Ralph Moritz wrote: > On 22/08/07, Elliot Foster <[EMAIL PROTECTED]> wrote: >> Ralph Moritz wrote: >>> Good point.After submitting this,I also realized that I forgot to >>> check the return value of strftime(). >> For that matter, why limit it to 1.1? 1.0 allows the Date header as well >> (RFC1945, 10.6). Also, thank you for adding this. > > Modified patch below: > > --- http.c.bak 2007-08-16 06:50:57.000000000 +0200 > +++ http.c 2007-08-23 09:11:50.000000000 +0200 > @@ -366,6 +366,20 @@ evhttp_make_header_response(struct evhtt > evhttp_add_header(req->output_headers, > "Content-Length", len); > } > + > + /* Add Date header. (Required by HTTP/1.1) */ > + char date[50]; > + struct tm cur; > + time_t t = time(NULL); > + int l; > + > + gmtime_r(&t, &cur); > + l = strftime(date, sizeof(date), > + "%a, %d %b %Y %H:%M:%S GMT", &cur); > + if (l != 0) { > + evhttp_add_header(req->output_headers, > + "Date", date); > + } > } > > /* if the request asked for a close, we send a close, too */ >
This patch will break on non C99 compilers with mixed declaration/code errors. Please move the declarations up to the start of this block. cheers, Jan -- jan: "Gee, Brain^WEric, what'd you wanna do tonight?" eric: Same thing we do everynight: Take over the HelloWorld! _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users