vapor / websocket-kit

WebSocket client library built on SwiftNIO
https://docs.vapor.codes/4.0/advanced/websockets/
MIT License
272 stars 79 forks source link

Remove content length header on initial handshake #106

Closed GNMoseke closed 2 years ago

GNMoseke commented 2 years ago

This removes the content-length: 0 header being automatically applied to outgoing websocket handshakes.

As per RFC 7230 Section 3.3.2:

A user agent SHOULD NOT send a Content-Length header field when the request message does not contain a payload body and the method semantics do not anticipate such a body.

This was causing issues with certain cloud providers, most notably Google Cloud Run, that would force close the websocket as soon as data was received from a client.

0xTim commented 2 years ago

@GNMoseke would you be able to add a test to verify the new behaviour?

GNMoseke commented 2 years ago

@GNMoseke would you be able to add a test to verify the new behaviour?

@0xTim Sure, done.

VaporBot commented 2 years ago

These changes are now available in 2.3.1