summary refs log tree commit diff stats
path: root/lib/pure/net.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes SSL version check logic [backport] (#21324)ringabout2023-02-021-3/+3
| | | | | | | | | | | | | | | | | | | * fixed version check logic [backport] * add ciphersuites * debug nimble * fixes returns omission * finally * remove debug message * add ciphersuites --------- Co-authored-by: Araq <rumpf_a@web.de>
* avoiding unnecessary allocation for dollar IpAddress (#21199)rockcavera2022-12-301-2/+2
| | | | | | | | | | | | | | | * avoiding allocating an unnecessary byte for IPv4 The inet.h file uses 16 as the string in C needs the last null byte https://github.com/torvalds/linux/blob/1b929c02afd37871d5afb9d498426f83432e71c2/include/linux/inet.h#L49 However, strings in Nim do not need this. So one byte is being allocated unnecessary and will never be used. * avoid unnecessary allocation in IPv6 dollar It is currently allocating 48 bytes. However, the Nim implementation for IPv6 will print a maximum of 39 characters. Nim does not implement IPv6 "0000:0000:0000:0000:0000:ffff:255.255.255.255" (45 characters) nor "0000:0000:0000:0000:0000:ffff:255.255.255.255%3" (47 characters). The indication in inet.h for 48 is due to the maximum use of 47 characters of a C string that needs a null byte at the end. So 48. https://github.com/torvalds/linux/blob/1b929c02afd37871d5afb9d498426f83432e71c2/include/linux/inet.h#L50
* fix socket send for string types (#21155)Jaremy Creechley2022-12-221-9/+30
| | | | | | | * fix socket send for string types * include windows version Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* Improve dollar IpAddress (#20729)Juan Carlos2022-11-031-10/+14
| | | | | | | | | | | | | | | * Improve dollar * Improve dollar * Simplify, remove 1 if in for loop * ci * Update lib/pure/net.nim * Update lib/pure/net.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* openssl 3 support no longer opt in + some 1.0 support (#20668)metagn2022-10-271-2/+15
| | | | | | | | | | | | | | | * Revert "Add OpenSSL 3 support (#19814)" This reverts commit 2dcfd732609a2cfa805e5a94cc105399a2f18632. * openssl 3 support no longer opt in + some 1.0 support * hopefully fix * maybe fix * final attempt * actual fix hopefully
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-1/+1
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* make more standard libraries work with `nimPreviewSlimSystem` (#20343)ringabout2022-09-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | * make more standard libraries work with `nimPreviewSlimSystem` * typo * part two * Delete specutils.nim * fixes more tests * more fixes * fixes tests * fixes three more tests * add formatfloat import * fix * last
* partial revert and redesign of #19814, changelog (#20341)metagn2022-09-141-0/+6
| | | | | | | | | | | | | | | * conservative partial revert of #19814 * fix * revert tssl * revert azure CI change * keep azure, revert version range * fully revert CI, add changelog * useOpenssl3 as separate define, .3 is a version
* fixes #17658; add cert dir for ssl ctx (#19920)ringabout2022-08-281-1/+5
| | | | | | | add cert dir for ssl ctx Co-authored-by: Paul Roberts <pmr@stelo.org.uk> Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Add OpenSSL 3 support (#19814)Federico Ceratto2022-08-231-35/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Minor refactor * Add OpenSSL 3 support Remove symbols noOpenSSLHacksq and openssl10 * Drop loading of older openssl versions * Add library path * Use only versioned libssl soname os OSX * Update .github/workflows/ci_packages.yml Co-authored-by: Hein Thant <official.heinthanth@gmail.com> * On Mac OS X CI, link OpenSSL in /usr/local/lib/ * Install OpenSSL on Mac OS X on azure pipeline * Remove DYLD_LIBRARY_PATH Co-authored-by: Hein Thant <official.heinthanth@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Hein Thant <official.heinthanth@gmail.com>
* fixes #19973; switch to poll on posix (#20212)ringabout2022-08-231-11/+28
| | | | | | | | | | | | | | | | | * fixes #19973; switch to poll on posix * it is fd * exclude lwip * fixes lwip * rename select to timeoutRead * refactor into timeoutRead/timeoutWrite * refactor common parts Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* make implicit cstring conversions explicit (#19488)ee72022-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Nim manual says that an implicit conversion to cstring will eventually not be allowed [1]: A Nim `string` is implicitly convertible to `cstring` for convenience. [...] Even though the conversion is implicit, it is not *safe*: The garbage collector does not consider a `cstring` to be a root and may collect the underlying memory. For this reason, the implicit conversion will be removed in future releases of the Nim compiler. Certain idioms like conversion of a `const` string to `cstring` are safe and will remain to be allowed. And from Nim 1.6.0, such a conversion triggers a warning [2]: A dangerous implicit conversion to `cstring` now triggers a `[CStringConv]` warning. This warning will become an error in future versions! Use an explicit conversion like `cstring(x)` in order to silence the warning. However, some files in this repo produced such a warning. For example, before this commit, compiling `parsejson.nim` would produce: /foo/Nim/lib/pure/parsejson.nim(221, 37) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv] /foo/Nim/lib/pure/parsejson.nim(231, 39) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv] This commit resolves the most visible `CStringConv` warnings, making the cstring conversions explicit. [1] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/doc/manual.md#cstring-type [2] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/changelogs/changelog_1_6_0.md#type-system
* enable style:usages for stdlib tests [backport: 1.6] (#19715)flywind2022-04-131-7/+7
| | | | | | | | | | | | | | | * enable style:usages for stdlib tests * freeAddrInfo * more tests * importc * bufSize * fix more * => parseSql and renderSql
* Embedded Network patches - eventfd & socket getters (#19632)Jaremy Creechley2022-03-281-0/+10
|
* Fix dial ignoring buffered parameter (#19650) [backport]John Titor2022-03-261-1/+1
|
* Update net.nim (#19327) [backport]rockcavera2022-01-061-1/+1
|
* devel: style fix (#19318)Ștefan Talpalaru2022-01-041-1/+1
| | | this allows "--styleCheck:usages --styleCheck:error"
* fix: fixes bug in CVerifyPeerUseEnvVars (#19247)Nick Wilburn2021-12-141-1/+2
| | | | | | Previously CVerifyPeerUseEnvVars was not being passed into scanSslCertificates, which meant that we weren't scanning additional certificate locations given via the SSL_CERT_FILE and SSL_CERT_DIR environment variables
* Various std net improvements (#19132)Jaremy Creechley2021-12-121-11/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Variant of that works with raw IpAddresses. - Add doc tests for new net proc's. - Aadd recvFrom impl - Add recvFrom impl -- tweak handling data var - Update lib/pure/net.nim Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com> - cleaning up sendTo args - remove extra connect test - cleaning up sendTo args - fix inet_ntop test - fix test failing - byte len * fix test failing - byte len * debugging odd windows build failure * debugging odd windows build failure * more experiments to figure out the windows failure * try manual assigment on InAddr Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
* Revert "swap port to correct port order (#19177)" (#19234)Jaremy Creechley2021-12-101-2/+2
| | | This reverts commit 0d0c249074d6a1041de16108dc247396efef5513.
* swap port to correct port order (#19177)Jaremy Creechley2021-11-241-2/+2
| | | Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
* Add Zephyr Support (#19003)Jaremy Creechley2021-10-241-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Porting Nim to run on Zephyr. Includes changes to `std/net`. Squashed commit of the following: tweaking more memory / malloc things revert back bitmasks tweaking nim to use kernel heap as C malloc doesn't work fixing socket polling on zephyr cleanup getting maximum sockets for process or for rtos'es reorganizing and fixing net for async / system merge netlite changes back into nativesockets merge netlite changes back into nativesockets reverting native sockets back tweaking nim / zephyr network adding option to run 'net-lite' from linux bridging zephyr's max connections fixing net errors fixing compilation with getAddrString fixing compilation with getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... add note regarding incorrect FreeRTOS Sockadd_in fields changing to NIM_STATIC_ASSERT cleaning up the static_assert error messages cleaning up the static_assert error messages setting up static assert ftw! testing compile time asserts reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms finding missing items (issue #18684) fixup posix constants (issue #18684) adding plumbing for zephyr os (issue #18684) adding plumbing for zephyr os (issue #18684) * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * Porting Nim to run on Zephyr. Includes changes to `std/net`. Squashed commit of the following: tweaking more memory / malloc things revert back bitmasks tweaking nim to use kernel heap as C malloc doesn't work fixing socket polling on zephyr cleanup getting maximum sockets for process or for rtos'es reorganizing and fixing net for async / system merge netlite changes back into nativesockets merge netlite changes back into nativesockets reverting native sockets back tweaking nim / zephyr network adding option to run 'net-lite' from linux bridging zephyr's max connections fixing net errors fixing compilation with getAddrString fixing compilation with getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... add note regarding incorrect FreeRTOS Sockadd_in fields changing to NIM_STATIC_ASSERT cleaning up the static_assert error messages cleaning up the static_assert error messages setting up static assert ftw! testing compile time asserts reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms finding missing items (issue #18684) fixup posix constants (issue #18684) adding plumbing for zephyr os (issue #18684) adding plumbing for zephyr os (issue #18684) * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * fixing PR issues * Porting Nim to run on Zephyr. Includes changes to `std/net`. Squashed commit of the following: tweaking more memory / malloc things revert back bitmasks tweaking nim to use kernel heap as C malloc doesn't work fixing socket polling on zephyr cleanup getting maximum sockets for process or for rtos'es reorganizing and fixing net for async / system merge netlite changes back into nativesockets merge netlite changes back into nativesockets reverting native sockets back tweaking nim / zephyr network adding option to run 'net-lite' from linux bridging zephyr's max connections fixing net errors fixing compilation with getAddrString fixing compilation with getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getAddrString experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... getLocalAddr experimenting with a nativesockets_lite ... add note regarding incorrect FreeRTOS Sockadd_in fields changing to NIM_STATIC_ASSERT cleaning up the static_assert error messages cleaning up the static_assert error messages setting up static assert ftw! testing compile time asserts reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms reworking Sockaddr objects to more closely match various platforms finding missing items (issue #18684) fixup posix constants (issue #18684) adding plumbing for zephyr os (issue #18684) adding plumbing for zephyr os (issue #18684) * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * Remerge * fixing constant capitalizations * remove extra debug prints and fix TSa_Family/cint issue * remove extra debug prints and fix TSa_Family/cint issue * fixing PR issues * fix maxDescriptors on zephyr/freertos * move maxDescriptors to selector.nim -- fixes compile issue * change realloc impl on zephyr to match ansi c behavior * change realloc impl on zephyr to match ansi c behavior * force compileOnly mode for tlwip Co-authored-by: Jaremy J. Creechley <jaremy.creechley@wavebaselabs.com> Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
* Only allow IPv4 literals in strict form (#18656)Christian Ulrich2021-08-081-3/+22
| | | | | | | | | | | | | * Only allow IPv4 literals in strict form The strict form as defined in RFC 6943, section 3.1.1 only allows the dotted form ddd.ddd.ddd.ddd of IPv4 literals, where ddd is a one to three digit decimal number between 0 and 255. Until now octal numbers (with a leading zero) were interpreted as decimal numbers which has security implications, see CVE-2021-29922 and CVE-2021-29923. * Update lib/pure/net.nim Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
* various small documentation improvements (#18602)Miran2021-07-281-4/+4
|
* termux ssl (#18520)Paul Roberts2021-07-201-1/+1
|
* deprecate cuchar, don't redefine it (#18505)Andreas Rumpf2021-07-161-3/+3
|
* improve rendering of newOSError.additionalInfo (#18443)Timothee Cour2021-07-071-1/+3
| | | | | * improve rendering of newOSError.additionalInfo * fixup
* std/net: show addr+port on address already in use error; code-block => ↵Timothee Cour2021-07-051-43/+37
| | | | | | | runnableExamples (#18428) * std/net: show addr+port on address already in use error; code-block => runnableExamples * var=>let
* Export sslHandle in `net` and `asyncnet`. (#17573)Ardek Romak2021-05-061-0/+5
|
* Fix buffer-overrun bug in net (#17728) [backport:1.0]shirleyquirk2021-04-161-4/+3
|
* Small doc fixes in net (#17566)Danil Yarantsev2021-03-291-4/+2
|
* Fix net.readLine infine loop #17534 (#17535)ben2021-03-291-0/+1
| | | | | * Fix net.readLine infine loop #17534 * fix #17534 add return to template
* Free the certificate after checking in `checkCertName` (#17558) [backport:1.2]Danil Yarantsev2021-03-291-3/+4
| | | | | | * Fix small leak in checkCertName * Size is not needed either * Free the certificate after checking
* remove redundant void return in stdlib (#17464)Timothee Cour2021-03-231-1/+1
|
* Use `.. warning::` (#17320)konsumlamm2021-03-101-8/+8
|
* use lowercase --define switches (#17283)flywind2021-03-071-1/+1
|
* Replace double backticks with single backticks - Part 3 out of ~7 (#17207)Danil Yarantsev2021-02-281-99/+99
|
* fixes yet another SSL problem on Windows [backport:1.2] (#17167)Andreas Rumpf2021-02-241-1/+1
|
* fix #15215 (#17142)rockcavera2021-02-221-5/+12
| | | | | | | | | | | | | | | | * fix 15215 * fix test * end line * Update tests/stdlib/tnetconnect.nim Co-authored-by: flywind <xzsflywind@gmail.com> * Update lib/pure/net.nim Co-authored-by: flywind <xzsflywind@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* add -d:nimStrictMode in CI to keep code from regressing; fixes ↵Timothee Cour2021-02-171-2/+3
| | | | ConvFromXtoItselfNotNeeded, UnusedImport notes (#16764)
* final SSL changes [backport:1.2] (#16983)Andreas Rumpf2021-02-091-0/+11
|
* basic cleanups regarding SSL handling (#16940) [backport:1.0]Andreas Rumpf2021-02-081-3/+5
| | | | | | | * basic cleanups regarding SSL handling * enabled certificate checking on Windows * updated the SSL test * quoting helps
* fix some warnings (#16952)flywind2021-02-081-6/+6
|
* use typeof instead type (#16962)flywind2021-02-081-2/+2
|
* Deprecate TaintedString (#15423)Juan Carlos2021-01-151-4/+4
| | | | Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
* styleCheck: Fix some inconsistent identifiers (#16177)ee72020-12-211-4/+4
|
* Fix broken links in docs (#16336)Elliot Waite2020-12-141-1/+1
| | | | | * Fix broken links in docs * Fix rand HSlice links
* fix #15698 (#15699)rockcavera2020-10-251-0/+4
| | | | | | | | | | | * fix in the net.`$` to print zeros that are not in the compressed group * Update lib/pure/net.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update net.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* close socket in getPrimaryIPAddr even if exception occurs (#15558)Christian Ulrich2020-10-121-3/+5
|
* close socket in getPrimaryIPAddr (#15538) [backport]Christian Ulrich2020-10-101-1/+2
|