Commit Graph

450 Commits

Author SHA1 Message Date
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 1a3e9162a4 Fix multipart end of message handling.
Add apps.nim.
Change copyrights dates.
Add httpserver tests to test suite.
2021-02-18 22:16:04 +02:00
cheatfate 789a5f8252 Fix dependency name. 2021-02-18 22:16:04 +02:00
cheatfate fb11d9f8ab Add httptable changes. 2021-02-18 22:16:04 +02:00
cheatfate 8c20b369b7 Fix queryParams() to not produce empty values.
Fix part() cancellation.
Add requestInfo() procedure.
Fix request.scheme.
Add MultiPart.isEmpty()
Fix MultiPart counter.
Add isEmpty() for HttpTable.
Add some documentation in HttpTable.
2021-02-18 22:16:04 +02:00
cheatfate a310a5620a General fixes. 2021-02-18 22:16:04 +02:00
cheatfate 0b03f8ec50 Expect header handling and response preparations. 2021-02-18 22:16:04 +02:00
cheatfate 74b0f85fc7 Add async post() procedure. 2021-02-18 22:16:04 +02:00
cheatfate 53aec163eb Fix nimble dependencies. 2021-02-18 22:16:04 +02:00
cheatfate 475c03ff7b Fix MultiPart handling mechanisms. 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 534df03a0b Fixes and improvements 2021-02-18 22:16:04 +02:00
cheatfate 0e5ea5b737 Prepare for HttpResponse. 2021-02-18 22:16:04 +02:00
cheatfate 60e5396a9e Remove executable. 2021-02-18 22:16:04 +02:00
cheatfate 8381a40868 Initial commit. 2021-02-18 22:16:04 +02:00
cheatfate 0b396c34d8 Add newline. 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 fb137112be Remove debugging changes. 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 f1b43aeb04 Investigation of Linux freezes #3. 2021-02-18 22:16:04 +02:00
cheatfate cf42a5455e Investigation of Linux freezes #2. 2021-02-18 22:16:04 +02:00
cheatfate bb176ba574 Investigation of Linux freezes #1. 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
Ștefan Talpalaru 39456e9c18
README: remove claim about temp var reordering (#155)
...between `await` calls. Can no longer replicate.
2021-02-10 16:49:12 +02:00
Eugene Kabanov dcf197a8c7
Attempt to fix MacOS compilation issues. (#152) 2021-02-02 17:10:07 +02:00
Jacek Sieka e7f5f855ab
use constant for ip kind (#151)
IPV6_MULTICAST_HOPS already declared in posix.nim while IP_MULTICAST_TTL
has a value that will stay constant on linux/x86_64 - better codegen and
nlvm compat like this.
2021-02-02 16:12:12 +02:00
andri lim c1f6e7276e
add github action script (#144) 2021-01-20 17:36:10 +02:00
Eugene Kabanov 491213dfa0
Add callIdle() primitive. (#148)
* Add callIdle primitive.

* Make single idle callback to be processed by single poll() step.
Add idleAsync() primitive to allow wait for "idle" time.
Refactor some `result` usage.
2021-01-19 13:48:39 +01:00
Jacek Sieka 9a420c6b05
work around overload resolution issues (#146)
it seems that due to a naming conflict from asyncdispatch, callSoon is
deduced to raise exceptions even if it doesn't in modules that import
both, even indirectly - this patch randomly works around the issue with
some more overloads
2021-01-11 22:15:21 +01:00
Eugene Kabanov 0933feaa35
Fix callSoon to raise Defect only. (#145)
* Initial commit.

* Move pragmas to forward declaration.
Add raises to callSoon declaration.

* Fix for IOSelectorsException.
2021-01-11 18:15:23 +01:00
cheatfate 46c0bf3c5a
Fix define to skip flaky test on MacOS. 2020-11-27 03:50:38 +02:00
Eugene Kabanov bca5559c6a
Race() call (#142)
* Add `race` procedure call which extends `one` with FutureBase.

* Fix race() and add test procedures.
2020-11-27 00:50:55 +02:00
Eugene Kabanov ac9b3e304f
Fix deadlock for pending write() calls on transport close. (#139)
Add tests for read() and write() deadlocks.
2020-11-18 11:30:33 +02:00
cheatfate 879c917242 Add cancellation handler for cancelAndWait() 2020-11-17 19:28:52 +02:00
cheatfate 493cb1dbfd Fix behavior of wait() and withTimeout() calls to cancel and wait for result of cancelled Future[T].
Add tests.
2020-11-17 19:28:52 +02:00
Jacek Sieka 7fd1a0f635
rename newFuture proc's (#136)
...or the compiler randomly gets confused when
`-d:chronosFutureTracking` is enabled
2020-11-15 20:46:42 +02:00
Eugene Kabanov b5915ecd29
Small fixes (#134)
* Fix cancellation behavior.
Fix some compilation warnings.

* Fix cancelAndWait() and add proper documentation.

* Add completed(Future) and done(Future) calls to check if Future[T] completed without an error.

* Add stepsAsync() and tests.

* Fix comments.

* Fix new primitive comment, to avoid usage for task switches.
2020-11-13 14:22:58 +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
Jacek Sieka 1ffd1cd3dc
release callback memory early (#130)
* release callback memory early

this fixes a memory leak where a deleted callback may keep references
alive until the future is finished.

In particular, when using helpers like `or` which try to remove
themselves from the callback list when a dependent future is completed,
create a reference chain between all futures in the expression - in the
pathological case where one of the futures is completes only rarely (for
example a timeout or a cancellation task), the buildup will be
significant.

* Removing unnecessary asserts, and place comments instead.
2020-09-15 10:55:43 +03:00
Eugene Kabanov 2134980744
Fix AsyncLock.locked flag to be consistent. (#129)
* Fix `locked` flag to be more consistent.
Refactor AsyncLock to not use `result`.
Add test for `locked` flag.

* Fixes.

* Fix imports.

* Fix multiple release() without scheduler.
Add more tests.

* Fix review comments.
2020-09-10 23:28:20 +03:00
Jacek Sieka 483054cda6
small fixes (#127)
* small fixes

* more efficient codegen for nil check (much less code)
* release futures earlier in AsyncEvent
* release finished future earlier in AsyncQueue
* avoid searches for futures (deque variant unused / broken)
* avoid catching defects

* Fix AsyncEvent test, because of optimization.

* delete fix

* avoid seq allocs

* Keep style consistent with other code.
Refactor AsyncEvent and AsyncQueue to not use `result` keyword.

Co-authored-by: cheatfate <eugene.kabanov@status.im>
2020-09-10 11:39:10 +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
Eugene Kabanov 126ea4bc56
Fix newFuture[T] location source for generated async procedures. (#125)
Add tests to for locations.
2020-09-03 14:37:53 +03:00
Eugene Kabanov a5442edfc0
Add asyncSpawn() procedure and tests. (#123)
Deprecated asyncDiscard() procedure.
Bump version to 2.5.2.
2020-09-01 21:41:18 +03:00
Zahary Karadjov e6d50b7736 Revert "some metrics for monitoring futures (#85)"
This reverts commit e45ef32b5b.

Metrics implemented this way, with a lock inside the otherwise tight
event loop are not consistent with the chronos architecture that for
good or bad uses thread local variables to avoid them - the solution
does not have rough consensus behind it, and other avenues should be
explored for this generally useful functionality.
2020-08-16 01:48:25 +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
Zahary Karadjov 03f4a26829 Revert "yieldAsync() (#120)"
This reverts commit 284d677815.

There is no rough consensus for how this should be implemented and
whether it's needed indeed - a use case that cannot be solved with
a queue or a lock/event should be identified before pursuing this
functionality.
2020-08-16 01:48:25 +03:00