daltoniam / Starscream

Websockets in swift for iOS and OSX
Apache License 2.0
8.28k stars 1.2k forks source link

Feature Request: Support for HTTP Redirect (Status 3xx) #434

Open ndreisg opened 6 years ago

ndreisg commented 6 years ago

It would be useful to have support for redirects like 3xx HTTP status.

According to WebSocket Protocol Specification from IETF, clients are not required to follow redirects, but they may do it. So this could probably be a feature that can be switched on/off with a boolean or so :)

Quote from https://tools.ietf.org/html/rfc6455:

   1.  If the status code received from the server is not 101, the
       client handles the response per HTTP [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.
daltoniam commented 6 years ago

I agree. That is something that will have to be hand added because we are using a pure NSStream. I'd love if we could have NSURLSession support in the future to handle more HTTP needs like this, but that will require a bit of updating by Apple to the NSURLSession API.

gsabran commented 2 years ago

Has this potentially changed since 2018?