summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-09-04 22:21:33 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-09-04 22:21:33 +0000
commit78ff51b3ebd230a926118179b3e5aea4d4529ea6 (patch)
tree1363ffcd9b498299a46a411cb48cbe727c8547e8
parent9dac9dbf099972d9467e305a4770d92ed7f2e86e (diff)
Handling of HTTP requests with a body like POST were broken in
relayd. Instead of checking for the direction RELAY_DIR_RESPONSE, set toread to 0 if we don't expect a body. OK reyk@
-rw-r--r--usr.sbin/relayd/relay_http.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c
index 5b933eb5412..a7925b44c2f 100644
--- a/usr.sbin/relayd/relay_http.c
+++ b/usr.sbin/relayd/relay_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_http.c,v 1.15 2013/06/02 18:02:45 reyk Exp $ */
+/* $OpenBSD: relay_http.c,v 1.16 2013/09/04 22:21:32 bluhm Exp $ */
/*
* Copyright (c) 2006 - 2012 Reyk Floeter <reyk@openbsd.org>
@@ -324,6 +324,8 @@ relay_read_http(struct bufferevent *bev, void *arg)
case HTTP_METHOD_GET:
case HTTP_METHOD_HEAD:
case HTTP_METHOD_OPTIONS:
+ cre->toread = 0;
+ /* FALLTHROUGH */
case HTTP_METHOD_POST:
case HTTP_METHOD_PUT:
case HTTP_METHOD_RESPONSE:
@@ -331,9 +333,8 @@ relay_read_http(struct bufferevent *bev, void *arg)
if (cre->toread > 0)
bev->readcb = relay_read_httpcontent;
- /* Single-pass HTTP response */
- if (cre->dir == RELAY_DIR_RESPONSE &&
- cre->toread < 0) {
+ /* Single-pass HTTP body */
+ if (cre->toread < 0) {
cre->toread = TOREAD_UNLIMITED;
bev->readcb = relay_read;
}