Revision: 14638
Author: adrian.chadd
Date: Tue May 4 21:44:21 2010
Log: Issue #108 - Move the HDR_OTHER whitespace check into the header entry
parsing code
rather than being done after the header entry has been parsed
and created.
http://code.google.com/p/lusca-cache/source/detail?r=14638
Modified:
/branches/LUSCA_HEAD/libhttp/HttpHeaderParse.c
=======================================
--- /branches/LUSCA_HEAD/libhttp/HttpHeaderParse.c Sat Apr 17 23:48:30 2010
+++ /branches/LUSCA_HEAD/libhttp/HttpHeaderParse.c Tue May 4 21:44:21 2010
@@ -114,19 +114,6 @@
}
return 1;
}
-
-static int
-hh_check_other(HttpHeader *hdr, int id, String *name, String *value)
-{
- if (stringHasWhitespace(strBuf(*name))) {
- debug(55, httpConfig_relaxed_parser <= 0 ? 1 : 2)
- ("WARNING: found whitespace in HTTP header name {%.*s}\n",
strLen2(*name), strBuf2(*name));
- if (!httpConfig_relaxed_parser) {
- return -1;
- }
- }
- return 1;
-}
/*
* -1: invalid header, return error
@@ -139,9 +126,6 @@
if (id == HDR_CONTENT_LENGTH) {
return(hh_check_content_length(hdr, value));
}
- if (id == HDR_OTHER) {
- return(hh_check_other(hdr, id, name, value));
- }
return 1;
}
@@ -289,6 +273,17 @@
return NULL;
}
+ /* Is it an OTHER header? Verify the header contents don't have
whitespace! */
+
+ if (id == HDR_OTHER && strpbrk_n(field_start, name_len, w_space)) {
+ debug(55, httpConfig_relaxed_parser <= 0 ? 1 : 2)
+ ("WARNING: found whitespace in HTTP header name {%.*s}\n", name_len,
field_start);
+ if (!httpConfig_relaxed_parser) {
+ return NULL;
+ }
+ }
+
+ /* Create the entry and return it */
e = memPoolAlloc(pool_http_header_entry);
debug(55, 9) ("creating entry %p: near '%.*s'\n", e,
charBufferSize(field_start, field_end), field_start);
e->id = id;
--
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en.