summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_request.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_http_request.c')
-rw-r--r--src/nxt_http_request.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c
index 916004d2..a18a02e7 100644
--- a/src/nxt_http_request.c
+++ b/src/nxt_http_request.c
@@ -17,8 +17,8 @@ static void nxt_http_request_mem_buf_completion(nxt_task_t *task, void *obj,
void *data);
static void nxt_http_request_done(nxt_task_t *task, void *obj, void *data);
-static u_char *nxt_http_date(u_char *buf, nxt_realtime_t *now, struct tm *tm,
- size_t size, const char *format);
+static u_char *nxt_http_date_cache_handler(u_char *buf, nxt_realtime_t *now,
+ struct tm *tm, size_t size, const char *format);
static const nxt_http_request_state_t nxt_http_request_init_state;
@@ -27,9 +27,9 @@ 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_http_date_cache_handler,
+ NULL,
+ NXT_HTTP_DATE_LEN,
NXT_THREAD_TIME_GMT,
NXT_THREAD_TIME_SEC,
};
@@ -369,7 +369,8 @@ nxt_http_request_read_body(nxt_task_t *task, nxt_http_request_t *r)
void
-nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r)
+nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r,
+ nxt_work_handler_t body_handler)
{
u_char *p, *end;
nxt_http_field_t *server, *date, *content_length;
@@ -430,7 +431,7 @@ nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r)
}
if (nxt_fast_path(r->proto.any != NULL)) {
- nxt_http_proto[r->protocol].header_send(task, r);
+ nxt_http_proto[r->protocol].header_send(task, r, body_handler);
}
return;
@@ -577,17 +578,8 @@ nxt_http_request_close_handler(nxt_task_t *task, void *obj, void *data)
static u_char *
-nxt_http_date(u_char *buf, nxt_realtime_t *now, struct tm *tm, size_t size,
- const char *format)
+nxt_http_date_cache_handler(u_char *buf, nxt_realtime_t *now, struct tm *tm,
+ size_t size, const char *format)
{
- static const char *week[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri",
- "Sat" };
-
- static const char *month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-
- return nxt_sprintf(buf, buf + size, format,
- week[tm->tm_wday], tm->tm_mday,
- month[tm->tm_mon], tm->tm_year + 1900,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
+ return nxt_http_date(buf, tm);
}