diff options
Diffstat (limited to 'src/nxt_http_request.c')
-rw-r--r-- | src/nxt_http_request.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index 2d6ccb42..06d45247 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -22,6 +22,16 @@ static const nxt_http_request_state_t nxt_http_request_init_state; static const nxt_http_request_state_t nxt_http_request_body_state; +nxt_time_string_t nxt_http_date_cache = { + (nxt_atomic_uint_t) -1, + nxt_http_date, + "%s, %02d %s %4d %02d:%02d:%02d GMT", + nxt_length("Wed, 31 Dec 1986 16:40:00 GMT"), + NXT_THREAD_TIME_GMT, + NXT_THREAD_TIME_SEC, +}; + + nxt_int_t nxt_http_init(nxt_task_t *task, nxt_runtime_t *rt) { @@ -278,15 +288,6 @@ nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r) u_char *p, *end; nxt_http_field_t *server, *date, *content_length; - static nxt_time_string_t date_cache = { - (nxt_atomic_uint_t) -1, - nxt_http_date, - "%s, %02d %s %4d %02d:%02d:%02d GMT", - nxt_length("Wed, 31 Dec 1986 16:40:00 GMT"), - NXT_THREAD_TIME_GMT, - NXT_THREAD_TIME_SEC, - }; - /* * TODO: "Server", "Date", and "Content-Length" processing should be moved * to the last header filter. @@ -307,15 +308,15 @@ nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r) nxt_http_field_name_set(date, "Date"); - p = nxt_mp_nget(r->mem_pool, date_cache.size); + p = nxt_mp_nget(r->mem_pool, nxt_http_date_cache.size); if (nxt_slow_path(p == NULL)) { goto fail; } - (void) nxt_thread_time_string(task->thread, &date_cache, p); + (void) nxt_thread_time_string(task->thread, &nxt_http_date_cache, p); date->value = p; - date->value_length = date_cache.size; + date->value_length = nxt_http_date_cache.size; r->resp.date = date; } |