dgaudet 98/02/11 17:09:47
Modified: src CHANGES src/modules/standard mod_autoindex.c mod_mime.c mod_negotiation.c Log: Old clients really don't want to see "Content-Encoding: gzip". So now we preserve the encoding given by the AddEncoding directive. This allows us, for example, to move forward with things like "AddEncoding deflate .df", while preserving backwards brokenness with "AddEncoding x-gzip .gz". Submitted by: [EMAIL PROTECTED] Reviewed by: Dean Gaudet Revision Changes Path 1.626 +4 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.625 retrieving revision 1.626 diff -u -r1.625 -r1.626 --- CHANGES 1998/02/09 13:25:40 1.625 +++ CHANGES 1998/02/12 01:09:41 1.626 @@ -1,5 +1,9 @@ Changes with Apache 1.3b5 + *) Preserve the content encoding given by the AddEncoding directive + when the client doesn't otherwise specify an encoding. + [Ronald Tschalaer <[EMAIL PROTECTED]>] + *) WIN32: Append a '.' to extensionless executables in spawn[lv]e* replacements, which makes them work. [Sam Robb <[EMAIL PROTECTED]>, Ben Laurie] 1.67 +0 -6 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.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- mod_autoindex.c 1998/02/06 09:11:39 1.66 +++ mod_autoindex.c 1998/02/12 01:09:44 1.67 @@ -178,9 +178,6 @@ 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); @@ -207,9 +204,6 @@ 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, 1.31 +0 -2 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.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- mod_mime.c 1998/02/06 09:11:39 1.30 +++ mod_mime.c 1998/02/12 01:09:44 1.31 @@ -127,8 +127,6 @@ { if (*ext == '.') ++ext; - if ((enc[0] == 'x' || enc[0] == 'X') && enc[1] == '-') - enc += 2; table_set(m->encoding_types, ext, enc); return NULL; } 1.70 +16 -6 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.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- mod_negotiation.c 1998/02/10 05:54:02 1.69 +++ mod_negotiation.c 1998/02/12 01:09:45 1.70 @@ -1463,6 +1463,7 @@ int i; accept_rec *accept_recs = (accept_rec *) neg->accept_encodings->elts; char *enc = variant->content_encoding; + char *x_enc = NULL; if (!enc || is_identity_encoding(enc)) { return; @@ -1479,19 +1480,28 @@ /* Go through each of the encodings on the Accept-Encoding: header, * looking for a match with our encoding - */ + * Prefer non- 'x-' prefixed token (e.g. gzip over x-gzip) */ + if (enc[0] == 'x' && enc[1] == '-') { + enc += 2; + } 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+off, enc)) { + if (!strcmp(name, enc)) { variant->encoding_quality = 1; variant->content_encoding = name; return; } + + if (name[0] == 'x' && name[1] == '-' && !strcmp(name+2, enc)) { + x_enc = name; + } + } + + if (x_enc != NULL) { + variant->encoding_quality = 1; + variant->content_encoding = x_enc; + return; } /* Encoding not found on Accept-Encoding: header, so it is