DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=10722>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=10722





------- Additional Comments From [EMAIL PROTECTED]  2005-08-22 12:02 -------
*** proxy_http.c        Tue Jun 18 01:59:59 2002
--- proxy_http.c_clean_new      Mon Oct  7 12:33:03 2002
***************
*** 137,142 ****
--- 137,198 ----
      return url;
  }
  
+ /* Take a cooke value and rewrite the path as required by ProxyPassReverse 
setting.
+  * Written for tomcat apps that add cookie path by default. NOT heavily 
tested.
+  */
+ 
+ static const char *proxy_cookie_reverse_map(request_rec *r, const char 
*cookie_val)
+ {
+   proxy_server_conf *conf;
+   struct proxy_alias *ent;
+   int i, l1, l2, l3, lreal, lrest;
+   char *u;
+   char *real_path;
+   char *ctmp1,*ctmp2,*ctmp3,*fixed = NULL;
+ 
+   conf = (proxy_server_conf *)ap_get_module_config(r->server->module_config, 
&proxy_module);
+   l1 = strlen(cookie_val);
+   ent = (struct proxy_alias *)conf->raliases->elts;
+   ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server,
+              "ProxyPassReverse Original cookie = %s", cookie_val);
+   for (i = 0; i < conf->raliases->nelts; i++) {
+     /* Find just the proxy reverse paths for cookie remapping */
+     ctmp1 = strstr(ent[i].real, "//");
+     /* go passed //, could do this above but simpler here */
+     ctmp1 = ctmp1 + 2;
+     /* find / which should be start of path. We have only a very
+      *            simple url to parse */
+     real_path = strstr(ctmp1, "/");
+     /*  real_path now has real path so swap real in for fake */
+     if( ctmp1 = strstr(cookie_val, "path=") ){
+       ctmp2 = strstr(ctmp1, ent[i].fake);
+       if ( !ctmp2 ) continue;
+       /* go passed path= */
+       ctmp1 += 5;
+       /* go passed fake entry (bit we are rewriting)*/
+       ctmp2 += strlen(ent[i].fake);
+       /*
+        * ctmp1 is just passed path= and ctmp2 at end of fake bit,
+        * now add bits together
+        * l3 = bit up to end "path=" + lenght real + bit at end fake + \0
+        */
+       lreal = strlen(real_path);
+       lrest = strlen(ctmp2);
+       l3 = ((int) (ctmp1 - cookie_val)) + lreal + lrest + 1;
+       fixed = ap_palloc(r->pool, l3);
+       strncpy(fixed, cookie_val, (int) (ctmp1 - cookie_val));
+       strncpy(&fixed[(int) (ctmp1 - cookie_val)], ctmp1, lreal);
+       strncpy(&fixed[(int) (ctmp1 - cookie_val + lreal)], ctmp2, lrest);
+       /* strncpy(&fixed[(int) (ctmp1 - a + lreal + lrest)], '\0', 1); */
+       ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server,
+                  "ProxyPassReverse Fixed cookie = %s", fixed);
+     }
+   }
+   if( fixed ) return fixed;
+   return cookie_val;
+ }
+ 
+ 
  /*
   * This handles http:// URLs, and other URLs using a remote proxy over http
   * If proxyhost is NULL, then contact the server directly, otherwise
***************
*** 153,161 ****
      char *strp2;
      const char *err, *desthost;
      int i, j, sock,/* len,*/ backasswards;
!     table *req_hdrs, *resp_hdrs;
!     array_header *reqhdrs_arr;
!     table_entry *reqhdrs_elts;
      struct sockaddr_in server;
      struct in_addr destaddr;
      struct hostent server_hp;
--- 209,217 ----
      char *strp2;
      const char *err, *desthost;
      int i, j, sock,/* len,*/ backasswards;
!     table *req_hdrs, *resp_hdrs, *cookie_temp;
!     array_header *reqhdrs_arr, *resphdrs_arr;
!     table_entry *reqhdrs_elts, *resphdrs_elts;
      struct sockaddr_in server;
      struct in_addr destaddr;
      struct hostent server_hp;
***************
*** 555,560 ****
--- 611,638 ----
      if ((urlstr = ap_table_get(resp_hdrs, "Content-Location")) != NULL)
          ap_table_set(resp_hdrs, "Content-Location", proxy_location_reverse_map
(r, urlstr));
  
+     cookie_temp = ap_make_table( r->pool, 2);
+     resphdrs_arr = ap_table_elts(resp_hdrs);
+     resphdrs_elts = (table_entry *)resphdrs_arr->elts;
+     for (i = 0; i < resphdrs_arr->nelts; i++) {
+       if ( strcmp(resphdrs_elts[i].key, "Set-Cookie") == 0 ){
+       ap_table_add( cookie_temp, "Set-Cookie", proxy_cookie_reverse_map(r, 
resphdrs_elts[i].val) );
+       ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server,
+                "Added cookie Set-Cookie to cookie_temp = %s", 
proxy_cookie_reverse_map(r, resphdrs_elts[i].val) );
+       }
+     }
+ 
+     if( ! ap_is_empty_table( cookie_temp ) ){
+       ap_table_unset(resp_hdrs, "Set-Cookie");
+       resphdrs_arr = ap_table_elts(cookie_temp);
+       resphdrs_elts = (table_entry *)resphdrs_arr->elts;
+       for (i = 0; i < resphdrs_arr->nelts; i++) {
+       ap_table_add(resp_hdrs, "Set-Cookie", resphdrs_elts[i].val);
+       ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server,
+                    "Added cookie Set-Cookie to resp_hdrs = %s", resphdrs_elts
[i].val);
+       }
+     }
+ 
  /* check if NoCache directive on this host */
      if (nocache == 0) {
          for (i = 0; i < conf->nocaches->nelts; i++) {



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to