Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Websocket connect, clear error response #52890

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
philos3 wants to merge 1 commit into dart-lang:main from philos3:patch-1

Conversation

@philos3
Copy link

@philos3 philos3 commented Jul 9, 2023
edited
Loading

Update websocket_impl.dart

It is usefull with more detail for "Connection was not upgraded to websocket error "


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:
  • See our contributor guide for general expectations for PRs.
  • Larger or significant changes should be discussed in an issue before creating a PR.
  • Contributions to our repos should follow the Dart style guide and use dart format.

Note that this repository uses Gerrit for code reviews. Your pull request will be automatically converted into a Gerrit CL and a link to the CL written into this PR. The review will happen on Gerrit but you can also push additional commits to this PR to update the code review.

talp-flytrex reacted with thumbs up emoji necessarylion, 0xdanny, and albertms10 reacted with heart emoji
Copy link

google-cla bot commented Jul 9, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@philos3 - thanks for the contribution! Before we can accept it you'll need to sign the CLA at https://cla.developers.google.com/.

Also, can you update the description of the PR to describe more what this PR is trying to accomplish. cc @brianquinlan

@devoncarew devoncarew added the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Jul 10, 2023
Copy link

Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at:

https://dart-review.googlesource.com/c/sdk/+/313042

Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly.

Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR).

Copy link

https://dart-review.googlesource.com/c/sdk/+/313042 has been updated with the latest commits from this pull request.

@github-actions github-actions bot removed the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Jul 11, 2023
Copy link

https://dart-review.googlesource.com/c/sdk/+/313042 has been updated with the latest commits from this pull request.

Copy link
Contributor

Copy link
Member

mraleph commented Oct 19, 2023

@philos3 would you like to address @brianquinlan's comments or should we close this PR?

Copy link
Contributor

brianquinlan commented Oct 19, 2023
edited
Loading

@mraleph Could we keep this open for now? Let's say that, if @philos3 isn't responsive by Monday, then I'll complete this change.

mraleph reacted with thumbs up emoji

Copy link

Approved @philos3

Copy link
Member

mraleph commented Nov 20, 2023

@mraleph Could we keep this open for now? Let's say that, if @philos3 isn't responsive by Monday, then I'll complete this change.

The deadline has passed, so it is on your plate now :)

Copy link
Contributor

It's on my plate. Adding the messages was easy - writing tests for all the failure variations is hard ;-)

Copy link
Member

mit-mit commented Jan 15, 2024

Any updates @brianquinlan ?

Copy link
Member

vsmenon commented Jan 29, 2024

gentle ping

Copy link

https://dart-review.googlesource.com/c/sdk/+/313042 has been updated with the latest commits from this pull request.

Copy link
Contributor

@mit-mit @vsmenon

Is this a priority? The original PR doesn't have tests so isn't mergable as-is. I can write the tests myself if getting this in is important.

Copy link
Member

mit-mit commented Feb 21, 2024

Given we're just updating a status message, perhaps we can exempt this one. wdyt Vijay?

Copy link
Contributor

The PR outputs the entire response message in the error - this could be arbitrarily large.

I have a modified version of the PR that decodes the error in more detail without including the entire response body:

- if (response.statusCode != HttpStatus.switchingProtocols ||
- connectionHeader == null ||
- !connectionHeader.any((value) => value.toLowerCase() == "upgrade") ||
- response.headers.value(HttpHeaders.upgradeHeader)!.toLowerCase() !=
- "websocket") {
- return error("Connection to '$uri' was not upgraded to websocket");
- }
+ if (response.statusCode != HttpStatus.switchingProtocols) {
+ return error("Unexpected status code: ${response.statusCode}");
+ }
+ if (connectionHeader == null) {
+ return error("Response did not contain a 'connection' header");
+ }
+ if (connectionHeader.first.toLowerCase() != "upgrade") {
+ return error(
+ "Unexpected 'connection' header: ${connectionHeader.first}");
+ }
+ if (upgradeHeader == null) {
+ return error("Response did not contain an 'upgrade' header");
+ }
+ if (upgradeHeader.first.toLowerCase() != "websocket") {
+ return error("Unexpected 'upgrade' header: ${upgradeHeader.first}");
+ }
+ if (acceptHeader == null) {
+ return error(
+ "Response did not contain a 'Sec-WebSocket-Accept' header");
+ }

But writing tests for this is not trivial and it didn't seem worth it. @mit-mit if there is some reason why this should be a priority (e.g., people are complaining about error messages) then just let me know.

Copy link
Member

mraleph commented Apr 30, 2024

I assume this is stale. Please reopen if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brianquinlan brianquinlan Awaiting requested review from brianquinlan

1 more reviewer

@JoaoVitorAmorim JoaoVitorAmorim JoaoVitorAmorim approved these changes

Reviewers whose approvals may not affect merge requirements

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /