You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/05/05 04:32:31 UTC
[trafficserver] branch 8.1.x updated: Handle response parsing case
where EOF happens before any data arrives.
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.1.x by this push:
new 7b01541 Handle response parsing case where EOF happens before any data arrives.
7b01541 is described below
commit 7b015413b00fdce318a9735b3ce4ea402c9fd67e
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Tue Jul 10 11:34:08 2018 -0500
Handle response parsing case where EOF happens before any data arrives.
(cherry picked from commit 712a5e6501e43809d8a51d33473339b6e89d15e7)
---
proxy/hdrs/HdrTSOnly.cc | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/proxy/hdrs/HdrTSOnly.cc b/proxy/hdrs/HdrTSOnly.cc
index 9f96b85..6841b1e 100644
--- a/proxy/hdrs/HdrTSOnly.cc
+++ b/proxy/hdrs/HdrTSOnly.cc
@@ -100,13 +100,21 @@ HTTPHdr::parse_resp(HTTPParser *parser, IOBufferReader *r, int *bytes_used, bool
do {
int64_t b_avail = r->block_read_avail();
+ tmp = start = r->start();
- if (b_avail <= 0 && eof == false) {
- break;
+ // No data currently available.
+ if (b_avail <= 0) {
+ if (eof == false) { // more data may arrive later, return CONTINUE state.
+ break;
+ } else if (nullptr == start) {
+ // EOF on empty MIOBuffer - that's a fail, don't bother with parsing.
+ // (otherwise will attempt to attach_block a non-existent block)
+ state = PARSE_RESULT_ERROR;
+ break;
+ }
}
- tmp = start = r->start();
- end = start + b_avail;
+ end = start + b_avail;
int heap_slot = m_heap->attach_block(r->get_current_block(), start);