err = evbuffer_drain(tmp, -1);
EVUTIL_ASSERT(!err && "drain input");
+ evcon->flags &= ~EVHTTP_CON_READING_ERROR;
+
evcon->state = EVCON_DISCONNECTED;
}
{
struct evbuffer *buf;
- evcon->state = EVCON_READING_FIRSTLINE;
+ /** Second time, we can't read anything */
+ if (evcon->flags & EVHTTP_CON_READING_ERROR) {
+ evcon->flags &= ~EVHTTP_CON_READING_ERROR;
+ evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
+ return;
+ }
+
req->kind = EVHTTP_RESPONSE;
buf = bufferevent_get_output(evcon->bufev);
evbuffer_drain(buf, evbuffer_get_length(buf));
evbuffer_freeze(buf, 1);
- bufferevent_setcb(evcon->bufev,
- evhttp_read_cb,
- NULL, /* evhttp_write_cb */
- evhttp_error_cb,
- evcon);
- evhttp_connection_start_detectclose(evcon);
+ evhttp_start_read_(evcon);
evcon->flags |= EVHTTP_CON_READING_ERROR;
}
*/
if (evcon->flags & EVHTTP_CON_CLOSEDETECT) {
evcon->flags &= ~EVHTTP_CON_CLOSEDETECT;
- if (evcon->flags & EVHTTP_CON_READING_ERROR) {
- evcon->flags &= ~EVHTTP_CON_READING_ERROR;
- evhttp_connection_fail_(evcon, EVREQ_HTTP_EOF);
- return;
- }
-
EVUTIL_ASSERT(evcon->http_server == NULL);
/* For connections from the client, we just
* reset the connection so that it becomes