summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-08-08 18:38:15 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-08-08 18:38:15 +0000
commitf6272c5a3d725570eff9f9521f9195d416c7d29c (patch)
tree6160b5b44c81adbcb68ac721d512069d975b06cb
parent898ec46e77f1c453fdbddad5336aa791f2d7d248 (diff)
Support HTTP responses that neither specify a Content-Length header
nor chunked encoding. We don't know the length of the HTTP body in this case, so it only works for single-pass HTTP responses without subsequent HTTP response headers in the stream. You can still enforce the Content-Length header with an "expect" rule. For example, this fixes response handling from undeadly.org (thttpd) if relayd is running as a transparent HTTP proxy.
-rw-r--r--usr.sbin/relayd/relay.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index b2f774fe8db..1756de63e0f 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.96 2008/08/08 08:51:21 thib Exp $ */
+/* $OpenBSD: relay.c,v 1.97 2008/08/08 18:38:14 reyk Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -1492,11 +1492,12 @@ relay_read_http(struct bufferevent *bev, void *arg)
case HTTP_METHOD_PUT:
case HTTP_METHOD_RESPONSE:
/* HTTP request payload */
- if (cre->toread) {
+ if (cre->toread)
bev->readcb = relay_read_httpcontent;
- break;
- }
- /* FALLTHROUGH */
+
+ /* Single-pass HTTP response */
+ bev->readcb = relay_read;
+ break;
default:
/* HTTP handler */
bev->readcb = relay_read_http;