From: Anthony Minessale Date: Mon, 27 Aug 2012 21:13:21 +0000 (-0500) Subject: add cache param to httapi X-Git-Tag: v1.2.3^2~158^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8b89bcc1e6d0e5363e7e1ff08d325297568e4eb;p=thirdparty%2Ffreeswitch.git add cache param to httapi --- diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 0dbb722f5e..887dae3891 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2276,7 +2276,9 @@ static char *load_cache_data(http_file_context_t *context, const char *url) if ((p = strchr(meta_buffer, ':'))) { *p++ = '\0'; - context->expires = (time_t) atol(meta_buffer); + if (context->expires != 1) { + context->expires = (time_t) atol(meta_buffer); + } context->metadata = switch_core_strdup(context->pool, p); } } @@ -2522,7 +2524,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char load_cache_data(context, url); - if (context->expires && now < context->expires) { + if (context->expires > 1 && now < context->expires) { return SWITCH_STATUS_SUCCESS; } @@ -2614,7 +2616,13 @@ static switch_status_t http_file_file_open(switch_file_handle_t *handle, const c switch_event_create_brackets(pdup, '(', ')', ',', &context->url_params, &parsed, SWITCH_FALSE); if (context->url_params) { + const char *var; context->ua = switch_event_get_header(context->url_params, "ua"); + + if ((var = switch_event_get_header(context->url_params, "cache")) && !switch_true(var)) { + context->expires = 1; + } + } if (parsed) path = parsed;