You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2020/07/21 17:54:49 UTC
[trafficserver] branch master updated: Add logic to resolve
content-length transfer-encoding conflicts on response (#6992)
This is an automated email from the ASF dual-hosted git repository.
shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 4666d5a Add logic to resolve content-length transfer-encoding conflicts on response (#6992)
4666d5a is described below
commit 4666d5a4ee660a5967de8098e736d87d3226653e
Author: Susan Hinrichs <sh...@yahoo-inc.com>
AuthorDate: Tue Jul 21 12:54:38 2020 -0500
Add logic to resolve content-length transfer-encoding conflicts on response (#6992)
---
proxy/hdrs/HTTP.cc | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index c557172..fb703be 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1252,6 +1252,10 @@ http_parser_parse_resp(HTTPParser *parser, HdrHeap *heap, HTTPHdrImpl *hh, const
if (err < 0) {
return err;
}
+ // Make sure the length headers are consistent
+ if (err == PARSE_RESULT_DONE) {
+ err = validate_hdr_content_length(heap, hh);
+ }
if ((err == PARSE_RESULT_DONE) || (err == PARSE_RESULT_CONT)) {
return err;
}
@@ -1287,7 +1291,12 @@ http_parser_parse_resp(HTTPParser *parser, HdrHeap *heap, HTTPHdrImpl *hh, const
end = real_end;
parser->m_parsing_http = false;
- return mime_parser_parse(&parser->m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, true);
+ auto ret = mime_parser_parse(&parser->m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, true);
+ // Make sure the length headers are consistent
+ if (ret == PARSE_RESULT_DONE) {
+ ret = validate_hdr_content_length(heap, hh);
+ }
+ return ret;
}
#endif
@@ -1402,8 +1411,12 @@ http_parser_parse_resp(HTTPParser *parser, HdrHeap *heap, HTTPHdrImpl *hh, const
end = real_end;
parser->m_parsing_http = false;
}
-
- return mime_parser_parse(&parser->m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, true);
+ auto ret = mime_parser_parse(&parser->m_mime_parser, heap, hh->m_fields_impl, start, end, must_copy_strings, eof, true);
+ // Make sure the length headers are consistent
+ if (ret == PARSE_RESULT_DONE) {
+ ret = validate_hdr_content_length(heap, hh);
+ }
+ return ret;
}
/*-------------------------------------------------------------------------