You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2006/01/23 21:17:04 UTC

svn commit: r371646 - in /httpd/httpd/branches/2.0.x: CHANGES STATUS modules/metadata/mod_mime_magic.c

Author: colm
Date: Mon Jan 23 12:16:54 2006
New Revision: 371646

URL: http://svn.apache.org/viewcvs?rev=371646&view=rev
Log:
Merge r179622 and r280114 from trunk:

* mod_mime_magic: Handle CRLF-format magic files so that it works with
  the default installation on Windows.

* rewrite CR mitigation logic to wipe out any trailing
  white space

Suggested by: wrowe
Submitted by: trawick

Modified:
    httpd/httpd/branches/2.0.x/CHANGES
    httpd/httpd/branches/2.0.x/STATUS
    httpd/httpd/branches/2.0.x/modules/metadata/mod_mime_magic.c

Modified: httpd/httpd/branches/2.0.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/CHANGES?rev=371646&r1=371645&r2=371646&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.0.x/CHANGES [utf-8] Mon Jan 23 12:16:54 2006
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.0.56
 
+  *) mod_mime_magic: Handle CRLF-format magic files so that it works with
+     the default installation on Windows.  [Jeff Trawick]
+
   *) Write message to error log if AuthGroupFile cannot be opened.
      PR 37566.  [Rüdiger Plüm]
 

Modified: httpd/httpd/branches/2.0.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/STATUS?rev=371646&r1=371645&r2=371646&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/STATUS (original)
+++ httpd/httpd/branches/2.0.x/STATUS Mon Jan 23 12:16:54 2006
@@ -133,14 +133,6 @@
          http://svn.apache.org/viewcvs?view=rev&rev=154319
        +1: stoddard, striker, wrowe (as corrected in subsequent patches)
 
-    *) mod_mime_magic: Handle CRLF-format^H^H^H^H^H^H^H magic files 
-       with any trailing whitespace so that it works with the
-       default installation on Windows.
-       http://svn.apache.org/viewcvs?rev=179622&view=rev
-       http://svn.apache.org/viewcvs?rev=280114&view=rev
-       +1: trawick, wrowe, colm
-        backported 280114 to 2.2.x branch already
-
     *) mod_dav: Fix a null pointer dereference in an error code path during the
        handling of MKCOL.
        Trunk version of patch:

Modified: httpd/httpd/branches/2.0.x/modules/metadata/mod_mime_magic.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/metadata/mod_mime_magic.c?rev=371646&r1=371645&r2=371646&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/metadata/mod_mime_magic.c (original)
+++ httpd/httpd/branches/2.0.x/modules/metadata/mod_mime_magic.c Mon Jan 23 12:16:54 2006
@@ -947,12 +947,17 @@
     /* parse it */
     for (lineno = 1; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) {
 	int ws_offset;
+        char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 since an
+                                               * "empty" line contains a '\n'
+                                               */
 
-	/* delete newline */
-	if (line[0]) {
-	    line[strlen(line) - 1] = '\0';
-	}
-
+	/* delete newline and any other trailing whitespace */
+        while (last >= line
+               && apr_isspace(*last)) {
+            *last = '\0';
+            --last;
+        }
+        
 	/* skip leading whitespace */
 	ws_offset = 0;
 	while (line[ws_offset] && apr_isspace(line[ws_offset])) {