Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#290 evhttp_error_cb when reading body EOF

open
nobody
5
2012-10-15
2012-10-15
balanceren
No

For some web server, the connecting close when read eof
static void
evhttp_error_cb(struct bufferevent *bufev, short what, void *arg)
......
case EVCON_READING_BODY:
if (!req->chunked && req->ntoread < 0
&& what == (BEV_EVENT_READING|BEV_EVENT_EOF)) {
/* EOF on read can be benign */
evcon->flags |= EVHTTP_CON_CLOSEEOF; //add flag

when call
evhttp_connection_done
.....
need_close = (evcon->flags & EVHTTP_CON_CLOSEEOF) ||
evhttp_is_connection_close(req->flags, req->input_headers)||
evhttp_is_connection_close(req->flags, req->output_headers);

Discussion

  • Nick Mathewson
    Nick Mathewson
    2012-10-16

    Is there a test for this, or a patch? I'm not sure I understand what you're saying.

    Have you tried "libevhtp"? It's what we generally recommend now in place of evhttp.

     
  • balanceren
    balanceren
    2012-10-16

    It is a patch.
    I found the bug one years ago, and make this patch in early version
    recently,I updated to the latest version2.0.20, the problem still exists.
    sorry for my poor English,and I am not familiar with the process of patching

     
  • Nick Mathewson
    Nick Mathewson
    2012-10-16

    Is it possible to find documentation in your language for using the tool "diff" or "git diff" to generate a patch? Patches are much easier to apply than what you're doing above.

    To understand what the issue is, it would be good to have some test code that demonstrates how the bug happens and how this fixes it.

    Also, you might want to use libevhtp instad of evhttp: it is a much better http library for libevent.