Fix multiple ws_connect with headers dict#1643
Merged
fafhrd91 merged 1 commit intoaio-libs:1.3from Feb 16, 2017
Merged
Conversation
53e6bb2 to
0b6681d
Compare
Member
|
thanks! |
Contributor
Author
|
A little too quick! There were a few linter issues in the test that popped up. |
Member
|
thats fine. i'll fix |
Contributor
Author
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What do these changes do?
Currently in my client, I'm generating a headers dictionary that is used for all websockets connections. What I found is that when ws_connect is called, the websocket key is added to this dict, which is then passed back on the next call to ws_connect. Since the default headers don't overwrite the headers dict, the stale secret key is sent to the server, and the connection fails.
This change forces the secret key to overwrite the existing headers, since it is (and should) be regenerated for each connection. We might also want to consider copying the incoming dict before making changes, but that's another issue.
Are there changes in behavior for the user?
No
Related issue number
Checklist
CONTRIBUTORS.txtCHANGES.rst#issue_numberformat at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.