From: Bill Stoddard Date: Thu, 3 Jan 2002 19:20:54 +0000 (+0000) Subject: Fix seg fault in HTTP_IN when trying to handle the LimitRequestBody X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3a9f55a2c78306b9597365f1d9694c2d8c90986;p=apache Fix seg fault in HTTP_IN when trying to handle the LimitRequestBody directive when reading a proxy response. We should bypass LimitRequestBody activities when handling a response from the proxied server. I don't think this will circumvent requestbody checking on a large request coming into the server that is destined to be proxied. (not tested though). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92722 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index b8db820e04..8b202544ba 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -519,9 +519,11 @@ typedef struct http_filter_ctx { } state; } http_ctx_t; -/* This is the input filter for HTTP requests. It handles chunked and - * content-length bodies. This can only be inserted/used after the headers - * are successfully parsed. */ +/* This is the HTTP_INPUT filter for HTTP requests and responses from + * proxied servers (mod_proxy). It handles chunked and content-length + * bodies. This can only be inserted/used after the headers + * are successfully parsed. + */ apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_off_t *readbytes) { @@ -540,7 +542,18 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ctx->state = BODY_NONE; ctx->remaining = 0; ctx->limit_used = 0; - ctx->limit = ap_get_limit_req_body(f->r); + + /* LimitRequestBody does not apply to proxied responses. + * Consider implementing this check in its own filter. + * Would adding a directive to limit the size of proxied + * responses be useful? + */ + if (!f->r->proxyreq) { + ctx->limit = ap_get_limit_req_body(f->r); + } + else { + ctx->limit = 0; + } tenc = apr_table_get(f->r->headers_in, "Transfer-Encoding"); lenp = apr_table_get(f->r->headers_in, "Content-Length"); diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 1d35acda54..e23ba0cd86 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -374,6 +374,7 @@ PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r) rp->notes = apr_table_make(c->pool, 5); rp->server = r->server; + rp->proxyreq = r->proxyreq; rp->request_time = r->request_time; rp->connection = c; rp->output_filters = c->output_filters;