From 538ab57b6e0679ea889cc5658249c49073edf56d Mon Sep 17 00:00:00 2001 From: Unbit Date: Tue, 16 Apr 2013 18:56:25 +0200 Subject: [PATCH] extend magic cache api to export the expires value (if available) --- core/cache.c | 29 +++++++++++++++++++++++++++-- core/protocol.c | 4 ++-- core/static.c | 24 ++++++++++++------------ core/writer.c | 11 +++++++++++ plugins/cache/cache.c | 14 +++++++++----- plugins/go/src/uwsgi/uwsgi.go | 2 +- plugins/jvm/jvm_plugin.c | 2 +- plugins/lua/lua_plugin.c | 2 +- plugins/mono/mono_plugin.c | 2 +- plugins/php/php_plugin.c | 2 +- plugins/psgi/uwsgi_plmodule.c | 2 +- plugins/python/uwsgi_pymodule.c | 2 +- plugins/rack/rack_api.c | 2 +- plugins/router_cache/router_cache.c | 6 +++++- plugins/ssi/ssi.c | 2 +- uwsgi.h | 6 +++++- 16 files changed, 80 insertions(+), 32 deletions(-) diff --git a/core/cache.c b/core/cache.c index 6442a1f8..c3c90e93 100644 --- a/core/cache.c +++ b/core/cache.c @@ -382,6 +382,28 @@ char *uwsgi_cache_get2(struct uwsgi_cache *uc, char *key, uint16_t keylen, uint6 return NULL; } +char *uwsgi_cache_get3(struct uwsgi_cache *uc, char *key, uint16_t keylen, uint64_t * valsize, uint64_t *expires) { + + uint64_t index = uwsgi_cache_get_index(uc, key, keylen); + + if (index) { + struct uwsgi_cache_item *uci = cache_item(index); + if (uci->flags & UWSGI_CACHE_FLAG_UNGETTABLE) + return NULL; + *valsize = uci->valsize; + if (expires) + *expires = uci->expires; + uci->hits++; + uc->hits++; + return uc->data + (uci->first_block * uc->blocksize); + } + + uc->miss++; + + return NULL; +} + + int uwsgi_cache_del2(struct uwsgi_cache *uc, char *key, uint16_t keylen, uint64_t index, uint16_t flags) { struct uwsgi_cache_item *uci; @@ -1249,7 +1271,7 @@ static int cache_magic_send_and_manage(int fd, struct uwsgi_buffer *ub, char *st return 0; } -char *uwsgi_cache_magic_get(char *key, uint16_t keylen, uint64_t *vallen, char *cache) { +char *uwsgi_cache_magic_get(char *key, uint16_t keylen, uint64_t *vallen, uint64_t *expires, char *cache) { struct uwsgi_cache_magic_context ucmc; struct uwsgi_cache *uc = NULL; char *cache_server = NULL; @@ -1274,7 +1296,7 @@ char *uwsgi_cache_magic_get(char *key, uint16_t keylen, uint64_t *vallen, char * // we have a local cache !!! if (uc) { uwsgi_rlock(uc->lock); - char *value = uwsgi_cache_get2(uc, key, keylen, vallen); + char *value = uwsgi_cache_get3(uc, key, keylen, vallen, expires); if (!value) { uwsgi_rwunlock(uc->lock); return NULL; @@ -1344,6 +1366,9 @@ char *uwsgi_cache_magic_get(char *key, uint16_t keylen, uint64_t *vallen, char * ub->buf = NULL; uwsgi_buffer_destroy(ub); *vallen = ucmc.size; + if (expires) { + *expires = ucmc.expires; + } return value; } diff --git a/core/protocol.c b/core/protocol.c index 3ebfd447..9afe8d39 100644 --- a/core/protocol.c +++ b/core/protocol.c @@ -739,7 +739,7 @@ next: // check if data are available in the local cache if (wsgi_req->cache_get_len > 0) { uint64_t cache_value_size; - char *cache_value = uwsgi_cache_magic_get(wsgi_req->cache_get, wsgi_req->cache_get_len, &cache_value_size, NULL); + char *cache_value = uwsgi_cache_magic_get(wsgi_req->cache_get, wsgi_req->cache_get_len, &cache_value_size, NULL, NULL); if (cache_value && cache_value_size > 0) { uwsgi_response_write_body_do(wsgi_req, cache_value, cache_value_size); free(cache_value); @@ -750,7 +750,7 @@ next: if (uwsgi.check_cache && wsgi_req->uri_len && wsgi_req->method_len == 3 && wsgi_req->method[0] == 'G' && wsgi_req->method[1] == 'E' && wsgi_req->method[2] == 'T') { uint64_t cache_value_size; - char *cache_value = uwsgi_cache_magic_get(wsgi_req->uri, wsgi_req->uri_len, &cache_value_size, NULL); + char *cache_value = uwsgi_cache_magic_get(wsgi_req->uri, wsgi_req->uri_len, &cache_value_size, NULL, NULL); if (cache_value && cache_value_size > 0) { uwsgi_response_write_body_do(wsgi_req, cache_value, cache_value_size); free(cache_value); diff --git a/core/static.c b/core/static.c index b437eaf7..c40211c5 100644 --- a/core/static.c +++ b/core/static.c @@ -55,7 +55,7 @@ gzip: return 1; } -static int set_http_date(time_t t, char *dst) { +int uwsgi_http_date(time_t t, char *dst) { static char *week[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static char *months[] = { @@ -179,7 +179,7 @@ int uwsgi_add_expires_type(struct wsgi_request *wsgi_req, char *mime_type, int m while (udd) { if (!uwsgi_strncmp(udd->key, udd->keylen, mime_type, mime_type_len)) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(now + delta, expires); + int size = uwsgi_http_date(now + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -192,7 +192,7 @@ int uwsgi_add_expires_type(struct wsgi_request *wsgi_req, char *mime_type, int m while (udd) { if (!uwsgi_strncmp(udd->key, udd->keylen, mime_type, mime_type_len)) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(st->st_mtime + delta, expires); + int size = uwsgi_http_date(st->st_mtime + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -215,7 +215,7 @@ int uwsgi_add_expires(struct wsgi_request *wsgi_req, char *filename, int filenam while (udd) { if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, filename, filename_len) >= 0) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(now + delta, expires); + int size = uwsgi_http_date(now + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -228,7 +228,7 @@ int uwsgi_add_expires(struct wsgi_request *wsgi_req, char *filename, int filenam while (udd) { if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, filename, filename_len) >= 0) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(st->st_mtime + delta, expires); + int size = uwsgi_http_date(st->st_mtime + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -250,7 +250,7 @@ int uwsgi_add_expires_path_info(struct wsgi_request *wsgi_req, struct stat *st) while (udd) { if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->path_info, wsgi_req->path_info_len) >= 0) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(now + delta, expires); + int size = uwsgi_http_date(now + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -263,7 +263,7 @@ int uwsgi_add_expires_path_info(struct wsgi_request *wsgi_req, struct stat *st) while (udd) { if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->path_info, wsgi_req->path_info_len) >= 0) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(st->st_mtime + delta, expires); + int size = uwsgi_http_date(st->st_mtime + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -285,7 +285,7 @@ int uwsgi_add_expires_uri(struct wsgi_request *wsgi_req, struct stat *st) { while (udd) { if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->uri, wsgi_req->uri_len) >= 0) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(now + delta, expires); + int size = uwsgi_http_date(now + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -298,7 +298,7 @@ int uwsgi_add_expires_uri(struct wsgi_request *wsgi_req, struct stat *st) { while (udd) { if (uwsgi_regexp_match(udd->pattern, udd->pattern_extra, wsgi_req->uri, wsgi_req->uri_len) >= 0) { int delta = uwsgi_str_num(udd->value, udd->vallen); - int size = set_http_date(st->st_mtime + delta, expires); + int size = uwsgi_http_date(st->st_mtime + delta, expires); if (size > 0) { if (uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, size)) return -1; } @@ -497,14 +497,14 @@ int uwsgi_real_file_serve(struct wsgi_request *wsgi_req, char *real_filename, si if (uwsgi.file_serve_mode == 1) { if (uwsgi_response_add_header(wsgi_req, "X-Accel-Redirect", 16, real_filename, real_filename_len)) return -1; // this is the final header (\r\n added) - int size = set_http_date(st->st_mtime, http_last_modified); + int size = uwsgi_http_date(st->st_mtime, http_last_modified); if (uwsgi_response_add_header(wsgi_req, "Last-Modified", 13, http_last_modified, size)) return -1; } // apache else if (uwsgi.file_serve_mode == 2) { if (uwsgi_response_add_header(wsgi_req, "X-Sendfile", 10, real_filename, real_filename_len)) return -1; // this is the final header (\r\n added) - int size = set_http_date(st->st_mtime, http_last_modified); + int size = uwsgi_http_date(st->st_mtime, http_last_modified); if (uwsgi_response_add_header(wsgi_req, "Last-Modified", 13, http_last_modified, size)) return -1; } // raw @@ -519,7 +519,7 @@ int uwsgi_real_file_serve(struct wsgi_request *wsgi_req, char *real_filename, si // here use teh original size !!! if (uwsgi_response_add_content_range(wsgi_req, wsgi_req->range_from, wsgi_req->range_to, st->st_size)) return -1; } - int size = set_http_date(st->st_mtime, http_last_modified); + int size = uwsgi_http_date(st->st_mtime, http_last_modified); if (uwsgi_response_add_header(wsgi_req, "Last-Modified", 13, http_last_modified, size)) return -1; // if it is a HEAD request just skip transfer diff --git a/core/writer.c b/core/writer.c index 4624f689..f9b4c836 100644 --- a/core/writer.c +++ b/core/writer.c @@ -12,6 +12,17 @@ int uwsgi_response_add_content_length(struct wsgi_request *wsgi_req, uint64_t cl return uwsgi_response_add_header(wsgi_req, "Content-Length", 14, buf, ret); } +int uwsgi_response_add_expires(struct wsgi_request *wsgi_req, uint64_t t) { + // 30+1 + char expires[31]; + int len = uwsgi_http_date((time_t) t, expires); + if (!len) { + wsgi_req->write_errors++; + return -1; + } + return uwsgi_response_add_header(wsgi_req, "Expires", 7, expires, len); +} + int uwsgi_response_add_content_range(struct wsgi_request *wsgi_req, uint64_t start, uint64_t end, uint64_t cl) { char buf[6+(sizeof(UMAX64_STR)*3)+4]; if (end == 0) { diff --git a/plugins/cache/cache.c b/plugins/cache/cache.c index fdfed8cd..c0da1fc8 100644 --- a/plugins/cache/cache.c +++ b/plugins/cache/cache.c @@ -40,7 +40,7 @@ static void cache_simple_command(char *key, uint16_t keylen, char *val, uint16_t if (vallen > 0) { if (!uwsgi_strncmp(key, keylen, "key", 3)) { uint64_t vallen = 0; - char *value = uwsgi_cache_magic_get(val, vallen, &vallen, NULL); + char *value = uwsgi_cache_magic_get(val, vallen, &vallen, NULL, NULL); if (value) { uwsgi_response_write_body_do(wsgi_req, value, vallen); free(value); @@ -49,7 +49,7 @@ static void cache_simple_command(char *key, uint16_t keylen, char *val, uint16_t } else if (!uwsgi_strncmp(key, keylen, "get", 3)) { uint64_t vallen = 0; - char *value = uwsgi_cache_magic_get(val, vallen, &vallen, NULL); + char *value = uwsgi_cache_magic_get(val, vallen, &vallen, NULL, NULL); if (value) { uwsgi_response_write_body_do(wsgi_req, value, vallen); free(value); @@ -77,8 +77,9 @@ static void manage_magic_context(struct wsgi_request *wsgi_req, struct uwsgi_cac // cache get if (!uwsgi_strncmp(ucmc->cmd, ucmc->cmd_len, "get", 3)) { uint64_t vallen = 0; + uint64_t expires = 0; uwsgi_rlock(uc->lock); - char *value = uwsgi_cache_get2(uc, ucmc->key, ucmc->key_len, &vallen); + char *value = uwsgi_cache_get3(uc, ucmc->key, ucmc->key_len, &vallen, &expires); if (!value) { uwsgi_rwunlock(uc->lock); return; @@ -88,6 +89,9 @@ static void manage_magic_context(struct wsgi_request *wsgi_req, struct uwsgi_cac ub->pos = 4; if (uwsgi_buffer_append_keyval(ub, "status", 6, "ok", 2)) goto error; if (uwsgi_buffer_append_keynum(ub, "size", 4, vallen)) goto error; + if (expires) { + if (uwsgi_buffer_append_keynum(ub, "expires", 7, expires)) goto error; + } if (uwsgi_buffer_set_uh(ub, 111, 17)) goto error; if (uwsgi_buffer_append(ub, value, vallen)) goto error; // unlock !!! @@ -205,7 +209,7 @@ static int uwsgi_cache_request(struct wsgi_request *wsgi_req) { case 0: // get if (wsgi_req->uh->pktsize > 0) { - value = uwsgi_cache_magic_get(wsgi_req->buffer, wsgi_req->uh->pktsize, &vallen, NULL); + value = uwsgi_cache_magic_get(wsgi_req->buffer, wsgi_req->uh->pktsize, &vallen, NULL, NULL); if (value) { wsgi_req->uh->pktsize = vallen; if (uwsgi_response_write_body_do(wsgi_req, (char *)&wsgi_req->uh, 4)) { free(value) ; return -1;} @@ -242,7 +246,7 @@ static int uwsgi_cache_request(struct wsgi_request *wsgi_req) { case 5: // get (uwsgi + stream) if (wsgi_req->uh->pktsize > 0) { - value = uwsgi_cache_magic_get(wsgi_req->buffer, wsgi_req->uh->pktsize, &vallen, NULL); + value = uwsgi_cache_magic_get(wsgi_req->buffer, wsgi_req->uh->pktsize, &vallen, NULL, NULL); if (value) { wsgi_req->uh->pktsize = 0; wsgi_req->uh->modifier2 = 1; diff --git a/plugins/go/src/uwsgi/uwsgi.go b/plugins/go/src/uwsgi/uwsgi.go index 334b5be9..2fb5226a 100644 --- a/plugins/go/src/uwsgi/uwsgi.go +++ b/plugins/go/src/uwsgi/uwsgi.go @@ -150,7 +150,7 @@ func CacheGet(key string, cache string) []byte { var p []byte - c_value := C.uwsgi_cache_magic_get(k, C.uint16_t(kl), &vl, c) + c_value := C.uwsgi_cache_magic_get(k, C.uint16_t(kl), &vl, (*C.uint64_t)(nil), c) if c_value != nil { p = C.GoBytes((unsafe.Pointer)(c_value), C.int(vl)) diff --git a/plugins/jvm/jvm_plugin.c b/plugins/jvm/jvm_plugin.c index e8b1645e..0658b6ee 100644 --- a/plugins/jvm/jvm_plugin.c +++ b/plugins/jvm/jvm_plugin.c @@ -79,7 +79,7 @@ JNIEXPORT jobject JNICALL uwsgi_jvm_api_cache_get(JNIEnv *env, jclass c, jstring size_t keylen = uwsgi_jvm_strlen(jkey); char *key = uwsgi_jvm_str2c(jkey); uint64_t vallen = 0; - char *value = uwsgi_cache_magic_get(key, keylen, &vallen, NULL); + char *value = uwsgi_cache_magic_get(key, keylen, &vallen, NULL, NULL); uwsgi_jvm_release_chars(jkey, key); if (value) { jobject o = uwsgi_jvm_bytearray(value, vallen); diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c index 8f799d4d..fe716967 100644 --- a/plugins/lua/lua_plugin.c +++ b/plugins/lua/lua_plugin.c @@ -276,7 +276,7 @@ static int uwsgi_api_cache_get(lua_State *L) { if (argc > 1) { cache = lua_tolstring(L, 2, NULL); } - value = uwsgi_cache_magic_get((char *)key, keylen, &valsize, (char *)cache); + value = uwsgi_cache_magic_get((char *)key, keylen, &valsize, NULL, (char *)cache); if (value) { lua_pushlstring(L, value, valsize); free(value); diff --git a/plugins/mono/mono_plugin.c b/plugins/mono/mono_plugin.c index d32f8a5a..fb8e7bc2 100644 --- a/plugins/mono/mono_plugin.c +++ b/plugins/mono/mono_plugin.c @@ -267,7 +267,7 @@ static MonoArray *uwsgi_mono_method_api_CacheGet(MonoString *key, MonoString *ca c_cache = mono_string_to_utf8(cache); } uint64_t vallen = 0 ; - char *value = uwsgi_cache_magic_get(c_key, c_keylen, &vallen, c_cache); + char *value = uwsgi_cache_magic_get(c_key, c_keylen, &vallen, NULL, c_cache); if (value) { MonoArray *ret = mono_array_new(mono_domain_get(), umono.byte_class, vallen); char *buf = mono_array_addr(ret, char, 0); diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c index 3e6ae912..c7173580 100644 --- a/plugins/php/php_plugin.c +++ b/plugins/php/php_plugin.c @@ -309,7 +309,7 @@ PHP_FUNCTION(uwsgi_cache_get) { RETURN_NULL(); } - char *value = uwsgi_cache_magic_get(key, keylen, &valsize, cache); + char *value = uwsgi_cache_magic_get(key, keylen, &valsize, NULL, cache); if (value) { char *ret = estrndup(value, valsize); free(value); diff --git a/plugins/psgi/uwsgi_plmodule.c b/plugins/psgi/uwsgi_plmodule.c index 69d940dd..a0345df4 100644 --- a/plugins/psgi/uwsgi_plmodule.c +++ b/plugins/psgi/uwsgi_plmodule.c @@ -136,7 +136,7 @@ XS(XS_cache_get) { cache = SvPV_nolen(ST(1)); } - char *value = uwsgi_cache_magic_get(key, (uint16_t) keylen, &vallen, cache); + char *value = uwsgi_cache_magic_get(key, (uint16_t) keylen, &vallen, NULL, cache); if (value) { ST(0) = newSVpv(value, vallen); free(value); diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 68a2d4fd..b664423b 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -2925,7 +2925,7 @@ PyObject *py_uwsgi_cache_get(PyObject * self, PyObject * args) { uint64_t vallen = 0; UWSGI_RELEASE_GIL - char *value = uwsgi_cache_magic_get(key, keylen, &vallen, cache); + char *value = uwsgi_cache_magic_get(key, keylen, &vallen, NULL, cache); UWSGI_GET_GIL if (value) { // in python 3.x we return bytes diff --git a/plugins/rack/rack_api.c b/plugins/rack/rack_api.c index a303c736..e56b36c3 100644 --- a/plugins/rack/rack_api.c +++ b/plugins/rack/rack_api.c @@ -463,7 +463,7 @@ VALUE rack_uwsgi_cache_get(int argc, VALUE *argv, VALUE *class) { } uint64_t vallen = 0;; - char *value = uwsgi_cache_magic_get(key, keylen, &vallen, cache); + char *value = uwsgi_cache_magic_get(key, keylen, &vallen, NULL, cache); if (value) { VALUE res = rb_str_new(value, vallen); free(value); diff --git a/plugins/router_cache/router_cache.c b/plugins/router_cache/router_cache.c index 944c79db..7a2f416b 100644 --- a/plugins/router_cache/router_cache.c +++ b/plugins/router_cache/router_cache.c @@ -109,7 +109,8 @@ static int uwsgi_routing_func_cache(struct wsgi_request *wsgi_req, struct uwsgi_ if (!ub) return UWSGI_ROUTE_BREAK; uint64_t valsize = 0; - char *value = uwsgi_cache_magic_get(ub->buf, ub->pos, &valsize, urcc->name); + uint64_t expires = 0; + char *value = uwsgi_cache_magic_get(ub->buf, ub->pos, &valsize, &expires, urcc->name); if (urcc->mime && value) { mime_type = uwsgi_get_mime_type(ub->buf, ub->pos, &mime_type_len); } @@ -125,6 +126,9 @@ static int uwsgi_routing_func_cache(struct wsgi_request *wsgi_req, struct uwsgi_ if (urcc->content_encoding_len) { if (uwsgi_response_add_header(wsgi_req, "Content-Encoding", 16, urcc->content_encoding, urcc->content_encoding_len)) goto error; } + if (expires) { + if (uwsgi_response_add_expires(wsgi_req, expires)) goto error; + } if (uwsgi_response_add_content_length(wsgi_req, valsize)) goto error; uwsgi_response_write_body_do(wsgi_req, value, valsize); free(value); diff --git a/plugins/ssi/ssi.c b/plugins/ssi/ssi.c index 9ec33ed5..892c61be 100644 --- a/plugins/ssi/ssi.c +++ b/plugins/ssi/ssi.c @@ -444,7 +444,7 @@ static struct uwsgi_buffer *ssi_cmd_cache(struct wsgi_request *wsgi_req, struct } uint64_t rlen = 0; - char *value = uwsgi_cache_magic_get(var, var_len, &rlen, cache_name); + char *value = uwsgi_cache_magic_get(var, var_len, &rlen, NULL, cache_name); if (cache_name) free(cache_name); struct uwsgi_buffer *ub = NULL; if (value) { diff --git a/uwsgi.h b/uwsgi.h index 0cbad038..2c485618 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -2708,6 +2708,7 @@ ssize_t uwsgi_send_message(int, uint8_t, uint8_t, char *, uint16_t, int, ssize_t int uwsgi_cache_set2(struct uwsgi_cache *, char *, uint16_t, char *, uint64_t, uint64_t, uint64_t); int uwsgi_cache_del2(struct uwsgi_cache *, char *, uint16_t, uint64_t, uint16_t); char *uwsgi_cache_get2(struct uwsgi_cache *, char *, uint16_t, uint64_t *); +char *uwsgi_cache_get3(struct uwsgi_cache *, char *, uint16_t, uint64_t *, uint64_t *); uint32_t uwsgi_cache_exists2(struct uwsgi_cache *, char *, uint16_t); struct uwsgi_cache *uwsgi_cache_create(char *); struct uwsgi_cache *uwsgi_cache_by_name(char *); @@ -3791,6 +3792,7 @@ ssize_t uwsgi_sendfile_do(int, int, size_t, size_t); int uwsgi_proto_base_fix_headers(struct wsgi_request *); int uwsgi_response_add_content_length(struct wsgi_request *, uint64_t); int uwsgi_response_add_content_range(struct wsgi_request *, uint64_t, uint64_t, uint64_t); +int uwsgi_response_add_expires(struct wsgi_request *, uint64_t); const char *uwsgi_http_status_msg(char *, uint16_t *); int uwsgi_stats_dump_vars(struct uwsgi_stats *, struct uwsgi_core *); @@ -3884,7 +3886,7 @@ struct uwsgi_cache_magic_context { uint16_t cache_len; }; -char *uwsgi_cache_magic_get(char *, uint16_t, uint64_t *, char *); +char *uwsgi_cache_magic_get(char *, uint16_t, uint64_t *, uint64_t *, char *); int uwsgi_cache_magic_set(char *, uint16_t, char *, uint64_t, uint64_t, uint64_t, char *); int uwsgi_cache_magic_del(char *, uint16_t, char *); int uwsgi_cache_magic_exists(char *, uint16_t, char *); @@ -3916,6 +3918,8 @@ int uwsgi_blob_to_response(struct wsgi_request *, char *, size_t); struct uwsgi_cron *uwsgi_cron_add(char *); int uwsgi_is_full_http(struct uwsgi_buffer *); +int uwsgi_http_date(time_t t, char *); + void uwsgi_check_emperor(void); #ifdef UWSGI_AS_SHARED_LIBRARY int uwsgi_init(int, char **, char **);