summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/httpd/httpd.h3
-rw-r--r--usr.sbin/httpd/server.c12
-rw-r--r--usr.sbin/httpd/server_fcgi.c3
-rw-r--r--usr.sbin/httpd/server_file.c3
4 files changed, 14 insertions, 7 deletions
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h
index aafc4f49883..9086bafb299 100644
--- a/usr.sbin/httpd/httpd.h
+++ b/usr.sbin/httpd/httpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.h,v 1.95 2015/07/31 00:10:51 benno Exp $ */
+/* $OpenBSD: httpd.h,v 1.96 2015/08/03 11:45:17 florian Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -302,6 +302,7 @@ struct client {
int clt_fd;
struct tls *clt_tls_ctx;
struct bufferevent *clt_srvbev;
+ int clt_srvbev_throttled;
off_t clt_toread;
size_t clt_headerlen;
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index 51d4e846c55..ffd6d305be2 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.73 2015/07/29 22:03:41 reyk Exp $ */
+/* $OpenBSD: server.c,v 1.74 2015/08/03 11:45:17 florian Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -728,8 +728,10 @@ server_write(struct bufferevent *bev, void *arg)
bufferevent_enable(bev, EV_READ);
- if (clt->clt_srvbev && !(clt->clt_srvbev->enabled & EV_READ))
+ if (clt->clt_srvbev && clt->clt_srvbev_throttled) {
bufferevent_enable(clt->clt_srvbev, EV_READ);
+ clt->clt_srvbev_throttled = 0;
+ }
return;
done:
@@ -773,8 +775,10 @@ server_read(struct bufferevent *bev, void *arg)
goto done;
if (EVBUFFER_LENGTH(EVBUFFER_OUTPUT(clt->clt_bev)) > (size_t)
- SERVER_MAX_PREFETCH * clt->clt_sndbufsiz)
- bufferevent_disable(bev, EV_READ);
+ SERVER_MAX_PREFETCH * clt->clt_sndbufsiz) {
+ bufferevent_disable(clt->clt_srvbev, EV_READ);
+ clt->clt_srvbev_throttled = 1;
+ }
return;
done:
diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c
index c43b64f67e3..a5c96b1cb83 100644
--- a/usr.sbin/httpd/server_fcgi.c
+++ b/usr.sbin/httpd/server_fcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_fcgi.c,v 1.62 2015/07/31 00:10:51 benno Exp $ */
+/* $OpenBSD: server_fcgi.c,v 1.63 2015/08/03 11:45:17 florian Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
@@ -160,6 +160,7 @@ server_fcgi(struct httpd *env, struct client *clt)
if (clt->clt_srvbev != NULL)
bufferevent_free(clt->clt_srvbev);
+ clt->clt_srvbev_throttled = 0;
clt->clt_srvbev = bufferevent_new(fd, server_fcgi_read,
NULL, server_file_error, clt);
if (clt->clt_srvbev == NULL) {
diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c
index e79a5ce3527..e060124911b 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.59 2015/07/20 11:38:19 semarie Exp $ */
+/* $OpenBSD: server_file.c,v 1.60 2015/08/03 11:45:17 florian Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -262,6 +262,7 @@ server_file_request(struct httpd *env, struct client *clt, char *path,
if (clt->clt_srvbev != NULL)
bufferevent_free(clt->clt_srvbev);
+ clt->clt_srvbev_throttled = 0;
clt->clt_srvbev = bufferevent_new(clt->clt_fd, server_read,
server_write, server_file_error, clt);
if (clt->clt_srvbev == NULL) {