-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add PerMessageDeflate Extension support, see #574 #866
Conversation
Hey @marci4, Codacy/PR Quality Review is complaining about the unused static variables. I will send a commit to fix it, but do you think should I comment them out until they are needed, or remove them completely ? |
Hey @haruntuncay, Sorry that this is not yet merged but as you know I am on vacation for 3 more weeks :) Best regards, |
1 similar comment
Hey @haruntuncay, Sorry that this is not yet merged but as you know I am on vacation for 3 more weeks :) Best regards, |
Hi @marci4,
Absolutely no problem, have a nice and fun vacation :) |
@haruntuncay just chatted with @TooTallNate about granting you access to manage this repo |
Hey @haruntuncay, just sent you an invite to be a collaborator on the project. Thank you in advance for any work your put in. 🍻 on me if you ever give SF a visit! |
Hello @TooTallNate, May I ask, just out of curiosity, how did you decided to intive me to collaborate on this project ? (I ask this because I originally was chatting with the socket.io java client maintainers and was surprised to see this invitation. 😄 ) |
Hello @haruntuncay, sorry for the delayed response. I was testing your changes against the autobahn testsuite (see here) and it seems that there is an issue in the encoding process. Could you take a look at this? Thank you! Best regards, |
|
||
@Override | ||
public boolean acceptProvidedExtensionAsClient(String inputExtension) { | ||
String[] requestedExtensions = inputExtension.split(","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not split by ; ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe specification states that extensions are seperated by commas( , ), and parameters to extensions are seperated by semi-colons( ; ).
Sec-WebSocket-Extensions = extension-list
extension-list = 1#extension
extension = extension-token *( ";" extension-param )
extension-token = registered-token
registered-token = token
extension-param = token [ "=" (token | quoted-string) ]
;When using the quoted-string syntax variant, the value
;after quoted-string unescaping MUST conform to the
;'token' ABNF.
An example from the spec:
Spec-WebSocket-Extensions: mux; max-channels=4; flow-control, deflate-stream
This example shows the usage of mux
extension with parameters max-channels=4,
flow-control extension
with no params and deflate-stream extension
with no parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chrome sends the following header:
permessage-deflate; client_max_window_bits
So we would have to split by ,
first and then by ;
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be the case for parsing with parameters. I currently didn't take parameters into account since I used Java provided classes, but I can parse them if you like.
|
||
@Override | ||
public boolean acceptProvidedExtensionAsServer(String inputExtension) { | ||
String[] requestedExtensions = inputExtension.split(","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See 148
Hello @marci4, Explanation from the PMCE spec#compression
|
Hey, had a amazing vacation, would have loved to stay there a few more months :) I was thinking of a different issue but you can disable the check (when only RSV1 is set) in There is however a real issue in the encoding process. Best regards, |
Hello @marci4, Hope you are doing well. I have also added a new class to conveniently parse extension requests and parameters. Note: When testing with autobahn, I had to comment out the body of |
@haruntuncay I am really sorry but I was busy the last two days! Gonna take a look at your changes later! |
Something is still wrong after the first frame... Trying to pinpoint it down |
What kind of error are you facing ? Is it a problem with fragmented frames ? Also, did you comment out the body of encodeFrame method ? |
Was trying to connect with a chrome to the server, getting an invalid frame error. Looks like the second server does not have RSV1 set... |
Could you please share the code you are using to connect with chrome ? |
I simple use the "Simple WebSocket Client" extension and enter the server. Also added the PerMessageDeflateExtension to the draft of course. ChatServer sources are here https://gist.github.com/marci4/78c96c1d1a52bac9cb00efbf987d62a6 Best regards, |
@marci4 . Turns out it is a problem caused by the "Simple Websocket Client" extension. |
Hello @marci4, |
@haruntuncay I send you an email to move the steps to reproduce out of this PR. |
Hello @marci4, |
Hello @marci4, |
Moving this to release for 1.5.0 since Deflater.SYNC_FLUSH requires Java 1.7 |
If you use |
… a class to conveniently parse an extension request
Hi, |
Hey @Canop, Apart from this you can use this feature without a new library version. Examples should be visible in the source changes here. Best regards, |
Thanks for the answer. I'll probably do that. |
Hey @haruntuncay, how do you feel about merging this PR? Best regards, |
Hi @marci4, If you're okay with it, it's also fine by me. |
thank you very very much for this contribution! Best regards, |
Description
Implemented support for PerMessageDeflateExtension, requested in #574.
Added an example file to show how to include the extension.
Related Issue
Fixes #574
Motivation and Context
New feature
How Has This Been Tested?
Added a new test file.
Types of changes
Checklist: