When connecting to WebSocket via TLS, certain servers require hostname
to be sent as part of SNI extension. This was done when using `news`
backend, but not when using `nim-websock` backend. Aligned both impls.
`nim-websock` suffered from a number of issues that are being addressed:
1. Long messages > `frameSize` (default 1 MB) were split into fragments
of `frameSize` each. However, when a concurrent message is sent, it
may be interleaved among the fragments of an already-sending message.
This is only allowed for control packets without a mux extension.
2. When the WebSocket session is closed, a msg may have been partially
received. This partial frame was reported as a full message, without
indication that the receiving was canceled. This behaviour is fixed
by raising a `WSClosedError` instead of reporting the partial msg.
3. When an individual `send` operation was canceled, it would actually
stop sending the remainder of a potentially partially sent messages.
This would corrupt the stream for concurrent and followup operations.
Cancellation is now inhibited for the message currently sending.
It is still possible to cancel messages that are not yet scheduled.
4. Messages could get reordered when using asynchronous encoders. This
is addressed by delaying followup messages until the current message
is fully encoded and transmitted (except for control packets).
Co-authored-by: Tanguy <tanguy@status.im>
* don't use global for server instance
* it gets shared between tests and causes gcsafe to trigger
* enable `chronosStrictException` in tests
* avoid asynctests dep
* testcommon -> all_tests (like the other projects)
* Remove version pin on chronicles
Caused dependency conflicts when combining websock with other
packages that depend on chronicles, now that chronicles has
a new version (0.10.2).
* Ensure that chronicles version supports isLogFormatUsed
* validate utf8 at the message level
* move utf-8 validation to message
* rename `recv` to `recvMsg`
* add partial frame validation tests
* use `recvMsg` instead of `recv`
previously we are using bash to run parallel autobahn test.
now we leverage CI jobs to run parallel tests.
with the inclusion of compression extension,
the autobahn test suite took significant time
to pass. move it to manually triggered CI
as it cannot make the main CI to fail anyway.
we only run basic autobahn tests in regular CI.
* cleanup examples
* more examples cleanup
* make HttServer a case object
* propagate errors when handling requests
* don't extend HttpServer
* remove port from create that takes a string host
make more consistent with client's `connect`
* add support for DNS resolution
- reworked API to be more consistent
- string addresses and Uri types will be now resolved
- made the API more consistent
* log failed connection attempt
* agent string can't contain spaces
* add websock topic (#83)
* style
Co-authored-by: Tanguy Cizain <tanguycizain@gmail.com>