]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r179622 and r280114 from trunk:
authorColm MacCarthaigh <colm@apache.org>
Mon, 23 Jan 2006 20:16:54 +0000 (20:16 +0000)
committerColm MacCarthaigh <colm@apache.org>
Mon, 23 Jan 2006 20:16:54 +0000 (20:16 +0000)
* 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

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@371646 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/metadata/mod_mime_magic.c

diff --git a/CHANGES b/CHANGES
index 82522c4aedbc4d906be27005df997c235599f2cb..a5b5cbdae6a71140406fd9a608b40fa2bdd156dc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
 
diff --git a/STATUS b/STATUS
index 0888db417969f9fb653982036fc4f87f6b503b06..c7c0af6e2f0286d9aaa18512e9e90b1f71b495fe 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -133,14 +133,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
          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:
index 0b18f56086e86b5cff2a572b31249bd3a083e05d..9443295a28912627d04d390aaee5f49d065fd10c 100644 (file)
@@ -947,12 +947,17 @@ static int apprentice(server_rec *s, apr_pool_t *p)
     /* parse it */
     for (lineno = 1; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) {
        int ws_offset;
-
-       /* delete newline */
-       if (line[0]) {
-           line[strlen(line) - 1] = '\0';
-       }
-
+        char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 since an
+                                               * "empty" line contains a '\n'
+                                               */
+
+       /* 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])) {