GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — Support 1xx codes by SentryMan · Pull Request #31 · robaho/httpserver Conversation
Owner
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Owner
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Owner
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Owner
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
Read the more recent comments on the issue. or even the PR that's open to fix it |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This way I can run the test case against the JDK version as well. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Took a test from the PR to fix on the JDK |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I mean that's cool and all, but the specification says
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… rather than websocket specific
…into pr/SentryMan/31
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Depending on the protocol, there may still be issues as well, as the connection timeouts could come into play. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
and clearly it paid off |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
that we can change
Indeed |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don’t think we can change that without an api change by the JDK team. The exchange interface is defined by them. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
That is, we don't send 100 with send response headers and just rely on the automatic send when reading |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.