From 866e3a772e0f94a15d3b31fdd947012dca229c97 Mon Sep 17 00:00:00 2001 From: reyk Date: Fri, 8 Aug 2008 18:38:14 +0000 Subject: [PATCH] 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. --- usr.sbin/relayd/relay.c | 11 ++++++----- 1 file 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 @@ -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; -- 2.20.1