Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #2222 "100-Continue is not correctly responded for chunked requ… #2224

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

carryel
Copy link
Contributor

@carryel carryel commented Feb 10, 2025

…ests" (#2222)

Chunked Transfer Coding supports 100-continue.

  • In case of chunked transfer coding, "Expect: 100-continue" is processed immediately after HttpHeader is parsed.
  • Added tests for chunked transfer encoding to HttpContinueTest.
  • All tests passed.

PS) However, custom sendAcknowledgment() of HttpHandler cannot be supported in that situation.

…chunked requests" (eclipse-ee4j#2222)

Chunked Transfer Coding supports 100-continue.
+ In case of chunked transfer coding, "Expect: 100-continue" is processed immediately after HttpHeader is parsed.
+ Added tests for chunked transfer encoding to HttpContinueTest.
+ All tests passed.

PS)  However, custom sendAcknowledgment() of HttpHandler cannot be supported in that situation.
@carryel
Copy link
Contributor Author

carryel commented Feb 11, 2025

https://datatracker.ietf.org/doc/html/rfc7231#section-5.1.1 explains it as follows:

 A 100-continue expectation informs recipients that the client is
   about to send a (presumably large) message body in this request and
   wishes to receive a 100 (Continue) interim response if the
   request-line and header fields are not sufficient to cause an
   immediate success, redirect, or error response.

Examples include:

     PUT /somewhere/fun HTTP/1.1
     Host: origin.example.com
     Content-Type: video/h264
     Content-Length: 1234567890987
     Expect: 100-continue

Grizzly handles 100-continue well for HTTP headers with Content-Length, but it does not consider cases where the body has chunk-size, such as chunked transfer coding.

I think the chunked transfer coding spec for 100-continue is a little unclear.
For chunked transfer coding, Grizzly tries to parse up to the chunk-size in the body and passes the control to the HttpHandler. However, in the case of 100-continue, it is determined when only the header is transmitted without the body.

Therefore, in the case of chunked transfer coding, we added the ability to process 100-continue immediately after header parsing is finished.
In other cases, after header parsing, control is passed to HttpHandler as before, and 100-continue is determined therein.
In the case of chunked transfer coding, 100-continue is processed before control is given to HttpHandler, so the existing custom HttpHandler#sendAcknowledgment() in Grizzly cannot be processed. I thought this was the best we could do given the current unclear specs and Grizzly implementation.

@carryel carryel requested a review from a team February 11, 2025 04:58
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.

1 participant