Starscream icon indicating copy to clipboard operation
Starscream copied to clipboard

Masked and rsv data is not currently supported code 1002

Open rickrvo opened this issue 4 years ago • 7 comments

Hi, I was debugging normaly testing some parsing and now I'm getting this error on websocket.connect() I did a rollback on my minor changes and the error persists.

this is the log: viabilityChanged error Optional(Starscream.HTTPUpgradeError.notAnUpgrade(503)) error Optional(Starscream.WSError(type: Starscream.ErrorType.protocolError, message: "masked and rsv data is not currently supported", code: 1002))

rickrvo avatar Jun 06 '20 23:06 rickrvo

Today it was working again.. so it's something that the server replies. I'm consuming an exchange server, so I wouldn't have access to know what it was sending.

rickrvo avatar Jun 08 '20 01:06 rickrvo

I have the same problem! but it works when I use ip connect, not works for domain。

hotwill07 avatar Jun 28 '20 08:06 hotwill07

HTTP/1.0 503 Service Unavailable\r\nCache-Control: no-cache\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n

503 Service Unavailable

\nNo server is available to handle this request.\n

Optional(Starscream.HTTPUpgradeError.notAnUpgrade(503)) Optional(Starscream.WSError(type: Starscream.ErrorType.protocolError, message: "masked and rsv data is not currently supported", code: 1002))

hotwill07 avatar Jun 28 '20 08:06 hotwill07

I solved this question! First I use domain connect,not ip connect! Reason: WSEngine --> connectionChanged(state: ConnectionState) --> let wsReq = HTTPWSHeader.createUpgrade(request: request, supportsCompression: framer.supportsCompression(), secKeyValue: secKeyValue) --> HTTPWSHeader.createUpgrade --> let hostValue = req.allHTTPHeaderFields?[HTTPWSHeader.hostName] ?? "(parts.host):(parts.port)" req.setValue(hostValue, forHTTPHeaderField: HTTPWSHeader.hostName)
If we do not set Host,default value is "(parts.host):(parts.port)", if we use domin connect, Host's value is like "ws://api.ws.cn:80". The Host's value is like "ws://api.ws.cn" without port. And this por 80 is default, our server‘s port is 7000. So connection is 503.

I set Host when created URLRequest,Eg: let URL = URL(String:"......") let request = URLRequest(url: URL) request.setValue(URL.host, forHTTPHeaderField: "Host")

Hope usefully.

hotwill07 avatar Jun 28 '20 08:06 hotwill07

I have the same problem, it happen when I use ip connect via lan. It quickly received this error(Starscream.WSError(type: Starscream.ErrorType.protocolError, message: "masked and rsv data is not currently supported", code: 1002)) when the websocket connected.

shalyf avatar Aug 28 '20 07:08 shalyf

Did you get to fix this?

eleazar0425 avatar Apr 14 '21 03:04 eleazar0425

FYI: Since I looked into how to reproduce this issue, I created a PR and put together the detail.

  • ref. https://github.com/daltoniam/Starscream/pull/930

yoheimuta avatar Oct 19 '21 07:10 yoheimuta