Commit Graph

7888 Commits

Author SHA1 Message Date
Timothee Cour
dfe51d10a1 addQuitProc now works with closures, and c, js(node/browser) backend; fix some bugs in testament (#14342)
* make addQuitProc great again

* fix bugs in testament

* fix test

* change 2016 => 2020

* addQuitProc => addExitProc + locks

* move to std/exitprocs
2020-06-16 11:43:48 +02:00
Timothee Cour
45cac4afda fix #14179, fix #14142, make CI 1.4x faster (2x faster locally) (#14658)
* fix #14142: no more clash with: import os + use of existsDir/dirExists/existsFile/fileExists/findExe in config.nims

* remove a comment

* Revert "fixes the regression #12860 caused; hotfix"

This reverts commit 3d2459bdc0.

* Revert "Undefine `paramCount` & `paramStr` in nimscript.nim for *.nims (#12860)"

This reverts commit d38853c504.

* noNimScript => noWeirdTarget + noNimJs
2020-06-16 08:56:12 +02:00
Timothee Cour
d51beb7b20 make fromJson/toJson work with array[range, typ], + 1 bugfix (#14669)
* make toJson more robust

* properly handle array
2020-06-15 13:22:43 +02:00
Timothee Cour
bf604c6829 normalizeExe (#14668) 2020-06-15 10:57:34 +02:00
solo989
3cbf59336d Update newLit set[T] to work when set is empty. (#14662)
* Update macros.nim

* Update lib/core/macros.nim

Co-authored-by: Clyybber <darkmine956@gmail.com>

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-06-15 09:15:17 +02:00
Ico Doornekamp
571bc011ea Added --benchmarkVM to times.cpuTime() documentation (#14663) 2020-06-15 08:58:11 +02:00
Timothee Cour
0fc5d3f13b fix #14655 setLen(seq) now zeros memory (#14656)
* simplify sysstr.nim

* fix #14655
2020-06-14 11:11:26 +02:00
Timothee Cour
e30a08103d remove tyOpt, mOpt (#14636)
* remove tyOpt, mOpt

* fixup
2020-06-12 11:03:52 +02:00
Juan Carlos
82e424189e Add rstgen.rstToLatex convenience proc for renderRstToOut and initRstGenerator with outLatex output, see https://github.com/nim-lang/fusion/pull/11#issuecomment-641804899 (#14629) 2020-06-12 10:51:55 +02:00
djazz
1168c75381 httpcore: Add http code 308 Permanent Redirect (#14639)
* httpcore: Add http code 308
* httpclient: Add 308 to redirection proc
* fix typo
2020-06-12 10:16:38 +02:00
c-blake
6aa971d39f Add proc find to heapqueue (#14628)
* Unwind just the "pseudorandom probing" (whole hash-code-keyed variable
stride double hashing) part of recent sets & tables changes (which has
still been causing bugs over a month later (e.g., two days ago
https://github.com/nim-lang/Nim/issues/13794) as well as still having
several "figure this out" implementation question comments in them (see
just diffs of this PR).

This topic has been discussed in many places:
  https://github.com/nim-lang/Nim/issues/13393
  https://github.com/nim-lang/Nim/pull/13418
  https://github.com/nim-lang/Nim/pull/13440
  https://github.com/nim-lang/Nim/issues/13794

Alternative/non-mandatory stronger integer hashes (or vice-versa opt-in
identity hashes) are a better solution that is more general (no illusion
of one hard-coded sequence solving all problems) while retaining the
virtues of linear probing such as cache obliviousness and age-less tables
under delete-heavy workloads (still untested after a month of this change).

The only real solution for truly adversarial keys is a hash keyed off of
data unobservable to attackers.  That all fits better with a few families
of user-pluggable/define-switchable hashes which can be provided in a
separate PR more about `hashes.nim`.

This PR carefully preserves the better (but still hard coded!) probing
of the  `intsets` and other recent fixes like `move` annotations, hash
order invariant tests, `intsets.missingOrExcl` fixing, and the move of
`rightSize` into `hashcommon.nim`.

* Fix `data.len` -> `dataLen` problem.

* Add neglected API call `find` to heapqueue.

* Add a changelog.md entry, `since` annotation and rename parameter to be
`heap` like all the other procs for consistency.

* Add missing import.
2020-06-10 19:53:18 +01:00
ee7
5131af1a44 exceptions.nim: Fix a bad Error -> Defect renaming (#14621)
This commit fixes a mistake from 7d6cbf290a.
2020-06-10 09:34:20 +02:00
Timothee Cour
b7b84fa165 parseutils: integerOutOfRangeDefect => integerOutOfRangeError (#14627) 2020-06-09 23:57:27 -07:00
Max Grender-Jones
cc3409e264 Make the example better describe the desired outcome (#14611) 2020-06-08 18:49:07 -07:00
Andreas Rumpf
c308c2e60b optimized wrapWords; fixes #14579 (#14606) [backport:1.2] 2020-06-08 14:34:26 +02:00
Timothee Cour
c7a1a7b8bf toJson, jsonTo, json (de)serialization for custom types; remove dependency on strtabs thanks to a hooking mechanism (#14563)
* json custom serialization; application for strtabs
* serialize using nesting
* make toJson more feature complete
* add since
* Revert "Improve JSON serialisation of strtabs (#14549)"

This reverts commit 7cb4ef26ad.

* better approach via mixin
* toJson, jsonTo
* fix test
* address comments
* move to jsonutils
* doc
* cleanups
* also test for js
* also test for vm
2020-06-08 10:35:23 +02:00
Tomohiro
733bd76f6b Fix sugar.dump: It doesn't work correctly with compile time expression (#14580) 2020-06-08 10:28:42 +02:00
alaviss
8edac9cf1d openssl: use explicit result for SSL_in_init (#14597)
Sometimes the analysis might get funky and decide that the if-expression
below is not an if-expression. Details of how this can happen is largely
unknown, but it's easy to prevent so we will just go forward with that.

Fix #14591
2020-06-08 08:15:10 +02:00
Leorize
4fdf9cb808 wrappers/openssl: defer loading SSL_CTX_set_ciphersuites 2020-06-06 21:11:53 +02:00
Leorize
6b2d8bfc8b net: also set TLSv1.3 cipher suites 2020-06-06 21:11:53 +02:00
Leorize
3cd74c6408 wrappers/openssl: mark casts as gcsafe
Nim will pretend that these proc are not gcsafe if they are not marked.
2020-06-06 21:11:53 +02:00
Leorize
b323bccd81 wrappers/openssl: enable SSL_CTX_set_ecdh_auto for LibreSSL
This procedure is not no-op for older LibreSSL, and the ABI is kept for
newer versions, so there's no harm in enabling it unconditionally for
all LibreSSL versions.
2020-06-06 21:11:53 +02:00
Leorize
e80a23f4d2 net: revert compatibility changes for Windows
This reverts commit d53a6355f3 and
688b1f250e.
2020-06-06 21:11:53 +02:00
Leorize
d406f588d8 wrappers/openssl: the version number comes from the utility library
Previously we loaded the SSL library for this, but that's not where the
symbol resides.
2020-06-06 21:11:53 +02:00
Leorize
0ca069b4f8 net: use CiphersOld list for Windows
The default DLLs shipped are too old, switch to CiphersOld list to
ensure compatibility.

This commit should be reverted before any future release.
2020-06-06 21:11:53 +02:00
Leorize
279438f1df net: don't call set_ecdh_auto for super old OpenSSL
And the fun thing is that currently we use a super old OpenSSL on
Windows.
2020-06-06 21:11:53 +02:00
Leorize
b5b191af4b wrappers/openssl: fix SSL_CTX_set_mode
Follow up of 794042080b
2020-06-06 21:11:53 +02:00
Leorize
61d4fbce4f wrappers/openssl: getOpenSSLVersion is gcsafe
Yet another weird {.gcsafe.} triggering when it shouldn't.
2020-06-06 21:11:53 +02:00
Leorize
6c0f86c486 net: enable automatic EC curve selection for OpenSSL 1.0.2
This setting is required for servers running OpenSSL < 1.1.0 to support
EC-based secure ciphers that is now part of the default cipher list.
2020-06-06 21:11:53 +02:00
Leorize
9278e785bd wrappers/openssl: fix SSL_CTX_ctrl signature 2020-06-06 21:11:53 +02:00
Leorize
e4e3d99ee2 asyncnet: clear SSL error queue before performing I/O
Follow up of 476be6cc27
2020-06-06 21:11:53 +02:00
Leorize
1fb2a58674 net: use a secure cipher list by default
Previously, the `net` module use the blanket "ALL" as the default cipher
list. This list may contain security ciphers that are weak and/or outdated
according to the current standard.

This commit introduces a new module `ssl_config` that contains the
latest OpenSSL configurations as recommended by Mozilla OpSec, and
make the `net` module use the cipher list targeting `intermediate`
compatibility level as the default.
2020-06-06 21:11:53 +02:00
Leorize
6cb94b5da6 asyncnet, net: clear openssl error queue before performing I/O
Per SSL_get_error(3):

  The current thread's error queue must be empty before the TLS/SSL I/O
  operation is attempted, or SSL_get_error() will not work reliably.

There has been records of not clearing the error queue causing weird SSL
errors when there shouldn't be any, see:

https://github.com/openssl/openssl/issues/11889
2020-06-06 21:11:53 +02:00
Leorize
f243f9aeb5 openssl: fix erroneous function signatures
Now matches the declaration in openssl/err.h
2020-06-06 21:11:53 +02:00
Leorize
78982b52f0 net: don't clear error queue unless shutdown() will be performed 2020-06-06 21:11:53 +02:00
Leorize
19ccce2617 Revert "net: don't clear all errors on close"
You're supposed to clear the error queue before any I/O operations. Per
SSL_get_error(3) man page.

This reverts commit ee3ed37300.
2020-06-06 21:11:53 +02:00
Leorize
d06e6eec79 net: don't clear all errors on close
Closing a socket clears the error queue of the entire thread, which
seems to be a bit too invasive.

Also I don't find any reason in the PR that added this.
2020-06-06 21:11:53 +02:00
Leorize
82092b3bb7 asyncnet, net: call SSL_shutdown only when connection established
This commit prevents "SSL_shutdown while in init" errors from happening.

See https://github.com/openssl/openssl/issues/710#issuecomment-253897666
2020-06-06 21:11:53 +02:00
Zed
ea761419ad Fix asynchttpserver newline breaking content-length (#14565) [backport] 2020-06-06 12:20:11 +02:00
Timothee Cour
d573581eb7 remove isMainModule from json,os,sequtils (#14572)
* move json.isMainModule => tjson

* move isMainModule => tos,tsequtils
2020-06-06 11:50:46 +02:00
PMunch
7cb4ef26ad Improve JSON serialisation of strtabs (#14549)
This creates a more compact serialisation of strtabs that is more in
line with the normal tables.
2020-06-05 10:54:38 +02:00
alaviss
55f0df164b io: correct signature for some win32 apis (#14551)
See https://github.com/nim-lang/Nim/pull/14550#issuecomment-637937649
2020-06-03 18:17:06 +02:00
Timothee Cour
621384b8ef fix https://github.com/timotheecour/Nim/issues/266 retry on failure to avoid common 503 github errors (#14547) 2020-06-02 10:47:19 +02:00
Timothee Cour
3cf88c2b49 walkDirRecFilter, update doc CI filter, compiler/index.nim for docs + various other fixes (#14501)
* update doc CI filter to include the files mostly likely to require doc rebuild
* remove code duplication in ./config/nimdoc.cfg; show link to compiler docs, various fixes
* walkDirRecFilter, factor nativeToUnixPath workaround
* glob for getRst2html
* docslocal: 40s to build all docs
* revert code dedup in github actions which did not work alas...
* fixups
2020-06-01 19:21:41 +02:00
Danil Yarantsev
5d0cf883c1 Disable unused warnings for error await template too (#14531) 2020-06-01 11:56:07 +02:00
Timothee Cour
004b0759c5 fix CI doc windows: style error in lib/std/time_t.nim (#14523) 2020-05-31 14:57:16 -07:00
Danil Yarantsev
5150186c68 Disable unused warnings for await in async macro (#14517)
* Disable unused warnings for await in async macro

* Remove used for the error template
2020-05-31 12:43:27 +02:00
Timothee Cour
63d1a0289e fix #14421 items uses lent T (#14447)
* fix #14421 items uses lent T for seq + openArray
* add -d:nimWorkaround14447
* fix test
2020-05-29 17:10:59 +02:00
Timothee Cour
e646c16e06 hotfix doc comments for procs without body (#14494) 2020-05-29 05:30:36 -07:00
Andreas Rumpf
e31ac81899 more checking for --gc:arc, no need for valgrind (#14467)
* sigmatch: removed dead code
2020-05-29 12:08:17 +02:00