-
-
Notifications
You must be signed in to change notification settings - Fork 158
Server with Transport Layer Security. #35
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Server with Transport Layer Security.
Change Connection::handleData to use `fread` once again so that, when it is appropriate, the data is filtered by an ssl/tls stream wrapper. Add a third argument to Server::listen which should be an array which can be passed directly to stream_context_create. If the context has an 'ssl' key then it will stream_socket_enable_crypto for connected sockets.
- Loading branch information
commit 615500dc87e5b5336622ec2a547216bc15ebb411
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 would love to know if anybody has managed to solve the requirement for this master socket to block for secure connections.
Uh oh!
There was an error while loading. Please reload this page.
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.
There is a way to do it... I don't have react specific code samples for it, however, the gist of it is to try until
stream_socket_enable_crypto
returns success.Assume the above to be part of a member function which you keep polling until the value of secure == STATE_ENCRYPTED. You don't need to do blocking at all in this way, see documentation of
stream_socket_enable_crypto
. Depending on thestream_select
timeout values typically doing it this way results in 1-3 cycles of polling to enable cryptography (tested on loopback interface).Edit: you might want to look at an old closed pull request from way back when... before the repositories were shuffled around. They got the gist of this approach 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.
Thank you @CriseX, your comment was very helpful. I've added the suggested improvements to this PR.