Having what I think is a timing issue with a client posting chunked data.
The client (java) request is marked as chunked but chunk_cb is not set when
evhttp_get_body is run for the request.  The question is how do I call
evhttp_request_set_chunked_cb early enough in the requests life to
set up a handler for each chunk?

For now I'm calling the requests callback from evhttp_get_body and the
handler
does evhttp_request_set_chunked_cb:

evhttp_get_body(struct evhttp_connection *evcon, struct evhttp_request *req)
{
const char *xfer_enc;
 /* If this is a request without a body, then we are done */
if (req->kind == EVHTTP_REQUEST && req->type != EVHTTP_REQ_POST) {
evhttp_connection_done(evcon);
return;
}
evcon->state = EVCON_READING_BODY;
xfer_enc = evhttp_find_header(req->input_headers, "Transfer-Encoding");
if (xfer_enc != NULL && strcasecmp(xfer_enc, "chunked") == 0) {
req->chunked = 1;
req->ntoread = -1;
// dispatch the request handler, it should set the
// chunked callback handler
(*req->cb)(req, req->cb_arg);
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to