I already review source code of libevent. Ur small code has same mean with
mine. However, Both are meaningless because function  *static char *
end_of_path(char *cp, int allow_qchars)* not allow '|' character. If uri
query contain '|' character then it response "bad request".

On Thu, Jan 13, 2011 at 9:51 AM, Nick Mathewson <[email protected]> wrote:

> On Wed, Jan 12, 2011 at 6:10 AM, Trong Long Dinh
> <[email protected]> wrote:
> > Hi all.
> > I setup a simple httpd like this:
> >
> >> #include <stdlib.h>
> >> #include <stdio.h>
> >> #include <time.h>
> >>
> >> #include <err.h>
> >> #include <event2/event.h>
> >> #include <event2/http.h>
> >> #include <event2/buffer.h>
> >>
> >> void now_handler(struct evhttp_request *req, void *arg) {
> >>     struct evbuffer *buf = evhttp_request_get_output_buffer(req);
> >>     evbuffer_add_printf(buf, "{\"now\":%d}", (int) time(NULL));
> >>     evhttp_send_reply(req, HTTP_OK, "OK", NULL);
> >> }
>
>
> That's not how you send a response, I think.  Instead do it more like:
>
>  struct evbuffer *buf = evbuffer_new();
>   evbuffer_add_printf(buf, "{\"now\":%d}", (int) time(NULL));
>   evhttp_send_reply(req, HTTP_OK, "OK", buf);
>  evbuffer_free(buf);
>
> If that doesn't work out for you, see if you can use some debugging
> tool to see what exactly firefox is saying to your server, and what
> your server is saying in response: that should make most protocol
> errors pretty apparent.
>
> yrs,
> --
> Nick
> ***********************************************************************
> To unsubscribe, send an e-mail to [email protected] with
> unsubscribe libevent-users    in the body.
>

Reply via email to