dgaudet 98/02/06 01:11:42
Modified:src CHANGES
src/modules/standard mod_autoindex.c mod_mime.c
mod_negotiation.c
Log:
HTTP/1.1 requires x-gzip and gzip encodings be treated
equivalent, similarly for x-compress and compress. Apache
now ignores a leading x- when comparing encodings. It also
preserves the encoding the client requests (for example if
it requests x-gzip, then Apache will respond with x-gzip
in the Content-Encoding header).
PR: 1772
Submitted by: Ronald Tschalaer <[EMAIL PROTECTED]>
Reviewed by: Dean Gaudet, Roy Fielding (concept)
Revision ChangesPath
1.617 +9 -1 apache-1.3/src/CHANGES
Index: CHANGES
===
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.616
retrieving revision 1.617
diff -u -r1.616 -r1.617
--- CHANGES 1998/02/04 21:23:30 1.616
+++ CHANGES 1998/02/06 09:11:36 1.617
@@ -1,5 +1,13 @@
Changes with Apache 1.3b4
-
+
+ *) HTTP/1.1 requires x-gzip and gzip encodings be treated
+ equivalent, similarly for x-compress and compress. Apache
+ now ignores a leading x- when comparing encodings. It also
+ preserves the encoding the client requests (for example if
+ it requests x-gzip, then Apache will respond with x-gzip
+ in the Content-Encoding header).
+ [Ronald Tschalaer <[EMAIL PROTECTED]>] PR#1772
+
*) Fix a memory leak on keep-alive connections. [Igor Tatarinov]
*) Added mod_so module to support dynamic loading of modules on Unix
1.66 +12 -0 apache-1.3/src/modules/standard/mod_autoindex.c
Index: mod_autoindex.c
===
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- mod_autoindex.c 1998/01/29 20:36:11 1.65
+++ mod_autoindex.c 1998/02/06 09:11:39 1.66
@@ -176,6 +176,12 @@
if (cmd->info == BY_PATH)
if (!strcmp(to, "**DIRECTORY**"))
to = "^^DIRECTORY^^";
+if (cmd->info == BY_ENCODING) {
+ str_tolower(to);
+ if (to[0] == 'x' && to[1] == '-') {
+ to += 2;
+ }
+}
push_item(((autoindex_config_rec *) d)->alt_list, cmd->info, to,
cmd->path, alt);
return NULL;
@@ -199,6 +205,12 @@
if (cmd->info == BY_PATH)
if (!strcmp(to, "**DIRECTORY**"))
to = "^^DIRECTORY^^";
+if (cmd->info == BY_ENCODING) {
+ str_tolower(to);
+ if (to[0] == 'x' && to[1] == '-') {
+ to += 2;
+ }
+}
push_item(((autoindex_config_rec *) d)->icon_list, cmd->info, to,
cmd->path,
iconbak);
1.30 +2 -0 apache-1.3/src/modules/standard/mod_mime.c
Index: mod_mime.c
===
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_mime.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mod_mime.c1998/01/13 23:11:23 1.29
+++ mod_mime.c1998/02/06 09:11:39 1.30
@@ -127,6 +127,8 @@
{
if (*ext == '.')
++ext;
+if ((enc[0] == 'x' || enc[0] == 'X') && enc[1] == '-')
+enc += 2;
table_set(m->encoding_types, ext, enc);
return NULL;
}
1.67 +9 -3 apache-1.3/src/modules/standard/mod_negotiation.c
Index: mod_negotiation.c
===
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_negotiation.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- mod_negotiation.c 1998/01/27 10:00:44 1.66
+++ mod_negotiation.c 1998/02/06 09:11:40 1.67
@@ -1468,7 +1468,6 @@
return;
}
-
/* if no Accept: header, leave quality alone (will
* remain at the default value of 1) */
if (neg->accept_encodings->nelts == 0) {
@@ -1483,9 +1482,14 @@
*/
for (i = 0; i < neg->accept_encodings->nelts; ++i) {
char *name = accept_recs[i].type_name;
+int off = 0;
+
+ if (name[0] == 'x' && name[1] == '-')
+off = 2;
-if (!strcmp(name, enc)) {
+if (!strcmp(name+off, enc)) {
variant->encoding_quality = 1;
+variant->content_encoding = name;
return;
}
}
@@ -2192,7 +2196,9 @@
r->filename = sub_req->filename;
r->handler = sub_req->handler;
r->content_type = sub_req->content_type;
-r->content_encoding = sub_req->content_encoding;
+/* it may have been modified, so that it would match the exact encoding
+ * requested by the client (i.e.