Hi, according to RFC 2616:
Origin servers MUST include a Date header field in all responses, except in these cases: 1. If the response status code is 100 (Continue) or 101 (Switching Protocols), the response MAY include a Date header field, at the server's option. 2. If the response status code conveys a server error, e.g. 500 (Internal Server Error) or 503 (Service Unavailable), and it is inconvenient or impossible to generate a valid Date. 3. If the server does not have a clock that can provide a reasonable approximation of the current time, its responses MUST NOT include a Date header field. In this case, the rules in section 14.18.1 MUST be followed. So I've modified `evhttp_make_header_response' appropriately. Patch below: --- http.c.bak 2007-08-16 06:50:57.000000000 +0200 +++ http.c 2007-08-22 18:48:42.000000000 +0200 @@ -366,6 +366,25 @@ evhttp_make_header_response(struct evhtt evhttp_add_header(req->output_headers, "Content-Length", len); } + + /* + * Add required Date header to HTTP/1.1 responses. + * (Except those with status 100/1) + */ + if ((req->major == 1) + && (req->minor == 1) + && (req->response_code != 100) + && (req->response_code != 101)) { + static char date[50]; + static struct tm cur; + time_t t = time(NULL); + + gmtime_r(&t, &cur); + strftime(date, sizeof(date), + "%a, %d %b %Y %H:%M:%S GMT", &cur); + evhttp_add_header(req->output_headers, + "Date", date); + } } /* if the request asked for a close, we send a close, too */ -- Ralph Moritz Ph: +27 84 626 9070 GPG Public Key: http://ralphm.info/public.gpg _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users