evhttp chunked response bug?
2009-09-04 06:40:39 GMT
Hi, there, I'm reading evhttp's source code, and I'm not sure if I've found a bug, or I just mis-read it. But it seems to me, when I do chunked encoding on response, I'd call three functions sequentially somehow, evhttp_send_reply_start(req, ...); evhttp_send_reply_chunk(req, ...); evhttp_send_reply_end(req, ...); Here's the problem, if any of the 1st two fails to send some packets, i.e., evbuffer_write() returned -1 or 0, it will call evhttp_connection_fail(), which will free the request eventually if connection needs to be closed by evhttp_connection_free(). Now, how does my subsequent call know "req" is freed? Wouldn't that cause crashes, if I simply call those 3 functions in a row? Or did I miss some correct way of calling them? Thanks. -Haiping