http-party / node-http-proxy

A full-featured http proxy for node.js
https://github.com/http-party/node-http-proxy
Other
13.89k stars 1.97k forks source link

Why used proxySocket.unshift(proxyHead) in ws-incomming js? #821

Open kspiridonov opened 9 years ago

kspiridonov commented 9 years ago

Hi! I use http_proxy as Websocket proxy layer. Sometimes i get a error like "object proxySocket has not method unshift...". And it is true, see https://nodejs.org/docs/v0.8.0/api/net.html#net_class_net_socket: object net.Socket has no method unshift Why you do this? Is there some hidden sense to do this? May be I don't understand...

jcrugzz commented 9 years ago

@kspiridonov This version of http-proxy (post 1.0.0) only works with node versions 0.10.x and above.

kspiridonov commented 9 years ago

Ok. But in https://nodejs.org/docs/v0.10.0/api/net.html#net_class_net_socket there is no unshift method too. And in 1.0.0 this instruction (proxySocket.unshift(...)) is.

jcrugzz commented 9 years ago

@kspiridonov net.Socket is a stream.Duplex which has an unshift method.

jcrugzz commented 9 years ago

@kspiridonov please provide a reproducible test case which displays this as an issue