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

WebSocket: "HTTP authentication will not function" is not correct #565

Closed
ricea opened this issue Jul 13, 2017 · 8 comments
Closed

WebSocket: "HTTP authentication will not function" is not correct #565

ricea opened this issue Jul 13, 2017 · 8 comments

Comments

@ricea
Copy link
Collaborator

ricea commented Jul 13, 2017

https://fetch.spec.whatwg.org/commit-snapshots/f3bb21991abdd335175fcc5d26a0d0b7b380d4fe/#websocket-opening-handshake

HTTP authentication will not function

Actually HTTP authentication functions with WebSockets in Chrome, Firefox, IE, and Edge. It doesn't work in Safari, but that's a bug: https://bugs.webkit.org/show_bug.cgi?id=80362

Firefox will also give you a password prompt if it gets a 401 response on a WebSocket. Chrome and Edge will only use cached credentials. In Chrome's case, this is the policy for all subresources, rather than being a WebSocket-specific restriction.

@annevk annevk changed the title "HTTP authentication will not function" is not correct WebSocket: "HTTP authentication will not function" is not correct Jul 14, 2017
@annevk
Copy link
Member

annevk commented Jul 14, 2017

Filed https://bugzilla.mozilla.org/show_bug.cgi?id=1380973 to remove the prompting in Firefox.

@annevk
Copy link
Member

annevk commented Sep 4, 2017

@ricea do you wait for a challenge or just send credentials if you have them?

@annevk
Copy link
Member

annevk commented Sep 4, 2017

Also, are there tests for this?

@ricea
Copy link
Collaborator Author

ricea commented Sep 4, 2017

As far as I know, Chrome always sends credentials in the initial request if it has them, but from the limited testing I've done it appears that Firefox doesn't. In Chrome we share the logic with ordinary HTTP.

There don't appear to be any web-platform-tests testing this. We have Chrome-specific tests, but not of a sort that could be straightforwardly ported.

@ricea
Copy link
Collaborator Author

ricea commented Jun 8, 2018

I can't actually find any normative text that prohibits HTTP authentication. I will create a PR to remove the text that says it doesn't.

ricea added a commit to ricea/fetch that referenced this issue Jun 8, 2018
Remove the warning that HTTP authentication is prohibited for
WebSockets.

See whatwg#565 for background.
@ricea
Copy link
Collaborator Author

ricea commented Jun 11, 2018

Simple wpt at web-platform-tests/wpt#11433.

@dveditz
Copy link
Member

dveditz commented Jun 16, 2018

As far as I know, Chrome always sends credentials in the initial request if it has them,

Without the 401 that could in theory be sending auth for the wrong realm.

@ricea
Copy link
Collaborator Author

ricea commented Jun 18, 2018

@dveditz wrote:

Without the 401 that could in theory be sending auth for the wrong realm.

Thanks for the clarification! If I catch Chrome doing the wrong thing I will file a bug.

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

No branches or pull requests

3 participants