1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

304 Commits

Author SHA1 Message Date
Ruediger Pluem
19fd02fdeb * For creating new buckets always use the bucket allocator of the brigade in
which we want to put the bucket.

  Currently this does not change behaviour as r->connection->bucket_alloc and
  to->bucket_alloc are the same. It is a cleanup and preparation for abstracting
  this in a proxy API.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726776 13f79535-47bb-0310-9956-ffa450edef68
2016-01-26 11:59:07 +00:00
Jim Jagielski
2b7a352917 Abstract out as macro
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1721759 13f79535-47bb-0310-9956-ffa450edef68
2015-12-26 21:29:21 +00:00
Yann Ylavic
6f8a850766 Follow up to r1715880: revert abusive ap_casecmpstr[n]() usages.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1716151 13f79535-47bb-0310-9956-ffa450edef68
2015-11-24 14:38:54 +00:00
Yann Ylavic
e30575b0b0 More ap_casecmpstr[n]() usages (follow up to r1715876).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715880 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:48:35 +00:00
Yann Ylavic
c80e6b2a34 Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715876 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:46:01 +00:00
Yann Ylavic
3c9ddf44bf Revert r1715789: will re-commit without spurious functional changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715869 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 16:28:36 +00:00
Yann Ylavic
29843dc73f Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).
[Reverted by r1715869]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715789 13f79535-47bb-0310-9956-ffa450edef68
2015-11-23 12:33:09 +00:00
Christophe Jaillet
43863e60ef Remove some useless 'return' statements.
Fix style and alignment.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715576 13f79535-47bb-0310-9956-ffa450edef68
2015-11-21 21:14:19 +00:00
Yann Ylavic
d9a3b78926 s/\<\(\w\+\)\>\s\+\<\1\>/\1/g
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1690137 13f79535-47bb-0310-9956-ffa450edef68
2015-07-09 18:07:50 +00:00
Yann Ylavic
0b5aeb0f65 mod_proxy: follow up to r1681694.
Handle the proxy-error-override note also in mod_proxy_ajp.

The note is not needed in mod_proxy_fcgi (which also handles
ProxyErrorOverride) since it calls ap_die() by itself, and always
returns OK to proxy_handler().

Add a comment about the note where used.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1682907 13f79535-47bb-0310-9956-ffa450edef68
2015-06-01 14:06:39 +00:00
Yann Ylavic
608a751ad6 mod_proxy: Don't put the worker in error state for 500 or 503 errors
returned by the backend unless failonstatus is configured to.  PR 56925.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1681694 13f79535-47bb-0310-9956-ffa450edef68
2015-05-26 07:25:08 +00:00
Yann Ylavic
8c162db8b6 mod_proxy_http: follow up to r1656259.
The proxy connection may be NULL during prefetch, don't try to dereference it!
Still origin->keepalive will be set according to p_conn->close by the caller
(proxy_http_handler).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1678771 13f79535-47bb-0310-9956-ffa450edef68
2015-05-11 15:48:58 +00:00
Christophe Jaillet
593715fd4a Remove some spaces between some return statements and ';' + fix a strange formating in a 'for' loop
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1673368 13f79535-47bb-0310-9956-ffa450edef68
2015-04-14 06:03:13 +00:00
Yann Ylavic
de86d7812f mod_proxy_http: Use the "Connection: close" header for requests to
backends not recycling connections (disablereuse), including the default
reverse and forward proxies.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1658765 13f79535-47bb-0310-9956-ffa450edef68
2015-02-10 17:25:54 +00:00
Yann Ylavic
2ebf887e1b mod_proxy_http: Don't expect the backend to ack the "Connection: close" to
finally close those not meant to be kept alive by SetEnv proxy-nokeepalive
or force-proxy-request-1.0, and respond with 502 instead of 400 if its
Connection header is invalid.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1658760 13f79535-47bb-0310-9956-ffa450edef68
2015-02-10 17:03:05 +00:00
Yann Ylavic
b26841b8dc mod_proxy(es): Avoid error response/document handling by the core if some
input filter already did it while reading client's payload.

When an input filter returns AP_FILTER_ERROR, it has already called ap_die()
or at least already responded to the client.

Here we don't want to lose AP_FILTER_ERROR when returning from proxy handlers,
so we use ap_map_http_request_error() to forward any AP_FILTER_ERROR to
ap_die() which knows whether a response needs to be completed or not.

Before this commit, returning an HTTP error code in this case caused a double
response to be generated.

Depends on r1657881 to preserve r->status (for logging) when nothing is to be
done by ap_die() when handling AP_FILTER_ERROR.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657897 13f79535-47bb-0310-9956-ffa450edef68
2015-02-06 16:54:16 +00:00
Yann Ylavic
ccc2e4c751 mod_proxy_http: don't connect or reuse backend before prefetching request body.
The goal is to minimize the delay between this connection is considered alive
and the first bytes sent (should the client's link be slow or some input filter
retain the data).
This is a best effort to prevent the backend from closing (from under us) what
it thinks is an idle connection, hence to reduce to the minimum the unavoidable
local ap_proxy_is_socket_connected() vs remote keepalive race condition.
PR 56541.

Also, allow the new subprocess_env variable "proxy-flushall" to prevent any
buffering of the request body before it is forwarded to the backend.
When set, the prefetch is still done (although non-blocking), so we can still
determine Content-Length vs chunked vs spooled (depending on data available
with the header or while reading it), and then all brigades are flushed when
passed to the backend.
PR 37920.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1656259 13f79535-47bb-0310-9956-ffa450edef68
2015-02-01 00:05:59 +00:00
Rainer Jung
5002fd13e7 Switch preference for headers, Transfer-Encoding
first, Content-Length second.

Addition to r1615289.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1620324 13f79535-47bb-0310-9956-ffa450edef68
2014-08-25 13:44:03 +00:00
Rainer Jung
3535416fc0 PR53420: Proxy responses with error status and
"ProxyErrorOverride On" hang until proxy timeout.

Regression from 2.2. It was introduced by r912063
in order to fix PR41646.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1615289 13f79535-47bb-0310-9956-ffa450edef68
2014-08-02 08:24:35 +00:00
Eric Covener
8cc5e00f9e *) SECURITY: CVE-2013-5704 (cve.mitre.org)
core: HTTP trailers could be used to replace HTTP headers
     late during request processing, potentially undoing or
     otherwise confusing modules that examined or modified
     request headers earlier.  Adds "MergeTrailers" directive to restore
     legacy behavior.  

Submitted By: Edward Lu, Yann Ylavic, Joe Orton, Eric Covener
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610814 13f79535-47bb-0310-9956-ffa450edef68
2014-07-15 19:11:02 +00:00
Joe Orton
bb2749fd6e SECURITY (CVE-2014-0117): Fix a crash in mod_proxy. In a reverse
proxy configuration, a remote attacker could send a carefully crafted
request which could crash a server process, resulting in denial of
service.

Thanks to Marek Kroemeke working with HP's Zero Day Initiative for
reporting this issue.

* server/util.c (ap_parse_token_list_strict): New function.

* modules/proxy/proxy_util.c (find_conn_headers): Use it here.

* modules/proxy/mod_proxy_http.c (ap_proxy_http_process_response):
  Send a 400 for a malformed Connection header.

Submitted by: Edward Lu, breser, covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610674 13f79535-47bb-0310-9956-ffa450edef68
2014-07-15 12:27:00 +00:00
Yann Ylavic
f1a9de3123 mod_proxy_http: avoid (unlikely) access to freed memory.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1599486 13f79535-47bb-0310-9956-ffa450edef68
2014-06-03 11:47:11 +00:00
Yann Ylavic
9ba346e885 mod_proxy: Preserve original request headers even if they differ
from the ones to be forwarded to the backend. PR 45387.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1588527 13f79535-47bb-0310-9956-ffa450edef68
2014-04-18 17:38:15 +00:00
Jeff Trawick
5512fa1b86 mod_proxy_http: Add detach_backend hook.
The immediate use is for a SSL-related module which works
on the backend proxy connection to be able to "leak" information
into the client r for logging.

This could be useful with other proxy scheme handlers.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1586719 13f79535-47bb-0310-9956-ffa450edef68
2014-04-11 17:07:18 +00:00
Christophe Jaillet
e2643b38f9 Use 'apr_table_setn' instead of 'apr_table_set' when possible in order to save memory.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1578760 13f79535-47bb-0310-9956-ffa450edef68
2014-03-18 06:52:08 +00:00
Jeff Trawick
d50ebf12a6 fix spelling
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1575958 13f79535-47bb-0310-9956-ffa450edef68
2014-03-10 14:57:14 +00:00
Yann Ylavic
fb3ff3e754 Redo what was reverted in r1572627.
Don't reuse a SSL backend connection whose SNI differs. PR 55782.
This may happen when ProxyPreserveHost is on and the proxy-worker
handles connections to different Hosts.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572630 13f79535-47bb-0310-9956-ffa450edef68
2014-02-27 15:40:01 +00:00
Yann Ylavic
dc560db2e9 Revert r1572606 for the time being since backport would conflict with 2.4.x's proxy_conn_rec.
The uds_path field is at the end of the struct in 2.4.x but not in trunk.
Fix that first, then recommit.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572627 13f79535-47bb-0310-9956-ffa450edef68
2014-02-27 15:31:58 +00:00
Yann Ylavic
93a607e6f2 Don't reuse a SSL backend connection whose SNI differs. PR 55782.
This may happen when ProxyPreserveHost is on and the proxy-worker
handles connections to different Hosts.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572606 13f79535-47bb-0310-9956-ffa450edef68
2014-02-27 14:52:12 +00:00
Yann Ylavic
739dc00ca9 Avoid useless functions calls.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572561 13f79535-47bb-0310-9956-ffa450edef68
2014-02-27 13:39:25 +00:00
Yann Ylavic
accfcf7471 Log an error in mod_proxy_http when reading the request body fails.
Follow-up to r1538776 where incomplete bodies are detected and an error returned through the input filters.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1570598 13f79535-47bb-0310-9956-ffa450edef68
2014-02-21 15:08:32 +00:00
Yann Ylavic
ffdab778e2 mod_proxy_http: don't recycle backend connections known to be closed (eg. EOS by close).
This saves a useless ap_is_socket_connected() call when reused.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1568404 13f79535-47bb-0310-9956-ffa450edef68
2014-02-14 17:55:19 +00:00
Jan Kaluža
d9c2352952 Cleanup the bb brigade, because buckets inserted to it can be created from
scpool and this pool can be freed before this brigade.
POSSIBLE (but as yet unconfirmed) fix for crashes seen with threaded servers,
e.g. PR 50335.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1550061 13f79535-47bb-0310-9956-ffa450edef68
2013-12-11 07:27:12 +00:00
Jim Jagielski
bb76893cfb We were not being consistent between http and others
if we added the default port or not during the canonizing
phase... Baseline the http method (don't add unless the
port provided isn't the default).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542562 13f79535-47bb-0310-9956-ffa450edef68
2013-11-16 20:13:48 +00:00
Joe Orton
817b1ea2c0 * modules/proxy/mod_proxy_http.c (ap_proxy_http_request): Use the same
brigade lifetime for the header brigade as the other brigades.
  POSSIBLE (but as yet unconfirmed) fix for crashes seen with threaded
  servers, e.g. PR 50335; appears correct or at least not harmful.

PR: 50335


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1534321 13f79535-47bb-0310-9956-ffa450edef68
2013-10-21 18:58:26 +00:00
Jim Jagielski
6284650f6d ping tuning via Yann Ylavic <ylavic.dev@gmail.com>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1530603 13f79535-47bb-0310-9956-ffa450edef68
2013-10-09 13:38:45 +00:00
Jeff Trawick
619866c198 fill in missing message numbers in APLOGNO() invocations
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1524018 13f79535-47bb-0310-9956-ffa450edef68
2013-09-17 12:51:08 +00:00
Christophe Jaillet
46d88308c2 Save a few cycles
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1517045 13f79535-47bb-0310-9956-ffa450edef68
2013-08-23 21:19:21 +00:00
Jim Jagielski
357828f9d2 Allow for a simple socket check in addition to the
higher level protocol-level checks for backends...

Not sure if it makes sense to do both or not... Comments?

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1516930 13f79535-47bb-0310-9956-ffa450edef68
2013-08-23 16:48:42 +00:00
Graham Leggett
1ab831fa06 mod_proxy_http: Make the proxy-interim-response environment variable
effective by formally overriding origin server behaviour.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1483027 13f79535-47bb-0310-9956-ffa450edef68
2013-05-15 19:27:10 +00:00
Graham Leggett
9bc9d79079 core: Stop the HTTP_IN filter from attempting to write error buckets
to the output filters, which is bogus in the proxy case. Create a
clean mapping from APR codes to HTTP status codes, and use it where
needed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1482522 13f79535-47bb-0310-9956-ffa450edef68
2013-05-14 18:58:06 +00:00
Graham Leggett
d2e6782ea7 mod_proxy, mod_proxy_http: Connection headers must be stripped on the way
in and out, support an optional function to handle this.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1482075 13f79535-47bb-0310-9956-ffa450edef68
2013-05-13 20:11:36 +00:00
Graham Leggett
a7fc0f013e mod_proxy: Ensure network errors detected by the proxy are returned as
504 Gateway Timout as opposed to 502 Bad Gateway, in order to be
compliant with RFC2616 14.9.4 Cache Revalidation and Reload Controls.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1480058 13f79535-47bb-0310-9956-ffa450edef68
2013-05-07 20:27:37 +00:00
Daniel Ruggeri
d31632f33c Add failontimeout to allow server admin to mark balancer member in err if IO timeout occurs.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1465839 13f79535-47bb-0310-9956-ffa450edef68
2013-04-09 00:18:42 +00:00
Jeff Trawick
d6c996a553 axe unused variable dconf (since r1453875)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1456124 13f79535-47bb-0310-9956-ffa450edef68
2013-03-13 20:39:34 +00:00
Jim Jagielski
2bea7fb2bf Pull out duplicated code to proxy_util...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1453875 13f79535-47bb-0310-9956-ffa450edef68
2013-03-07 14:06:51 +00:00
Ruediger Pluem
3611dfe9d5 * A limit of zero means unlimited for LimitRequestBody.
PR: 54435
Submitted by: Pavel Mateja <pavel netsafe.cz>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1433988 13f79535-47bb-0310-9956-ffa450edef68
2013-01-16 15:37:16 +00:00
Rainer Jung
4cf751dbb9 Fix closing the back end connection in case of error.
The field "closed" was changed from an int to a bit
field of size one in 2.4.x.
For historical reasons a close instruction was coded
as an increment on the field, which in 2.4.x flips
the field each time. There were mutliple code paths
that would flip it several times for a single error,
so effectively the connection was no longer closed
in these cases.

Especially in the case of an aborted client connection
this lead to a non consumed back end buffer and thus to
response mixup between users.

PR 53727

CVE-2012-3052


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1373955 13f79535-47bb-0310-9956-ffa450edef68
2012-08-16 17:54:50 +00:00
Ruediger Pluem
96cc34efbe * Use the the same hostname for SNI as for the HTTP request when forwarding
to SSL backends.

PR: 53134
Based on a patch from: Michael Weiser <michael weiser.dinsnail.net>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1333969 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 14:02:58 +00:00
Joe Orton
e16536b2cd * modules/proxy/mod_proxy_http.c (ap_proxy_http_process_response):
Treat EAGAIN as an error for a blocking read from the input filter
  stack.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1242798 13f79535-47bb-0310-9956-ffa450edef68
2012-02-10 14:52:25 +00:00