This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new 805dd12 Change header validation
805dd12 is described below
commit 805dd12dcbff171a1e9c27063e14bcddbfd61e2a
Author: ZeddYu Lu <[email protected]>
AuthorDate: Tue Feb 4 11:20:13 2020 -0800
Change header validation
(cherry picked from commit 5830bc72611e85e7a31098ce86710242f29076dc)
Conflicts:
proxy/hdrs/HTTP.cc
---
proxy/hdrs/HTTP.cc | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index 6566dab..b96ccf8 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1120,19 +1120,17 @@ http_parser_parse_req(HTTPParser *parser, HdrHeap
*heap, HTTPHdrImpl *hh, const
end = real_end;
parser->m_parsing_http = false;
-
- ParseResult ret = mime_parser_parse(&parser->m_mime_parser, heap,
hh->m_fields_impl, start, end, must_copy_strings, eof);
- // If we're done with the main parse do some validation
- if (ret == PARSE_RESULT_DONE) {
- ret = validate_hdr_host(hh); // check HOST header
- }
- if (ret == PARSE_RESULT_DONE) {
- ret = validate_hdr_content_length(heap, hh);
- }
- return ret;
}
- return mime_parser_parse(&parser->m_mime_parser, heap, hh->m_fields_impl,
start, end, must_copy_strings, eof);
+ ParseResult ret = mime_parser_parse(&parser->m_mime_parser, heap,
hh->m_fields_impl, start, end, must_copy_strings, eof);
+ // If we're done with the main parse do some validation
+ if (ret == PARSE_RESULT_DONE) {
+ ret = validate_hdr_host(hh); // check HOST header
+ }
+ if (ret == PARSE_RESULT_DONE) {
+ ret = validate_hdr_content_length(heap, hh);
+ }
+ return ret;
}
ParseResult
@@ -1187,7 +1185,7 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl
*hh)
if (mime_hdr_field_find(hh->m_fields_impl, MIME_FIELD_TRANSFER_ENCODING,
MIME_LEN_TRANSFER_ENCODING) != nullptr) {
// Delete all Content-Length headers
Debug("http", "Transfer-Encoding header and Content-Length headers the
request, removing all Content-Length headers");
- mime_hdr_field_delete(heap, hh->m_fields_impl, content_length_field);
+ mime_hdr_field_delete(heap, hh->m_fields_impl, content_length_field,
true);
return PARSE_RESULT_DONE;
}