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

Merge pull request #943 from da-als/master #943

Merged
merged 3 commits into from Jan 19, 2020
Merged

Conversation

da-als
Copy link
Contributor

@da-als da-als commented Nov 15, 2019

Description

This pull request includes a fix developed by @doyledavidson where any data located after the end of a SSL handshake is saved to be returned on the next read operation. This way, the data is not lost and connections from clients that append data at the end of the handshake do not have trouble communicating with Java-WebSocket.

Related Issue

Fixes #665
Fixes #940

Motivation and Context

Some clients, when connecting to a WSS server, use TLS False Start, which causes initial data to be appended to the SSL handshake. That data gets discarded by the Java-WebSocket server which often causes communication problems, even causing the connection to become unresponsive for the client as it waits for a reply from the server.

How Has This Been Tested?

I use the Java-WebSocket library on an application that acts as a local server on hundreds of clients that access this server functionality from a regular web browser. Clients that are using browsers that use TLS False Start often required multiple connection attempts to work around the issue, and even that, in some cases, was not enough. I have deployed my fork of this library with a new beta of my application on about a dozen clients for testing; they are not running into the issue anymore (connections work on the first try) and no regressions have been reported.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Once again, the code was added by @doyledavidson, not myself. I am not familiar with the process for running the tests, but since it affects new connections' handshakes and their first read operations I would assume the changes would be fully covered by existing tests.

Copy link
Collaborator

@PhilipRoman PhilipRoman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, although I wasn't able to test this.

@marci4
Copy link
Collaborator

marci4 commented Nov 19, 2019

@PhilipRoman thx, I will try it when I have some time on my hands.

@marci4
Copy link
Collaborator

marci4 commented Nov 29, 2019

I had some problems running this.
The autobahn testsuite failed a few times for me.
Anyone else tried it?

@da-als
Copy link
Contributor Author

da-als commented Nov 30, 2019

I had some problems running this.
The autobahn testsuite failed a few times for me.
Anyone else tried it?

After your report I tried running all the tests in the project. The only test that failed for me was "Issue256Test", but this one also fails without the changes from the merge (it fails on the master branch of the main project) so it has no relation to this pull request.

@marci4
Copy link
Collaborator

marci4 commented Dec 4, 2019

@da-als I was running it against the big websocket autobahn test suite, which is not part of the normal unit test.

Currently, really busy, so I did not have more time to take a look at this sorry..

@jiangjianping
Copy link

@da-als
thank you very much. This almost reosolved my issue #958

@marci4
Copy link
Collaborator

marci4 commented Dec 30, 2019

I havent forgotten this PR, currently just very busy...

Copy link
Collaborator

@marci4 marci4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test look good

@marci4
Copy link
Collaborator

marci4 commented Jan 19, 2020

@da-als thx a lot for your contribution!

@marci4 marci4 added this to the Release 1.4.1 milestone Jan 19, 2020
@marci4 marci4 changed the title Fix for discarded data at end of SSL handshake Merge pull request #943 from da-als/master Jan 19, 2020
@marci4 marci4 merged commit 7bfa83d into TooTallNate:master Jan 19, 2020
@da-als
Copy link
Contributor Author

da-als commented Jan 19, 2020

@marci4 Happy to help! Glad to see the fix merged.

@doyledavidson
Copy link
Contributor

Thank you everyone for getting that pulled in!

@doyledavidson
Copy link
Contributor

Any plan to push a new version (1.4.1?) to Maven repo?

@marci4
Copy link
Collaborator

marci4 commented Jan 20, 2020

@doyledavidson a snapshot should be available

@marci4 marci4 added the Bug label Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants