Commit Graph

40 Commits

Author SHA1 Message Date
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
Arijit Das 1b3e47d2f5
Add support for binary frame 2021-05-22 03:05:57 -06:00
Dmitriy Ryajov f37e4bb19a
Cleanup (#21)
* cleanup

* send payload with ping
2021-05-22 02:26:45 -06:00
jangko 30d4f5ca17
add meaningful name to the example server
this server name will appear at autobahn summary report.
if we do not set the server name, it will display ugly `unknown server`.
2021-05-22 12:12:42 +07:00
jangko c38ddf89de
add autobahn summary report link to readme.md 2021-05-22 12:12:42 +07:00
jangko 888ec6f089
make autobahn start_server.sh executable
from:          ./scripts/start_server.sh
to  : chmod +x ./scripts/start_server.sh
2021-05-22 12:12:42 +07:00
jangko 4de768910b
text formatting: consistent indentation
using 2 spaces for both `testtlswebsockets.nim` and
`tests/testwebsockets.nim`
2021-05-22 12:12:41 +07:00
jangko 2ed87ca58d
skip failing test case in `tests/testwebsockets.nim`
on Windows there is bug with message:
`Unhandled exception: Stream is already closed! [AsyncStreamIncorrectDefect]`
caused by the async stream closed more than once.
2021-05-22 12:12:41 +07:00
Arijit Das ffeaaa9d68
Automate autobhan test suite. 2021-05-22 12:12:41 +07:00
Arijit Das f8cfcd1f99
Fix webscoket close and fix test cases. 2021-05-22 12:12:41 +07:00
Arijit Das 51d834a0a1
Fix webscoket close and fix test cases. 2021-05-22 12:12:31 +07:00
Dmitriy Ryajov 0feac12a67
cleanup nimble file 2021-05-21 11:44:58 -06:00
Dmitriy Ryajov 4133d1d87c
bump chronos to 3.0.0 2021-05-21 10:42:41 +07:00
jangko 6bdc3680f0
add .gitignore 2021-05-21 10:25:31 +07:00
Arijit Das de1446593d
Update Readme.md with roadmap. 2021-05-21 09:47:14 +07:00
jangko 51ad3fd685
fix github action script
change "mingw$arch-6.3.0.7z" to "mingw$arch.7z"
2021-05-21 09:14:36 +07:00
jangko 640f21b0ca
add github action CI badge to readme.md 2021-05-21 09:13:09 +07:00
Arijit Das 6b76bd8261
WIP: Implement websocket TLS. (#7)
* Update http to use chronos http.

* Implement TLS in websocket.

* Add webscoket TLS test.

* Minor nit.

* Add TLS test file.

* 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>

* Implement TLS in websocket.

* Minor nit.

* merge master

* wip

* 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>

* Update http to use chronos http.

* Implement TLS in websocket.

* Minor nit.

* 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>

* Implement TLS in websocket.

* Minor nit.

* add testing keys

* wip

* fix test

* wip

* remove eth dep and add skipdirs

* fix package structure

* fix deps

* check nim version

* Fix CI failure.

* Don't call `ws.stream.closeWait()`

* always close both ends to complete the sequence

* misc

* don't fail on close

* Fix windows CI.

* fix linux x86 builds

* use consistent connect pattern

* move keys to better place

* return dumbResponse

* small cleanup

Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
2021-04-13 16:05:58 -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
Arijit Das 8e34e0f138 Remove ws.nim file. 2021-01-05 18:29:06 +05:30
Arijit Das 350fa94418 Add HTTP and websocket client. 2021-01-05 18:27:46 +05:30
Arijit Das fa37c87dd5 Parse Frame and handle different message type. 2020-12-15 18:39:50 +05:30
Arijit Das 8fb4e78353 Support Websocket handshake and update the readme. 2020-12-08 18:19:22 +05:30
Arijit Das a1c1c37a41 Update the readme instruction to test the server. 2020-12-08 15:45:21 +05:30
Arijit Das d4901f1cba Add callback handler for HTTP server 2020-12-08 15:39:11 +05:30
Arijit Das 8755d03265 Implement a HTTP server using httputils package 2020-12-08 01:17:45 +05:30
Arijit Das 19a573e756 Add Todo to use chronos async fd 2020-12-01 19:19:13 +05:30
Arijit Das afb7e4d86e Fix package import 2020-12-01 18:53:27 +05:30
Arijit Das 22cefcfd4b Minor nit 2020-12-01 18:32:41 +05:30
Arijit Das 3b69187007 Implement web socket handshake 2020-12-01 18:13:59 +05:30