Author: wrowe
Date: Sun Sep 11 13:28:20 2005
New Revision: 280177
URL: http://svn.apache.org/viewcvs?rev=280177&view=rev
Log:
Backport 280114
rewrite CR mitigation logic to wipe out any trailing
white space
Submitted by: trawick
Suggested and reviewed by: wrowe
Modified:
httpd/httpd/branches/2.2.x/modules/metadata/mod_mime_magic.c
Modified: httpd/httpd/branches/2.2.x/modules/metadata/mod_mime_magic.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/metadata/mod_mime_magic.c?rev=280177&r1=280176&r2=280177&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/metadata/mod_mime_magic.c (original)
+++ httpd/httpd/branches/2.2.x/modules/metadata/mod_mime_magic.c Sun Sep 11 13:28:20 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 */
|