Commit Graph

4567 Commits

Author SHA1 Message Date
Andreas Rumpf
57c9de181a Revert "Update uri.nim (#19148) [backport:1.0]" (#19280)
This reverts commit a3ef5df680.

(cherry picked from commit 81d32cf7e5)
2021-12-31 05:23:04 +01:00
Miran
0b1fee5d66 [backport:1.0] json: limit recursion depth (#19252)
* json: limit recursion depth

* do not run this check for JS backend

(cherry picked from commit c17baaefbc)
2021-12-14 18:23:42 +01:00
flywind
594831620b oids: switch from PRNG to random module (#16203)
* switch from PRNG to random module
* fix the regression
* comments + tests
* runnableExamples
* make oids better

(cherry picked from commit 89a21e4ec7)
2021-12-13 15:00:32 +01:00
Dominik Picheta
2eb0442a9a Update uri.nim (#19148) [backport:1.0]
(cherry picked from commit a3ef5df680)
2021-12-11 09:25:46 +01:00
Ștefan Talpalaru
76560576d2 asyncdispatch+stackTraceOverride: fix premature collection (#18039) [backport:1.2]
Copying StackTraceEntry instances when nimStackTraceOverride is defined
breaks the link between a cstring field that's supposed to point at
another string field in the same object.

Sometimes, the original object is garbage collected, that memory region
reused for storing other strings, so when the StackTraceEntry copy tries
to use its cstring pointer to construct a traceback message, it accesses
unrelated strings.

This only happens for async tracebacks and this patch prevents that by
making sure we only use the string fields when nimStackTraceOverride is
defined.

Async tracebacks also beautified slightly by getting rid of an extra line
that was supposed to be commented out, along with the corresponding debugging output.

There's also a micro-optimisation to avoid concatenating two strings just
to get their combined length.

(cherry picked from commit a1c82c39af)
2021-05-19 19:52:50 +02:00
shirleyquirk
7a9e5ba68f Fix buffer-overrun bug in net (#17728) [backport:1.0]
(cherry picked from commit fdd4391534)
2021-05-17 16:10:33 +02:00
Andreas Rumpf
ba02bf50b9 CIs: attempt to use csources_v1 (#16282)
* CIs: attempt to use csources_v1
* also updated the BSDs
* also updated azure pipelines
* std modules should not itself use the 'std/' import dir...
* compiler has to be careful with std/ for v1 booting

(cherry picked from commit a9b62de895)
2021-04-28 08:50:39 +02:00
Danil Yarantsev
7f834c69fb Free the certificate after checking in checkCertName (#17558) [backport:1.2]
* Fix small leak in checkCertName
* Size is not needed either
* Free the certificate after checking

(cherry picked from commit b36182b0a4)
2021-03-29 15:34:11 +02:00
Igor Ribeiro de Assis
1d301e354f Fix FutureStream memory usage (#17395) [backport:1.2]
(cherry picked from commit 9bb0e55749)
2021-03-18 17:46:59 +01:00
xioren
a7570ff0c2 Relocate 4xx/5xx exception in downloadFile (#17332) [backport:1.2]
Move 4xx/5xx exception to before disk i/o. As it stands an empty file is created on http error 4xx/5xx.

(cherry picked from commit 3d198fdcc2)
2021-03-18 17:30:15 +01:00
Andreas Rumpf
2ee078cdf8 fixes yet another SSL problem on Windows [backport:1.2] (#17167)
(cherry picked from commit b48a32053f)
2021-03-18 17:24:37 +01:00
narimiran
ebc114c526 Revert "fix #17118 (#17119) [backport:1.2]"
This reverts commit 2e896e3360.
2021-02-22 13:51:01 +01:00
flywind
2e896e3360 fix #17118 (#17119) [backport:1.2]
* fix js unsigned integer
* Use `std` prefix for standard library modules
* fix #17118

(cherry picked from commit 32bf10126c)
2021-02-22 10:31:14 +01:00
Benoit Favre
a48abc262c Fix bug in removeDotSegments when path ends with dot (#17038) [backport:1.2]
(cherry picked from commit 8f54d3b792)
2021-02-17 18:39:34 +01:00
Andreas Rumpf
2db37e2e0e final SSL changes [backport:1.2] (#16983)
(cherry picked from commit 74d6a4d7f4)
2021-02-09 15:45:05 +01:00
hlaaftana
3fb7979211 fix #16967 [backport:1.2] (#16976)
* fix #16967 [backport:1.2]

* move test to tsugar

(cherry picked from commit 49ee2f7f3b)
2021-02-09 15:41:34 +01:00
Andreas Rumpf
793bd0a977 basic cleanups regarding SSL handling (#16940) [backport:1.0]
* basic cleanups regarding SSL handling
* enabled certificate checking on Windows
* updated the SSL test
* quoting helps

(cherry picked from commit abac35e743)
2021-02-08 17:26:07 +01:00
Araq
6d75a9c996 better documentation
(cherry picked from commit cb19dc53ca)
2020-12-27 15:06:09 +01:00
Tomohiro
6e0c052509 Fix osproc so that it doesn't close pipe/process/thread handles twice (#16385) [backport]
* Add error check to closeHandle and fix closing handle twice in osproc

* Fix compile error on Linux

(cherry picked from commit dcdbae798c)
2020-12-19 14:28:53 +01:00
Andreas Rumpf
c5bf0d6fa9 fixes #16359 [backport] (#16377)
(cherry picked from commit b87bcb6d92)
2020-12-19 14:23:11 +01:00
Timothee Cour
a82cfb2d54 simplify toHex (#15821)
(cherry picked from commit 235e4930ab)
2020-12-07 15:47:36 +01:00
Miran
e3810646eb fix toHex - make it work with int literals (#15770)
(cherry picked from commit c0fdc8b215)
2020-12-07 15:47:26 +01:00
Araq
67bdbb676e fixes 'nim doc'
(cherry picked from commit 19d52033f8)
2020-11-25 15:30:23 +01:00
flywind
93552e2e31 fix rope index (#16100)
* fix rope index

* add testcase

(cherry picked from commit ab2c082cb3)
2020-11-25 13:49:47 +01:00
flywind
252bebd16e fix ropes format errors (#16106) [backport:1.0]
* fix rope index

* add testcase

* fix ropes format

(cherry picked from commit 0c6c4be0e7)
2020-11-25 13:02:02 +01:00
flywind
a27459fc08 fix #9695 asyncmacro: tfuturevar fails when activated [backport: 1.0] (#16090)
* fix asyncmacro

* Apply suggestions from code review

* Update lib/pure/asyncmacro.nim

(cherry picked from commit 6f1a72069a)
2020-11-25 12:59:01 +01:00
Andreas Rumpf
9af27994c9 makes parsesql .gcsafe [backport:1.0] (#16039)
(cherry picked from commit 743f2f5faa)
2020-11-25 12:58:35 +01:00
Andreas Rumpf
71c0b6e76c asynchttpserver cleanups [backport:1.0] (#15966)
* asynchttpserver cleanups [backport:1.0]

(cherry picked from commit 122f22d163)
2020-11-25 12:57:21 +01:00
Araq
b3a12b4e3f attempt to make asynchttpserver better; fixes #15925; [backport:1.0]
(cherry picked from commit 8778d4a6f3)
2020-11-25 12:54:07 +01:00
Christopher Dunn
6c5eaa955d Fix a problem for long symlinks in conda (#15908) [backport]
* d8c80ea69d (diff-e1d8e552330911f9f779f85b6f2c00a15e790dcc3fbb3b28f5da1d660a30c5b8)

(cherry picked from commit c6ceefea6d)
2020-11-25 12:52:10 +01:00
Igor Ribeiro de Assis
4642a3485c Fix crash in parsexml (#15582) (#15583)
Co-authored-by: Igor Ribeiro de Assis <igor.ribeiro_de_assis@zeiss.com>
(cherry picked from commit 42c180c665)
2020-10-15 13:27:46 +02:00
alaviss
825f358c8b terminal: fix fgColor/bgColor commands [backport] (#15554)
Since #8296, fgSetColor is no longer a global. These commands were
probably left out from the change as an oversight, so some tests have
been added to make sure this won't happen again.

(cherry picked from commit d1af9587b8)
2020-10-13 21:21:52 +02:00
Christopher Dunn
17bed3c966 Fix doc for CountTable (#15561) [backport]
(cherry picked from commit f1d81dc6e6)
2020-10-13 08:43:46 +02:00
Christian Ulrich
eb51fa5ead close socket in getPrimaryIPAddr (#15538) [backport]
(cherry picked from commit c7ccbfac39)
2020-10-13 08:43:27 +02:00
Miran
736e1dd0a0 various documentation fixes [backport] (#15422)
(cherry picked from commit eb2a4961c7)
2020-10-06 08:46:54 +02:00
Andreas Rumpf
eefb13d638 better nativestacktrace support; refs #15284; backport [1.2] (#15384)
* nimStackTraceOverride: enable stack traces in exceptions

This is a two-step stack trace collection scheme, because re-raised
exceptions will collect multiple stack traces but use them rarely, when
printing info about an uncaught exception, so it makes sense to only do
the cheap stack unwinding all the time and the relatively expensive
debugging information collection on-demand.

`asyncfutures` implements its own `$` proc for printing
`seq[StackTraceEntry]`, so we have to add the debugging info there, just
like we do for the private `$` proc in `system/excpt`.

* cleaned up PR #15284

Co-authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
(cherry picked from commit 1fae66e4df)
2020-10-06 08:45:13 +02:00
Andreas Rumpf
4827bf5e88 base64: fixes the error message for an invalid base64 input character [backport:1.2]
(cherry picked from commit cbdda631db)
2020-09-21 18:19:04 +02:00
flywind
183f876bd1 remove annoying messages when creating orderedTables (#15309)
* nativesockets docs minor [backport: 1.2]

* remove annoying messages

(cherry picked from commit a41b243fea)
2020-09-21 18:15:54 +02:00
slangmgh
abe72ba1b3 fix #14203 (#14204)
(cherry picked from commit b56432bd8a)
2020-09-11 14:49:21 +02:00
flywind
0845e88110 nativesockets docs minor [backport: 1.2] (#15285)
(cherry picked from commit a81610230d)
2020-09-11 13:58:04 +02:00
flywind
040ac6cd2b more Protocol supports in windows (#15274) [backport:1.2]
(cherry picked from commit e08b802d79)
2020-09-11 13:58:04 +02:00
Miran
b5c90a3431 fix #15257, toHex couldn't handle large uint64 (#15261) [backport:1.2]
(cherry picked from commit 4fb17bc03b)
2020-09-11 13:58:04 +02:00
Araq
4e428c5a18 fixes #15207 [backport:1.2]
(cherry picked from commit 40969296e9)
2020-09-11 13:58:04 +02:00
Miran
dc3f74f1c2 [backport] fix #15064, strscans.scanf edge case for '$+' (#15223)
(cherry picked from commit 15ff89cec1)
2020-09-11 13:58:04 +02:00
alaviss
98e73512d1 asyncnet: don't try to close the socket again [backport] (#15174)
The closed flag isn't a good design by any means, but let's have this
working first before I get rid of the flag and potentially create a
non-backportable commit.

(cherry picked from commit 957bf15a08)
2020-09-11 13:58:04 +02:00
Andreas Rumpf
67d729aa2e fixes a collect() bug reported on the forum (#15156) [backport:1.2]
(cherry picked from commit 64aec6eb85)
2020-09-11 13:58:04 +02:00
c-blake
bf320ed172 Attempt to explain better why delImplIdx is the way it is. Maybe this can (#15108)
avoid future implementation mischief.  (Maybe not.  Sometimes, general
distrust of theory leads people to distrust simple reasoning over times
from CPUs trying as hard as possible to mask DRAM latency via pre-fetch.)

(cherry picked from commit 196e747df1)
2020-07-29 11:59:40 +02:00
Jjp137
896c3c41d3 parsecsv: fix '\0' being displayed as '0' in docs (#15086) [backport]
(cherry picked from commit a62bc55955)
2020-07-29 10:43:36 +02:00
c-blake
c804e559ad Fulfill https://github.com/nim-lang/Nim/pull/14995#issuecomment-664914391 (#15104)
request.  This can be conceived as an alternate, more capable resolution of
  https://github.com/nim-lang/Nim/issues/12200
than
  https://github.com/nim-lang/Nim/pull/12208

The code re-org idea here is to upgrade tablimpl.nim:`delImpl`/`delImplIdx`
to abstract client code conventions for cell emptiness & cell hashing via
three new template arguments - `makeEmpty`, `cellEmpty`, `cellHash` which
all take a single integer argument and clear a cell, test if clear or
produce the hash of the key stored at that index in `.data[]`.

Then we update the 3 call sites (`Table`, `CountTable`, `SharedTable`) of
`delImpl`/`delImplIdx` by defining define those arguments just before the
first invocation as non-exported templates.

Because `CountTable` does not save hash() outputs as `.hcode`, it needs a
new tableimpl.nim:`delImplNoHCode` which simply in-lines the hash search
when no `.hcode` field is available for "prefix compare" acceleration.
It is conceivable this new template could be used by future variants, such
as one optimized for integer keys where `hash()` and `==` are fast and
`.hcode` is both wasted space & time (though a small change to interfaces
there for a sentinel key meaning "empty" is needed for maximum efficiency).

We also eliminate the old O(n) `proc remove(CountTable...)` in favor of
simply invoking the new `delImpl*` templates and take care to correctly
handle the case where `val` is either zero for non-existent keys in `inc`
or evolves to zero over time in `[]=` or `inc`.

The only user-visible changes from the +-42 delta here are speed, iteration
order post deletes, and relaxing the `Positive` constraint on `val` in
`proc inc` again, as indicated in the `changelog.md` entry.

(cherry picked from commit b2a1944587)
2020-07-29 09:54:39 +02:00
Andreas Rumpf
d0a2857675 enforce browsers.nim only handles URLs [backport] (#15045)
(cherry picked from commit 925dd92e07)
2020-07-23 11:52:15 +02:00