Skip to content

Fix unkown length response#550

Open
TingDaoK wants to merge 8 commits intomainfrom
fix-unkown-length-response
Open

Fix unkown length response#550
TingDaoK wants to merge 8 commits intomainfrom
fix-unkown-length-response

Conversation

@TingDaoK
Copy link
Contributor

Issue #, if available:

Description of changes:

  • The HTTP client currently treat the response completes after the headers if no transfer encoding nor content-length received.
  • But, the SPEC clearly mentioned that is a valid case for the response to provide indeterminate length response. (But request is not allowed to do so.)
  • Add support to handle the case by leave the decoder

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TingDaoK TingDaoK marked this pull request as ready for review February 21, 2026 00:28
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.78%. Comparing base (a9745ea) to head (fd61a12).

Files with missing lines Patch % Lines
source/h1_connection.c 75.00% 1 Missing ⚠️
source/h1_decoder.c 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #550      +/-   ##
==========================================
+ Coverage   79.72%   79.78%   +0.05%     
==========================================
  Files          28       28              
  Lines       11894    11920      +26     
==========================================
+ Hits         9483     9510      +27     
+ Misses       2411     2410       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

/* RFC-7230 section 3.3 Message Body */
decoder->body_headers_ignored |= code_val == AWS_HTTP_STATUS_CODE_304_NOT_MODIFIED;
if (decoder->body_headers_ignored_on_2xx) {
decoder->body_headers_ignored |= code_val / 200 == 1;
Copy link
Contributor

@azkrishpy azkrishpy Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2xx (Successful) responses to a CONNECT request method (Section 4.3.6 of[RFC7231]) 
switch to tunnel mode instead of having a message body. All 1xx (Informational), 
204 (No Content), and 304 (Not Modified) responses do not include a message body.  
All other responses do include a message body, although the body might be of zero length.

we seem to ignore body for any value between 200 and 400? Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was wrong about the math, this is supposed to be status code from 200-299.
Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants