From: Ryan Bloom Date: Thu, 9 Aug 2001 04:21:26 +0000 (+0000) Subject: Handle the -1 case in ap_http_filter. -1 means that we have to read X-Git-Tag: 2.0.24~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=979df5fa53ecdf2c0e722af8ee018b5ad7efe5e6;p=apache Handle the -1 case in ap_http_filter. -1 means that we have to read all data from the socket until the socket is closed. This has been used to proxy www.google.com successfully, but it doesn't return anything when used with www.yahoo.com. Still debugging that problem. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90044 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 2f9fbd394e..59782cbed4 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -646,6 +646,20 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode } } + if (*readbytes == -1) { + apr_bucket *e; + apr_off_t total; + APR_BRIGADE_FOREACH(e, ctx->b) { + const char *str; + apr_size_t len; + apr_bucket_read(e, &str, &len, APR_BLOCK_READ); + } + apr_brigade_length(b, 1, &total); + *readbytes = total; + e = apr_bucket_eos_create(); + APR_BRIGADE_INSERT_TAIL(b, e); + return APR_SUCCESS; + } /* readbytes == 0 is "read a single line". otherwise, read a block. */ if (*readbytes) { apr_off_t total;