httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r824072 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_proxy.xml include/ap_mmn.h modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h modules/proxy/mod_proxy_http.c
Date Sun, 11 Oct 2009 13:38:52 GMT
Author: sf
Date: Sun Oct 11 13:38:51 2009
New Revision: 824072

URL: http://svn.apache.org/viewvc?rev=824072&view=rev
Log:
Allow ProxyPreserveHost to work in <Proxy> sections

PR: 34901

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/modules/proxy/mod_proxy.c
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=824072&r1=824071&r2=824072&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Oct 11 13:38:51 2009
@@ -10,6 +10,9 @@
      mod_proxy_ftp: NULL pointer dereference on error paths.
      [Stefan Fritsch <sf fritsch.de>, Joe Orton]
 
+  *) Allow ProxyPreserveHost to work in <Proxy> sections. PR 34901.
+     [Stefan Fritsch]
+
   *) configure: Fix THREADED_MPMS so that mod_cgid is enabled again 
      for worker MPM. [Takashi Sato]
 

Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml?rev=824072&r1=824071&r2=824072&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml Sun Oct 11 13:38:51 2009
@@ -412,6 +412,7 @@
 <syntax>ProxyPreserveHost On|Off</syntax>
 <default>ProxyPreserveHost Off</default>
 <contextlist><context>server config</context><context>virtual host</context>
+<context>directory</context>
 </contextlist>
 <compatibility>Available in Apache 2.0.31 and later.</compatibility>
 

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=824072&r1=824071&r2=824072&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Sun Oct 11 13:38:51 2009
@@ -200,15 +200,17 @@
  *                         param to ap_wait_or_timeout()
  * 20090925.1 (2.3.3-dev)  Add optional function ap_logio_get_last_bytes() to
  *                         mod_logio
+ * 20091011.0 (2.3.3-dev)  Move preserve_host{,_set} from proxy_server_conf to
+ *                         proxy_dir_conf
  *
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20090925
+#define MODULE_MAGIC_NUMBER_MAJOR 20091011
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=824072&r1=824071&r2=824072&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Sun Oct 11 13:38:51 2009
@@ -1103,8 +1103,6 @@
     ps->maxfwd_set = 0;
     ps->error_override = 0;
     ps->error_override_set = 0;
-    ps->preserve_host_set = 0;
-    ps->preserve_host = 0;
     ps->timeout = 0;
     ps->timeout_set = 0;
     ps->badopt = bad_error;
@@ -1144,8 +1142,6 @@
     ps->maxfwd_set = overrides->maxfwd_set || base->maxfwd_set;
     ps->error_override = (overrides->error_override_set == 0) ? base->error_override
: overrides->error_override;
     ps->error_override_set = overrides->error_override_set || base->error_override_set;
-    ps->preserve_host = (overrides->preserve_host_set == 0) ? base->preserve_host
: overrides->preserve_host;
-    ps->preserve_host_set = overrides->preserve_host_set || base->preserve_host_set;
     ps->timeout= (overrides->timeout_set == 0) ? base->timeout : overrides->timeout;
     ps->timeout_set = overrides->timeout_set || base->timeout_set;
     ps->badopt = (overrides->badopt_set == 0) ? base->badopt : overrides->badopt;
@@ -1169,6 +1165,8 @@
     new->cookie_domains = apr_array_make(p, 10, sizeof(struct proxy_alias));
     new->cookie_path_str = apr_strmatch_precompile(p, "path=", 0);
     new->cookie_domain_str = apr_strmatch_precompile(p, "domain=", 0);
+    new->preserve_host_set = 0;
+    new->preserve_host = 0;
     new->interpolate_env = -1; /* unset */
 
     return (void *) new;
@@ -1197,6 +1195,9 @@
     new->ftp_directory_charset = add->ftp_directory_charset ?
                                  add->ftp_directory_charset :
                                  base->ftp_directory_charset;
+    new->preserve_host = (add->preserve_host_set == 0) ? base->preserve_host
+                                                        : add->preserve_host;
+    new->preserve_host_set = add->preserve_host_set || base->preserve_host_set;
     return new;
 }
 
@@ -1612,13 +1613,12 @@
     return NULL;
 }
 static const char *
-    set_preserve_host(cmd_parms *parms, void *dummy, int flag)
+    set_preserve_host(cmd_parms *parms, void *dconf, int flag)
 {
-    proxy_server_conf *psf =
-    ap_get_module_config(parms->server->module_config, &proxy_module);
+    proxy_dir_conf *conf = dconf;
 
-    psf->preserve_host = flag;
-    psf->preserve_host_set = 1;
+    conf->preserve_host = flag;
+    conf->preserve_host_set = 1;
     return NULL;
 }
 
@@ -2115,7 +2115,7 @@
      "Configure Via: proxy header header to one of: on | off | block | full"),
     AP_INIT_FLAG("ProxyErrorOverride", set_proxy_error_override, NULL, RSRC_CONF,
      "use our error handling pages instead of the servers' we are proxying"),
-    AP_INIT_FLAG("ProxyPreserveHost", set_preserve_host, NULL, RSRC_CONF,
+    AP_INIT_FLAG("ProxyPreserveHost", set_preserve_host, NULL, RSRC_CONF|ACCESS_CONF,
      "on if we should preserve host header while proxying"),
     AP_INIT_TAKE1("ProxyTimeout", set_proxy_timeout, NULL, RSRC_CONF,
      "Set the timeout (in seconds) for a proxied connection. "

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=824072&r1=824071&r2=824072&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Sun Oct 11 13:38:51 2009
@@ -160,8 +160,6 @@
      */
     int error_override;
     int error_override_set;
-    int preserve_host;
-    int preserve_host_set;
     apr_interval_time_t timeout;
     char timeout_set;
     enum {
@@ -203,6 +201,8 @@
     const apr_strmatch_pattern* cookie_domain_str;
     const char *ftp_directory_charset;
     int interpolate_env;
+    int preserve_host;
+    int preserve_host_set;
 } proxy_dir_conf;
 
 /* if we interpolate env vars per-request, we'll need a per-request

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=824072&r1=824071&r2=824072&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Sun Oct 11 13:38:51 2009
@@ -693,7 +693,9 @@
     apr_off_t bytes;
     int force10, rv;
     apr_table_t *headers_in_copy;
+    proxy_dir_conf *dconf;
 
+    dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
     header_brigade = apr_brigade_create(p, origin->bucket_alloc);
 
     /*
@@ -723,7 +725,7 @@
     ap_xlate_proto_to_ascii(buf, strlen(buf));
     e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(header_brigade, e);
-    if (conf->preserve_host == 0) {
+    if (dconf->preserve_host == 0) {
         if (ap_strchr_c(uri->hostname, ':')) { /* if literal IPv6 address */
             if (uri->port_str && uri->port != DEFAULT_HTTP_PORT) {
                 buf = apr_pstrcat(p, "Host: [", uri->hostname, "]:", 



Mime
View raw message