Commit Graph

9 Commits

Author SHA1 Message Date
Dmitriy Ryajov 0ec755738c
Perform utf-8 validation at message boundaries (#90)
* 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`
2021-08-04 10:23:56 -06:00
Dmitriy Ryajov 06ae75cf7f
add support for DNS resolution (#81)
* 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>
2021-07-14 18:51:39 -06:00
jangko b3c60bbd4e
rename nim-ws to nim-websock 2021-06-29 08:50:29 +07:00
jangko 3a0834943d
fixes copyright header in each .nim file 2021-06-20 11:28:38 +07:00
Dmitriy Ryajov 5af418f850
add accepts api (#51)
* add accepts api

* Fix partial frame handling and allow extensions to hijack the flow (#56)

* moving files around

* wip

* wip

* move tls example into server example

* add tls functionality

* rename

* rename

* fix tests

* move extension related files to own folder

* use trace instead of debug

* export extensions

* rework partial frame handling and closing

* rework status codes as distincts

* logging

* re-enable extensions processing for frames

* enable all test for non-tls server

* remove tlsserver

* remove offset to mask - don't think we need it

* pass sessions extensions when calling send/recv

* adding encode/decode extensions flow test

* move server/client setup to helpers

* proper frame order execution on decode

* fix tls tests

* fix merge

* add tls support for `accept` call

* fix tests to use accepts & cb
2021-06-14 17:20:28 -06:00
Dmitriy Ryajov 3e1599d790
Fix partial frame handling and allow extensions to hijack the flow (#56)
* moving files around

* wip

* wip

* move tls example into server example

* add tls functionality

* rename

* rename

* fix tests

* move extension related files to own folder

* use trace instead of debug

* export extensions

* rework partial frame handling and closing

* rework status codes as distincts

* logging

* re-enable extensions processing for frames

* enable all test for non-tls server

* remove tlsserver

* remove offset to mask - don't think we need it

* pass sessions extensions when calling send/recv

* adding encode/decode extensions flow test

* move server/client setup to helpers

* proper frame order execution on decode

* fix tls tests
2021-06-11 14:04:09 -06:00
Arijit Das e4f00698ea
Update http to use chronos http. (#6)
* Update http to use chronos http.

* Add stream.nim file.

* Address comments.

* Fix CI failure.

* Minor change.

* Address comments.

* Fix windows CI failing test.

* minor cleanup

* spacess

* more idiomatic connect

* use stew/base10

Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
2021-04-05 15:01:10 -06:00
Dmitriy Ryajov 3923a9be20
Rework (#5)
* Use seq[byte] to store data.

* Working bytes conversion.

* Refactor the code.

* Add test.

* Add websocket test and fix closing handshake.

* Add MsgReader to read data in external buffer.

* rework frame reading

* don't do toTitleCase

* fix examples

* use byte for more comfort

* rework message reading + api

* fix tests

* adding specific exception types

* minor cleanup

* fixing tests

* more tests

* check the fin flag at the correct place

* info for debug

* split data not encoded frames

* more tests

* wip - control messages

* closing flow and more explicit exception handling

* test close and pings

* add tests task to nimble

* adding ci

* change recv semantics

* add frame tests

* remove echo

* better frame tests

* fix

* fix

* handle continuation frames properly

* more close logic handling

* wip tests

* handle close reasons properly

* test control frames encoding

* don't pass ws to event callbacks

* fix masking and use correct base64 encoding

* fix ci

* addressing review comments

* fix client example

* i386 ci fix

* wip ci

* fix reading offset

* don't read if socket closed

* fix ci

* wip

* don't read if socket is closed

Co-authored-by: Arijit Das <arijit@status.im>
Co-authored-by: Arijit Das <arijitad.in@gmail.com>
2021-03-18 09:30:21 -06:00
Arijit Das a1ae7d2c70
[WIP] Web socket client implementation. (#2)
* Implement websocket server.

* Implement websocket client.

* Run nimpretty.

* Remove commented code.

* Address comments.

* Address comments on websocket server.

* Use seq[byte] to store data.

* Working bytes conversion.

* Remove result from return

* Refactor the code.

* Minor change.

* Add test.

* Add websocket test and fix closing handshake.

* Add MsgReader to read data in external buffer.
2021-03-10 21:34:14 -06:00