You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2002/03/21 12:38:03 UTC
cvs commit: apache-1.3/src/modules/proxy proxy_http.c proxy_util.c
minfrin 02/03/21 03:38:03
Modified: src CHANGES
src/modules/proxy proxy_http.c proxy_util.c
Log:
Fixed the previous multiple-cookie fix in the proxy. Cookies
are broken in that they contain dates which in turn contain
commas - so merging and then unmerging them breaks Set-Cookie
headers. Sigh.
Revision Changes Path
1.1789 +6 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1788
retrieving revision 1.1789
diff -u -r1.1788 -r1.1789
--- CHANGES 19 Mar 2002 19:17:40 -0000 1.1788
+++ CHANGES 21 Mar 2002 11:38:03 -0000 1.1789
@@ -1,4 +1,10 @@
Changes with Apache 1.3.24
+
+ *) Fixed the previous multiple-cookie fix in the proxy. Cookies
+ are broken in that they contain dates which in turn contain
+ commas - so merging and then unmerging them breaks Set-Cookie
+ headers. Sigh. [Graham Leggett]
+
*) Add ap_uuencode to the httpd.exp exports file used by
the AIX linker. [Bill Stoddard]
1.88 +0 -4 apache-1.3/src/modules/proxy/proxy_http.c
Index: proxy_http.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- proxy_http.c 13 Mar 2002 21:05:32 -0000 1.87
+++ proxy_http.c 21 Mar 2002 11:38:03 -0000 1.88
@@ -539,10 +539,6 @@
r->content_type = ap_table_get (r->headers_out, "Content-Type");
ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Content-Type: %s", r->content_type);
- /* cookies are special: they must not be merged (stupid browsers) */
- ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie");
- ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie2");
-
/* finally output the headers to the client */
ap_send_http_header(r);
1.109 +32 -6 apache-1.3/src/modules/proxy/proxy_util.c
Index: proxy_util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- proxy_util.c 21 Mar 2002 06:10:44 -0000 1.108
+++ proxy_util.c 21 Mar 2002 11:38:03 -0000 1.109
@@ -426,8 +426,11 @@
* Reads headers from a buffer and returns an array of headers.
* Returns NULL on file error
* This routine tries to deal with too long lines and continuation lines.
- * @@@: XXX: FIXME: currently the headers are passed thru un-merged.
- * Is that okay, or should they be collapsed where possible?
+ *
+ * Note: Currently the headers are passed through unmerged. This has to be
+ * done so that headers which react badly to merging (such as Set-Cookie
+ * headers, which contain commas within the date field) do not get stuffed
+ * up.
*/
table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f)
{
@@ -475,8 +478,8 @@
for (end = &value[strlen(value)-1]; end > value && ap_isspace(*end); --end)
*end = '\0';
- /* make sure we merge so as not to destroy duplicated headers */
- ap_table_merge(resp_hdrs, buffer, value);
+ /* make sure we add so as not to destroy duplicated headers */
+ ap_table_add(resp_hdrs, buffer, value);
/* the header was too long; at the least we should skip extra data */
if (len >= size - 1) {
@@ -1447,6 +1450,20 @@
/* overlay one table on another
* keys in base will be replaced by keys in overlay
+ *
+ * Note: this has to be done in a special way, due
+ * to some nastiness when it comes to having multiple
+ * headers in the overlay table. First, we remove all
+ * the headers in the base table that are found in the
+ * overlay table, then we simply concatenate the
+ * tables together.
+ *
+ * The base and overlay tables need not be in the same
+ * pool (and probably won't be).
+ *
+ * If the base table is changed in any way through
+ * being overlayed with the overlay table, this
+ * function returns a 1.
*/
int ap_proxy_table_replace(table *base, table *overlay)
{
@@ -1454,11 +1471,20 @@
int i, q = 0;
const char *val;
+ /* remove overlay's keys from base */
for (i = 0; i < overlay->a.nelts; ++i) {
val = ap_table_get(base, elts[i].key);
- if (!val || strcmp(val, elts[i].val))
+ if (!val || strcmp(val, elts[i].val)) {
q = 1;
- ap_table_set(base, elts[i].key, elts[i].val);
+ }
+ if (val) {
+ ap_table_unset(base, elts[i].key);
+ }
+ }
+
+ /* add overlay to base */
+ for (i = 0; i < overlay->a.nelts; ++i) {
+ ap_table_add(base, elts[i].key, elts[i].val);
}
return q;