I'm writing a service using libevent 2.1.5 (beta) that needs to support
relatively large (5-10GB) PUT requests (uploads) over local 10GB ethernet.
It'd be ideal if I could handle these in a chunked mode, just like when the
client handles chunked replies, rather than consume memory or split it into
zillions of small HTTP requests...
Along these lines (server side):
evhttp_accept_socket(http, nfd);
evhttp_set_cb(http, "/upload", http_upload, base);
static void http_upload(struct evhttp_request *req, void *arg) {
if (evhttp_request_get_command(req) == EVHTTP_REQ_POST) {
evhttp_request set_chunked_cb(req, http_upload_chunk);
}
}
static void http_upload_chunk(..) {handle uploaded chunk of data}
I'm trying to do it, but evhttp_request set_chunked_cb just complains it
is in the client mode.
Is that by design? Just not implemented? Am I doing something wrong?
Cheers,
Dmitry