httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r179622 - in /httpd/httpd/trunk: CHANGES modules/metadata/mod_mime_magic.c
Date Thu, 02 Jun 2005 18:24:28 GMT
Author: trawick
Date: Thu Jun  2 11:24:27 2005
New Revision: 179622

URL: http://svn.apache.org/viewcvs?rev=179622&view=rev
Log:
mod_mime_magic: Handle CRLF-format magic files so that it works with
the default installation on Windows.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/metadata/mod_mime_magic.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=179622&r1=179621&r2=179622&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES (original)
+++ httpd/httpd/trunk/CHANGES Thu Jun  2 11:24:27 2005
@@ -2,6 +2,9 @@
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_mime_magic: Handle CRLF-format magic files so that it works with
+     the default installation on Windows.  [Jeff Trawick]
+
   *) core: Allow multiple modules to register interest in a single 
      configuration command. [Paul Querna]
 

Modified: httpd/httpd/trunk/modules/metadata/mod_mime_magic.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/metadata/mod_mime_magic.c?rev=179622&r1=179621&r2=179622&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_mime_magic.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_mime_magic.c Thu Jun  2 11:24:27 2005
@@ -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 */
 
-	/* delete newline */
-	if (line[0]) {
-	    line[strlen(line) - 1] = '\0';
-	}
-
+	/* delete newline and potential carriage return */
+        if (*last == '\n') {
+            *last = '\0';
+            --last;
+        }
+        if (*last == '\r') {
+            *last = '\0';
+        }
+        
 	/* skip leading whitespace */
 	ws_offset = 0;
 	while (line[ws_offset] && apr_isspace(line[ws_offset])) {



Mime
View raw message