cvs commit: apache-1.3/src/modules/standard mod_autoindex.c mod_mime.c mod_negotiation.c

1998-02-06 Thread dgaudet
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.

cvs commit: apache-1.3/src/modules/standard mod_autoindex.c mod_mime.c mod_negotiation.c

1998-02-12 Thread dgaudet
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  ChangesPath
  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.c1998/02/06 09:11:39 1.30
  +++ mod_mime.c1998/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