diff --git a/src/evhttp/evhttp.h b/src/evhttp/evhttp.h index 68bcff96..1f3ac4b4 100644 --- a/src/evhttp/evhttp.h +++ b/src/evhttp/evhttp.h @@ -64,6 +64,7 @@ extern "C" { struct evhttp; struct evhttp_request; struct evkeyvalq; +struct evhttp_connection; /** Create a new HTTP server * @@ -159,6 +160,8 @@ void evhttp_send_reply(struct evhttp_request *req, int code, /* Low-level response interface, for streaming/chunked replies */ void evhttp_send_reply_start(struct evhttp_request *, int, const char *); +void evhttp_send_reply_chunk_with_cb(struct evhttp_request *, struct evbuffer *, + void (*cb)(struct evhttp_connection *, void *), void *arg); void evhttp_send_reply_chunk(struct evhttp_request *, struct evbuffer *); void evhttp_send_reply_end(struct evhttp_request *); diff --git a/src/evhttp/http.c b/src/evhttp/http.c index bfd838d5..4b76d4c4 100644 --- a/src/evhttp/http.c +++ b/src/evhttp/http.c @@ -1963,7 +1963,8 @@ evhttp_send_reply_start(struct evhttp_request *req, int code, } void -evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf) +evhttp_send_reply_chunk_with_cb(struct evhttp_request *req, struct evbuffer *databuf, + void (*cb)(struct evhttp_connection *, void *), void *arg) { if (req->chunked) { evbuffer_add_printf(req->evcon->output_buffer, "%x\r\n", @@ -1973,7 +1974,13 @@ evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf) if (req->chunked) { evbuffer_add(req->evcon->output_buffer, "\r\n", 2); } - evhttp_write_buffer(req->evcon, NULL, NULL); + evhttp_write_buffer(req->evcon, cb, arg); +} + +void +evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf) +{ + evhttp_send_reply_chunk_with_cb(req, databuf, NULL, NULL); } void