GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support 1xx codes by SentryMan · Pull Request #31 · robaho/httpserver

Conversation

@SentryMan

@SentryMan SentryMan commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

will not set sent headers to true on informational requests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SentryMan
support 1xx codes
7ef036e
@robaho

robaho commented Oct 7, 2025

Copy link
Copy Markdown
Owner

I really need a bug that describes the problem in detail. All of the core JDK tests pass with the current code so I need to better understand the problem this is addressing and why

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 7, 2025

Copy link
Copy Markdown
Owner

I looked into this a bit. I think the framework needs to be the one sending 100 level responses in some very specific circumstances. The proper place to discuss this is in an issue and not the PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 7, 2025

Copy link
Copy Markdown
Contributor Author

https://bugs.openjdk.org/browse/JDK-8349670

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 7, 2025

Copy link
Copy Markdown
Owner

You’ll have to be more for specific. I don’t see how that relates to this PR. The bug you reference doesn’t discuss 1xx returns in the problem report. There are RFCs that govern what should happen here. We could have an enhancement to support ‘expect continue’ header.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 7, 2025

Copy link
Copy Markdown
Owner

The comments on the bug state that sending interim responses is an anti pattern. I suspect this is something that cannot be changed in order to remain compatible I do think supporting 100 Continue is possible.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 7, 2025

Copy link
Copy Markdown
Contributor Author

Essentially, calling sendheaders twice doesn't work. So you are unable to send a 1xx code using sendheaders, and then call it again to send a 200 for the final response.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 7, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

The comments on the bug state that sending interim responses is an anti pattern.

Read the more recent comments on the issue. or even the PR that's open to fix it

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 7, 2025

Copy link
Copy Markdown
Owner

Please add a compliant test case to the PR - preferably the one from the JDK that tests this. The bug is not fixed and I suspect it is because it breaks compatibility and/or other current documented behavior.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 7, 2025

Copy link
Copy Markdown
Owner

This way I can run the test case against the JDK version as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan
Create InputRead100Test.java
f1273f3
@SentryMan

SentryMan commented Oct 7, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Took a test from the PR to fix on the JDK

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

Hi, I made some comments on the JDK issue regarding the test. openjdk/jdk#27069 (comment)

I think the we need that to ensure things are working as expected.

I am also not certain what the JDK folks are going to decide. I looked at Jetty and it automatically sends the '100 Continue' on the getInputStream() call by the handler. Maybe the exchange needs to track if the continue has been sent already, and if not send it, or we can punt to the manual method your code uses.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 8, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Maybe the exchange needs to track if the continue has been sent already, and if not send it, or we can punt to the manual method your code uses.

I mean that's cool and all, but the specification says

A server MAY omit sending a 100 (Continue) response if it has already received some or all of the content for the corresponding request, or if the framing indicates that there is no content.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

right, so you need to send the 100 Continue if it hasn't received any of the content. The purpose is to enable the sender to not send the body if the request is going to fail. If your test case ensured this - it would hang - that is it expects the continue.

100% that it is a bug in the JDK and the roboho version that neither implements the handling of 'Expect: 100-Continue'.

I believe for consistency it is probably better to have the server automatically respond when the handler attempts to read the input stream, or you will get duplicate '100 Continue' messages - which will break the client reading the response.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

To clarify, if I don't do it in the server, technically every handler must understand 'Expect: 100-Continue' and handle it or the clients will hang.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

I've reviewed and tested the patch and there is another issue. The content-length should really only be set to 0 when switching protocols - and I'm not even sure that is right - it was done solely to enable the websocket approach. Additionally, in the same vein as the "sending the headers twice" the content length is sent with the informational response. This would incorrect (assuming so) in the case of a 100 Continue, because you would send a content length of zero, then in the full response you may have a non zero content length.

So if I pass the -1, then the exchange will be closed, which isn't right. So I think it needs more special case handling.

I am starting to think this is attempting to shoehorn something in (connection upgrades) which the JDK was not designed to support generally. And it really needs this support, and general support for the other interim responses.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

The other major problem, is that calling setResponseHeaders is what sets up the linked output streams, which is also why you are not supposed to call this more than once.

If code was not properly ordered, like first get the input stream, then send the informational then send the response - it would all break.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

It is also why there is the 'websocket' flag in the exchange, due to this support - in order to hand the request over. It seems that maybe I could change this to be an 'upgrade connection' flag at this time, to make switching protocols support more generic.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

SentryMan and others added 6 commits October 8, 2025 17:20
@SentryMan
no contentlength header
152a0dd
@robaho
update build for gradle 9.1.0
a498e88
@robaho
test 100 Continue to Expect header
7896dac
@robaho
handle manual 1xx responses including make connection upgrade generic…
2de1c20
… rather than websocket specific
@robaho
Merge branch '100-continue' of https://github.com/sentryman/httpserver …
ddaca02
…into pr/SentryMan/31
@robaho
update comments
ddf5630
@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

I made some changes and the tests pass, but I am still unclear as to why you needed this - unless you are doing custom protocol upgrades, as the expect/continue is automatically handled.

A handler could call sendResponseHeaders(101,0) and take over the streams but it isn't documented on how to do this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho
robaho merged commit 7ed4d26 into robaho:main Oct 8, 2025
@robaho

robaho commented Oct 8, 2025

Copy link
Copy Markdown
Owner

Depending on the protocol, there may still be issues as well, as the connection timeouts could come into play.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

I am still unclear as to why you needed this

I don't have a particular reason, saw the JDK had a bug and thought I might gain wisdom if I added a fix here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 9, 2025

Copy link
Copy Markdown
Contributor Author

and clearly it paid off

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan
SentryMan deleted the 100-continue branch October 9, 2025 02:16
@robaho

robaho commented Oct 10, 2025

Copy link
Copy Markdown
Owner

Also, if you’re inclined, I’m not against the PR to send the continue when the request is read. To me that makes more sense, so the handler has a chance to reject it. There is still the issue of the headers being sent instead of a set designed for the interim responses.

Seems to me that the ‘create interim response headers’ should be a callback on the exchange - but the JDK team has been very reluctant to make api changes. It’s like pulling teeth.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

There is still the issue of the headers being sent instead of a set designed for the interim responses.

that we can change

It’s like pulling teeth.

Indeed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 10, 2025

Copy link
Copy Markdown
Owner

I don’t think we can change that without an api change by the JDK team. The exchange interface is defined by them.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SentryMan

SentryMan commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

That is, we don't send 100 with send response headers and just rely on the automatic send when reading

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robaho

robaho commented Oct 10, 2025

Copy link
Copy Markdown
Owner

Yes, for 100 we would send no additional headers just like now - but we’d send them at the correct time allowing more efficient clients.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@SentryMan @robaho
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.