websocat icon indicating copy to clipboard operation
websocat copied to clipboard

Support HTTP Redirection at Handshake

Open misery opened this issue 3 years ago • 2 comments

Hi!

I like to request that the server can send a http redirect (3xx) and websocat allows to handle this.

It seems WebSocket allows this: https://www.rfc-editor.org/rfc/rfc6455

1.  If the status code received from the server is not 101, the
       client handles the response per HTTP [[RFC2616](https://www.rfc-editor.org/rfc/rfc2616)] procedures.  In
       particular, the client might perform authentication if it
       receives a 401 status code; the server might redirect the client
       using a 3xx status code (but clients are not required to follow
       them), etc.  Otherwise, proceed as follows.

misery avatar Nov 17 '22 08:11 misery

At least printing of Location: in a more user-friendly way can be an option for quick implementation.

Proper redirects may be more of Websocat3 material.

vi avatar Nov 17 '22 12:11 vi

In Websocat 1.12:

$ websocat  ws://127.0.0.1:7780/
websocat: WebSocketError: WebSocketError: Redirected (302 Found) to http://example.com/
websocat: error running

vi avatar Sep 17 '23 12:09 vi