libevent parse multipart formdata site:stackoverflow.com
void upload_cb(struct evhttp_request *req, void *arg){
struct bufferevent *bev = evhttp_connection_get_bufferevent(req->evcon);
if (bev) //Prio is initialized with 10 states in main
bufferevent_priority_set(bev, 9); // set to low priority
struct evbuffer* post_buffer = evhttp_request_get_input_buffer(req);
size_t body_size = evbuffer_get_length(post_buffer);
// a multipart parser takes care of writing the
// post_buffer content to a file
// this takes a few seconds and after completing this
// the status_cb is accessible again
}
void status_cb(struct evhttp_request *req, void *arg){
// send some json
}
evhttp_set_cb(_http, "/upload", upload_cb, NULL);
evhttp_set_cb(_http, "/status", status_cb, NULL);