diff options
author | Valentin Bartenev <vbart@nginx.com> | 2019-09-19 02:47:09 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2019-09-19 02:47:09 +0300 |
commit | 08a8d1510d5f73d91112ead9e6ac075fb7d2bac0 (patch) | |
tree | f4dceb5af955f40820b0edbde4bdae41084c80ce /src/nxt_http_request.c | |
parent | c554941b4f826d83d92d5ca8d7713bea4167896e (diff) | |
download | unit-08a8d1510d5f73d91112ead9e6ac075fb7d2bac0.tar.gz unit-08a8d1510d5f73d91112ead9e6ac075fb7d2bac0.tar.bz2 |
Basic support for serving static files.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_http_request.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index 8c38eeb2..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, }; @@ -578,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); } |