AlixAbbasi / mongoose

Mongoose Embedded HTTP Server
MIT License
0 stars 0 forks source link

cache/expires keywords for mongoose on iphone #309

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
- (void)startHTTP:(NSString *)ports
{
...
mg_set_option(ctx, "cache", "no-cache");
mg_set_option(ctx, "cache-control", "no-cache");
mg_set_option(ctx, "expires", "Sat, 1 Jan 2022 05:00:00 GMT");

...
}

Are cache/cache-control/expires the correct keywords to use in order to control 
caching and expire dates?

What version of the product are you using? On what operating system?
ios/iphone

Original issue reported on code.google.com by zs...@vprex.com on 16 Jan 2012 at 9:52

GoogleCodeExporter commented 9 years ago
Just a quick follow-up:
Here are my settings and the mongoose response:

    mg_set_option(ctx, "cache", "no-cache");
    mg_set_option(ctx, "Cache-Control", "no-cache");
    mg_set_option(ctx, "Pragma", "no-cache");
    mg_set_option(ctx, "expires", "Tue, 1 Jan 2002 05:00:00 GMT");
    /*
     [1326782705] [error] [client 0.0.0.0] mg_set_option: No such option: [cache]
     [1326782151] [error] [client 0.0.0.0] mg_set_option: No such option: [Cache-Control]
     [1326782151] [error] [client 0.0.0.0] mg_set_option: No such option: [Pragma]
     [1326782151] [error] [client 0.0.0.0] mg_set_option: No such option: [expires]
     */

Original comment by zs...@vprex.com on 17 Jan 2012 at 12:50

GoogleCodeExporter commented 9 years ago
Is there an option list for mg_set_option? how can I force mongoose not to 
cache anything?

Thanks for taking a look.

Original comment by zs...@vprex.com on 17 Jan 2012 at 12:51

GoogleCodeExporter commented 9 years ago
Please let me know if you have any suggestions.. I am still trying to look for 
it but no luck yet still.

Original comment by zs...@vprex.com on 19 Jan 2012 at 7:18

GoogleCodeExporter commented 9 years ago
I think there is some misunderstanding going on here.
Mongoose options control server behavior, for example number of threads, 
etcetera.
Your code example clearly shows that you're trying to set HTTP headers in the 
response.
There is no way to configure custom headers appended to every response.
But if you're using callbacks, it could be done easily by mg_printf() -- just 
print the respective header/value.

Original comment by valenok on 19 Jan 2012 at 1:30

GoogleCodeExporter commented 9 years ago

Original comment by valenok on 22 Sep 2012 at 2:51