You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2020/02/05 00:33:52 UTC
[trafficserver] branch 8.0.x updated: Change header validation
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.0.x by this push:
new ea847ad Change header validation
ea847ad is described below
commit ea847adb40bd3f86eba5b604ad4b9025896f5d22
Author: ZeddYu Lu <ze...@gmail.com>
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 c30efbe..595ed62 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1125,19 +1125,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
@@ -1189,7 +1187,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;
}