summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r--usr.sbin/httpd/server.c9
-rw-r--r--usr.sbin/httpd/server_file.c17
2 files changed, 14 insertions, 12 deletions
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index 6460f357237..77168e95ca3 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -688,9 +688,11 @@ server_write(struct bufferevent *bev, void *arg)
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;
}
@@ -728,10 +730,9 @@ server_read(struct bufferevent *bev, void *arg)
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));
diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c
index 5b72aaf4683..65ecb0100b8 100644
--- a/usr.sbin/httpd/server_file.c
+++ b/usr.sbin/httpd/server_file.c
@@ -1,4 +1,4 @@
-/* $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>
@@ -375,13 +375,6 @@ server_file_error(struct bufferevent *bev, short error, void *arg)
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)
@@ -392,6 +385,14 @@ server_file_error(struct bufferevent *bev, short error, void *arg)
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;
}