Commit Graph

65 Commits

Author SHA1 Message Date
Eugene Kabanov e9d0e2d208
Apply fix for recent Nim devel changes. (#300) 2022-07-30 12:48:58 +03:00
Jacek Sieka 2a19e4ca4c
bearssl: spelling (#294) 2022-07-16 20:46:19 +02:00
Jacek Sieka c6ce4d4fb2
bearssl: use split ABI (#282) 2022-06-17 12:39:14 +02:00
Derek 呆 1233f8fb4b
fix tiny typo in comment (#274) 2022-05-19 17:37:51 +02:00
Tanguy 8719723077
Fix TLS certificate allocation (#259)
* Fix TLS certificate allocation

* change style + comment
2022-01-28 13:46:15 +02:00
Jacek Sieka 0fc82049ac enable --styleCheck:usages 2021-12-27 17:33:25 +02:00
Zahary Karadjov 7ca85ddadc
Fix compilation errors with --styleCheck:usages --styleCheck:error 2021-12-08 16:58:24 +02:00
Eugene Kabanov 05c91418be
Export async-related imports to allow partial imports. (#218) 2021-08-26 14:22:29 +03:00
Eugene Kabanov b14f66c295
No more Defect on stream close. (#213)
Fix async streams issue with replacing state.
Add `closing` states to HTTP's server connection, request and bodyrw.
Fix Http server cancellation leaks.
2021-08-06 13:13:55 +03:00
Eugene Kabanov fed6b0ac92
Restore functionality of zero-sized bounded reader/writer streams. (#184)
* Restore functionality of zero-sized bounded reader/writer streams.
Adding tests for it.

* run build_nim.sh unconditionally

Co-authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
2021-05-07 18:52:44 +03:00
cheatfate 645d62db78
Remove fastpath execution and finally fix issue. 2021-04-27 00:07:49 +03:00
Eugene Kabanov 39f4060e07
Refactor and optimization of BoundedStream. (#180)
Documentation for BoundedStream.
Fix HttpServer bounding.
2021-04-26 14:05:37 +03:00
Eugene Kabanov 833d968782
Fix upload() issue and adding tests. (#179) 2021-04-24 20:32:21 +03:00
Eugene Kabanov e6ba00cb81
Fix reading could stuck on very big chunked headers and tests. (#178) 2021-04-22 15:32:28 +03:00
Jacek Sieka 4abd7a5645
exception tracking (#166)
* exception tracking

This PR adds minimal exception tracking to chronos, moving the goalpost
one step further.

In particular, it becomes invalid to raise exceptions from `callSoon`
callbacks: this is critical for writing correct error handling because
there's no reasonable way that a user of chronos can possibly _reason_
about exceptions coming out of there: the event loop will be in an
indeterminite state when the loop is executing an _random_ callback.

As expected, there are several issues in the error handling of chronos:
in particular, it will end up in an inconsistent internal state whenever
the selector loop operations fail, because the internal state update
functions are not written in an exception-safe way. This PR turns this
into a Defect, which probably is not the optimal way of handling things
- expect more work to be done here.

Some API have no way of reporting back errors to callers - for example,
when something fails in the accept loop, there's not much it can do, and
no way to report it back to the user of the API - this has been fixed
with the new accept flow - the old one should be deprecated.

Finally, there is information loss in the API: in composite operations
like `poll` and `waitFor` there's no way to differentiate internal
errors from user-level errors originating from callbacks.

* store `CatchableError` in future
* annotate proc's with correct raises information
* `selectors2` to avoid non-CatchableError IOSelectorsException
* `$` should never raise
* remove unnecessary gcsafe annotations
* fix exceptions leaking out of timer waits
* fix some imports
* functions must signal raising the union of all exceptions across all
platforms to enable cross-platform code
* switch to unittest2
* add `selectors2` which supercedes the std library version and fixes
several exception handling issues in there

* fixes

* docs, platform-independent eh specifiers for some functions

* add feature flag for strict exception mode

also bump version to 3.0.0 - _most_ existing code should be compatible
with this version of exception handling but some things might need
fixing - callbacks, existing raises specifications etc.

* fix AsyncCheck for non-void T
2021-03-24 10:08:33 +01:00
cheatfate 25688cd0aa Add hexValue tests. 2021-02-18 22:16:04 +02:00
cheatfate 4e9a857b90 Link to original procedure for hexValue(). 2021-02-18 22:16:04 +02:00
cheatfate 1d49ae7a47 Fix x86 int conversion. 2021-02-18 22:16:04 +02:00
cheatfate eb81018d02 Address review comments and fix issues found.
Adding more tests.
2021-02-18 22:16:04 +02:00
cheatfate fc0d1bcb43 Address review comments. 2021-02-18 22:16:04 +02:00
cheatfate 1789328748 Set TLSStream default to use TLS1.2 only. 2021-02-18 22:16:04 +02:00
cheatfate 3e9ffae407 Properly fix case when request body size exceeds maximum allowed size. 2021-02-18 22:16:04 +02:00
cheatfate 970e5641d7 Add less strict rules for BoundStream reader/writer. 2021-02-18 22:16:04 +02:00
cheatfate d43a9cb92d HttpServer now supports TLS.
Some TLSStream fixes to properly support EOF.
Some HttpServer to properly support TLS handshake problems.
HttpServer test suite for HTTPS.
2021-02-18 22:16:04 +02:00
cheatfate a310a5620a General fixes. 2021-02-18 22:16:04 +02:00
cheatfate c0472bd349 Fix streams to check only for Closed state. 2021-02-18 22:16:04 +02:00
cheatfate 2defc4b822 Add sequence of bytes as boundary to BoundStream and tests. 2021-02-18 22:16:04 +02:00
cheatfate 13eddf382d Simplification and fixes for TLSStream state machine. 2021-02-18 22:16:04 +02:00
cheatfate e8d2a3ca0a Attempt #5. 2021-02-18 22:16:04 +02:00
cheatfate 49fd70f504 Attempt #4. 2021-02-18 22:16:04 +02:00
cheatfate ac8b11d6ca close() procedure should not raise, otherwise its impossible to cleanup. 2021-02-18 22:16:04 +02:00
cheatfate 0cb6840f03 Big refactoring of AsyncStreams.
1. Implement all read() primitives using readLoop() like it was done in streams.
2. Fix readLine() bug.
3. Add readMessage() primitive.
4. Fixing exception hierarchy, handling code and simplification of (break/continue + exception).
5. Fix TLSStream closure procedure.
6. Add BoundedStream stream and tests.
7. Remove `result` usage from the code.
2021-02-18 22:16:04 +02:00
Eugene Kabanov d3018ae908
Fix TLSStream SSL errors while in handshake could stuck connection. (#133)
Fix expired SSL certificate in tests.
2020-10-13 02:12:52 +03:00
Eugene Kabanov 57ebe84d17
Add Defect check for arguments `pbytes` and `nbytes`. (#128)
* Add Defect check for arguments `pbytes` and `nbytes`.

* Allow some edge cases to be not Defect.
2020-09-10 03:50:06 +03:00
Zahary Karadjov 826d48c4aa Revert "more docs (#111)"
This reverts commit d0a17d551f.

Moving CancelledError outside of the established Nim hierarchy is
not a solution that has rough consensus and has an unknown impact
on compatibility with otherwise correctly implemented cancellation
code (for example when `CatchableError` is caught, cleanup is done,
then the exception is reraised). Further, this breaks the established
convention in the Nim community that Exception should not be inherited
from, complicating compatibility with future Nim versions that may
enforce this more strongly.
2020-08-16 01:48:25 +03:00
Ștefan Talpalaru d0a17d551f
more docs (#111)
* more docs

* make CancelledError and object of Exception
2020-08-06 20:52:50 +02:00
Giovanni Petrantoni 9ea1017a06
Fix possible race condition in asyncstream close (#91) 2020-04-09 17:56:56 +03:00
cheatfate 73c130abb4
Remove usage of getCurrentException().
Bump version to 2.3.4.
2019-11-28 20:14:19 +02:00
cheatfate 5758d07c08
Fix compilation problems in Nim devel. 2019-10-24 15:29:21 +03:00
cheatfate 368502c10b
Rename harvestItem to copyOut. 2019-10-18 19:24:58 +03:00
cheatfate 9ce7141087
Fix cancel() issue.
Fix asyncstream.nim not propagating cancellation.
Fix tlsstream.nim to proper propagate cancellation.
Fix tlsstream.nim stuck on close.
2019-10-17 14:44:14 +03:00
cheatfate d008fa2087
Fix make serverName mandatory and check for empty serverName. 2019-10-16 09:07:46 +03:00
cheatfate a92ad6d2d2
Add TLS inbound stream.
Fix some review comments.
2019-10-16 09:01:52 +03:00
cheatfate 161c50209e
Remove debugging echos. 2019-10-10 14:53:33 +03:00
cheatfate fe6fca1e67
Add hexdump.nim. 2019-10-10 13:01:14 +03:00
cheatfate 5c801a5dbc
Add upload() and some debugging. 2019-10-10 12:52:12 +03:00
cheatfate 3f8d529c8e
Attempt to fix state machine issue. 2019-10-09 09:12:54 +03:00
cheatfate 417111093e
Cleanup references on exit. 2019-10-08 20:38:39 +03:00
cheatfate e19101d287
Add GC reference to reader and writer. 2019-10-08 20:30:43 +03:00
cheatfate cae1d09690
Removed debugging imports. 2019-10-08 19:02:42 +03:00