httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r231355 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h mod_proxy_http.c
Date Wed, 10 Aug 2005 23:36:43 GMT
Author: niq
Date: Wed Aug 10 16:36:39 2005
New Revision: 231355

URL: http://svn.apache.org/viewcvs?rev=231355&view=rev
Log:
Fix ProxyPassReverse & family to work correctly in <Location>

Modified:
    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/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=231355&r1=231354&r2=231355&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Aug 10 16:36:39 2005
@@ -788,11 +788,6 @@
     ps->sec_proxy = apr_array_make(p, 10, sizeof(ap_conf_vector_t *));
     ps->proxies = apr_array_make(p, 10, sizeof(struct proxy_remote));
     ps->aliases = apr_array_make(p, 10, sizeof(struct proxy_alias));
-    ps->raliases = apr_array_make(p, 10, sizeof(struct proxy_alias));
-    ps->cookie_paths = apr_array_make(p, 10, sizeof(struct proxy_alias));
-    ps->cookie_domains = apr_array_make(p, 10, sizeof(struct proxy_alias));
-    ps->cookie_path_str = apr_strmatch_precompile(p, "path=", 0);
-    ps->cookie_domain_str = apr_strmatch_precompile(p, "domain=", 0);
     ps->noproxies = apr_array_make(p, 10, sizeof(struct noproxy_entry));
     ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry));
     ps->allowed_connect_ports = apr_array_make(p, 10, sizeof(int));
@@ -832,13 +827,6 @@
     ps->proxies = apr_array_append(p, base->proxies, overrides->proxies);
     ps->sec_proxy = apr_array_append(p, base->sec_proxy, overrides->sec_proxy);
     ps->aliases = apr_array_append(p, base->aliases, overrides->aliases);
-    ps->raliases = apr_array_append(p, base->raliases, overrides->raliases);
-    ps->cookie_paths
-        = apr_array_append(p, base->cookie_paths, overrides->cookie_paths);
-    ps->cookie_domains
-        = apr_array_append(p, base->cookie_domains, overrides->cookie_domains);
-    ps->cookie_path_str = base->cookie_path_str;
-    ps->cookie_domain_str = base->cookie_domain_str;
     ps->noproxies = apr_array_append(p, base->noproxies, overrides->noproxies);
     ps->dirconn = apr_array_append(p, base->dirconn, overrides->dirconn);
     ps->allowed_connect_ports = apr_array_append(p, base->allowed_connect_ports, overrides->allowed_connect_ports);
@@ -869,6 +857,13 @@
 
     /* Filled in by proxysection, when applicable */
 
+    /* Put these in the dir config so they work inside <Location> */
+    new->raliases = apr_array_make(p, 10, sizeof(struct proxy_alias));
+    new->cookie_paths = apr_array_make(p, 10, sizeof(struct proxy_alias));
+    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);
+
     return (void *) new;
 }
 
@@ -880,6 +875,15 @@
     new->p = add->p;
     new->p_is_fnmatch = add->p_is_fnmatch;
     new->r = add->r;
+
+    /* Put these in the dir config so they work inside <Location> */
+    new->raliases = apr_array_append(p, base->raliases, overrides->raliases);
+    new->cookie_paths
+        = apr_array_append(p, base->cookie_paths, overrides->cookie_paths);
+    new->cookie_domains
+        = apr_array_append(p, base->cookie_domains, overrides->cookie_domains);
+    new->cookie_path_str = base->cookie_path_str;
+    new->cookie_domain_str = base->cookie_domain_str;
     return new;
 }
 
@@ -1042,14 +1046,11 @@
 }
 
 static const char *
-    add_pass_reverse(cmd_parms *cmd, void *dummy, const char *f, const char *r)
+    add_pass_reverse(cmd_parms *cmd, void *dconf, const char *f, const char *r)
 {
-    server_rec *s = cmd->server;
-    proxy_server_conf *conf;
+    proxy_dir_conf *conf = dconf;
     struct proxy_alias *new;
 
-    conf = (proxy_server_conf *)ap_get_module_config(s->module_config, 
-                                                     &proxy_module);
     if (r!=NULL && cmd->path == NULL ) {
         new = apr_array_push(conf->raliases);
         new->fake = f;
@@ -1068,14 +1069,11 @@
     return NULL;
 }
 static const char*
-    cookie_path(cmd_parms *cmd, void *dummy, const char *f, const char *r)
+    cookie_path(cmd_parms *cmd, void *dconf, const char *f, const char *r)
 {
-    server_rec *s = cmd->server;
-    proxy_server_conf *conf;
+    proxy_dir_conf *conf = dconf;
     struct proxy_alias *new;
 
-    conf = (proxy_server_conf *)ap_get_module_config(s->module_config,
-                                                     &proxy_module);
     new = apr_array_push(conf->cookie_paths);
     new->fake = f;
     new->real = r;
@@ -1083,14 +1081,11 @@
     return NULL;
 }
 static const char*
-    cookie_domain(cmd_parms *cmd, void *dummy, const char *f, const char *r)
+    cookie_domain(cmd_parms *cmd, void *dconf, const char *f, const char *r)
 {
-    server_rec *s = cmd->server;
-    proxy_server_conf *conf;
+    proxy_dir_conf *conf = dconf;
     struct proxy_alias *new;
 
-    conf = (proxy_server_conf *)ap_get_module_config(s->module_config,
-                                                     &proxy_module);
     new = apr_array_push(conf->cookie_domains);
     new->fake = f;
     new->real = r;

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=231355&r1=231354&r2=231355&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Wed Aug 10 16:36:39 2005
@@ -125,7 +125,6 @@
     apr_array_header_t *proxies;
     apr_array_header_t *sec_proxy;
     apr_array_header_t *aliases;
-    apr_array_header_t *raliases;
     apr_array_header_t *noproxies;
     apr_array_header_t *dirconn;
     apr_array_header_t *allowed_connect_ports;
@@ -173,10 +172,6 @@
  * the strmatch_patterns are really a const just to have a
  * case-independent strstr.
  */
-    apr_array_header_t* cookie_paths;
-    apr_array_header_t* cookie_domains;
-    const apr_strmatch_pattern* cookie_path_str;
-    const apr_strmatch_pattern* cookie_domain_str;
     enum {
         status_off,
         status_on,
@@ -191,6 +186,19 @@
     const char *p;            /* The path */
     int         p_is_fnmatch; /* Is this path an fnmatch candidate? */
     ap_regex_t  *r;            /* Is this a regex? */
+
+/* ProxyPassReverse and friends are documented as working inside
+ * <Location>.  But in fact they never have done in the case of
+ * more than one <Location>, because the server_conf can't see it.
+ * We need to move them to the per-dir config.
+ * Discussed in February:
+ * http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=110726027118798&w=2
+ */
+    apr_array_header_t *raliases;
+    apr_array_header_t* cookie_paths;
+    apr_array_header_t* cookie_domains;
+    const apr_strmatch_pattern* cookie_path_str;
+    const apr_strmatch_pattern* cookie_domain_str;
 } proxy_dir_conf;
 
 typedef struct {

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=231355&r1=231354&r2=231355&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Wed Aug 10 16:36:39 2005
@@ -968,7 +968,7 @@
     return APR_SUCCESS;
 }
 
-static void process_proxy_header(request_rec* r, proxy_server_conf* c,
+static void process_proxy_header(request_rec* r, proxy_dir_conf* c,
                       const char* key, const char* value)
 {
     static const char* date_hdrs[]
@@ -1021,7 +1021,9 @@
     int saw_headers = 0;
     void *sconf = r->server->module_config;
     proxy_server_conf *psc;
+    proxy_dir_conf *dconf;
 
+    dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
     psc = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module);
 
     r->headers_out = apr_table_make(r->pool, 20);
@@ -1096,7 +1098,7 @@
          * Modify headers requiring canonicalisation and/or affected
          * by ProxyPassReverse and family with process_proxy_header
          */
-        process_proxy_header(r, psc, buffer, value) ;
+        process_proxy_header(r, dconf, buffer, value) ;
         saw_headers = 1;
 
         /* the header was too long; at the least we should skip extra data */



Mime
View raw message