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

Handling handshake that returns a status code other than 101? #1423

Closed
daveisfera opened this issue Dec 13, 2023 · 2 comments
Closed

Handling handshake that returns a status code other than 101? #1423

daveisfera opened this issue Dec 13, 2023 · 2 comments

Comments

@daveisfera
Copy link

I'm using websockets as a client to test the server and the handshake first does a 401 so it can return a nonce that the client is supposed to use. I've tried implementing handshake in WebSocketClientProtocol to handle this but couldn't get it to send a follow on request/connection.

Is there a way to accomplish this?

@aaugustin
Copy link
Member

I don't know any good way to do this.

The least aggravating option in the current state of websockets may be:

  • perform a HTTP request with an API that give you access to the underlying socket object
  • get the 401 answer, extract the nonce, and build the authenticated request
  • use the sock and extra_headers arguments of connect to reuse the same connection and send the correct headers

This is a duplicate of #784, isn't it?

@daveisfera
Copy link
Author

Thanks for the reply! Sounds like I'll close this out since it's not currently supported and I'll use a workaround like you're suggesting

As far as the other issues goes, I believe the concept of supporting authentication is similar but the details are different

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

No branches or pull requests

2 participants