[jboss-jira] [JBoss JIRA] (JBWEB-238) HTTP Upgrade API Broken
Remy Maucherat (JIRA)
jira-events at lists.jboss.org
Fri Apr 13 15:25:47 EDT 2012
[ https://issues.jboss.org/browse/JBWEB-238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12684056#comment-12684056 ]
Remy Maucherat commented on JBWEB-238:
--------------------------------------
After verifying in the HTTP spec, all 1xx status codes indeed have no entity body, that's what I remembered but I wasn't sure yet. So adding the body parameter in the sendUpgrade method is wrong. Similarly, your patch adds hacks to disable length delimitation on input. Neither of this is nice, which is why I cannot commit your patch.
OTOH, it is possible to consider that this "entity body" of the response is part of the upgraded protocol, as I mentioned in a previous comment (essentially, doing a separate write after the sendUpgrade()). Similarly, it would be possible to do reads for the request body if it had proper content delimitation, like a content-length. After the upgrade, it is always possible to read it, so that's the solution I recommend since the response header doesn't contain the handshake, which makes this trick doable.
I am attaching an example that works, reading the input content for the handshake, then writing output data. It's a bit inconvinient, but it works, and that's the best I can do.
As for future proofing other protocol upgrades, I trust they would read the HTTP specification this time. (ok, won't happen probably)
> HTTP Upgrade API Broken
> -----------------------
>
> Key: JBWEB-238
> URL: https://issues.jboss.org/browse/JBWEB-238
> Project: JBoss Web
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: JBossWeb-7.0.13.GA
> Environment: Any
> Reporter: Mike Brock
> Assignee: Remy Maucherat
> Attachments: cdidemo2.war, JBossWeb.patch
>
>
> The HTTP Upgrade API currently does not permit reading and writing to the ServetOutputStream and ServletInputStream during the initial negotiation. All of the data is swallowed until after the negotiation and head exchange.
> Unfortunately this is insufficient as some WebSocket Draft Specification rely on data within the body of the request and response as part of the handshake.
> The attached patch fixes this problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list