81 Commits

Author SHA1 Message Date
Tanguy Cizain
f354dfebe9
allow accept cancellation (#91) 2021-08-31 16:30:09 +02:00
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
Jordan Hrycaj
00440b6eff Use caps for log-levels in tests
why;
  Using nimble installed chronicles (as documented in the readme) fails
  to compile unless the log-level "info" is spelled "INFO".
2021-07-29 08:02:59 +01:00
Dmitriy Ryajov
2af07c5736
"Host" header override (#87)
Override "Host" header for externally resolved addresses
2021-07-28 11:54:09 -06:00
andri lim
d60df8176d
restructure CI jobs to parallelise autobahn test (#70)
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.
2021-07-19 10:15:52 -06:00
Dmitriy Ryajov
7756dd1e77
Make HttpServer a case object (#84)
* 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`
2021-07-15 14:17:55 -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
Tanguy Cizain
fec0f2bac1
add websock topic (#83) 2021-07-14 11:26:46 -06:00
jangko
eabf183e6d
add websock logo to readme.md 2021-06-29 08:50:34 +07:00
jangko
b3c60bbd4e
rename nim-ws to nim-websock 2021-06-29 08:50:29 +07:00
Tanguy Cizain
cb5255ea5f
update for chronicles 2021-06-28 15:07:06 +02:00
Tanguy Cizain
6de3895580
switch to isLogFormatUsed 2021-06-28 15:07:06 +02:00
Tanguy Cizain
78f2af5bac
import json_ser and use ord 2021-06-28 15:07:06 +02:00
jangko
7e668c4c85
fix compile time error when using chronicles sink:json
fixes #73
2021-06-28 15:07:06 +02:00
Tanguy Cizain
781cb35200
Fix mutual closing (#76)
* add mutual closing test

* fix mutual closing
2021-06-28 14:52:18 +02:00
jangko
2ee209af39
update .nimble [skip ci]
- change nim dependency from "1.2.6" to "1.2.0" because
  nimble refuse to install it when we are using
  nimbus-build-system
- fixes skipdir entry
2021-06-23 16:00:02 +07:00
jangko
e56447dda3
update comments in compression extensions [skip ci]
fixes #14
2021-06-21 14:02:29 +07:00
jangko
5a93ad7867
add deflate compression test cases
* binary data roundtrip
* text data roundtrip
2021-06-20 14:50:54 +07:00
jangko
14d8e51f53
implement permessage-deflate compression extension
depends on zlib as it's backend compressor
pass both client and server tests in autobahn test suite
2021-06-20 14:50:54 +07:00
jangko
fef04a1595
ci: parallelise autobahn tests 2021-06-20 14:34:49 +07:00
jangko
dbd76f78e2
update copyright header in autobahn client and server file 2021-06-20 11:33:20 +07:00
jangko
3a0834943d
fixes copyright header in each .nim file 2021-06-20 11:28:38 +07:00
jangko
9b09cd8830
update readme.md reflecting current state of nim-ws 2021-06-20 10:17:05 +07:00
jangko
43c56074c9
ci: build release mode binaries participating in autobahn tests 2021-06-20 10:06:41 +07:00
jangko
32b62989a4
add test cases for multiple extensions flow
using dummy `base64` and `hex` extensions
- check flow client-server flow,
  `hex` to `base64` and `base64` to `hex`
- check for encode-decode roundtrip
2021-06-16 17:44:38 +07:00
jangko
a96a123bfe
fixes related to extensions
- set RSV bits in frame.encode
- move ExtParams from extutils.nim to types.nim
- remodel extension factory type
- accept/reject extensions offer in server
- offer/accept extensions in client
2021-06-15 21:34: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
andri lim
f80278aeee
implement frame reader for buffered payload (#55)
now the frame can choose to read from buffered
payload if available or read from asyncstream
if the buffer is empty
2021-06-14 13:41:31 -06:00
jangko
99d643013b
fix autobahn client to process multi messages test case
turn out the autobahn server not only use single echo
message for all test case, but also use multi messages
response to measure performance.
2021-06-12 14:58:28 +07:00
jangko
3634754621
run autobahn client test in CI
fixes #27
2021-06-12 13:51:54 +07:00
jangko
a60dbd5dc9
fixes required to allow autobahn client works
- send requestUrl.query in client.nim
- fixes genMaskKey bug in utils.nim
- using Base64Pad instead of Base64 in `connect` proc
- add `host` field to request HTTP header in `connect` proc
- add missing `secure` param in `connect` proc

fixes #32
2021-06-12 13:51:50 +07:00
jangko
88e99ff028
fixes failing utf8 test case
it was a buggy test case, not related to windows
but by chance discovered on windows.
2021-06-12 13:39:24 +07:00
Dmitriy Ryajov
480560c7c8
don't await nil futures 2021-06-11 20:53:34 -06:00
Dmitriy Ryajov
deb46fef31
fix messages with multiple empty frames (#61) 2021-06-11 20:14:53 -06:00
Dmitriy Ryajov
1188bf3c0b
fix limits tests (#59) 2021-06-11 19:05:06 -06:00
Dmitriy Ryajov
03744f37c7
Fix autobahn tls tests (#57)
* split out message and control frames sending

* fix premature closure under TLS

* dissable hints noise
2021-06-11 18:40:56 -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
Dmitriy Ryajov
e632202037
wip: modeling extensions api (#48) 2021-06-01 14:24:00 -06:00
andri lim
1fed598d8c
implement extension parameters parser (#44)
fixes #43
2021-05-31 21:02:24 -06:00
Dmitriy Ryajov
64da1a4344
Rework http (#38)
* wip

* wip

* move http under ws folder

* use asyctest

* wip

* wip

* rework response sending

* make example work with latest changes

* wip request/response

* misc

* fix example to use new http layer

* pass tls flags to client

* more cleanup

* unused imports

* more unsused imports

* better headers

* add helpre sendError

* export sendError

* attach selected proto to session

* move proto to session

* handle unsupported version

* fix tests

* comment out for now

* fix utf8 tests

* allow tests to be ran in tls

* misc

* use Port type

* add tls flags

* better api

* run tls tests

* fix tests on windows

* allow running tests with tls

* mic

* wip

* fix autobahn ci

* handle close

* cleanup

* logging and error handling

* remove old stream
2021-05-31 20:39:14 -06:00
andri lim
723971a39d
autobahn: add test for tlsserver (#42)
also publish the result to github pages like ws server
2021-05-28 10:48:23 -06:00
andri lim
90c664545d
implement UTF8 handling (#35)
* implement UTF8 handling

or to be precisely, we add UTF8 validator which main duty
is to detect malformed UTF8 sequence using a fast DFA UTF8
decoder.

also enable autobahn UTF8 category tests, much more green :)

fixes #13

* fixes case 7.5.1 Send a close frame with invalid UTF8 payload

* add tests for validateUTF8

- tests for validateUTF8 in raw mode
- tests for validateUTF8 in websocket client/server
2021-05-28 10:47:24 -06:00
andri lim
93f0aba685
add autobahn_client for incoming autobahn client test (#34) 2021-05-26 11:07:57 -06:00
Dmitriy Ryajov
eb62ec1725
Extract session (#31)
* extract websocket session

* fix tests

* fix frame tests
2021-05-25 16:39:10 -06:00
Dmitriy Ryajov
0f48b62eb9
Fix tlsclient (#30)
* fix npe in handshake

* fix tls client
2021-05-25 15:00:53 -06:00
Dmitriy Ryajov
5d0bcf6375
Client server (#29)
* better client/server separation (WIP)

* add extensions interface

* index out of bounds
2021-05-25 08:02:32 -06:00
Dmitriy Ryajov
0a4121c29d
Fix first frame (#28)
* split out frame

* use new api

* fix import
2021-05-24 18:47:27 -06:00
jangko
cdd5224905
autobahn: fixes unknownserver in summary report 2021-05-22 20:07:30 +07:00
jangko
f3185c216f
change the python version in github action ci
from: 2.7.17 to pypy-2.7

why:
there is annoying warning message in github action ci:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.
Please upgrade your Python as Python 2.7 won't be maintained after that date.
A future version of pip will drop support for Python 2.7.
More details about Python 2 support in pip, can be found at
https://pip.pypa.io/en/latest/development/release-process/#python-2-support
2021-05-22 17:31:24 +07:00
Dmitriy Ryajov
352bb6b3a4
use binary flag 2021-05-22 03:09:28 -06:00