Commit Graph

57 Commits

Author SHA1 Message Date
a2f2188e17 * Port r546128 to mod_proxy_connect to ensure that core_pre_connection does not
succeed in resetting the timeout of our socket to base_server->timeout.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901088 13f79535-47bb-0310-9956-ffa450edef68
2022-05-20 15:15:24 +00:00
43d7517dd7 * Do not change the status code after we already sent it to the client.
Changing the status code after we sent it to the client causes a status
  code being logged that is different from the one sent to the client which
  can be confusing.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895715 13f79535-47bb-0310-9956-ffa450edef68
2021-12-09 07:40:25 +00:00
2b7f51ade7 core: Add ap_create_connection() to create a server or client/proxy connection.
c->outgoing shouldn't be set by mod_ssl, ap_create_connection() allows that
and this commit also replaces all the calls to ap_run_create_connection() in
mod_proxy modules (not in the MPMs which create incoming connections only).

* include/http_connection.h, server/connection.c:
  Declare and implement ap_create_connection().

* modules/proxy/proxy_util.c, modules/proxy/mod_proxy_connect.c,
  modules/proxy/mod_proxy_ftp.c:
  Use ap_create_connection() instead of ap_run_create_connection(), and don't
  provide a connection_id a scoreboard handle for outgoing connection.

* server/log.c(do_errorlog_default):
  Use c->outgoing instead of c->sbh to determine if it's a "client" or "remote"
  connection.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893184 13f79535-47bb-0310-9956-ffa450edef68
2021-09-09 16:55:24 +00:00
85760859ca Fix spelling errors found by codespell. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
2020-02-13 18:15:57 +00:00
124a26fb09 mod_proxy: Improve tunneling loop.
Support half closed connections and pending data draining (for protocols like
rsync). PR 61616.

When reading on one side goes faster than writing on the other side, the output
filters chain may start buffering data and finally block, which will break
bidirectional tunneling for some protocols.

To avoid this, proxy_tunnel_run() now stops polling/reading until pending data
are drained, and recovers appropriately.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869420 13f79535-47bb-0310-9956-ffa450edef68
2019-11-05 16:41:14 +00:00
641102d747 mod_proxy: factorize mod_proxy_{connect,wstunnel} tunneling code in proxy_util.
This commit adds struct proxy_tunnel_rec that contains the fields needed for a
poll() loop through the filters chains, plus functions ap_proxy_tunnel_create()
and ap_proxy_tunnel_run() to respectively initialize a tunnel and (re)start it.
 
Proxy connect and wstunnel modules now make use of this new API to avoid
duplicating logic and code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869338 13f79535-47bb-0310-9956-ffa450edef68
2019-11-03 15:48:53 +00:00
2aa27e3a01 All error handling paths of this function call 'apr_socket_close()' , except this one.
So add it here too.

Probably spotted with the help of the Coccinelle software (Thx Julia for the patch and for Coccinelle)

See PR 53015

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1832348 13f79535-47bb-0310-9956-ffa450edef68
2018-05-27 20:38:39 +00:00
8b44a6d937 Fix some style (spaces only)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756853 13f79535-47bb-0310-9956-ffa450edef68
2016-08-18 21:13:06 +00:00
44586ba955 Be more consistent when we alocate this brigade.
This should save a few bytes in case of early exit and is, IMHO, cleaner.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1756852 13f79535-47bb-0310-9956-ffa450edef68
2016-08-18 21:10:37 +00:00
a3814e4cd2 mod_proxy_connect,wstunnel: log polling errors (and events) consistently at
level ERR (resp. TRACE2), and name the backend connection "backend" instead of
"sock".


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1754161 13f79535-47bb-0310-9956-ffa450edef68
2016-07-26 17:37:18 +00:00
f9ad2754f7 mod_proxy, mod_ssl: Handle SSLProxy* directives in <Proxy> sections,
allowing per backend TLS configuration.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1740928 13f79535-47bb-0310-9956-ffa450edef68
2016-04-26 00:04:57 +00:00
b70e849980 * Let mod_proxy_wstunnel and mod_proxy_connect use ap_proxy_transfer_between_connections
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1728481 13f79535-47bb-0310-9956-ffa450edef68
2016-02-04 13:57:14 +00:00
39beb46322 * Transform the buckets to the correct lifetime of the brigade, connection and filter stack that processes it.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1727567 13f79535-47bb-0310-9956-ffa450edef68
2016-01-29 12:36:38 +00:00
549749d283 mod_proxy_{connect,wstunnel}: follow up to r1657636.
Since rv is not used as an apr_status_t in the loop (it's logging is done by
proxy_{connect,wstunnel}_transfer() when necessary/relevent), use a boolean
instead to avoid the ugly ORs between APR error codes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1669130 13f79535-47bb-0310-9956-ffa450edef68
2015-03-25 15:00:37 +00:00
c6f5f2f63f mod_proxy_connect/wstunnel: If both client and backend sides get readable
at the same time, don't lose errors occuring while forwarding on the first
side when none occurs next on the other side, and abort.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657636 13f79535-47bb-0310-9956-ffa450edef68
2015-02-05 17:36:23 +00:00
12af2e3ac2 mod_proxy_connect: fix duplicated AH introduced by r1635645.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1656230 13f79535-47bb-0310-9956-ffa450edef68
2015-01-31 18:19:59 +00:00
a7becdbf75 mod_proxy_connect: Don't issue AH02447 on sockets hangups, let the read
determine whether it is a normal close or a real error. PR 57168.

Abort the client or backend connection on polling errors, but don't forcibly
abort the client side at the end (the core filters will do that otherwise
when necessary), so that lingering close and SSL shutdown can occur on normal
close.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1635645 13f79535-47bb-0310-9956-ffa450edef68
2014-10-31 00:07:06 +00:00
3400ec7e6a Fix some compiler warnings.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1500423 13f79535-47bb-0310-9956-ffa450edef68
2013-07-07 13:04:39 +00:00
4b36695126 Don't keepalive the connection to the client if the
backend closes the connection.

PR: 54474
Submitted by: Pavel Mateja <pavel netsafe cz>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1442320 13f79535-47bb-0310-9956-ffa450edef68
2013-02-04 19:56:39 +00:00
cc786585b6 * modules/proxy/mod_proxy_connect.c (proxy_connect_handler): Fix
use of APLOGNO().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1375407 13f79535-47bb-0310-9956-ffa450edef68
2012-08-21 07:31:36 +00:00
6c41025260 Fix handling of ProxyBlock if a forward proxy is configured, and fix
mod_proxy_connect to avoid an inappropriate DNS lookup:

* modules/proxy/proxy_util.c (ap_proxy_checkproxyblock): Take hostname
  argument, make address argument optional.  Check names against
  hostname arg, omit if addr not given.
  (ap_proxy_determine_connection): Adjust for the above; pass hostname
  from URI not the next hop.

* modules/proxy/mod_proxy_ftp.c (proxy_ftp_handler): Adjust for
  ap_proxy_checkproxyblock change.

* modules/proxy/mod_proxy_connect.c (proxy_connect_handler): Adjust
  similarly, and avoid the DNS lookup on the request-URI hostname if a
  proxy is used.

* include/ap_mmn.h: Bump MMN.

PR: 43697


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1365001 13f79535-47bb-0310-9956-ffa450edef68
2012-07-24 12:17:00 +00:00
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
8ec7f5c5bf great proxy logging cleanup:
* remove "proxy:", "FCGI", etc. prefixes and pid which are now
    included in the error log format

  * propagate frontend request's logconfig to backend request
    
  * use ap_log_rerror where possible
    
  * remove obsolete APLOG_NOERRNO


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203859 13f79535-47bb-0310-9956-ffa450edef68
2011-11-18 21:41:09 +00:00
427c85bd23 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:39:32 +00:00
24e349de03 mod_proxy_http, mod_proxy_connect: Add 'proxy-status' and 'proxy-source-port'
request notes for logging

PR: 30195


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1154342 13f79535-47bb-0310-9956-ffa450edef68
2011-08-05 18:35:29 +00:00
fba947527f Introduce new function ap_get_conn_socket() to access the socket of
a connection


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1135153 13f79535-47bb-0310-9956-ffa450edef68
2011-06-13 16:02:18 +00:00
c9fd2623da Introduce ap_(get|set)_core_module_config() functions/macros and use them
everywhere.

We know that the core module has module_index 0. Therefore we can save
some pointer operations in ap_get_module_config(cv, &core_module) and
ap_set_module_config(cv, &core_module, val). As these are called rather often,
this may actually have some (small) measurable effect.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
2011-06-06 21:26:56 +00:00
b76f1b5dbf PR50220: keep on chugging after EINTR in mod_proxy_connect
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1031551 13f79535-47bb-0310-9956-ffa450edef68
2010-11-05 13:12:14 +00:00
01b9f2e551 - Be less verbose at levels INFO and DEBUG in mod_proxy* and mod_ssl
- Add some trace logging to core and http


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951900 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 17:07:12 +00:00
ebb62867fb Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to take
advantage of per-module loglevels


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951895 13f79535-47bb-0310-9956-ffa450edef68
2010-06-06 16:59:50 +00:00
877b46df6b log issues with CONNECT at request scope instead of server scope
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951189 13f79535-47bb-0310-9956-ffa450edef68
2010-06-03 22:47:46 +00:00
871fa3dcac mod_proxy_connect: Support port ranges in AllowConnect
PR: 23673


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@932927 13f79535-47bb-0310-9956-ffa450edef68
2010-04-11 15:54:02 +00:00
596940ef40 If the client disconnects and the backend continues to send data fast, forcibly
close the backend connection.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@924455 13f79535-47bb-0310-9956-ffa450edef68
2010-03-17 20:08:42 +00:00
517aec9157 tweak handling for default allowed ports
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894430 13f79535-47bb-0310-9956-ffa450edef68
2009-12-29 16:25:31 +00:00
255f44600c Move AllowCONNECT from mod_proxy to mod_proxy_connect.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894425 13f79535-47bb-0310-9956-ffa450edef68
2009-12-29 15:39:54 +00:00
fdc5eea45b * More style fixes. No functional changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@813265 13f79535-47bb-0310-9956-ffa450edef68
2009-09-10 07:00:27 +00:00
7aa37bccb6 * Style fixes. No functional changes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@813254 13f79535-47bb-0310-9956-ffa450edef68
2009-09-10 06:35:34 +00:00
09ccc5d520 * Silence compiler warnings
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@813249 13f79535-47bb-0310-9956-ffa450edef68
2009-09-10 06:19:27 +00:00
c8fe617ea4 mod_proxy_connect: The connect method doesn't work if the client is
connecting to the apache proxy through an ssl socket. Fixed.
PR: 29744.
Submitted by: Brad Boyer, Mark Cave-Ayland, Julian Gilbey, Fabrice Durand,
David Gence, Tim Dodge, Per Gunnar Hans, Emmanuel Elango, Kevin Croft,
Rudolf Cardinal


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@813178 13f79535-47bb-0310-9956-ffa450edef68
2009-09-09 23:56:29 +00:00
7fe574e381 OK, might as well finish this... Allow ServerTokens Off
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808895 13f79535-47bb-0310-9956-ffa450edef68
2009-08-28 14:31:00 +00:00
93cdac913c Return consistent error status for proxy unable to connect
PR 46971


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@806920 13f79535-47bb-0310-9956-ffa450edef68
2009-08-23 02:00:43 +00:00
3fadc493c9 * Do better checking of pollset operations in various places to avoid segfaults.
PR: 46467
Submitted by: Stefan Fritsch <sf sfritsch.de>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@804764 13f79535-47bb-0310-9956-ffa450edef68
2009-08-16 20:29:47 +00:00
a324a1d72f Remove all references to CORE_PRIVATE.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:45:43 +00:00
4a9af5285b whitespace format change...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@572050 13f79535-47bb-0310-9956-ffa450edef68
2007-09-02 17:37:59 +00:00
0f1e54fd07 * Improve formating. No functional change.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@571932 13f79535-47bb-0310-9956-ffa450edef68
2007-09-02 08:57:34 +00:00
f4b856b17b Clean up nasty formatting
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@571879 13f79535-47bb-0310-9956-ffa450edef68
2007-09-01 21:42:30 +00:00
0d631a0b62 * s/\t/ /g. No functional change.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@571869 13f79535-47bb-0310-9956-ffa450edef68
2007-09-01 21:13:38 +00:00
520afe638a Move error-checking to where it should be
Updating r571414 (patch for PR 40756) following rpluem comment


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@571863 13f79535-47bb-0310-9956-ffa450edef68
2007-09-01 19:45:20 +00:00
08c88581d3 Fix potential proxy segfault
PR 40756.  Patch adapted from 2.0 patch by Trevin Beattie


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@571414 13f79535-47bb-0310-9956-ffa450edef68
2007-08-31 10:13:59 +00:00
743a621e8d Replace ap_get_server_version with ap_get_server_banner() and
ap_get_server_description().

High-level summary:

The full server version information is now included in the error log at
startup as well as server status reports, irrespective of the setting
of the ServerTokens directive.

Third-party modules must now use ap_get_server_banner() or 
ap_get_server_description() in place of ap_get_server_version().



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@440337 13f79535-47bb-0310-9956-ffa450edef68
2006-09-05 13:08:15 +00:00