-/* $OpenBSD: server.c,v 1.33 2014/08/06 09:40:04 reyk Exp $ */
+/* $OpenBSD: server.c,v 1.34 2014/08/06 11:24:12 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
if (clt->clt_done)
goto done;
+
+ bufferevent_enable(bev, EV_READ);
return;
done:
- server_close(clt, "last write (done)");
+ (*bev->errorcb)(bev, EVBUFFER_WRITE|EVBUFFER_EOF, bev->cbarg);
return;
}
goto fail;
if (clt->clt_done)
goto done;
- bufferevent_enable(bev, EV_READ);
return;
done:
- server_close(clt, "last read (done)");
+ (*bev->errorcb)(bev, EVBUFFER_READ|EVBUFFER_EOF, bev->cbarg);
return;
fail:
server_close(clt, strerror(errno));
-/* $OpenBSD: server_file.c,v 1.30 2014/08/06 09:36:31 reyk Exp $ */
+/* $OpenBSD: server_file.c,v 1.31 2014/08/06 11:24:12 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
clt->clt_done = 1;
- dst = EVBUFFER_OUTPUT(clt->clt_bev);
- if (EVBUFFER_LENGTH(dst)) {
- /* Finish writing all data first */
- bufferevent_enable(clt->clt_bev, EV_WRITE);
- return;
- }
-
if (clt->clt_persist) {
/* Close input file and wait for next HTTP request */
if (clt->clt_fd != -1)
bufferevent_enable(clt->clt_bev, EV_READ|EV_WRITE);
return;
}
+
+ dst = EVBUFFER_OUTPUT(clt->clt_bev);
+ if (EVBUFFER_LENGTH(dst)) {
+ /* Finish writing all data first */
+ bufferevent_enable(clt->clt_bev, EV_WRITE);
+ return;
+ }
+
server_close(clt, "done");
return;
}