From ca496593e905cadd5ed4dd80d9760d8856ff4b26 Mon Sep 17 00:00:00 2001 From: steveselva <100062566+SteveSelva@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:58:04 +0530 Subject: [PATCH] Update HTTP1xCodec.cpp Added extra check for ignoreBody with ContentLength header. --- proxygen/lib/http/codec/HTTP1xCodec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxygen/lib/http/codec/HTTP1xCodec.cpp b/proxygen/lib/http/codec/HTTP1xCodec.cpp index 66c34ea0a7..31518f53b7 100644 --- a/proxygen/lib/http/codec/HTTP1xCodec.cpp +++ b/proxygen/lib/http/codec/HTTP1xCodec.cpp @@ -1198,7 +1198,8 @@ int HTTP1xCodec::onHeadersComplete(size_t len) { ignoreBody = false; } else { is1xxResponse_ = msg_->is1xxResponse(); - if (connectRequest_ && (msg_->is4xxResponse() || msg_->is5xxResponse())) { + std::string contentLengthHeader = msg_->getHeaders().getSingleOrEmpty(HTTP_HEADER_CONTENT_LENGTH); + if (connectRequest_ && (msg_->is4xxResponse() || msg_->is5xxResponse()) && !contentLengthHeader.empty() && std::stol(contentLengthHeader) != 0) { ignoreBody = false; } else if (expectNoResponseBody_) { ignoreBody = true;