httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r280114 - /httpd/httpd/trunk/modules/metadata/mod_mime_magic.c
Date Sun, 11 Sep 2005 12:35:58 GMT
Author: trawick
Date: Sun Sep 11 05:35:56 2005
New Revision: 280114

URL: http://svn.apache.org/viewcvs?rev=280114&view=rev
Log:
rewrite CR mitigation logic to wipe out any trailing
white space

Suggested by: wrowe

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

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=280114&r1=280113&r2=280114&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_mime_magic.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_mime_magic.c Sun Sep 11 05:35:56 2005
@@ -947,15 +947,15 @@
     /* 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 */
+        char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 since an
+                                               * "empty" line contains a '\n'
+                                               */
 
-	/* delete newline and potential carriage return */
-        if (*last == '\n') {
+	/* delete newline and any other trailing whitespace */
+        while (last >= line
+               && apr_isspace(*last)) {
             *last = '\0';
             --last;
-        }
-        if (*last == '\r') {
-            *last = '\0';
         }
         
 	/* skip leading whitespace */



Mime
View raw message