And you also need to check if there is a Date header already.  You
don't want it to appear twice.

Niels.

On 8/23/07, Ralph Moritz <[EMAIL PROTECTED]> wrote:
> On 23/08/07, Jan Kneschke <[EMAIL PROTECTED]> wrote:
> > This patch will break on non C99 compilers with mixed declaration/code
> > errors. Please move the declarations up to the start of this block.
>
> Thanks for spotting that. New patch below. Hopefully this one's kosher.
>
> --- http.c.bak  2007-08-16 06:50:57.000000000 +0200
> +++ http.c      2007-08-23 12:11:50.000000000 +0200
> @@ -345,6 +345,20 @@ evhttp_make_header_response(struct evhtt
>
>         /* Potentially add headers for unidentified content. */
>         if (EVBUFFER_LENGTH(req->output_buffer)) {
> +               /* 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 (evhttp_find_header(req->output_headers,
>                         "Content-Type") == NULL) {
>                         evhttp_add_header(req->output_headers,
>
>
> --
> 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
>
>
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to