You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using the NetConn function to create a net.Conn from a websocket.Conn.
My client is then also written using the same library proxies between a websocket and stdin/stdout (not using NetConn, just (error handling removed for clarity)
By default, the message reader has a limit of 32768 per message, however the net.Conn wrapper produced by NetConn doesn't limit what it sends, it just writes everything from each Write call into a message and sends it on the websocket.
This means that without a call to c.SetReadLimit I'm going to get the socket being closed when the server writes something bigger than 32k to the socket.
I'm not in control of the server, I'm creating a net.Conn that wraps the websocket and then passing it to a third party library. I'm proxying a protocol over a websocket using the equivalent of "netcat" at the client.
Given that there is a read limit on the client, would it make sense to add a write limit to the net.Conn wrapper so that it will chop the data up into messages of at most that size? Otherwise my only real option seems to be to call s.SetReadLimit(math.MaxInt64-1) to effectively remove the read limit (passing math.MaxInt64 results in an overflow as SetReadLimit adds one to the passed in value).
Thanks.
The text was updated successfully, but these errors were encountered:
OK, thanks. I see that PR is on the "dev" branch. What does that mean in terms of when that might be on a release? It seems to have been applied 2 years ago from what I can see?
I have been using the NetConn function to create a net.Conn from a websocket.Conn.
My client is then also written using the same library proxies between a websocket and stdin/stdout (not using NetConn, just (error handling removed for clarity)
By default, the message reader has a limit of 32768 per message, however the net.Conn wrapper produced by NetConn doesn't limit what it sends, it just writes everything from each Write call into a message and sends it on the websocket.
This means that without a call to c.SetReadLimit I'm going to get the socket being closed when the server writes something bigger than 32k to the socket.
I'm not in control of the server, I'm creating a net.Conn that wraps the websocket and then passing it to a third party library. I'm proxying a protocol over a websocket using the equivalent of "netcat" at the client.
Given that there is a read limit on the client, would it make sense to add a write limit to the net.Conn wrapper so that it will chop the data up into messages of at most that size? Otherwise my only real option seems to be to call s.SetReadLimit(math.MaxInt64-1) to effectively remove the read limit (passing math.MaxInt64 results in an overflow as SetReadLimit adds one to the passed in value).
Thanks.
The text was updated successfully, but these errors were encountered: