Hi,
I have come across what seems to be a bug in http implementation, where an http server does not detect closed connections until the next time it attempts to write something.
After some investigation I found the issue in evhttp_write_buffer() from http.c. There is a comment there that says:
"We don't disable reading, since we *do* want to learn about any close events"
However reading is already disabled so it needs to be enabled for close events to be sent. Once I enabled reading the above problem was solved and the http server was able to properly detect connections closed by the client and send a close event.
I am new to libevent, happy to send a patch if desirable but first wanted to run it by someone.