* Implement dial, support IPv6 in httpclient
Added ``dial`` procedure to networking modules: ``net``, ``asyncdispatch``,
``asyncnet``. It merges socket creation, address resolution, and connection
into single step. When using ``dial``, you don't have to worry about
IPv4 vs IPv6 problem.
Fixed addrInfo loop in connect to behave properly.
Previously it would stop on first non-immediate failure, instead of
continuing and trying the remaining addresses.
Fixed newAsyncNativeSocket to raise proper error if socket creation
fails.
Fixes: #3811
* Check domain during connect() only on non-Windows
This is how it was in the previous implementation of connect().
* Call 'osLastError' before 'close' in net.dial
* Record osLastError before freeAddrInfo in net.dial
* Add missing docs for 'dial' proc
* Optimize dial to create one FD per domain, add tests
And make async IPv6 servers work on Windows.
* Add IPv6 test to uri module
* Fix getAddrString error handling
* Fix 2 problems. First, 0 is a valid fd on Unix (easily gotten if user first
closes all fds and then starts using memfiles). Use -1 instead for an invalid
fd. Second, it is best practice to conserve open fds on Unix and file handles
on Windows. These handles are not needed unless the user wants to remap the
memory with ``mapMem`` (or a hypothetical future ``proc resize``). Adding a
new bool param ``allowRemap=false`` to ``memfiles.open`` solves this cleanly
in a "mostly" backward compatible way. This is only "mostly" because the
default ``false`` case does not keep unneeded resources allocated, but that
most sensible default means that any ``mapMem`` callers need to fix all their
open calls to have allowRemap=true, as this PR also does for tmemfiles2.nim.
* Include backwards compatibility note.
* add 'last' argument to 'find' procs in strutils
* add 'rfind' proc for looking up set[char] in strutils
* use optimised C function 'memchr' when available