Rewrite http redirects to be backward compatible with blazor redirects#1195
Merged
connor4312 merged 3 commits intomicrosoft:mainfrom Feb 8, 2022
Merged
Rewrite http redirects to be backward compatible with blazor redirects#1195connor4312 merged 3 commits intomicrosoft:mainfrom
connor4312 merged 3 commits intomicrosoft:mainfrom
Conversation
mkArtakMSFT
reviewed
Feb 8, 2022
connor4312
requested changes
Feb 8, 2022
src/cdp/webSocketTransport.ts
Outdated
| const redirectedUrl = ws.url.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:'); | ||
|
|
||
| if (redirectedUrl === url) { | ||
| reject(errorEvent); // Parameter is an ErrorEvent. See https://github.com/websockets/ws/blob/master/doc/ws.md#websocketonerror |
Member
There was a problem hiding this comment.
Previously this was rejected with errorEvent.error, was the change intentional?
src/cdp/webSocketTransport.ts
Outdated
| } | ||
|
|
||
| // Try to reconnect with the redirected URL | ||
| const redirectedSocket = new WebSocket(redirectedUrl, [], options); |
Member
There was a problem hiding this comment.
I suggest instead making a recursive call to the create method here so that timeout/cancellation is handled
7ed543b to
90f6c57
Compare
connor4312
approved these changes
Feb 8, 2022
connor4312
pushed a commit
that referenced
this pull request
Feb 8, 2022
…irects (#1195) * Handle http redirect urls to be backward compatible with blazor redirects * Exit in the nonredirected case * Call create recursively to handle cancellation
connor4312
pushed a commit
that referenced
this pull request
Feb 8, 2022
…irects (#1195) * Handle http redirect urls to be backward compatible with blazor redirects * Exit in the nonredirected case * Call create recursively to handle cancellation
11 tasks
This was referenced Feb 15, 2022
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
when a redirect occurs the WebSocket updates the url property so we read that in the error handler and replace http(s): with ws(s): and try one more time to connect
fixes #1190 here to support previous releases of the Blazor debugger