You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Fred Tyler <fr...@gmail.com> on 2007/05/04 07:07:34 UTC

[users@httpd] Getting rid of "Vary" by altering mod_negotiation.c

Sorry for all the followups, but I wanted to post one this last
modification for comments.

Below you'll see the change I made to mod_negotiation.c that prevents
it from appending the Vary, TCN, and Content-Location headers. Since I
am only using mod_negotiation to allow me to use extension-less URLs,
I do not see a need for any of these headers.

With these changes, all of the Internet Explorer problems disappear.
It properly caches all files and does not have problem with
dynamically generated things like favicons and m3u playlists.

This modification feels "safer" than the one I previously sent.
Unconditionally wiping out the "Vary" header seems a little harsh, and
it seems like it could potentially interfere with other modules that
use "Vary", like mod_deflate and mod_proxy. (I'm just guessing about
this though.)

So... the mod_negotiation.c modifications are shown below. Is there
anything danger in doing this?


********************************************
  Change to mod_negotiation.c in 1.3.37
********************************************


--- mod_negotiation.c,orig      2007-05-04 04:18:37.000000000 +0000
+++ mod_negotiation.c   2007-05-04 04:50:17.000000000 +0000
@@ -2231,21 +2231,21 @@
                         ap_array_pstrcat(r->pool, arr, '\0'));
     }

-    if (neg->is_transparent || vary_by_type || vary_by_language ||
-        vary_by_language || vary_by_charset || vary_by_encoding) {
-
-        ap_table_mergen(hdrs, "Vary", 2 + ap_pstrcat(r->pool,
-            neg->is_transparent ? ", negotiate"       : "",
-            vary_by_type        ? ", accept"          : "",
-            vary_by_language    ? ", accept-language" : "",
-            vary_by_charset     ? ", accept-charset"  : "",
-            vary_by_encoding    ? ", accept-encoding" : "", NULL));
-    }
-
-    if (neg->is_transparent) { /* Create TCN response header */
-        ap_table_setn(hdrs, "TCN",
-                      alg_result == alg_list ? "list" : "choice");
-    }
+//    if (neg->is_transparent || vary_by_type || vary_by_language ||
+//        vary_by_language || vary_by_charset || vary_by_encoding) {
+//
+//        ap_table_mergen(hdrs, "Vary", 2 + ap_pstrcat(r->pool,
+//            neg->is_transparent ? ", negotiate"       : "",
+//            vary_by_type        ? ", accept"          : "",
+//            vary_by_language    ? ", accept-language" : "",
+//            vary_by_charset     ? ", accept-charset"  : "",
+//            vary_by_encoding    ? ", accept-encoding" : "", NULL));
+//    }
+//
+//    if (neg->is_transparent) { /* Create TCN response header */
+//        ap_table_setn(hdrs, "TCN",
+//                      alg_result == alg_list ? "list" : "choice");
+//    }
 }

 /**********************************************************************
@@ -2427,8 +2427,8 @@
         ap_table_unset(sub_req->err_headers_out, "Vary");
     }

-    ap_table_setn(r->err_headers_out, "Content-Location",
-                  ap_pstrdup(r->pool, variant->file_name));
+//    ap_table_setn(r->err_headers_out, "Content-Location",
+//                  ap_pstrdup(r->pool, variant->file_name));

     set_neg_headers(r, neg, alg_choice);         /* add Alternates and Vary */




********************************************
  Change to mod_negotiation.c in 2.2.4
********************************************



--- modules/mappers/mod_negotiation.c,orig      2007-05-04
04:45:00.000000000 +0000
+++ modules/mappers/mod_negotiation.c   2007-05-04 04:46:08.000000000 +0000
@@ -2605,21 +2605,21 @@
                         apr_array_pstrcat(r->pool, arr, '\0'));
     }

-    if (neg->is_transparent || vary_by_type || vary_by_language ||
-        vary_by_language || vary_by_charset || vary_by_encoding) {
-
-        apr_table_mergen(hdrs, "Vary", 2 + apr_pstrcat(r->pool,
-            neg->is_transparent ? ", negotiate"       : "",
-            vary_by_type        ? ", accept"          : "",
-            vary_by_language    ? ", accept-language" : "",
-            vary_by_charset     ? ", accept-charset"  : "",
-            vary_by_encoding    ? ", accept-encoding" : "", NULL));
-    }
-
-    if (neg->is_transparent) { /* Create TCN response header */
-        apr_table_setn(hdrs, "TCN",
-                      alg_result == alg_list ? "list" : "choice");
-    }
+//    if (neg->is_transparent || vary_by_type || vary_by_language ||
+//        vary_by_language || vary_by_charset || vary_by_encoding) {
+//
+//        apr_table_mergen(hdrs, "Vary", 2 + apr_pstrcat(r->pool,
+//            neg->is_transparent ? ", negotiate"       : "",
+//            vary_by_type        ? ", accept"          : "",
+//            vary_by_language    ? ", accept-language" : "",
+//            vary_by_charset     ? ", accept-charset"  : "",
+//            vary_by_encoding    ? ", accept-encoding" : "", NULL));
+//    }
+//
+//    if (neg->is_transparent) { /* Create TCN response header */
+//        apr_table_setn(hdrs, "TCN",
+//                      alg_result == alg_list ? "list" : "choice");
+//    }
 }

 /**********************************************************************
@@ -2803,8 +2803,8 @@
         apr_table_unset(sub_req->err_headers_out, "Vary");
     }

-    apr_table_setn(r->err_headers_out, "Content-Location",
-                  apr_pstrdup(r->pool, variant->file_name));
+//    apr_table_setn(r->err_headers_out, "Content-Location",
+//                  apr_pstrdup(r->pool, variant->file_name));

     set_neg_headers(r, neg, alg_choice);         /* add Alternates and Vary */

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org