On Wed, Jan 12, 2011 at 6:10 AM, Trong Long Dinh
<
tronglongcntt@xxxxxxxxx> 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: