taking cookie across mod_proxy

taking cookie across mod_proxy

am 16.06.2002 13:48:44 von Maurizio Marini

Hi there!=09

I'm integrating mod_pubcookie (WEBISO) in a server acting as ProxyPass &=20
ProxyPassReverse for some appl server behind it.
My concern is that mod_pubcookie send session cookies to browser during 4=
=20
phase.
Then at handler stage, mod_proxy ignore these fields in headers_out, carr=
ying=20
on only a few of them:

mod_proxy in apache 2.0.36:

804 /* munge the Location and URI response headers according=
to
805 * ProxyPassReverse
806 */
807 {
808 const char *buf;
809 if ((buf =3D apr_table_get(r->headers_out, "Location=
")) !=
NULL) {
810 apr_table_set(r->headers_out, "Location",
811 ap_proxy_location_reverse_map(r, c=
onf,=20
buf));
812 }
813 if ((buf =3D apr_table_get(r->headers_out,=20
"Content-Location")) !=3D NULL) {
814 apr_table_set(r->headers_out, "Content-Location"=
,
815 ap_proxy_location_reverse_map(r, c=
onf,=20
buf));
816 }
817 if ((buf =3D apr_table_get(r->headers_out, "URI")) !=
=3D NULL)=20
{
818 apr_table_set(r->headers_out, "URI",
819 ap_proxy_location_reverse_map(r, c=
onf,=20
buf));
820 }
821 }


mod_proxy in apache 1.3.2x:


497 * HTTP/1.0 requires us to accept 3 types of dates, but only gen=
erate
498 * one type
499 */
500 if ((datestr =3D ap_table_get(resp_hdrs, "Date")) !=3D NULL)
501 ap_table_set(resp_hdrs, "Date", ap_proxy_date_canon(p,=20
datestr));
502 if ((datestr =3D ap_table_get(resp_hdrs, "Last-Modified")) !=
=3D NULL)
503 ap_table_set(resp_hdrs, "Last-Modified",=20
ap_proxy_date_canon(p, datestr));
504 if ((datestr =3D ap_table_get(resp_hdrs, "Expires")) !=3D NU=
LL)
505 ap_table_set(resp_hdrs, "Expires", ap_proxy_date_canon(p=
,=20
datestr));
506
507 if ((datestr =3D ap_table_get(resp_hdrs, "Location")) !=3D N=
ULL)
508 ap_table_set(resp_hdrs, "Location",=20
proxy_location_reverse_map(r, datestr));
509 if ((datestr =3D ap_table_get(resp_hdrs, "URI")) !=3D NULL)
510 ap_table_set(resp_hdrs, "URI", proxy_location_reverse_ma=
p(r,=20
datestr));




Now, I've developed a patch for 1.3.2x that:
1) point to topmost request
2) extract from headers_out Set-cookie elts, if any of them exist
3) add them to current request

512 ap_table_get_next(r->headers_out, NULL);
513 i=3D0;
514 while( elts =3D ap_table_get_next(r->headers_out, "Set-Cook=
ie")){
515 newelts[i]=3Dap_palloc(r->pool, strlen(elts)+1);
516 strcpy(newelts[i],elts);
517 i++;
518 }
519
520 for ( j =3D 0; j < i; j++ ){
521 ap_log_rerror(APLOG_MARK,=20
APLOG_NOERRNO|APLOG_DEBUG,r,"handler_auth_ok[%d]: current r->newelts[%d]:=
=20
%s\n",
522 __LINE__, j, newelts[j]);
523 ap_table_add(resp_hdrs, "Set-Cookie", newelts[j]=
);
524 }
525

The patch I developed, for now, applies to version 1.3.2x, only.
The patch is suited for our goals, only, i fear.

I'm wondering if I've violated any rfc, doing this.
If not, can be this patch submitted to 1.3.24 cvs?
Thnx in advance for your consideration,
any suggestion will be very very appreciated.

Maurizio Marini =20
CosT Srl Via Longhi, 13 - 20137 Milano
Tel. Direct (+39)02 45446 202 Fax +39-2-45446333
mailto:maumar@datalogica.com GSM +39-335-8259739