gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] branch master updated (b7ee06519 -> 4bdd2f26c)


From: gnunet
Subject: [GNUnet-SVN] [gnurl] branch master updated (b7ee06519 -> 4bdd2f26c)
Date: Fri, 30 Mar 2018 16:47:34 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a change to branch master
in repository gnurl.

    from b7ee06519 README: point out obvious configure
     new fdaa8257a Fix small typo.
     new 494f02e08 Fixes for MSDOS etc.
     new 02b728068 progress-bar: don't use stderr explicitly, use bar->out
     new fd9f20737 TODO: CURL_REFUSE_CLEARTEXT
     new 03ae81097 TODO: hardcode the "localhost" addresses
     new 4c46dfc39 cookies: remove verbose "cookie size:" output
     new e25025b9f bump: towards 7.58.1
     new e178fbd40 SChannel/WinSSL: Implement public key pinning
     new 1c0051949 SChannel/WinSSL: Replace Curl_none_md5sum with 
Curl_schannel_md5sum
     new 1433e4645 openssl: fix pinned public key build error in FIPS mode
     new 1c39128d9 parsedate: fix date parsing for systems with 32 bit long
     new 9a230ba41 configure: fix the check for unsigned time_t
     new f8475c694 darwinssl: Don't import client certificates into Keychain on 
macOS
     new 5c497343d GSKit: restore pinnedpubkey functionality
     new d3db7bc72 lib544: sync ascii code data with textual data
     new a6b611f0d lib517: make variable static to avoid compiler warning
     new bd5b9e50c lib555: drop text conversion and encode data as ascii codes
     new 4021bac4c docs: fix typos in man pages
     new d76709080 KNOWN_BUGS: DICT responses show the underlying protocol
     new 094647fca TODO: UTF-8 filenames in Content-Disposition
     new 1c9207491 RELEASE-NOTES: synced with 094647fca
     new 93836e2ba build: open VC15 projects with VS 2017
     new 4272a0b0f curl_ctype: private is*() type macros and functions
     new b7db28426 configure: set PATH_SEPARATOR to colon for PATH w/o separator
     new fecec1d8a curl: add --proxy-pinnedpubkey
     new a406e86ec winbuild: make linker generate proper PDB
     new 9caa3e248 curl_easy_reset: clear digest auth state
     new 8f69a9f28 time: support > year 2038 time stamps for system with 32bit 
long
     new 811beab9f curl/curl.h: fix comment typo for CURLOPT_DNS_LOCAL_IP6
     new 3a048fa0c curlver: next release will be 7.59.0
     new f02c34476 RELEASE-NOTES: synced with 811beab9f
     new e04417d98 Curl_range: commonize FTP and FILE range handling
     new 3f8a72761 Curl_range: add check to ensure "from <= to"
     new 811d96e9e file: Check the return code from Curl_range and bail out on 
error
     new 0630bb21b http2: set DEBUG_HTTP2 to enable more HTTP/2 logging
     new 34ecdffe9 progress-bar.d: update to match implementation
     new 2b50e5634 build: fix windows build methods for curl_ctype.c
     new 19abad095 fnmatch: do not match the empty string with a character set
     new fcaa1826b fnmatch: accept an alphanum to be followed by a non-alphanum 
in char set
     new da5f4b1d8 fnmatch: pattern syntax can no longer fail
     new fcb9b63ee parsedate: s/#if/#ifdef
     new 9409d0c26 curl_setup: move the precautionary define of SIZEOF_TIME_T
     new ddd31dc5d time_t-fixes: remove typecasts to 'long' for info.filetime
     new 1eb4f5ac9 build: fix termios issue on android cross-compile
     new a19afaccf getdate: return -1 for out of range
     new 84ad1fd30 formdata: use the mime-content type function
     new d25b05037 time-cond: fix reading the file modification time on Windows
     new be033641c build-openssl.bat: Extend VC15 support to include Enterprise 
and Professional
     new 05484d483 build-wolfssl.bat: Extend VC15 support to include Enterprise 
and Professional
     new dc8543773 openssl: Don't add verify locations when verifypeer==0
     new ff0708958 build-openssl.bat/build-wolfssl.bat: Build platform is 
optional
     new a0984eae1 fnmatch: optimize processing of consecutive *s and ?s 
pattern characters
     new 0fd6221f8 curl_addrinfo.c: Allow Unix Domain Sockets to compile under 
Windows
     new a64b002e3 schannel: fix compiler warnings
     new 648679ab8 build-openssl.bat: Fixed incorrect move if destination build 
folder exists
     new daf959f69 build-openssl.bat: Follow up to 648679ab8e to suppress 
copy/move output
     new f886cbfe9 content_encoding: Add "none" alias to "identity"
     new 1c680e35a schannel: fix "no previous prototype" compiler warning
     new 23722c515 get_posix_time: only check for overflows if they can happen!
     new 155ea8818 http_chunks: don't write chunks twice with 
CURLOPT_HTTP_TRANSFER_DECODING on
     new b9e323334 README: language fix
     new 50c0033a6 sha256: build with OpenSSL < 0.9.8 too
     new 3f6051f4e sha256: avoid redefine
     new 62cf2d180 smtp: fix processing of initial dot in data
     new 08029a7e7 tlsauthtype.d: works only if libcurl is built with TLS-SRP 
support
     new e551910f8 tests: new tests for http raw mode
     new 851851fa9 RELEASE-NOTES: synced with e551910f8
     new 390184205 libcurl-security.3: split out from libcurl-tutorial.3
     new 03b7b2e8f libcurl-security.3: mention the URL standards problems too
     new 1e720400a libcurl-security.3: the http://192.168.0.1/my_router_config 
case
     new 63f6b3b22 libcurl-security.3: separate file:// section
     new 40e22e5c0 curl_gssapi: make sure this file too uses our *printf()
     new 43a50a258 BINDINGS: fix curb link (and remove ruby-curl-multi)
     new b46cfbc06 TODO fixed: Detect when called from within callbacks
     new 1605d93a7 nss: use PK11_CreateManagedGenericObject() if available
     new de9fac00c KNOWN_BUGS: 2.5 curl should not offer "ALPN: h2" when using 
https-proxy
     new ccd1ec7aa TODO: 18.18 retry on network is unreachable
     new bb5017704 travis: add build with iconv enabled
     new c78675a43 non-ascii: fix implicit declaration warning
     new 16d1f3694 Revert "KNOWN_BUGS: 2.5 curl should not offer "ALPN: h2" 
when using https-proxy"
     new 797b21068 ssh: add two missing state names
     new 74b1f89b1 TODO: 1.7 Support HTTP/2 for HTTP(S) proxies
     new f549b2cef TODO: 1.1 Option to refuse usernames in URLs
     new d93922681 CURLOPT_HEADERFUNCTION.3: mention folded headers
     new 5a44c9fa8 CURLOPT_HEADERFUNCTION.3: fix typo from d939226813
     new 03370fa5a http: fix the max header length detection logic
     new 5e17a5f6c test1154: verify that long HTTP headers get rejected
     new 367689d8c header callback: don't chop headers into smaller pieces
     new 70cbb9213 test1556: verify >16KB headers to the header callback
     new 174212972 CURLOPT_HEADER.3: clarify problems with different data sizes
     new a3e52a7b2 TODO: "Support in-memory certs/ca certs/keys"
     new f8e8028b0 curl --version: show PSL if the run-time lib has it enabled
     new e77f0e5a5 examples/sftpuploadresume: resume upload via CURLOPT_APPEND
     new 50d1b3379 CURLOPT_RESOLVE: Add support for multiple IP addresses per 
entry
     new 9b4c2165f TODO: warning if curl version is not in sync with libcurl 
version
     new 73050fb6a hostip: fix 'potentially uninitialized variable' warning
     new 2427d94c6 url: Add option CURLOPT_HAPPY_EYEBALLS_TIMEOUT
     new 7b71b5150 RELEASE-NOTES: synced with 2427d94c6
     new de97b5fce sasl: prefer PLAIN mechanism over LOGIN
     new dd027c80f lib: CURLOPT_HAPPY_EYEBALLS_TIMEOUT => 
CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS
     new 23713645d url: Add option CURLOPT_RESOLVER_START_FUNCTION
     new 93e7a6ffd form.d: rephrased somewhat, added two example command lines
     new a91a235d4 os400: add curl_resolver_start_callback type to ILE/RPG 
binding
     new 4fff37b91 winbuild: Use CALL to run batch scripts
     new 1a99ecdf5 curl_share_setopt.3: connection cache is shared within multi 
handles
     new 1be96a295 TODO: remove "sha-256 digest", added in 2b5b37cb9109e7c2
     new 5fb70ea17 winbuild: Use macros for the names of some build utilities
     new 06df42410 projects/README: remove reference to dead IDN link/package
     new 7e35eb772 spelling fixes
     new a1d78ffc8 lib655: silence compiler warning
     new 1b27fcfcf curl-openssl.m4: Fix version check for OpenSSL 1.1.1
     new ee8408592 docs/MANUAL: formfind.pl is not accessible on the site 
anymore
     new 828187d86 travis: update compiler versions
     new 24753bcd4 unit1309: fix warning on Windows x64
     new c87c71b3f unit1307: proper cleanup on OOM to fix torture tests
     new 68d84cfe9 curl_ctype: fix macro redefinition warnings
     new 8b0b1a308 build: get CFLAGS (including -werror) used for examples and 
tests
     new b7f90470b NO_PROXY: fix for IPv6 numericals in the URL
     new 4d0b1e688 CURLOPT_NOPROXY.3: mention how to list numerical IPv6 
addresses
     new c74521628 curl.1: mention how to add numerical IP addresses in NO_PROXY
     new 612bc926f krb5: use nondeprecated functions
     new cc1d4c505 winbuild: prefer documented zlib library names
     new cb281f9df RELEASE-NOTES/THANKS: synced with cc1d4c505
     new 613ccbf26 WolfSSL: adding TLSv1.3
     new b2afc36da THANKS + mailmap: remove duplicates, fixup full names
     new 82f050809 curl tool: accept --compressed also if Brotli is enabled and 
zlib is not.
     new 8b754c430 SECURITY: distros' max embargo time is 14 days now
     new 019aa722a http2: verbose output new MAX_CONCURRENT_STREAMS values
     new 8123560d4 HTTP: allow "header;" to replace an internal header with a 
blank one
     new a577059f9 hostip: fix compiler warning: 'variable set but not used'
     new 7294e7048 Curl_range: fix FTP-only and FILE-only builds
     new 9c05701be SECURITY.md: call it the security process
     new 029ae1103 docs/SECURITY.md -> docs/SECURITY-PROCESS.md
     new 72a0f6251 limit-rate: kick in even before "limit" data has been 
received
     new ddb879c6a BUGS: updated link to security process
     new d52dc4760 readwrite: make sure excess reads don't go beyond buffer end
     new 535432c0a FTP: reject path components with control codes
     new 9889db043 openldap: check ldap_get_attribute_ber() results for NULL 
before using
     new 1f8e81391 openldap: white space changes, fixed up the copyright years
     new 7fe68c39b credits: Viktor prefers without accent
     new 8b498a875 http2: mark the connection for close on GOAWAY
     new 62a71af6d FAQ: fix a broken URL [ci skip]
     new 05826081e curl-openssl.m4: fix spelling [ci skip]
     new cd3903127 checksrc.pl: add -i and -m options
     new 981e8f9b8 limit-rate: fix compiler warning
     new 98eee3396 Revert "hostip: fix compiler warning: 'variable set but not 
used'"
     new d974b39a9 CURLOPT_COOKIEFILE.3: "-" as file name means stdin
     new 4a9f14d92 tests/.../spnego.py: fix identifier typo
     new 4d6bd91ab release: 7.59.0
     new 4bdd2f26c Merge tag 'curl-7_59_0' of https://github.com/curl/curl

The 150 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .mailmap                                           |   7 +-
 .travis-iconv-env.sh                               |   1 +
 .travis.yml                                        |  30 +-
 CMake/Utilities.cmake                              |   2 +-
 README                                             |   2 +
 README.md                                          |   2 +-
 RELEASE-NOTES                                      | 316 ++++++++++---------
 configure.ac                                       |  19 +-
 docs/BINDINGS.md                                   |   4 +-
 docs/BUGS                                          |   2 +-
 docs/FAQ                                           |   6 +-
 docs/KNOWN_BUGS                                    |  11 +
 docs/MAIL-ETIQUETTE                                |   2 +-
 docs/MANUAL                                        |   3 +-
 docs/Makefile.am                                   |   4 +-
 docs/{SECURITY.md => SECURITY-PROCESS.md}          |  10 +-
 docs/THANKS                                        |  24 +-
 docs/THANKS-filter                                 |   3 +-
 docs/TODO                                          | 108 +++++--
 docs/cmdline-opts/Makefile.inc                     |   6 +-
 docs/cmdline-opts/form.d                           |  42 ++-
 docs/cmdline-opts/happy-eyeballs-timeout-ms.d      |  17 ++
 docs/cmdline-opts/page-footer                      |   9 +-
 docs/cmdline-opts/progress-bar.d                   |   5 +-
 .../{pinnedpubkey.d => proxy-pinnedpubkey.d}       |  17 +-
 docs/cmdline-opts/resolve.d                        |   4 +-
 docs/cmdline-opts/tlsauthtype.d                    |   4 +-
 docs/examples/Makefile.am                          |   5 +-
 docs/examples/Makefile.inc                         |   4 +-
 docs/examples/ftpupload.c                          |   2 +-
 docs/examples/sftpuploadresume.c                   | 130 ++++++++
 docs/libcurl/Makefile.inc                          |   3 +-
 docs/libcurl/gnurl_easy_getinfo.3                  |   7 +-
 docs/libcurl/gnurl_easy_setopt.3                   |  10 +-
 docs/libcurl/gnurl_getdate.3                       |  16 +-
 docs/libcurl/gnurl_global_init.3                   |   2 +-
 docs/libcurl/gnurl_share_setopt.3                  |   9 +-
 docs/libcurl/libgnurl-env.3                        |   4 +-
 docs/libcurl/libgnurl-errors.3                     |   4 +
 docs/libcurl/libgnurl-security.3                   | 338 +++++++++++++++++++++
 docs/libcurl/libgnurl-tutorial.3                   | 233 +-------------
 ...{GNURLINFO_FILETIME.3 => CURLINFO_FILETIME_T.3} |  35 ++-
 ...UT_MS.3 => CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3} |  45 ++-
 ...LOPT_STDERR.3 => CURLOPT_RESOLVER_START_DATA.3} |  37 ++-
 .../libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3 |  83 +++++
 ...RLOPT_TIMEVALUE.3 => CURLOPT_TIMEVALUE_LARGE.3} |  25 +-
 docs/libcurl/opts/GNURLINFO_CONDITION_UNMET.3      |   2 +-
 docs/libcurl/opts/GNURLINFO_FILETIME.3             |  11 +-
 docs/libcurl/opts/GNURLOPT_COOKIEFILE.3            |   5 +-
 docs/libcurl/opts/GNURLOPT_HEADER.3                |  18 +-
 docs/libcurl/opts/GNURLOPT_HEADERFUNCTION.3        |   7 +-
 docs/libcurl/opts/GNURLOPT_NOPROXY.3               |   7 +-
 docs/libcurl/opts/GNURLOPT_PINNEDPUBLICKEY.3       |  10 +-
 docs/libcurl/opts/GNURLOPT_RESOLVE.3               |  12 +-
 docs/libcurl/opts/GNURLOPT_TIMEVALUE.3             |   5 +-
 docs/libcurl/opts/Makefile.inc                     |   5 +
 docs/libcurl/symbols-in-versions                   |   8 +
 include/gnurl/curl.h                               |  29 +-
 include/gnurl/curlver.h                            |  10 +-
 include/gnurl/multi.h                              |   6 +-
 include/gnurl/typecheck-gcc.h                      |  13 +
 lib/Makefile.inc                                   |   8 +-
 lib/checksrc.pl                                    |  34 ++-
 lib/config-win32.h                                 |   7 +-
 lib/connect.c                                      |  35 ++-
 lib/connect.h                                      |   7 +-
 lib/content_encoding.c                             |   2 +-
 lib/cookie.c                                       |   5 +-
 lib/curl_addrinfo.c                                |   6 +-
 lib/curl_ctype.c                                   | 122 ++++++++
 lib/curl_ctype.h                                   |  48 +++
 lib/curl_fnmatch.c                                 | 327 ++++++++------------
 lib/curl_gssapi.c                                  |   7 +-
 lib/curl_ntlm_wb.c                                 |   2 +-
 lib/curl_range.c                                   |  95 ++++++
 lib/{vtls/gtls.h => curl_range.h}                  |  14 +-
 lib/curl_sasl.c                                    |  20 +-
 lib/curl_setup.h                                   |  32 +-
 lib/curl_setup_once.h                              |  23 +-
 lib/easy.c                                         |  21 +-
 lib/file.c                                         |  70 +----
 lib/formdata.c                                     |  64 +---
 lib/ftp.c                                          |  97 ++----
 lib/ftplistparser.c                                |   3 +
 lib/getinfo.c                                      |  12 +-
 lib/hostip.c                                       | 128 ++++++--
 lib/http.c                                         | 159 +++++-----
 lib/http.h                                         |   5 +-
 lib/http2.c                                        | 164 +++++-----
 lib/http_chunks.c                                  |  25 +-
 lib/http_proxy.c                                   |   8 +-
 lib/krb5.c                                         |   6 +-
 lib/mime.c                                         |  13 +-
 lib/mime.h                                         |   5 +
 lib/mk-ca-bundle.vbs                               |   2 +-
 lib/multi.c                                        |  74 ++++-
 lib/multihandle.h                                  |   1 +
 lib/multiif.h                                      |   2 +
 lib/non-ascii.c                                    |  16 +-
 lib/objnames.inc                                   |   2 +-
 lib/openldap.c                                     |  45 +--
 lib/parsedate.c                                    | 100 +++---
 lib/progress.c                                     |  45 +--
 lib/progress.h                                     |  12 +-
 lib/rtsp.c                                         |  30 +-
 lib/sendf.c                                        |  65 ++--
 lib/sendf.h                                        |   4 +-
 lib/setopt.c                                       |  33 ++
 lib/sha256.c                                       |  12 +-
 lib/smb.c                                          |  15 +-
 lib/smtp.c                                         |   5 +
 lib/ssh-libssh.c                                   |   8 +-
 lib/ssh.c                                          |  22 +-
 lib/strerror.c                                     |   6 +
 lib/telnet.c                                       |   3 +-
 lib/transfer.c                                     |  22 +-
 lib/transfer.h                                     |   3 +-
 lib/url.c                                          |  13 +-
 lib/urldata.h                                      |  13 +-
 lib/vtls/cyassl.c                                  |  12 +-
 lib/vtls/darwinssl.c                               |  73 ++++-
 lib/vtls/gskit.c                                   |   2 +-
 lib/vtls/gtls.c                                    |  15 +-
 lib/vtls/nss.c                                     |  12 +-
 lib/vtls/openssl.c                                 |  57 ++--
 lib/vtls/schannel.c                                | 157 +++++++++-
 lib/warnless.h                                     |   5 +
 m4/curl-openssl.m4                                 |  13 +-
 m4/zz40-xc-ovr.m4                                  |  12 +-
 packages/OS400/README.OS400                        |   6 +-
 packages/OS400/curl.inc.in                         |  11 +
 packages/Symbian/group/libcurl.mmp                 |   4 +-
 packages/vms/config_h.com                          |   2 +-
 projects/README                                    |  11 +-
 projects/Windows/VC15/curl-all.sln                 |   2 +-
 projects/Windows/VC15/lib/libcurl.sln              |   2 +-
 projects/Windows/VC15/src/curl.sln                 |   2 +-
 projects/build-openssl.bat                         | 114 +++++--
 projects/build-wolfssl.bat                         |  38 ++-
 projects/generate.bat                              |   2 +
 src/Makefile.inc                                   |   8 +-
 src/Makefile.netware                               |   6 +-
 src/tool_cb_prg.c                                  |   8 +-
 src/tool_cfgable.c                                 |   4 +-
 src/tool_cfgable.h                                 |   7 +-
 src/tool_dirhie.c                                  |   8 +-
 src/tool_filetime.c                                | 154 ++++++++++
 lib/setopt.h => src/tool_filetime.h                |  21 +-
 src/tool_getparam.c                                |  34 ++-
 src/tool_help.c                                    |  12 +-
 src/tool_operate.c                                 | 100 +-----
 tests/data/Makefile.inc                            |  22 +-
 tests/data/{test553 => test1154}                   |  56 ++--
 tests/data/{test1122 => test1170}                  |   6 +-
 tests/data/{test1122 => test1171}                  |   6 +-
 tests/data/{test1255 => test1265}                  |  12 +-
 tests/data/{test5 => test1292}                     |  14 +-
 tests/data/test1538                                |   6 +-
 tests/data/{test1513 => test1555}                  |  11 +-
 tests/data/{test553 => test1556}                   |  58 ++--
 tests/data/{test1303 => test1607}                  |   6 +-
 tests/data/{test220 => test319}                    |  34 +--
 tests/data/test326                                 |  66 ++++
 tests/data/{test111 => test340}                    |  25 +-
 tests/data/test517                                 |  90 ------
 tests/data/test555                                 |   4 -
 tests/data/{test512 => test655}                    |  27 +-
 tests/data/test911                                 |   1 -
 tests/data/{test900 => test951}                    |  18 +-
 tests/data/{test911 => test952}                    |  16 +-
 tests/ftpserver.pl                                 |   8 +-
 tests/libtest/Makefile.am                          |   4 +-
 tests/libtest/Makefile.inc                         |  15 +-
 tests/libtest/{lib1513.c => lib1555.c}             |  27 +-
 tests/libtest/{lib564.c => lib1556.c}              |  79 ++---
 tests/libtest/lib517.c                             | 228 +++++++-------
 tests/libtest/lib544.c                             |  11 +-
 tests/libtest/lib555.c                             |  24 +-
 tests/libtest/lib560.c                             |   2 +-
 tests/libtest/lib655.c                             | 112 +++++++
 tests/libtest/mk-lib1521.pl                        |   3 +-
 tests/nroff-scan.pl                                |   4 +-
 tests/pathhelp.pm                                  |   2 +-
 tests/python_dependencies/impacket/spnego.py       |   2 +-
 tests/runtests.pl                                  |   1 +
 tests/server/CMakeLists.txt                        |   2 +-
 tests/server/Makefile.inc                          |   6 +-
 tests/server/sockfilt.c                            |   2 +-
 tests/server/sws.c                                 |   8 +-
 tests/unit/Makefile.am                             |   4 +-
 tests/unit/Makefile.inc                            |   5 +-
 tests/unit/unit1307.c                              |  18 +-
 tests/unit/unit1309.c                              |  14 +-
 tests/unit/unit1607.c                              | 213 +++++++++++++
 winbuild/Makefile.vc                               |   4 +-
 winbuild/MakefileBuild.vc                          |  30 +-
 196 files changed, 3940 insertions(+), 2207 deletions(-)
 create mode 100644 .travis-iconv-env.sh
 rename docs/{SECURITY.md => SECURITY-PROCESS.md} (95%)
 create mode 100644 docs/cmdline-opts/happy-eyeballs-timeout-ms.d
 copy docs/cmdline-opts/{pinnedpubkey.d => proxy-pinnedpubkey.d} (58%)
 create mode 100644 docs/examples/sftpuploadresume.c
 create mode 100644 docs/libcurl/libgnurl-security.3
 copy docs/libcurl/opts/{GNURLINFO_FILETIME.3 => CURLINFO_FILETIME_T.3} (60%)
 copy docs/libcurl/opts/{GNURLOPT_CONNECTTIMEOUT_MS.3 => 
CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3} (52%)
 copy docs/libcurl/opts/{GNURLOPT_STDERR.3 => CURLOPT_RESOLVER_START_DATA.3} 
(57%)
 create mode 100644 docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3
 copy docs/libcurl/opts/{GNURLOPT_TIMEVALUE.3 => CURLOPT_TIMEVALUE_LARGE.3} 
(65%)
 create mode 100644 lib/curl_ctype.c
 create mode 100644 lib/curl_ctype.h
 create mode 100644 lib/curl_range.c
 copy lib/{vtls/gtls.h => curl_range.h} (80%)
 create mode 100644 src/tool_filetime.c
 copy lib/setopt.h => src/tool_filetime.h (64%)
 copy tests/data/{test553 => test1154} (78%)
 copy tests/data/{test1122 => test1170} (89%)
 copy tests/data/{test1122 => test1171} (89%)
 copy tests/data/{test1255 => test1265} (71%)
 copy tests/data/{test5 => test1292} (68%)
 copy tests/data/{test1513 => test1555} (76%)
 copy tests/data/{test553 => test1556} (80%)
 copy tests/data/{test1303 => test1607} (79%)
 copy tests/data/{test220 => test319} (51%)
 create mode 100644 tests/data/test326
 copy tests/data/{test111 => test340} (69%)
 copy tests/data/{test512 => test655} (62%)
 copy tests/data/{test900 => test951} (67%)
 copy tests/data/{test911 => test952} (74%)
 copy tests/libtest/{lib1513.c => lib1555.c} (74%)
 copy tests/libtest/{lib564.c => lib1556.c} (57%)
 create mode 100644 tests/libtest/lib655.c
 create mode 100644 tests/unit/unit1607.c

diff --git a/.mailmap b/.mailmap
index c296aa04a..0e173c059 100644
--- a/.mailmap
+++ b/.mailmap
@@ -5,7 +5,7 @@ Alessandro Ghedini <address@hidden> <address@hidden>
 Alessandro Ghedini <address@hidden> <address@hidden>
 Björn Stenberg <address@hidden>
 Björn Stenberg <address@hidden> <address@hidden>
-Viktor Szakáts <address@hidden>
+Viktor Szakats <address@hidden>
 Daniel Gustafsson <address@hidden> <address@hidden>
 Daniel Gustafsson <address@hidden> <address@hidden>
 Linus Nielsen <address@hidden>
@@ -35,3 +35,8 @@ Jason Juang <address@hidden>
 Carlo Teubner <address@hidden>
 Joel Depooter <address@hidden>
 Sebastian Mundry <address@hidden>
+Rainer Canavan <address@hidden> <address@hidden>
+Dan Fandrich <address@hidden>
+Henrik S. Gaßmann <address@hidden>
+Jiří Malák <address@hidden>
+Nick Zitzmann <address@hidden>
diff --git a/.travis-iconv-env.sh b/.travis-iconv-env.sh
new file mode 100644
index 000000000..bb7dcf422
--- /dev/null
+++ b/.travis-iconv-env.sh
@@ -0,0 +1 @@
+export CPPFLAGS="-DCURL_DOES_CONVERSIONS -DHAVE_ICONV 
-DCURL_ICONV_CODESET_OF_HOST='\"ISO8859-1\"'"
diff --git a/.travis.yml b/.travis.yml
index d2924556a..373db6925 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,17 +4,17 @@ addons:
     apt:
         sources:
             - ubuntu-toolchain-r-test
-            - llvm-toolchain-precise-3.7
+            - llvm-toolchain-precise-3.9
         packages:
             - cmake
-            - gcc-4.8
+            - gcc-6
             - lcov
-            - clang-3.7
+            - clang-3.9
             - valgrind
             - libev-dev
             - libc-ares-dev
-            - g++-4.8
-            - libstdc++-4.8-dev
+            - g++-6
+            - libstdc++-6-dev
             - stunnel4
             - libidn2-0-dev
             - libssh2-1-dev
@@ -51,6 +51,10 @@ matrix:
           compiler: clang
           dist: trusty
           env: T=debug
+        - os: linux
+          compiler: gcc
+          dist: trusty
+          env: T=iconv
         - os: osx
           compiler: gcc
           env: T=debug
@@ -98,7 +102,7 @@ install:
   - if [ $TRAVIS_OS_NAME = linux ]; then
       curl -L 
https://github.com/nghttp2/nghttp2/releases/download/v1.24.0/nghttp2-1.24.0.tar.gz
 |
          tar xzf - &&
-         (cd nghttp2-1.24.0 && CXX="g++-4.8" ./configure --prefix=/usr 
--disable-threads --enable-app && make && sudo make install);
+         (cd nghttp2-1.24.0 && CXX="g++-6" ./configure --prefix=/usr 
--disable-threads --enable-app && make && sudo make install);
     fi
 
 before_script:
@@ -139,15 +143,15 @@ script:
         # Uncomment this when `coverage` runs on Trusty.
         # set -eo pipefail
         if [ "$T" = "coverage" ]; then
-             export CC="gcc-4.8"
+             export CC="gcc-6"
              ./configure --enable-debug --disable-shared --enable-code-coverage
              make
              make TFLAGS=-n test-nonflaky
              tests="1 2 3 4 5 6 7 8 9 10 200 201 202 300 301 302 500 501 502 
503 504 506 507 508 509 510 511 512 513 514 515 516 517 518 519 600 601 800 801 
802 803 900 901 902 903 1000 1001 1002 1004 1302 1303 1304 1305 1306 1308 1400 
1401 1402 1404 1450 1451 1452 1502 1507 1508 1600 1602 1603 1605"
              make "TFLAGS=-n -e $tests" test-nonflaky
              make "TFLAGS=-n -t $tests" test-nonflaky
-             coveralls --gcov /usr/bin/gcov-4.8 --gcov-options '\-lp' -i src 
-e lib -e tests -e docs -b $PWD/src
-             coveralls --gcov /usr/bin/gcov-4.8 --gcov-options '\-lp' -e src 
-i lib -e tests -e docs -b $PWD/lib
+             coveralls --gcov /usr/bin/gcov-6 --gcov-options '\-lp' -i src -e 
lib -e tests -e docs -b $PWD/src
+             coveralls --gcov /usr/bin/gcov-6 --gcov-options '\-lp' -e src -i 
lib -e tests -e docs -b $PWD/lib
         fi
     - |
         set -eo pipefail
@@ -172,6 +176,14 @@ script:
         fi
     - |
         set -eo pipefail
+        if [ "$T" = "iconv" ]; then
+             source .travis-iconv-env.sh
+             ./configure --enable-debug --enable-werror $C
+             make && make examples
+             make TFLAGS=-n test-nonflaky
+        fi
+    - |
+        set -eo pipefail
         if [ "$T" = "cmake" ]; then
              mkdir build
              cd build
diff --git a/CMake/Utilities.cmake b/CMake/Utilities.cmake
index 8b6276df6..005b166ff 100644
--- a/CMake/Utilities.cmake
+++ b/CMake/Utilities.cmake
@@ -19,7 +19,7 @@ function(LIST_SPACES_APPEND_ONCE LIST_NAME)
   set(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE)
 endfunction()
 
-# Convinience function that does the same as LIST(FIND ...) but with a 
TRUE/FALSE return value.
+# Convenience function that does the same as LIST(FIND ...) but with a 
TRUE/FALSE return value.
 # Ex: IN_STR_LIST(MY_LIST "Searched item" WAS_FOUND)
 function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL)
   list(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS)
diff --git a/README b/README
index 8ebadeecd..ba216c0f1 100644
--- a/README
+++ b/README
@@ -14,6 +14,8 @@ Changes to the code:
 * renamed files to ensure a system-wide installation of
   libgnurl does not result in namespace collisions with libcurl
 * adjustments to the testsuite to address the gnurl specific build
+* Changes to be written:
+  * Replace the release process with more automatization
 
 Usage notes:
 * exported symbols were NOT renamed, so they still all have the
diff --git a/README.md b/README.md
index a5992098f..552cb5ffd 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ downloads.
 
 ## Git
 
-To download the very latest source off the Git server do this:
+To download the very latest source from the Git server do this:
 
     git clone https://github.com/curl/curl.git
 
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index eefd0c356..6cbfe48e6 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,100 +1,100 @@
-Curl and libcurl 7.58.0
+Curl and libcurl 7.59.0
 
- Public curl releases:         172
- Command line options:         211
- curl_easy_setopt() options:   249
+ Public curl releases:         173
+ Command line options:         213
+ curl_easy_setopt() options:   253
  Public functions in libcurl:  74
- Contributors:                 1685
+ Contributors:                 1705
 
 This release includes the following changes:
 
- o new libssh-powered SSH SCP/SFTP back-end
- o curl-config: add --ssl-backends [10]
+ o curl: add --proxy-pinnedpubkey [10]
+ o added: CURLOPT_TIMEVALUE_LARGE and CURLINFO_FILETIME_T [13]
+ o CURLOPT_RESOLVE: Add support for multiple IP addresses per entry [37]
+ o Add option CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS [37]
+ o Add new tool option --happy-eyeballs-timeout-ms [37]
+ o Add CURLOPT_RESOLVER_START_FUNCTION and CURLOPT_RESOLVER_START_DATA [39]
 
 This release includes the following bugfixes:
 
- o http2: fix incorrect trailer buffer size [40]
- o http: prevent custom Authorization headers in redirects [55]
- o travis: add boringssl build [1]
- o examples/xmlstream.c: don't switch off CURL_GLOBAL_SSL [2]
- o SSL: Avoid magic allocation of SSL backend specific data [3]
- o lib: don't export all symbols, just everything curl_* [4]
- o libssh2: send the correct CURLE error code on scp file not found
- o libssh2: return CURLE_UPLOAD_FAILED on failure to upload
- o openssl: enable pkcs12 in boringssl builds [5]
- o libssh2: remove dead code from SSH_SFTP_QUOTE [6]
- o sasl_getmesssage: make sure we have a long enough string to pass [7]
- o conncache: fix several lock issues [8]
- o threaded-shared-conn.c: new example
- o conncache: only allow multiplexing within same multi handle [9]
- o configure: check for netinet/in6.h [11]
- o URL: tolerate backslash after drive letter for FILE: [12]
- o openldap: add commented out debug possibilities [13]
- o include: get netinet/in.h before linux/tcp.h [14]
- o CONNECT: keep close connection flag in http_connect_state struct [15]
- o BINDINGS: another PostgreSQL client
- o curl: limit -# update frequency for unknown total size [16]
- o configure: add AX_CODE_COVERAGE only if using gcc [17]
- o curl.h: remove incorrect comment about ERRORBUFFER
- o openssl: improve data-pending check for https proxy [18]
- o curl: remove __EMX__ #ifdefs [19]
- o CURLOPT_PRIVATE.3: fix grammar [20]
- o sftp: allow quoted commands to use relative paths [21]
- o CURLOPT_DNS_CACHE_TIMEOUT.3: see also CURLOPT_RESOLVE
- o RESOLVE: output verbose text when trying to set a duplicate name
- o openssl: Disable file buffering for Win32 SSLKEYLOGFILE [22]
- o multi_done: prune DNS cache [23]
- o tests: update .gitignore for libtests
- o tests: mark data files as non-executable in git
- o CURLOPT_DNS_LOCAL_IP4.3: fixed the "SEE ALSO" to not self-reference
- o curl.1: documented two missing valid exit codes
- o curl.1: mention http:// and https:// as valid proxy prefixes
- o vtls: replaced getenv() with curl_getenv() [24]
- o setopt: less *or equal* than INT_MAX/1000 should be fine [25]
- o examples/smtp-mail.c: use separate defines for options and mail
- o curl: support >256 bytes warning messsages [26]
- o conncache: fix a return code
- o krb5: fix a potential access of uninitialized memory
- o rand: add a clang-analyzer work-around
- o CURLOPT_READFUNCTION.3: refer to argument with correct name [27]
- o brotli: allow compiling with version 0.6.0
- o content_encoding: rework zlib_inflate [28]
- o curl_easy_reset: release mime-related data [29]
- o examples/rtsp: fix error handling macros [30]
- o build-openssl.bat: Added support for VC15
- o build-wolfssl.bat: Added support for VC15
- o build: Added Visual Studio 2017 project files
- o winbuild: Added support for VC15
- o curl: Support size modifiers for --max-filesize [32]
- o examples/cacertinmem: ignore cert-already-exists error [33]
- o brotli: data at the end of content can be lost [34]
- o curl_version_info.3: call the argument 'age' [35]
- o openssl: fix memory leak of SSLKEYLOGFILE filename
- o build: remove HAVE_LIMITS_H check [36]
- o --mail-rcpt: fix short-text description
- o scripts: allow all perl scripts to be run directly [37]
- o progress: calculate transfer speed on milliseconds if possible [38]
- o system.h: check __LONG_MAX__ for defining curl_off_t [31]
- o easy: fix connection ownership in curl_easy_pause [39]
- o setopt: reintroduce non-static Curl_vsetopt() for OS400 support [41]
- o setopt: fix SSLVERSION to allow CURL_SSLVERSION_MAX_ values [42]
- o configure.ac: append extra linker flags instead of prepending them [43]
- o HTTP: bail out on negative Content-Length: values [44]
- o docs: comment about CURLE_READ_ERROR returned by curl_mime_filedata
- o mime: clone mime tree upon easy handle duplication [45]
- o openssl: enable SSLKEYLOGFILE support by default [46]
- o smtp/pop3/imap_get_message: decrease the data length too... [47]
- o CURLOPT_TCP_NODELAY.3: fix typo [48]
- o SMB: fix numeric constant suffix and variable types [49]
- o ftp-wildcard: fix matching an empty string with "*[^a]" [50]
- o curl_fnmatch: only allow 5 '*' sections in a single pattern
- o openssl: fix potential memory leak in SSLKEYLOGFILE logic
- o SSH: Fix state machine for ssh-agent authentication [51]
- o examples/url2file.c: add missing curl_global_cleanup() call [52]
- o http2: don't close connection when single transfer is stopped [53]
- o libcurl-env.3: first version
- o curl: progress bar refresh, get width using ioctl() [54]
- o CONNECT_TO: fail attempt to set an IPv6 numerical without IPv6 support [56]
+ o openldap: check ldap_get_attribute_ber() results for NULL before using [50]
+ o FTP: reject path components with control codes [51]
+ o readwrite: make sure excess reads don't go beyond buffer end [52]
+ o lib555: drop text conversion and encode data as ascii codes [1]
+ o lib517: make variable static to avoid compiler warning
+ o lib544: sync ascii code data with textual data [1]
+ o GSKit: restore pinnedpubkey functionality [2]
+ o darwinssl: Don't import client certificates into Keychain on macOS [3]
+ o parsedate: fix date parsing for systems with 32 bit long [4]
+ o openssl: fix pinned public key build error in FIPS mode [5]
+ o SChannel/WinSSL: Implement public key pinning [6]
+ o cookies: remove verbose "cookie size:" output
+ o progress-bar: don't use stderr explicitly, use bar->out [7]
+ o Fixes for MSDOS
+ o build: open VC15 projects with VS 2017
+ o curl_ctype: private is*() type macros and functions [8]
+ o configure: set PATH_SEPARATOR to colon for PATH w/o separator [9]
+ o winbuild: make linker generate proper PDB [11]
+ o curl_easy_reset: clear digest auth state [12]
+ o curl/curl.h: fix comment typo for CURLOPT_DNS_LOCAL_IP6 [14]
+ o range: commonize FTP and FILE range handling [15]
+ o progress-bar docs: update to match implementation [16]
+ o fnmatch: do not match the empty string with a character set
+ o fnmatch: accept an alphanum to be followed by a non-alphanum in char set 
[17]
+ o build: fix termios issue on android cross-compile [18]
+ o getdate: return -1 for out of range [19]
+ o formdata: use the mime-content type function [20]
+ o time-cond: fix reading the file modification time on Windows [21]
+ o build-openssl.bat: Extend VC15 support to include Enterprise and 
Professional
+ o build-wolfssl.bat: Extend VC15 support to include Enterprise and 
Professional
+ o openssl: Don't add verify locations when verifypeer==0
+ o fnmatch: optimize processing of consecutive *s and ?s pattern characters 
[22]
+ o schannel: fix compiler warnings [23]
+ o content_encoding: Add "none" alias to "identity" [24]
+ o get_posix_time: only check for overflows if they can happen
+ o http_chunks: don't write chunks twice with CURLOPT_HTTP_TRANSFER_DECODING 
[25]
+ o README: language fix [26]
+ o sha256: build with OpenSSL < 0.9.8 [27]
+ o smtp: fix processing of initial dot in data [28]
+ o --tlsauthtype: works only if libcurl is built with TLS-SRP support [29]
+ o tests: new tests for http raw mode [30]
+ o libcurl-security.3: man page discussion security concerns when using libcurl
+ o curl_gssapi: make sure this file too uses our *printf()
+ o BINDINGS: fix curb link (and remove ruby-curl-multi)
+ o nss: use PK11_CreateManagedGenericObject() if available [31]
+ o travis: add build with iconv enabled [32]
+ o ssh: add two missing state names [33]
+ o CURLOPT_HEADERFUNCTION.3: mention folded headers
+ o http: fix the max header length detection logic [34]
+ o header callback: don't chop headers into smaller pieces [35]
+ o CURLOPT_HEADER.3: clarify problems with different data sizes
+ o curl --version: show PSL if the run-time lib has it enabled
+ o examples/sftpuploadresume: resume upload via CURLOPT_APPEND [36]
+ o Return error if called recursively from within callbacks [38]
+ o sasl: prefer PLAIN mechanism over LOGIN
+ o winbuild: Use CALL to run batch scripts [40]
+ o curl_share_setopt.3: connection cache is shared within multi handles
+ o winbuild: Use macros for the names of some build utilities [41]
+ o projects/README: remove reference to dead IDN link/package [42]
+ o lib655: silence compiler warning [43]
+ o configure: Fix version check for OpenSSL 1.1.1
+ o docs/MANUAL: formfind.pl is not accessible on the site anymore [44]
+ o unit1309: fix warning on Windows x64 [45]
+ o unit1307: proper cleanup on OOM to fix torture tests
+ o curl_ctype: fix macro redefinition warnings
+ o build: get CFLAGS (including -werror) used for examples and tests [46]
+ o NO_PROXY: fix for IPv6 numericals in the URL [47]
+ o krb5: use nondeprecated functions [48]
+ o winbuild: prefer documented zlib library names [49]
+ o http2: mark the connection for close on GOAWAY [53]
+ o limit-rate: kick in even before "limit" data has been received [54]
+ o HTTP: allow "header;" to replace an internal header with a blank one [55]
+ o http2: verbose output new MAX_CONCURRENT_STREAMS values
+ o SECURITY: distros' max embargo time is 14 days
+ o curl tool: accept --compressed also if Brotli is enabled and zlib is not
+ o WolfSSL: adding TLSv1.3 [56]
+ o checksrc.pl: add -i and -m options
+ o CURLOPT_COOKIEFILE.3: "-" as file name means stdin
 
 This release includes the following known bugs:
 
@@ -103,78 +103,76 @@ This release includes the following known bugs:
 This release would not have looked like this without help, code, reports and
 advice from friends like these:
 
-  ahodesuka on github, Andreas Schneider, Basuke Suzuki, Brad Spencer,
-  Chester Liu, cmfrolick on github, Craig de Stigter, Daniel Stenberg,
-  Dan Johnson, David Benjamin, Dima Tisnek, Dimitrios Apostolou,
-  Dmitry Kostjuchenko, Dominik Hölzl, Elliot Saba, Frank Gevaerts, Gisle Vanem,
-  guitared on github, Jan Ehrhardt, Johannes Schindelin, John DeHelian,
-  John Hascall, jonrumsey on github, jungle-boogie on github, Kartik Mahajan,
-  Martin Galvan, Matthew Kerwin, Mattias Fornander, Max Dymond, Michael Felt,
-  Michael Gmelin, Michael Kaufmann, Mikalai Ananenka, Nikos Mavrogiannopoulos,
-  Oleg Pudeyev, Patrick Dawson, Patrick Monnerat, Per Malmberg, Pete Lomax,
-  Rainer Canavan, Randall S. Becker, Ray Satiro, Richard Alcock, Robert Kolcun,
-  Sean MacLennan, Stanislav Zidek, Stepan Broz, Steve Holme,
-  Thomas van Hesteren, Tomas Mraz, W. Mark Kubacki, XhstormR on github,
-  Zachary Seguin, Zhouyihai Ding,
-  (54 contributors)
+  Adam Marcionek, Alessandro Ghedini, Anders Bakken, Aron Bergman, Ben Greear,
+  Björn Stenberg, Bruno Grasselli, Dair Grant, Dan Fandrich, Daniel Stenberg,
+  Dario Weisser, Douglas Mencken, Duy Phan Thanh, Earnestly on github,
+  Erik Johansson, Francisco Sedano, Gisle Vanem, Guido Berhoerster,
+  Henry Roeland, Kamil Dudka, Klaus Stein, Łukasz Domeradzki, Marcel Raad,
+  Martin Dreher, Max Dymond, Michael Kaufmann, Michał Janiszewski,
+  Mohammad AlSaleh, Patrick Monnerat, Patrick Schlangen, Ray Satiro,
+  Richard Alcock, Richard Moore, Rod Widdowson, Ruurd Beerstra,
+  Sergii Kavunenko, Sergio Borghese, Somnath Kundu, steelman on github,
+  Stefan Kanthak, Steve Holme, Tim Mcdonough, Travis Burtrum, Viktor Szakats,
+  刘佩东,
+  (45 contributors)
 
         Thanks! (and sorry if I forgot to mention someone)
 
 References to bug reports and discussions on issues:
 
- [1] = https://curl.haxx.se/bug/?i=2118
- [2] = https://curl.haxx.se/mail/lib-2017-12/0000.html
- [3] = https://curl.haxx.se/bug/?i=2119
- [4] = https://curl.haxx.se/bug/?i=2127
- [5] = https://curl.haxx.se/bug/?i=2134
- [6] = https://curl.haxx.se/bug/?i=2143
- [7] = https://curl.haxx.se/bug/?i=2150
- [8] = https://curl.haxx.se/bug/?i=2132
- [9] = https://curl.haxx.se/bug/?i=2152
- [10] = https://curl.haxx.se/bug/?i=2128
- [11] = https://curl.haxx.se/bug/?i=2146
- [12] = https://curl.haxx.se/bug/?i=2154
- [13] = https://curl.haxx.se/bug/?i=2159
- [14] = https://curl.haxx.se/bug/?i=2160
- [15] = https://curl.haxx.se/bug/?i=2088
- [16] = https://curl.haxx.se/bug/?i=2158
- [17] = https://curl.haxx.se/bug/?i=2076
- [18] = https://curl.haxx.se/bug/?i=1916
- [19] = https://curl.haxx.se/bug/?i=2166
- [20] = https://curl.haxx.se/bug/?i=2168
- [21] = https://curl.haxx.se/bug/?i=1900
- [22] = https://github.com/curl/curl/pull/1346#issuecomment-350530901
- [23] = https://curl.haxx.se/bug/?i=2169
- [24] = https://curl.haxx.se/bug/?i=2171
- [25] = https://curl.haxx.se/bug/?i=2173
- [26] = https://curl.haxx.se/bug/?i=2174
- [27] = https://curl.haxx.se/bug/?i=2175
- [28] = https://curl.haxx.se/bug/?i=2068
- [29] = https://curl.haxx.se/mail/lib-2017-12/0060.html
- [30] = https://curl.haxx.se/bug/?i=2185
- [31] = https://curl.haxx.se/bug/?i=2216
- [32] = https://curl.haxx.se/bug/?i=2179
- [33] = https://curl.haxx.se/mail/lib-2017-12/0057.html
- [34] = https://curl.haxx.se/bug/?i=2194
- [35] = https://curl.haxx.se/mail/lib-2017-12/0074.html
- [36] = https://curl.haxx.se/bug/?i=2215
- [37] = https://curl.haxx.se/bug/?i=2222
- [38] = https://curl.haxx.se/bug/?i=2200
- [39] = https://curl.haxx.se/bug/?i=2217
- [40] = https://curl.haxx.se/docs/adv_2018-824a.html
- [41] = https://curl.haxx.se/bug/?i=2230
- [42] = https://curl.haxx.se/bug/?i=2225
- [43] = https://curl.haxx.se/bug/?i=2234
- [44] = https://curl.haxx.se/bug/?i=2212
- [45] = https://curl.haxx.se/bug/?i=2235
- [46] = https://curl.haxx.se/bug/?i=2210
- [47] = https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5206
- [48] = https://curl.haxx.se/bug/?i=2239
- [49] = https://curl.haxx.se/bug/?i=2211
- [50] = https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5251
- [51] = https://curl.haxx.se/bug/?i=2248
- [52] = https://curl.haxx.se/bug/?i=2245
- [53] = https://curl.haxx.se/bug/?i=2237
- [54] = https://curl.haxx.se/bug/?i=2242
- [55] = https://curl.haxx.se/docs/adv_2018-b3bf.html
- [56] = https://curl.haxx.se/mail/lib-2018-01/0087.html
+ [1] = https://curl.haxx.se/bug/?i=1872
+ [2] = https://curl.haxx.se/bug/?i=2263
+ [3] = https://curl.haxx.se/bug/?i=2085
+ [4] = https://curl.haxx.se/bug/?i=2250
+ [5] = https://curl.haxx.se/bug/?i=2258
+ [6] = https://curl.haxx.se/bug/?i=1429
+ [7] = 
https://github.com/curl/curl/commit/993dd5651a6c853bfe3870f6a69c7b329fa4e8ce#commitcomment-27070080
+ [8] = https://curl.haxx.se/bug/?i=2269
+ [9] = https://curl.haxx.se/bug/?i=2202
+ [10] = https://curl.haxx.se/bug/?i=2268
+ [11] = https://curl.haxx.se/bug/?i=2274
+ [12] = https://curl.haxx.se/mail/lib-2018-01/0074.html
+ [13] = https://curl.haxx.se/bug/?i=2238
+ [14] = https://curl.haxx.se/bug/?i=2275
+ [15] = https://curl.haxx.se/bug/?i=2205
+ [16] = https://curl.haxx.se/bug/?i=2271
+ [17] = https://curl.haxx.se/mail/lib-2018-01/0114.html
+ [18] = https://curl.haxx.se/mail/lib-2018-01/0122.html
+ [19] = https://curl.haxx.se/bug/?i=2278
+ [20] = https://curl.haxx.se/bug/?i=2282
+ [21] = https://curl.haxx.se/bug/?i=2164
+ [22] = https://curl.haxx.se/bug/?i=2291
+ [23] = https://curl.haxx.se/bug/?i=2296
+ [24] = https://curl.haxx.se/bug/?i=2298
+ [25] = https://curl.haxx.se/bug/?i=2303
+ [26] = https://curl.haxx.se/bug/?i=2300
+ [27] = https://curl.haxx.se/bug/?i=2305
+ [28] = https://curl.haxx.se/bug/?i=2304
+ [29] = https://bugzilla.redhat.com/1542256
+ [30] = https://curl.haxx.se/bug/?i=2303
+ [31] = https://bugzilla.redhat.com/1510247
+ [32] = https://curl.haxx.se/bug/?i=1872
+ [33] = https://curl.haxx.se/bug/?i=2312
+ [34] = https://curl.haxx.se/mail/lib-2018-02/0056.html
+ [35] = https://curl.haxx.se/bug/?i=2314
+ [36] = https://curl.haxx.se/mail/lib-2018-02/0072.html
+ [37] = https://curl.haxx.se/bug/?i=2260
+ [38] = https://curl.haxx.se/bug/?i=2302
+ [39] = https://curl.haxx.se/bug/?i=2311
+ [40] = https://curl.haxx.se/bug/?i=2330
+ [41] = https://curl.haxx.se/bug/?i=2329
+ [42] = https://curl.haxx.se/bug/?i=2325
+ [43] = https://curl.haxx.se/bug/?i=2335
+ [44] = https://curl.haxx.se/bug/?i=2342
+ [45] = https://curl.haxx.se/bug/?i=2341
+ [46] = https://curl.haxx.se/bug/?i=2337
+ [47] = https://curl.haxx.se/bug/?i=2353
+ [48] = https://curl.haxx.se/bug/?i=2356
+ [49] = https://curl.haxx.se/bug/?i=2354
+ [50] = https://curl.haxx.se/docs/adv_2018-97a2.html
+ [51] = https://curl.haxx.se/docs/adv_2018-9cd6.html
+ [52] = https://curl.haxx.se/docs/adv_2018-b047.html
+ [53] = https://curl.haxx.se/bug/?i=2365
+ [54] = https://curl.haxx.se/bug/?i=2371
+ [55] = https://curl.haxx.se/bug/?i=2357
+ [56] = https://curl.haxx.se/bug/?i=2349
diff --git a/configure.ac b/configure.ac
index 34777f229..f946bb5b6 100755
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -2803,6 +2803,23 @@ AC_CHECK_TYPE([bool],[
 #endif
 ])
 
+AC_MSG_CHECKING([if time_t is unsigned])
+AC_RUN_IFELSE([
+  AC_LANG_SOURCE([[
+  #include <time.h>
+  #include <limits.h>
+  time_t t = -1;
+  return (t > 0);
+  ]])] ,[
+  AC_MSG_RESULT([yes])
+  AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
+],[
+  AC_MSG_RESULT([no])
+],[
+  dnl cross-compiling, most systems are unsigned
+  AC_MSG_RESULT([no])
+])
+
 CURL_CONFIGURE_CURL_SOCKLEN_T
 
 CURL_CONFIGURE_PULL_SYS_POLL
diff --git a/docs/BINDINGS.md b/docs/BINDINGS.md
index b2d50fb3f..024f169e3 100644
--- a/docs/BINDINGS.md
+++ b/docs/BINDINGS.md
@@ -87,7 +87,7 @@ Bailiff and Bálint Szilakszi,
 
 RPG, support for ILE/RPG on OS/400 is included in source distribution
 
-Ruby: [curb](http://curb.rubyforge.org/) written by Ross Bamford, 
[ruby-curl-multi](http://curl-multi.rubyforge.org/) written by Kristjan 
Petursson and Keith Rarick
+Ruby: [curb](https://github.com/taf2/curb) written by Ross Bamford
 
 [Rust](https://github.com/carllerche/curl-rust) curl-rust - by Carl Lerche
 
@@ -95,7 +95,7 @@ Ruby: [curb](http://curb.rubyforge.org/) written by Ross 
Bamford, [ruby-curl-mul
 
 [Scilab](https://help.scilab.org/docs/current/fr_FR/getURL.html) binding by 
Sylvestre Ledru
 
-[S-Lang](http://www.jedsoft.org/slang/modules/curl.html) by John E Davis
+[S-Lang](https://www.jedsoft.org/slang/modules/curl.html) by John E Davis
 
 [Smalltalk](http://www.squeaksource.com/CurlPlugin/) Written by Danil Osipchuk
 
diff --git a/docs/BUGS b/docs/BUGS
index 33f06cedc..7322d9b21 100644
--- a/docs/BUGS
+++ b/docs/BUGS
@@ -68,7 +68,7 @@ BUGS
   The curl project's process for handling security related issues is
   documented here:
 
-        https://curl.haxx.se/dev/security.html
+        https://curl.haxx.se/dev/secprocess.html
 
 1.4 What to report
 
diff --git a/docs/FAQ b/docs/FAQ
index 7ed5fa0ce..cb28c2a53 100644
--- a/docs/FAQ
+++ b/docs/FAQ
@@ -218,9 +218,9 @@ FAQ
   very well at the side. Curl's output can be piped into another program or
   redirected to another file for the next program to interpret.
 
-  We focus on protocol related issues and improvements. If you wanna do more
+  We focus on protocol related issues and improvements. If you want to do more
   magic with the supported protocols than curl currently does, chances are good
-  we will agree. If you wanna add more protocols, we may very well agree.
+  we will agree. If you want to add more protocols, we may very well agree.
 
   If you want someone else to do all the work while you wait for us to
   implement it for you, that is not a very friendly attitude. We spend a
@@ -998,7 +998,7 @@ FAQ
   compilers or prior curl versions it may set a time that appears one hour off.
   This happens due to a flaw in how Windows stores and uses file modification
   times and it is not easily worked around. For more details read this:
-  http://www.codeproject.com/datetime/dstbugs.asp
+  
https://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting
 
   4.14 Redirects work in browser but not with curl!
 
diff --git a/docs/KNOWN_BUGS b/docs/KNOWN_BUGS
index 961a62814..280edd0ed 100644
--- a/docs/KNOWN_BUGS
+++ b/docs/KNOWN_BUGS
@@ -90,6 +90,8 @@ problems may have been fixed or changed somewhat since this 
was written!
  13. TCP/IP
  13.1 --interface for ipv6 binds to unusable IP address
 
+ 14 DICT
+ 14.1 DICT responses show the underlying protocol
 
 ==============================================================================
 
@@ -591,3 +593,12 @@ problems may have been fixed or changed somewhat since 
this was written!
  locally scoped address as that is bound to fail.
 
  https://github.com/curl/curl/issues/686
+
+14. DICT
+
+14.1 DICT responses show the underlying protocol
+
+ When getting a DICT response, the protocol parts of DICT aren't stripped off
+ from the output.
+
+ https://github.com/curl/curl/issues/1809
diff --git a/docs/MAIL-ETIQUETTE b/docs/MAIL-ETIQUETTE
index 54f1090b7..effdcce21 100644
--- a/docs/MAIL-ETIQUETTE
+++ b/docs/MAIL-ETIQUETTE
@@ -179,7 +179,7 @@ MAIL ETIQUETTE
   or just remove them completely from the mail. Note that this includes base64
   encoded HTTP Basic auth headers.
 
-  This public nature of the curl mailing lists makes automaticly inserted mail
+  This public nature of the curl mailing lists makes automatically inserted 
mail
   footers about mails being "private" or "only meant for the receipient" or
   similar even more silly than usual. Because they are absolutely not private
   when sent to a public mailing list.
diff --git a/docs/MANUAL b/docs/MANUAL
index 0e3db0ffb..5df37e44a 100644
--- a/docs/MANUAL
+++ b/docs/MANUAL
@@ -298,8 +298,7 @@ POST (HTTP)
 
   How to post a form with curl, lesson #1:
 
-  Dig out all the <input> tags in the form that you want to fill in. (There's
-  a perl program called formfind.pl on the curl site that helps with this).
+  Dig out all the <input> tags in the form that you want to fill in.
 
   If there's a "normal" post, you use -d to post. -d takes a full "post
   string", which is in the format
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 2ce22b8e4..c6a5bb51a 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -43,7 +43,7 @@ CLEANFILES = $(GENHTMLPAGES) $(PDFPAGES) $(MANDISTPAGES) 
curl.1
 EXTRA_DIST = MANUAL BUGS CONTRIBUTE.md FAQ FEATURES INTERNALS.md SSLCERTS.md   
 \
  README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS KNOWN_BUGS  
 \
  BINDINGS.md HISTORY.md INSTALL INSTALL.md LICENSE-MIXING.md     \
- README.netware MAIL-ETIQUETTE HTTP-COOKIES.md SECURITY.md RELEASE-PROCEDURE   
 \
+ README.netware MAIL-ETIQUETTE HTTP-COOKIES.md SECURITY-PROCESS.md 
RELEASE-PROCEDURE    \
  SSL-PROBLEMS.md HTTP2.md ROADMAP.md CODE_OF_CONDUCT.md CODE_STYLE.md          
 \
  CHECKSRC.md CMakeLists.txt README.md CIPHERS.md INSTALL.cmake README.cmake    
 \
  $(noinst_man_MANS) HELP-US.md
diff --git a/docs/SECURITY.md b/docs/SECURITY-PROCESS.md
similarity index 95%
rename from docs/SECURITY.md
rename to docs/SECURITY-PROCESS.md
index c88cc9c81..d39c5a1fb 100644
--- a/docs/SECURITY.md
+++ b/docs/SECURITY-PROCESS.md
@@ -1,8 +1,8 @@
-curl security for developers
-============================
+curl security process
+=====================
 
-This document is intended to provide guidance to curl developers on how
-security vulnerabilities should be handled.
+This document describes how security vulnerabilities should be handled in the
+curl project.
 
 Publishing Information
 ----------------------
@@ -64,7 +64,7 @@ announcement.
   address@hidden(http://oss-security.openwall.org/wiki/mailing-lists/distros)
   when also informing and preparing them for the upcoming public security
   vulnerability announcement - attach the advisory draft for information. Note
-  that 'distros' won't accept an embargo longer than 19 days and they do not
+  that 'distros' won't accept an embargo longer than 14 days and they do not
   care for Windows-specific flaws. For windows-specific flaws, request CVE
   directly from MITRE.
 
diff --git a/docs/THANKS b/docs/THANKS
index 7d5cf079e..f51c9f78f 100644
--- a/docs/THANKS
+++ b/docs/THANKS
@@ -13,6 +13,7 @@ Abram Pousada
 Adam D. Moss
 Adam Langley
 Adam Light
+Adam Marcionek
 Adam Piggott
 Adam Sampson
 Adam Tkac
@@ -137,6 +138,7 @@ Arkadiusz Miskiewicz
 Armel Asselin
 Arnaud Compan
 Arnaud Ebalard
+Aron Bergman
 Artak Galoyan
 Arthur Murray
 Arve Knudsen
@@ -216,6 +218,7 @@ Brock Noland
 Bru Rom
 Bruce Mitchener
 Bruce Stephens
+Bruno Grasselli
 Bruno Thomsen
 Bruno de Carvalho
 Bryan Henderson
@@ -299,6 +302,7 @@ D. Flinkmann
 Da-Yoon Chung
 Dag Ekengren
 Dagobert Michelsen
+Dair Grant
 Dambaev Alexander
 Damian Dixon
 Damien Adant
@@ -337,6 +341,7 @@ Daniel Stenberg
 Daniel Theron
 Daniel at touchtunes
 Daphne Luong
+Dario Weisser
 Darryl House
 Darshan Mody
 Darío Hereñú
@@ -423,6 +428,7 @@ Doug Porter
 Douglas Creager
 Douglas E. Wegscheid
 Douglas Kilpatrick
+Douglas Mencken
 Douglas R. Horner
 Douglas Steinwand
 Dov Murik
@@ -431,11 +437,13 @@ Duane Cathey
 Duncan Mac-Vicar Prett
 Dustin Boswell
 Dusty Mabe
+Duy Phan Thanh
 Dwarakanath Yadavalli
 Dylan Ellicott
 Dylan Salisbury
 Dániel Bakai
 Early Ehlinger
+Earnestly on github
 Ebenezer Ikonne
 Ed Morley
 Edin Kadribasic
@@ -507,6 +515,7 @@ Florian Weimer
 Florin Petriuc
 Forrest Cahoon
 Francisco Moraes
+Francisco Sedano
 Francois Petitjean
 Frank Denis
 Frank Gevaerts
@@ -608,6 +617,7 @@ Hendrik Visage
 Henrik Gaßmann
 Henrik Storner
 Henry Ludemann
+Henry Roeland
 Herve Amblard
 Hidemoto Nakada
 Ho-chi Chen
@@ -860,6 +870,7 @@ Kim Vandry
 Kimmo Kinnunen
 Kjell Ericson
 Kjetil Jacobsen
+Klaus Stein
 Klevtsov Vadim
 Konstantin Isakov
 Kris Kennaway
@@ -986,6 +997,7 @@ Marquis de Muesli
 Martijn Koster
 Martin C. Martin
 Martin Drasar
+Martin Dreher
 Martin Frodl
 Martin Galvan
 Martin Hager
@@ -1056,6 +1068,7 @@ Michal Bonino
 Michal Marek
 Michał Fita
 Michał Górny
+Michał Janiszewski
 Michał Kowalczyk
 Michał Piechowski
 Michel Promonet
@@ -1166,6 +1179,7 @@ Patrick Dawson
 Patrick McManus
 Patrick Monnerat
 Patrick Rapin
+Patrick Schlangen
 Patrick Scott
 Patrick Smith
 Patrick Watson
@@ -1354,6 +1368,7 @@ Roy Shan
 Rune Kleveland
 Ruslan Gazizov
 Rutger Hofman
+Ruurd Beerstra
 Ryan Braud
 Ryan Chan
 Ryan Nelson
@@ -1399,8 +1414,10 @@ Senthil Raja Velu
 Sergei Kuzmin
 Sergei Nikulov
 Sergey Tatarincev
+Sergii Kavunenko
 Sergii Pylypenko
 Sergio Ballestrero
+Sergio Borghese
 Serj Kalichev
 Seshubabu Pasam
 Seth Mos
@@ -1421,6 +1438,7 @@ Simon H.
 Simon Josefsson
 Simon Liu
 Simon Warta
+Somnath Kundu
 Song Ma
 Sonia Subramanian
 Spacen Jasset
@@ -1505,6 +1523,7 @@ Tim Chen
 Tim Costello
 Tim Harder
 Tim Heckman
+Tim Mcdonough
 Tim Newsome
 Tim Rühsen
 Tim Sneddon
@@ -1575,7 +1594,7 @@ Venkataramana Mokkapati
 Victor Snezhko
 Vijay Panghal
 Vikram Saxena
-Viktor Szakáts
+Viktor Szakats
 Ville Skyttä
 Vilmos Nebehaj
 Vincas Razma
@@ -1644,7 +1663,6 @@ arainchik on github
 asavah on github
 baumanj on github
 bsammon on github
-canavan on github
 cbartl on github
 cmfrolick on github
 destman on github
@@ -1677,6 +1695,7 @@ omau on github
 ovidiu-benea on github
 paulharris on github
 silveja1 on github
+steelman on github
 stootill on github
 swalkaus at yahoo.com
 tarek112 on github
@@ -1687,5 +1706,6 @@ wyattoday on github
 youngchopin on github
 zelinchen on github
 İsmail Dönmez
+Łukasz Domeradzki
 Štefan Kremeň
 Никита Дорохин
diff --git a/docs/THANKS-filter b/docs/THANKS-filter
index 4c447be68..09340f785 100644
--- a/docs/THANKS-filter
+++ b/docs/THANKS-filter
@@ -47,7 +47,7 @@ s/Frank Van Uffelen and Fabian Hiernaux//
 s/Rodrigo Silva (MestreLion)/Rodrigo Silva/
 s/tetetest tetetest//
 s/Jiří Hruška/Jiri Hruska/
-s/Viktor Szakats/Viktor Szakáts/
+s/Viktor Szakáts/Viktor Szakats/
 s/Jonathan Cardoso$/Jonathan Cardoso Machado/
 s/Linus Nielsen$/Linus Nielsen Feltzing/
 s/Todd Ouska$/Todd A Ouska/
@@ -77,3 +77,4 @@ s/shachaf on github$/Shachaf Ben-Kiki/
 s/CarloCannas on github$/Carlo Cannas/
 s/Henrik S. Gaßmann$/Henrik Gaßmann/
 s/moteus on github/Alexey Melnichuk/
+s/Rich Moore/Richard Moore/
diff --git a/docs/TODO b/docs/TODO
index 25f860b42..ea78d9f18 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -17,12 +17,13 @@
  All bugs documented in the KNOWN_BUGS document are subject for fixing!
 
  1. libcurl
+ 1.1 Option to refuse usernames in URLs
  1.2 More data sharing
  1.3 struct lifreq
  1.4 signal-based resolver timeouts
  1.5 get rid of PATH_MAX
  1.6 Modified buffer size approach
- 1.7 Detect when called from within callbacks
+ 1.7 Support HTTP/2 for HTTP(S) proxies
  1.8 CURLOPT_RESOLVE for any port number
  1.9 Cache negative name resolves
  1.10 auto-detect proxy
@@ -40,6 +41,8 @@
  1.23 Offer API to flush the connection pool
  1.24 TCP Fast Open for windows
  1.25 Expose tried IP addresses that failed
+ 1.26 CURL_REFUSE_CLEARTEXT
+ 1.27 hardcode the "localhost" addresses
 
  2. libcurl - multi interface
  2.1 More non-blocking
@@ -65,7 +68,6 @@
  5.1 Better persistency for HTTP 1.0
  5.2 support FF3 sqlite cookie files
  5.3 Rearrange request header order
- 5.4 HTTP Digest using SHA-256
  5.5 auth= in URLs
  5.6 Refuse "downgrade" redirects
  5.7 QUIC
@@ -103,13 +105,12 @@
  13. SSL
  13.1 Disable specific versions
  13.2 Provide mutex locking API
- 13.3 Evaluate SSL patches
+ 13.3 Support in-memory certs/ca certs/keys
  13.4 Cache/share OpenSSL contexts
  13.5 Export session ids
  13.6 Provide callback for cert verification
  13.7 improve configure --with-ssl
  13.8 Support DANE
- 13.10 Support SSLKEYLOGFILE
  13.11 Support intermediate & root pinning for PINNEDPUBLICKEY
  13.12 Support HSTS
  13.13 Support HPKP
@@ -139,7 +140,9 @@
  18.2 glob posts
  18.3 prevent file overwriting
  18.4 simultaneous parallel transfers
+ 18.5 UTF-8 filenames in Content-Disposition
  18.6 warning when setting an option
+ 18.7 warning if curl version is not in sync with libcurl version
  18.8 offer color-coded HTTP header output
  18.9 Choose the name of file in braces for complex URLs
  18.10 improve how curl works in a windows console window
@@ -150,6 +153,7 @@
  18.15 --retry should resume
  18.16 send only part of --data
  18.17 consider file name from the redirected URL with -O ?
+ 18.18 retry on network is unreachable
 
  19. Build
  19.1 roffit
@@ -182,6 +186,16 @@
 
 1. libcurl
 
+1.1 Option to refuse usernames in URLs
+
+ There's a certain risk for application in allowing user names in URLs. For
+ example: if the wrong person gets to set the URL and manages to set a user
+ name in there when .netrc is used, the application may send along a password
+ that otherwise the person couldn't provide.
+
+ A new libcurl option could be added to allow applications to switch off this
+ feature and thus avoid a potential risk.
+
 1.2 More data sharing
 
  curl_share_* functions already exist and work, and they can be extended to
@@ -236,11 +250,9 @@
  Dynamically allocate buffer size depending on protocol in use in combination
  with freeing it after each individual transfer? Other suggestions?
 
-1.7 Detect when called from within callbacks
+1.7 Support HTTP/2 for HTTP(S) proxies
 
- We should set a state variable before calling callbacks, so that we
- subsequently can add code within libcurl that returns error if called within
- callbacks for when that's not supported.
+ Support for doing HTTP/2 to HTTP and HTTPS proxies is still missing.
 
 1.8 CURLOPT_RESOLVE for any port number
 
@@ -393,6 +405,32 @@
 
  https://github.com/curl/curl/issues/2126
 
+1.26 CURL_REFUSE_CLEARTEXT
+
+ An environment variable that when set will make libcurl refuse to use any
+ cleartext network protocol. That's all non-encrypted ones (FTP, HTTP, Gopher,
+ etc). By adding the check to libcurl and not just curl, this environment
+ variable can then help users to block all libcurl-using programs from
+ accessing the network using unsafe protocols.
+
+ The variable could be given some sort of syntax or different levels and be
+ used to also allow for example users to refuse libcurl to do transfers with
+ HTTPS certificate checks disabled.
+
+ It could also offer to refuse usernames in URLs (see TODO 1.1)
+
+1.27 hardcode the "localhost" addresses
+
+ There's this new spec getting adopted that says "localhost" should always and
+ unconditionally be a local address and not get resolved by a DNS server. A
+ fine way for curl to fix this would be to simply hard-code the response to
+ 127.0.0.1 and/or ::1 (depending on what IP versions that are requested). This
+ is what the browsers probably will do with this hostname.
+
+ https://bugzilla.mozilla.org/show_bug.cgi?id=1220810
+
+ https://tools.ietf.org/html/draft-ietf-dnsop-let-localhost-be-localhost-02
+
 2. libcurl - multi interface
 
 2.1 More non-blocking
@@ -521,15 +559,6 @@
  headers use a default value so only headers that need to be moved have to be
  specified.
 
-5.4 HTTP Digest using SHA-256
-
- RFC 7616 introduces an update to the HTTP Digest authentication
- specification, which amongst other thing defines how new digest algorithms
- can be used instead of MD5 which is considered old and not recommended.
-
- See https://tools.ietf.org/html/rfc7616 and
- https://github.com/curl/curl/issues/1018
-
 5.5 auth= in URLs
 
  Add the ability to specify the preferred authentication mechanism to use by
@@ -676,10 +705,13 @@ that doesn't exist on the server, just like 
--ftp-create-dirs.
  library, so that the same application code can use mutex-locking
  independently of OpenSSL or GnutTLS being used.
 
-13.3 Evaluate SSL patches
+13.3 Support in-memory certs/ca certs/keys
 
- Evaluate/apply Gertjan van Wingerde's SSL patches:
- https://curl.haxx.se/mail/lib-2004-03/0087.html
+ You can specify the private and public keys for SSH/SSL as file paths. Some
+ programs want to avoid using files and instead just pass them as in-memory
+ data blobs. There's probably a challenge to make this work across the
+ plethory of different TLS and SSH backends that curl suppports.
+ https://github.com/curl/curl/issues/2310
 
 13.4 Cache/share OpenSSL contexts
 
@@ -731,16 +763,6 @@ that doesn't exist on the server, just like 
--ftp-create-dirs.
  Björn Stenberg wrote a separate initial take on DANE that was never
  completed.
 
-13.10 Support SSLKEYLOGFILE
-
- When used, Firefox and Chrome dumps their master TLS keys to the file name
- this environment variable specifies. This allows tools like for example
- Wireshark to capture and decipher TLS traffic to/from those clients. libcurl
- could be made to support this more widely (presumably this already works when
- built with NSS). Peter Wu made a OpenSSL preload to make possible that can be
- used as inspiration and guidance
- https://git.lekensteyn.nl/peter/wireshark-notes/tree/src/sslkeylog.c
-
 13.11 Support intermediate & root pinning for PINNEDPUBLICKEY
 
  CURLOPT_PINNEDPUBLICKEY does not consider the hashes of intermediate & root
@@ -908,12 +930,26 @@ that doesn't exist on the server, just like 
--ftp-create-dirs.
  Using the multi interface would also allow properly using parallel transfers
  with HTTP/2 and supporting HTTP/2 server push from the command line.
 
+18.5 UTF-8 filenames in Content-Disposition
+
+ RFC 6266 documents how UTF-8 names can be passed to a client in the
+ Content-Disposition header, and curl does not support this.
+
+ https://github.com/curl/curl/issues/1888
+
 18.6 warning when setting an option
 
  Display a warning when libcurl returns an error when setting an option.
  This can be useful to tell when support for a particular feature hasn't been
  compiled into the library.
 
+18.7 warning if curl version is not in sync with libcurl version
+
+ This is usually a sign of a funny, weird or unexpected install situations
+ that aren't always quickly nor easily detected by users. curl and libcurl are
+ always released in sync and should use the same version numbers unless very
+ special situations.
+
 18.8 offer color-coded HTTP header output
 
  By offering different color output on the header name and the header
@@ -1015,6 +1051,18 @@ that doesn't exist on the server, just like 
--ftp-create-dirs.
 
  See https://github.com/curl/curl/issues/1241
 
+18.18 retry on network is unreachable
+
+ The --retry option retries transfers on "transient failures". We later added
+ --retry-connrefused to also retry for "connection refused" errors.
+
+ Suggestions have been brought to also allow retry on "network is unreachable"
+ errors and while totally reasonable, maybe we should consider a way to make
+ this more configurable than to add a new option for every new error people
+ want to retry for?
+
+ https://github.com/curl/curl/issues/1603
+
 19. Build
 
 19.1 roffit
diff --git a/docs/cmdline-opts/Makefile.inc b/docs/cmdline-opts/Makefile.inc
index e8f46410b..778149ca3 100644
--- a/docs/cmdline-opts/Makefile.inc
+++ b/docs/cmdline-opts/Makefile.inc
@@ -12,7 +12,9 @@ DPAGES = abstract-unix-socket.d anyauth.d append.d basic.d 
cacert.d capath.d cer
   form.d form-string.d ftp-account.d ftp-alternative-to-user.d          \
   ftp-create-dirs.d ftp-method.d ftp-pasv.d ftp-port.d ftp-pret.d       \
   ftp-skip-pasv-ip.d ftp-ssl-ccc.d ftp-ssl-ccc-mode.d ftp-ssl-control.d \
-  get.d globoff.d head.d header.d help.d hostpubmd5.d http1.0.d         \
+  get.d globoff.d                                                       \
+  happy-eyeballs-timeout-ms.d                                           \
+  head.d header.d help.d hostpubmd5.d http1.0.d                         \
   http1.1.d http2.d http2-prior-knowledge.d ignore-content-length.d     \
   include.d insecure.d interface.d ipv4.d ipv6.d junk-session-cookies.d \
   keepalive-time.d key.d key-type.d krb.d libcurl.d limit-rate.d        \
@@ -34,7 +36,7 @@ DPAGES = abstract-unix-socket.d anyauth.d append.d basic.d 
cacert.d capath.d cer
   remote-name-all.d remote-name.d remote-time.d request.d resolve.d     \
   retry-connrefused.d retry.d retry-delay.d retry-max-time.d sasl-ir.d  \
   service-name.d show-error.d silent.d socks4a.d socks4.d socks5.d      \
-  socks5-basic.d socks5-gssapi.d                                        \
+  socks5-basic.d socks5-gssapi.d proxy-pinnedpubkey.d                   \
   socks5-gssapi-nec.d socks5-gssapi-service.d socks5-hostname.d         \
   speed-limit.d speed-time.d ssl-allow-beast.d ssl.d ssl-no-revoke.d    \
   ssl-reqd.d sslv2.d sslv3.d stderr.d suppress-connect-headers.d        \
diff --git a/docs/cmdline-opts/form.d b/docs/cmdline-opts/form.d
index d95d0cc38..8d04d4193 100644
--- a/docs/cmdline-opts/form.d
+++ b/docs/cmdline-opts/form.d
@@ -12,25 +12,35 @@ Content-Type multipart/form-data according to RFC 2388.
 For SMTP and IMAP protocols, this is the mean to compose a multipart mail
 message to transmit.
 
-This enables uploading of binary
-files etc. To force the 'content' part to be a file, prefix the file name with
-an @ sign. To just get the content part from a file, prefix the file name with
-the symbol <. The difference between @ and < is then that @ makes a file get
-attached in the post as a file upload, while the < makes a text field and just
-get the contents for that text field from a file.
-
-Example: to send an image to an HTTP server, where \&'profile' is the name of
-the form-field to which portrait.jpg will be the input:
+This enables uploading of binary files etc. To force the 'content' part to be
+a file, prefix the file name with an @ sign. To just get the content part from
+a file, prefix the file name with the symbol <. The difference between @ and <
+is then that @ makes a file get attached in the post as a file upload, while
+the < makes a text field and just get the contents for that text field from a
+file.
+
+Tell curl to read content from stdin instead of a file by using - as
+filename. This goes for both @ and < constructs. When stdin is used, the
+contents is buffered in memory first by curl to determine its size and allow a
+possible resend.  Defining a part's data from a named non-regular file (such
+as a named pipe or similar) is unfortunately not subject to buffering and will
+be effectively read at transmission time; since the full size is unknown
+before the transfer starts, such data is sent as chunks by HTTP and rejected
+by IMAP.
+
+Example: send an image to an HTTP server, where \&'profile' is the name of the
+form-field to which the file portrait.jpg will be the input:
 
  curl -F address@hidden https://example.com/upload.cgi
 
-To read content from stdin instead of a file, use - as the filename. This goes
-for both @ and < constructs. If stdin is not attached to a regular file, it is
-buffered first to determine its size and allow a possible resend. Defining a
-part's data from a named non-regular file (such as a named pipe or similar) is
-unfortunately not subject to buffering and will be effectively read at
-transmission time; since the full size is unknown before the transfer starts,
-data is sent as chunks by HTTP and rejected by IMAP.
+Example: send a your name and shoe size in two text fields to the server:
+
+ curl -F name=John -F shoesize=11 https://example.com/
+
+Example: send a your essay in a text field to the server. Send it as a plain
+text field, but get the contents for it from a local file:
+
+ curl -F "story=<hugefile.txt" https://example.com/
 
 You can also tell curl what Content-Type to use by using 'type=', in a manner
 similar to:
diff --git a/docs/cmdline-opts/happy-eyeballs-timeout-ms.d 
b/docs/cmdline-opts/happy-eyeballs-timeout-ms.d
new file mode 100644
index 000000000..ec9a8c228
--- /dev/null
+++ b/docs/cmdline-opts/happy-eyeballs-timeout-ms.d
@@ -0,0 +1,17 @@
+Long: happy-eyeballs-timeout-ms
+Arg: <milliseconds>
+Help: How long to wait in milliseconds for IPv6 before trying IPv4
+Added: 7.59.0
+---
+Happy eyeballs is an algorithm that attempts to connect to both IPv4 and IPv6
+addresses for dual-stack hosts, preferring IPv6 first for the number of
+milliseconds. If the IPv6 address cannot be connected to within that time then
+a connection attempt is made to the IPv4 address in parallel. The first
+connection to be established is the one that is used.
+
+The range of suggested useful values is limited. Happy Eyeballs RFC 6555 says
+"It is RECOMMENDED that connection attempts be paced 150-250 ms apart to
+balance human factors against network load." libcurl currently defaults to
+200 ms. Firefox and Chrome currently default to 300 ms.
+
+If this option is used several times, the last one will be used.
diff --git a/docs/cmdline-opts/page-footer b/docs/cmdline-opts/page-footer
index 6006f4649..1ca47ae02 100644
--- a/docs/cmdline-opts/page-footer
+++ b/docs/cmdline-opts/page-footer
@@ -24,14 +24,17 @@ Sets the proxy server to use if no protocol-specific proxy 
is set.
 list of host names that shouldn't go through any proxy. If set to a asterisk
 \&'*' only, it matches all hosts.
 
-Since 7.53.0, this environment variable disable the proxy even if specify
---proxy option. That is
+This environment variable disables use of the proxy even when specified with
+the --proxy option. That is
 .B NO_PROXY=direct.example.com curl -x http://proxy.example.com
 .B http://direct.example.com
 accesses the target URL directly, and
 .B NO_PROXY=direct.example.com curl -x http://proxy.example.com
 .B http://somewhere.example.com
-accesses the target URL through proxy.
+accesses the target URL through the proxy.
+
+The list of host names can also be include numerical IP addresses, and IPv6
+versions should then be given without enclosing brackets.
 
 .SH "PROXY PROTOCOL PREFIXES"
 Since curl version 7.21.7, the proxy string may be specified with a
diff --git a/docs/cmdline-opts/progress-bar.d b/docs/cmdline-opts/progress-bar.d
index 11e95b45e..f27de2d93 100644
--- a/docs/cmdline-opts/progress-bar.d
+++ b/docs/cmdline-opts/progress-bar.d
@@ -7,5 +7,6 @@ standard, more informational, meter.
 
 This progress bar draws a single line of '#' characters across the screen and
 shows a percentage if the transfer size is known. For transfers without a
-known size, it will instead output one '#' character for every 1024 bytes
-transferred.
+known size, there will be space ship (-=o=-) that moves back and forth but
+only while data is being transferred, with a set of flying hash sign symbols on
+top.
diff --git a/docs/cmdline-opts/pinnedpubkey.d 
b/docs/cmdline-opts/proxy-pinnedpubkey.d
similarity index 58%
copy from docs/cmdline-opts/pinnedpubkey.d
copy to docs/cmdline-opts/proxy-pinnedpubkey.d
index 0657e6e79..abd6dc4aa 100644
--- a/docs/cmdline-opts/pinnedpubkey.d
+++ b/docs/cmdline-opts/proxy-pinnedpubkey.d
@@ -1,10 +1,10 @@
-Long: pinnedpubkey
+Long: proxy-pinnedpubkey
 Arg: <hashes>
-Help: FILE/HASHES Public key to verify peer against
+Help: FILE/HASHES public key to verify proxy with
 Protocols: TLS
 ---
 Tells curl to use the specified public key file (or hashes) to verify the
-peer. This can be a path to a file which contains a single public key in PEM
+proxy. This can be a path to a file which contains a single public key in PEM
 or DER format, or any number of base64 encoded sha256 hashes preceded by
 \'sha256//\' and separated by \';\'
 
@@ -13,15 +13,4 @@ indicating its identity. A public key is extracted from this 
certificate and
 if it does not exactly match the public key provided to this option, curl will
 abort the connection before sending or receiving any data.
 
-PEM/DER support:
-  7.39.0: OpenSSL, GnuTLS and GSKit
-  7.43.0: NSS and wolfSSL/CyaSSL
-  7.47.0: mbedtls
-  7.49.0: PolarSSL
-sha256 support:
-  7.44.0: OpenSSL, GnuTLS, NSS and wolfSSL/CyaSSL.
-  7.47.0: mbedtls
-  7.49.0: PolarSSL
-Other SSL backends not supported.
-
 If this option is used several times, the last one will be used.
diff --git a/docs/cmdline-opts/resolve.d b/docs/cmdline-opts/resolve.d
index 91539b8e9..9e1457b5e 100644
--- a/docs/cmdline-opts/resolve.d
+++ b/docs/cmdline-opts/resolve.d
@@ -1,5 +1,5 @@
 Long: resolve
-Arg: <host:port:address>
+Arg: <host:port:address[,address]...>
 Help: Resolve the host+port to this address
 Added: 7.21.3
 ---
@@ -16,4 +16,6 @@ is set to make curl use another IP version.
 
 Support for providing the IP address within [brackets] was added in 7.57.0.
 
+Support for providing multiple IP addresses per entry was added in 7.59.0.
+
 This option can be used many times to add many host names to resolve.
diff --git a/docs/cmdline-opts/tlsauthtype.d b/docs/cmdline-opts/tlsauthtype.d
index 1b1481ffe..ede21c2f7 100644
--- a/docs/cmdline-opts/tlsauthtype.d
+++ b/docs/cmdline-opts/tlsauthtype.d
@@ -5,4 +5,6 @@ Added: 7.21.4
 ---
 Set TLS authentication type. Currently, the only supported option is "SRP",
 for TLS-SRP (RFC 5054). If --tlsuser and --tlspassword are specified but
---tlsauthtype is not, then this option defaults to "SRP".
+--tlsauthtype is not, then this option defaults to "SRP".  This option works
+only if the underlying libcurl is built with TLS-SRP support, which requires
+OpenSSL or GnuTLS with TLS-SRP support.
diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am
index fed027166..8c0665c21 100644
--- a/docs/examples/Makefile.am
+++ b/docs/examples/Makefile.am
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -53,6 +53,9 @@ else
 LDADD = $(LIBDIR)/libgnurl.la
 endif
 
+# This might hold -Werror
+CFLAGS += @CURL_CFLAG_EXTRAS@
+
 # Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
 include Makefile.inc
 
diff --git a/docs/examples/Makefile.inc b/docs/examples/Makefile.inc
index 9e4e1ffaa..e8aa9fa68 100644
--- a/docs/examples/Makefile.inc
+++ b/docs/examples/Makefile.inc
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -34,7 +34,7 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface 
debug fileupload \
   imap-tls imap-multi url2file sftpget ftpsget postinmemory http2-download \
   http2-upload http2-serverpush getredirect ftpuploadfrommem               \
   ftpuploadresume sslbackend postit2-formadd multi-formadd                 \
-  shared-connection-cache
+  shared-connection-cache sftpuploadresume
 
 # These examples require external dependencies that may not be commonly
 # available on POSIX systems, so don't bother attempting to compile them here.
diff --git a/docs/examples/ftpupload.c b/docs/examples/ftpupload.c
index ec91c818b..3871f514a 100644
--- a/docs/examples/ftpupload.c
+++ b/docs/examples/ftpupload.c
@@ -77,7 +77,7 @@ int main(void)
 
   /* get the file size of the local file */
   if(stat(LOCAL_FILE, &file_info)) {
-    printf("Couldnt open '%s': %s\n", LOCAL_FILE, strerror(errno));
+    printf("Couldn't open '%s': %s\n", LOCAL_FILE, strerror(errno));
     return 1;
   }
   fsize = (curl_off_t)file_info.st_size;
diff --git a/docs/examples/sftpuploadresume.c b/docs/examples/sftpuploadresume.c
new file mode 100644
index 000000000..032bcaffb
--- /dev/null
+++ b/docs/examples/sftpuploadresume.c
@@ -0,0 +1,130 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+/* <DESC>
+ * Upload to SFTP, resuming a previously aborted transfer.
+ * </DESC>
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <curl/curl.h>
+
+/* read data to upload */
+static size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+  FILE *f = (FILE *)stream;
+  size_t n;
+
+  if(ferror(f))
+    return CURL_READFUNC_ABORT;
+
+  n = fread(ptr, size, nmemb, f) * size;
+
+  return n;
+}
+
+/*
+ * sftpGetRemoteFileSize returns the remote file size in byte; -1 on error
+ */
+static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
+{
+  CURLcode result = CURLE_GOT_NOTHING;
+  curl_off_t remoteFileSizeByte = -1;
+  CURL *curlHandlePtr = NULL;
+
+  curlHandlePtr = curl_easy_init();
+  curl_easy_setopt(curlHandlePtr, CURLOPT_VERBOSE, 1L);
+
+  curl_easy_setopt(curlHandlePtr, CURLOPT_URL, i_remoteFile);
+  curl_easy_setopt(curlHandlePtr, CURLOPT_NOPROGRESS, 1);
+  curl_easy_setopt(curlHandlePtr, CURLOPT_NOBODY, 1);
+  curl_easy_setopt(curlHandlePtr, CURLOPT_HEADER, 1);
+  curl_easy_setopt(curlHandlePtr, CURLOPT_FILETIME, 1);
+
+  result = curl_easy_perform(curlHandlePtr);
+  if(CURLE_OK == result) {
+    result = curl_easy_getinfo(curlHandlePtr,
+                               CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
+                               &remoteFileSizeByte);
+    printf("filesize: %ld \n", remoteFileSizeByte);
+  }
+  curl_easy_cleanup(curlHandlePtr);
+
+  return remoteFileSizeByte;
+}
+
+
+static int sftpResumeUpload(CURL *curlhandle, const char *remotepath,
+                            const char *localpath)
+{
+  FILE *f = NULL;
+  CURLcode result = CURLE_GOT_NOTHING;
+
+  curl_off_t remoteFileSizeByte = sftpGetRemoteFileSize(remotepath);
+  if(-1 == remoteFileSizeByte) {
+    printf("Error reading the remote file size: unable to resume upload\n");
+    return -1;
+  }
+
+  f = fopen(localpath, "rb");
+  if(!f) {
+    perror(NULL);
+    return 0;
+  }
+
+  curl_easy_setopt(curlhandle, CURLOPT_UPLOAD, 1L);
+  curl_easy_setopt(curlhandle, CURLOPT_URL, remotepath);
+  curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, readfunc);
+  curl_easy_setopt(curlhandle, CURLOPT_READDATA, f);
+
+  fseek(f, remoteFileSizeByte, SEEK_SET);
+  curl_easy_setopt(curlhandle, CURLOPT_APPEND, 1L);
+  result = curl_easy_perform(curlhandle);
+
+  fclose(f);
+
+  if(result == CURLE_OK)
+    return 1;
+  else {
+    fprintf(stderr, "%s\n", curl_easy_strerror(result));
+    return 0;
+  }
+}
+
+int main(void)
+{
+  const char *remote = "sftp://user:address@hidden/path/filename";;
+  const char *filename = "filename";
+  CURL *curlhandle = NULL;
+
+  curl_global_init(CURL_GLOBAL_ALL);
+  curlhandle = curl_easy_init();
+
+  if(!sftpResumeUpload(curlhandle, remote, filename)) {
+    printf("resumed upload using curl %s failed\n", curl_version());
+  }
+
+  curl_easy_cleanup(curlhandle);
+  curl_global_cleanup();
+
+  return 0;
+}
diff --git a/docs/libcurl/Makefile.inc b/docs/libcurl/Makefile.inc
index 7d45ffa67..22eb865eb 100644
--- a/docs/libcurl/Makefile.inc
+++ b/docs/libcurl/Makefile.inc
@@ -21,4 +21,5 @@ man_MANS = gnurl_easy_cleanup.3 gnurl_easy_getinfo.3 
gnurl_easy_init.3      \
   gnurl_mime_init.3 gnurl_mime_free.3 gnurl_mime_addpart.3 gnurl_mime_name.3 \
   gnurl_mime_data.3 gnurl_mime_data_cb.3 gnurl_mime_filedata.3              \
   gnurl_mime_filename.3 gnurl_mime_subparts.3                              \
-  gnurl_mime_type.3 gnurl_mime_headers.3 gnurl_mime_encoder.3 libgnurl-env.3
+  gnurl_mime_type.3 gnurl_mime_headers.3 gnurl_mime_encoder.3 libgnurl-env.3 \
+  libgnurl-security.3
diff --git a/docs/libcurl/gnurl_easy_getinfo.3 
b/docs/libcurl/gnurl_easy_getinfo.3
index c2ebd16b3..351a6b8d9 100644
--- a/docs/libcurl/gnurl_easy_getinfo.3
+++ b/docs/libcurl/gnurl_easy_getinfo.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -54,8 +54,9 @@ See \fICURLINFO_HTTP_CONNECTCODE(3)\fP
 The http version used in the connection.
 See \fICURLINFO_HTTP_VERSION(3)\fP
 .IP CURLINFO_FILETIME
-Remote time of the retrieved document.
-See \fICURLINFO_FILETIME(3)\fP
+Remote time of the retrieved document. See \fICURLINFO_FILETIME(3)\fP
+.IP CURLINFO_FILETIME_T
+Remote time of the retrieved document. See \fICURLINFO_FILETIME_T(3)\fP
 .IP CURLINFO_TOTAL_TIME
 Total time of previous transfer.
 See \fICURLINFO_TOTAL_TIME(3)\fP
diff --git a/docs/libcurl/gnurl_easy_setopt.3 b/docs/libcurl/gnurl_easy_setopt.3
index cafcf0819..cd05dd422 100644
--- a/docs/libcurl/gnurl_easy_setopt.3
+++ b/docs/libcurl/gnurl_easy_setopt.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -139,6 +139,10 @@ Callback for wildcard matching. See 
\fICURLOPT_FNMATCH_FUNCTION(3)\fP
 Data pointer to pass to the wildcard matching callback. See 
\fICURLOPT_FNMATCH_DATA(3)\fP
 .IP CURLOPT_SUPPRESS_CONNECT_HEADERS
 Suppress proxy CONNECT response headers from user callbacks. See 
\fICURLOPT_SUPPRESS_CONNECT_HEADERS(3)\fP
+.IP CURLOPT_RESOLVER_START_FUNCTION
+Callback to be called before a new resolve request is started. See 
\fICURLOPT_RESOLVER_START_FUNCTION(3)\fP
+.IP CURLOPT_RESOLVER_START_DATA
+Data pointer to pass to resolver start callback. See 
\fICURLOPT_RESOLVER_START_DATA(3)\fP
 .SH ERROR OPTIONS
 .IP CURLOPT_ERRORBUFFER
 Error message buffer. See \fICURLOPT_ERRORBUFFER(3)\fP
@@ -421,6 +425,8 @@ Maximum file size to get. See 
\fICURLOPT_MAXFILESIZE_LARGE(3)\fP
 Make a time conditional request. See \fICURLOPT_TIMECONDITION(3)\fP
 .IP CURLOPT_TIMEVALUE
 Time value for the time conditional request. See \fICURLOPT_TIMEVALUE(3)\fP
+.IP CURLOPT_TIMEVALUE_LARGE
+Time value for the time conditional request. See 
\fICURLOPT_TIMEVALUE_LARGE(3)\fP
 .SH CONNECTION OPTIONS
 .IP CURLOPT_TIMEOUT
 Timeout for the entire request. See \fICURLOPT_TIMEOUT(3)\fP
@@ -462,6 +468,8 @@ Bind name resolves to this IP6 address. See 
\fICURLOPT_DNS_LOCAL_IP6(3)\fP
 Preferred DNS servers. See \fICURLOPT_DNS_SERVERS(3)\fP
 .IP CURLOPT_ACCEPTTIMEOUT_MS
 Timeout for waiting for the server's connect back to be accepted. See 
\fICURLOPT_ACCEPTTIMEOUT_MS(3)\fP
+.IP CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS
+Timeout for happy eyeballs. See \fICURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS(3)\fP
 .SH SSL and SECURITY OPTIONS
 .IP CURLOPT_SSLCERT
 Client cert. See \fICURLOPT_SSLCERT(3)\fP
diff --git a/docs/libcurl/gnurl_getdate.3 b/docs/libcurl/gnurl_getdate.3
index 5a4f8f25a..2694faa9e 100644
--- a/docs/libcurl/gnurl_getdate.3
+++ b/docs/libcurl/gnurl_getdate.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -96,13 +96,15 @@ only ones RFC 7231 says HTTP applications may use.
 This function returns -1 when it fails to parse the date string. Otherwise it
 returns the number of seconds as described.
 
-If the year is larger than 2037 on systems with 32 bit time_t, this function
-will return 0x7fffffff (since that is the largest possible signed 32 bit
-number).
+On systems with a signed 32 bit time_t: if the year is larger than 2037 or
+less than 1903, this function will return -1.
 
-Having a 64 bit time_t is not a guarantee that dates beyond 03:14:07 UTC,
-January 19, 2038 will work fine. On systems with a 64 bit time_t but with a
-crippled mktime(), \fIcurl_getdate(3)\fP will return -1 in this case.
+On systems with an unsigned 32 bit time_t: if the year is larger than 2106 or
+less than 1970, this function will return -1.
+
+On systems with 64 bit time_t: if the year is less than 1583, this function
+will return -1. (The Gregorian calendar was first introduced 1582 so no "real"
+dates in this way of doing dates existed before then.)
 .SH "SEE ALSO"
 .BR curl_easy_escape "(3), " curl_easy_unescape "(3), "
 .BR CURLOPT_TIMECONDITION "(3), " CURLOPT_TIMEVALUE "(3) "
diff --git a/docs/libcurl/gnurl_global_init.3 b/docs/libcurl/gnurl_global_init.3
index 6ff5b774b..f4cd5d6df 100644
--- a/docs/libcurl/gnurl_global_init.3
+++ b/docs/libcurl/gnurl_global_init.3
@@ -62,7 +62,7 @@ Initialize everything possible. This sets all known bits 
except
 \fBCURL_GLOBAL_ACK_EINTR\fP.
 
 .IP CURL_GLOBAL_SSL
-(This flag's presence or absense serves no meaning since 7.57.0. The
+(This flag's presence or absence serves no meaning since 7.57.0. The
 description below is for older libcurl versions.)
 
 Initialize SSL.
diff --git a/docs/libcurl/gnurl_share_setopt.3 
b/docs/libcurl/gnurl_share_setopt.3
index c9966214e..d903f49a4 100644
--- a/docs/libcurl/gnurl_share_setopt.3
+++ b/docs/libcurl/gnurl_share_setopt.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -62,8 +62,8 @@ Cookie data will be shared across the easy handles using this 
shared object.
 .IP CURL_LOCK_DATA_DNS
 Cached DNS hosts will be shared across the easy handles using this shared
 object. Note that when you use the multi interface, all easy handles added to
-the same multi handle will share DNS cache by default without this having to
-be used!
+the same multi handle will share DNS cache by default without using this
+option.
 .IP CURL_LOCK_DATA_SSL_SESSION
 SSL session IDs will be shared across the easy handles using this shared
 object. This will reduce the time spent in the SSL handshake when reconnecting
@@ -84,6 +84,9 @@ in different threads using a shared connection.
 
 Support for \fBCURL_LOCK_DATA_CONNECT\fP was added in 7.57.0, but the symbol
 existed before this.
+
+Note that when you use the multi interface, all easy handles added to the same
+multi handle will share connection cache by default without using this option.
 .RE
 .IP CURLSHOPT_UNSHARE
 This option does the opposite of \fICURLSHOPT_SHARE\fP. It specifies that
diff --git a/docs/libcurl/libgnurl-env.3 b/docs/libcurl/libgnurl-env.3
index 3eb3b42e2..7bab37f5f 100644
--- a/docs/libcurl/libgnurl-env.3
+++ b/docs/libcurl/libgnurl-env.3
@@ -36,7 +36,7 @@ will use the "ftp_proxy" variable.
 
 These proxy variables are also checked for in their uppercase versions, except
 the "http_proxy" one which is only used lowercase. Note also that some systems
-actually have a case insensitve handling of environment variables and then of
+actually have a case insensitive handling of environment variables and then of
 course "HTTP_PROXY" will still work...
 .IP ALL_PROXY
 This is a setting to set proxy for all URLs, independently of what scheme is
@@ -46,7 +46,7 @@ set.
 When libcurl is built to support multiple SSL backends, it will select a
 specific backend at first use. If no selection is done by the program using
 libcurl, this variable's selection will be used. It should be set to the full
-SSL backend name to use (case insensitve).
+SSL backend name to use (case insensitive).
 .IP HOME
 When the netrc feature is used (\fICURLOPT_NETRC(3)\fP), this variable is
 checked as the primary way to find the "current" home directory in which
diff --git a/docs/libcurl/libgnurl-errors.3 b/docs/libcurl/libgnurl-errors.3
index 1b6e34f51..2c866b0d2 100644
--- a/docs/libcurl/libgnurl-errors.3
+++ b/docs/libcurl/libgnurl-errors.3
@@ -252,6 +252,8 @@ Failed to match the pinned key specified with 
\fICURLOPT_PINNEDPUBLICKEY(3)\fP.
 Status returned failure when asked with \fICURLOPT_SSL_VERIFYSTATUS(3)\fP.
 .IP "CURLE_HTTP2_STREAM (92)"
 Stream error in the HTTP/2 framing layer.
+.IP "CURLE_RECURSIVE_API_CALL (93)"
+An API function was called from inside a callback.
 .IP "CURLE_OBSOLETE*"
 These error codes will never be returned. They were used in an old libcurl
 version and are currently unused.
@@ -285,6 +287,8 @@ curl_multi_setopt() with unsupported option
 .IP "CURLM_ADDED_ALREADY (7)"
 An easy handle already added to a multi handle was attempted to get added a
 second time. (Added in 7.32.1)
+.IP "CURLM_RECURSIVE_API_CALL (8)"
+An API function was called from inside a callback.
 .SH "CURLSHcode"
 The "share" interface will return a CURLSHcode to indicate when an error has
 occurred.  Also consider \fIcurl_share_strerror(3)\fP.
diff --git a/docs/libcurl/libgnurl-security.3 b/docs/libcurl/libgnurl-security.3
new file mode 100644
index 000000000..377301ee0
--- /dev/null
+++ b/docs/libcurl/libgnurl-security.3
@@ -0,0 +1,338 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH libcurl-security 3 "13 Feb 2018" "libcurl" "libcurl security"
+.SH NAME
+libcurl-security \- security considerations when using libcurl
+.SH "Security"
+The libcurl project takes security seriously.  The library is written with
+caution and precautions are taken to mitigate many kinds of risks encountered
+while operating with potentially malicious servers on the Internet. It is a
+powerful library, however, which allows application writers to make trade-offs
+between ease of writing and exposure to potential risky operations. If used
+the right way, you can use libcurl to transfer data pretty safely.
+
+Many applications are used in closed networks where users and servers can
+(possibly) be trusted, but many others are used on arbitrary servers and are
+fed input from potentially untrusted users.  Following is a discussion about
+some risks in the ways in which applications commonly use libcurl and
+potential mitigations of those risks. It is by no means comprehensive, but
+shows classes of attacks that robust applications should consider. The Common
+Weakness Enumeration project at https://cwe.mitre.org/ is a good reference for
+many of these and similar types of weaknesses of which application writers
+should be aware.
+.SH "Command Lines"
+If you use a command line tool (such as curl) that uses libcurl, and you give
+options to the tool on the command line those options can very likely get read
+by other users of your system when they use 'ps' or other tools to list
+currently running processes.
+
+To avoid these problems, never feed sensitive things to programs using command
+line options. Write them to a protected file and use the \-K option to avoid
+this.
+.SH ".netrc"
+\&.netrc is a pretty handy file/feature that allows you to login quickly and
+automatically to frequently visited sites. The file contains passwords in
+clear text and is a real security risk. In some cases, your .netrc is also
+stored in a home directory that is NFS mounted or used on another network
+based file system, so the clear text password will fly through your network
+every time anyone reads that file!
+
+For applications that enable .netrc use, a user who manage to set the right
+URL might then be possible to pass on passwords.
+
+To avoid these problems, don't use .netrc files and never store passwords in
+plain text anywhere.
+.SH "Clear Text Passwords"
+Many of the protocols libcurl supports send name and password unencrypted as
+clear text (HTTP Basic authentication, FTP, TELNET etc). It is very easy for
+anyone on your network or a network nearby yours to just fire up a network
+analyzer tool and eavesdrop on your passwords. Don't let the fact that HTTP
+Basic uses base64 encoded passwords fool you. They may not look readable at a
+first glance, but they very easily "deciphered" by anyone within seconds.
+
+To avoid this problem, use an authentication mechanism or other protocol that
+doesn't let snoopers see your password: Digest, CRAM-MD5, Kerberos, SPNEGO or
+NTLM authentication. Or even better: use authenticated protocols that protect
+the entire connection and everything sent over it.
+.SH "Un-authenticated Connections"
+Protocols that don't have any form of cryptographic authentication can not
+with any certainty know that they communicate with the right remote server.
+
+If your application is using a fixed scheme or fixed host name, it is not safe
+as long as the connection is un-authenticated. There can be a
+man-in-the-middle or in fact the whole server might have been replaced by an
+evil actor.
+
+Un-authenticated protocols are unsafe. The data that comes back to curl may
+have been injected by an attacker. The data that curl sends might be modified
+before it reaches the intended server. If it even reaches the intended server
+at all.
+
+Remedies include:
+ - Restrict operations to authenticated transfers
+ - Make sure the server's certificate etc is verified
+.SH "Redirects"
+The \fICURLOPT_FOLLOWLOCATION(3)\fP option automatically follows HTTP
+redirects sent by a remote server.  These redirects can refer to any kind of
+URL, not just HTTP. libcurl restricts the protocols allowed to be used in
+redirects for security reasons: FILE, SCP, SMB and SMBS are disabled by
+default. Applications are encouraged to restrict that set further.
+
+A redirect to a file: URL would cause the libcurl to read (or write) arbitrary
+files from the local filesystem.  If the application returns the data back to
+the user (as would happen in some kinds of CGI scripts), an attacker could
+leverage this to read otherwise forbidden data (e.g.
+file://localhost/etc/passwd).
+
+If authentication credentials are stored in the ~/.netrc file, or Kerberos
+is in use, any other URL type (not just file:) that requires
+authentication is also at risk.  A redirect such as
+ftp://some-internal-server/private-file would then return data even when
+the server is password protected.
+
+In the same way, if an unencrypted SSH private key has been configured for the
+user running the libcurl application, SCP: or SFTP: URLs could access password
+or private-key protected resources,
+e.g. sftp://address@hidden/etc/passwd
+
+The \fICURLOPT_REDIR_PROTOCOLS(3)\fP and \fICURLOPT_NETRC(3)\fP options can be
+used to mitigate against this kind of attack.
+
+A redirect can also specify a location available only on the machine running
+libcurl, including servers hidden behind a firewall from the attacker.
+e.g. http://127.0.0.1/ or http://intranet/delete-stuff.cgi?delete=all or
+tftp://bootp-server/pc-config-data
+
+Applications can mitigate against this by disabling
+\fICURLOPT_FOLLOWLOCATION(3)\fP and handling redirects itself, sanitizing URLs
+as necessary. Alternately, an app could leave \fICURLOPT_FOLLOWLOCATION(3)\fP
+enabled but set \fICURLOPT_REDIR_PROTOCOLS(3)\fP and install a
+\fICURLOPT_OPENSOCKETFUNCTION(3)\fP callback function in which addresses are
+sanitized before use.
+.SH "Local Resources"
+A user who can control the DNS server of a domain being passed in within a URL
+can change the address of the host to a local, private address which a
+server-side libcurl-using application could then use. e.g. the innocuous URL
+http://fuzzybunnies.example.com/ could actually resolve to the IP address of a
+server behind a firewall, such as 127.0.0.1 or 10.1.2.3.  Applications can
+mitigate against this by setting a \fICURLOPT_OPENSOCKETFUNCTION(3)\fP and
+checking the address before a connection.
+
+All the malicious scenarios regarding redirected URLs apply just as well to
+non-redirected URLs, if the user is allowed to specify an arbitrary URL that
+could point to a private resource. For example, a web app providing a
+translation service might happily translate file://localhost/etc/passwd and
+display the result.  Applications can mitigate against this with the
+\fICURLOPT_PROTOCOLS(3)\fP option as well as by similar mitigation techniques
+for redirections.
+
+A malicious FTP server could in response to the PASV command return an IP
+address and port number for a server local to the app running libcurl but
+behind a firewall.  Applications can mitigate against this by using the
+\fICURLOPT_FTP_SKIP_PASV_IP(3)\fP option or \fICURLOPT_FTPPORT(3)\fP.
+
+Local servers sometimes assume local access comes from friends and trusted
+users. An application that expects http://example.com/file_to_read that and
+instead gets http://192.168.0.1/my_router_config might print a file that would
+otherwise be protected by the firewall.
+
+Allowing your application to connect to local hosts, be it the same machine
+that runs the application or a machine on the same local network, might be
+possible to exploit by an attacker who then perhaps can "port-scan" the
+particular hosts - depending on how the application and servers acts.
+.SH "IPv6 Addresses"
+libcurl will normally handle IPv6 addresses transparently and just as easily
+as IPv4 addresses. That means that a sanitizing function that filters out
+addresses like 127.0.0.1 isn't sufficient--the equivalent IPv6 addresses ::1,
+::, 0:00::0:1, ::127.0.0.1 and ::ffff:7f00:1 supplied somehow by an attacker
+would all bypass a naive filter and could allow access to undesired local
+resources.  IPv6 also has special address blocks like link-local and
+site-local that generally shouldn't be accessed by a server-side libcurl-using
+application.  A poorly-configured firewall installed in a data center,
+organization or server may also be configured to limit IPv4 connections but
+leave IPv6 connections wide open.  In some cases, setting
+\fICURLOPT_IPRESOLVE(3)\fP to CURL_IPRESOLVE_V4 can be used to limit resolved
+addresses to IPv4 only and bypass these issues.
+.SH Uploads
+When uploading, a redirect can cause a local (or remote) file to be
+overwritten. Applications must not allow any unsanitized URL to be passed in
+for uploads. Also, \fICURLOPT_FOLLOWLOCATION(3)\fP should not be used on
+uploads.  Instead, the applications should consider handling redirects itself,
+sanitizing each URL first.
+.SH Authentication
+Use of \fICURLOPT_UNRESTRICTED_AUTH(3)\fP could cause authentication
+information to be sent to an unknown second server.  Applications can mitigate
+against this by disabling \fICURLOPT_FOLLOWLOCATION(3)\fP and handling
+redirects itself, sanitizing where necessary.
+
+Use of the CURLAUTH_ANY option to \fICURLOPT_HTTPAUTH(3)\fP could result in
+user name and password being sent in clear text to an HTTP server.  Instead,
+use CURLAUTH_ANYSAFE which ensures that the password is encrypted over the
+network, or else fail the request.
+
+Use of the CURLUSESSL_TRY option to \fICURLOPT_USE_SSL(3)\fP could result in
+user name and password being sent in clear text to an FTP server.  Instead,
+use CURLUSESSL_CONTROL to ensure that an encrypted connection is used or else
+fail the request.
+.SH Cookies
+If cookies are enabled and cached, then a user could craft a URL which
+performs some malicious action to a site whose authentication is already
+stored in a cookie. e.g. http://mail.example.com/delete-stuff.cgi?delete=all
+Applications can mitigate against this by disabling cookies or clearing them
+between requests.
+.SH "Dangerous SCP URLs"
+SCP URLs can contain raw commands within the scp: URL, which is a side effect
+of how the SCP protocol is designed. e.g.
+
+  scp://user:address@hidden/a;date >/tmp/test;
+
+Applications must not allow unsanitized SCP: URLs to be passed in for
+downloads.
+.SH "file://"
+By default curl and libcurl support file:// URLs. Such a URL is always an
+access, or attempted access, to a local resource. If your application wants to
+avoid that, keep control of what URLs to use and/or prevent curl/libcurl from
+using the protocol.
+
+By default, libcurl prohibits redirects to file:// URLs.
+.SH "What if the user can set the URL"
+Applications may find it tempting to let users set the URL that it can work
+on. That's probably fine, but opens up for mischief and trickery that you as
+an application author may want to address or take precautions against.
+
+If your curl-using script allow a custom URL do you also, perhaps
+unintentionally, allow the user to pass other options to the curl command line
+if creative use of special characters are applied?
+
+If the user can set the URL, the user can also specify the scheme part to
+other protocols that you didn't intend for users to use and perhaps didn't
+consider. curl supports over 20 different URL schemes. "http://"; might be what
+you thought, "ftp://"; or "imap://" might be what the user gives your
+application. Also, cross-protocol operations might be done by using a
+particular scheme in the URL but point to a server doing a different protocol
+on a non-standard port.
+
+Remedies:
+
+ - curl command lines can use \fI--proto\fP to limit what schemes it accepts
+ - libcurl programs can use \fICURLOPT_PROTOCOLS(3)\fP
+ - consider not allowing the user to set the full URL
+ - consider strictly filtering input to only allow specific choices
+.SH "RFC 3986 vs WHATWG URL"
+curl supports URLs mostly according to how they are defined in RFC 3986, and
+has done so since the beginning.
+
+Web browsers mostly adhere to the WHATWG URL Specification.
+
+This deviance makes some URLs copied between browsers (or returned over HTTP
+for redirection) and curl not work the same way. This can mislead users into
+getting the wrong thing, connecting to the wrong host or otherwise not work
+identically.
+.SH "FTP uses two connections"
+When performing an FTP transfer, two TCP connections are used: one for setting
+up the transfer and one for the actual data.
+
+FTP is not only un-authenticated, but the setting up of the second transfer is
+also a weak spot. The second connection to use for data, is either setup with
+the PORT/EPRT command that makes the server connect back to the client on the
+given IP+PORT, or with PASV/EPSV that makes the server setup a port to listen
+to and tells the client to connect to a given IP+PORT.
+
+Again, un-authenticated means that the connection might be meddled with by a
+man-in-the-middle or that there's a malicious server pretending to be the
+right one.
+
+A malicious FTP server can respond to PASV commands with the IP+PORT of a
+totally different machine. Perhaps even a third party host, and when there are
+many clients trying to connect to that third party, it could create a
+Distributed Denial-Of-Service attack out of it! If the client makes an upload
+operation, it can make the client send the data to another site. If the
+attacker can affect what data the client uploads, it can be made to work as a
+HTTP request and then the client could be made to issue HTTP requests to third
+party hosts.
+
+An attacker that manages to control curl's command line options can tell curl
+to send an FTP PORT command to ask the server to connect to a third party host
+instead of back to curl.
+
+The fact that FTP uses two connections makes it vulnerable in a way that is
+hard to avoid.
+.SH "Denial of Service"
+A malicious server could cause libcurl to effectively hang by sending data
+very slowly, or even no data at all but just keeping the TCP connection open.
+This could effectively result in a denial-of-service attack. The
+\fICURLOPT_TIMEOUT(3)\fP and/or \fICURLOPT_LOW_SPEED_LIMIT(3)\fP options can
+be used to mitigate against this.
+
+A malicious server could cause libcurl to download an infinite amount of data,
+potentially causing all of memory or disk to be filled. Setting the
+\fICURLOPT_MAXFILESIZE_LARGE(3)\fP option is not sufficient to guard against
+this.  Instead, applications should monitor the amount of data received within
+the write or progress callback and abort once the limit is reached.
+
+A malicious HTTP server could cause an infinite redirection loop, causing a
+denial-of-service. This can be mitigated by using the
+\fICURLOPT_MAXREDIRS(3)\fP option.
+.SH "Arbitrary Headers"
+User-supplied data must be sanitized when used in options like
+\fICURLOPT_USERAGENT(3)\fP, \fICURLOPT_HTTPHEADER(3)\fP,
+\fICURLOPT_POSTFIELDS(3)\fP and others that are used to generate structured
+data. Characters like embedded carriage returns or ampersands could allow the
+user to create additional headers or fields that could cause malicious
+transactions.
+.SH "Server-supplied Names"
+A server can supply data which the application may, in some cases, use as a
+file name. The curl command-line tool does this with
+\fI--remote-header-name\fP, using the Content-disposition: header to generate
+a file name.  An application could also use \fICURLINFO_EFFECTIVE_URL(3)\fP to
+generate a file name from a server-supplied redirect URL. Special care must be
+taken to sanitize such names to avoid the possibility of a malicious server
+supplying one like "/etc/passwd", "\\autoexec.bat", "prn:" or even ".bashrc".
+.SH "Server Certificates"
+A secure application should never use the \fICURLOPT_SSL_VERIFYPEER(3)\fP
+option to disable certificate validation. There are numerous attacks that are
+enabled by applications that fail to properly validate server TLS/SSL
+certificates, thus enabling a malicious server to spoof a legitimate
+one. HTTPS without validated certificates is potentially as insecure as a
+plain HTTP connection.
+.SH "Report Security Problems"
+Should you detect or just suspect a security problem in libcurl or curl,
+contact the project curl security team immediately. See the separate
+SECURITY.md document for details.
+.SH "Showing What You Do"
+Relatedly, be aware that in situations when you have problems with libcurl and
+ask someone for help, everything you reveal in order to get best possible help
+might also impose certain security related risks. Host names, user names,
+paths, operating system specifics, etc. (not to mention passwords of course)
+may in fact be used by intruders to gain additional information of a potential
+target.
+
+Be sure to limit access to application logs if they could hold private or
+security-related data.  Besides the obvious candidates like user names and
+passwords, things like URLs, cookies or even file names could also hold
+sensitive data.
+
+To avoid this problem, you must of course use your common sense. Often, you
+can just edit out the sensitive data or just search/replace your true
+information with faked data.
+
diff --git a/docs/libcurl/libgnurl-tutorial.3 b/docs/libcurl/libgnurl-tutorial.3
index 6b23057de..741e08e4b 100644
--- a/docs/libcurl/libgnurl-tutorial.3
+++ b/docs/libcurl/libgnurl-tutorial.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -856,7 +856,7 @@ discussed. Instead, the only way to have SSL work over a 
HTTP proxy is to ask
 the proxy to tunnel trough everything without being able to check or fiddle
 with the traffic.
 
-Opening an SSL connection over a HTTP proxy is therefor a matter of asking the
+Opening an SSL connection over a HTTP proxy is therefore a matter of asking the
 proxy for a straight connection to the target host on a specified port. This
 is made with the HTTP request CONNECT. ("please mr proxy, connect me to that
 remote host").
@@ -1286,234 +1286,7 @@ etc.
 actually true headers, but in this case we pretend they are! ;-)
 
 .SH "Post Transfer Information"
-
- [ curl_easy_getinfo ]
-
-.SH "Security Considerations"
-
-The libcurl project takes security seriously.  The library is written with
-caution and precautions are taken to mitigate many kinds of risks encountered
-while operating with potentially malicious servers on the Internet.  It is a
-powerful library, however, which allows application writers to make trade offs
-between ease of writing and exposure to potential risky operations.  If
-used the right way, you can use libcurl to transfer data pretty safely.
-
-Many applications are used in closed networks where users and servers
-can be trusted, but many others are used on arbitrary servers and are fed
-input from potentially untrusted users.  Following is a discussion about
-some risks in the ways in which applications commonly use libcurl and
-potential mitigations of those risks. It is by no means comprehensive, but
-shows classes of attacks that robust applications should consider. The
-Common Weakness Enumeration project at https://cwe.mitre.org/ is a good
-reference for many of these and similar types of weaknesses of which
-application writers should be aware.
-
-.IP "Command Lines"
-If you use a command line tool (such as curl) that uses libcurl, and you give
-options to the tool on the command line those options can very likely get read
-by other users of your system when they use 'ps' or other tools to list
-currently running processes.
-
-To avoid this problem, never feed sensitive things to programs using command
-line options. Write them to a protected file and use the \-K option to
-avoid this.
-
-.IP ".netrc"
-\&.netrc is a pretty handy file/feature that allows you to login quickly and
-automatically to frequently visited sites. The file contains passwords in
-clear text and is a real security risk. In some cases, your .netrc is also
-stored in a home directory that is NFS mounted or used on another network
-based file system, so the clear text password will fly through your network
-every time anyone reads that file!
-
-To avoid this problem, don't use .netrc files and never store passwords in
-plain text anywhere.
-
-.IP "Clear Text Passwords"
-Many of the protocols libcurl supports send name and password unencrypted as
-clear text (HTTP Basic authentication, FTP, TELNET etc). It is very easy for
-anyone on your network or a network nearby yours to just fire up a network
-analyzer tool and eavesdrop on your passwords. Don't let the fact that HTTP
-Basic uses base64 encoded passwords fool you. They may not look readable at a
-first glance, but they very easily "deciphered" by anyone within seconds.
-
-To avoid this problem, use an authentication mechanism or other protocol that
-doesn't let snoopers see your password: Digest, CRAM-MD5, Kerberos, SPNEGO or
-NTLM authentication, HTTPS, FTPS, SCP and SFTP are a few examples.
-
-.IP "Redirects"
-The \fICURLOPT_FOLLOWLOCATION(3)\fP option automatically follows HTTP
-redirects sent by a remote server.  These redirects can refer to any kind of
-URL, not just HTTP. By default libcurl will allow all protocols on redirect
-except several disabled for security reasons: Since 7.19.4 FILE and SCP are
-disabled, and since 7.40.0 SMB and SMBS are also disabled.
-
-A redirect to a file: URL would cause the libcurl to read (or write) arbitrary
-files from the local filesystem.  If the application returns the data back to
-the user (as would happen in some kinds of CGI scripts), an attacker could
-leverage this to read otherwise forbidden data (e.g.
-file://localhost/etc/passwd).
-
-If authentication credentials are stored in the ~/.netrc file, or Kerberos
-is in use, any other URL type (not just file:) that requires
-authentication is also at risk.  A redirect such as
-ftp://some-internal-server/private-file would then return data even when
-the server is password protected.
-
-In the same way, if an unencrypted SSH private key has been configured for
-the user running the libcurl application, SCP: or SFTP: URLs could access
-password or private-key protected resources,
-e.g. sftp://address@hidden/etc/passwd
-
-The \fICURLOPT_REDIR_PROTOCOLS(3)\fP and \fICURLOPT_NETRC(3)\fP options can be
-used to mitigate against this kind of attack.
-
-A redirect can also specify a location available only on the machine running
-libcurl, including servers hidden behind a firewall from the attacker.
-e.g. http://127.0.0.1/ or http://intranet/delete-stuff.cgi?delete=all or
-tftp://bootp-server/pc-config-data
-
-Apps can mitigate against this by disabling \fICURLOPT_FOLLOWLOCATION(3)\fP
-and handling redirects itself, sanitizing URLs as necessary. Alternately, an
-app could leave \fICURLOPT_FOLLOWLOCATION(3)\fP enabled but set
-\fICURLOPT_REDIR_PROTOCOLS(3)\fP and install a
-\fICURLOPT_OPENSOCKETFUNCTION(3)\fP callback function in which addresses are
-sanitized before use.
-
-.IP "Private Resources"
-A user who can control the DNS server of a domain being passed in within a URL
-can change the address of the host to a local, private address which a
-server-side libcurl-using application could then use. e.g. the innocuous URL
-http://fuzzybunnies.example.com/ could actually resolve to the IP address of a
-server behind a firewall, such as 127.0.0.1 or 10.1.2.3.  Apps can mitigate
-against this by setting a \fICURLOPT_OPENSOCKETFUNCTION(3)\fP and checking the
-address before a connection.
-
-All the malicious scenarios regarding redirected URLs apply just as well to
-non-redirected URLs, if the user is allowed to specify an arbitrary URL that
-could point to a private resource. For example, a web app providing a
-translation service might happily translate file://localhost/etc/passwd and
-display the result.  Apps can mitigate against this with the
-\fICURLOPT_PROTOCOLS(3)\fP option as well as by similar mitigation techniques
-for redirections.
-
-A malicious FTP server could in response to the PASV command return an IP
-address and port number for a server local to the app running libcurl but
-behind a firewall.  Apps can mitigate against this by using the
-\fICURLOPT_FTP_SKIP_PASV_IP(3)\fP option or \fICURLOPT_FTPPORT(3)\fP.
-
-.IP "IPv6 Addresses"
-libcurl will normally handle IPv6 addresses transparently and just as easily
-as IPv4 addresses. That means that a sanitizing function that filters out
-addresses like 127.0.0.1 isn't sufficient--the equivalent IPv6 addresses ::1,
-::, 0:00::0:1, ::127.0.0.1 and ::ffff:7f00:1 supplied somehow by an attacker
-would all bypass a naive filter and could allow access to undesired local
-resources.  IPv6 also has special address blocks like link-local and site-local
-that generally shouldn't be accessed by a server-side libcurl-using
-application.  A poorly-configured firewall installed in a data center,
-organization or server may also be configured to limit IPv4 connections but
-leave IPv6 connections wide open.  In some cases, the CURL_IPRESOLVE_V4 option
-can be used to limit resolved addresses to IPv4 only and bypass these issues.
-
-.IP Uploads
-When uploading, a redirect can cause a local (or remote) file to be
-overwritten.  Apps must not allow any unsanitized URL to be passed in for
-uploads.  Also, \fICURLOPT_FOLLOWLOCATION(3)\fP should not be used on uploads.
-Instead, the app should handle redirects itself, sanitizing each URL first.
-
-.IP Authentication
-Use of \fICURLOPT_UNRESTRICTED_AUTH(3)\fP could cause authentication
-information to be sent to an unknown second server.  Apps can mitigate against
-this by disabling \fICURLOPT_FOLLOWLOCATION(3)\fP and handling redirects
-itself, sanitizing where necessary.
-
-Use of the CURLAUTH_ANY option to \fICURLOPT_HTTPAUTH(3)\fP could result in
-user name and password being sent in clear text to an HTTP server.  Instead,
-use CURLAUTH_ANYSAFE which ensures that the password is encrypted over the
-network, or else fail the request.
-
-Use of the CURLUSESSL_TRY option to \fICURLOPT_USE_SSL(3)\fP could result in
-user name and password being sent in clear text to an FTP server.  Instead,
-use CURLUSESSL_CONTROL to ensure that an encrypted connection is used or else
-fail the request.
-
-.IP Cookies
-If cookies are enabled and cached, then a user could craft a URL which
-performs some malicious action to a site whose authentication is already
-stored in a cookie. e.g. http://mail.example.com/delete-stuff.cgi?delete=all
-Apps can mitigate against this by disabling cookies or clearing them
-between requests.
-
-.IP "Dangerous URLs"
-SCP URLs can contain raw commands within the scp: URL, which is a side effect
-of how the SCP protocol is designed. e.g.
-scp://user:address@hidden/a;date >/tmp/test;
-Apps must not allow unsanitized SCP: URLs to be passed in for downloads.
-
-.IP "Denial of Service"
-A malicious server could cause libcurl to effectively hang by sending a
-trickle of data through, or even no data at all but just keeping the TCP
-connection open.  This could result in a denial-of-service attack. The
-\fICURLOPT_TIMEOUT(3)\fP and/or \fICURLOPT_LOW_SPEED_LIMIT(3)\fP options can
-be used to mitigate against this.
-
-A malicious server could cause libcurl to effectively hang by starting to send
-data, then severing the connection without cleanly closing the TCP connection.
-The app could install a \fICURLOPT_SOCKOPTFUNCTION(3)\fP callback function and
-set the TCP SO_KEEPALIVE option to mitigate against this.  Setting one of the
-timeout options would also work against this attack.
-
-A malicious server could cause libcurl to download an infinite amount of data,
-potentially causing all of memory or disk to be filled. Setting the
-\fICURLOPT_MAXFILESIZE_LARGE(3)\fP option is not sufficient to guard against
-this.  Instead, the app should monitor the amount of data received within the
-write or progress callback and abort once the limit is reached.
-
-A malicious HTTP server could cause an infinite redirection loop, causing a
-denial-of-service. This can be mitigated by using the
-\fICURLOPT_MAXREDIRS(3)\fP option.
-
-.IP "Arbitrary Headers"
-User-supplied data must be sanitized when used in options like
-\fICURLOPT_USERAGENT(3)\fP, \fICURLOPT_HTTPHEADER(3)\fP,
-\fICURLOPT_POSTFIELDS(3)\fP and others that are used to generate structured
-data. Characters like embedded carriage returns or ampersands could allow the
-user to create additional headers or fields that could cause malicious
-transactions.
-
-.IP "Server-supplied Names"
-A server can supply data which the application may, in some cases, use as
-a file name. The curl command-line tool does this with --remote-header-name,
-using the Content-disposition: header to generate a file name.  An application
-could also use CURLINFO_EFFECTIVE_URL to generate a file name from a
-server-supplied redirect URL. Special care must be taken to sanitize such
-names to avoid the possibility of a malicious server supplying one like
-"/etc/passwd", "\\autoexec.bat", "prn:" or even ".bashrc".
-
-.IP "Server Certificates"
-A secure application should never use the \fICURLOPT_SSL_VERIFYPEER(3)\fP
-option to disable certificate validation. There are numerous attacks that are
-enabled by apps that fail to properly validate server TLS/SSL certificates,
-thus enabling a malicious server to spoof a legitimate one. HTTPS without
-validated certificates is potentially as insecure as a plain HTTP connection.
-
-.IP "Showing What You Do"
-On a related issue, be aware that even in situations like when you have
-problems with libcurl and ask someone for help, everything you reveal in order
-to get best possible help might also impose certain security related
-risks. Host names, user names, paths, operating system specifics, etc. (not to
-mention passwords of course) may in fact be used by intruders to gain
-additional information of a potential target.
-
-Be sure to limit access to application logs if they could hold private or
-security-related data.  Besides the obvious candidates like user names and
-passwords, things like URLs, cookies or even file names could also hold
-sensitive data.
-
-To avoid this problem, you must of course use your common sense. Often, you
-can just edit out the sensitive data or just search/replace your true
-information with faked data.
-
+See \fIcurl_easy_getinfo(3)\fP.
 .SH "The multi Interface"
 The easy interface as described in detail in this document is a synchronous
 interface that transfers one file at a time and doesn't return until it is
diff --git a/docs/libcurl/opts/GNURLINFO_FILETIME.3 
b/docs/libcurl/opts/CURLINFO_FILETIME_T.3
similarity index 60%
copy from docs/libcurl/opts/GNURLINFO_FILETIME.3
copy to docs/libcurl/opts/CURLINFO_FILETIME_T.3
index 90a010210..d8853ccd2 100644
--- a/docs/libcurl/opts/GNURLINFO_FILETIME.3
+++ b/docs/libcurl/opts/CURLINFO_FILETIME_T.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -20,23 +20,27 @@
 .\" *
 .\" **************************************************************************
 .\"
-.TH CURLINFO_FILETIME 3 "28 Aug 2015" "libcurl 7.44.0" "curl_easy_getinfo 
options"
+.TH CURLINFO_FILETIME 3 "25 Jan 2018" "libcurl 7.59.0" "curl_easy_getinfo 
options"
 .SH NAME
-CURLINFO_FILETIME \- get the remote time of the retrieved document
+CURLINFO_FILETIME_T \- get the remote time of the retrieved document
 .SH SYNOPSIS
-#include <gnurl/curl.h>
+#include <curl/curl.h>
 
-CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep);
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME_T, curl_off_t 
*timep);
 .SH DESCRIPTION
-Pass a pointer to a long to receive the remote time of the retrieved document
-(in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If you get
--1, it can be because of many reasons (it might be unknown, the server might
-hide it or the server doesn't support the command that tells document time
-etc) and the time of the document is unknown.
+Pass a pointer to a curl_off_t to receive the remote time of the retrieved
+document (in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If
+you get -1, it can be because of many reasons (it might be unknown, the server
+might hide it or the server doesn't support the command that tells document
+time etc) and the time of the document is unknown.
 
-Note that you must tell the server to collect this information before the
-transfer is made, by using the \fICURLOPT_FILETIME(3)\fP option to
-\fIcurl_easy_setopt(3)\fP or you will unconditionally get a -1 back.
+You must ask libcurl to collect this information before the transfer is made,
+by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or
+you will unconditionally get a -1 back.
+
+This option is an alternative to \fICURLINFO_FILETIME(3)\fP to allow systems
+with 32 bit long variables to extract dates outside of the 32bit timestamp
+range.
 .SH PROTOCOLS
 HTTP(S), FTP(S), SFTP
 .SH EXAMPLE
@@ -48,7 +52,8 @@ if(curl) {
   curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
   res = curl_easy_perform(curl);
   if(CURLE_OK == res) {
-    res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
+    curl_off_t filetime;
+    res = curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
     if((CURLE_OK == res) && (filetime >= 0)) {
       time_t file_time = (time_t)filetime;
       printf("filetime %s: %s", filename, ctime(&file_time));
@@ -59,7 +64,7 @@ if(curl) {
 }
 .fi
 .SH AVAILABILITY
-Added in 7.5
+Added in 7.59.0
 .SH RETURN VALUE
 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
 .SH "SEE ALSO"
diff --git a/docs/libcurl/opts/GNURLOPT_CONNECTTIMEOUT_MS.3 
b/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3
similarity index 52%
copy from docs/libcurl/opts/GNURLOPT_CONNECTTIMEOUT_MS.3
copy to docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3
index 7a7ee9302..df6694877 100644
--- a/docs/libcurl/opts/GNURLOPT_CONNECTTIMEOUT_MS.3
+++ b/docs/libcurl/opts/CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3
@@ -20,45 +20,40 @@
 .\" *
 .\" **************************************************************************
 .\"
-.TH CURLOPT_CONNECTTIMEOUT_MS 3 "17 Jun 2014" "libcurl 7.37.0" 
"curl_easy_setopt options"
+.TH CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS 3 "1 Feb 2018" "libcurl 7.59.0" 
"curl_easy_setopt options"
 .SH NAME
-CURLOPT_CONNECTTIMEOUT_MS \- timeout for the connect phase
+CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS \- head start for ipv6 for happy eyeballs
 .SH SYNOPSIS
-#include <gnurl/curl.h>
+#include <curl/curl.h>
 
-CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT_MS, long 
timeout);
+CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, 
long timeout);
 .SH DESCRIPTION
-Pass a long. It should contain the maximum time in milliseconds that you allow
-the connection phase to the server to take.  This only limits the connection
-phase, it has no impact once it has connected. Set to zero to switch to the
-default built-in connection timeout - 300 seconds. See also the
-\fICURLOPT_TIMEOUT_MS(3)\fP option.
+Happy eyeballs is an algorithm that attempts to connect to both IPv4 and IPv6
+addresses for dual-stack hosts, preferring IPv6 first for \fItimeout\fP
+milliseconds. If the IPv6 address cannot be connected to within that time then
+a connection attempt is made to the IPv4 address in parallel. The first
+connection to be established is the one that is used.
 
-In unix-like systems, this might cause signals to be used unless
-\fICURLOPT_NOSIGNAL(3)\fP is set.
-
-If both \fICURLOPT_CONNECTTIMEOUT(3)\fP and \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP
-are set, the value set last will be used.
+The range of suggested useful values for \fItimeout\fP is limited. Happy
+Eyeballs RFC 6555 says "It is RECOMMENDED that connection attempts be paced
+150-250 ms apart to balance human factors against network load." libcurl
+currently defaults to 200 ms. Firefox and Chrome currently default to 300 ms.
 .SH DEFAULT
-300000
-.SH PROTOCOLS
-All
+CURL_HET_DEFAULT (currently defined as 200L)
 .SH EXAMPLE
 .nf
 CURL *curl = curl_easy_init();
 if(curl) {
-  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com";);
-
-  /* complete connection within 10000 milliseconds */
-  curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
+  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com";);
+  curl_easy_setopt(curl, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, 300L);
 
   curl_easy_perform(curl);
+
+  /* always cleanup */
+  curl_easy_cleanup(curl);
 }
 .fi
 .SH AVAILABILITY
-Always
+Added in 7.59.0
 .SH RETURN VALUE
 Returns CURLE_OK
-.SH "SEE ALSO"
-.BR CURLOPT_CONNECTTIMEOUT "(3), " 
-.BR CURLOPT_TIMEOUT "(3), " CURLOPT_LOW_SPEED_LIMIT "(3), "
diff --git a/docs/libcurl/opts/GNURLOPT_STDERR.3 
b/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3
similarity index 57%
copy from docs/libcurl/opts/GNURLOPT_STDERR.3
copy to docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3
index 53f09a2d3..4d8f8793e 100644
--- a/docs/libcurl/opts/GNURLOPT_STDERR.3
+++ b/docs/libcurl/opts/CURLOPT_RESOLVER_START_DATA.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -20,35 +20,44 @@
 .\" *
 .\" **************************************************************************
 .\"
-.TH CURLOPT_STDERR 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
+.TH CURLOPT_RESOLVER_START_DATA 3 "14 Feb 2018" "libcurl 7.59.0" 
"curl_easy_setopt options"
 .SH NAME
-CURLOPT_STDERR \- redirect stderr to another stream
+CURLOPT_RESOLVER_START_DATA \- custom pointer passed to the resolver start 
callback
 .SH SYNOPSIS
-#include <gnurl/curl.h>
+#include <curl/curl.h>
 
-CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STDERR, FILE *stream);
+CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVER_START_DATA, void 
*pointer);
 .SH DESCRIPTION
-Pass a FILE * as parameter. Tell libcurl to use this \fIstream\fP instead of
-stderr when showing the progress meter and displaying \fICURLOPT_VERBOSE(3)\fP
-data.
+Pass a \fIpointer\fP that will be untouched by libcurl and passed as the third
+argument in the resolver start callback set with
+\fICURLOPT_RESOLVER_START_FUNCTION(3)\fP.
 .SH DEFAULT
-stderr
+NULL
 .SH PROTOCOLS
 All
 .SH EXAMPLE
 .nf
+static int resolver_start_cb(void *resolver_state, void *reserved,
+                             void *userdata)
+{
+  (void)reserved;
+  printf("Received resolver_state=%p userdata=%p\\n",
+         resolver_state, userdata);
+  return 0;
+}
+
 CURL *curl = curl_easy_init();
-FILE *filep = fopen("dump", "wb");
 if(curl) {
+  curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_start_cb);
+  curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com";);
-  curl_easy_setopt(curl, CURLOPT_STDERR, filep);
-
   curl_easy_perform(curl);
+  curl_easy_cleanup(curl);
 }
 .fi
 .SH AVAILABILITY
-Always
+Added in 7.59.0
 .SH RETURN VALUE
 Returns CURLE_OK
 .SH "SEE ALSO"
-.BR CURLOPT_VERBOSE "(3), " CURLOPT_NOPROGRESS "(3), "
+.BR CURLOPT_RESOLVER_START_FUNCTION "(3) "
diff --git a/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3 
b/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3
new file mode 100644
index 000000000..fd11910ce
--- /dev/null
+++ b/docs/libcurl/opts/CURLOPT_RESOLVER_START_FUNCTION.3
@@ -0,0 +1,83 @@
+.\" **************************************************************************
+.\" *                                  _   _ ____  _
+.\" *  Project                     ___| | | |  _ \| |
+.\" *                             / __| | | | |_) | |
+.\" *                            | (__| |_| |  _ <| |___
+.\" *                             \___|\___/|_| \_\_____|
+.\" *
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+.\" *
+.\" * This software is licensed as described in the file COPYING, which
+.\" * you should have received as part of this distribution. The terms
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
+.\" *
+.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+.\" * copies of the Software, and permit persons to whom the Software is
+.\" * furnished to do so, under the terms of the COPYING file.
+.\" *
+.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+.\" * KIND, either express or implied.
+.\" *
+.\" **************************************************************************
+.\"
+.TH CURLOPT_RESOLVER_START_FUNCTION 3 "14 Feb 2018" "libcurl 7.59.0" 
"curl_easy_setopt options"
+.SH NAME
+CURLOPT_RESOLVER_START_FUNCTION \- set callback to be called before a new 
resolve request is started
+.SH SYNOPSIS
+.nf
+#include <curl/curl.h>
+
+int resolver_start_cb(void *resolver_state, void *reserved, void *userdata);
+
+CURLcode curl_easy_setopt(CURL *handle,
+                          CURLOPT_RESOLVER_START_FUNCTION,
+                          resolver_start_cb);
+.SH DESCRIPTION
+Pass a pointer to your callback function, which should match the prototype
+shown above.
+
+This callback function gets called by libcurl every time before a new resolve
+request is started.
+
+\fIresolver_state\fP points to a backend-specific resolver state. Currently
+only the ares resolver backend has a resolver state. It can be used to set up
+any desired option on the ares channel before it's used, for example setting up
+socket callback options.
+
+\fIreserved\fP is reserved.
+
+\fIuserdata\fP is the user pointer set with the
+\fICURLOPT_RESOLVER_START_DATA(3)\fP option.
+
+The callback must return 0 on success. Returning a non-zero value will cause
+the resolve to fail.
+.SH DEFAULT
+NULL (No callback)
+.SH PROTOCOLS
+All
+.SH EXAMPLE
+.nf
+static int resolver_start_cb(void *resolver_state, void *reserved,
+                             void *userdata)
+{
+  (void)reserved;
+  printf("Received resolver_state=%p userdata=%p\\n",
+         resolver_state, userdata);
+  return 0;
+}
+
+CURL *curl = curl_easy_init();
+if(curl) {
+  curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_start_cb);
+  curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
+  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com";);
+  curl_easy_perform(curl);
+  curl_easy_cleanup(curl);
+}
+.fi
+.SH AVAILABILITY
+Added in 7.59.0
+.SH RETURN VALUE
+Returns CURLE_OK
+.SH "SEE ALSO"
+.BR CURLOPT_RESOLVER_START_DATA "(3) "
diff --git a/docs/libcurl/opts/GNURLOPT_TIMEVALUE.3 
b/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3
similarity index 65%
copy from docs/libcurl/opts/GNURLOPT_TIMEVALUE.3
copy to docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3
index 65364b72d..884b51236 100644
--- a/docs/libcurl/opts/GNURLOPT_TIMEVALUE.3
+++ b/docs/libcurl/opts/CURLOPT_TIMEVALUE_LARGE.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -20,17 +20,21 @@
 .\" *
 .\" **************************************************************************
 .\"
-.TH CURLOPT_TIMEVALUE 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt 
options"
+.TH CURLOPT_TIMEVALUE_LARGE 3 "25 Jan 2018" "libcurl 7.59.0" "curl_easy_setopt 
options"
 .SH NAME
-CURLOPT_TIMEVALUE \- set time value for conditional
+CURLOPT_TIMEVALUE_LARGE \- set time value for conditional
 .SH SYNOPSIS
-#include <gnurl/curl.h>
+#include <curl/curl.h>
 
-CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, long val);
+CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE_LARGE, curl_off_t 
val);
 .SH DESCRIPTION
-Pass a long \fIval\fP as parameter. This should be the time counted as seconds
-since 1 Jan 1970, and the time will be used in a condition as specified with
-\fICURLOPT_TIMECONDITION(3)\fP.
+Pass a curl_off_t \fIval\fP as parameter. This should be the time counted as
+seconds since 1 Jan 1970, and the time will be used in a condition as
+specified with \fICURLOPT_TIMECONDITION(3)\fP.
+
+The difference between this option and \fICURLOPT_TIMEVALUE(3)\fP is the type
+of the argument. On systems where 'long' is only 32 bit wide, this option has
+to be used to set dates beyond the year 2038.
 .SH DEFAULT
 0
 .SH PROTOCOLS
@@ -42,7 +46,7 @@ if(curl) {
   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com";);
 
   /* January 1, 2020 is 1577833200 */
-  curl_easy_setopt(curl, CURLOPT_TIMEVALUE, 1577833200L);
+  curl_easy_setopt(curl, CURLOPT_TIMEVALUE_LARGE, (curl_off_t)1577833200);
 
   /* If-Modified-Since the above time stamp */
   curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
@@ -52,8 +56,9 @@ if(curl) {
 }
 .fi
 .SH AVAILABILITY
-Always
+Added in 7.59.0.
 .SH RETURN VALUE
 Returns CURLE_OK
 .SH "SEE ALSO"
 .BR CURLOPT_TIMECONDITION "(3), "
+.BR CURLOPT_TIMEVALUE_LARGE "(3), "
diff --git a/docs/libcurl/opts/GNURLINFO_CONDITION_UNMET.3 
b/docs/libcurl/opts/GNURLINFO_CONDITION_UNMET.3
index e83b4e2f7..a52e5f750 100644
--- a/docs/libcurl/opts/GNURLINFO_CONDITION_UNMET.3
+++ b/docs/libcurl/opts/GNURLINFO_CONDITION_UNMET.3
@@ -31,7 +31,7 @@ CURLcode curl_easy_getinfo(CURL *handle, 
CURLINFO_CONDITION_UNMET, long *unmet);
 Pass a pointer to a long to receive the number 1 if the condition provided in
 the previous request didn't match (see \fICURLOPT_TIMECONDITION(3)\fP). Alas,
 if this returns a 1 you know that the reason you didn't get data in return is
-because it didn't fulfill the condition. The long ths argument points to will
+because it didn't fulfill the condition. The long this argument points to will
 get a zero stored if the condition instead was met.
 .SH PROTOCOLS
 HTTP and some
diff --git a/docs/libcurl/opts/GNURLINFO_FILETIME.3 
b/docs/libcurl/opts/GNURLINFO_FILETIME.3
index 90a010210..966cc3821 100644
--- a/docs/libcurl/opts/GNURLINFO_FILETIME.3
+++ b/docs/libcurl/opts/GNURLINFO_FILETIME.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -34,9 +34,12 @@ Pass a pointer to a long to receive the remote time of the 
retrieved document
 hide it or the server doesn't support the command that tells document time
 etc) and the time of the document is unknown.
 
-Note that you must tell the server to collect this information before the
-transfer is made, by using the \fICURLOPT_FILETIME(3)\fP option to
-\fIcurl_easy_setopt(3)\fP or you will unconditionally get a -1 back.
+You must tell libcurl to collect this information before the transfer is made,
+by using the \fICURLOPT_FILETIME(3)\fP option to \fIcurl_easy_setopt(3)\fP or
+you will unconditionally get a -1 back.
+
+Consider using \fICURLINFO_FILETIME_T(3)\fP to be able to extract dates beyond
+the year 2038 on systems using 32 bit longs.
 .SH PROTOCOLS
 HTTP(S), FTP(S), SFTP
 .SH EXAMPLE
diff --git a/docs/libcurl/opts/GNURLOPT_COOKIEFILE.3 
b/docs/libcurl/opts/GNURLOPT_COOKIEFILE.3
index 7faf66474..fcf908631 100644
--- a/docs/libcurl/opts/GNURLOPT_COOKIEFILE.3
+++ b/docs/libcurl/opts/GNURLOPT_COOKIEFILE.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -38,7 +38,8 @@ subsequent requests with this handle.
 
 Given an empty or non-existing file or by passing the empty string ("") to
 this option, you can enable the cookie engine without reading any initial
-cookies.
+cookies. If you tell libcurl the file name is "-" (just a single minus sign),
+libcurl will instead read from stdin.
 
 This option only \fBreads\fP cookies. To make libcurl write cookies to file,
 see \fICURLOPT_COOKIEJAR(3)\fP.
diff --git a/docs/libcurl/opts/GNURLOPT_HEADER.3 
b/docs/libcurl/opts/GNURLOPT_HEADER.3
index 057257eb6..22e56ae6b 100644
--- a/docs/libcurl/opts/GNURLOPT_HEADER.3
+++ b/docs/libcurl/opts/GNURLOPT_HEADER.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -28,14 +28,20 @@ CURLOPT_HEADER \- pass headers to the data stream
 
 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADER, long onoff);
 .SH DESCRIPTION
-Pass in \fIonoff\fP set to 1 to tell the library to include the header in the
-body output for requests with this \fIhandle\fP. This option is relevant for
-protocols that actually have headers or other meta-data (like HTTP and FTP).
+Pass the long value \fIonoff\fP set to 1 to ask libcurl to include the headers
+in the write callback (\fICURLOPT_WRITEFUNCTION(3)\fP). This option is
+relevant for protocols that actually have headers or other meta-data (like
+HTTP and FTP).
 
-When asking to get the header info passed to the same callback as the body, it
-is not possible to accurately separate them again without detailed knowledge
+When asking to get the headers passed to the same callback as the body, it is
+not possible to accurately separate them again without detailed knowledge
 about the protocol in use.
 
+Further: the \fCURLOPT_WRITEFUNCTION(3)\fP callback is limited to only ever
+get a maximum of \fICURL_MAX_WRITE_SIZE\fP bytes passed to it (16KB), while a
+header can be longer and the \fICURLOPT_HEADERFUNCTION(3)\fP supports getting
+called with headers up to \fICURL_MAX_HTTP_HEADER\fP bytes big (100KB).
+
 It is often better to use \fICURLOPT_HEADERFUNCTION(3)\fP to get the header
 data separately.
 
diff --git a/docs/libcurl/opts/GNURLOPT_HEADERFUNCTION.3 
b/docs/libcurl/opts/GNURLOPT_HEADERFUNCTION.3
index bf772b613..e103d578d 100644
--- a/docs/libcurl/opts/GNURLOPT_HEADERFUNCTION.3
+++ b/docs/libcurl/opts/GNURLOPT_HEADERFUNCTION.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -74,6 +74,11 @@ the trailer.
 
 For non-HTTP protocols like FTP, POP3, IMAP and SMTP this function will get
 called with the server responses to the commands that libcurl sends.
+.SH LIMITATIONS
+libcurl does not unfold HTTP "folded headers" (deprecated since RFC 7230). A
+folded header is a header that continues on a subsequent line and starts with
+a whitespace. Such folds will be passed to the header callback as a separate
+one, although strictly it is just a continuation of the previous line.
 .SH DEFAULT
 Nothing.
 .SH PROTOCOLS
diff --git a/docs/libcurl/opts/GNURLOPT_NOPROXY.3 
b/docs/libcurl/opts/GNURLOPT_NOPROXY.3
index 873724484..b6b2a3d66 100644
--- a/docs/libcurl/opts/GNURLOPT_NOPROXY.3
+++ b/docs/libcurl/opts/GNURLOPT_NOPROXY.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -44,6 +44,11 @@ use for both "www.example.com" as well as for 
"foo.example.com".
 Setting the noproxy string to "" (an empty string) will explicitly enable the
 proxy for all host names, even if there is an environment variable set for it.
 
+Enter IPv6 numerical addresses in the list of host names without enclosing
+brackets:
+
+ "example.com,::1,localhost"
+
 The application does not have to keep the string around after setting this
 option.
 .SH "Environment variables"
diff --git a/docs/libcurl/opts/GNURLOPT_PINNEDPUBLICKEY.3 
b/docs/libcurl/opts/GNURLOPT_PINNEDPUBLICKEY.3
index c2fd27068..ff4d60da0 100644
--- a/docs/libcurl/opts/GNURLOPT_PINNEDPUBLICKEY.3
+++ b/docs/libcurl/opts/GNURLOPT_PINNEDPUBLICKEY.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -95,7 +95,9 @@ footer:
 .SH AVAILABILITY
 PEM/DER support:
 
-  7.39.0: OpenSSL, GnuTLS and GSKit
+  7.39.0: OpenSSL, GnuTLS
+
+  7.39.0-7.48.0,7.58.1+: GSKit
 
   7.43.0: NSS and wolfSSL/CyaSSL
 
@@ -105,6 +107,8 @@ PEM/DER support:
 
   7.54.1: SecureTransport/DarwinSSL on macOS 10.7+/iOS 10+
 
+  7.58.1: SChannel/WinSSL
+
 sha256 support:
 
   7.44.0: OpenSSL, GnuTLS, NSS and wolfSSL/CyaSSL
@@ -115,6 +119,8 @@ sha256 support:
 
   7.54.1: SecureTransport/DarwinSSL on macOS 10.7+/iOS 10+
 
+  7.58.1: SChannel/WinSSL Windows XP SP3+
+
 Other SSL backends not supported.
 .SH RETURN VALUE
 Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
diff --git a/docs/libcurl/opts/GNURLOPT_RESOLVE.3 
b/docs/libcurl/opts/GNURLOPT_RESOLVE.3
index e321f000f..b6144a78a 100644
--- a/docs/libcurl/opts/GNURLOPT_RESOLVE.3
+++ b/docs/libcurl/opts/GNURLOPT_RESOLVE.3
@@ -37,10 +37,12 @@ list of \fBstruct curl_slist\fP structs properly filled in. 
Use
 to clean up an entire list.
 
 Each single name resolve string should be written using the format
-HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, PORT is
-the port number of the service where libcurl wants to connect to the HOST and
-ADDRESS is the numerical IP address. If libcurl is built to support IPv6,
-ADDRESS can of course be either IPv4 or IPv6 style addressing.
+HOST:PORT:ADDRESS[,ADDRESS]... where HOST is the name libcurl will try
+to resolve, PORT is the port number of the service where libcurl wants
+to connect to the HOST and ADDRESS is one or more numerical IP
+addresses. If you specify multiple ip addresses they need to be
+separated by comma. If libcurl is built to support IPv6, each of the
+ADDRESS entries can of course be either IPv4 or IPv6 style addressing.
 
 This option effectively pre-populates the DNS cache with entries for the
 host+port pair so redirects and everything that operations against the
@@ -57,6 +59,8 @@ by including a string in the linked list that uses the format
 and port number must exactly match what was already added previously.
 
 Support for providing the ADDRESS within [brackets] was added in 7.57.0.
+
+Support for providing multiple IP addresses per entry was added in 7.59.0.
 .SH DEFAULT
 NULL
 .SH PROTOCOLS
diff --git a/docs/libcurl/opts/GNURLOPT_TIMEVALUE.3 
b/docs/libcurl/opts/GNURLOPT_TIMEVALUE.3
index 65364b72d..3cd2f02b9 100644
--- a/docs/libcurl/opts/GNURLOPT_TIMEVALUE.3
+++ b/docs/libcurl/opts/GNURLOPT_TIMEVALUE.3
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
@@ -31,6 +31,9 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEVALUE, 
long val);
 Pass a long \fIval\fP as parameter. This should be the time counted as seconds
 since 1 Jan 1970, and the time will be used in a condition as specified with
 \fICURLOPT_TIMECONDITION(3)\fP.
+
+On systems with 32 bit 'long' variables, this option cannot set dates beyond
+the year 2038. Consider \fICURLOPT_TIMEVALUE_LARGE(3)\fP instead.
 .SH DEFAULT
 0
 .SH PROTOCOLS
diff --git a/docs/libcurl/opts/Makefile.inc b/docs/libcurl/opts/Makefile.inc
index e8fb5d80d..618eb08f3 100644
--- a/docs/libcurl/opts/Makefile.inc
+++ b/docs/libcurl/opts/Makefile.inc
@@ -14,6 +14,7 @@ man_MANS =                                      \
   GNURLINFO_COOKIELIST.3                         \
   GNURLINFO_EFFECTIVE_URL.3                      \
   GNURLINFO_FILETIME.3                           \
+  GNURLINFO_FILETIME_T.3                         \
   GNURLINFO_FTP_ENTRY_PATH.3                     \
   GNURLINFO_HEADER_SIZE.3                        \
   GNURLINFO_HTTPAUTH_AVAIL.3                     \
@@ -135,6 +136,7 @@ man_MANS =                                      \
   GNURLOPT_FTP_USE_EPSV.3                        \
   GNURLOPT_FTP_USE_PRET.3                        \
   GNURLOPT_GSSAPI_DELEGATION.3                   \
+  GNURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3           \
   GNURLOPT_HEADER.3                              \
   GNURLOPT_HEADERDATA.3                          \
   GNURLOPT_HEADERFUNCTION.3                      \
@@ -240,6 +242,8 @@ man_MANS =                                      \
   GNURLOPT_REFERER.3                             \
   GNURLOPT_REQUEST_TARGET.3                      \
   GNURLOPT_RESOLVE.3                             \
+  GNURLOPT_RESOLVER_START_DATA.3                 \
+  GNURLOPT_RESOLVER_START_FUNCTION.3             \
   GNURLOPT_RESUME_FROM.3                         \
   GNURLOPT_RESUME_FROM_LARGE.3                   \
   GNURLOPT_RTSP_CLIENT_CSEQ.3                    \
@@ -301,6 +305,7 @@ man_MANS =                                      \
   GNURLOPT_TIMEOUT.3                             \
   GNURLOPT_TIMEOUT_MS.3                          \
   GNURLOPT_TIMEVALUE.3                           \
+  GNURLOPT_TIMEVALUE_LARGE.3                     \
   GNURLOPT_TLSAUTH_PASSWORD.3                    \
   GNURLOPT_TLSAUTH_TYPE.3                        \
   GNURLOPT_TLSAUTH_USERNAME.3                    \
diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions
index ab899b9b0..c58086fb7 100644
--- a/docs/libcurl/symbols-in-versions
+++ b/docs/libcurl/symbols-in-versions
@@ -101,6 +101,7 @@ CURLE_QUOTE_ERROR               7.17.0
 CURLE_RANGE_ERROR               7.17.0
 CURLE_READ_ERROR                7.1
 CURLE_RECV_ERROR                7.10
+CURLE_RECURSIVE_API_CALL        7.59.0
 CURLE_REMOTE_ACCESS_DENIED      7.17.0
 CURLE_REMOTE_DISK_FULL          7.17.0
 CURLE_REMOTE_FILE_EXISTS        7.17.0
@@ -220,6 +221,7 @@ CURLINFO_DOUBLE                 7.4.1
 CURLINFO_EFFECTIVE_URL          7.4
 CURLINFO_END                    7.9.6
 CURLINFO_FILETIME               7.5
+CURLINFO_FILETIME_T             7.59.0
 CURLINFO_FTP_ENTRY_PATH         7.15.4
 CURLINFO_HEADER_IN              7.9.6
 CURLINFO_HEADER_OUT             7.9.6
@@ -322,6 +324,7 @@ CURLM_CALL_MULTI_SOCKET         7.15.5
 CURLM_INTERNAL_ERROR            7.9.6
 CURLM_OK                        7.9.6
 CURLM_OUT_OF_MEMORY             7.9.6
+CURLM_RECURSIVE_API_CALL        7.59.0
 CURLM_UNKNOWN_OPTION            7.15.4
 CURLOPTTYPE_FUNCTIONPOINT       7.1
 CURLOPTTYPE_LONG                7.1
@@ -400,6 +403,7 @@ CURLOPT_FTP_USE_EPRT            7.10.5
 CURLOPT_FTP_USE_EPSV            7.9.2
 CURLOPT_FTP_USE_PRET            7.20.0
 CURLOPT_GSSAPI_DELEGATION       7.22.0
+CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS 7.59.0
 CURLOPT_HEADER                  7.1
 CURLOPT_HEADERDATA              7.10
 CURLOPT_HEADERFUNCTION          7.7.2
@@ -587,11 +591,14 @@ CURLOPT_TIMECONDITION           7.1
 CURLOPT_TIMEOUT                 7.1
 CURLOPT_TIMEOUT_MS              7.16.2
 CURLOPT_TIMEVALUE               7.1
+CURLOPT_TIMEVALUE_LARGE         7.59.0
 CURLOPT_TLSAUTH_PASSWORD        7.21.4
 CURLOPT_TLSAUTH_TYPE            7.21.4
 CURLOPT_TLSAUTH_USERNAME        7.21.4
 CURLOPT_TRANSFERTEXT            7.1.1
 CURLOPT_TRANSFER_ENCODING       7.21.6
+CURLOPT_RESOLVER_START_FUNCTION 7.59.0
+CURLOPT_RESOLVER_START_DATA     7.59.0
 CURLOPT_UNIX_SOCKET_PATH        7.40.0
 CURLOPT_UNRESTRICTED_AUTH       7.10.4
 CURLOPT_UPLOAD                  7.1
@@ -737,6 +744,7 @@ CURL_GLOBAL_DEFAULT             7.8
 CURL_GLOBAL_NOTHING             7.8
 CURL_GLOBAL_SSL                 7.8
 CURL_GLOBAL_WIN32               7.8.1
+CURL_HET_DEFAULT                7.59.0
 CURL_HTTPPOST_BUFFER            7.46.0
 CURL_HTTPPOST_CALLBACK          7.46.0
 CURL_HTTPPOST_FILENAME          7.46.0
diff --git a/include/gnurl/curl.h b/include/gnurl/curl.h
index 7680acd18..fa019eca9 100644
--- a/include/gnurl/curl.h
+++ b/include/gnurl/curl.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -245,7 +245,9 @@ typedef size_t (*curl_write_callback)(char *buffer,
                                       size_t nitems,
                                       void *outstream);
 
-
+/* This callback will be called when a new resolver request is made */
+typedef int (*curl_resolver_start_callback)(void *resolver_state,
+                                            void *reserved, void *userdata);
 
 /* enumeration of file types */
 typedef enum {
@@ -577,6 +579,8 @@ typedef enum {
   CURLE_SSL_INVALIDCERTSTATUS,   /* 91 - invalid certificate status */
   CURLE_HTTP2_STREAM,            /* 92 - stream error in HTTP/2 framing layer
                                     */
+  CURLE_RECURSIVE_API_CALL,      /* 93 - an api function was called from
+                                    inside a callback */
   CURL_LAST /* never use! */
 } CURLcode;
 
@@ -789,6 +793,11 @@ typedef enum {
    SSL backends where such behavior is present. */
 #define CURLSSLOPT_NO_REVOKE (1<<1)
 
+/* The default connection attempt delay in milliseconds for happy eyeballs.
+   CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 and happy-eyeballs-timeout-ms.d document
+   this value, keep them in sync. */
+#define CURL_HET_DEFAULT 200L
+
 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
                           the obsolete stuff removed! */
 
@@ -1662,7 +1671,7 @@ typedef enum {
    * Only supported by the c-ares DNS backend */
   CINIT(DNS_LOCAL_IP4, STRINGPOINT, 222),
 
-  /* Set the local IPv4 address to use for outgoing DNS requests.
+  /* Set the local IPv6 address to use for outgoing DNS requests.
    * Only supported by the c-ares DNS backend */
   CINIT(DNS_LOCAL_IP6, STRINGPOINT, 223),
 
@@ -1819,6 +1828,19 @@ typedef enum {
   /* Post MIME data. */
   CINIT(MIMEPOST, OBJECTPOINT, 269),
 
+  /* Time to use with the CURLOPT_TIMECONDITION. Specified in number of
+     seconds since 1 Jan 1970. */
+  CINIT(TIMEVALUE_LARGE, OFF_T, 270),
+
+  /* Head start in milliseconds to give happy eyeballs. */
+  CINIT(HAPPY_EYEBALLS_TIMEOUT_MS, LONG, 271),
+
+  /* Function that will be called before a resolver request is made */
+  CINIT(RESOLVER_START_FUNCTION, FUNCTIONPOINT, 272),
+
+  /* User data to pass to the resolver start callback. */
+  CINIT(RESOLVER_START_DATA, OBJECTPOINT, 273),
+
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
 
@@ -2459,6 +2481,7 @@ typedef enum {
   CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,
   CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,
   CURLINFO_FILETIME         = CURLINFO_LONG   + 14,
+  CURLINFO_FILETIME_T       = CURLINFO_OFF_T  + 14,
   CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,
   CURLINFO_CONTENT_LENGTH_DOWNLOAD_T = CURLINFO_OFF_T  + 15,
   CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,
diff --git a/include/gnurl/curlver.h b/include/gnurl/curlver.h
index 2ee531d8f..5149d2f77 100644
--- a/include/gnurl/curlver.h
+++ b/include/gnurl/curlver.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -26,16 +26,16 @@
    a script at release-time. This was made its own header file in 7.11.2 */
 
 /* This is the global package copyright */
-#define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, <address@hidden>."
+#define LIBCURL_COPYRIGHT "1996 - 2018 Daniel Stenberg, <address@hidden>."
 
 /* This is the version number of the libcurl package from which this header
    file origins: */
-#define LIBCURL_VERSION "7.58.0-DEV"
+#define LIBCURL_VERSION "7.59.0-DEV"
 
 /* The numeric version number is also available "in parts" by using these
    defines: */
 #define LIBCURL_VERSION_MAJOR 7
-#define LIBCURL_VERSION_MINOR 58
+#define LIBCURL_VERSION_MINOR 59
 #define LIBCURL_VERSION_PATCH 0
 
 /* This is the numeric version of the libcurl version number, meant for easier
@@ -57,7 +57,7 @@
    CURL_VERSION_BITS() macro since curl's own configure script greps for it
    and needs it to contain the full number.
 */
-#define LIBCURL_VERSION_NUM 0x073A00
+#define LIBCURL_VERSION_NUM 0x073B00
 
 /*
  * This is the date and time when the full source package was created. The
diff --git a/include/gnurl/multi.h b/include/gnurl/multi.h
index 55efae0be..eab23c08e 100644
--- a/include/gnurl/multi.h
+++ b/include/gnurl/multi.h
@@ -70,6 +70,8 @@ typedef enum {
   CURLM_UNKNOWN_OPTION,  /* curl_multi_setopt() with unsupported option */
   CURLM_ADDED_ALREADY,   /* an easy handle already added to a multi handle was
                             attempted to get added - again */
+  CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
+                               callback */
   CURLM_LAST
 } CURLMcode;
 
@@ -184,8 +186,8 @@ CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
   *
   * Returns: CURLMcode type, general multi error code. *NOTE* that this only
   *          returns errors etc regarding the whole multi stack. There might
-  *          still have occurred problems on invidual transfers even when this
-  *          returns OK.
+  *          still have occurred problems on individual transfers even when
+  *          this returns OK.
   */
 CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
                                          int *running_handles);
diff --git a/include/gnurl/typecheck-gcc.h b/include/gnurl/typecheck-gcc.h
index 10c74c764..3a0f253f6 100644
--- a/include/gnurl/typecheck-gcc.h
+++ b/include/gnurl/typecheck-gcc.h
@@ -54,6 +54,9 @@ __extension__ ({                                              
                \
     if(_curl_is_write_cb_option(_curl_opt))                                   \
       if(!_curl_is_write_cb(value))                                           \
         _curl_easy_setopt_err_write_callback();                               \
+    if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION)                        \
+      if(!_curl_is_resolver_start_callback(value))                            \
+        _curl_easy_setopt_err_resolver_start_callback();                      \
     if((_curl_opt) == CURLOPT_READFUNCTION)                                   \
       if(!_curl_is_read_cb(value))                                            \
         _curl_easy_setopt_err_read_cb();                                      \
@@ -170,6 +173,10 @@ _CURL_WARNING(_curl_easy_setopt_err_string,
   )
 _CURL_WARNING(_curl_easy_setopt_err_write_callback,
   "curl_easy_setopt expects a curl_write_callback argument for this option")
+_CURL_WARNING(_curl_easy_setopt_err_resolver_start_callback,
+              "curl_easy_setopt expects a "
+              "curl_resolver_start_callback argument for this option"
+  )
 _CURL_WARNING(_curl_easy_setopt_err_read_cb,
   "curl_easy_setopt expects a curl_read_callback argument for this option")
 _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
@@ -354,6 +361,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
    (option) == CURLOPT_SSH_KEYDATA ||                                         \
    (option) == CURLOPT_SSL_CTX_DATA ||                                        \
    (option) == CURLOPT_WRITEDATA ||                                           \
+   (option) == CURLOPT_RESOLVER_START_DATA ||                                 \
    0)
 
 /* evaluates to true if option takes a POST data argument (void* or char*) */
@@ -504,6 +512,11 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
   (__builtin_types_compatible_p(__typeof__(func), type) ||                    \
    __builtin_types_compatible_p(__typeof__(func) *, type))
 
+/* evaluates to true if expr is of type curl_resolver_start_callback */
+#define _curl_is_resolver_start_callback(expr)       \
+  (_curl_is_NULL(expr) || \
+   _curl_callback_compatible((expr), curl_resolver_start_callback))
+
 /* evaluates to true if expr is of type curl_read_callback or "similar" */
 #define _curl_is_read_cb(expr)                                          \
   (_curl_is_NULL(expr) ||                                                     \
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
index 61e80cf52..69f9b403d 100644
--- a/lib/Makefile.inc
+++ b/lib/Makefile.inc
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -46,7 +46,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c 
formdata.c   \
   http_digest.c md4.c md5.c http_negotiate.c inet_pton.c strtoofft.c    \
   strerror.c amigaos.c hostasyn.c hostip4.c hostip6.c hostsyn.c         \
   inet_ntop.c parsedate.c select.c tftp.c splay.c strdup.c socks.c      \
-  ssh.c ssh-libssh.c curl_addrinfo.c socks_gssapi.c socks_sspi.c            \
+  ssh.c ssh-libssh.c curl_addrinfo.c socks_gssapi.c socks_sspi.c        \
   curl_sspi.c slist.c nonblock.c curl_memrchr.c imap.c pop3.c smtp.c    \
   pingpong.c rtsp.c curl_threads.c warnless.c hmac.c curl_rtmp.c        \
   openldap.c curl_gethostname.c gopher.c idn_win32.c                    \
@@ -54,7 +54,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c 
formdata.c   \
   http_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_sasl.c rand.c        \
   curl_multibyte.c hostcheck.c conncache.c pipeline.c dotdot.c          \
   x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c      \
-  mime.c sha256.c setopt.c curl_path.c
+  mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c
 
 LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
   formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h         \
@@ -74,7 +74,7 @@ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h 
progress.h \
   curl_setup_once.h multihandle.h setup-vms.h pipeline.h dotdot.h       \
   x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h           \
   curl_printf.h system_win32.h rand.h mime.h curl_sha256.h setopt.h     \
-  curl_path.h
+  curl_path.h curl_ctype.h curl_range.h
 
 LIB_RCFILES = libcurl.rc
 
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index 92af9000c..c86222b21 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -6,7 +6,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 2011 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 2011 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -26,7 +26,7 @@ my $indent = 2;
 
 my $warnings;
 my $errors;
-my $supressed; # whitelisted problems
+my $suppressed; # whitelisted problems
 my $file;
 my $dir=".";
 my $wlist;
@@ -35,10 +35,10 @@ my $verbose;
 my %whitelist;
 
 my %warnings = (
-    'LONGLINE' =>         "Line longer than $max_column",
-    'TABS' =>             'TAB characters not allowed',
-    'TRAILINGSPACE' =>    'Trailing white space on the line',
-    'CPPCOMMENTS' =>      '// comment detected',
+    'LONGLINE'         => "Line longer than $max_column",
+    'TABS'             => 'TAB characters not allowed',
+    'TRAILINGSPACE'    => 'Trailing white space on the line',
+    'CPPCOMMENTS'      => '// comment detected',
     'SPACEBEFOREPAREN' => 'space before an open parenthesis',
     'SPACEAFTERPAREN'  => 'space after open parenthesis',
     'SPACEBEFORECLOSE' => 'space before a close parenthesis',
@@ -58,9 +58,9 @@ my %warnings = (
     'OPENCOMMENT'      => 'file ended with a /* comment still "open"',
     'ASTERISKSPACE'    => 'pointer declared with space after asterisk',
     'ASTERISKNOSPACE'  => 'pointer declared without space before asterisk',
-    'ASSIGNWITHINCONDITION'  => 'assignment within conditional expression',
+    'ASSIGNWITHINCONDITION' => 'assignment within conditional expression',
     'EQUALSNOSPACE'    => 'equals sign without following space',
-    'NOSPACEEQUALS'    => 'equals sign without preceeding space',
+    'NOSPACEEQUALS'    => 'equals sign without preceding space',
     'SEMINOSPACE'      => 'semicolon without following space',
     'MULTISPACE'       => 'multiple spaces used when not suitable',
     );
@@ -101,7 +101,7 @@ sub checkwarn {
     }
 
     if($nowarn) {
-        $supressed++;
+        $suppressed++;
         if($w) {
             $swarnings++;
         }
@@ -142,6 +142,16 @@ while(1) {
         $file = shift @ARGV;
         next;
     }
+    elsif($file =~ /-i([1-9])/) {
+        $indent = $1 + 0;
+        $file = shift @ARGV;
+        next;
+    }
+    elsif($file =~ /-m([0-9]+)/) {
+        $max_column = $1 + 0;
+        $file = shift @ARGV;
+        next;
+    }
     elsif($file =~ /^(-h|--help)/) {
         undef $file;
         last;
@@ -156,6 +166,8 @@ if(!$file) {
     print "  -D[DIR]   Directory to prepend file names\n";
     print "  -h        Show help output\n";
     print "  -W[file]  Whitelist the given file - ignore all its flaws\n";
+    print "  -i<n>     Indent spaces. Default: 2\n";
+    print "  -m<n>     Maximum line length. Default: 79\n";
     print "\nDetects and warns for these problems:\n";
     for(sort keys %warnings) {
         printf (" %-18s: %s\n", $_, $warnings{$_});
@@ -422,7 +434,7 @@ sub scanfile {
                 # There is a quote here, figure out whether the comma is
                 # within a string or '' or not.
                 if($pref =~ /\"/) {
-                    # withing a string
+                    # within a string
                 }
                 elsif($pref =~ /\'$/) {
                     # a single letter
@@ -596,7 +608,7 @@ sub scanfile {
 
 if($errors || $warnings || $verbose) {
     printf "checksrc: %d errors and %d warnings\n", $errors, $warnings;
-    if($supressed) {
+    if($suppressed) {
         printf "checksrc: %d errors and %d warnings suppressed\n",
         $serrors,
         $swarnings;
diff --git a/lib/config-win32.h b/lib/config-win32.h
index 3e5567df2..fdac6f9a2 100644
--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -708,6 +708,11 @@ Vista
 /* Define to use the Windows crypto library. */
 #define USE_WIN32_CRYPTO
 
+/* Define to use Unix sockets. */
+#if defined(_MSC_VER) && _MSC_VER >= 1900
+/* #define USE_UNIX_SOCKETS */
+#endif
+
 /* ---------------------------------------------------------------- */
 /*                       ADDITIONAL DEFINITIONS                     */
 /* ---------------------------------------------------------------- */
diff --git a/lib/connect.c b/lib/connect.c
index 3edb71eb7..1a27ae135 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -619,8 +619,8 @@ void Curl_persistconninfo(struct connectdata *conn)
 
 /* retrieves ip address and port from a sockaddr structure.
    note it calls Curl_inet_ntop which sets errno on fail, not SOCKERRNO. */
-static bool getaddressinfo(struct sockaddr *sa, char *addr,
-                           long *port)
+bool Curl_getaddressinfo(struct sockaddr *sa, char *addr,
+                         long *port)
 {
   unsigned short us_port;
   struct sockaddr_in *si = NULL;
@@ -700,16 +700,16 @@ void Curl_updateconninfo(struct connectdata *conn, 
curl_socket_t sockfd)
       return;
     }
 
-    if(!getaddressinfo((struct sockaddr*)&ssrem,
-                        conn->primary_ip, &conn->primary_port)) {
+    if(!Curl_getaddressinfo((struct sockaddr*)&ssrem,
+                            conn->primary_ip, &conn->primary_port)) {
       failf(data, "ssrem inet_ntop() failed with errno %d: %s",
             errno, Curl_strerror(conn, errno));
       return;
     }
     memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);
 
-    if(!getaddressinfo((struct sockaddr*)&ssloc,
-                       conn->local_ip, &conn->local_port)) {
+    if(!Curl_getaddressinfo((struct sockaddr*)&ssloc,
+                            conn->local_ip, &conn->local_port)) {
       failf(data, "ssloc inet_ntop() failed with errno %d: %s",
             errno, Curl_strerror(conn, errno));
       return;
@@ -783,7 +783,8 @@ CURLcode Curl_is_connected(struct connectdata *conn,
 
       /* should we try another protocol family? */
       if(i == 0 && conn->tempaddr[1] == NULL &&
-         Curl_timediff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) {
+         (Curl_timediff(now, conn->connecttime) >=
+          data->set.happy_eyeballs_timeout)) {
         trynextip(conn, sockindex, 1);
       }
     }
@@ -1005,8 +1006,8 @@ static CURLcode singleipconnect(struct connectdata *conn,
     return CURLE_OK;
 
   /* store remote address and port used in this connection attempt */
-  if(!getaddressinfo((struct sockaddr*)&addr.sa_addr,
-                     ipaddress, &port)) {
+  if(!Curl_getaddressinfo((struct sockaddr*)&addr.sa_addr,
+                          ipaddress, &port)) {
     /* malformed address or bug in inet_ntop, try next address */
     failf(data, "sa_addr inet_ntop() failed with errno %d: %s",
           errno, Curl_strerror(conn, errno));
@@ -1033,9 +1034,11 @@ static CURLcode singleipconnect(struct connectdata *conn,
 
   if(data->set.fsockopt) {
     /* activate callback for setting socket options */
+    Curl_set_in_callback(data, true);
     error = data->set.fsockopt(data->set.sockopt_client,
                                sockfd,
                                CURLSOCKTYPE_IPCXN);
+    Curl_set_in_callback(data, false);
 
     if(error == CURL_SOCKOPT_ALREADY_CONNECTED)
       isconnected = TRUE;
@@ -1204,7 +1207,8 @@ CURLcode Curl_connecthost(struct connectdata *conn,  /* 
context */
   }
 
   data->info.numconnects++; /* to track the number of connections made */
-  Curl_expire(conn->data, HAPPY_EYEBALLS_TIMEOUT, EXPIRE_HAPPY_EYEBALLS);
+  Curl_expire(conn->data, data->set.happy_eyeballs_timeout,
+              EXPIRE_HAPPY_EYEBALLS);
 
   return CURLE_OK;
 }
@@ -1311,8 +1315,12 @@ int Curl_closesocket(struct connectdata *conn,
          status */
       conn->sock_accepted[SECONDARYSOCKET] = FALSE;
     else {
+      int rc;
       Curl_multi_closed(conn, sock);
-      return conn->fclosesocket(conn->closesocket_client, sock);
+      Curl_set_in_callback(conn->data, true);
+      rc = conn->fclosesocket(conn->closesocket_client, sock);
+      Curl_set_in_callback(conn->data, false);
+      return rc;
     }
   }
 
@@ -1363,7 +1371,7 @@ CURLcode Curl_socket(struct connectdata *conn,
      addr->addrlen = sizeof(struct Curl_sockaddr_storage);
   memcpy(&addr->sa_addr, ai->ai_addr, addr->addrlen);
 
-  if(data->set.fopensocket)
+  if(data->set.fopensocket) {
    /*
     * If the opensocket callback is set, all the destination address
     * information is passed to the callback. Depending on this information the
@@ -1373,9 +1381,12 @@ CURLcode Curl_socket(struct connectdata *conn,
     * might have been changed and this 'new' address will actually be used
     * here to connect.
     */
+    Curl_set_in_callback(data, true);
     *sockfd = data->set.fopensocket(data->set.opensocket_client,
                                     CURLSOCKTYPE_IPCXN,
                                     (struct curl_sockaddr *)addr);
+    Curl_set_in_callback(data, false);
+  }
   else
     /* opensocket callback not set, so simply create the socket now */
     *sockfd = socket(addr->family, addr->socktype, addr->protocol);
diff --git a/lib/connect.h b/lib/connect.h
index 397448636..193dc6397 100644
--- a/lib/connect.h
+++ b/lib/connect.h
@@ -41,8 +41,6 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
                          bool duringconnect);
 
 #define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */
-#define HAPPY_EYEBALLS_TIMEOUT     200 /* milliseconds to wait between
-                                          IPv4/IPv6 connection attempts */
 
 /*
  * Used to extract socket and connectdata struct for the most recent
@@ -78,6 +76,11 @@ void Curl_persistconninfo(struct connectdata *conn);
 int Curl_closesocket(struct connectdata *conn, curl_socket_t sock);
 
 /*
+ * Get presentation format IP address and port from a sockaddr.
+ */
+bool Curl_getaddressinfo(struct sockaddr *sa, char *addr, long *port);
+
+/*
  * The Curl_sockaddr_ex structure is basically libcurl's external API
  * curl_sockaddr structure with enough space available to directly hold any
  * protocol-specific address structures. The variable declared here will be
diff --git a/lib/content_encoding.c b/lib/content_encoding.c
index eb6d7dca3..047245170 100644
--- a/lib/content_encoding.c
+++ b/lib/content_encoding.c
@@ -726,7 +726,7 @@ static void identity_close_writer(struct connectdata *conn,
 
 static const content_encoding identity_encoding = {
   "identity",
-  NULL,
+  "none",
   identity_init_writer,
   identity_unencode_write,
   identity_close_writer,
diff --git a/lib/cookie.c b/lib/cookie.c
index c7afc7ae3..63deee163 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -430,9 +430,6 @@ Curl_cookie_add(struct Curl_easy *data,
         size_t nlen = strlen(name);
         const char *endofn = &ptr[ nlen ];
 
-        infof(data, "cookie size: name/val %d + %d bytes\n",
-              nlen, len);
-
         if(nlen >= (MAX_NAME-1) || len >= (MAX_NAME-1) ||
            ((nlen + len) > MAX_NAME)) {
           /* too long individual name or contents, or too long combination of
diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c
index e1e3b2bfe..b289a4831 100644
--- a/lib/curl_addrinfo.c
+++ b/lib/curl_addrinfo.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -50,6 +50,10 @@
 #  define in_addr_t unsigned long
 #endif
 
+#if defined(WIN32) && defined(USE_UNIX_SOCKETS)
+#include <afunix.h>
+#endif
+
 #include <stddef.h>
 
 #include "curl_addrinfo.h"
diff --git a/lib/curl_ctype.c b/lib/curl_ctype.c
new file mode 100644
index 000000000..4f5abc207
--- /dev/null
+++ b/lib/curl_ctype.c
@@ -0,0 +1,122 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+
+#undef _U
+#define _U (1<<0) /* upper case */
+#undef _L
+#define _L (1<<1) /* lower case */
+#undef _N
+#define _N (1<<2) /* decimal numerical digit */
+#undef _S
+#define _S (1<<3) /* space */
+#undef _P
+#define _P (1<<4) /* punctuation */
+#undef _C
+#define _C (1<<5) /* control */
+#undef _X
+#define _X (1<<6) /* hexadecimal letter */
+#undef _B
+#define _B (1<<7) /* blank */
+
+static const unsigned char ascii[128] = {
+  _C,   _C,     _C,     _C,     _C,     _C,     _C,     _C,
+  _C,   _C|_S,  _C|_S,  _C|_S,  _C|_S,  _C|_S,  _C,     _C,
+  _C,   _C,     _C,     _C,     _C,     _C,     _C,     _C,
+  _C,   _C,     _C,     _C,     _C,     _C,     _C,     _C,
+  _S|_B, _P,    _P,     _P,     _P,     _P,     _P,     _P,
+  _P,   _P,     _P,     _P,     _P,     _P,     _P,     _P,
+  _N,   _N,     _N,     _N,     _N,     _N,     _N,     _N,
+  _N,   _N,     _P,     _P,     _P,     _P,     _P,     _P,
+  _P,   _U|_X,  _U|_X,  _U|_X,  _U|_X,  _U|_X,  _U|_X,  _U,
+  _U,   _U,     _U,     _U,     _U,     _U,     _U,     _U,
+  _U,   _U,     _U,     _U,     _U,     _U,     _U,     _U,
+  _U,   _U,     _U,     _P,     _P,     _P,     _P,     _P,
+  _P,   _L|_X,  _L|_X,  _L|_X,  _L|_X,  _L|_X,  _L|_X,  _L,
+  _L,   _L,     _L,     _L,     _L,     _L,     _L,     _L,
+  _L,   _L,     _L,     _L,     _L,     _L,     _L,     _L,
+  _L,   _L,     _L,     _P,     _P,     _P,     _P,     _C
+};
+
+int Curl_isspace(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & _S);
+}
+
+int Curl_isdigit(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & _N);
+}
+
+int Curl_isalnum(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & (_N|_U|_L));
+}
+
+int Curl_isxdigit(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & (_N|_X));
+}
+
+int Curl_isgraph(int c)
+{
+  if((c < 0) || (c >= 0x80) || (c == ' '))
+    return FALSE;
+  return (ascii[c] & (_N|_X|_U|_L|_P|_S));
+}
+
+int Curl_isprint(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & (_N|_X|_U|_L|_P|_S));
+}
+
+int Curl_isalpha(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & (_U|_L));
+}
+
+int Curl_isupper(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & (_U));
+}
+
+int Curl_islower(int c)
+{
+  if((c < 0) || (c >= 0x80))
+    return FALSE;
+  return (ascii[c] & (_L));
+}
diff --git a/lib/curl_ctype.h b/lib/curl_ctype.h
new file mode 100644
index 000000000..da3bd95a6
--- /dev/null
+++ b/lib/curl_ctype.h
@@ -0,0 +1,48 @@
+#ifndef HEADER_CURL_CTYPE_H
+#define HEADER_CURL_CTYPE_H
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+int Curl_isspace(int c);
+int Curl_isdigit(int c);
+int Curl_isalnum(int c);
+int Curl_isxdigit(int c);
+int Curl_isgraph(int c);
+int Curl_isprint(int c);
+int Curl_isalpha(int c);
+int Curl_isupper(int c);
+int Curl_islower(int c);
+
+#define ISSPACE(x)  (Curl_isspace((int)  ((unsigned char)x)))
+#define ISDIGIT(x)  (Curl_isdigit((int)  ((unsigned char)x)))
+#define ISALNUM(x)  (Curl_isalnum((int)  ((unsigned char)x)))
+#define ISXDIGIT(x) (Curl_isxdigit((int) ((unsigned char)x)))
+#define ISGRAPH(x)  (Curl_isgraph((int)  ((unsigned char)x)))
+#define ISALPHA(x)  (Curl_isalpha((int)  ((unsigned char)x)))
+#define ISPRINT(x)  (Curl_isprint((int)  ((unsigned char)x)))
+#define ISUPPER(x)  (Curl_isupper((int)  ((unsigned char)x)))
+#define ISLOWER(x)  (Curl_islower((int)  ((unsigned char)x)))
+#define ISASCII(x)  (((x) >= 0) && ((x) <= 0x80))
+#define ISBLANK(x)  (int)((((unsigned char)x) == ' ') ||        \
+                          (((unsigned char)x) == '\t'))
+
+#endif /* HEADER_CURL_CTYPE_H */
diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c
index d8c86bbd5..c6c905600 100644
--- a/lib/curl_fnmatch.c
+++ b/lib/curl_fnmatch.c
@@ -47,14 +47,7 @@
 #define CURLFNM_UPPER   (CURLFNM_CHARSET_LEN + 10)
 
 typedef enum {
-  CURLFNM_LOOP_DEFAULT = 0,
-  CURLFNM_LOOP_BACKSLASH
-} loop_state;
-
-typedef enum {
   CURLFNM_SCHS_DEFAULT = 0,
-  CURLFNM_SCHS_MAYRANGE,
-  CURLFNM_SCHS_MAYRANGE2,
   CURLFNM_SCHS_RIGHTBR,
   CURLFNM_SCHS_RIGHTBRLEFTBR
 } setcharset_state;
@@ -64,6 +57,13 @@ typedef enum {
   CURLFNM_PKW_DDOT
 } parsekey_state;
 
+typedef enum {
+  CCLASS_OTHER = 0,
+  CCLASS_DIGIT,
+  CCLASS_UPPER,
+  CCLASS_LOWER
+} char_class;
+
 #define SETCHARSET_OK     1
 #define SETCHARSET_FAIL   0
 
@@ -81,12 +81,12 @@ static int parsekeyword(unsigned char **pattern, unsigned 
char *charset)
       return SETCHARSET_FAIL;
     switch(state) {
     case CURLFNM_PKW_INIT:
-      if(ISALPHA(c) && ISLOWER(c))
+      if(ISLOWER(c))
         keyword[i] = c;
       else if(c == ':')
         state = CURLFNM_PKW_DDOT;
       else
-        return 0;
+        return SETCHARSET_FAIL;
       break;
     case CURLFNM_PKW_DDOT:
       if(c == ']')
@@ -123,14 +123,48 @@ static int parsekeyword(unsigned char **pattern, unsigned 
char *charset)
   return SETCHARSET_OK;
 }
 
+/* Return the character class. */
+static char_class charclass(unsigned char c)
+{
+  if(ISUPPER(c))
+    return CCLASS_UPPER;
+  if(ISLOWER(c))
+    return CCLASS_LOWER;
+  if(ISDIGIT(c))
+    return CCLASS_DIGIT;
+  return CCLASS_OTHER;
+}
+
+/* Include a character or a range in set. */
+static void setcharorrange(unsigned char **pp, unsigned char *charset)
+{
+  unsigned char *p = (*pp)++;
+  unsigned char c = *p++;
+
+  charset[c] = 1;
+  if(ISALNUM(c) && *p++ == '-') {
+    char_class cc = charclass(c);
+    unsigned char endrange = *p++;
+
+    if(endrange == '\\')
+      endrange = *p++;
+    if(endrange >= c && charclass(endrange) == cc) {
+      while(c++ != endrange)
+        if(charclass(c) == cc)  /* Chars in class may be not consecutive. */
+          charset[c] = 1;
+      *pp = p;
+    }
+  }
+}
+
 /* returns 1 (true) if pattern is OK, 0 if is bad ("p" is pattern pointer) */
 static int setcharset(unsigned char **p, unsigned char *charset)
 {
   setcharset_state state = CURLFNM_SCHS_DEFAULT;
-  unsigned char rangestart = 0;
-  unsigned char lastchar   = 0;
   bool something_found = FALSE;
   unsigned char c;
+
+  memset(charset, 0, CURLFNM_CHSET_SIZE);
   for(;;) {
     c = **p;
     if(!c)
@@ -138,14 +172,7 @@ static int setcharset(unsigned char **p, unsigned char 
*charset)
 
     switch(state) {
     case CURLFNM_SCHS_DEFAULT:
-      if(ISALNUM(c)) { /* ASCII value */
-        rangestart = c;
-        charset[c] = 1;
-        (*p)++;
-        state = CURLFNM_SCHS_MAYRANGE;
-        something_found = TRUE;
-      }
-      else if(c == ']') {
+      if(c == ']') {
         if(something_found)
           return SETCHARSET_OK;
         something_found = TRUE;
@@ -154,26 +181,16 @@ static int setcharset(unsigned char **p, unsigned char 
*charset)
         (*p)++;
       }
       else if(c == '[') {
-        char c2 = *((*p) + 1);
-        if(c2 == ':') { /* there has to be a keyword */
-          (*p) += 2;
-          if(parsekeyword(p, charset)) {
-            state = CURLFNM_SCHS_DEFAULT;
-          }
-          else
-            return SETCHARSET_FAIL;
-        }
+        unsigned char *pp = *p + 1;
+
+        if(*pp++ == ':' && parsekeyword(&pp, charset))
+          *p = pp;
         else {
           charset[c] = 1;
           (*p)++;
         }
         something_found = TRUE;
       }
-      else if(c == '?' || c == '*') {
-        something_found = TRUE;
-        charset[c] = 1;
-        (*p)++;
-      }
       else if(c == '^' || c == '!') {
         if(!something_found) {
           if(charset[CURLFNM_NEGATE]) {
@@ -189,82 +206,17 @@ static int setcharset(unsigned char **p, unsigned char 
*charset)
       }
       else if(c == '\\') {
         c = *(++(*p));
-        if(ISPRINT((c))) {
-          something_found = TRUE;
-          state = CURLFNM_SCHS_MAYRANGE;
-          charset[c] = 1;
-          rangestart = c;
-          (*p)++;
-        }
+        if(c)
+          setcharorrange(p, charset);
         else
-          return SETCHARSET_FAIL;
+          charset['\\'] = 1;
+        something_found = TRUE;
       }
       else {
-        charset[c] = 1;
-        (*p)++;
+        setcharorrange(p, charset);
         something_found = TRUE;
       }
       break;
-    case CURLFNM_SCHS_MAYRANGE:
-      if(c == '-') {
-        charset[c] = 1;
-        (*p)++;
-        lastchar = '-';
-        state = CURLFNM_SCHS_MAYRANGE2;
-      }
-      else if(c == '[') {
-        state = CURLFNM_SCHS_DEFAULT;
-      }
-      else if(ISALNUM(c)) {
-        charset[c] = 1;
-        (*p)++;
-      }
-      else if(c == '\\') {
-        c = *(++(*p));
-        if(ISPRINT(c)) {
-          charset[c] = 1;
-          (*p)++;
-        }
-        else
-          return SETCHARSET_FAIL;
-      }
-      else if(c == ']') {
-        return SETCHARSET_OK;
-      }
-      else
-        return SETCHARSET_FAIL;
-      break;
-    case CURLFNM_SCHS_MAYRANGE2:
-      if(c == ']') {
-        return SETCHARSET_OK;
-      }
-      else if(c == '\\') {
-        c = *(++(*p));
-        if(ISPRINT(c)) {
-          charset[c] = 1;
-          state = CURLFNM_SCHS_DEFAULT;
-          (*p)++;
-        }
-        else
-          return SETCHARSET_FAIL;
-      }
-      else if(c >= rangestart) {
-        if((ISLOWER(c) && ISLOWER(rangestart)) ||
-           (ISDIGIT(c) && ISDIGIT(rangestart)) ||
-           (ISUPPER(c) && ISUPPER(rangestart))) {
-          charset[lastchar] = 0;
-          rangestart++;
-          while(rangestart++ <= c)
-            charset[rangestart-1] = 1;
-          (*p)++;
-          state = CURLFNM_SCHS_DEFAULT;
-        }
-        else
-          return SETCHARSET_FAIL;
-      }
-      else
-        return SETCHARSET_FAIL;
-      break;
     case CURLFNM_SCHS_RIGHTBR:
       if(c == '[') {
         state = CURLFNM_SCHS_RIGHTBRLEFTBR;
@@ -286,14 +238,11 @@ static int setcharset(unsigned char **p, unsigned char 
*charset)
         goto fail;
       break;
     case CURLFNM_SCHS_RIGHTBRLEFTBR:
-      if(c == ']') {
+      if(c == ']')
         return SETCHARSET_OK;
-      }
-      else {
-        state  = CURLFNM_SCHS_DEFAULT;
-        charset[c] = 1;
-        (*p)++;
-      }
+      state  = CURLFNM_SCHS_DEFAULT;
+      charset[c] = 1;
+      (*p)++;
       break;
     }
   }
@@ -304,107 +253,93 @@ fail:
 static int loop(const unsigned char *pattern, const unsigned char *string,
                 int maxstars)
 {
-  loop_state state = CURLFNM_LOOP_DEFAULT;
   unsigned char *p = (unsigned char *)pattern;
   unsigned char *s = (unsigned char *)string;
   unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 };
-  int rc = 0;
 
   for(;;) {
-    switch(state) {
-    case CURLFNM_LOOP_DEFAULT:
-      if(*p == '*') {
-        if(!maxstars)
-          return CURL_FNMATCH_NOMATCH;
-        while(*(p + 1) == '*') /* eliminate multiple stars */
-          p++;
-        if(*s == '\0' && *(p + 1) == '\0')
-          return CURL_FNMATCH_MATCH;
-        rc = loop(p + 1, s, maxstars - 1); /* *.txt matches .txt <=>
-                                              .txt matches .txt */
-        if(rc == CURL_FNMATCH_MATCH)
+    unsigned char *pp;
+
+    switch(*p) {
+    case '*':
+      if(!maxstars)
+        return CURL_FNMATCH_NOMATCH;
+      /* Regroup consecutive stars and question marks. This can be done because
+         '*?*?*' can be expressed as '??*'. */
+      for(;;) {
+        if(*++p == '\0')
           return CURL_FNMATCH_MATCH;
-        if(*s) /* let the star eat up one character */
-          s++;
-        else
-          return CURL_FNMATCH_NOMATCH;
-      }
-      else if(*p == '?') {
-        if(ISPRINT(*s)) {
-          s++;
-          p++;
+        if(*p == '?') {
+          if(!*s++)
+            return CURL_FNMATCH_NOMATCH;
         }
-        else if(*s == '\0')
-          return CURL_FNMATCH_NOMATCH;
-        else
-          return CURL_FNMATCH_FAIL; /* cannot deal with other character */
+        else if(*p != '*')
+          break;
       }
-      else if(*p == '\0') {
-        if(*s == '\0')
+      /* Skip string characters until we find a match with pattern suffix. */
+      for(maxstars--; *s; s++) {
+        if(loop(p, s, maxstars) == CURL_FNMATCH_MATCH)
           return CURL_FNMATCH_MATCH;
-        return CURL_FNMATCH_NOMATCH;
       }
-      else if(*p == '\\') {
-        state = CURLFNM_LOOP_BACKSLASH;
+      return CURL_FNMATCH_NOMATCH;
+    case '?':
+      if(!*s)
+        return CURL_FNMATCH_NOMATCH;
+      s++;
+      p++;
+      break;
+    case '\0':
+      return *s? CURL_FNMATCH_NOMATCH: CURL_FNMATCH_MATCH;
+    case '\\':
+      if(p[1])
         p++;
-      }
-      else if(*p == '[') {
-        unsigned char *pp = p + 1; /* cannot handle with pointer to register */
-        if(setcharset(&pp, charset)) {
-          int found = FALSE;
-          if(charset[(unsigned int)*s])
-            found = TRUE;
-          else if(charset[CURLFNM_ALNUM])
-            found = ISALNUM(*s);
-          else if(charset[CURLFNM_ALPHA])
-            found = ISALPHA(*s);
-          else if(charset[CURLFNM_DIGIT])
-            found = ISDIGIT(*s);
-          else if(charset[CURLFNM_XDIGIT])
-            found = ISXDIGIT(*s);
-          else if(charset[CURLFNM_PRINT])
-            found = ISPRINT(*s);
-          else if(charset[CURLFNM_SPACE])
-            found = ISSPACE(*s);
-          else if(charset[CURLFNM_UPPER])
-            found = ISUPPER(*s);
-          else if(charset[CURLFNM_LOWER])
-            found = ISLOWER(*s);
-          else if(charset[CURLFNM_BLANK])
-            found = ISBLANK(*s);
-          else if(charset[CURLFNM_GRAPH])
-            found = ISGRAPH(*s);
+      if(*s++ != *p++)
+        return CURL_FNMATCH_NOMATCH;
+      break;
+    case '[':
+      pp = p + 1; /* Copy in case of syntax error in set. */
+      if(setcharset(&pp, charset)) {
+        int found = FALSE;
+        if(!*s)
+          return CURL_FNMATCH_NOMATCH;
+        if(charset[(unsigned int)*s])
+          found = TRUE;
+        else if(charset[CURLFNM_ALNUM])
+          found = ISALNUM(*s);
+        else if(charset[CURLFNM_ALPHA])
+          found = ISALPHA(*s);
+        else if(charset[CURLFNM_DIGIT])
+          found = ISDIGIT(*s);
+        else if(charset[CURLFNM_XDIGIT])
+          found = ISXDIGIT(*s);
+        else if(charset[CURLFNM_PRINT])
+          found = ISPRINT(*s);
+        else if(charset[CURLFNM_SPACE])
+          found = ISSPACE(*s);
+        else if(charset[CURLFNM_UPPER])
+          found = ISUPPER(*s);
+        else if(charset[CURLFNM_LOWER])
+          found = ISLOWER(*s);
+        else if(charset[CURLFNM_BLANK])
+          found = ISBLANK(*s);
+        else if(charset[CURLFNM_GRAPH])
+          found = ISGRAPH(*s);
 
-          if(charset[CURLFNM_NEGATE])
-            found = !found;
+        if(charset[CURLFNM_NEGATE])
+          found = !found;
 
-          if(found) {
-            p = pp + 1;
-            if(*s)
-              /* don't advance if we're matching on an empty string */
-              s++;
-            memset(charset, 0, CURLFNM_CHSET_SIZE);
-          }
-          else
-            return CURL_FNMATCH_NOMATCH;
-        }
-        else
-          return CURL_FNMATCH_FAIL;
-      }
-      else {
-        if(*p++ != *s++)
+        if(!found)
           return CURL_FNMATCH_NOMATCH;
+        p = pp + 1;
+        s++;
+        break;
       }
-      break;
-    case CURLFNM_LOOP_BACKSLASH:
-      if(ISPRINT(*p)) {
-        if(*p++ == *s++)
-          state = CURLFNM_LOOP_DEFAULT;
-        else
-          return CURL_FNMATCH_NOMATCH;
-      }
-      else
-        return CURL_FNMATCH_FAIL;
+
+      /* Syntax error in set: this must be taken as a regular character. */
+      /* FALLTHROUGH */
+    default:
+      if(*p++ != *s++)
+        return CURL_FNMATCH_NOMATCH;
       break;
     }
   }
diff --git a/lib/curl_gssapi.c b/lib/curl_gssapi.c
index 83f3fa0c4..f007986c0 100644
--- a/lib/curl_gssapi.c
+++ b/lib/curl_gssapi.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2011 - 2016, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 2011 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -27,6 +27,11 @@
 #include "curl_gssapi.h"
 #include "sendf.h"
 
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "memdebug.h"
+
 static char spnego_oid_bytes[] = "\x2b\x06\x01\x05\x05\x02";
 gss_OID_desc Curl_spnego_mech_oid = { 6, &spnego_oid_bytes };
 static char krb5_oid_bytes[] = "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02";
diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c
index 03f47a3a5..353a65645 100644
--- a/lib/curl_ntlm_wb.c
+++ b/lib/curl_ntlm_wb.c
@@ -364,7 +364,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
   case NTLMSTATE_TYPE1:
   default:
     /* Use Samba's 'winbind' daemon to support NTLM authentication,
-     * by delegating the NTLM challenge/response protocal to a helper
+     * by delegating the NTLM challenge/response protocol to a helper
      * in ntlm_auth.
      * http://devel.squid-cache.org/ntlm/squid_helper_protocol.html
      * https://www.samba.org/samba/docs/man/manpages-3/winbindd.8.html
diff --git a/lib/curl_range.c b/lib/curl_range.c
new file mode 100644
index 000000000..aa3c49332
--- /dev/null
+++ b/lib/curl_range.c
@@ -0,0 +1,95 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+#include <curl/curl.h>
+#include "curl_range.h"
+#include "sendf.h"
+#include "strtoofft.h"
+
+/* Only include this function if one or more of FTP, FILE are enabled. */
+#if !defined(CURL_DISABLE_FTP) || !defined(CURL_DISABLE_FILE)
+
+ /*
+  Check if this is a range download, and if so, set the internal variables
+  properly.
+ */
+CURLcode Curl_range(struct connectdata *conn)
+{
+  curl_off_t from, to;
+  char *ptr;
+  char *ptr2;
+  struct Curl_easy *data = conn->data;
+
+  if(data->state.use_range && data->state.range) {
+    CURLofft from_t;
+    CURLofft to_t;
+    from_t = curlx_strtoofft(data->state.range, &ptr, 0, &from);
+    if(from_t == CURL_OFFT_FLOW)
+      return CURLE_RANGE_ERROR;
+    while(*ptr && (ISSPACE(*ptr) || (*ptr == '-')))
+      ptr++;
+    to_t = curlx_strtoofft(ptr, &ptr2, 0, &to);
+    if(to_t == CURL_OFFT_FLOW)
+      return CURLE_RANGE_ERROR;
+    if((to_t == CURL_OFFT_INVAL) && !from_t) {
+      /* X - */
+      data->state.resume_from = from;
+      DEBUGF(infof(data, "RANGE %" CURL_FORMAT_CURL_OFF_T " to end of file\n",
+                   from));
+    }
+    else if((from_t == CURL_OFFT_INVAL) && !to_t) {
+      /* -Y */
+      data->req.maxdownload = to;
+      data->state.resume_from = -to;
+      DEBUGF(infof(data, "RANGE the last %" CURL_FORMAT_CURL_OFF_T " bytes\n",
+                   to));
+    }
+    else {
+      /* X-Y */
+      curl_off_t totalsize;
+
+      /* Ensure the range is sensible - to should follow from. */
+      if(from > to)
+        return CURLE_RANGE_ERROR;
+
+      totalsize = to - from;
+      if(totalsize == CURL_OFF_T_MAX)
+        return CURLE_RANGE_ERROR;
+
+      data->req.maxdownload = totalsize + 1; /* include last byte */
+      data->state.resume_from = from;
+      DEBUGF(infof(data, "RANGE from %" CURL_FORMAT_CURL_OFF_T
+                   " getting %" CURL_FORMAT_CURL_OFF_T " bytes\n",
+                   from, data->req.maxdownload));
+    }
+    DEBUGF(infof(data, "range-download from %" CURL_FORMAT_CURL_OFF_T
+                 " to %" CURL_FORMAT_CURL_OFF_T ", totally %"
+                 CURL_FORMAT_CURL_OFF_T " bytes\n",
+                 from, to, data->req.maxdownload));
+  }
+  else
+    data->req.maxdownload = -1;
+  return CURLE_OK;
+}
+
+#endif
diff --git a/lib/vtls/gtls.h b/lib/curl_range.h
similarity index 80%
copy from lib/vtls/gtls.h
copy to lib/curl_range.h
index 780fc109d..2350df992 100644
--- a/lib/vtls/gtls.h
+++ b/lib/curl_range.h
@@ -1,5 +1,5 @@
-#ifndef HEADER_CURL_GTLS_H
-#define HEADER_CURL_GTLS_H
+#ifndef HEADER_CURL_RANGE_H
+#define HEADER_CURL_RANGE_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -23,12 +23,8 @@
  ***************************************************************************/
 
 #include "curl_setup.h"
-
-#ifdef USE_GNUTLS
-
 #include "urldata.h"
 
-extern const struct Curl_ssl Curl_ssl_gnutls;
+CURLcode Curl_range(struct connectdata *conn);
 
-#endif /* USE_GNUTLS */
-#endif /* HEADER_CURL_GTLS_H */
+#endif /* HEADER_CURL_RANGE_H */
diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c
index 10a59aa5f..26ac6d04a 100644
--- a/lib/curl_sasl.c
+++ b/lib/curl_sasl.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2012 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 2012 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -361,15 +361,6 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct 
connectdata *conn,
                                                        conn->oauth_bearer,
                                                        &resp, &len);
     }
-    else if(enabledmechs & SASL_MECH_LOGIN) {
-      mech = SASL_MECH_STRING_LOGIN;
-      state1 = SASL_LOGIN;
-      state2 = SASL_LOGIN_PASSWD;
-      sasl->authused = SASL_MECH_LOGIN;
-
-      if(force_ir || data->set.sasl_ir)
-        result = Curl_auth_create_login_message(data, conn->user, &resp, &len);
-    }
     else if(enabledmechs & SASL_MECH_PLAIN) {
       mech = SASL_MECH_STRING_PLAIN;
       state1 = SASL_PLAIN;
@@ -379,6 +370,15 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct 
connectdata *conn,
         result = Curl_auth_create_plain_message(data, conn->user, conn->passwd,
                                                 &resp, &len);
     }
+    else if(enabledmechs & SASL_MECH_LOGIN) {
+      mech = SASL_MECH_STRING_LOGIN;
+      state1 = SASL_LOGIN;
+      state2 = SASL_LOGIN_PASSWD;
+      sasl->authused = SASL_MECH_LOGIN;
+
+      if(force_ir || data->set.sasl_ir)
+        result = Curl_auth_create_login_message(data, conn->user, &resp, &len);
+    }
   }
 
   if(!result && mech) {
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index ef1c2e3e1..89fd060c2 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -389,6 +389,11 @@
 #  define LSEEK_ERROR (off_t)-1
 #endif
 
+#ifndef SIZEOF_TIME_T
+/* assume default size of time_t to be 32 bit */
+#define SIZEOF_TIME_T 4
+#endif
+
 /*
  * Default sizeof(off_t) in case it hasn't been defined in config file.
  */
@@ -424,6 +429,24 @@
 #endif
 #define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1))
 
+#if (SIZEOF_TIME_T == 4)
+#  ifdef HAVE_TIME_T_UNSIGNED
+#  define TIME_T_MAX UINT_MAX
+#  define TIME_T_MIN 0
+#  else
+#  define TIME_T_MAX INT_MAX
+#  define TIME_T_MIN INT_MIN
+#  endif
+#else
+#  ifdef HAVE_TIME_T_UNSIGNED
+#  define TIME_T_MAX 0xFFFFFFFFFFFFFFFF
+#  define TIME_T_MIN 0
+#  else
+#  define TIME_T_MAX 0x7FFFFFFFFFFFFFFF
+#  define TIME_T_MIN (-TIME_T_MAX - 1)
+#  endif
+#endif
+
 /*
  * Arg 2 type for gethostname in case it hasn't been defined in config file.
  */
@@ -607,11 +630,6 @@ int netware_init(void);
 #error "Both libidn2 and WinIDN are enabled, choose one."
 #endif
 
-#ifndef SIZEOF_TIME_T
-/* assume default size of time_t to be 32 bit */
-#define SIZEOF_TIME_T 4
-#endif
-
 #define LIBIDN_REQUIRED_VERSION "0.4.1"
 
 #if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_NSS) || \
@@ -751,11 +769,11 @@ endings either CRLF or LF so 't' is appropriate.
 #  if defined(WIN32) || defined(__CYGWIN__)
 #    define USE_RECV_BEFORE_SEND_WORKAROUND
 #  endif
-#else  /* DONT_USE_RECV_BEFORE_SEND_WORKAROUNDS */
+#else  /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */
 #  ifdef USE_RECV_BEFORE_SEND_WORKAROUND
 #    undef USE_RECV_BEFORE_SEND_WORKAROUND
 #  endif
-#endif /* DONT_USE_RECV_BEFORE_SEND_WORKAROUNDS */
+#endif /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */
 
 /* Detect Windows App environment which has a restricted access
  * to the Win32 APIs. */
diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h
index a5b542c6e..6d01ea156 100644
--- a/lib/curl_setup_once.h
+++ b/lib/curl_setup_once.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -101,7 +101,6 @@
 #  endif
 #endif
 
-
 /*
  * Definition of timeval struct for platforms that don't have it.
  */
@@ -274,25 +273,6 @@ struct timeval {
 #  define sfcntl  fcntl
 #endif
 
-/*
- * Uppercase macro versions of ANSI/ISO is*() functions/macros which
- * avoid negative number inputs with argument byte codes > 127.
- */
-
-#define ISSPACE(x)  (isspace((int)  ((unsigned char)x)))
-#define ISDIGIT(x)  (isdigit((int)  ((unsigned char)x)))
-#define ISALNUM(x)  (isalnum((int)  ((unsigned char)x)))
-#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))
-#define ISGRAPH(x)  (isgraph((int)  ((unsigned char)x)))
-#define ISALPHA(x)  (isalpha((int)  ((unsigned char)x)))
-#define ISPRINT(x)  (isprint((int)  ((unsigned char)x)))
-#define ISUPPER(x)  (isupper((int)  ((unsigned char)x)))
-#define ISLOWER(x)  (islower((int)  ((unsigned char)x)))
-#define ISASCII(x)  (isascii((int)  ((unsigned char)x)))
-
-#define ISBLANK(x)  (int)((((unsigned char)x) == ' ') || \
-                          (((unsigned char)x) == '\t'))
-
 #define TOLOWER(x)  (tolower((int)  ((unsigned char)x)))
 
 
@@ -347,6 +327,7 @@ struct timeval {
 #define FALSE false
 #endif
 
+#include "curl_ctype.h"
 
 /*
  * Macro WHILE_FALSE may be used to build single-iteration do-while loops,
diff --git a/lib/easy.c b/lib/easy.c
index fe033014a..8bf200650 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -61,6 +61,7 @@
 #include "strdup.h"
 #include "progress.h"
 #include "easyif.h"
+#include "multiif.h"
 #include "select.h"
 #include "sendf.h" /* for failf function prototype */
 #include "connect.h" /* for Curl_getconnectinfo */
@@ -73,6 +74,7 @@
 #include "sigpipe.h"
 #include "ssh.h"
 #include "setopt.h"
+#include "http_digest.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -760,6 +762,9 @@ static CURLcode easy_perform(struct Curl_easy *data, bool 
events)
     data->multi_easy = multi;
   }
 
+  if(multi->in_callback)
+    return CURLE_RECURSIVE_API_CALL;
+
   /* Copy the MAXCONNECTS option to the multi handle */
   curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, data->set.maxconnects);
 
@@ -1017,6 +1022,7 @@ void curl_easy_reset(struct Curl_easy *data)
   /* zero out authentication data: */
   memset(&data->state.authhost, 0, sizeof(struct auth));
   memset(&data->state.authproxy, 0, sizeof(struct auth));
+  Curl_digest_cleanup(data);
 }
 
 /*
@@ -1028,6 +1034,9 @@ void curl_easy_reset(struct Curl_easy *data)
  * the pausing, you may get your write callback called at this point.
  *
  * Action is a bitmask consisting of CURLPAUSE_* bits in gnurl/curl.h
+ *
+ * NOTE: This is one of few API functions that are allowed to be called from
+ * within a callback.
  */
 CURLcode curl_easy_pause(struct Curl_easy *data, int action)
 {
@@ -1070,10 +1079,8 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int 
action)
       /* even if one function returns error, this loops through and frees all
          buffers */
       if(!result)
-        result = Curl_client_chop_write(conn,
-                                        writebuf[i].type,
-                                        writebuf[i].buf,
-                                        writebuf[i].len);
+        result = Curl_client_write(conn, writebuf[i].type, writebuf[i].buf,
+                                   writebuf[i].len);
       free(writebuf[i].buf);
     }
 
@@ -1132,6 +1139,9 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void 
*buffer, size_t buflen,
   ssize_t n1;
   struct connectdata *c;
 
+  if(Curl_is_in_callback(data))
+    return CURLE_RECURSIVE_API_CALL;
+
   result = easy_connection(data, &sfd, &c);
   if(result)
     return result;
@@ -1159,6 +1169,9 @@ CURLcode curl_easy_send(struct Curl_easy *data, const 
void *buffer,
   ssize_t n1;
   struct connectdata *c = NULL;
 
+  if(Curl_is_in_callback(data))
+    return CURLE_RECURSIVE_API_CALL;
+
   result = easy_connection(data, &sfd, &c);
   if(result)
     return result;
diff --git a/lib/file.c b/lib/file.c
index be19c9fc2..9e7645679 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -61,6 +61,7 @@
 #include "url.h"
 #include "parsedate.h" /* for the week day and month names */
 #include "warnless.h"
+#include "curl_range.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
 #include "curl_memory.h"
@@ -125,65 +126,6 @@ static CURLcode file_setup_connection(struct connectdata 
*conn)
   return CURLE_OK;
 }
 
- /*
-  Check if this is a range download, and if so, set the internal variables
-  properly. This code is copied from the FTP implementation and might as
-  well be factored out.
- */
-static CURLcode file_range(struct connectdata *conn)
-{
-  curl_off_t from, to;
-  curl_off_t totalsize = -1;
-  char *ptr;
-  char *ptr2;
-  struct Curl_easy *data = conn->data;
-
-  if(data->state.use_range && data->state.range) {
-    CURLofft from_t;
-    CURLofft to_t;
-    from_t = curlx_strtoofft(data->state.range, &ptr, 0, &from);
-    if(from_t == CURL_OFFT_FLOW)
-      return CURLE_RANGE_ERROR;
-    while(*ptr && (ISSPACE(*ptr) || (*ptr == '-')))
-      ptr++;
-    to_t = curlx_strtoofft(ptr, &ptr2, 0, &to);
-    if(to_t == CURL_OFFT_FLOW)
-      return CURLE_RANGE_ERROR;
-    if((to_t == CURL_OFFT_INVAL) && !from_t) {
-      /* X - */
-      data->state.resume_from = from;
-      DEBUGF(infof(data, "RANGE %" CURL_FORMAT_CURL_OFF_T " to end of file\n",
-                   from));
-    }
-    else if((from_t == CURL_OFFT_INVAL) && !to_t) {
-      /* -Y */
-      data->req.maxdownload = to;
-      data->state.resume_from = -to;
-      DEBUGF(infof(data, "RANGE the last %" CURL_FORMAT_CURL_OFF_T " bytes\n",
-                   to));
-    }
-    else {
-      /* X-Y */
-      totalsize = to-from;
-      if(totalsize == CURL_OFF_T_MAX)
-        /* this is too big to increase, so bail out */
-        return CURLE_RANGE_ERROR;
-      data->req.maxdownload = totalsize + 1; /* include last byte */
-      data->state.resume_from = from;
-      DEBUGF(infof(data, "RANGE from %" CURL_FORMAT_CURL_OFF_T
-                   " getting %" CURL_FORMAT_CURL_OFF_T " bytes\n",
-                   from, data->req.maxdownload));
-    }
-    DEBUGF(infof(data, "range-download from %" CURL_FORMAT_CURL_OFF_T
-                 " to %" CURL_FORMAT_CURL_OFF_T ", totally %"
-                 CURL_FORMAT_CURL_OFF_T " bytes\n",
-                 from, to, data->req.maxdownload));
-  }
-  else
-    data->req.maxdownload = -1;
-  return CURLE_OK;
-}
-
 /*
  * file_connect() gets called from Curl_protocol_connect() to allow us to
  * do protocol-specific actions at connect-time.  We emulate a
@@ -461,12 +403,12 @@ static CURLcode file_do(struct connectdata *conn, bool 
*done)
     /* we could stat it, then read out the size */
     expected_size = statbuf.st_size;
     /* and store the modification time */
-    data->info.filetime = (long)statbuf.st_mtime;
+    data->info.filetime = statbuf.st_mtime;
     fstated = TRUE;
   }
 
   if(fstated && !data->state.range && data->set.timecondition) {
-    if(!Curl_meets_timecondition(data, (time_t)data->info.filetime)) {
+    if(!Curl_meets_timecondition(data, data->info.filetime)) {
       *done = TRUE;
       return CURLE_OK;
     }
@@ -514,7 +456,9 @@ static CURLcode file_do(struct connectdata *conn, bool 
*done)
   }
 
   /* Check whether file range has been specified */
-  file_range(conn);
+  result = Curl_range(conn);
+  if(result)
+    return result;
 
   /* Adjust the start offset in case we want to get the N last bytes
    * of the stream iff the filesize could be determined */
diff --git a/lib/formdata.c b/lib/formdata.c
index 429031354..3bb451b49 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -154,60 +154,6 @@ static FormInfo * AddFormInfo(char *value,
 
 /***************************************************************************
  *
- * ContentTypeForFilename()
- *
- * Provides content type for filename if one of the known types (else
- * (either the prevtype or the default is returned).
- *
- * Returns some valid contenttype for filename.
- *
- ***************************************************************************/
-static const char *ContentTypeForFilename(const char *filename,
-                                          const char *prevtype)
-{
-  const char *contenttype = NULL;
-  unsigned int i;
-  /*
-   * No type was specified, we scan through a few well-known
-   * extensions and pick the first we match!
-   */
-  struct ContentType {
-    const char *extension;
-    const char *type;
-  };
-  static const struct ContentType ctts[]={
-    {".gif",  "image/gif"},
-    {".jpg",  "image/jpeg"},
-    {".jpeg", "image/jpeg"},
-    {".txt",  "text/plain"},
-    {".html", "text/html"},
-    {".xml", "application/xml"}
-  };
-
-  if(prevtype)
-    /* default to the previously set/used! */
-    contenttype = prevtype;
-  else
-    contenttype = HTTPPOST_CONTENTTYPE_DEFAULT;
-
-  if(filename) { /* in case a NULL was passed in */
-    for(i = 0; i<sizeof(ctts)/sizeof(ctts[0]); i++) {
-      if(strlen(filename) >= strlen(ctts[i].extension)) {
-        if(strcasecompare(filename +
-                          strlen(filename) - strlen(ctts[i].extension),
-                          ctts[i].extension)) {
-          contenttype = ctts[i].type;
-          break;
-        }
-      }
-    }
-  }
-  /* we have a contenttype by now */
-  return contenttype;
-}
-
-/***************************************************************************
- *
  * FormAdd()
  *
  * Stores a formpost parameter and builds the appropriate linked list.
@@ -626,9 +572,15 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
          !form->contenttype) {
         char *f = form->flags & HTTPPOST_BUFFER?
           form->showfilename : form->value;
+        char const *type;
+        type = Curl_mime_contenttype(f);
+        if(!type)
+          type = prevtype;
+        if(!type)
+          type = FILE_CONTENTTYPE_DEFAULT;
 
         /* our contenttype is missing */
-        form->contenttype = strdup(ContentTypeForFilename(f, prevtype));
+        form->contenttype = strdup(type);
         if(!form->contenttype) {
           return_value = CURL_FORMADD_MEMORY;
           break;
diff --git a/lib/ftp.c b/lib/ftp.c
index 27d7f3311..426845bea 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -59,6 +59,7 @@
 #include "ftp.h"
 #include "fileinfo.h"
 #include "ftplistparser.h"
+#include "curl_range.h"
 #include "curl_sec.h"
 #include "strtoofft.h"
 #include "strcase.h"
@@ -310,9 +311,11 @@ static CURLcode AcceptServerConnect(struct connectdata 
*conn)
     int error = 0;
 
     /* activate callback for setting socket options */
+    Curl_set_in_callback(data, true);
     error = data->set.fsockopt(data->set.sockopt_client,
                                s,
                                CURLSOCKTYPE_ACCEPT);
+    Curl_set_in_callback(data, false);
 
     if(error) {
       close_secondarysocket(conn);
@@ -1471,7 +1474,7 @@ static CURLcode ftp_state_list(struct connectdata *conn)
       slashPos = strrchr(inpath, '/');
       n = slashPos - inpath;
     }
-    result = Curl_urldecode(data, inpath, n, &lstArg, NULL, FALSE);
+    result = Curl_urldecode(data, inpath, n, &lstArg, NULL, TRUE);
     if(result)
       return result;
   }
@@ -1535,7 +1538,7 @@ static CURLcode ftp_state_type(struct connectdata *conn)
      date. */
   if(data->set.opt_no_body && ftpc->file &&
      ftp_need_type(conn, data->set.prefer_ascii)) {
-    /* The SIZE command is _not_ RFC 959 specified, and therefor many servers
+    /* The SIZE command is _not_ RFC 959 specified, and therefore many servers
        may not support it! It is however the only way we have to get a file's
        size! */
 
@@ -1615,8 +1618,10 @@ static CURLcode ftp_state_ul_setup(struct connectdata 
*conn,
 
     /* Let's read off the proper amount of bytes from the input. */
     if(conn->seek_func) {
+      Curl_set_in_callback(data, true);
       seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
                                 SEEK_SET);
+      Curl_set_in_callback(data, true);
     }
 
     if(seekerr != CURL_SEEKFUNC_OK) {
@@ -2060,7 +2065,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata 
*conn,
                  "%04d%02d%02d %02d:%02d:%02d GMT",
                  year, month, day, hour, minute, second);
         /* now, convert this into a time() value: */
-        data->info.filetime = (long)curl_getdate(timebuf, &secs);
+        data->info.filetime = curl_getdate(timebuf, &secs);
       }
 
 #ifdef CURL_FTP_HTTPSTYLE_HEAD
@@ -2072,7 +2077,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata 
*conn,
          data->set.get_filetime &&
          (data->info.filetime >= 0) ) {
         char headerbuf[128];
-        time_t filetime = (time_t)data->info.filetime;
+        time_t filetime = data->info.filetime;
         struct tm buffer;
         const struct tm *tm = &buffer;
 
@@ -3180,14 +3185,16 @@ static CURLcode ftp_done(struct connectdata *conn, 
CURLcode status,
 
   if(data->state.wildcardmatch) {
     if(data->set.chunk_end && ftpc->file) {
+      Curl_set_in_callback(data, true);
       data->set.chunk_end(data->wildcard.customptr);
+      Curl_set_in_callback(data, false);
     }
     ftpc->known_filesize = -1;
   }
 
   if(!result)
     /* get the "raw" path */
-    result = Curl_urldecode(data, path_to_use, 0, &path, NULL, FALSE);
+    result = Curl_urldecode(data, path_to_use, 0, &path, NULL, TRUE);
   if(result) {
     /* We can limp along anyway (and should try to since we may already be in
      * the error path) */
@@ -3463,62 +3470,6 @@ ftp_pasv_verbose(struct connectdata *conn,
 #endif
 
 /*
-  Check if this is a range download, and if so, set the internal variables
-  properly.
- */
-
-static CURLcode ftp_range(struct connectdata *conn)
-{
-  curl_off_t from, to;
-  char *ptr;
-  struct Curl_easy *data = conn->data;
-  struct ftp_conn *ftpc = &conn->proto.ftpc;
-
-  if(data->state.use_range && data->state.range) {
-    CURLofft from_t;
-    CURLofft to_t;
-    from_t = curlx_strtoofft(data->state.range, &ptr, 0, &from);
-    if(from_t == CURL_OFFT_FLOW)
-      return CURLE_RANGE_ERROR;
-    while(*ptr && (ISSPACE(*ptr) || (*ptr == '-')))
-      ptr++;
-    to_t = curlx_strtoofft(ptr, NULL, 0, &to);
-    if(to_t == CURL_OFFT_FLOW)
-      return CURLE_RANGE_ERROR;
-    if((to_t == CURL_OFFT_INVAL) && !from_t) {
-      /* X - */
-      data->state.resume_from = from;
-      DEBUGF(infof(conn->data, "FTP RANGE %" CURL_FORMAT_CURL_OFF_T
-                   " to end of file\n", from));
-    }
-    else if(!to_t && (from_t == CURL_OFFT_INVAL)) {
-      /* -Y */
-      data->req.maxdownload = to;
-      data->state.resume_from = -to;
-      DEBUGF(infof(conn->data, "FTP RANGE the last %" CURL_FORMAT_CURL_OFF_T
-                   " bytes\n", to));
-    }
-    else {
-      /* X-Y */
-      data->req.maxdownload = (to - from) + 1; /* include last byte */
-      data->state.resume_from = from;
-      DEBUGF(infof(conn->data, "FTP RANGE from %" CURL_FORMAT_CURL_OFF_T
-                   " getting %" CURL_FORMAT_CURL_OFF_T " bytes\n",
-                   from, data->req.maxdownload));
-    }
-    DEBUGF(infof(conn->data, "range-download from %" CURL_FORMAT_CURL_OFF_T
-                 " to %" CURL_FORMAT_CURL_OFF_T ", totally %"
-                 CURL_FORMAT_CURL_OFF_T " bytes\n",
-                 from, to, data->req.maxdownload));
-    ftpc->dont_check = TRUE; /* don't check for successful transfer */
-  }
-  else
-    data->req.maxdownload = -1;
-  return CURLE_OK;
-}
-
-
-/*
  * ftp_do_more()
  *
  * This function shall be called when the second FTP (data) connection is
@@ -3640,7 +3591,13 @@ static CURLcode ftp_do_more(struct connectdata *conn, 
int *completep)
       /* download */
       ftp->downloadsize = -1; /* unknown as of yet */
 
-      result = ftp_range(conn);
+      result = Curl_range(conn);
+
+      if(result == CURLE_OK && data->req.maxdownload >= 0) {
+        /* Don't check for successful transfer */
+        ftpc->dont_check = TRUE;
+      }
+
       if(result)
         ;
       else if(data->set.ftp_list_only || !ftpc->file) {
@@ -3883,8 +3840,11 @@ static CURLcode wc_statemach(struct connectdata *conn)
 
     infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename);
     if(conn->data->set.chunk_bgn) {
-      long userresponse = conn->data->set.chunk_bgn(
+      long userresponse;
+      Curl_set_in_callback(conn->data, true);
+      userresponse = conn->data->set.chunk_bgn(
         finfo, wildcard->customptr, (int)wildcard->filelist.size);
+      Curl_set_in_callback(conn->data, false);
       switch(userresponse) {
       case CURL_CHUNK_BGN_FUNC_SKIP:
         infof(conn->data, "Wildcard - \"%s\" skipped by user\n",
@@ -3920,8 +3880,11 @@ static CURLcode wc_statemach(struct connectdata *conn)
   } break;
 
   case CURLWC_SKIP: {
-    if(conn->data->set.chunk_end)
+    if(conn->data->set.chunk_end) {
+      Curl_set_in_callback(conn->data, true);
       conn->data->set.chunk_end(conn->data->wildcard.customptr);
+      Curl_set_in_callback(conn->data, false);
+    }
     Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
     wildcard->state = (wildcard->filelist.size == 0) ?
                       CURLWC_CLEAN : CURLWC_DOWNLOADING;
@@ -4192,7 +4155,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
       result = Curl_urldecode(conn->data, slash_pos ? cur_pos : "/",
                               slash_pos ? dirlen : 1,
                               &ftpc->dirs[0], NULL,
-                              FALSE);
+                              TRUE);
       if(result) {
         freedirs(ftpc);
         return result;
@@ -4299,7 +4262,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
     size_t dlen;
     char *path;
     CURLcode result =
-      Curl_urldecode(conn->data, data->state.path, 0, &path, &dlen, FALSE);
+      Curl_urldecode(conn->data, data->state.path, 0, &path, &dlen, TRUE);
     if(result) {
       freedirs(ftpc);
       return result;
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c
index ec3579ce3..e4de8cba0 100644
--- a/lib/ftplistparser.c
+++ b/lib/ftplistparser.c
@@ -49,6 +49,7 @@
 #include "ftplistparser.h"
 #include "curl_fnmatch.h"
 #include "curl_memory.h"
+#include "multiif.h"
 /* The last #include file should be: */
 #include "memdebug.h"
 
@@ -294,6 +295,7 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata 
*conn,
     compare = Curl_fnmatch;
 
   /* filter pattern-corresponding filenames */
+  Curl_set_in_callback(conn->data, true);
   if(compare(conn->data->set.fnmatch_data, wc->pattern,
              finfo->filename) == 0) {
     /* discard symlink which is containing multiple " -> " */
@@ -305,6 +307,7 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata 
*conn,
   else {
     add = FALSE;
   }
+  Curl_set_in_callback(conn->data, false);
 
   if(add) {
     Curl_llist_insert_next(llist, llist->tail, finfo, &infop->list);
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 2385717d1..45e7c39bd 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -156,7 +156,12 @@ static CURLcode getinfo_long(struct Curl_easy *data, 
CURLINFO info,
     *param_longp = data->info.httpproxycode;
     break;
   case CURLINFO_FILETIME:
-    *param_longp = data->info.filetime;
+    if(data->info.filetime > LONG_MAX)
+      *param_longp = LONG_MAX;
+    else if(data->info.filetime < LONG_MIN)
+      *param_longp = LONG_MIN;
+    else
+      *param_longp = (long)data->info.filetime;
     break;
   case CURLINFO_HEADER_SIZE:
     *param_longp = data->info.header_size;
@@ -253,6 +258,9 @@ static CURLcode getinfo_offt(struct Curl_easy *data, 
CURLINFO info,
                              curl_off_t *param_offt)
 {
   switch(info) {
+  case CURLINFO_FILETIME_T:
+    *param_offt = (curl_off_t)data->info.filetime;
+    break;
   case CURLINFO_SIZE_UPLOAD_T:
     *param_offt = data->progress.uploaded;
     break;
diff --git a/lib/hostip.c b/lib/hostip.c
index 886aeec42..8554d39d1 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -58,6 +58,7 @@
 #include "strerror.h"
 #include "url.h"
 #include "inet_ntop.h"
+#include "multiif.h"
 #include "warnless.h"
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -481,6 +482,17 @@ int Curl_resolv(struct connectdata *conn,
     if(!Curl_ipvalid(conn))
       return CURLRESOLV_ERROR;
 
+    /* notify the resolver start callback */
+    if(data->set.resolver_start) {
+      int st;
+      Curl_set_in_callback(data, true);
+      st = data->set.resolver_start(data->state.resolver, NULL,
+                                    data->set.resolver_start_client);
+      Curl_set_in_callback(data, false);
+      if(st)
+        return CURLRESOLV_ERROR;
+    }
+
     /* If Curl_getaddrinfo() returns NULL, 'respwait' might be set to a
        non-zero value indicating that we need to wait for the response to the
        resolve call */
@@ -781,7 +793,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
 {
   struct curl_slist *hostp;
   char hostname[256];
-  int port;
+  int port = 0;
 
   for(hostp = data->change.resolve; hostp; hostp = hostp->next) {
     if(!hostp->data)
@@ -819,32 +831,95 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
     }
     else {
       struct Curl_dns_entry *dns;
-      Curl_addrinfo *addr;
+      Curl_addrinfo *head = NULL, *tail = NULL;
       char *entry_id;
       size_t entry_len;
-      char buffer[256];
-      char *address = &buffer[0];
+      char address[64];
+      char *addresses = NULL;
+      char *addr_begin;
+      char *addr_end;
+      char *port_ptr;
+      char *end_ptr;
+      char *host_end;
+      unsigned long tmp_port;
+      bool error = true;
+
+      host_end = strchr(hostp->data, ':');
+      if(!host_end ||
+         ((host_end - hostp->data) >= (ptrdiff_t)sizeof(hostname)))
+        goto err;
+
+      memcpy(hostname, hostp->data, host_end - hostp->data);
+      hostname[host_end - hostp->data] = '\0';
+
+      port_ptr = host_end + 1;
+      tmp_port = strtoul(port_ptr, &end_ptr, 10);
+      if(tmp_port > USHRT_MAX || end_ptr == port_ptr || *end_ptr != ':')
+        goto err;
+
+      port = (int)tmp_port;
+      addresses = end_ptr + 1;
+
+      while(*end_ptr) {
+        size_t alen;
+        Curl_addrinfo *ai;
+
+        addr_begin = end_ptr + 1;
+        addr_end = strchr(addr_begin, ',');
+        if(!addr_end)
+          addr_end = addr_begin + strlen(addr_begin);
+        end_ptr = addr_end;
+
+        /* allow IP(v6) address within [brackets] */
+        if(*addr_begin == '[') {
+          if(addr_end == addr_begin || *(addr_end - 1) != ']')
+            goto err;
+          ++addr_begin;
+          --addr_end;
+        }
 
-      if(3 != sscanf(hostp->data, "%255[^:]:%d:%255s", hostname, &port,
-                     address)) {
-        infof(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'!\n",
-              hostp->data);
-        continue;
-      }
+        alen = addr_end - addr_begin;
+        if(!alen)
+          continue;
+
+        if(alen >= sizeof(address))
+          goto err;
 
-      /* allow IP(v6) address within [brackets] */
-      if(address[0] == '[') {
-        size_t alen = strlen(address);
-        if(address[alen-1] != ']')
-          /* it needs to also end with ] to be valid */
+        memcpy(address, addr_begin, alen);
+        address[alen] = '\0';
+
+#ifndef ENABLE_IPV6
+        if(strchr(address, ':')) {
+          infof(data, "Ignoring resolve address '%s', missing IPv6 support.\n",
+                address);
           continue;
-        address[alen-1] = 0; /* zero terminate there */
-        address++; /* pass the open bracket */
+        }
+#endif
+
+        ai = Curl_str2addr(address, port);
+        if(!ai) {
+          infof(data, "Resolve address '%s' found illegal!\n", address);
+          goto err;
+        }
+
+        if(tail) {
+          tail->ai_next = ai;
+          tail = tail->ai_next;
+        }
+        else {
+          head = tail = ai;
+        }
       }
 
-      addr = Curl_str2addr(address, port);
-      if(!addr) {
-        infof(data, "Address in '%s' found illegal!\n", hostp->data);
+      if(!head)
+        goto err;
+
+      error = false;
+   err:
+      if(error) {
+        infof(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'!\n",
+              hostp->data);
+        Curl_freeaddrinfo(head);
         continue;
       }
 
@@ -852,10 +927,9 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
       entry_id = create_hostcache_id(hostname, port);
       /* If we can't create the entry id, fail */
       if(!entry_id) {
-        Curl_freeaddrinfo(addr);
+        Curl_freeaddrinfo(head);
         return CURLE_OUT_OF_MEMORY;
       }
-
       entry_len = strlen(entry_id);
 
       if(data->share)
@@ -869,7 +943,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
 
       if(!dns) {
         /* if not in the cache already, put this host in the cache */
-        dns = Curl_cache_addr(data, addr, hostname, port);
+        dns = Curl_cache_addr(data, head, hostname, port);
         if(dns) {
           dns->timestamp = 0; /* mark as added by CURLOPT_RESOLVE */
           /* release the returned reference; the cache itself will keep the
@@ -880,19 +954,19 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
       else {
         /* this is a duplicate, free it again */
         infof(data, "RESOLVE %s:%d is already cached, %s not stored!\n",
-              hostname, port, address);
-        Curl_freeaddrinfo(addr);
+              hostname, port, addresses);
+        Curl_freeaddrinfo(head);
       }
 
       if(data->share)
         Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
 
       if(!dns) {
-        Curl_freeaddrinfo(addr);
+        Curl_freeaddrinfo(head);
         return CURLE_OUT_OF_MEMORY;
       }
       infof(data, "Added %s:%d:%s to DNS cache\n",
-            hostname, port, address);
+            hostname, port, addresses);
     }
   }
   data->change.resolve = NULL; /* dealt with now */
diff --git a/lib/http.c b/lib/http.c
index 900e83d0c..ca63eddd6 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -177,9 +177,9 @@ CURLcode Curl_http_setup_conn(struct connectdata *conn)
  * if proxy headers are not available, then it will lookup into http header
  * link list
  *
- * It takes a connectdata struct as input instead of the Curl_easy simply
- * to know if this is a proxy request or not, as it then might check a
- * different header list.
+ * It takes a connectdata struct as input instead of the Curl_easy simply to
+ * know if this is a proxy request or not, as it then might check a different
+ * header list. Provide the header prefix without colon!.
  */
 char *Curl_checkProxyheaders(const struct connectdata *conn,
                              const char *thisheader)
@@ -191,7 +191,8 @@ char *Curl_checkProxyheaders(const struct connectdata *conn,
   for(head = (conn->bits.proxy && data->set.sep_headers) ?
         data->set.proxyheaders : data->set.headers;
       head; head = head->next) {
-    if(strncasecompare(head->data, thisheader, thislen))
+    if(strncasecompare(head->data, thisheader, thislen) &&
+       Curl_headersep(head->data[thislen]))
       return head->data;
   }
 
@@ -614,9 +615,9 @@ output_auth_headers(struct connectdata *conn,
   if(authstatus->picked == CURLAUTH_BASIC) {
     /* Basic */
     if((proxy && conn->bits.proxy_user_passwd &&
-        !Curl_checkProxyheaders(conn, "Proxy-authorization:")) ||
+        !Curl_checkProxyheaders(conn, "Proxy-authorization")) ||
        (!proxy && conn->bits.user_passwd &&
-        !Curl_checkheaders(conn, "Authorization:"))) {
+        !Curl_checkheaders(conn, "Authorization"))) {
       auth = "Basic";
       result = http_output_basic(conn, proxy);
       if(result)
@@ -1533,7 +1534,7 @@ static CURLcode expect100(struct Curl_easy *data,
     /* if not doing HTTP 1.0 or version 2, or disabled explicitly, we add an
        Expect: 100-continue to the headers which actually speeds up post
        operations (as there is one packet coming back from the web server) */
-    ptr = Curl_checkheaders(conn, "Expect:");
+    ptr = Curl_checkheaders(conn, "Expect");
     if(ptr) {
       data->state.expect100header =
         Curl_compareheader(ptr, "Expect:", "100-continue");
@@ -1598,7 +1599,32 @@ CURLcode Curl_add_custom_headers(struct connectdata 
*conn,
     headers = h[i];
 
     while(headers) {
+      char *semicolonp = NULL;
       ptr = strchr(headers->data, ':');
+      if(!ptr) {
+        char *optr;
+        /* no colon, semicolon? */
+        ptr = strchr(headers->data, ';');
+        if(ptr) {
+          optr = ptr;
+          ptr++; /* pass the semicolon */
+          while(*ptr && ISSPACE(*ptr))
+            ptr++;
+
+          if(*ptr) {
+            /* this may be used for something else in the future */
+            optr = NULL;
+          }
+          else {
+            if(*(--ptr) == ';') {
+              /* send no-value custom header if terminated by semicolon */
+              *ptr = ':';
+              semicolonp = ptr;
+            }
+          }
+          ptr = optr;
+        }
+      }
       if(ptr) {
         /* we require a colon for this to be a true header */
 
@@ -1606,8 +1632,9 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
         while(*ptr && ISSPACE(*ptr))
           ptr++;
 
-        if(*ptr) {
-          /* only send this if the contents was non-blank */
+        if(*ptr || semicolonp) {
+          /* only send this if the contents was non-blank or done special */
+          CURLcode result = CURLE_OK;
 
           if(conn->allocptr.host &&
              /* a Host: header was sent already, don't pass on any custom Host:
@@ -1645,40 +1672,12 @@ CURLcode Curl_add_custom_headers(struct connectdata 
*conn,
                    !strcasecompare(data->state.first_host, conn->host.name)))
             ;
           else {
-            CURLcode result = Curl_add_bufferf(req_buffer, "%s\r\n",
-                                               headers->data);
-            if(result)
-              return result;
-          }
-        }
-      }
-      else {
-        ptr = strchr(headers->data, ';');
-        if(ptr) {
-
-          ptr++; /* pass the semicolon */
-          while(*ptr && ISSPACE(*ptr))
-            ptr++;
-
-          if(*ptr) {
-            /* this may be used for something else in the future */
-          }
-          else {
-            if(*(--ptr) == ';') {
-              CURLcode result;
-
-              /* send no-value custom header if terminated by semicolon */
-              *ptr = ':';
-              result = Curl_add_bufferf(req_buffer, "%s\r\n",
-                                        headers->data);
-
-              /* restore the previous value */
-              *ptr = ';';
-
-              if(result)
-                return result;
-            }
+            result = Curl_add_bufferf(req_buffer, "%s\r\n", headers->data);
           }
+          if(semicolonp)
+            *semicolonp = ';'; /* put back the semicolon */
+          if(result)
+            return result;
         }
       }
       headers = headers->next;
@@ -1869,7 +1868,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
      it might have been used in the proxy connect, but if we have got a header
      with the user-agent string specified, we erase the previously made string
      here. */
-  if(Curl_checkheaders(conn, "User-Agent:")) {
+  if(Curl_checkheaders(conn, "User-Agent")) {
     free(conn->allocptr.uagent);
     conn->allocptr.uagent = NULL;
   }
@@ -1890,7 +1889,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
     conn->bits.authneg = FALSE;
 
   Curl_safefree(conn->allocptr.ref);
-  if(data->change.referer && !Curl_checkheaders(conn, "Referer:")) {
+  if(data->change.referer && !Curl_checkheaders(conn, "Referer")) {
     conn->allocptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
     if(!conn->allocptr.ref)
       return CURLE_OUT_OF_MEMORY;
@@ -1899,11 +1898,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
     conn->allocptr.ref = NULL;
 
 #if !defined(CURL_DISABLE_COOKIES)
-  if(data->set.str[STRING_COOKIE] && !Curl_checkheaders(conn, "Cookie:"))
+  if(data->set.str[STRING_COOKIE] && !Curl_checkheaders(conn, "Cookie"))
     addcookies = data->set.str[STRING_COOKIE];
 #endif
 
-  if(!Curl_checkheaders(conn, "Accept-Encoding:") &&
+  if(!Curl_checkheaders(conn, "Accept-Encoding") &&
      data->set.str[STRING_ENCODING]) {
     Curl_safefree(conn->allocptr.accept_encoding);
     conn->allocptr.accept_encoding =
@@ -1919,22 +1918,29 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
 #ifdef HAVE_LIBZ
   /* we only consider transfer-encoding magic if libz support is built-in */
 
-  if(!Curl_checkheaders(conn, "TE:") &&
+  if(!Curl_checkheaders(conn, "TE") &&
      data->set.http_transfer_encoding) {
     /* When we are to insert a TE: header in the request, we must also insert
        TE in a Connection: header, so we need to merge the custom provided
        Connection: header and prevent the original to get sent. Note that if
        the user has inserted his/hers own TE: header we don't do this magic
        but then assume that the user will handle it all! */
-    char *cptr = Curl_checkheaders(conn, "Connection:");
+    char *cptr = Curl_checkheaders(conn, "Connection");
 #define TE_HEADER "TE: gzip\r\n"
 
     Curl_safefree(conn->allocptr.te);
 
+    if(cptr) {
+      cptr = Curl_copy_header_value(cptr);
+      if(!cptr)
+        return CURLE_OUT_OF_MEMORY;
+    }
+
     /* Create the (updated) Connection: header */
-    conn->allocptr.te = cptr? aprintf("%s, TE\r\n" TE_HEADER, cptr):
-      strdup("Connection: TE\r\n" TE_HEADER);
+    conn->allocptr.te = aprintf("Connection: %s%sTE\r\n" TE_HEADER,
+                                cptr ? cptr : "", (cptr && *cptr) ? ", ":"");
 
+    free(cptr);
     if(!conn->allocptr.te)
       return CURLE_OUT_OF_MEMORY;
   }
@@ -1958,7 +1964,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
   }
 
   if(http->sendit) {
-    const char *cthdr = Curl_checkheaders(conn, "Content-Type:");
+    const char *cthdr = Curl_checkheaders(conn, "Content-Type");
 
     /* Read and seek body only. */
     http->sendit->flags |= MIME_BODY_ONLY;
@@ -1982,7 +1988,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
     http->postsize = Curl_mime_size(http->sendit);
   }
 
-  ptr = Curl_checkheaders(conn, "Transfer-Encoding:");
+  ptr = Curl_checkheaders(conn, "Transfer-Encoding");
   if(ptr) {
     /* Some kind of TE is requested, check if 'chunked' is chosen */
     data->req.upload_chunky =
@@ -2016,7 +2022,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
 
   Curl_safefree(conn->allocptr.host);
 
-  ptr = Curl_checkheaders(conn, "Host:");
+  ptr = Curl_checkheaders(conn, "Host");
   if(ptr && (!data->state.this_is_a_follow ||
              strcasecompare(data->state.first_host, conn->host.name))) {
 #if !defined(CURL_DISABLE_COOKIES)
@@ -2055,7 +2061,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
 #endif
 
     if(strcmp("Host:", ptr)) {
-      conn->allocptr.host = aprintf("%s\r\n", ptr);
+      conn->allocptr.host = aprintf("Host:%s\r\n", &ptr[5]);
       if(!conn->allocptr.host)
         return CURLE_OUT_OF_MEMORY;
     }
@@ -2164,7 +2170,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
   }
 #endif /* CURL_DISABLE_PROXY */
 
-  http->p_accept = Curl_checkheaders(conn, "Accept:")?NULL:"Accept: */*\r\n";
+  http->p_accept = Curl_checkheaders(conn, "Accept")?NULL:"Accept: */*\r\n";
 
   if((HTTPREQ_POST == httpreq || HTTPREQ_PUT == httpreq) &&
      data->state.resume_from) {
@@ -2191,8 +2197,10 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       /* Now, let's read off the proper amount of bytes from the
          input. */
       if(conn->seek_func) {
+        Curl_set_in_callback(data, true);
         seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
                                   SEEK_SET);
+        Curl_set_in_callback(data, false);
       }
 
       if(seekerr != CURL_SEEKFUNC_OK) {
@@ -2243,14 +2251,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
      * ones if any such are specified.
      */
     if(((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) &&
-       !Curl_checkheaders(conn, "Range:")) {
+       !Curl_checkheaders(conn, "Range")) {
       /* if a line like this was already allocated, free the previous one */
       free(conn->allocptr.rangeline);
       conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n",
                                          data->state.range);
     }
     else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) &&
-            !Curl_checkheaders(conn, "Content-Range:")) {
+            !Curl_checkheaders(conn, "Content-Range")) {
 
       /* if a line like this was already allocated, free the previous one */
       free(conn->allocptr.rangeline);
@@ -2352,7 +2360,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
                      conn->allocptr.ref:"" /* Referer: <data> */,
                      (conn->bits.httpproxy &&
                       !conn->bits.tunnel_proxy &&
-                      !Curl_checkProxyheaders(conn, "Proxy-Connection:"))?
+                      !Curl_checkProxyheaders(conn, "Proxy-Connection"))?
                      "Proxy-Connection: Keep-Alive\r\n":"",
                      te
       );
@@ -2453,7 +2461,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       postsize = data->state.infilesize;
 
     if((postsize != -1) && !data->req.upload_chunky &&
-       (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length:"))) {
+       (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length"))) {
       /* only add Content-Length if not uploading chunked */
       result = Curl_add_bufferf(req_buffer,
                                 "Content-Length: %" CURL_FORMAT_CURL_OFF_T
@@ -2515,7 +2523,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
        we don't upload data chunked, as RFC2616 forbids us to set both
        kinds of headers (Transfer-Encoding: chunked and Content-Length) */
     if(postsize != -1 && !data->req.upload_chunky &&
-       (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length:"))) {
+       (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length"))) {
       /* we allow replacing this header if not during auth negotiation,
          although it isn't very wise to actually set your own */
       result = Curl_add_bufferf(req_buffer,
@@ -2540,7 +2548,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
        the somewhat bigger ones we allow the app to disable it. Just make
        sure that the expect100header is always set to the preferred value
        here. */
-    ptr = Curl_checkheaders(conn, "Expect:");
+    ptr = Curl_checkheaders(conn, "Expect");
     if(ptr) {
       data->state.expect100header =
         Curl_compareheader(ptr, "Expect:", "100-continue");
@@ -2594,7 +2602,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
        we don't upload data chunked, as RFC2616 forbids us to set both
        kinds of headers (Transfer-Encoding: chunked and Content-Length) */
     if((postsize != -1) && !data->req.upload_chunky &&
-       (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length:"))) {
+       (conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length"))) {
       /* we allow replacing this header if not during auth negotiation,
          although it isn't very wise to actually set your own */
       result = Curl_add_bufferf(req_buffer,
@@ -2604,7 +2612,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
         return result;
     }
 
-    if(!Curl_checkheaders(conn, "Content-Type:")) {
+    if(!Curl_checkheaders(conn, "Content-Type")) {
       result = Curl_add_bufferf(req_buffer,
                                 "Content-Type: application/"
                                 "x-www-form-urlencoded\r\n");
@@ -2616,7 +2624,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
        the somewhat bigger ones we allow the app to disable it. Just make
        sure that the expect100header is always set to the preferred value
        here. */
-    ptr = Curl_checkheaders(conn, "Expect:");
+    ptr = Curl_checkheaders(conn, "Expect");
     if(ptr) {
       data->state.expect100header =
         Curl_compareheader(ptr, "Expect:", "100-continue");
@@ -2878,20 +2886,19 @@ static CURLcode header_append(struct Curl_easy *data,
                               struct SingleRequest *k,
                               size_t length)
 {
-  if(k->hbuflen + length >= data->state.headersize) {
+  size_t newsize = k->hbuflen + length;
+  if(newsize > CURL_MAX_HTTP_HEADER) {
+    /* The reason to have a max limit for this is to avoid the risk of a bad
+       server feeding libcurl with a never-ending header that will cause
+       reallocs infinitely */
+    failf(data, "Rejected %zd bytes header (max is %d)!", newsize,
+          CURL_MAX_HTTP_HEADER);
+    return CURLE_OUT_OF_MEMORY;
+  }
+  if(newsize >= data->state.headersize) {
     /* We enlarge the header buffer as it is too small */
     char *newbuff;
     size_t hbufp_index;
-    size_t newsize;
-
-    if(k->hbuflen + length > CURL_MAX_HTTP_HEADER) {
-      /* The reason to have a max limit for this is to avoid the risk of a bad
-         server feeding libcurl with a never-ending header that will cause
-         reallocs infinitely */
-      failf(data, "Avoided giant realloc for header (max is %d)!",
-            CURL_MAX_HTTP_HEADER);
-      return CURLE_OUT_OF_MEMORY;
-    }
 
     newsize = CURLMAX((k->hbuflen + length) * 3 / 2, data->state.headersize*2);
     hbufp_index = k->hbufp - data->state.headerbuff;
@@ -3692,7 +3699,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy 
*data,
       k->timeofdoc = curl_getdate(k->p + strlen("Last-Modified:"),
                                   &secs);
       if(data->set.get_filetime)
-        data->info.filetime = (long)k->timeofdoc;
+        data->info.filetime = k->timeofdoc;
     }
     else if((checkprefix("WWW-Authenticate:", k->p) &&
              (401 == k->httpcode)) ||
diff --git a/lib/http.h b/lib/http.h
index 0252f63db..35b829679 100644
--- a/lib/http.h
+++ b/lib/http.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -172,8 +172,6 @@ struct HTTP {
   size_t pauselen; /* the number of bytes left in data */
   bool closed; /* TRUE on HTTP2 stream close */
   bool close_handled; /* TRUE if stream closure is handled by libcurl */
-  uint32_t error_code; /* HTTP/2 error code */
-
   char *mem;     /* points to a buffer in memory to store received data */
   size_t len;    /* size of the buffer 'mem' points to */
   size_t memlen; /* size of data copied to mem */
@@ -226,6 +224,7 @@ struct http_conn {
   /* list of settings that will be sent */
   nghttp2_settings_entry local_settings[3];
   size_t local_settings_num;
+  uint32_t error_code; /* HTTP/2 error code */
 #else
   int unused; /* prevent a compiler warning */
 #endif
diff --git a/lib/http2.c b/lib/http2.c
index 866733576..fd32b2405 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -65,6 +65,12 @@
 
 #define HTTP2_HUGE_WINDOW_SIZE (1 << 30)
 
+#ifdef DEBUG_HTTP2
+#define H2BUGF(x) x
+#else
+#define H2BUGF(x) do { } WHILE_FALSE
+#endif
+
 /*
  * Curl_http2_init_state() is called when the easy handle is created and
  * allows for HTTP/2 specific init of state.
@@ -140,13 +146,13 @@ static CURLcode http2_disconnect(struct connectdata *conn,
   struct http_conn *c = &conn->proto.httpc;
   (void)dead_connection;
 
-  DEBUGF(infof(conn->data, "HTTP/2 DISCONNECT starts now\n"));
+  H2BUGF(infof(conn->data, "HTTP/2 DISCONNECT starts now\n"));
 
   nghttp2_session_del(c->h2);
   Curl_safefree(c->inbuf);
   http2_stream_free(conn->data->req.protop);
 
-  DEBUGF(infof(conn->data, "HTTP/2 DISCONNECT done\n"));
+  H2BUGF(infof(conn->data, "HTTP/2 DISCONNECT done\n"));
 
   return CURLE_OK;
 }
@@ -204,7 +210,6 @@ void Curl_http2_setup_req(struct Curl_easy *data)
   http->status_code = -1;
   http->pausedata = NULL;
   http->pauselen = 0;
-  http->error_code = NGHTTP2_NO_ERROR;
   http->closed = FALSE;
   http->close_handled = FALSE;
   http->mem = data->state.buffer;
@@ -217,6 +222,7 @@ void Curl_http2_setup_conn(struct connectdata *conn)
 {
   conn->proto.httpc.settings.max_concurrent_streams =
     DEFAULT_MAX_CONCURRENT_STREAMS;
+  conn->proto.httpc.error_code = NGHTTP2_NO_ERROR;
 }
 
 /*
@@ -428,7 +434,7 @@ static int push_promise(struct Curl_easy *data,
                         const nghttp2_push_promise *frame)
 {
   int rv;
-  DEBUGF(infof(data, "PUSH_PROMISE received, stream %u!\n",
+  H2BUGF(infof(data, "PUSH_PROMISE received, stream %u!\n",
                frame->promised_stream_id));
   if(data->multi->push_cb) {
     struct HTTP *stream;
@@ -448,7 +454,7 @@ static int push_promise(struct Curl_easy *data,
     heads.data = data;
     heads.frame = frame;
     /* ask the application */
-    DEBUGF(infof(data, "Got PUSH_PROMISE, ask application!\n"));
+    H2BUGF(infof(data, "Got PUSH_PROMISE, ask application!\n"));
 
     stream = data->req.protop;
     if(!stream) {
@@ -458,9 +464,11 @@ static int push_promise(struct Curl_easy *data,
       goto fail;
     }
 
+    Curl_set_in_callback(data, true);
     rv = data->multi->push_cb(data, newhandle,
                               stream->push_headers_used, &heads,
                               data->multi->push_userp);
+    Curl_set_in_callback(data, false);
 
     /* free the headers again */
     for(i = 0; i<stream->push_headers_used; i++)
@@ -497,7 +505,7 @@ static int push_promise(struct Curl_easy *data,
                                          frame->promised_stream_id, newhandle);
   }
   else {
-    DEBUGF(infof(data, "Got PUSH_PROMISE, ignore it!\n"));
+    H2BUGF(infof(data, "Got PUSH_PROMISE, ignore it!\n"));
     rv = 1;
   }
   fail:
@@ -520,21 +528,22 @@ static int on_frame_recv(nghttp2_session *session, const 
nghttp2_frame *frame,
     /* stream ID zero is for connection-oriented stuff */
     if(frame->hd.type == NGHTTP2_SETTINGS) {
       uint32_t max_conn = httpc->settings.max_concurrent_streams;
-      DEBUGF(infof(conn->data, "Got SETTINGS\n"));
+      H2BUGF(infof(conn->data, "Got SETTINGS\n"));
       httpc->settings.max_concurrent_streams =
         nghttp2_session_get_remote_settings(
           session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS);
       httpc->settings.enable_push =
         nghttp2_session_get_remote_settings(
           session, NGHTTP2_SETTINGS_ENABLE_PUSH);
-      DEBUGF(infof(conn->data, "MAX_CONCURRENT_STREAMS == %d\n",
+      H2BUGF(infof(conn->data, "MAX_CONCURRENT_STREAMS == %d\n",
                    httpc->settings.max_concurrent_streams));
-      DEBUGF(infof(conn->data, "ENABLE_PUSH == %s\n",
+      H2BUGF(infof(conn->data, "ENABLE_PUSH == %s\n",
                    httpc->settings.enable_push?"TRUE":"false"));
       if(max_conn != httpc->settings.max_concurrent_streams) {
         /* only signal change if the value actually changed */
         infof(conn->data,
-              "Connection state changed (MAX_CONCURRENT_STREAMS updated)!\n");
+              "Connection state changed (MAX_CONCURRENT_STREAMS == %d)!\n",
+              httpc->settings.max_concurrent_streams);
         Curl_multi_connchanged(conn->data->multi);
       }
     }
@@ -545,7 +554,7 @@ static int on_frame_recv(nghttp2_session *session, const 
nghttp2_frame *frame,
     lastStream = stream_id;
   }
   if(!data_s) {
-    DEBUGF(infof(conn->data,
+    H2BUGF(infof(conn->data,
                  "No Curl_easy associated with stream: %x\n",
                  stream_id));
     return 0;
@@ -553,12 +562,12 @@ static int on_frame_recv(nghttp2_session *session, const 
nghttp2_frame *frame,
 
   stream = data_s->req.protop;
   if(!stream) {
-    DEBUGF(infof(conn->data, "No proto pointer for stream: %x\n",
+    H2BUGF(infof(conn->data, "No proto pointer for stream: %x\n",
                  stream_id));
     return NGHTTP2_ERR_CALLBACK_FAILURE;
   }
 
-  DEBUGF(infof(data_s, "on_frame_recv() header %x stream %x\n",
+  H2BUGF(infof(data_s, "on_frame_recv() header %x stream %x\n",
                frame->hd.type, stream_id));
 
   switch(frame->hd.type) {
@@ -600,7 +609,7 @@ static int on_frame_recv(nghttp2_session *session, const 
nghttp2_frame *frame,
            ncopy);
     stream->nread_header_recvbuf += ncopy;
 
-    DEBUGF(infof(data_s, "Store %zu bytes headers from stream %u at %p\n",
+    H2BUGF(infof(data_s, "Store %zu bytes headers from stream %u at %p\n",
                  ncopy, stream_id, stream->mem));
 
     stream->len -= ncopy;
@@ -629,7 +638,7 @@ static int on_frame_recv(nghttp2_session *session, const 
nghttp2_frame *frame,
     }
     break;
   default:
-    DEBUGF(infof(conn->data, "Got frame type %x for stream %u!\n",
+    H2BUGF(infof(conn->data, "Got frame type %x for stream %u!\n",
                  frame->hd.type, stream_id));
     break;
   }
@@ -642,13 +651,13 @@ static int on_invalid_frame_recv(nghttp2_session *session,
 {
   struct Curl_easy *data_s = NULL;
   (void)userp;
-#if !defined(DEBUGBUILD) || defined(CURL_DISABLE_VERBOSE_STRINGS)
+#if !defined(DEBUG_HTTP2) || defined(CURL_DISABLE_VERBOSE_STRINGS)
   (void)lib_error_code;
 #endif
 
   data_s = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
   if(data_s) {
-    DEBUGF(infof(data_s,
+    H2BUGF(infof(data_s,
                  "on_invalid_frame_recv() was called, error=%d:%s\n",
                  lib_error_code, nghttp2_strerror(lib_error_code)));
   }
@@ -693,7 +702,7 @@ static int on_data_chunk_recv(nghttp2_session *session, 
uint8_t flags,
   if(conn->data != data_s)
     Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
 
-  DEBUGF(infof(data_s, "%zu data received for stream %u "
+  H2BUGF(infof(data_s, "%zu data received for stream %u "
                "(%zu left in buffer %p, total %zu)\n",
                nread, stream_id,
                stream->len, stream->mem,
@@ -702,7 +711,7 @@ static int on_data_chunk_recv(nghttp2_session *session, 
uint8_t flags,
   if(nread < len) {
     stream->pausedata = data + nread;
     stream->pauselen = len - nread;
-    DEBUGF(infof(data_s, "NGHTTP2_ERR_PAUSE - %zu bytes out of buffer"
+    H2BUGF(infof(data_s, "NGHTTP2_ERR_PAUSE - %zu bytes out of buffer"
                  ", stream %u\n",
                  len - nread, stream_id));
     data_s->easy_conn->proto.httpc.pause_stream_id = stream_id;
@@ -730,7 +739,7 @@ static int before_frame_send(nghttp2_session *session,
 
   data_s = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
   if(data_s) {
-    DEBUGF(infof(data_s, "before_frame_send() was called\n"));
+    H2BUGF(infof(data_s, "before_frame_send() was called\n"));
   }
 
   return 0;
@@ -744,7 +753,7 @@ static int on_frame_send(nghttp2_session *session,
 
   data_s = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
   if(data_s) {
-    DEBUGF(infof(data_s, "on_frame_send() was called, length = %zd\n",
+    H2BUGF(infof(data_s, "on_frame_send() was called, length = %zd\n",
                  frame->hd.length));
   }
   return 0;
@@ -755,13 +764,13 @@ static int on_frame_not_send(nghttp2_session *session,
 {
   struct Curl_easy *data_s;
   (void)userp;
-#if !defined(DEBUGBUILD) || defined(CURL_DISABLE_VERBOSE_STRINGS)
+#if !defined(DEBUG_HTTP2) || defined(CURL_DISABLE_VERBOSE_STRINGS)
   (void)lib_error_code;
 #endif
 
   data_s = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
   if(data_s) {
-    DEBUGF(infof(data_s,
+    H2BUGF(infof(data_s,
                  "on_frame_not_send() was called, lib_error_code = %d\n",
                  lib_error_code));
   }
@@ -777,6 +786,7 @@ static int on_stream_close(nghttp2_session *session, 
int32_t stream_id,
   (void)stream_id;
 
   if(stream_id) {
+    struct http_conn *httpc;
     /* get the stream from the hash based on Stream ID, stream ID zero is for
        connection-oriented stuff */
     data_s = nghttp2_session_get_stream_user_data(session, stream_id);
@@ -785,20 +795,21 @@ static int on_stream_close(nghttp2_session *session, 
int32_t stream_id,
          decided to reject stream (e.g., PUSH_PROMISE). */
       return 0;
     }
-    DEBUGF(infof(data_s, "on_stream_close(), %s (err %d), stream %u\n",
+    H2BUGF(infof(data_s, "on_stream_close(), %s (err %d), stream %u\n",
                  Curl_http2_strerror(error_code), error_code, stream_id));
     stream = data_s->req.protop;
     if(!stream)
       return NGHTTP2_ERR_CALLBACK_FAILURE;
 
-    stream->error_code = error_code;
     stream->closed = TRUE;
     data_s->state.drain++;
-    conn->proto.httpc.drain_total++;
+    httpc = &conn->proto.httpc;
+    httpc->drain_total++;
+    httpc->error_code = error_code;
 
     /* remove the entry from the hash as the stream is now gone */
     nghttp2_session_set_stream_user_data(session, stream_id, 0);
-    DEBUGF(infof(data_s, "Removed stream %u hash!\n", stream_id));
+    H2BUGF(infof(data_s, "Removed stream %u hash!\n", stream_id));
   }
   return 0;
 }
@@ -815,7 +826,7 @@ static int on_begin_headers(nghttp2_session *session,
     return 0;
   }
 
-  DEBUGF(infof(data_s, "on_begin_headers() was called\n"));
+  H2BUGF(infof(data_s, "on_begin_headers() was called\n"));
 
   if(frame->hd.type != NGHTTP2_HEADERS) {
     return 0;
@@ -827,7 +838,7 @@ static int on_begin_headers(nghttp2_session *session,
   }
 
   /* This is trailer HEADERS started.  Allocate buffer for them. */
-  DEBUGF(infof(data_s, "trailer field started\n"));
+  H2BUGF(infof(data_s, "trailer field started\n"));
 
   DEBUGASSERT(stream->trailer_recvbuf == NULL);
 
@@ -928,7 +939,7 @@ static int on_header(nghttp2_session *session, const 
nghttp2_frame *frame,
     /* 4 is for ": " and "\r\n". */
     uint32_t n = (uint32_t)(namelen + valuelen + 4);
 
-    DEBUGF(infof(data_s, "h2 trailer: %.*s: %.*s\n", namelen, name, valuelen,
+    H2BUGF(infof(data_s, "h2 trailer: %.*s: %.*s\n", namelen, name, valuelen,
                  value));
 
     Curl_add_buffer(stream->trailer_recvbuf, &n, sizeof(n));
@@ -956,7 +967,7 @@ static int on_header(nghttp2_session *session, const 
nghttp2_frame *frame,
     if(conn->data != data_s)
       Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
 
-    DEBUGF(infof(data_s, "h2 status: HTTP/2 %03d (easy %p)\n",
+    H2BUGF(infof(data_s, "h2 status: HTTP/2 %03d (easy %p)\n",
                  stream->status_code, data_s));
     return 0;
   }
@@ -972,7 +983,7 @@ static int on_header(nghttp2_session *session, const 
nghttp2_frame *frame,
   if(conn->data != data_s)
     Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
 
-  DEBUGF(infof(data_s, "h2 header: %.*s: %.*s\n", namelen, name, valuelen,
+  H2BUGF(infof(data_s, "h2 header: %.*s: %.*s\n", namelen, name, valuelen,
                value));
 
   return 0; /* 0 is successful */
@@ -1021,7 +1032,7 @@ static ssize_t data_source_read_callback(nghttp2_session 
*session,
   else if(nread == 0)
     return NGHTTP2_ERR_DEFERRED;
 
-  DEBUGF(infof(data_s, "data_source_read_callback: "
+  H2BUGF(infof(data_s, "data_source_read_callback: "
                "returns %zu bytes stream %u\n",
                nread, stream_id));
 
@@ -1067,7 +1078,7 @@ void Curl_http2_done(struct connectdata *conn, bool 
premature)
   struct http_conn *httpc = &conn->proto.httpc;
 
   if(http->header_recvbuf) {
-    DEBUGF(infof(data, "free header_recvbuf!!\n"));
+    H2BUGF(infof(data, "free header_recvbuf!!\n"));
     Curl_add_buffer_free(http->header_recvbuf);
     http->header_recvbuf = NULL; /* clear the pointer */
     Curl_add_buffer_free(http->trailer_recvbuf);
@@ -1225,13 +1236,14 @@ static int h2_session_send(struct Curl_easy *data,
  * This function returns 0 if it succeeds, or -1 and error code will
  * be assigned to *err.
  */
-static int h2_process_pending_input(struct Curl_easy *data,
+static int h2_process_pending_input(struct connectdata *conn,
                                     struct http_conn *httpc,
                                     CURLcode *err)
 {
   ssize_t nread;
   char *inbuf;
   ssize_t rv;
+  struct Curl_easy *data = conn->data;
 
   nread = httpc->inbuflen - httpc->nread_inbuf;
   inbuf = httpc->inbuf + httpc->nread_inbuf;
@@ -1246,7 +1258,7 @@ static int h2_process_pending_input(struct Curl_easy 
*data,
   }
 
   if(nread == rv) {
-    DEBUGF(infof(data,
+    H2BUGF(infof(data,
                  "h2_process_pending_input: All data in connection buffer "
                  "processed\n"));
     httpc->inbuflen = 0;
@@ -1254,7 +1266,7 @@ static int h2_process_pending_input(struct Curl_easy 
*data,
   }
   else {
     httpc->nread_inbuf += rv;
-    DEBUGF(infof(data,
+    H2BUGF(infof(data,
                  "h2_process_pending_input: %zu bytes left in connection "
                  "buffer\n",
                  httpc->inbuflen - httpc->nread_inbuf));
@@ -1267,9 +1279,15 @@ static int h2_process_pending_input(struct Curl_easy 
*data,
   }
 
   if(should_close_session(httpc)) {
-    DEBUGF(infof(data,
+    H2BUGF(infof(data,
                  "h2_process_pending_input: nothing to do in this session\n"));
-    *err = CURLE_HTTP2;
+    if(httpc->error_code)
+      *err = CURLE_HTTP2;
+    else {
+      /* not an error per se, but should still close the connection */
+      connclose(conn, "GOAWAY received");
+      *err = CURLE_OK;
+    }
     return -1;
   }
 
@@ -1300,7 +1318,7 @@ CURLcode Curl_http2_done_sending(struct connectdata *conn)
          that it can signal EOF to nghttp2 */
       (void)nghttp2_session_resume_data(h2, stream->stream_id);
 
-      (void)h2_process_pending_input(conn->data, httpc, &result);
+      (void)h2_process_pending_input(conn, httpc, &result);
     }
   }
   return result;
@@ -1324,7 +1342,7 @@ static ssize_t http2_handle_stream_close(struct 
connectdata *conn,
   data->state.drain = 0;
 
   if(httpc->pause_stream_id == 0) {
-    if(h2_process_pending_input(data, httpc, err) != 0) {
+    if(h2_process_pending_input(conn, httpc, err) != 0) {
       return -1;
     }
   }
@@ -1333,10 +1351,10 @@ static ssize_t http2_handle_stream_close(struct 
connectdata *conn,
 
   /* Reset to FALSE to prevent infinite loop in readwrite_data function. */
   stream->closed = FALSE;
-  if(stream->error_code != NGHTTP2_NO_ERROR) {
+  if(httpc->error_code != NGHTTP2_NO_ERROR) {
     failf(data, "HTTP/2 stream %u was not closed cleanly: %s (err %d)",
-          stream->stream_id, Curl_http2_strerror(stream->error_code),
-          stream->error_code);
+          stream->stream_id, Curl_http2_strerror(httpc->error_code),
+          httpc->error_code);
     *err = CURLE_HTTP2_STREAM;
     return -1;
   }
@@ -1370,7 +1388,7 @@ static ssize_t http2_handle_stream_close(struct 
connectdata *conn,
 
   stream->close_handled = TRUE;
 
-  DEBUGF(infof(data, "http2_recv returns 0, http2_handle_stream_close\n"));
+  H2BUGF(infof(data, "http2_recv returns 0, http2_handle_stream_close\n"));
   return 0;
 }
 
@@ -1411,7 +1429,7 @@ static int h2_session_send(struct Curl_easy *data,
 
     h2_pri_spec(data, &pri_spec);
 
-    DEBUGF(infof(data, "Queuing PRIORITY on stream %u (easy %p)\n",
+    H2BUGF(infof(data, "Queuing PRIORITY on stream %u (easy %p)\n",
                  stream->stream_id, data));
     rv = nghttp2_submit_priority(h2, NGHTTP2_FLAG_NONE, stream->stream_id,
                                  &pri_spec);
@@ -1435,7 +1453,7 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
   (void)sockindex; /* we always do HTTP2 on sockindex 0 */
 
   if(should_close_session(httpc)) {
-    DEBUGF(infof(data,
+    H2BUGF(infof(data,
                  "http2_recv: nothing to do in this session\n"));
     *err = CURLE_HTTP2;
     return -1;
@@ -1461,16 +1479,16 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
            ncopy);
     stream->nread_header_recvbuf += ncopy;
 
-    DEBUGF(infof(data, "http2_recv: Got %d bytes from header_recvbuf\n",
+    H2BUGF(infof(data, "http2_recv: Got %d bytes from header_recvbuf\n",
                  (int)ncopy));
     return ncopy;
   }
 
-  DEBUGF(infof(data, "http2_recv: easy %p (stream %u)\n",
+  H2BUGF(infof(data, "http2_recv: easy %p (stream %u)\n",
                data, stream->stream_id));
 
   if((data->state.drain) && stream->memlen) {
-    DEBUGF(infof(data, "http2_recv: DRAIN %zu bytes stream %u!! (%p => %p)\n",
+    H2BUGF(infof(data, "http2_recv: DRAIN %zu bytes stream %u!! (%p => %p)\n",
                  stream->memlen, stream->stream_id,
                  stream->mem, mem));
     if(mem != stream->mem) {
@@ -1484,7 +1502,7 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
       /* We have paused nghttp2, but we have no pause data (see
          on_data_chunk_recv). */
       httpc->pause_stream_id = 0;
-      if(h2_process_pending_input(data, httpc, &result) != 0) {
+      if(h2_process_pending_input(conn, httpc, &result) != 0) {
         *err = result;
         return -1;
       }
@@ -1500,7 +1518,7 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
 
     infof(data, "%zu data bytes written\n", nread);
     if(stream->pauselen == 0) {
-      DEBUGF(infof(data, "Unpaused by stream %u\n", stream->stream_id));
+      H2BUGF(infof(data, "Unpaused by stream %u\n", stream->stream_id));
       DEBUGASSERT(httpc->pause_stream_id == stream->stream_id);
       httpc->pause_stream_id = 0;
 
@@ -1514,12 +1532,12 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
          frames, then we have to call it again with 0-length data.
          Without this, on_stream_close callback will not be called,
          and stream could be hanged. */
-      if(h2_process_pending_input(data, httpc, &result) != 0) {
+      if(h2_process_pending_input(conn, httpc, &result) != 0) {
         *err = result;
         return -1;
       }
     }
-    DEBUGF(infof(data, "http2_recv: returns unpaused %zd bytes on stream %u\n",
+    H2BUGF(infof(data, "http2_recv: returns unpaused %zd bytes on stream %u\n",
                  nread, stream->stream_id));
     return nread;
   }
@@ -1532,7 +1550,7 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
        socket is not read.  But it seems that usually streams are
        notified with its drain property, and socket is read again
        quickly. */
-    DEBUGF(infof(data, "stream %x is paused, pause id: %x\n",
+    H2BUGF(infof(data, "stream %x is paused, pause id: %x\n",
                  stream->stream_id, httpc->pause_stream_id));
     *err = CURLE_AGAIN;
     return -1;
@@ -1566,7 +1584,7 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
         return -1;
       }
 
-      DEBUGF(infof(data, "nread=%zd\n", nread));
+      H2BUGF(infof(data, "nread=%zd\n", nread));
 
       httpc->inbuflen = nread;
       inbuf = httpc->inbuf;
@@ -1575,7 +1593,7 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
       nread = httpc->inbuflen - httpc->nread_inbuf;
       inbuf = httpc->inbuf + httpc->nread_inbuf;
 
-      DEBUGF(infof(data, "Use data left in connection buffer, nread=%zd\n",
+      H2BUGF(infof(data, "Use data left in connection buffer, nread=%zd\n",
                    nread));
     }
     rv = nghttp2_session_mem_recv(httpc->h2, (const uint8_t *)inbuf, nread);
@@ -1586,15 +1604,15 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
       *err = CURLE_RECV_ERROR;
       return -1;
     }
-    DEBUGF(infof(data, "nghttp2_session_mem_recv() returns %zd\n", rv));
+    H2BUGF(infof(data, "nghttp2_session_mem_recv() returns %zd\n", rv));
     if(nread == rv) {
-      DEBUGF(infof(data, "All data in connection buffer processed\n"));
+      H2BUGF(infof(data, "All data in connection buffer processed\n"));
       httpc->inbuflen = 0;
       httpc->nread_inbuf = 0;
     }
     else {
       httpc->nread_inbuf += rv;
-      DEBUGF(infof(data, "%zu bytes left in connection buffer\n",
+      H2BUGF(infof(data, "%zu bytes left in connection buffer\n",
                    httpc->inbuflen - httpc->nread_inbuf));
     }
     /* Always send pending frames in nghttp2 session, because
@@ -1606,21 +1624,21 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
     }
 
     if(should_close_session(httpc)) {
-      DEBUGF(infof(data, "http2_recv: nothing to do in this session\n"));
+      H2BUGF(infof(data, "http2_recv: nothing to do in this session\n"));
       *err = CURLE_HTTP2;
       return -1;
     }
   }
   if(stream->memlen) {
     ssize_t retlen = stream->memlen;
-    DEBUGF(infof(data, "http2_recv: returns %zd for stream %u\n",
+    H2BUGF(infof(data, "http2_recv: returns %zd for stream %u\n",
                  retlen, stream->stream_id));
     stream->memlen = 0;
 
     if(httpc->pause_stream_id == stream->stream_id) {
       /* data for this stream is returned now, but this stream caused a pause
          already so we need it called again asap */
-      DEBUGF(infof(data, "Data returned for PAUSED stream %u\n",
+      H2BUGF(infof(data, "Data returned for PAUSED stream %u\n",
                    stream->stream_id));
     }
     else if(!stream->closed) {
@@ -1637,7 +1655,7 @@ static ssize_t http2_recv(struct connectdata *conn, int 
sockindex,
     return http2_handle_stream_close(conn, data, stream, err);
   }
   *err = CURLE_AGAIN;
-  DEBUGF(infof(data, "http2_recv returns AGAIN for stream %u\n",
+  H2BUGF(infof(data, "http2_recv returns AGAIN for stream %u\n",
                stream->stream_id));
   return -1;
 }
@@ -1739,7 +1757,7 @@ static ssize_t http2_send(struct connectdata *conn, int 
sockindex,
 
   (void)sockindex;
 
-  DEBUGF(infof(conn->data, "http2_send len=%zu\n", len));
+  H2BUGF(infof(conn->data, "http2_send len=%zu\n", len));
 
   if(stream->stream_id != -1) {
     if(stream->close_handled) {
@@ -1768,7 +1786,7 @@ static ssize_t http2_send(struct connectdata *conn, int 
sockindex,
     stream->upload_len = 0;
 
     if(should_close_session(httpc)) {
-      DEBUGF(infof(conn->data, "http2_send: nothing to do in this session\n"));
+      H2BUGF(infof(conn->data, "http2_send: nothing to do in this session\n"));
       *err = CURLE_HTTP2;
       return -1;
     }
@@ -1781,7 +1799,7 @@ static ssize_t http2_send(struct connectdata *conn, int 
sockindex,
       nghttp2_session_resume_data(h2, stream->stream_id);
     }
 
-    DEBUGF(infof(conn->data, "http2_send returns %zu for stream %u\n", len,
+    H2BUGF(infof(conn->data, "http2_send returns %zu for stream %u\n", len,
                  stream->stream_id));
     return len;
   }
@@ -1937,7 +1955,7 @@ static ssize_t http2_send(struct connectdata *conn, int 
sockindex,
     for(i = 0; i < nheader; ++i) {
       acc += nva[i].namelen + nva[i].valuelen;
 
-      DEBUGF(infof(conn->data, "h2 header: %.*s:%.*s\n",
+      H2BUGF(infof(conn->data, "h2 header: %.*s:%.*s\n",
                    nva[i].namelen, nva[i].name,
                    nva[i].valuelen, nva[i].value));
     }
@@ -1975,7 +1993,7 @@ static ssize_t http2_send(struct connectdata *conn, int 
sockindex,
   Curl_safefree(nva);
 
   if(stream_id < 0) {
-    DEBUGF(infof(conn->data, "http2_send() send error\n"));
+    H2BUGF(infof(conn->data, "http2_send() send error\n"));
     *err = CURLE_SEND_ERROR;
     return -1;
   }
@@ -1994,7 +2012,7 @@ static ssize_t http2_send(struct connectdata *conn, int 
sockindex,
   }
 
   if(should_close_session(httpc)) {
-    DEBUGF(infof(conn->data, "http2_send: nothing to do in this session\n"));
+    H2BUGF(infof(conn->data, "http2_send: nothing to do in this session\n"));
     *err = CURLE_HTTP2;
     return -1;
   }
@@ -2152,7 +2170,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
     return CURLE_HTTP2;
   }
 
-  DEBUGF(infof(data, "nghttp2_session_mem_recv() returns %zd\n", nproc));
+  H2BUGF(infof(data, "nghttp2_session_mem_recv() returns %zd\n", nproc));
 
   if((ssize_t)nread == nproc) {
     httpc->inbuflen = 0;
@@ -2172,7 +2190,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
   }
 
   if(should_close_session(httpc)) {
-    DEBUGF(infof(data,
+    H2BUGF(infof(data,
                  "nghttp2_session_send(): nothing to do in this session\n"));
     return CURLE_HTTP2;
   }
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 161642969..8368eeca6 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -74,15 +74,6 @@
 
  */
 
-/* Check for an ASCII hex digit.
- We avoid the use of isxdigit to accommodate non-ASCII hosts. */
-static bool Curl_isxdigit(char digit)
-{
-  return ( (digit >= 0x30 && digit <= 0x39) /* 0-9 */
-        || (digit >= 0x41 && digit <= 0x46) /* A-F */
-        || (digit >= 0x61 && digit <= 0x66) /* a-f */) ? TRUE : FALSE;
-}
-
 void Curl_httpchunk_init(struct connectdata *conn)
 {
   struct Curl_chunker *chunk = &conn->chunk;
@@ -187,15 +178,15 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
       piece = curlx_sotouz((ch->datasize >= length)?length:ch->datasize);
 
       /* Write the data portion available */
-      if(conn->data->set.http_ce_skip || !k->writer_stack) {
-        if(!k->ignorebody)
+      if(!conn->data->set.http_te_skip && !k->ignorebody) {
+        if(!conn->data->set.http_ce_skip && k->writer_stack)
+          result = Curl_unencode_write(conn, k->writer_stack, datap, piece);
+        else
           result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, piece);
-      }
-      else
-        result = Curl_unencode_write(conn, k->writer_stack, datap, piece);
 
-      if(result)
-        return CHUNKE_WRITE_ERROR;
+        if(result)
+          return CHUNKE_WRITE_ERROR;
+      }
 
       *wrote += piece;
       ch->datasize -= piece; /* decrease amount left to expect */
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index 99c12dd68..4465befa1 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -252,7 +252,7 @@ static CURLcode CONNECT(struct connectdata *conn,
           return CURLE_OUT_OF_MEMORY;
         }
 
-        if(!Curl_checkProxyheaders(conn, "Host:")) {
+        if(!Curl_checkProxyheaders(conn, "Host")) {
           host = aprintf("Host: %s\r\n", hostheader);
           if(!host) {
             free(hostheader);
@@ -260,10 +260,10 @@ static CURLcode CONNECT(struct connectdata *conn,
             return CURLE_OUT_OF_MEMORY;
           }
         }
-        if(!Curl_checkProxyheaders(conn, "Proxy-Connection:"))
+        if(!Curl_checkProxyheaders(conn, "Proxy-Connection"))
           proxyconn = "Proxy-Connection: Keep-Alive\r\n";
 
-        if(!Curl_checkProxyheaders(conn, "User-Agent:") &&
+        if(!Curl_checkProxyheaders(conn, "User-Agent") &&
            data->set.str[STRING_USERAGENT])
           useragent = conn->allocptr.uagent;
 
diff --git a/lib/krb5.c b/lib/krb5.c
index 35a4ca0c2..8b5a24720 100644
--- a/lib/krb5.c
+++ b/lib/krb5.c
@@ -85,7 +85,7 @@ krb5_decode(void *app_data, void *buf, int len,
 
   enc.value = buf;
   enc.length = len;
-  maj = gss_unseal(&min, *context, &enc, &dec, NULL, NULL);
+  maj = gss_unwrap(&min, *context, &enc, &dec, NULL, NULL);
   if(maj != GSS_S_COMPLETE) {
     if(len >= 4)
       strcpy(buf, "599 ");
@@ -119,11 +119,11 @@ krb5_encode(void *app_data, const void *from, int length, 
int level, void **to)
   int len;
 
   /* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal
-   * libraries modify the input buffer in gss_seal()
+   * libraries modify the input buffer in gss_wrap()
    */
   dec.value = (void *)from;
   dec.length = length;
-  maj = gss_seal(&min, *context,
+  maj = gss_wrap(&min, *context,
                  level == PROT_PRIVATE,
                  GSS_C_QOP_DEFAULT,
                  &dec, &state, &enc);
diff --git a/lib/mime.c b/lib/mime.c
index cf3e3b4c7..4e48db7dd 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -51,10 +51,6 @@
 #endif
 
 
-#define FILE_CONTENTTYPE_DEFAULT        "application/octet-stream"
-#define MULTIPART_CONTENTTYPE_DEFAULT   "multipart/mixed"
-#define DISPOSITION_DEFAULT             "attachment"
-
 #define READ_ERROR                      ((size_t) -1)
 
 /* Encoders. */
@@ -1642,8 +1638,7 @@ static CURLcode add_content_type(struct curl_slist **slp,
                               boundary? boundary: "");
 }
 
-
-static const char *ContentTypeForFilename(const char *filename)
+const char *Curl_mime_contenttype(const char *filename)
 {
   unsigned int i;
 
@@ -1715,14 +1710,14 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part,
       contenttype = MULTIPART_CONTENTTYPE_DEFAULT;
       break;
     case MIMEKIND_FILE:
-      contenttype = ContentTypeForFilename(part->filename);
+      contenttype = Curl_mime_contenttype(part->filename);
       if(!contenttype)
-        contenttype = ContentTypeForFilename(part->data);
+        contenttype = Curl_mime_contenttype(part->data);
       if(!contenttype && part->filename)
         contenttype = FILE_CONTENTTYPE_DEFAULT;
       break;
     default:
-      contenttype = ContentTypeForFilename(part->filename);
+      contenttype = Curl_mime_contenttype(part->filename);
       break;
     }
   }
diff --git a/lib/mime.h b/lib/mime.h
index 920a8a77a..4d5c70404 100644
--- a/lib/mime.h
+++ b/lib/mime.h
@@ -30,6 +30,10 @@
 #define MIME_USERHEADERS_OWNER  (1 << 0)
 #define MIME_BODY_ONLY          (1 << 1)
 
+#define FILE_CONTENTTYPE_DEFAULT        "application/octet-stream"
+#define MULTIPART_CONTENTTYPE_DEFAULT   "multipart/mixed"
+#define DISPOSITION_DEFAULT             "attachment"
+
 /* Part source kinds. */
 enum mimekind {
   MIMEKIND_NONE = 0,            /* Part not set. */
@@ -134,5 +138,6 @@ size_t Curl_mime_read(char *buffer, size_t size, size_t 
nitems,
                       void *instream);
 CURLcode Curl_mime_rewind(curl_mimepart *part);
 CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...);
+const char *Curl_mime_contenttype(const char *filename);
 
 #endif /* HEADER_CURL_MIME_H */
diff --git a/lib/mk-ca-bundle.vbs b/lib/mk-ca-bundle.vbs
index a9b983e9b..8da279268 100755
--- a/lib/mk-ca-bundle.vbs
+++ b/lib/mk-ca-bundle.vbs
@@ -314,7 +314,7 @@ Function RegExprFirst(SearchPattern, TheString)
   Set objRegExp = New RegExp                    ' create a regular expression.
   objRegExp.Pattern = SearchPattern             ' sets the search pattern.
   objRegExp.IgnoreCase = TRUE                   ' set to ignores case.
-  objRegExp.Global = TRUE                       ' set to gloabal search.
+  objRegExp.Global = TRUE                       ' set to global search.
   Set Matches = objRegExp.Execute(TheString)    ' do the search.
   If (Matches.Count) Then
     RegExprFirst = Matches(0).SubMatches(0)     ' return first match.
diff --git a/lib/multi.c b/lib/multi.c
index ed29c7cbc..5641effe2 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -366,6 +366,9 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
   if(data->multi)
     return CURLM_ADDED_ALREADY;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   /* Initialize timeout list for this handle */
   Curl_llist_init(&data->state.timeoutlist, NULL);
 
@@ -535,11 +538,8 @@ static CURLcode multi_done(struct connectdata **connp,
       result = CURLE_ABORTED_BY_CALLBACK;
   }
 
-  if(conn->send_pipe.size + conn->recv_pipe.size != 0 &&
-     !data->set.reuse_forbid &&
-     !conn->bits.close) {
-    /* Stop if pipeline is not empty and we do not have to close
-       connection. */
+  if(conn->send_pipe.size || conn->recv_pipe.size) {
+    /* Stop if pipeline is not empty . */
     data->easy_conn = NULL;
     DEBUGF(infof(data, "Connection still in use, no more multi_done now!\n"));
     return CURLE_OK;
@@ -640,6 +640,9 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
   if(!data->multi)
     return CURLM_OK; /* it is already removed so let's say it is fine! */
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   premature = (data->mstate < CURLM_STATE_COMPLETED) ? TRUE : FALSE;
   easy_owns_conn = (data->easy_conn && (data->easy_conn->data == easy)) ?
     TRUE : FALSE;
@@ -903,6 +906,9 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
   if(!GOOD_MULTI_HANDLE(multi))
     return CURLM_BAD_HANDLE;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   data = multi->easyp;
   while(data) {
     bitmap = multi_getsock(data, sockbunch, MAX_SOCKSPEREASYHANDLE);
@@ -956,6 +962,9 @@ CURLMcode curl_multi_wait(struct Curl_multi *multi,
   if(!GOOD_MULTI_HANDLE(multi))
     return CURLM_BAD_HANDLE;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   /* If the internally desired timeout is actually shorter than requested from
      the outside, then use the shorter time! But only if the internal timer
      is actually larger than -1! */
@@ -1121,6 +1130,9 @@ CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
 {
   CURLMcode rc;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   rc = curl_multi_add_handle(multi, data);
   if(!rc) {
     struct SingleRequest *k = &data->req;
@@ -2127,6 +2139,9 @@ CURLMcode curl_multi_perform(struct Curl_multi *multi, 
int *running_handles)
   if(!GOOD_MULTI_HANDLE(multi))
     return CURLM_BAD_HANDLE;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   data = multi->easyp;
   while(data) {
     CURLMcode result;
@@ -2174,6 +2189,9 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
   struct Curl_easy *nextdata;
 
   if(GOOD_MULTI_HANDLE(multi)) {
+    if(multi->in_callback)
+      return CURLM_RECURSIVE_API_CALL;
+
     multi->type = 0; /* not good anymore */
 
     /* Firsrt remove all remaining easy handles */
@@ -2234,7 +2252,9 @@ CURLMsg *curl_multi_info_read(struct Curl_multi *multi, 
int *msgs_in_queue)
 
   *msgs_in_queue = 0; /* default to none */
 
-  if(GOOD_MULTI_HANDLE(multi) && Curl_llist_count(&multi->msglist)) {
+  if(GOOD_MULTI_HANDLE(multi) &&
+     !multi->in_callback &&
+     Curl_llist_count(&multi->msglist)) {
     /* there is one or more messages in the list */
     struct curl_llist_element *e;
 
@@ -2624,6 +2644,9 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi,
   if(!GOOD_MULTI_HANDLE(multi))
     return CURLM_BAD_HANDLE;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   va_start(param, option);
 
   switch(option) {
@@ -2688,7 +2711,10 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi,
 CURLMcode curl_multi_socket(struct Curl_multi *multi, curl_socket_t s,
                             int *running_handles)
 {
-  CURLMcode result = multi_socket(multi, FALSE, s, 0, running_handles);
+  CURLMcode result;
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+  result = multi_socket(multi, FALSE, s, 0, running_handles);
   if(CURLM_OK >= result)
     update_timer(multi);
   return result;
@@ -2697,8 +2723,10 @@ CURLMcode curl_multi_socket(struct Curl_multi *multi, 
curl_socket_t s,
 CURLMcode curl_multi_socket_action(struct Curl_multi *multi, curl_socket_t s,
                                    int ev_bitmask, int *running_handles)
 {
-  CURLMcode result = multi_socket(multi, FALSE, s,
-                                  ev_bitmask, running_handles);
+  CURLMcode result;
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+  result = multi_socket(multi, FALSE, s, ev_bitmask, running_handles);
   if(CURLM_OK >= result)
     update_timer(multi);
   return result;
@@ -2707,8 +2735,10 @@ CURLMcode curl_multi_socket_action(struct Curl_multi 
*multi, curl_socket_t s,
 CURLMcode curl_multi_socket_all(struct Curl_multi *multi, int *running_handles)
 
 {
-  CURLMcode result = multi_socket(multi, TRUE, CURL_SOCKET_BAD, 0,
-                                  running_handles);
+  CURLMcode result;
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+  result = multi_socket(multi, TRUE, CURL_SOCKET_BAD, 0, running_handles);
   if(CURLM_OK >= result)
     update_timer(multi);
   return result;
@@ -2760,6 +2790,9 @@ CURLMcode curl_multi_timeout(struct Curl_multi *multi,
   if(!GOOD_MULTI_HANDLE(multi))
     return CURLM_BAD_HANDLE;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   return multi_timeout(multi, timeout_ms);
 }
 
@@ -2992,6 +3025,9 @@ CURLMcode curl_multi_assign(struct Curl_multi *multi, 
curl_socket_t s,
 {
   struct Curl_sh_entry *there = NULL;
 
+  if(multi->in_callback)
+    return CURLM_RECURSIVE_API_CALL;
+
   there = sh_getentry(&multi->sockhash, s);
 
   if(!there)
@@ -3054,6 +3090,20 @@ void Curl_multi_process_pending_handles(struct 
Curl_multi *multi)
   }
 }
 
+void Curl_set_in_callback(struct Curl_easy *easy, bool value)
+{
+  if(easy->multi_easy)
+    easy->multi_easy->in_callback = value;
+  else if(easy->multi)
+      easy->multi->in_callback = value;
+}
+
+bool Curl_is_in_callback(struct Curl_easy *easy)
+{
+  return ((easy->multi && easy->multi->in_callback) ||
+          (easy->multi_easy && easy->multi_easy->in_callback));
+}
+
 #ifdef DEBUGBUILD
 void Curl_multi_dump(struct Curl_multi *multi)
 {
diff --git a/lib/multihandle.h b/lib/multihandle.h
index de9a7cf59..1a5017f4a 100644
--- a/lib/multihandle.h
+++ b/lib/multihandle.h
@@ -146,6 +146,7 @@ struct Curl_multi {
   void *timer_userp;
   struct curltime timer_lastcall; /* the fixed time for the timeout for the
                                     previous callback */
+  bool in_callback;            /* true while executing a callback */
 };
 
 #endif /* HEADER_CURL_MULTIHANDLE_H */
diff --git a/lib/multiif.h b/lib/multiif.h
index a877571a0..a988bfd4a 100644
--- a/lib/multiif.h
+++ b/lib/multiif.h
@@ -31,6 +31,8 @@ void Curl_expire_clear(struct Curl_easy *data);
 void Curl_expire_done(struct Curl_easy *data, expire_id id);
 bool Curl_pipeline_wanted(const struct Curl_multi* multi, int bits);
 void Curl_multi_handlePipeBreak(struct Curl_easy *data);
+void Curl_set_in_callback(struct Curl_easy *data, bool value);
+bool Curl_is_in_callback(struct Curl_easy *easy);
 
 /* Internal version of curl_multi_init() accepts size parameters for the
    socket and connection hashes */
diff --git a/lib/non-ascii.c b/lib/non-ascii.c
index b9ac225e2..42400b3cb 100644
--- a/lib/non-ascii.c
+++ b/lib/non-ascii.c
@@ -30,6 +30,7 @@
 #include "formdata.h"
 #include "sendf.h"
 #include "urldata.h"
+#include "multiif.h"
 
 #include "curl_memory.h"
 /* The last #include file should be: */
@@ -84,7 +85,10 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data,
 {
   if(data && data->set.convtonetwork) {
     /* use translation callback */
-    CURLcode result = data->set.convtonetwork(buffer, length);
+    CURLcode result;
+    Curl_set_in_callback(data, true);
+    result = data->set.convtonetwork(buffer, length);
+    Curl_set_in_callback(data, false);
     if(result) {
       failf(data,
             "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s",
@@ -147,7 +151,10 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data,
 {
   if(data && data->set.convfromnetwork) {
     /* use translation callback */
-    CURLcode result = data->set.convfromnetwork(buffer, length);
+    CURLcode result;
+    Curl_set_in_callback(data, true);
+    result = data->set.convfromnetwork(buffer, length);
+    Curl_set_in_callback(data, false);
     if(result) {
       failf(data,
             "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s",
@@ -210,7 +217,10 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data,
 {
   if(data && data->set.convfromutf8) {
     /* use translation callback */
-    CURLcode result = data->set.convfromutf8(buffer, length);
+    CURLcode result;
+    Curl_set_in_callback(data, true);
+    result = data->set.convfromutf8(buffer, length);
+    Curl_set_in_callback(data, false);
     if(result) {
       failf(data,
             "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s",
diff --git a/lib/objnames.inc b/lib/objnames.inc
index 6a5b2a837..e362f6e8e 100644
--- a/lib/objnames.inc
+++ b/lib/objnames.inc
@@ -86,7 +86,7 @@ curl_10char_object_name() {
 # curl_8char_object_name
 #
 # Same as curl_10char_object_name() description and details above, except
-# that object name is limited to 8 charcters maximum.
+# that object name is limited to 8 characters maximum.
 #
 
 curl_8char_object_name() {
diff --git a/lib/openldap.c b/lib/openldap.c
index 4002e3cc2..e2308825a 100644
--- a/lib/openldap.c
+++ b/lib/openldap.c
@@ -5,8 +5,8 @@
  *                | (__| |_| |  _ <| |___
  *                 \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2010, 2017, Howard Chu, <address@hidden>
- * Copyright (C) 2011 - 2016, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 2010, Howard Chu, <address@hidden>
+ * Copyright (C) 2011 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -221,7 +221,7 @@ static CURLcode ldap_connect(struct connectdata *conn, bool 
*done)
   if(conn->handler->flags & PROTOPT_SSL)
     *ptr++ = 's';
   snprintf(ptr, sizeof(hosturl)-(ptr-hosturl), "://%s:%d",
-    conn->host.name, conn->remote_port);
+           conn->host.name, conn->remote_port);
 
 #ifdef CURL_OPENLDAP_DEBUG
   static int do_trace = 0;
@@ -286,7 +286,7 @@ static CURLcode ldap_connecting(struct connectdata *conn, 
bool *done)
 
   tvp = &tv;
 
-retry:
+  retry:
   if(!li->didbind) {
     char *binddn;
     struct berval passwd;
@@ -472,8 +472,8 @@ static ssize_t ldap_recv(struct connectdata *conn, int 
sockindex, char *buf,
     return ret;
 
   for(ent = ldap_first_message(li->ld, msg); ent;
-    ent = ldap_next_message(li->ld, ent)) {
-    struct berval bv, *bvals, **bvp = &bvals;
+      ent = ldap_next_message(li->ld, ent)) {
+    struct berval bv, *bvals;
     int binary = 0, msgtype;
     CURLcode writeerr;
 
@@ -535,12 +535,13 @@ static ssize_t ldap_recv(struct connectdata *conn, int 
sockindex, char *buf,
     }
     data->req.bytecount += bv.bv_len + 5;
 
-    for(rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp);
-      rc == LDAP_SUCCESS;
-      rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, bvp)) {
+    for(rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, &bvals);
+        (rc == LDAP_SUCCESS) && bvals;
+        rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, &bvals)) {
       int i;
 
-      if(bv.bv_val == NULL) break;
+      if(bv.bv_val == NULL)
+        break;
 
       if(bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7))
         binary = 1;
@@ -555,24 +556,24 @@ static ssize_t ldap_recv(struct connectdata *conn, int 
sockindex, char *buf,
           return -1;
         }
 
-       writeerr = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val,
-                                    bv.bv_len);
-       if(writeerr) {
-         *err = writeerr;
-         return -1;
-       }
+        writeerr = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val,
+                                     bv.bv_len);
+        if(writeerr) {
+          *err = writeerr;
+          return -1;
+        }
 
         writeerr = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)":", 1);
-       if(writeerr) {
-         *err = writeerr;
-         return -1;
-       }
+        if(writeerr) {
+          *err = writeerr;
+          return -1;
+        }
         data->req.bytecount += bv.bv_len + 2;
 
         if(!binary) {
           /* check for leading or trailing whitespace */
           if(ISSPACE(bvals[i].bv_val[0]) ||
-              ISSPACE(bvals[i].bv_val[bvals[i].bv_len-1]))
+             ISSPACE(bvals[i].bv_val[bvals[i].bv_len-1]))
             binval = 1;
           else {
             /* check for unprintable characters */
@@ -610,7 +611,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int 
sockindex, char *buf,
           data->req.bytecount += 2;
           if(val_b64_sz > 0) {
             writeerr = Curl_client_write(conn, CLIENTWRITE_BODY, val_b64,
-                                     val_b64_sz);
+                                         val_b64_sz);
             if(writeerr) {
               *err = writeerr;
               return -1;
diff --git a/lib/parsedate.c b/lib/parsedate.c
index a678ede3a..f86628741 100644
--- a/lib/parsedate.c
+++ b/lib/parsedate.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -276,26 +276,23 @@ struct my_tm {
   int tm_hour;
   int tm_mday;
   int tm_mon;
-  int tm_year;
+  int tm_year; /* full year */
 };
 
 /* struct tm to time since epoch in GMT time zone.
  * This is similar to the standard mktime function but for GMT only, and
  * doesn't suffer from the various bugs and portability problems that
  * some systems' implementations have.
+ *
+ * Returns 0 on success, otherwise non-zero.
  */
-static time_t my_timegm(struct my_tm *tm)
+static void my_timegm(struct my_tm *tm, time_t *t)
 {
   static const int month_days_cumulative [12] =
     { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
   int month, year, leap_days;
 
-  if(tm->tm_year < 70)
-    /* we don't support years before 1970 as they will cause this function
-       to return a negative value */
-    return -1;
-
-  year = tm->tm_year + 1900;
+  year = tm->tm_year;
   month = tm->tm_mon;
   if(month < 0) {
     year += (11 - month) / 12;
@@ -310,9 +307,9 @@ static time_t my_timegm(struct my_tm *tm)
   leap_days = ((leap_days / 4) - (leap_days / 100) + (leap_days / 400)
                - (1969 / 4) + (1969 / 100) - (1969 / 400));
 
-  return ((((time_t) (year - 1970) * 365
-            + leap_days + month_days_cumulative [month] + tm->tm_mday - 1) * 24
-           + tm->tm_hour) * 60 + tm->tm_min) * 60 + tm->tm_sec;
+  *t = ((((time_t) (year - 1970) * 365
+          + leap_days + month_days_cumulative[month] + tm->tm_mday - 1) * 24
+         + tm->tm_hour) * 60 + tm->tm_min) * 60 + tm->tm_sec;
 }
 
 /*
@@ -436,7 +433,7 @@ static int parsedate(const char *date, time_t *output)
           tzoff = (val/100 * 60 + val%100)*60;
 
           /* the + and - prefix indicates the local time compared to GMT,
-             this we need ther reversed math to get what we want */
+             this we need their reversed math to get what we want */
           tzoff = date[-1]=='+'?-tzoff:tzoff;
         }
 
@@ -462,7 +459,7 @@ static int parsedate(const char *date, time_t *output)
         if(!found && (dignext == DATE_YEAR) && (yearnum == -1)) {
           yearnum = val;
           found = TRUE;
-          if(yearnum < 1900) {
+          if(yearnum < 100) {
             if(yearnum > 70)
               yearnum += 1900;
             else
@@ -491,18 +488,39 @@ static int parsedate(const char *date, time_t *output)
     /* lacks vital info, fail */
     return PARSEDATE_FAIL;
 
-#if SIZEOF_TIME_T < 5
-  /* 32 bit time_t can only hold dates to the beginning of 2038 */
-  if(yearnum > 2037) {
-    *output = 0x7fffffff;
-    return PARSEDATE_LATER;
+#ifdef HAVE_TIME_T_UNSIGNED
+  if(yearnum < 1970) {
+    /* only positive numbers cannot return earlier */
+    *output = TIME_T_MIN;
+    return PARSEDATE_SOONER;
   }
 #endif
 
-  if(yearnum < 1970) {
-    *output = 0;
+#if (SIZEOF_TIME_T < 5)
+
+#ifdef HAVE_TIME_T_UNSIGNED
+  /* an unsigned 32 bit time_t can only hold dates to 2106 */
+  if(yearnum > 2105) {
+    *output = TIME_T_MAX;
+    return PARSEDATE_LATER;
+  }
+#else
+  /* a signed 32 bit time_t can only hold dates to the beginning of 2038 */
+  if(yearnum > 2037) {
+    *output = TIME_T_MAX;
+    return PARSEDATE_LATER;
+  }
+  if(yearnum < 1903) {
+    *output = TIME_T_MIN;
     return PARSEDATE_SOONER;
   }
+#endif
+
+#else
+  /* The Gregorian calendar was introduced 1582 */
+  if(yearnum < 1583)
+    return PARSEDATE_FAIL;
+#endif
 
   if((mdaynum > 31) || (monnum > 11) ||
      (hournum > 23) || (minnum > 59) || (secnum > 60))
@@ -513,31 +531,25 @@ static int parsedate(const char *date, time_t *output)
   tm.tm_hour = hournum;
   tm.tm_mday = mdaynum;
   tm.tm_mon = monnum;
-  tm.tm_year = yearnum - 1900;
-
-  /* my_timegm() returns a time_t. time_t is often 32 bits, even on many
-     architectures that feature 64 bit 'long'.
+  tm.tm_year = yearnum;
 
-     Some systems have 64 bit time_t and deal with years beyond 2038. However,
-     even on some of the systems with 64 bit time_t mktime() returns -1 for
-     dates beyond 03:14:07 UTC, January 19, 2038. (Such as AIX 5100-06)
+  /* my_timegm() returns a time_t. time_t is often 32 bits, sometimes even on
+     architectures that feature 64 bit 'long' but ultimately time_t is the
+     correct data type to use.
   */
-  t = my_timegm(&tm);
-
-  /* time zone adjust (cast t to int to compare to negative one) */
-  if(-1 != (int)t) {
+  my_timegm(&tm, &t);
 
-    /* Add the time zone diff between local time zone and GMT. */
-    long delta = (long)(tzoff!=-1?tzoff:0);
+  /* Add the time zone diff between local time zone and GMT. */
+  if(tzoff == -1)
+    tzoff = 0;
 
-    if((delta>0) && (t > LONG_MAX - delta)) {
-      *output = 0x7fffffff;
-      return PARSEDATE_LATER; /* time_t overflow */
-    }
-
-    t += delta;
+  if((tzoff > 0) && (t > TIME_T_MAX - tzoff)) {
+    *output = TIME_T_MAX;
+    return PARSEDATE_LATER; /* time_t overflow */
   }
 
+  t += tzoff;
+
   *output = t;
 
   return PARSEDATE_OK;
@@ -549,10 +561,10 @@ time_t curl_getdate(const char *p, const time_t *now)
   int rc = parsedate(p, &parsed);
   (void)now; /* legacy argument from the past that we ignore */
 
-  switch(rc) {
-  case PARSEDATE_OK:
-  case PARSEDATE_LATER:
-  case PARSEDATE_SOONER:
+  if(rc == PARSEDATE_OK) {
+    if(parsed == -1)
+      /* avoid returning -1 for a working scenario */
+      parsed++;
     return parsed;
   }
   /* everything else is fail */
diff --git a/lib/progress.c b/lib/progress.c
index cc5e8be79..ce8be7ffb 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -24,6 +24,7 @@
 
 #include "urldata.h"
 #include "sendf.h"
+#include "multiif.h"
 #include "progress.h"
 #include "curl_printf.h"
 
@@ -237,8 +238,8 @@ void Curl_pgrsStartNow(struct Curl_easy *data)
 }
 
 /*
- * This is used to handle speed limits, calculating how much milliseconds we
- * need to wait until we're back under the speed limit, if needed.
+ * This is used to handle speed limits, calculating how many milliseconds to
+ * wait until we're back under the speed limit, if needed.
  *
  * The way it works is by having a "starting point" (time & amount of data
  * transferred by then) used in the speed computation, to be used instead of
@@ -250,16 +251,15 @@ void Curl_pgrsStartNow(struct Curl_easy *data)
  * the starting point, the limit (in bytes/s), the time of the starting point
  * and the current time.
  *
- * Returns -1 if no waiting is needed (not enough data transferred since
- * starting point yet), 0 when no waiting is needed but the starting point
- * should be reset (to current), or the number of milliseconds to wait to get
- * back under the speed limit.
+ * Returns 0 if no waiting is needed or when no waiting is needed but the
+ * starting point should be reset (to current); or the number of milliseconds
+ * to wait to get back under the speed limit.
  */
-long Curl_pgrsLimitWaitTime(curl_off_t cursize,
-                            curl_off_t startsize,
-                            curl_off_t limit,
-                            struct curltime start,
-                            struct curltime now)
+timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize,
+                                  curl_off_t startsize,
+                                  curl_off_t limit,
+                                  struct curltime start,
+                                  struct curltime now)
 {
   curl_off_t size = cursize - startsize;
   time_t minimum;
@@ -269,16 +269,23 @@ long Curl_pgrsLimitWaitTime(curl_off_t cursize,
   if(start.tv_sec == 0 && start.tv_usec == 0)
     return 0;
 
-  /* not enough data yet */
-  if(size < limit)
-    return -1;
+  if(!limit)
+    return 0;
+
+  if(size < CURL_OFF_T_MAX/1000)
+    minimum = (time_t) (CURL_OFF_T_C(1000) * size / limit);
+  else {
+    minimum = (time_t) (size / limit);
+    if(minimum < TIME_T_MAX/1000)
+      minimum *= 1000;
+    else
+      minimum = TIME_T_MAX;
+  }
 
-  minimum = (time_t) (CURL_OFF_T_C(1000) * size / limit);
   actual = Curl_timediff(now, start);
 
   if(actual < minimum)
-    /* this is a conversion on some systems (64bit time_t => 32bit long) */
-    return (long)(minimum - actual);
+    return (minimum - actual);
 
   return 0;
 }
@@ -461,22 +468,26 @@ int Curl_pgrsUpdate(struct connectdata *conn)
 
     if(data->set.fxferinfo) {
       /* There's a callback set, call that */
+      Curl_set_in_callback(data, true);
       result = data->set.fxferinfo(data->set.progress_client,
                                    data->progress.size_dl,
                                    data->progress.downloaded,
                                    data->progress.size_ul,
                                    data->progress.uploaded);
+      Curl_set_in_callback(data, false);
       if(result)
         failf(data, "Callback aborted");
       return result;
     }
     if(data->set.fprogress) {
       /* The older deprecated callback is set, call that */
+      Curl_set_in_callback(data, true);
       result = data->set.fprogress(data->set.progress_client,
                                    (double)data->progress.size_dl,
                                    (double)data->progress.downloaded,
                                    (double)data->progress.size_ul,
                                    (double)data->progress.uploaded);
+      Curl_set_in_callback(data, false);
       if(result)
         failf(data, "Callback aborted");
       return result;
diff --git a/lib/progress.h b/lib/progress.h
index 9333ab25c..3c2231cb6 100644
--- a/lib/progress.h
+++ b/lib/progress.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -49,11 +49,11 @@ void Curl_pgrsSetUploadCounter(struct Curl_easy *data, 
curl_off_t size);
 int Curl_pgrsUpdate(struct connectdata *);
 void Curl_pgrsResetTransferSizes(struct Curl_easy *data);
 void Curl_pgrsTime(struct Curl_easy *data, timerid timer);
-long Curl_pgrsLimitWaitTime(curl_off_t cursize,
-                            curl_off_t startsize,
-                            curl_off_t limit,
-                            struct curltime start,
-                            struct curltime now);
+timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize,
+                                  curl_off_t startsize,
+                                  curl_off_t limit,
+                                  struct curltime start,
+                                  struct curltime now);
 
 /* Don't show progress for sizes smaller than: */
 #define LEAST_SIZE_PROGRESS BUFSIZE
diff --git a/lib/rtsp.c b/lib/rtsp.c
index d3e62aada..1b5890bc4 100644
--- a/lib/rtsp.c
+++ b/lib/rtsp.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -47,7 +47,7 @@
  *  -incoming server requests
  *      -server CSeq counter
  *  -digest authentication
- *  -connect thru proxy
+ *  -connect through proxy
  *  -pipelining?
  */
 
@@ -357,7 +357,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
   }
 
   /* Transport Header for SETUP requests */
-  p_transport = Curl_checkheaders(conn, "Transport:");
+  p_transport = Curl_checkheaders(conn, "Transport");
   if(rtspreq == RTSPREQ_SETUP && !p_transport) {
     /* New Transport: setting? */
     if(data->set.str[STRING_RTSP_TRANSPORT]) {
@@ -381,11 +381,11 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
   /* Accept Headers for DESCRIBE requests */
   if(rtspreq == RTSPREQ_DESCRIBE) {
     /* Accept Header */
-    p_accept = Curl_checkheaders(conn, "Accept:")?
+    p_accept = Curl_checkheaders(conn, "Accept")?
       NULL:"Accept: application/sdp\r\n";
 
     /* Accept-Encoding header */
-    if(!Curl_checkheaders(conn, "Accept-Encoding:") &&
+    if(!Curl_checkheaders(conn, "Accept-Encoding") &&
        data->set.str[STRING_ENCODING]) {
       Curl_safefree(conn->allocptr.accept_encoding);
       conn->allocptr.accept_encoding =
@@ -402,11 +402,11 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
      it might have been used in the proxy connect, but if we have got a header
      with the user-agent string specified, we erase the previously made string
      here. */
-  if(Curl_checkheaders(conn, "User-Agent:") && conn->allocptr.uagent) {
+  if(Curl_checkheaders(conn, "User-Agent") && conn->allocptr.uagent) {
     Curl_safefree(conn->allocptr.uagent);
     conn->allocptr.uagent = NULL;
   }
-  else if(!Curl_checkheaders(conn, "User-Agent:") &&
+  else if(!Curl_checkheaders(conn, "User-Agent") &&
           data->set.str[STRING_USERAGENT]) {
     p_uagent = conn->allocptr.uagent;
   }
@@ -421,7 +421,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
 
   /* Referrer */
   Curl_safefree(conn->allocptr.ref);
-  if(data->change.referer && !Curl_checkheaders(conn, "Referer:"))
+  if(data->change.referer && !Curl_checkheaders(conn, "Referer"))
     conn->allocptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
   else
     conn->allocptr.ref = NULL;
@@ -438,7 +438,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
      (rtspreq  & (RTSPREQ_PLAY | RTSPREQ_PAUSE | RTSPREQ_RECORD))) {
 
     /* Check to see if there is a range set in the custom headers */
-    if(!Curl_checkheaders(conn, "Range:") && data->state.range) {
+    if(!Curl_checkheaders(conn, "Range") && data->state.range) {
       Curl_safefree(conn->allocptr.rangeline);
       conn->allocptr.rangeline = aprintf("Range: %s\r\n", data->state.range);
       p_range = conn->allocptr.rangeline;
@@ -448,11 +448,11 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
   /*
    * Sanity check the custom headers
    */
-  if(Curl_checkheaders(conn, "CSeq:")) {
+  if(Curl_checkheaders(conn, "CSeq")) {
     failf(data, "CSeq cannot be set as a custom header.");
     return CURLE_RTSP_CSEQ_ERROR;
   }
-  if(Curl_checkheaders(conn, "Session:")) {
+  if(Curl_checkheaders(conn, "Session")) {
     failf(data, "Session ID cannot be set as a custom header.");
     return CURLE_BAD_FUNCTION_ARGUMENT;
   }
@@ -542,7 +542,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
     if(putsize > 0 || postsize > 0) {
       /* As stated in the http comments, it is probably not wise to
        * actually set a custom Content-Length in the headers */
-      if(!Curl_checkheaders(conn, "Content-Length:")) {
+      if(!Curl_checkheaders(conn, "Content-Length")) {
         result = Curl_add_bufferf(req_buffer,
             "Content-Length: %" CURL_FORMAT_CURL_OFF_T"\r\n",
             (data->set.upload ? putsize : postsize));
@@ -552,7 +552,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
 
       if(rtspreq == RTSPREQ_SET_PARAMETER ||
          rtspreq == RTSPREQ_GET_PARAMETER) {
-        if(!Curl_checkheaders(conn, "Content-Type:")) {
+        if(!Curl_checkheaders(conn, "Content-Type")) {
           result = Curl_add_bufferf(req_buffer,
               "Content-Type: text/parameters\r\n");
           if(result)
@@ -561,7 +561,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool 
*done)
       }
 
       if(rtspreq == RTSPREQ_ANNOUNCE) {
-        if(!Curl_checkheaders(conn, "Content-Type:")) {
+        if(!Curl_checkheaders(conn, "Content-Type")) {
           result = Curl_add_bufferf(req_buffer,
               "Content-Type: application/sdp\r\n");
           if(result)
@@ -770,7 +770,9 @@ CURLcode rtp_client_write(struct connectdata *conn, char 
*ptr, size_t len)
     user_ptr = data->set.out;
   }
 
+  Curl_set_in_callback(data, true);
   wrote = writeit(ptr, 1, len, user_ptr);
+  Curl_set_in_callback(data, false);
 
   if(CURL_WRITEFUNC_PAUSE == wrote) {
     failf(data, "Cannot pause RTP");
diff --git a/lib/sendf.c b/lib/sendf.c
index ead95a182..11593b2a0 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -37,6 +37,7 @@
 #include "connect.h"
 #include "vtls/vtls.h"
 #include "ssh.h"
+#include "easyif.h"
 #include "multiif.h"
 #include "non-ascii.h"
 #include "strerror.h"
@@ -388,7 +389,7 @@ ssize_t Curl_send_plain(struct connectdata *conn, int num,
       (WSAEWOULDBLOCK == err)
 #else
       /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned
-         due to its inability to send off data without blocking. We therefor
+         due to its inability to send off data without blocking. We therefore
          treat both error codes the same here */
       (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err) ||
       (EINPROGRESS == err)
@@ -455,7 +456,7 @@ ssize_t Curl_recv_plain(struct connectdata *conn, int num, 
char *buf,
       (WSAEWOULDBLOCK == err)
 #else
       /* errno may be EWOULDBLOCK or on some systems EAGAIN when it returned
-         due to its inability to send off data without blocking. We therefor
+         due to its inability to send off data without blocking. We therefore
          treat both error codes the same here */
       (EWOULDBLOCK == err) || (EAGAIN == err) || (EINTR == err)
 #endif
@@ -540,18 +541,20 @@ static CURLcode pausewrite(struct Curl_easy *data,
 }
 
 
-/* Curl_client_chop_write() writes chunks of data not larger than
- * CURL_MAX_WRITE_SIZE via client write callback(s) and
- * takes care of pause requests from the callbacks.
+/* chop_write() writes chunks of data not larger than CURL_MAX_WRITE_SIZE via
+ * client write callback(s) and takes care of pause requests from the
+ * callbacks.
  */
-CURLcode Curl_client_chop_write(struct connectdata *conn,
-                                int type,
-                                char *ptr,
-                                size_t len)
+static CURLcode chop_write(struct connectdata *conn,
+                           int type,
+                           char *optr,
+                           size_t olen)
 {
   struct Curl_easy *data = conn->data;
   curl_write_callback writeheader = NULL;
   curl_write_callback writebody = NULL;
+  char *ptr = optr;
+  size_t len = olen;
 
   if(!len)
     return CURLE_OK;
@@ -597,25 +600,30 @@ CURLcode Curl_client_chop_write(struct connectdata *conn,
       }
     }
 
-    if(writeheader) {
-      size_t wrote = writeheader(ptr, 1, chunklen, data->set.writeheader);
-
-      if(CURL_WRITEFUNC_PAUSE == wrote)
-        /* here we pass in the HEADER bit only since if this was body as well
-           then it was passed already and clearly that didn't trigger the
-           pause, so this is saved for later with the HEADER bit only */
-        return pausewrite(data, CLIENTWRITE_HEADER, ptr, len);
-
-      if(wrote != chunklen) {
-        failf(data, "Failed writing header");
-        return CURLE_WRITE_ERROR;
-      }
-    }
-
     ptr += chunklen;
     len -= chunklen;
   }
 
+  if(writeheader) {
+    size_t wrote;
+    ptr = optr;
+    len = olen;
+    Curl_set_in_callback(data, true);
+    wrote = writeheader(ptr, 1, len, data->set.writeheader);
+    Curl_set_in_callback(data, false);
+
+    if(CURL_WRITEFUNC_PAUSE == wrote)
+      /* here we pass in the HEADER bit only since if this was body as well
+         then it was passed already and clearly that didn't trigger the
+         pause, so this is saved for later with the HEADER bit only */
+      return pausewrite(data, CLIENTWRITE_HEADER, ptr, len);
+
+    if(wrote != len) {
+      failf(data, "Failed writing header");
+      return CURLE_WRITE_ERROR;
+    }
+  }
+
   return CURLE_OK;
 }
 
@@ -657,7 +665,7 @@ CURLcode Curl_client_write(struct connectdata *conn,
 #endif /* CURL_DO_LINEEND_CONV */
     }
 
-  return Curl_client_chop_write(conn, type, ptr, len);
+  return chop_write(conn, type, ptr, len);
 }
 
 CURLcode Curl_read_plain(curl_socket_t sockfd,
@@ -798,8 +806,11 @@ static int showit(struct Curl_easy *data, curl_infotype 
type,
   }
 #endif /* CURL_DOES_CONVERSIONS */
 
-  if(data->set.fdebug)
+  if(data->set.fdebug) {
+    Curl_set_in_callback(data, true);
     rc = (*data->set.fdebug)(data, type, ptr, size, data->set.debugdata);
+    Curl_set_in_callback(data, false);
+  }
   else {
     switch(type) {
     case CURLINFO_TEXT:
diff --git a/lib/sendf.h b/lib/sendf.h
index fbe4f99c8..7c9134dec 100644
--- a/lib/sendf.h
+++ b/lib/sendf.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -51,8 +51,6 @@ void Curl_failf(struct Curl_easy *, const char *fmt, ...);
 #define CLIENTWRITE_HEADER (1<<1)
 #define CLIENTWRITE_BOTH   (CLIENTWRITE_BODY|CLIENTWRITE_HEADER)
 
-CURLcode Curl_client_chop_write(struct connectdata *conn, int type, char *ptr,
-                                size_t len) WARN_UNUSED_RESULT;
 CURLcode Curl_client_write(struct connectdata *conn, int type, char *ptr,
                            size_t len) WARN_UNUSED_RESULT;
 
diff --git a/lib/setopt.c b/lib/setopt.c
index a5ef75c72..9c96eb358 100644
--- a/lib/setopt.c
+++ b/lib/setopt.c
@@ -43,6 +43,7 @@
 #include "sendf.h"
 #include "http2.h"
 #include "setopt.h"
+#include "multiif.h"
 
 /* The last 3 #include files should be in this order */
 #include "curl_printf.h"
@@ -361,6 +362,14 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption 
option,
     data->set.timevalue = (time_t)va_arg(param, long);
     break;
 
+  case CURLOPT_TIMEVALUE_LARGE:
+    /*
+     * This is the value to compare with the remote document with the
+     * method set with CURLOPT_TIMECONDITION
+     */
+    data->set.timevalue = (time_t)va_arg(param, curl_off_t);
+    break;
+
   case CURLOPT_SSLVERSION:
   case CURLOPT_PROXY_SSLVERSION:
     /*
@@ -2101,6 +2110,21 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption 
option,
     data->set.fclosesocket = va_arg(param, curl_closesocket_callback);
     break;
 
+  case CURLOPT_RESOLVER_START_FUNCTION:
+    /*
+     * resolver start callback function: called before a new resolver request
+     * is started
+     */
+    data->set.resolver_start = va_arg(param, curl_resolver_start_callback);
+    break;
+
+  case CURLOPT_RESOLVER_START_DATA:
+    /*
+     * resolver start callback data pointer. Might be NULL.
+     */
+    data->set.resolver_start_client = va_arg(param, void *);
+    break;
+
   case CURLOPT_CLOSESOCKETDATA:
     /*
      * socket callback data pointer. Might be NULL.
@@ -2524,6 +2548,12 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption 
option,
   case CURLOPT_SSH_COMPRESSION:
     data->set.ssh_compression = (0 != va_arg(param, long))?TRUE:FALSE;
     break;
+  case CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS:
+    arg = va_arg(param, long);
+    if(arg < 0)
+      return CURLE_BAD_FUNCTION_ARGUMENT;
+    data->set.happy_eyeballs_timeout = arg;
+    break;
   default:
     /* unknown tag and its companion, just ignore: */
     result = CURLE_UNKNOWN_OPTION;
@@ -2536,6 +2566,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption 
option,
 /*
  * curl_easy_setopt() is the external interface for setting options on an
  * easy handle.
+ *
+ * NOTE: This is one of few API functions that are allowed to be called from
+ * within a callback.
  */
 
 #undef curl_easy_setopt
diff --git a/lib/sha256.c b/lib/sha256.c
index cd81c0254..55716c63b 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -29,9 +29,17 @@
 
 #if defined(USE_OPENSSL)
 
+#include <openssl/opensslv.h>
+
+#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
+#define USE_OPENSSL_SHA256
+#endif
+
+#endif
+
+#ifdef USE_OPENSSL_SHA256
 /* When OpenSSL is available we use the SHA256-function from OpenSSL */
 #include <openssl/sha.h>
-
 #else
 
 /* When no other crypto library is available we use this code segment */
@@ -234,7 +242,7 @@ static int SHA256_Final(unsigned char *out,
     sha256_compress(md, md->buf);
     md->curlen = 0;
   }
-  /* pad upto 56 bytes of zeroes */
+  /* pad up to 56 bytes of zeroes */
   while(md->curlen < 56) {
     md->buf[md->curlen++] = (unsigned char)0;
   }
diff --git a/lib/smb.c b/lib/smb.c
index 6cb4083bb..b4326341e 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -709,14 +709,21 @@ static CURLcode smb_connection_state(struct connectdata 
*conn, bool *done)
 }
 
 /*
- * Convert a timestamp from the Windows world (100 nsec units from
- * 1 Jan 1601) to Posix time.
+ * Convert a timestamp from the Windows world (100 nsec units from 1 Jan 1601)
+ * to Posix time. Cap the output to fit within a time_t.
  */
-static void get_posix_time(long *out, curl_off_t timestamp)
+static void get_posix_time(time_t *out, curl_off_t timestamp)
 {
   timestamp -= 116444736000000000;
   timestamp /= 10000000;
-  *out = (long) timestamp;
+#if SIZEOF_TIME_T < SIZEOF_CURL_OFF_T
+  if(timestamp > TIME_T_MAX)
+    *out = TIME_T_MAX;
+  else if(timestamp < TIME_T_MIN)
+    *out = TIME_T_MIN;
+  else
+#endif
+    *out = (time_t) timestamp;
 }
 
 static CURLcode smb_request_state(struct connectdata *conn, bool *done)
diff --git a/lib/smtp.c b/lib/smtp.c
index 7fc76c956..cb04cba8c 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -1289,6 +1289,11 @@ static CURLcode smtp_perform(struct connectdata *conn, 
bool *connected,
   /* Store the first recipient (or NULL if not specified) */
   smtp->rcpt = data->set.mail_rcpt;
 
+  /* Initial data character is the first character in line: it is implicitly
+     preceded by a virtual CRLF. */
+  smtp->trailing_crlf = TRUE;
+  smtp->eob = 2;
+
   /* Start the first command in the DO phase */
   if((data->set.upload || data->set.mimepost.kind) && data->set.mail_rcpt)
     /* MAIL transfer */
diff --git a/lib/ssh-libssh.c b/lib/ssh-libssh.c
index 51e264480..944bdaf49 100644
--- a/lib/ssh-libssh.c
+++ b/lib/ssh-libssh.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2017 - 2018 Red Hat, Inc.
  *
  * Authors: Nikos Mavrogiannopoulos, Tomas Mraz, Stanislav Zidek,
  *          Robert Kolcun, Andreas Schneider
@@ -383,8 +383,10 @@ static int myssh_is_known(struct connectdata *conn)
     }
 
     /* we don't have anything equivalent to knownkey. Always NULL */
+    Curl_set_in_callback(data, true);
     rc = func(data, NULL, &foundkey, /* from the remote host */
               keymatch, data->set.ssh_keyfunc_userp);
+    Curl_set_in_callback(data, false);
 
     switch(rc) {
       case CURLKHSTAT_FINE_ADD_TO_FILE:
@@ -1046,7 +1048,7 @@ static CURLcode myssh_statemach_act(struct connectdata 
*conn, bool *block)
 
       attrs = sftp_stat(sshc->sftp_session, protop->path);
       if(attrs != 0) {
-        data->info.filetime = (long)attrs->mtime;
+        data->info.filetime = attrs->mtime;
         sftp_attributes_free(attrs);
       }
 
@@ -1128,8 +1130,10 @@ static CURLcode myssh_statemach_act(struct connectdata 
*conn, bool *block)
       if(data->state.resume_from > 0) {
         /* Let's read off the proper amount of bytes from the input. */
         if(conn->seek_func) {
+          Curl_set_in_callback(data, true);
           seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
                                     SEEK_SET);
+          Curl_set_in_callback(data, false);
         }
 
         if(seekerr != CURL_SEEKFUNC_OK) {
diff --git a/lib/ssh.c b/lib/ssh.c
index 69cfb3ffd..4a56dcccf 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -342,6 +342,7 @@ static void state(struct connectdata *conn, sshstate 
nowstate)
     "SSH_AUTH_HOST",
     "SSH_AUTH_KEY_INIT",
     "SSH_AUTH_KEY",
+    "SSH_AUTH_GSSAPI",
     "SSH_AUTH_DONE",
     "SSH_SFTP_INIT",
     "SSH_SFTP_REALPATH",
@@ -376,6 +377,7 @@ static void state(struct connectdata *conn, sshstate 
nowstate)
     "SSH_SCP_TRANS_INIT",
     "SSH_SCP_UPLOAD_INIT",
     "SSH_SCP_DOWNLOAD_INIT",
+    "SSH_SCP_DOWNLOAD",
     "SSH_SCP_DONE",
     "SSH_SCP_SEND_EOF",
     "SSH_SCP_WAIT_EOF",
@@ -386,6 +388,9 @@ static void state(struct connectdata *conn, sshstate 
nowstate)
     "QUIT"
   };
 
+  /* a precaution to make sure the lists are in sync */
+  DEBUGASSERT(sizeof(names)/sizeof(names[0]) == SSH_LAST);
+
   if(sshc->state != nowstate) {
     infof(conn->data, "SFTP %p state change from %s to %s\n",
           (void *)sshc, names[sshc->state], names[nowstate]);
@@ -523,9 +528,11 @@ static CURLcode ssh_knownhost(struct connectdata *conn)
       keymatch = (enum curl_khmatch)keycheck;
 
       /* Ask the callback how to behave */
+      Curl_set_in_callback(data, true);
       rc = func(data, knownkeyp, /* from the knownhosts file */
                 &foundkey, /* from the remote host */
                 keymatch, data->set.ssh_keyfunc_userp);
+      Curl_set_in_callback(data, false);
     }
     else
       /* no remotekey means failure! */
@@ -1627,7 +1634,7 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
         break;
       }
       if(rc == 0) {
-        data->info.filetime = (long)attrs.mtime;
+        data->info.filetime = attrs.mtime;
       }
 
       state(conn, SSH_SFTP_TRANS_INIT);
@@ -1747,8 +1754,10 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
       if(data->state.resume_from > 0) {
         /* Let's read off the proper amount of bytes from the input. */
         if(conn->seek_func) {
+          Curl_set_in_callback(data, true);
           seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
                                     SEEK_SET);
+          Curl_set_in_callback(data, false);
         }
 
         if(seekerr != CURL_SEEKFUNC_OK) {
@@ -1765,9 +1774,12 @@ static CURLcode ssh_statemach_act(struct connectdata 
*conn, bool *block)
               (size_t)data->set.buffer_size :
               curlx_sotouz(data->state.resume_from - passed);
 
-            size_t actuallyread =
-              data->state.fread_func(data->state.buffer, 1,
-                                     readthisamountnow, data->state.in);
+            size_t actuallyread;
+            Curl_set_in_callback(data, true);
+            actuallyread = data->state.fread_func(data->state.buffer, 1,
+                                                  readthisamountnow,
+                                                  data->state.in);
+            Curl_set_in_callback(data, false);
 
             passed += actuallyread;
             if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
diff --git a/lib/strerror.c b/lib/strerror.c
index 42e22ee4e..2dcf4d5a0 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -312,6 +312,9 @@ curl_easy_strerror(CURLcode error)
   case CURLE_HTTP2_STREAM:
     return "Stream error in the HTTP/2 framing layer";
 
+  case CURLE_RECURSIVE_API_CALL:
+    return "API function called from within callback";
+
     /* error codes not used by current libcurl */
   case CURLE_OBSOLETE20:
   case CURLE_OBSOLETE24:
@@ -380,6 +383,9 @@ curl_multi_strerror(CURLMcode error)
   case CURLM_ADDED_ALREADY:
     return "The easy handle is already added to a multi handle";
 
+  case CURLM_RECURSIVE_API_CALL:
+    return "API function called from within callback";
+
   case CURLM_LAST:
     break;
   }
diff --git a/lib/telnet.c b/lib/telnet.c
index b3c9cd27f..1766669ec 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -1460,7 +1460,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool 
*done)
           if(n == 0)                        /* no bytes */
             break;
 
-          readfile_read = (DWORD)n; /* fall thru with number of bytes read */
+          /* fall through with number of bytes read */
+          readfile_read = (DWORD)n;
         }
         else {
           /* read from stdin */
diff --git a/lib/transfer.c b/lib/transfer.c
index a6db3f739..ae301d230 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -85,7 +85,7 @@
     !defined(CURL_DISABLE_IMAP)
 /*
  * checkheaders() checks the linked list of custom headers for a
- * particular header (prefix).
+ * particular header (prefix). Provide the prefix without colon!
  *
  * Returns a pointer to the first matching header or NULL if none matched.
  */
@@ -97,7 +97,8 @@ char *Curl_checkheaders(const struct connectdata *conn,
   struct Curl_easy *data = conn->data;
 
   for(head = data->set.headers; head; head = head->next) {
-    if(strncasecompare(head->data, thisheader, thislen))
+    if(strncasecompare(head->data, thisheader, thislen) &&
+       Curl_headersep(head->data[thislen]) )
       return head->data;
   }
 
@@ -135,8 +136,10 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int 
bytes, int *nreadp)
 
   /* this function returns a size_t, so we typecast to int to prevent warnings
      with picky compilers */
+  Curl_set_in_callback(data, true);
   nread = (int)data->state.fread_func(data->req.upload_fromhere, 1,
                                       buffersize, data->state.in);
+  Curl_set_in_callback(data, false);
 
   if(nread == CURL_READFUNC_ABORT) {
     failf(data, "operation aborted by callback");
@@ -302,7 +305,9 @@ CURLcode Curl_readrewind(struct connectdata *conn)
     if(data->set.seek_func) {
       int err;
 
+      Curl_set_in_callback(data, true);
       err = (data->set.seek_func)(data->set.seek_client, 0, SEEK_SET);
+      Curl_set_in_callback(data, false);
       if(err) {
         failf(data, "seek callback returned error %d", (int)err);
         return CURLE_SEND_FAIL_REWIND;
@@ -311,8 +316,10 @@ CURLcode Curl_readrewind(struct connectdata *conn)
     else if(data->set.ioctl_func) {
       curlioerr err;
 
+      Curl_set_in_callback(data, true);
       err = (data->set.ioctl_func)(data, CURLIOCMD_RESTARTREAD,
                                    data->set.ioctl_client);
+      Curl_set_in_callback(data, false);
       infof(data, "the ioctl callback returned %d\n", (int)err);
 
       if(err) {
@@ -801,10 +808,15 @@ static CURLcode readwrite_data(struct Curl_easy *data,
 
     } /* if(!header and data to read) */
 
-    if(conn->handler->readwrite &&
-       (excess > 0 && !conn->bits.stream_was_rewound)) {
+    if(conn->handler->readwrite && excess && !conn->bits.stream_was_rewound) {
       /* Parse the excess data */
       k->str += nread;
+
+      if(&k->str[excess] > &k->buf[data->set.buffer_size]) {
+        /* the excess amount was too excessive(!), make sure
+           it doesn't read out of buffer */
+        excess = &k->buf[data->set.buffer_size] - k->str;
+      }
       nread = (ssize_t)excess;
 
       result = conn->handler->readwrite(data, conn, &nread, &readmore);
diff --git a/lib/transfer.h b/lib/transfer.h
index 72526a834..9ba398d27 100644
--- a/lib/transfer.h
+++ b/lib/transfer.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -22,6 +22,7 @@
  *
  ***************************************************************************/
 
+#define Curl_headersep(x) ((((x)==':') || ((x)==';')))
 char *Curl_checkheaders(const struct connectdata *conn,
                         const char *thisheader);
 
diff --git a/lib/url.c b/lib/url.c
index 74813e874..945d4e327 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -527,6 +527,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
   set->expect_100_timeout = 1000L; /* Wait for a second by default. */
   set->sep_headers = TRUE; /* separated header lists by default */
   set->buffer_size = READBUFFER_SIZE;
+  set->happy_eyeballs_timeout = CURL_HET_DEFAULT;
 
   Curl_http2_init_userset(set);
   return result;
@@ -2573,7 +2574,15 @@ static bool check_noproxy(const char *name, const char 
*no_proxy)
     /* NO_PROXY was specified and it wasn't just an asterisk */
 
     no_proxy_len = strlen(no_proxy);
-    endptr = strchr(name, ':');
+    if(name[0] == '[') {
+      /* IPv6 numerical address */
+      endptr = strchr(name, ']');
+      if(!endptr)
+        return FALSE;
+      name++;
+    }
+    else
+      endptr = strchr(name, ':');
     if(endptr)
       namelen = endptr - name;
     else
@@ -4116,7 +4125,7 @@ static CURLcode create_conn(struct Curl_easy *data,
    *************************************************************/
   if(prot_missing) {
     /* We're guessing prefixes here and if we're told to use a proxy or if
-       we're gonna follow a Location: later or... then we need the protocol
+       we're going to follow a Location: later or... then we need the protocol
        part added so that we have a valid URL. */
     char *reurl;
     char *ch_lower;
diff --git a/lib/urldata.h b/lib/urldata.h
index afc972ac0..eb61bf5d8 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1025,10 +1025,8 @@ struct PureInfo {
   int httpcode;  /* Recent HTTP, FTP, RTSP or SMTP response code */
   int httpproxycode; /* response code from proxy when received separate */
   int httpversion; /* the http version number X.Y = X*10+Y */
-  long filetime; /* If requested, this is might get set. Set to -1 if the time
-                    was unretrievable. We cannot have this of type time_t,
-                    since time_t is unsigned on several platforms such as
-                    OpenVMS. */
+  time_t filetime; /* If requested, this is might get set. Set to -1 if the
+                      time was unretrievable. */
   bool timecond;  /* set to TRUE if the time condition didn't match, which
                      thus made the document NOT get fetched */
   long header_size;  /* size of read header(s) in bytes */
@@ -1169,7 +1167,7 @@ struct Curl_http2_dep {
 };
 
 /*
- * This struct is for holding data that was attemped to get sent to the user's
+ * This struct is for holding data that was attempted to get sent to the user's
  * callback but is held due to pausing. One instance per type (BOTH, HEADER,
  * BODY).
  */
@@ -1523,6 +1521,7 @@ struct UserDefined {
   long timeout;         /* in milliseconds, 0 means no timeout */
   long connecttimeout;  /* in milliseconds, 0 means no timeout */
   long accepttimeout;   /* in milliseconds, 0 means no timeout */
+  long happy_eyeballs_timeout; /* in milliseconds, 0 is a valid value */
   long server_response_timeout; /* in milliseconds, 0 means no timeout */
   long tftp_blksize;    /* in bytes, 0 means use default */
   bool tftp_no_options; /* do not send TFTP options requests */
@@ -1683,6 +1682,10 @@ struct UserDefined {
   struct Curl_http2_dep *stream_dependents;
 
   bool abstract_unix_socket;
+
+  curl_resolver_start_callback resolver_start; /* optional callback called
+                                                  before resolver start */
+  void *resolver_start_client; /* pointer to pass to resolver start callback */
 };
 
 struct Names {
diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c
index 46b71bfd3..1bd42d2c8 100644
--- a/lib/vtls/cyassl.c
+++ b/lib/vtls/cyassl.c
@@ -199,8 +199,14 @@ cyassl_connect_step1(struct connectdata *conn,
     use_sni(TRUE);
     break;
   case CURL_SSLVERSION_TLSv1_3:
+#ifdef WOLFSSL_TLS13
+    req_method = wolfTLSv1_3_client_method();
+    use_sni(TRUE);
+    break;
+#else
     failf(data, "CyaSSL: TLS 1.3 is not yet supported");
     return CURLE_SSL_CONNECT_ERROR;
+#endif
   case CURL_SSLVERSION_SSLv3:
 #ifdef WOLFSSL_ALLOW_SSLV3
     req_method = SSLv3_client_method();
@@ -245,7 +251,11 @@ cyassl_connect_step1(struct connectdata *conn,
     */
     if((wolfSSL_CTX_SetMinVersion(BACKEND->ctx, WOLFSSL_TLSV1) != 1) &&
        (wolfSSL_CTX_SetMinVersion(BACKEND->ctx, WOLFSSL_TLSV1_1) != 1) &&
-       (wolfSSL_CTX_SetMinVersion(BACKEND->ctx, WOLFSSL_TLSV1_2) != 1)) {
+       (wolfSSL_CTX_SetMinVersion(BACKEND->ctx, WOLFSSL_TLSV1_2) != 1)
+#ifdef WOLFSSL_TLS13
+       && (wolfSSL_CTX_SetMinVersion(BACKEND->ctx, WOLFSSL_TLSV1_3) != 1)
+#endif
+      ) {
       failf(data, "SSL: couldn't set the minimum protocol version");
       return CURLE_SSL_CONNECT_ERROR;
     }
diff --git a/lib/vtls/darwinssl.c b/lib/vtls/darwinssl.c
index 53a7ec37b..694ac572d 100644
--- a/lib/vtls/darwinssl.c
+++ b/lib/vtls/darwinssl.c
@@ -1135,28 +1135,77 @@ static OSStatus CopyIdentityFromPKCS12File(const char 
*cPath,
      raise linker errors when used on that cat for some reason. */
 #if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS
   if(CFURLCreateDataAndPropertiesFromResource(NULL, pkcs_url, &pkcs_data,
-    NULL, NULL, &status)) {
+   NULL, NULL, &status)) {
+    CFArrayRef items = NULL;
+
+  /* On iOS SecPKCS12Import will never add the client certificate to the
+   * Keychain.
+   *
+   * It gives us back a SecIdentityRef that we can use directly. */
+#if CURL_BUILD_IOS
     const void *cKeys[] = {kSecImportExportPassphrase};
     const void *cValues[] = {password};
     CFDictionaryRef options = CFDictionaryCreate(NULL, cKeys, cValues,
       password ? 1L : 0L, NULL, NULL);
-    CFArrayRef items = NULL;
 
-    /* Here we go: */
-    status = SecPKCS12Import(pkcs_data, options, &items);
-    if(status == errSecSuccess && items && CFArrayGetCount(items)) {
-      CFDictionaryRef identity_and_trust = CFArrayGetValueAtIndex(items, 0L);
-      const void *temp_identity = CFDictionaryGetValue(identity_and_trust,
-        kSecImportItemIdentity);
+    if(options != NULL) {
+      status = SecPKCS12Import(pkcs_data, options, &items);
+      CFRelease(options);
+    }
+
 
-      /* Retain the identity; we don't care about any other data... */
-      CFRetain(temp_identity);
-      *out_cert_and_key = (SecIdentityRef)temp_identity;
+  /* On macOS SecPKCS12Import will always add the client certificate to
+   * the Keychain.
+   *
+   * As this doesn't match iOS, and apps may not want to see their client
+   * certificate saved in the the user's keychain, we use SecItemImport
+   * with a NULL keychain to avoid importing it.
+   *
+   * This returns a SecCertificateRef from which we can construct a
+   * SecIdentityRef.
+   */
+#elif CURL_BUILD_MAC_10_7
+    SecItemImportExportKeyParameters keyParams;
+    SecExternalFormat inputFormat = kSecFormatPKCS12;
+    SecExternalItemType inputType = kSecItemTypeCertificate;
+
+    memset(&keyParams, 0x00, sizeof(keyParams));
+    keyParams.version    = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
+    keyParams.passphrase = password;
+
+    status = SecItemImport(pkcs_data, NULL, &inputFormat, &inputType,
+                           0, &keyParams, NULL, &items);
+#endif
+
+
+    /* Extract the SecIdentityRef */
+    if(status == errSecSuccess && items && CFArrayGetCount(items)) {
+      CFIndex i, count;
+      count = CFArrayGetCount(items);
+
+      for(i = 0; i < count; i++) {
+        CFTypeRef item = (CFTypeRef) CFArrayGetValueAtIndex(items, i);
+        CFTypeID  itemID = CFGetTypeID(item);
+
+        if(itemID == CFDictionaryGetTypeID()) {
+          CFTypeRef identity = (CFTypeRef) CFDictionaryGetValue(
+                                                 (CFDictionaryRef) item,
+                                                 kSecImportItemIdentity);
+          CFRetain(identity);
+          *out_cert_and_key = (SecIdentityRef) identity;
+          break;
+        }
+        else if(itemID == SecCertificateGetTypeID()) {
+          status = SecIdentityCreateWithCertificate(NULL,
+                                                 (SecCertificateRef) item,
+                                                 out_cert_and_key);
+          break;
+        }
+      }
     }
 
     if(items)
       CFRelease(items);
-    CFRelease(options);
     CFRelease(pkcs_data);
   }
 #endif /* CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS */
diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c
index f9db8d1f7..c8f60fda7 100644
--- a/lib/vtls/gskit.c
+++ b/lib/vtls/gskit.c
@@ -1355,7 +1355,7 @@ const struct Curl_ssl Curl_ssl_gskit = {
 
   0, /* have_ca_path */
   1, /* have_certinfo */
-  0, /* have_pinnedpubkey */
+  1, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
   /* TODO: convert to 1 and fix test #1014 (if need) */
   0, /* support_https_proxy */
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
index 30b255b81..078874103 100644
--- a/lib/vtls/gtls.c
+++ b/lib/vtls/gtls.c
@@ -60,15 +60,6 @@
 /* The last #include file should be: */
 #include "memdebug.h"
 
-#ifndef GNUTLS_POINTER_TO_SOCKET_CAST
-#define GNUTLS_POINTER_TO_SOCKET_CAST(p) \
-  ((curl_socket_t) ((char *)(p) - (char *)NULL))
-#endif
-#ifndef GNUTLS_SOCKET_TO_POINTER_CAST
-#define GNUTLS_SOCKET_TO_POINTER_CAST(s) \
-  ((void *) ((char *)NULL + (s)))
-#endif
-
 /* Enable GnuTLS debugging by defining GTLSDEBUG */
 /*#define GTLSDEBUG */
 
@@ -161,7 +152,7 @@ static int gtls_mapped_sockerrno(void)
 
 static ssize_t Curl_gtls_push(void *s, const void *buf, size_t len)
 {
-  ssize_t ret = swrite(GNUTLS_POINTER_TO_SOCKET_CAST(s), buf, len);
+  ssize_t ret = swrite(CURLX_POINTER_TO_INTEGER_CAST(s), buf, len);
 #if defined(USE_WINSOCK) && !defined(GNUTLS_MAPS_WINSOCK_ERRORS)
   if(ret < 0)
     gnutls_transport_set_global_errno(gtls_mapped_sockerrno());
@@ -171,7 +162,7 @@ static ssize_t Curl_gtls_push(void *s, const void *buf, 
size_t len)
 
 static ssize_t Curl_gtls_pull(void *s, void *buf, size_t len)
 {
-  ssize_t ret = sread(GNUTLS_POINTER_TO_SOCKET_CAST(s), buf, len);
+  ssize_t ret = sread(CURLX_POINTER_TO_INTEGER_CAST(s), buf, len);
 #if defined(USE_WINSOCK) && !defined(GNUTLS_MAPS_WINSOCK_ERRORS)
   if(ret < 0)
     gnutls_transport_set_global_errno(gtls_mapped_sockerrno());
@@ -857,7 +848,7 @@ gtls_connect_step1(struct connectdata *conn,
   }
   else {
     /* file descriptor for the socket */
-    transport_ptr = GNUTLS_SOCKET_TO_POINTER_CAST(conn->sock[sockindex]);
+    transport_ptr = CURLX_INTEGER_TO_POINTER_CAST(conn->sock[sockindex]);
     gnutls_transport_push = Curl_gtls_push;
     gnutls_transport_pull = Curl_gtls_pull;
   }
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index a3ef37a12..458f9d814 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -440,7 +440,17 @@ static CURLcode nss_create_object(struct ssl_connect_data 
*connssl,
     PK11_SETATTRS(attrs, attr_cnt, CKA_TRUST, pval, sizeof(*pval));
   }
 
-  obj = PK11_CreateGenericObject(slot, attrs, attr_cnt, PR_FALSE);
+  /* PK11_CreateManagedGenericObject() was introduced in NSS 3.34 because
+   * PK11_DestroyGenericObject() does not release resources allocated by
+   * PK11_CreateGenericObject() early enough.  */
+  obj =
+#ifdef HAVE_PK11_CREATEMANAGEDGENERICOBJECT
+    PK11_CreateManagedGenericObject
+#else
+    PK11_CreateGenericObject
+#endif
+    (slot, attrs, attr_cnt, PR_FALSE);
+
   PK11_FreeSlot(slot);
   if(!obj)
     return result;
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 93faa6fa8..2a6b3cfac 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -2338,10 +2338,11 @@ static CURLcode ossl_connect_step1(struct connectdata 
*conn, int sockindex)
 #endif
 
   if(ssl_cafile || ssl_capath) {
-    /* tell SSL where to find CA certificates that are used to verify
-       the servers certificate. */
-    if(!SSL_CTX_load_verify_locations(BACKEND->ctx, ssl_cafile, ssl_capath)) {
-      if(verifypeer) {
+    if(verifypeer) {
+      /* tell SSL where to find CA certificates that are used to verify
+         the servers certificate. */
+      if(!SSL_CTX_load_verify_locations(BACKEND->ctx,
+                                        ssl_cafile, ssl_capath)) {
         /* Fail if we insist on successfully verifying the server. */
         failf(data, "error setting certificate verify locations:\n"
               "  CAfile: %s\n  CApath: %s",
@@ -2349,20 +2350,18 @@ static CURLcode ossl_connect_step1(struct connectdata 
*conn, int sockindex)
               ssl_capath ? ssl_capath : "none");
         return CURLE_SSL_CACERT_BADFILE;
       }
-      /* Just continue with a warning if no strict  certificate verification
-         is required. */
-      infof(data, "error setting certificate verify locations,"
-            " continuing anyway:\n");
+      else {
+        /* Everything is fine. */
+        infof(data, "successfully set certificate verify locations:\n"
+              "  CAfile: %s\n  CApath: %s\n",
+              ssl_cafile ? ssl_cafile : "none",
+              ssl_capath ? ssl_capath : "none");
+      }
     }
     else {
-      /* Everything is fine. */
-      infof(data, "successfully set certificate verify locations:\n");
+      infof(data, "ignoring certificate verify locations due to "
+            "disabled peer verification\n");
     }
-    infof(data,
-          "  CAfile: %s\n"
-          "  CApath: %s\n",
-          ssl_cafile ? ssl_cafile : "none",
-          ssl_capath ? ssl_capath : "none");
   }
 #ifdef CURL_CA_FALLBACK
   else if(verifypeer) {
@@ -3580,11 +3579,15 @@ static CURLcode Curl_ossl_md5sum(unsigned char *tmp, /* 
input */
                                  unsigned char *md5sum /* output */,
                                  size_t unused)
 {
-  MD5_CTX MD5pw;
-  (void)unused;
-  MD5_Init(&MD5pw);
-  MD5_Update(&MD5pw, tmp, tmplen);
-  MD5_Final(md5sum, &MD5pw);
+  EVP_MD_CTX *mdctx;
+  unsigned int len = 0;
+  (void) unused;
+
+  mdctx = EVP_MD_CTX_create();
+  EVP_DigestInit_ex(mdctx, EVP_md5(), NULL);
+  EVP_DigestUpdate(mdctx, tmp, tmplen);
+  EVP_DigestFinal_ex(mdctx, md5sum, &len);
+  EVP_MD_CTX_destroy(mdctx);
   return CURLE_OK;
 }
 
@@ -3594,11 +3597,15 @@ static void Curl_ossl_sha256sum(const unsigned char 
*tmp, /* input */
                                 unsigned char *sha256sum /* output */,
                                 size_t unused)
 {
-  SHA256_CTX SHA256pw;
-  (void)unused;
-  SHA256_Init(&SHA256pw);
-  SHA256_Update(&SHA256pw, tmp, tmplen);
-  SHA256_Final(sha256sum, &SHA256pw);
+  EVP_MD_CTX *mdctx;
+  unsigned int len = 0;
+  (void) unused;
+
+  mdctx =  EVP_MD_CTX_create();
+  EVP_DigestInit_ex(mdctx, EVP_sha256(), NULL);
+  EVP_DigestUpdate(mdctx, tmp, tmplen);
+  EVP_DigestFinal_ex(mdctx, sha256sum, &len);
+  EVP_MD_CTX_destroy(mdctx);
 }
 #endif
 
diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
index 85c64cf44..b8afe46f1 100644
--- a/lib/vtls/schannel.c
+++ b/lib/vtls/schannel.c
@@ -7,7 +7,7 @@
  *
  * Copyright (C) 2012 - 2016, Marc Hoersken, <address@hidden>
  * Copyright (C) 2012, Mark Salisbury, <address@hidden>
- * Copyright (C) 2012 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 2012 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -129,6 +129,10 @@
  * #define failf(x, y, ...) printf(y, __VA_ARGS__)
  */
 
+#ifndef CALG_SHA_256
+#  define CALG_SHA_256 0x0000800c
+#endif
+
 /* Structs to store Schannel handles */
 struct curl_schannel_cred {
   CredHandle cred_handle;
@@ -165,6 +169,9 @@ struct ssl_backend_data {
 static Curl_recv schannel_recv;
 static Curl_send schannel_send;
 
+static CURLcode pkp_pin_peer_pubkey(struct connectdata *conn, int sockindex,
+                                    const char *pinnedpubkey);
+
 #ifdef _WIN32_WCE
 static CURLcode verify_certificate(struct connectdata *conn, int sockindex);
 #endif
@@ -542,6 +549,7 @@ schannel_connect_step2(struct connectdata *conn, int 
sockindex)
   bool doread;
   char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
     conn->host.name;
+  const char *pubkey_ptr;
 
   doread = (connssl->connecting_state != ssl_connect_2_writing) ? TRUE : FALSE;
 
@@ -761,6 +769,17 @@ schannel_connect_step2(struct connectdata *conn, int 
sockindex)
     infof(data, "schannel: SSL/TLS handshake complete\n");
   }
 
+  pubkey_ptr = SSL_IS_PROXY() ?
+    data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
+    data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
+  if(pubkey_ptr) {
+    result = pkp_pin_peer_pubkey(conn, sockindex, pubkey_ptr);
+    if(result) {
+      failf(data, "SSL: public key does not match pinned public key!");
+      return result;
+    }
+  }
+
 #ifdef _WIN32_WCE
   /* Windows CE doesn't do any server certificate validation.
      We have to do it manually. */
@@ -1669,6 +1688,68 @@ static CURLcode Curl_schannel_random(struct Curl_easy 
*data UNUSED_PARAM,
   return CURLE_OK;
 }
 
+static CURLcode pkp_pin_peer_pubkey(struct connectdata *conn, int sockindex,
+                                    const char *pinnedpubkey)
+{
+  SECURITY_STATUS status;
+  struct Curl_easy *data = conn->data;
+  struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+  CERT_CONTEXT *pCertContextServer = NULL;
+  const char *x509_der;
+  DWORD x509_der_len;
+  curl_X509certificate x509_parsed;
+  curl_asn1Element *pubkey;
+
+  /* Result is returned to caller */
+  CURLcode result = CURLE_SSL_PINNEDPUBKEYNOTMATCH;
+
+  /* if a path wasn't specified, don't pin */
+  if(!pinnedpubkey)
+    return CURLE_OK;
+
+  do {
+    status = s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle,
+                                              SECPKG_ATTR_REMOTE_CERT_CONTEXT,
+                                              &pCertContextServer);
+
+    if((status != SEC_E_OK) || (pCertContextServer == NULL)) {
+      failf(data, "schannel: Failed to read remote certificate context: %s",
+            Curl_sspi_strerror(conn, status));
+      break; /* failed */
+    }
+
+
+    if(!(((pCertContextServer->dwCertEncodingType & X509_ASN_ENCODING) != 0) &&
+       (pCertContextServer->cbCertEncoded > 0)))
+      break;
+
+    x509_der = (const char *)pCertContextServer->pbCertEncoded;
+    x509_der_len = pCertContextServer->cbCertEncoded;
+    memset(&x509_parsed, 0, sizeof x509_parsed);
+    if(Curl_parseX509(&x509_parsed, x509_der, x509_der + x509_der_len))
+      break;
+
+    pubkey = &x509_parsed.subjectPublicKeyInfo;
+    if(!pubkey->header || pubkey->end <= pubkey->header) {
+      failf(data, "SSL: failed retrieving public key from server certificate");
+      break;
+    }
+
+    result = Curl_pin_peer_pubkey(data,
+                                  pinnedpubkey,
+                                  (const unsigned char *)pubkey->header,
+                                  (size_t)(pubkey->end - pubkey->header));
+    if(result) {
+      failf(data, "SSL: public key does not match pinned public key!");
+    }
+  } while(0);
+
+  if(pCertContextServer)
+    CertFreeCertificateContext(pCertContextServer);
+
+  return result;
+}
+
 #ifdef _WIN32_WCE
 static CURLcode verify_certificate(struct connectdata *conn, int sockindex)
 {
@@ -1809,6 +1890,74 @@ static CURLcode verify_certificate(struct connectdata 
*conn, int sockindex)
 }
 #endif /* _WIN32_WCE */
 
+static void Curl_schannel_checksum(const unsigned char *input,
+                      size_t inputlen,
+                      unsigned char *checksum,
+                      size_t checksumlen,
+                      DWORD provType,
+                      const unsigned int algId)
+{
+  HCRYPTPROV hProv = 0;
+  HCRYPTHASH hHash = 0;
+  DWORD cbHashSize = 0;
+  DWORD dwHashSizeLen = (DWORD)sizeof(cbHashSize);
+  DWORD dwChecksumLen = (DWORD)checksumlen;
+
+  /* since this can fail in multiple ways, zero memory first so we never
+   * return old data
+   */
+  memset(checksum, 0, checksumlen);
+
+  if(!CryptAcquireContext(&hProv, NULL, NULL, provType,
+                          CRYPT_VERIFYCONTEXT))
+    return; /* failed */
+
+  do {
+    if(!CryptCreateHash(hProv, algId, 0, 0, &hHash))
+      break; /* failed */
+
+    if(!CryptHashData(hHash, (const BYTE*)input, (DWORD)inputlen, 0))
+      break; /* failed */
+
+    /* get hash size */
+    if(!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE *)&cbHashSize,
+                          &dwHashSizeLen, 0))
+      break; /* failed */
+
+    /* check hash size */
+    if(checksumlen < cbHashSize)
+      break; /* failed */
+
+    if(CryptGetHashParam(hHash, HP_HASHVAL, checksum, &dwChecksumLen, 0))
+      break; /* failed */
+  } while(0);
+
+  if(hHash)
+    CryptDestroyHash(hHash);
+
+  if(hProv)
+    CryptReleaseContext(hProv, 0);
+}
+
+static CURLcode Curl_schannel_md5sum(unsigned char *input,
+                                     size_t inputlen,
+                                     unsigned char *md5sum,
+                                     size_t md5len)
+{
+    Curl_schannel_checksum(input, inputlen, md5sum, md5len,
+                           PROV_RSA_FULL, CALG_MD5);
+    return CURLE_OK;
+}
+
+static void Curl_schannel_sha256sum(const unsigned char *input,
+                                    size_t inputlen,
+                                    unsigned char *sha256sum,
+                                    size_t sha256len)
+{
+    Curl_schannel_checksum(input, inputlen, sha256sum, sha256len,
+                           PROV_RSA_AES, CALG_SHA_256);
+}
+
 static void *Curl_schannel_get_internals(struct ssl_connect_data *connssl,
                                          CURLINFO info UNUSED_PARAM)
 {
@@ -1821,7 +1970,7 @@ const struct Curl_ssl Curl_ssl_schannel = {
 
   0, /* have_ca_path */
   1, /* have_certinfo */
-  0, /* have_pinnedpubkey */
+  1, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
   0, /* support_https_proxy */
 
@@ -1845,8 +1994,8 @@ const struct Curl_ssl Curl_ssl_schannel = {
   Curl_none_set_engine_default,      /* set_engine_default */
   Curl_none_engines_list,            /* engines_list */
   Curl_none_false_start,             /* false_start */
-  Curl_none_md5sum,                  /* md5sum */
-  NULL                               /* sha256sum */
+  Curl_schannel_md5sum,              /* md5sum */
+  Curl_schannel_sha256sum            /* sha256sum */
 };
 
 #endif /* USE_SCHANNEL */
diff --git a/lib/warnless.h b/lib/warnless.h
index 5905cb7e3..318c020c2 100644
--- a/lib/warnless.h
+++ b/lib/warnless.h
@@ -26,6 +26,11 @@
 #include <gnurl/curl.h> /* for curl_socket_t */
 #endif
 
+#define CURLX_POINTER_TO_INTEGER_CAST(p) \
+  ((char *)(p) - (char *)NULL)
+#define CURLX_INTEGER_TO_POINTER_CAST(i) \
+  ((void *)((char *)NULL + (i)))
+
 unsigned short curlx_ultous(unsigned long ulnum);
 
 unsigned char curlx_ultouc(unsigned long ulnum);
diff --git a/m4/curl-openssl.m4 b/m4/curl-openssl.m4
index 20c312658..d55827861 100644
--- a/m4/curl-openssl.m4
+++ b/m4/curl-openssl.m4
@@ -29,7 +29,7 @@ dnl -------------------------------------------------
 dnl Find out OpenSSL headers API version, as reported
 dnl by OPENSSL_VERSION_NUMBER. No runtime checks
 dnl allowed here for cross-compilation support.
-dnl HAVE_OPENSSL_API_HEADERS is defined as apprpriate
+dnl HAVE_OPENSSL_API_HEADERS is defined as appropriate
 dnl only for systems which actually run the configure
 dnl script. Config files generated manually or in any
 dnl other way shall not define this.
@@ -66,6 +66,7 @@ AC_DEFUN([CURL_CHECK_OPENSSL_API_HEADERS], [
         ;;
     esac
     case $tst_api in
+      0x111) tst_show="1.1.1" ;;
       0x110) tst_show="1.1.0" ;;
       0x102) tst_show="1.0.2" ;;
       0x101) tst_show="1.0.1" ;;
@@ -102,7 +103,7 @@ dnl Find out OpenSSL library API version, performing
 dnl only link tests in order to avoid getting fooled
 dnl by mismatched OpenSSL headers. No runtime checks
 dnl allowed here for cross-compilation support.
-dnl HAVE_OPENSSL_API_LIBRARY is defined as apprpriate
+dnl HAVE_OPENSSL_API_LIBRARY is defined as appropriate
 dnl only for systems which actually run the configure
 dnl script. Config files generated manually or in any
 dnl other way shall not define this.
@@ -122,6 +123,13 @@ AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [
   #
   AC_MSG_CHECKING([for OpenSSL library version])
   if test "$tst_api" = "unknown"; then
+    AC_LINK_IFELSE([
+      AC_LANG_FUNC_LINK_TRY([ERR_clear_last_mark])
+    ],[
+      tst_api="0x111"
+    ])
+  fi
+  if test "$tst_api" = "unknown"; then
     case $host in
       *-*-vms*)
         AC_LINK_IFELSE([
@@ -217,6 +225,7 @@ AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [
     ])
   fi
   case $tst_api in
+    0x111) tst_show="1.1.1" ;;
     0x110) tst_show="1.1.0" ;;
     0x102) tst_show="1.0.2" ;;
     0x101) tst_show="1.0.1" ;;
diff --git a/m4/zz40-xc-ovr.m4 b/m4/zz40-xc-ovr.m4
index 0e3b1cba6..3d6e695f3 100644
--- a/m4/zz40-xc-ovr.m4
+++ b/m4/zz40-xc-ovr.m4
@@ -2,7 +2,7 @@
 #
 # zz40-xc-ovr.m4
 #
-# Copyright (c) 2013 Daniel Stenberg <address@hidden>
+# Copyright (c) 2013 - 2018 Daniel Stenberg <address@hidden>
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -18,9 +18,6 @@
 #
 #---------------------------------------------------------------------------
 
-# serial 1
-
-
 dnl The funny name of this file is intentional in order to make it
 dnl sort alphabetically after any libtool, autoconf or automake
 dnl provided .m4 macro file that might get copied into this same
@@ -398,9 +395,10 @@ if test $xc_tst_dirs_sem -eq $xc_tst_dirs_col; then
   # When both counting methods give the same result we do not want to
   # chose one over the other, and consider auto-detection not possible.
   if test -z "$PATH_SEPARATOR"; then
-    # Stop dead until user provides 'PATH_SEPARATOR' definition.
-    echo "$xc_msg_err 'PATH_SEPARATOR' variable not set. $xc_msg_abrt" >&2
-    exit 1
+    # User should provide the correct 'PATH_SEPARATOR' definition.
+    # Until then, guess that it is colon!
+    echo "$xc_msg_warn path separator not determined, guessing colon" >&2
+    PATH_SEPARATOR=':'
   fi
 else
   # Separator with the greater directory count is the auto-detected one.
diff --git a/packages/OS400/README.OS400 b/packages/OS400/README.OS400
index db46a4ee1..f92d11637 100644
--- a/packages/OS400/README.OS400
+++ b/packages/OS400/README.OS400
@@ -183,8 +183,8 @@ CCSID.
         CURLINFO_COOKIELIST
 Lists returned should be released with curl_slist_free_all() after use.
   Option CURLINFO_CERTINFO is followed by a struct curl_certinfo * * and a
-CCSID. Returned structures sould be free'ed using curl_certinfo_free_all() 
after
-use.
+CCSID. Returned structures should be free'ed using curl_certinfo_free_all()
+after use.
   Other options are processed like in curl_easy_getinfo().
 
 _ curl_pushheader_bynum_cssid() and curl_pushheader_byname_ccsid()
@@ -243,7 +243,7 @@ _ If data compression has to be supported, ZLIB development 
environment must
 _ Likewise, if SCP and SFTP protocols have to be compiled in, LIBSSH2
   developent environment must be installed.
 _ Install the curl source directory in IFS. Do NOT install it in the
-  installation target directory (wich defaults to /curl).
+  installation target directory (which defaults to /curl).
 _ Enter shell (QSH)
 _ Change current directory to the curl installation directory
 _ Change current directory to ./packages/OS400
diff --git a/packages/OS400/curl.inc.in b/packages/OS400/curl.inc.in
index 03603e290..a21ee9bba 100644
--- a/packages/OS400/curl.inc.in
+++ b/packages/OS400/curl.inc.in
@@ -1322,6 +1322,14 @@
      d                 c                   00268
      d  CURLOPT_MIMEPOST...
      d                 c                   10269
+     d  CURLOPT_TIMEVALUE_LARGE...
+     d                 c                   30270
+     d  CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS...
+     d                 c                   00271
+     d  CURLOPT_RESOLVER_START_FUNCTION...
+     d                 c                   20272
+     d  CURLOPT_RESOLVER_START_DATA...
+     d                 c                   10273
       *
       /if not defined(CURL_NO_OLDIES)
      d  CURLOPT_FILE   c                   10001
@@ -1960,6 +1968,9 @@
      d curl_closesocket_callback...
      d                 s               *   based(######ptr######) procptr
       *
+     d curl_resolver_start_callback...
+     d                 s               *   based(######ptr######) procptr
+      *
       
**************************************************************************
       *                              Prototypes
       
**************************************************************************
diff --git a/packages/Symbian/group/libcurl.mmp 
b/packages/Symbian/group/libcurl.mmp
index bb99ec265..6f0fb78cc 100644
--- a/packages/Symbian/group/libcurl.mmp
+++ b/packages/Symbian/group/libcurl.mmp
@@ -31,7 +31,7 @@ SOURCE \
   http_negotiate.c inet_pton.c strtoofft.c strerror.c amigaos.c        \
   hostasyn.c hostip4.c hostip6.c hostsyn.c inet_ntop.c parsedate.c     \
   select.c vtls/gtls.c vtls/vtls.c tftp.c splay.c strdup.c socks.c     \
-  ssh.c vtls/nss.c strcase.c curl_addrinfo.c socks_gssapi.c             \
+  ssh.c vtls/nss.c strcase.c curl_addrinfo.c socks_gssapi.c            \
   socks_sspi.c curl_sspi.c slist.c nonblock.c curl_memrchr.c imap.c    \
   pop3.c smtp.c pingpong.c rtsp.c curl_threads.c warnless.c hmac.c     \
   vtls/polarssl.c curl_rtmp.c openldap.c curl_gethostname.c gopher.c   \
@@ -39,7 +39,7 @@ SOURCE \
   asyn-ares.c asyn-thread.c curl_gssapi.c http_ntlm.c curl_ntlm_wb.c   \
   curl_ntlm_core.c curl_sasl.c vtls/schannel.c curl_multibyte.c        \
   vtls/darwinssl.c conncache.c curl_sasl_sspi.c smb.c curl_endian.c    \
-  curl_des.c system_win32.c sha256.c                                   \
+  curl_des.c curl_range.c system_win32.c sha256.c                      \
   vauth/vauth.c vauth/cleartext.c vauth/cram.c vauth/digest.c          \
   vauth/digest_sspi.c vauth/krb5_gssapi.c vauth/krb5_sspi.c            \
   vauth/ntlm.c vauth/ntlm_sspi.c vauth/oauth2.c vauth/spnego_gssapi.c  \
diff --git a/packages/vms/config_h.com b/packages/vms/config_h.com
index 2a5503f76..0f1fa0f62 100644
--- a/packages/vms/config_h.com
+++ b/packages/vms/config_h.com
@@ -1382,7 +1382,7 @@ $!                        search/out 'tfile1' 
"$_''keyterm'"
 $                      severity = '$severity'
 $                  endif
 $!
-$!                 Unix compatability routines
+$!                 Unix compatibility routines
 $!---------------------------------------------
 $                  if severity .ne. 1
 $                  then
diff --git a/projects/README b/projects/README
index 60b8c874d..99b1d7a29 100644
--- a/projects/README
+++ b/projects/README
@@ -74,9 +74,6 @@ Building with Visual C++
    If you require support for Internationalized Domain Names via Windows IDN
    then you will need either:
 
-    * Microsoft Internationalized Domain Name (IDN) Mitigation APIs:
-      https://www.microsoft.com/en-us/download/details.aspx?id=734
-
     * Microsoft Windows SDK Update for Windows Vista:
       https://www.microsoft.com/en-us/download/details.aspx?id=23719
 
@@ -108,7 +105,7 @@ Running DLL based configurations
 
    ... where 'Path to DLL` is the configuration specific path. For example the
    following configurations in Visual Studio 2010 might be:
-   
+
    DLL Debug - DLL OpenSSL (Win32):
    PATH=..\..\..\..\..\openssl\build\Win32\VC10\DLL Debug;C:\Windows\system32;
         C:\Windows;C:\Windows\System32\Wbem
@@ -133,7 +130,7 @@ Notes
 =====
 
    The following keywords have been used in the directory hierarchy:
-   
+
    <platform>      - The platform (For example: Windows)
    <ide>           - The IDE (For example: VC6, VC10, BCC5)
    <architecture>  - The platform architecture (For example: Win32, Win64)
@@ -142,12 +139,12 @@ Notes
 
    If you are using the source code from the git repository, rather than a
    release archive or nightly build, you will need to generate the project
-   files. Please run "generate -help" for usage details. 
+   files. Please run "generate -help" for usage details.
 
    Should you wish to help out with some of the items on the TODO list, or
    find bugs in the project files that need correcting, and would like to
    submit updated files back then please note that, whilst the solution files
-   can be edited directly, the templates for the project files (which are 
+   can be edited directly, the templates for the project files (which are
    stored in the git repositoty) will need to be modified rather than the
    generated project files that Visual Studio uses.
 
diff --git a/projects/Windows/VC15/curl-all.sln 
b/projects/Windows/VC15/curl-all.sln
index 05820e1f4..e563caeea 100644
--- a/projects/Windows/VC15/curl-all.sln
+++ b/projects/Windows/VC15/curl-all.sln
@@ -1,5 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2015
+# Visual Studio 15
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curl", 
"src\curl.vcxproj", "{5228E9CE-A216-422F-A5E6-58E95E2DD71D}"
        ProjectSection(ProjectDependencies) = postProject
                {DA6F56B4-06A4-441D-AD70-AC5A7D51FADB} = 
{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}
diff --git a/projects/Windows/VC15/lib/libcurl.sln 
b/projects/Windows/VC15/lib/libcurl.sln
index cd8afe248..595bdb209 100644
--- a/projects/Windows/VC15/lib/libcurl.sln
+++ b/projects/Windows/VC15/lib/libcurl.sln
@@ -1,5 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2015
+# Visual Studio 15
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", 
"libcurl.vcxproj", "{DA6F56B4-06A4-441D-AD70-AC5A7D51FADB}"
 EndProject
 Global
diff --git a/projects/Windows/VC15/src/curl.sln 
b/projects/Windows/VC15/src/curl.sln
index b40c18bed..2af095916 100644
--- a/projects/Windows/VC15/src/curl.sln
+++ b/projects/Windows/VC15/src/curl.sln
@@ -1,5 +1,5 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2015
+# Visual Studio 15
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curl", "curl.vcxproj", 
"{5228E9CE-A216-422F-A5E6-58E95E2DD71D}"
 EndProject
 Global
diff --git a/projects/build-openssl.bat b/projects/build-openssl.bat
index 2a135b910..21709b76b 100644
--- a/projects/build-openssl.bat
+++ b/projects/build-openssl.bat
@@ -6,7 +6,7 @@ rem *                             / __| | | | |_) | |
 rem *                            | (__| |_| |  _ <| |___
 rem *                             \___|\___/|_| \_\_____|
 rem *
-rem * Copyright (C) 2012 - 2017, Steve Holme, <address@hidden>.
+rem * Copyright (C) 2012 - 2018, Steve Holme, <address@hidden>.
 rem *
 rem * This software is licensed as described in the file COPYING, which
 rem * you should have received as part of this distribution. The terms
@@ -33,6 +33,16 @@ rem 
***************************************************************************
   rem Ensure we have the required arguments
   if /i "%~1" == "" goto syntax
 
+  rem Calculate the program files directory
+  if defined PROGRAMFILES (
+    set "PF=%PROGRAMFILES%"
+    set OS_PLATFORM=x86
+  )
+  if defined PROGRAMFILES(x86) (
+    set "PF=%PROGRAMFILES(x86)%"
+    set OS_PLATFORM=x64
+  )
+
 :parseArgs
   if "%~1" == "" goto prerequisites
 
@@ -75,7 +85,16 @@ rem 
***************************************************************************
   ) else if /i "%~1" == "vc15" (
     set VC_VER=15.0
     set VC_DESC=VC15
-    set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
+
+    rem Determine the VC15 path based on the installed edition in decending
+    rem order (Enterprise, then Professional and finally Community)
+    if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
+      set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
+    ) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
+      set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
+    ) else (
+      set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
+    )
   ) else if /i "%~1%" == "x86" (
     set BUILD_PLATFORM=x86
   ) else if /i "%~1%" == "x64" (
@@ -101,23 +120,12 @@ rem 
***************************************************************************
   shift & goto parseArgs
 
 :prerequisites
-  rem Compiler and platform are required parameters.
+  rem Compiler is a required parameter
   if not defined VC_VER goto syntax
-  if not defined BUILD_PLATFORM goto syntax
 
   rem Default the start directory if one isn't specified
   if not defined START_DIR set START_DIR=..\..\openssl
 
-  rem Calculate the program files directory
-  if defined PROGRAMFILES (
-    set "PF=%PROGRAMFILES%"
-    set OS_PLATFORM=x86
-  )
-  if defined PROGRAMFILES(x86) (
-    set "PF=%PROGRAMFILES(x86)%"
-    set OS_PLATFORM=x64
-  )
-
   rem Check we have a program files directory
   if not defined PF goto nopf
 
@@ -211,12 +219,22 @@ rem 
***************************************************************************
   nmake -f ms\ntdll.mak
 
   rem Move the output directories
-  move out32.dbg "%OUTDIR%\LIB Debug"
-  move out32dll.dbg "%OUTDIR%\DLL Debug"
+  if exist "%OUTDIR%\LIB Debug" (
+    copy /y out32.dbg\* "%OUTDIR%\LIB Debug" 1>nul
+    rd out32.dbg /s /q
+  ) else (
+    move out32.dbg "%OUTDIR%\LIB Debug" 1>nul
+  )
+  if exist "%OUTDIR%\DLL Debug" (
+    copy /y out32dll.dbg\* "%OUTDIR%\DLL Debug" 1>nul
+    rd out32dll.dbg /s /q
+  ) else (
+    move out32dll.dbg "%OUTDIR%\DLL Debug" 1>nul
+  )
 
   rem Move the PDB files
-  move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug"
-  move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug"
+  move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug" 1>nul
+  move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug" 1>nul
   
   rem Remove the intermediate directories
   rd tmp32.dbg /s /q
@@ -232,14 +250,24 @@ rem 
***************************************************************************
   call ms\do_win64a
   nmake -f ms\nt.mak
   nmake -f ms\ntdll.mak
-  
+
   rem Move the output directories
-  move out32 "%OUTDIR%\LIB Release"
-  move out32dll "%OUTDIR%\DLL Release"
+  if exist "%OUTDIR%\LIB Release" (
+    copy /y out32\* "%OUTDIR%\LIB Release" 1>nul
+    rd out32 /s /q
+  ) else (
+    move out32 "%OUTDIR%\LIB Release" 1>nul
+  )
+  if exist "%OUTDIR%\DLL Release" (
+    copy /y out32dll\* "%OUTDIR%\DLL Release" 1>nul
+    rd out32dll /s /q
+  ) else (
+    move out32dll "%OUTDIR%\DLL Release" 1>nul
+  )
 
   rem Move the PDB files
-  move tmp32\lib.pdb "%OUTDIR%\LIB Release"
-  move tmp32dll\lib.pdb "%OUTDIR%\DLL Release"
+  move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul
+  move tmp32dll\lib.pdb "%OUTDIR%\DLL Release" 1>nul
 
   rem Remove the intermediate directories
   rd tmp32 /s /q
@@ -264,12 +292,22 @@ rem 
***************************************************************************
   nmake -f ms\ntdll.mak
 
   rem Move the output directories
-  move out32.dbg "%OUTDIR%\LIB Debug"
-  move out32dll.dbg "%OUTDIR%\DLL Debug"
+  if exist "%OUTDIR%\LIB Debug" (
+    copy /y out32.dbg\* "%OUTDIR%\LIB Debug" 1>nul
+    rd out32.dbg /s /q
+  ) else (
+    move out32.dbg "%OUTDIR%\LIB Debug" 1>nul
+  )
+  if exist "%OUTDIR%\DLL Debug" (
+    copy /y out32dll.dbg\* "%OUTDIR%\DLL Debug" 1>nul
+    rd out32dll.dbg /s /q
+  ) else (
+    move out32dll.dbg "%OUTDIR%\DLL Debug" 1>nul
+  )
 
   rem Move the PDB files
-  move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug"
-  move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug"
+  move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug" 1>nul
+  move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug" 1>nul
 
   rem Remove the intermediate directories
   rd tmp32.dbg /s /q
@@ -285,14 +323,24 @@ rem 
***************************************************************************
   call ms\do_ms
   nmake -f ms\nt.mak
   nmake -f ms\ntdll.mak
-  
+
   rem Move the output directories
-  move out32 "%OUTDIR%\LIB Release"
-  move out32dll "%OUTDIR%\DLL Release"
+  if exist "%OUTDIR%\LIB Release" (
+    copy /y out32\* "%OUTDIR%\LIB Release" 1>nul
+    rd out32 /s /q
+  ) else (
+    move out32 "%OUTDIR%\LIB Release" 1>nul
+  )
+  if exist "%OUTDIR%\DLL Release" (
+    copy /y out32dll\* "%OUTDIR%\DLL Release" 1>nul
+    rd out32dll /s /q
+  ) else (
+    move out32dll "%OUTDIR%\DLL Release" 1>nul
+  )
 
   rem Move the PDB files
-  move tmp32\lib.pdb "%OUTDIR%\LIB Release"
-  move tmp32dll\lib.pdb "%OUTDIR%\DLL Release"
+  move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul
+  move tmp32dll\lib.pdb "%OUTDIR%\DLL Release" 1>nul
 
   rem Remove the intermediate directories
   rd tmp32 /s /q
@@ -303,7 +351,7 @@ rem 
***************************************************************************
 :syntax
   rem Display the help
   echo.
-  echo Usage: build-openssl ^<compiler^> ^<platform^> [configuration] 
[directory]
+  echo Usage: build-openssl ^<compiler^> [platform] [configuration] [directory]
   echo.
   echo Compiler:
   echo.
diff --git a/projects/build-wolfssl.bat b/projects/build-wolfssl.bat
index 875d6fd8d..e5cf1536a 100644
--- a/projects/build-wolfssl.bat
+++ b/projects/build-wolfssl.bat
@@ -6,7 +6,7 @@ rem *                             / __| | | | |_) | |
 rem *                            | (__| |_| |  _ <| |___
 rem *                             \___|\___/|_| \_\_____|
 rem *
-rem * Copyright (C) 2012 - 2017, Steve Holme, <address@hidden>.
+rem * Copyright (C) 2012 - 2018, Steve Holme, <address@hidden>.
 rem * Copyright (C) 2015, Jay Satiro, <address@hidden>.
 rem *
 rem * This software is licensed as described in the file COPYING, which
@@ -35,6 +35,16 @@ rem 
***************************************************************************
   rem Ensure we have the required arguments
   if /i "%~1" == "" goto syntax
 
+  rem Calculate the program files directory
+  if defined PROGRAMFILES (
+    set "PF=%PROGRAMFILES%"
+    set OS_PLATFORM=x86
+  )
+  if defined PROGRAMFILES(x86) (
+    set "PF=%PROGRAMFILES(x86)%"
+    set OS_PLATFORM=x64
+  )
+
 :parseArgs
   if "%~1" == "" goto prerequisites
 
@@ -62,7 +72,16 @@ rem 
***************************************************************************
     set VC_VER=15.0
     set VC_DESC=VC15
     set VC_TOOLSET=v141
-    set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
+
+    rem Determine the VC15 path based on the installed edition in decending
+    rem order (Enterprise, then Professional and finally Community)
+    if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
+      set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
+    ) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
+      set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
+    ) else (
+      set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
+    )    
   ) else if /i "%~1" == "x86" (
     set BUILD_PLATFORM=x86
   ) else if /i "%~1" == "x64" (
@@ -88,23 +107,12 @@ rem 
***************************************************************************
   shift & goto parseArgs
 
 :prerequisites
-  rem Compiler and platform are required parameters.
+  rem Compiler is a required parameter
   if not defined VC_VER goto syntax
-  if not defined BUILD_PLATFORM goto syntax
 
   rem Default the start directory if one isn't specified
   if not defined START_DIR set START_DIR=..\..\wolfssl
 
-  rem Calculate the program files directory
-  if defined PROGRAMFILES (
-    set "PF=%PROGRAMFILES%"
-    set OS_PLATFORM=x86
-  )
-  if defined PROGRAMFILES(x86) (
-    set "PF=%PROGRAMFILES(x86)%"
-    set OS_PLATFORM=x64
-  )
-
   rem Check we have a program files directory
   if not defined PF goto nopf
 
@@ -291,7 +299,7 @@ rem 
***************************************************************************
 :syntax
   rem Display the help
   echo.
-  echo Usage: build-wolfssl ^<compiler^> ^<platform^> [configuration] 
[directory]
+  echo Usage: build-wolfssl ^<compiler^> [platform] [configuration] [directory]
   echo.
   echo Compiler:
   echo.
diff --git a/projects/generate.bat b/projects/generate.bat
index f8fb81fe9..d1fc6088c 100644
--- a/projects/generate.bat
+++ b/projects/generate.bat
@@ -284,12 +284,14 @@ rem
       call :element %1 lib "strtoofft.c" %3
       call :element %1 lib "nonblock.c" %3
       call :element %1 lib "warnless.c" %3
+      call :element %1 lib "curl_ctype.c" %3
     ) else if "!var!" == "CURL_SRC_X_H_FILES" (
       call :element %1 lib "config-win32.h" %3
       call :element %1 lib "curl_setup.h" %3
       call :element %1 lib "strtoofft.h" %3
       call :element %1 lib "nonblock.h" %3
       call :element %1 lib "warnless.h" %3
+      call :element %1 lib "curl_ctype.h" %3
     ) else if "!var!" == "CURL_LIB_C_FILES" (
       for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element %1 lib 
"%%c" %3
     ) else if "!var!" == "CURL_LIB_H_FILES" (
diff --git a/src/Makefile.inc b/src/Makefile.inc
index 45b4967f6..e0506c7f5 100644
--- a/src/Makefile.inc
+++ b/src/Makefile.inc
@@ -12,13 +12,15 @@
 CURLX_CFILES = \
        ../lib/strtoofft.c \
        ../lib/nonblock.c \
-       ../lib/warnless.c
+       ../lib/warnless.c \
+        ../lib/curl_ctype.c
 
 CURLX_HFILES = \
        ../lib/curl_setup.h \
        ../lib/strtoofft.h \
        ../lib/nonblock.h \
-       ../lib/warnless.h
+       ../lib/warnless.h \
+        ../lib/curl_ctype.h
 
 CURL_CFILES = \
        slist_wc.c \
@@ -35,6 +37,7 @@ CURL_CFILES = \
        tool_dirhie.c \
        tool_doswin.c \
        tool_easysrc.c \
+       tool_filetime.c \
        tool_formparse.c \
        tool_getparam.c \
        tool_getpass.c \
@@ -75,6 +78,7 @@ CURL_HFILES = \
        tool_dirhie.h \
        tool_doswin.h \
        tool_easysrc.h \
+       tool_filetime.h \
        tool_formparse.h \
        tool_getparam.h \
        tool_getpass.h \
diff --git a/src/Makefile.netware b/src/Makefile.netware
index 975551e0a..245c54780 100644
--- a/src/Makefile.netware
+++ b/src/Makefile.netware
@@ -106,7 +106,7 @@ DESCR       = curl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - 
https://curl.haxx.se
 MTSAFE = YES
 STACK  = 64000
 SCREEN = $(TARGET) commandline utility
-# Comment the line below if you dont want to load protected automatically.
+# Comment the line below if you don't want to load protected automatically.
 # LDRING = 3
 
 # Uncomment the next line to enable linking with POSIX semantics.
@@ -178,7 +178,7 @@ endif
        CFLAGS += -align 4
 else
        # PRELUDE = $(NDK_CLIB)/imports/clibpre.o
-       # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
+       # to avoid the __init_* / __deinit_* whoes don't use prelude from NDK
        PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
        # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
        CFLAGS += -align 1
@@ -201,7 +201,7 @@ else
 endif
 else
        # PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o
-       # to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
+       # to avoid the __init_* / __deinit_* whoes don't use prelude from NDK
        # http://www.gknw.net/development/mk_nlm/gcc_pre.zip
        PRELUDE = $(NDK_ROOT)/pre/prelude.o
        CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c
index cf3251b29..60a3804f9 100644
--- a/src/tool_cb_prg.c
+++ b/src/tool_cb_prg.c
@@ -35,6 +35,12 @@
 
 #include "memdebug.h" /* keep this as LAST include */
 
+#ifdef HAVE_TERMIOS_H
+#  include <termios.h>
+#elif defined(HAVE_TERMIO_H)
+#  include <termio.h>
+#endif
+
 /* 200 values generated by this perl code:
 
    my $pi = 3.1415;
@@ -78,7 +84,7 @@ static void fly(struct ProgressData *bar, bool moved)
   pos = sinus[(bar->tick + 15)%200] / (10000 / check);
   buf[pos] = '#';
 
-  fputs(buf, stderr);
+  fputs(buf, bar->out);
   bar->tick += 2;
   if(bar->tick >= 200)
     bar->tick -= 200;
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index 755195ced..81e16c1c8 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -42,6 +42,7 @@ void config_init(struct OperationConfig* config)
   config->proto_redir_present = FALSE;
   config->proto_default = NULL;
   config->tcp_nodelay = TRUE; /* enabled by default */
+  config->happy_eyeballs_timeout_ms = CURL_HET_DEFAULT;
 }
 
 static void free_config_fields(struct OperationConfig *config)
@@ -113,6 +114,7 @@ static void free_config_fields(struct OperationConfig 
*config)
   Curl_safefree(config->proxy_capath);
   Curl_safefree(config->crlfile);
   Curl_safefree(config->pinnedpubkey);
+  Curl_safefree(config->proxy_pinnedpubkey);
   Curl_safefree(config->proxy_crlfile);
   Curl_safefree(config->key);
   Curl_safefree(config->proxy_key);
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index ddfc9bfce..743ce725d 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -128,6 +128,7 @@ struct OperationConfig {
   char *crlfile;
   char *proxy_crlfile;
   char *pinnedpubkey;
+  char *proxy_pinnedpubkey;
   char *key;
   char *proxy_key;
   char *key_type;
@@ -168,7 +169,7 @@ struct OperationConfig {
   long proxy_ssl_version;
   long ip_version;
   curl_TimeCond timecond;
-  time_t condtime;
+  curl_off_t condtime;
   struct curl_slist *headers;
   struct curl_slist *proxyheaders;
   curl_mime *mimepost;
@@ -249,6 +250,8 @@ struct OperationConfig {
   curl_error synthetic_error;     /* if non-zero, it overrides any libcurl
                                      error */
   bool ssh_compression;           /* enable/disable SSH compression */
+  long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.
+                                     0 is valid. default: CURL_HET_DEFAULT. */
   struct GlobalConfig *global;
   struct OperationConfig *prev;
   struct OperationConfig *next;   /* Always last in the struct */
diff --git a/src/tool_dirhie.c b/src/tool_dirhie.c
index 1d7359205..a01f9dc5f 100644
--- a/src/tool_dirhie.c
+++ b/src/tool_dirhie.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -41,9 +41,9 @@
 #  endif
 #endif
 
-#ifdef WIN32
+#if defined(WIN32) || (defined(MSDOS) && !defined(__DJGPP__))
 #  define mkdir(x,y) (mkdir)((x))
-#  ifndef __POCC__
+#  ifndef F_OK
 #    define F_OK 0
 #  endif
 #endif
@@ -91,7 +91,7 @@ static void show_dir_errno(FILE *errors, const char *name)
  *  should create all the dir* automagically
  */
 
-#ifdef WIN32
+#if defined(WIN32) || defined(__DJGPP__)
 /* systems that may use either or when specifying a path */
 #define PATH_DELIMITERS "\\/"
 #else
diff --git a/src/tool_filetime.c b/src/tool_filetime.c
new file mode 100644
index 000000000..6071e44d2
--- /dev/null
+++ b/src/tool_filetime.c
@@ -0,0 +1,154 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "tool_filetime.h"
+
+#ifdef HAVE_UTIME_H
+#  include <utime.h>
+#elif defined(HAVE_SYS_UTIME_H)
+#  include <sys/utime.h>
+#endif
+
+curl_off_t getfiletime(const char *filename, FILE *error_stream)
+{
+  curl_off_t result = -1;
+
+/* Windows stat() may attempt to adjust the unix GMT file time by a daylight
+   saving time offset and since it's GMT that is bad behavior. When we have
+   access to a 64-bit type we can bypass stat and get the times directly. */
+#if defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)
+  HANDLE hfile;
+
+  hfile = CreateFileA(filename, FILE_READ_ATTRIBUTES,
+                      (FILE_SHARE_READ | FILE_SHARE_WRITE |
+                       FILE_SHARE_DELETE),
+                      NULL, OPEN_EXISTING, 0, NULL);
+  if(hfile != INVALID_HANDLE_VALUE) {
+    FILETIME ft;
+    if(GetFileTime(hfile, NULL, NULL, &ft)) {
+      curl_off_t converted = (curl_off_t)ft.dwLowDateTime
+          | ((curl_off_t)ft.dwHighDateTime) << 32;
+
+      if(converted < CURL_OFF_T_C(116444736000000000)) {
+        fprintf(error_stream,
+                "Failed to get filetime: underflow\n");
+      }
+      else {
+        result = (converted - CURL_OFF_T_C(116444736000000000)) / 10000000;
+      }
+    }
+    else {
+      fprintf(error_stream,
+              "Failed to get filetime: "
+              "GetFileTime failed: GetLastError %u\n",
+              (unsigned int)GetLastError());
+    }
+    CloseHandle(hfile);
+  }
+  else if(GetLastError() != ERROR_FILE_NOT_FOUND) {
+    fprintf(error_stream,
+            "Failed to get filetime: "
+            "CreateFile failed: GetLastError %u\n",
+            (unsigned int)GetLastError());
+  }
+#else
+  struct_stat statbuf;
+  if(-1 != stat(filename, &statbuf)) {
+    result = (curl_off_t)statbuf.st_mtime;
+  }
+  else if(errno != ENOENT) {
+    fprintf(error_stream,
+            "Failed to get filetime: %s\n", strerror(errno));
+  }
+#endif
+  return result;
+}
+
+#if defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \
+    (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8))
+void setfiletime(curl_off_t filetime, const char *filename,
+    FILE *error_stream)
+{
+  if(filetime >= 0) {
+/* Windows utime() may attempt to adjust the unix GMT file time by a daylight
+   saving time offset and since it's GMT that is bad behavior. When we have
+   access to a 64-bit type we can bypass utime and set the times directly. */
+#if defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)
+    HANDLE hfile;
+
+    /* 910670515199 is the maximum unix filetime that can be used as a
+       Windows FILETIME without overflow: 30827-12-31T23:59:59. */
+    if(filetime > CURL_OFF_T_C(910670515199)) {
+      fprintf(error_stream,
+              "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+              " on outfile: overflow\n", filetime);
+      return;
+    }
+
+    hfile = CreateFileA(filename, FILE_WRITE_ATTRIBUTES,
+                        (FILE_SHARE_READ | FILE_SHARE_WRITE |
+                         FILE_SHARE_DELETE),
+                        NULL, OPEN_EXISTING, 0, NULL);
+    if(hfile != INVALID_HANDLE_VALUE) {
+      curl_off_t converted = ((curl_off_t)filetime * 10000000) +
+                             CURL_OFF_T_C(116444736000000000);
+      FILETIME ft;
+      ft.dwLowDateTime = (DWORD)(converted & 0xFFFFFFFF);
+      ft.dwHighDateTime = (DWORD)(converted >> 32);
+      if(!SetFileTime(hfile, NULL, &ft, &ft)) {
+        fprintf(error_stream,
+                "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+                " on outfile: SetFileTime failed: GetLastError %u\n",
+                filetime, (unsigned int)GetLastError());
+      }
+      CloseHandle(hfile);
+    }
+    else {
+      fprintf(error_stream,
+              "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+              " on outfile: CreateFile failed: GetLastError %u\n",
+              filetime, (unsigned int)GetLastError());
+    }
+
+#elif defined(HAVE_UTIMES)
+    struct timeval times[2];
+    times[0].tv_sec = times[1].tv_sec = (time_t)filetime;
+    times[0].tv_usec = times[1].tv_usec = 0;
+    if(utimes(filename, times)) {
+      fprintf(error_stream,
+              "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+              " on outfile: %s\n", filetime, strerror(errno));
+    }
+
+#elif defined(HAVE_UTIME)
+    struct utimbuf times;
+    times.actime = (time_t)filetime;
+    times.modtime = (time_t)filetime;
+    if(utime(filename, &times)) {
+      fprintf(error_stream,
+              "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
+              " on outfile: %s\n", filetime, strerror(errno));
+    }
+#endif
+  }
+}
+#endif /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \
+          (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) */
diff --git a/lib/setopt.h b/src/tool_filetime.h
similarity index 64%
copy from lib/setopt.h
copy to src/tool_filetime.h
index c658e04ae..966a70b46 100644
--- a/lib/setopt.h
+++ b/src/tool_filetime.h
@@ -1,5 +1,5 @@
-#ifndef HEADER_CURL_SETOPT_H
-#define HEADER_CURL_SETOPT_H
+#ifndef HEADER_CURL_TOOL_FILETIME_H
+#define HEADER_CURL_TOOL_FILETIME_H
 /***************************************************************************
  *                                  _   _ ____  _
  *  Project                     ___| | | |  _ \| |
@@ -21,9 +21,18 @@
  * KIND, either express or implied.
  *
  ***************************************************************************/
+#include "tool_setup.h"
 
-CURLcode Curl_setstropt(char **charp, const char *s);
-CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option,
-                      va_list arg);
+curl_off_t getfiletime(const char *filename, FILE *error_stream);
+
+#if defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \
+    (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8))
+void setfiletime(curl_off_t filetime, const char *filename,
+    FILE *error_stream);
+#else
+#define setfiletime(a,b,c) Curl_nop_stmt
+#endif /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \
+          (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) */
+
+#endif /* HEADER_CURL_TOOL_FILETIME_H */
 
-#endif /* HEADER_CURL_SETOPT_H */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 3f4046417..7ce9c28c7 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -31,6 +31,7 @@
 #include "tool_cfgable.h"
 #include "tool_cb_prg.h"
 #include "tool_convert.h"
+#include "tool_filetime.h"
 #include "tool_formparse.h"
 #include "tool_getparam.h"
 #include "tool_helpers.h"
@@ -189,6 +190,7 @@ static const struct LongShort aliases[]= {
   {"$X", "tls-max",                  ARG_STRING},
   {"$Y", "suppress-connect-headers", ARG_BOOL},
   {"$Z", "compressed-ssh",           ARG_BOOL},
+  {"$~", "happy-eyeballs-timeout-ms", ARG_STRING},
   {"0",   "http1.0",                 ARG_NONE},
   {"01",  "http1.1",                 ARG_NONE},
   {"02",  "http2",                   ARG_NONE},
@@ -232,6 +234,7 @@ static const struct LongShort aliases[]= {
   {"En", "ssl-allow-beast",          ARG_BOOL},
   {"Eo", "login-options",            ARG_STRING},
   {"Ep", "pinnedpubkey",             ARG_STRING},
+  {"EP", "proxy-pinnedpubkey",       ARG_STRING},
   {"Eq", "cert-status",              ARG_BOOL},
   {"Er", "false-start",              ARG_BOOL},
   {"Es", "ssl-no-revoke",            ARG_BOOL},
@@ -652,7 +655,8 @@ ParameterError getparameter(const char *flag, /* f or 
-long-flag */
       break;
 
       case 'j': /* --compressed */
-        if(toggle && !(curlinfo->features & CURL_VERSION_LIBZ))
+        if(toggle &&
+           !(curlinfo->features & (CURL_VERSION_LIBZ | CURL_VERSION_BROTLI)))
           return PARAM_LIBCURL_DOESNT_SUPPORT;
         config->encoding = toggle;
         break;
@@ -1109,6 +1113,12 @@ ParameterError getparameter(const char *flag, /* f or 
-long-flag */
       case 'Z': /* --compressed-ssh */
         config->ssh_compression = toggle;
         break;
+      case '~': /* --happy-eyeballs-timeout-ms */
+        err = str2unum(&config->happy_eyeballs_timeout_ms, nextarg);
+        if(err)
+          return err;
+        /* 0 is a valid value for this timeout */
+        break;
       }
       break;
     case '#': /* --progress-bar */
@@ -1500,6 +1510,10 @@ ParameterError getparameter(const char *flag, /* f or 
-long-flag */
         GetStr(&config->pinnedpubkey, nextarg);
         break;
 
+      case 'P': /* proxy pinned public key */
+        GetStr(&config->proxy_pinnedpubkey, nextarg);
+        break;
+
       case 'q': /* --cert-status */
         config->verifystatus = TRUE;
         break;
@@ -2082,11 +2096,15 @@ ParameterError getparameter(const char *flag, /* f or 
-long-flag */
         break;
       }
       now = time(NULL);
-      config->condtime = curl_getdate(nextarg, &now);
-      if(-1 == (int)config->condtime) {
+      config->condtime = (curl_off_t)curl_getdate(nextarg, &now);
+      if(-1 == config->condtime) {
         /* now let's see if it is a file name to get the time from instead! */
-        struct_stat statbuf;
-        if(-1 == stat(nextarg, &statbuf)) {
+        curl_off_t filetime = getfiletime(nextarg, config->global->errors);
+        if(filetime >= 0) {
+          /* pull the time out from the file */
+          config->condtime = filetime;
+        }
+        else {
           /* failed, remove time condition */
           config->timecond = CURL_TIMECOND_NONE;
           warnf(global,
@@ -2094,10 +2112,6 @@ ParameterError getparameter(const char *flag, /* f or 
-long-flag */
                 "a file name). Disabling time condition. "
                 "See curl_getdate(3) for valid date syntax.\n");
         }
-        else {
-          /* pull the time out from the file */
-          config->condtime = statbuf.st_mtime;
-        }
       }
       break;
     default: /* unknown flag */
diff --git a/src/tool_help.c b/src/tool_help.c
index 9dc59cb3e..9796b7e87 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -160,6 +160,8 @@ static const struct helptxt helptext[] = {
    "Put the post data in the URL and use GET"},
   {"-g, --globoff",
    "Disable URL sequences and ranges using {} and []"},
+  {"    --happy-eyeballs-timeout-ms",
+   "How long to wait in milliseconds for IPv6 before trying IPv4"},
   {"-I, --head",
    "Show document info only"},
   {"-H, --header <header/@file>",
@@ -314,6 +316,8 @@ static const struct helptxt helptext[] = {
    "Use NTLM authentication on the proxy"},
   {"    --proxy-pass <phrase>",
    "Pass phrase for the private key for HTTPS proxy"},
+  {"    --proxy-pinnedpubkey <hashes>",
+   "FILE/HASHES public key to verify proxy with"},
   {"    --proxy-service-name <name>",
    "SPNEGO proxy service name"},
   {"    --proxy-ssl-allow-beast",
@@ -505,7 +509,8 @@ static const struct feat feats[] = {
   {"HTTP2",          CURL_VERSION_HTTP2},
   {"UnixSockets",    CURL_VERSION_UNIX_SOCKETS},
   {"HTTPS-proxy",    CURL_VERSION_HTTPS_PROXY},
-  {"MultiSSL",       CURL_VERSION_MULTI_SSL}
+  {"MultiSSL",       CURL_VERSION_MULTI_SSL},
+  {"PSL",            CURL_VERSION_PSL},
 };
 
 void tool_help(void)
@@ -549,9 +554,6 @@ void tool_version_info(void)
 #ifdef USE_METALINK
     printf("Metalink ");
 #endif
-#ifdef USE_LIBPSL
-    printf("PSL ");
-#endif
     puts(""); /* newline */
   }
 }
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 5401955af..e8b434a53 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -25,12 +25,6 @@
 #  include <fcntl.h>
 #endif
 
-#ifdef HAVE_UTIME_H
-#  include <utime.h>
-#elif defined(HAVE_SYS_UTIME_H)
-#  include <sys/utime.h>
-#endif
-
 #ifdef HAVE_LOCALE_H
 #  include <locale.h>
 #endif
@@ -56,6 +50,7 @@
 #include "tool_dirhie.h"
 #include "tool_doswin.h"
 #include "tool_easysrc.h"
+#include "tool_filetime.h"
 #include "tool_getparam.h"
 #include "tool_helpers.h"
 #include "tool_homedir.h"
@@ -174,79 +169,6 @@ static curl_off_t VmsSpecialSize(const char *name,
 }
 #endif /* __VMS */
 
-#if defined(HAVE_UTIME) || \
-    (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8))
-static void setfiletime(long filetime, const char *filename,
-                        FILE *error_stream)
-{
-  if(filetime >= 0) {
-/* Windows utime() may attempt to adjust our unix gmt 'filetime' by a daylight
-   saving time offset and since it's GMT that is bad behavior. When we have
-   access to a 64-bit type we can bypass utime and set the times directly. */
-#if defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)
-    HANDLE hfile;
-
-#if (SIZEOF_LONG >= 8)
-    /* 910670515199 is the maximum unix filetime that can be used as a
-       Windows FILETIME without overflow: 30827-12-31T23:59:59. */
-    if(filetime > CURL_OFF_T_C(910670515199)) {
-      fprintf(error_stream,
-              "Failed to set filetime %ld on outfile: overflow\n",
-              filetime);
-      return;
-    }
-#endif /* SIZEOF_LONG >= 8 */
-
-    hfile = CreateFileA(filename, FILE_WRITE_ATTRIBUTES,
-                        (FILE_SHARE_READ | FILE_SHARE_WRITE |
-                         FILE_SHARE_DELETE),
-                        NULL, OPEN_EXISTING, 0, NULL);
-    if(hfile != INVALID_HANDLE_VALUE) {
-      curl_off_t converted = ((curl_off_t)filetime * 10000000) +
-                             CURL_OFF_T_C(116444736000000000);
-      FILETIME ft;
-      ft.dwLowDateTime = (DWORD)(converted & 0xFFFFFFFF);
-      ft.dwHighDateTime = (DWORD)(converted >> 32);
-      if(!SetFileTime(hfile, NULL, &ft, &ft)) {
-        fprintf(error_stream,
-                "Failed to set filetime %ld on outfile: "
-                "SetFileTime failed: GetLastError %u\n",
-                filetime, GetLastError());
-      }
-      CloseHandle(hfile);
-    }
-    else {
-      fprintf(error_stream,
-              "Failed to set filetime %ld on outfile: "
-              "CreateFile failed: GetLastError %u\n",
-              filetime, GetLastError());
-    }
-
-#elif defined(HAVE_UTIMES)
-    struct timeval times[2];
-    times[0].tv_sec = times[1].tv_sec = filetime;
-    times[0].tv_usec = times[1].tv_usec = 0;
-    if(utimes(filename, times)) {
-      fprintf(error_stream,
-              "Failed to set filetime %ld on outfile: errno %d\n",
-              filetime, errno);
-    }
-
-#elif defined(HAVE_UTIME)
-    struct utimbuf times;
-    times.actime = (time_t)filetime;
-    times.modtime = (time_t)filetime;
-    if(utime(filename, &times)) {
-      fprintf(error_stream,
-              "Failed to set filetime %ld on outfile: errno %d\n",
-              filetime, errno);
-    }
-#endif
-  }
-}
-#endif /* defined(HAVE_UTIME) || \
-          (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) */
-
 #define BUFFER_SIZE (100*1024)
 
 static CURLcode operate_do(struct GlobalConfig *global,
@@ -710,7 +632,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
            * to be considered with one appended if implied CC
            */
 #ifdef __VMS
-          /* Calculate the real upload site for VMS */
+          /* Calculate the real upload size for VMS */
           infd = -1;
           if(stat(uploadfile, &fileinfo) == 0) {
             fileinfo.st_size = VmsSpecialSize(uploadfile, &fileinfo);
@@ -1232,7 +1154,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
 #endif
 
         my_setopt_enum(curl, CURLOPT_TIMECONDITION, (long)config->timecond);
-        my_setopt(curl, CURLOPT_TIMEVALUE, (long)config->condtime);
+        my_setopt(curl, CURLOPT_TIMEVALUE_LARGE, config->condtime);
         my_setopt_str(curl, CURLOPT_CUSTOMREQUEST, config->customrequest);
         customrequest_helper(config, config->httpreq, config->customrequest);
         my_setopt(curl, CURLOPT_STDERR, global->errors);
@@ -1518,6 +1440,11 @@ static CURLcode operate_do(struct GlobalConfig *global,
         if(config->tftp_no_options)
           my_setopt(curl, CURLOPT_TFTP_NO_OPTIONS, 1L);
 
+        /* new in 7.59.0 */
+        if(config->happy_eyeballs_timeout_ms != CURL_HET_DEFAULT)
+          my_setopt(curl, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
+                    config->happy_eyeballs_timeout_ms);
+
         /* initialize retry vars for loop below */
         retry_sleep_default = (config->retry_delay) ?
           config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */
@@ -1841,18 +1768,13 @@ static CURLcode operate_do(struct GlobalConfig *global,
         }
 #endif
 
-#if defined(HAVE_UTIME) || \
-    (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8))
         /* File time can only be set _after_ the file has been closed */
         if(!result && config->remote_time && outs.s_isreg && outs.filename) {
           /* Ask libcurl if we got a remote file time */
-          long filetime = -1;
-          curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
-          if(filetime >= 0)
-            setfiletime(filetime, outs.filename, config->global->errors);
+          curl_off_t filetime = -1;
+          curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
+          setfiletime(filetime, outs.filename, config->global->errors);
         }
-#endif /* defined(HAVE_UTIME) || \
-          (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) */
 
 #ifdef USE_METALINK
         if(!metalink && config->use_metalink && result == CURLE_OK) {
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 98d03b6b4..eaf0deb05 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -55,8 +55,11 @@ test280 test281 test282 test283 test284 test285 test286 
test287 test288 \
 test289 test290 test291 test292 test293 test294 test295 test296 test297 \
 test298 test299 test300 test301 test302 test303 test304 test305 test306 \
 test307 test308 test309 test310 test311 test312 test313 test314 test315 \
-test316 test317 test318         test320 test321 test322 test323 test324 \
-test325 \
+test316 test317 test318 test319 test320 test321 test322 test323 test324 \
+test325 test326 \
+\
+test340 \
+\
 test350 test351 test352 test353 test354 \
 test393 test394 test395 \
 \
@@ -80,7 +83,7 @@ test617 test618 test619 test620 test621 test622 test623 
test624 test625 \
 test626 test627 test628 test629 test630 test631 test632 test633 test634 \
 test635 test636 test637 test638 test639 test640 test641 test642 \
 test643 test644 test645 test646 test647 test648 test649 test650 test651 \
-test652 test653 test654 \
+test652 test653 test654 test655 \
 \
 test700 test701 test702 test703 test704 test705 test706 test707 test708 \
 test709 test710 test711 test712 test713 test714 test715 \
@@ -103,7 +106,7 @@ test909 test910 test911 test912 test913 test914 test915 
test916 test917 \
 test918 test919 test920 test921 test922 test923 test924 test925 test926 \
 test927 test928 test929 test930 test931 test932 test933 test934 test935 \
 test936 test937 test938 test939 test940 test941 test942 test943 test944 \
-test945 test946 test947 test948 test949 test950 \
+test945 test946 test947 test948 test949 test950 test951 test952 \
 \
 test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 \
 test1008 test1009 test1010 test1011 test1012 test1013 test1014 test1015 \
@@ -124,9 +127,10 @@ test1120 test1121 test1122 test1123 test1124 test1125 
test1126 test1127 \
 test1128 test1129 test1130 test1131 test1132 test1133 test1134 test1135 \
 test1136 test1137 test1138                   test1141 test1142 test1143 \
 test1144 test1145 test1146 test1147 test1148 test1149 test1150 test1151 \
-test1152 test1153 \
+test1152 test1153 test1154 \
 \
 test1160 test1161 test1162 test1163 \
+test1170 test1171 \
 test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \
 test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \
 test1216 test1217 test1218 test1219 \
@@ -135,10 +139,10 @@ test1228 test1229 test1230 test1231 test1232 test1233 
test1234 test1235 \
 test1236 test1237 test1238 test1239 test1240 test1241 test1242 test1243 \
 test1244 test1245 test1246 test1247 test1248 test1249 test1250 test1251 \
 test1252 test1253 test1254 test1255 test1256 test1257 test1258 test1259 \
-test1260 test1261 test1262 test1263 test1264 \
+test1260 test1261 test1262 test1263 test1264 test1265 \
 \
 test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 \
-test1288 test1289 test1290 test1291 \
+test1288 test1289 test1290 test1291 test1292 \
 test1298 test1299 \
 test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
 test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
@@ -171,8 +175,8 @@ test1520 test1521 \
 test1525 test1526 test1527 test1528 test1529 test1530 test1531 test1532 \
 test1533 test1534 test1535 test1536 test1537 test1538 \
 test1540 \
-test1550 test1551 test1552 test1553 test1554 \
-test1600 test1601 test1602 test1603 test1604 test1605 test1606 \
+test1550 test1551 test1552 test1553 test1554 test1555 test1556 \
+test1600 test1601 test1602 test1603 test1604 test1605 test1606 test1607 \
 \
 test1700 test1701 test1702 \
 \
diff --git a/tests/data/test553 b/tests/data/test1154
similarity index 78%
copy from tests/data/test553
copy to tests/data/test1154
index bd937f016..cb056d1a8 100644
--- a/tests/data/test553
+++ b/tests/data/test1154
@@ -2,64 +2,56 @@
 <info>
 <keywords>
 HTTP
-HTTP POST
-POST callback
-huge request header
+HTTP GET
 </keywords>
 </info>
+
+#
 # Server-side
 <reply>
-
 <data>
-HTTP/1.1 200 Fine!
-Server: Apache/1.3.27 (Darwin) PHP/4.1.2
-Content-Length: 6
-
-hello
-</data>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Content-Length: 6
+Connection: close
+Long: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
 
+-foo-
+</data>
+<datacheck>
+</datacheck>
 </reply>
 
+#
 # Client-side
 <client>
 <server>
 http
 </server>
-# tool to use
-<tool>
-lib553
-</tool>
-<features>
-</features>
  <name>
-HTTP post with huge request headers and post data from callback
+HTTP GET
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/path/553
+http://%HOSTIP:%HTTPPORT/1154
 </command>
 </client>
 
+#
 # Verify data after the test has been "shot"
 <verify>
 <strip>
-^User-Agent: curl/.*
+^User-Agent:.*
 </strip>
-<protocol nonewline="yes">
-POST /path/553 HTTP/1.1
+<protocol>
+GET /1154 HTTP/1.1
 Host: %HOSTIP:%HTTPPORT
 Accept: */*
-Header0: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header1: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header2: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header3: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header4: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header5: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header6: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header7: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Content-Length: 40960
-Content-Type: application/x-www-form-urlencoded
 
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
 </protocol>
+# 27 == CURLE_OUT_OF_MEMORY
+<errorcode>
+27
+</errorcode>
 </verify>
 </testcase>
diff --git a/tests/data/test1122 b/tests/data/test1170
similarity index 89%
copy from tests/data/test1122
copy to tests/data/test1170
index 78d50d77b..a4d9eb84b 100644
--- a/tests/data/test1122
+++ b/tests/data/test1170
@@ -45,10 +45,10 @@ libz
 http
 </server>
  <name>
-HTTP GET gzip transfer-encoded content
+HTTP GET transfer-encoding with removed Connection:
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/1122 --tr-encoding
+http://%HOSTIP:%HTTPPORT/1170 --tr-encoding -H "Connection:"
 </command>
 </client>
 
@@ -59,7 +59,7 @@ http://%HOSTIP:%HTTPPORT/1122 --tr-encoding
 ^User-Agent:.*
 </strip>
 <protocol>
-GET /1122 HTTP/1.1
+GET /1170 HTTP/1.1
 Host: %HOSTIP:%HTTPPORT
 Accept: */*
 Connection: TE
diff --git a/tests/data/test1122 b/tests/data/test1171
similarity index 89%
copy from tests/data/test1122
copy to tests/data/test1171
index 78d50d77b..0f7ee90d3 100644
--- a/tests/data/test1122
+++ b/tests/data/test1171
@@ -45,10 +45,10 @@ libz
 http
 </server>
  <name>
-HTTP GET gzip transfer-encoded content
+HTTP GET transfer-encoding with blanked Connection:
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/1122 --tr-encoding
+http://%HOSTIP:%HTTPPORT/1171 --tr-encoding -H "Connection;"
 </command>
 </client>
 
@@ -59,7 +59,7 @@ http://%HOSTIP:%HTTPPORT/1122 --tr-encoding
 ^User-Agent:.*
 </strip>
 <protocol>
-GET /1122 HTTP/1.1
+GET /1171 HTTP/1.1
 Host: %HOSTIP:%HTTPPORT
 Accept: */*
 Connection: TE
diff --git a/tests/data/test1255 b/tests/data/test1265
similarity index 71%
copy from tests/data/test1255
copy to tests/data/test1265
index d82310f67..5d3ef6dc8 100644
--- a/tests/data/test1255
+++ b/tests/data/test1265
@@ -24,17 +24,17 @@ foo
 # Client-side
 <client>
 <server>
-http
+http-ipv6
 </server>
 <name>
-Under condition using http_proxy, override NO_PROXY by --nproxy and access 
target URL directly
+NO_PROXY with IPv6 numerical address
 </name>
 <setenv>
 http_proxy=http://%HOSTIP:%HTTPPORT
-NO_PROXY=example.com
+NO_PROXY=::1
 </setenv>
 <command>
-http://%HOSTIP:%HTTPPORT/1255 --noproxy %HOSTIP
+http://%HOST6IP:%HTTP6PORT/1265
 </command>
 </client>
 
@@ -44,8 +44,8 @@ http://%HOSTIP:%HTTPPORT/1255 --noproxy %HOSTIP
 ^User-Agent:.*
 </strip>
 <protocol>
-GET /1255 HTTP/1.1
-Host: %HOSTIP:%HTTPPORT
+GET /1265 HTTP/1.1
+Host: %HOST6IP:%HTTP6PORT
 Accept: */*
 
 </protocol>
diff --git a/tests/data/test5 b/tests/data/test1292
similarity index 68%
copy from tests/data/test5
copy to tests/data/test1292
index b62f1a127..880a4b465 100644
--- a/tests/data/test5
+++ b/tests/data/test1292
@@ -3,7 +3,8 @@
 <keywords>
 HTTP
 HTTP GET
-HTTP proxy
+HTTP added headers
+HTTP replaced headers
 </keywords>
 </info>
 #
@@ -26,10 +27,10 @@ Funny-head: yesyes
 http
 </server>
  <name>
-HTTP over proxy
+Replaced internal headers with a blank one
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/we/want/that/page/5#5 -x %HOSTIP:%HTTPPORT
+ -H "Host;" -H "Accept;" http://%HOSTIP:%HTTPPORT/1292
 </command>
 </client>
 
@@ -40,10 +41,9 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/5#5 -x 
%HOSTIP:%HTTPPORT
 ^User-Agent:.*
 </strip>
 <protocol>
-GET http://%HOSTIP:%HTTPPORT/we/want/that/page/5 HTTP/1.1
-Host: %HOSTIP:%HTTPPORT
-Accept: */*
-Proxy-Connection: Keep-Alive
+GET /1292 HTTP/1.1
+Host:
+Accept:
 
 </protocol>
 </verify>
diff --git a/tests/data/test1538 b/tests/data/test1538
index 25b39a6f6..b084dac6d 100644
--- a/tests/data/test1538
+++ b/tests/data/test1538
@@ -125,7 +125,8 @@ e89: The max connection limit is reached
 e90: SSL public key does not match pinned public key
 e91: SSL server certificate status verification FAILED
 e92: Stream error in the HTTP/2 framing layer
-e93: Unknown error
+e93: API function called from within callback
+e94: Unknown error
 m-1: Please call curl_multi_perform() soon
 m0: No error
 m1: Invalid multi handle
@@ -135,7 +136,8 @@ m4: Internal error
 m5: Invalid socket argument
 m6: Unknown option
 m7: The easy handle is already added to a multi handle
-m8: Unknown error
+m8: API function called from within callback
+m9: Unknown error
 s0: No error
 s1: Unknown share option
 s2: Share currently in use
diff --git a/tests/data/test1513 b/tests/data/test1555
similarity index 76%
copy from tests/data/test1513
copy to tests/data/test1555
index ba0c18a40..19512c5f5 100644
--- a/tests/data/test1513
+++ b/tests/data/test1555
@@ -1,7 +1,7 @@
 <testcase>
 <info>
 <keywords>
-PROGRESSFUNCTION
+RECURSIVE_API_CALL
 </keywords>
 </info>
 
@@ -22,15 +22,15 @@ wait 10
 http
 </server>
 <tool>
-lib1513
+lib1555
 </tool>
  <name>
-return failure immediately from progress callback
+verify api is protected against calls from callbacks
  </name>
 
 # this server/host won't be used for real
  <command>
-http://%HOSTIP:%HTTPPORT/1513
+http://%HOSTIP:%HTTPPORT/1555
 </command>
 </client>
 
@@ -43,7 +43,8 @@ http://%HOSTIP:%HTTPPORT/1513
 42
 </errorcode>
 <stdout>
-PROGRESSFUNCTION called
+curl_easy_recv returned 93
+curl_easy_send returned 93
 </stdout>
 </verify>
 </testcase>
diff --git a/tests/data/test553 b/tests/data/test1556
similarity index 80%
copy from tests/data/test553
copy to tests/data/test1556
index bd937f016..0f99abd81 100644
--- a/tests/data/test553
+++ b/tests/data/test1556
@@ -2,64 +2,62 @@
 <info>
 <keywords>
 HTTP
-HTTP POST
-POST callback
-huge request header
+HTTP GET
 </keywords>
 </info>
+
+#
 # Server-side
 <reply>
+<data nocheck="yes">
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+Long: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
 
-<data>
-HTTP/1.1 200 Fine!
-Server: Apache/1.3.27 (Darwin) PHP/4.1.2
-Content-Length: 6
-
-hello
+-foo-
 </data>
-
 </reply>
 
+#
 # Client-side
 <client>
 <server>
 http
 </server>
-# tool to use
 <tool>
-lib553
+lib1556
 </tool>
-<features>
-</features>
  <name>
-HTTP post with huge request headers and post data from callback
+send long HTTP headers to header callback
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/path/553
+http://%HOSTIP:%HTTPPORT/1556
 </command>
 </client>
 
+#
 # Verify data after the test has been "shot"
 <verify>
 <strip>
-^User-Agent: curl/.*
+^User-Agent:.*
 </strip>
-<protocol nonewline="yes">
-POST /path/553 HTTP/1.1
+<protocol>
+GET /1556 HTTP/1.1
 Host: %HOSTIP:%HTTPPORT
 Accept: */*
-Header0: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header1: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header2: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header3: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header4: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header5: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header6: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Header7: 
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
-Content-Length: 40960
-Content-Type: application/x-www-form-urlencoded
 
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 [...]
 </protocol>
+<stdout>
+-foo-
+Max: 100008
+</stdout>
 </verify>
 </testcase>
diff --git a/tests/data/test1303 b/tests/data/test1607
similarity index 79%
copy from tests/data/test1303
copy to tests/data/test1607
index 925b47e15..9628324e4 100644
--- a/tests/data/test1303
+++ b/tests/data/test1607
@@ -2,7 +2,7 @@
 <info>
 <keywords>
 unittest
-Curl_timeleft
+CURLOPT_RESOLVE
 </keywords>
 </info>
 
@@ -16,10 +16,10 @@ none
 unittest
 </features>
  <name>
-Curl_timeleft unit tests
+CURLOPT_RESOLVE parsing
  </name>
 <tool>
-unit1303
+unit1607
 </tool>
 </client>
 
diff --git a/tests/data/test220 b/tests/data/test319
similarity index 51%
copy from tests/data/test220
copy to tests/data/test319
index 7fd264345..6a61a143a 100644
--- a/tests/data/test220
+++ b/tests/data/test319
@@ -13,23 +13,13 @@ compressed
 SFRUUC8xLjEgMjAwIE9LDQpEYXRlOiBNb24sIDI5IE5vdiAyMDA0IDIxOjU2OjUzIEdNVA0KU2Vy
 dmVyOiBBcGFjaGUvMS4zLjMxIChEZWJpYW4gR05VL0xpbnV4KSBtb2RfZ3ppcC8xLjMuMjYuMWEg
 UEhQLzQuMy45LTEgbW9kX3NzbC8yLjguMjAgT3BlblNTTC8wLjkuN2QgbW9kX3BlcmwvMS4yOQ0K
-VmFyeTogQWNjZXB0LUVuY29kaW5nDQpDb250ZW50LVR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD1J
-U08tODg1OS0xDQpDb250ZW50LUVuY29kaW5nOiBHWklQDQpDb250ZW50LUxlbmd0aDogNDQNCg0K
-H4sICHmeq0EAA2xhbGFsYQDLycxLVTDkUsgB0UZcChCGMRcACgJxYBgAAAA=
+Q29udGVudC1UeXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9SVNPLTg4NTktMQ0KVHJhbnNmZXItRW5j
+b2Rpbmc6IGd6aXANCkNvbnRlbnQtTGVuZ3RoOiA0NA0KDQofiwgIeZ6rQQADbGFsYWxhAMvJzEtV
+MORSyAHRRlwKEIYxFwAKAnFgGAAAAA==
 </data>
 
-<datacheck>
-HTTP/1.1 200 OK
-Date: Mon, 29 Nov 2004 21:56:53 GMT
-Server: Apache/1.3.31 (Debian GNU/Linux) mod_gzip/1.3.26.1a PHP/4.3.9-1 
mod_ssl/2.8.20 OpenSSL/0.9.7d mod_perl/1.29
-Vary: Accept-Encoding
-Content-Type: text/html; charset=ISO-8859-1
-Content-Encoding: GZIP
-Content-Length: 44
-
-line 1
- line 2
-  line 3
+<datacheck base64="yes">
+H4sICHmeq0EAA2xhbGFsYQDLycxLVTDkUsgB0UZcChCGMRcACgJxYBgAAAA=
 </datacheck>
 
 </reply>
@@ -44,11 +34,11 @@ libz
 http
 </server>
  <name>
-HTTP GET gzip compressed content
+HTTP GET gzip transfer-encoded data in raw mode
  </name>
- <command>
-http://%HOSTIP:%HTTPPORT/220 --compressed
-</command>
+ <command option="no-include">
+http://%HOSTIP:%HTTPPORT/319 --raw
+ </command>
 </client>
 
 #
@@ -57,14 +47,10 @@ http://%HOSTIP:%HTTPPORT/220 --compressed
 <strip>
 ^User-Agent:.*
 </strip>
-<strippart>
-s/^Accept-Encoding: .*/Accept-Encoding: xxx/
-</strippart>
 <protocol>
-GET /220 HTTP/1.1
+GET /319 HTTP/1.1
 Host: %HOSTIP:%HTTPPORT
 Accept: */*
-Accept-Encoding: xxx
 
 </protocol>
 </verify>
diff --git a/tests/data/test326 b/tests/data/test326
new file mode 100644
index 000000000..1a4aae5f9
--- /dev/null
+++ b/tests/data/test326
@@ -0,0 +1,66 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+</keywords>
+</info>
+#
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Mon, 29 Nov 2004 21:56:53 GMT
+Server: Apache/1.3.31 (Debian GNU/Linux) mod_gzip/1.3.26.1a PHP/4.3.9-1 
mod_ssl/2.8.20 OpenSSL/0.9.7d mod_perl/1.29
+Content-Type: text/html; charset=ISO-8859-1
+Transfer-Encoding: chunked
+
+18
+line 1
+ line 2
+  line 3
+
+0
+
+</data>
+
+<datacheck>
+18
+line 1
+ line 2
+  line 3
+
+0
+
+</datacheck>
+
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+HTTP GET chunked data in raw mode
+ </name>
+ <command option="no-include">
+http://%HOSTIP:%HTTPPORT/326 --raw
+ </command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /326 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol>
+</verify>
+</testcase>
diff --git a/tests/data/test111 b/tests/data/test340
similarity index 69%
copy from tests/data/test111
copy to tests/data/test340
index bcaa55425..d834d767c 100644
--- a/tests/data/test111
+++ b/tests/data/test340
@@ -2,16 +2,15 @@
 <info>
 <keywords>
 FTP
-EPSV
-Resume
-FAILURE
+PASV
+CWD
+--ftp-method
+singlecwd
 </keywords>
 </info>
+#
 # Server-side
 <reply>
-<size>
-85
-</size>
 </reply>
 
 # Client-side
@@ -20,26 +19,22 @@ FAILURE
 ftp
 </server>
  <name>
-FTP download resume beyond file size
+FTP using %00 in path with singlecwd
  </name>
  <command>
-ftp://%HOSTIP:%FTPPORT/111 -C 2000
+--ftp-method singlecwd ftp://%HOSTIP:%FTPPORT/%00first/second/third/340
 </command>
 </client>
 
 # Verify data after the test has been "shot"
 <verify>
-<errorcode>
-36
-</errorcode>
 <protocol>
 USER anonymous
 PASS address@hidden
 PWD
-EPSV
-TYPE I
-SIZE 111
-QUIT
 </protocol>
+<errorcode>
+3
+</errorcode>
 </verify>
 </testcase>
diff --git a/tests/data/test517 b/tests/data/test517
index 513634f15..f58f4edaa 100644
--- a/tests/data/test517
+++ b/tests/data/test517
@@ -32,96 +32,6 @@ nothing
 # Verify data after the test has been "shot"
 <verify>
 <stdout>
-0: Sun, 06 Nov 1994 08:49:37 GMT => 784111777
-1: Sunday, 06-Nov-94 08:49:37 GMT => 784111777
-2: Sun Nov  6 08:49:37 1994 => 784111777
-3: 06 Nov 1994 08:49:37 GMT => 784111777
-4: 06-Nov-94 08:49:37 GMT => 784111777
-5: Nov  6 08:49:37 1994 => 784111777
-6: 06 Nov 1994 08:49:37 => 784111777
-7: 06-Nov-94 08:49:37 => 784111777
-8: 1994 Nov 6 08:49:37 => 784111777
-9: GMT 08:49:37 06-Nov-94 Sunday => 784111777
-10: 94 6 Nov 08:49:37 => 784111777
-11: 1994 Nov 6 => 784080000
-12: 06-Nov-94 => 784080000
-13: Sun Nov 6 94 => 784080000
-14: 1994.Nov.6 => 784080000
-15: Sun/Nov/6/94/GMT => 784080000
-16: Sun, 06 Nov 1994 08:49:37 CET => 784108177
-17: 06 Nov 1994 08:49:37 EST => 784129777
-18: Sun, 12 Sep 2004 15:05:58 -0700 => 1095026758
-19: Sat, 11 Sep 2004 21:32:11 +0200 => 1094931131
-20: 20040912 15:05:58 -0700 => 1095026758
-21: 20040911 +0200 => 1094853600
-22: Thu, 01-Jan-1970 00:59:59 GMT => 3599
-23: Thu, 01-Jan-1970 01:00:00 GMT => 3600
-24: Sat, 15-Apr-17 21:01:22 GMT => 1492290082
-25: Thu, 19-Apr-2007 16:00:00 GMT => 1176998400
-26: Wed, 25 Apr 2007 21:02:13 GMT => 1177534933
-27: Thu, 19/Apr\2007 16:00:00 GMT => 1176998400
-28: Fri, 1 Jan 2010 01:01:50 GMT => 1262307710
-29: Wednesday, 1-Jan-2003 00:00:00 GMT => 1041379200
-30: , 1-Jan-2003 00:00:00 GMT => 1041379200
-31:  1-Jan-2003 00:00:00 GMT => 1041379200
-32: 1-Jan-2003 00:00:00 GMT => 1041379200
-33: Wed,18-Apr-07 22:50:12 GMT => 1176936612
-34: WillyWonka  , 18-Apr-07 22:50:12 GMT => -1
-35: WillyWonka  , 18-Apr-07 22:50:12 => -1
-36: WillyWonka  ,  18-apr-07   22:50:12 => -1
-37: Mon, 18-Apr-1977 22:50:13 GMT => 230251813
-38: Mon, 18-Apr-77 22:50:13 GMT => 230251813
-39: "Sat, 15-Apr-17\"21:01:22\"GMT" => 1492290082
-40: Partyday, 18- April-07 22:50:12 => -1
-41: Partyday, 18 - Apri-07 22:50:12 => -1
-42: Wednes, 1-Januar-2003 00:00:00 GMT => -1
-43: Sat, 15-Apr-17 21:01:22 => 1492290082
-44: Sat, 15-Apr-17 21:01:22 GMT-2 => 1492290082
-45: Sat, 15-Apr-17 21:01:22 GMT BLAH => 1492290082
-46: Sat, 15-Apr-17 21:01:22 GMT-0400 => 1492290082
-47: Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT) => 1492290082
-48: Sat, 15-Apr-17 21:01:22 DST => -1
-49: Sat, 15-Apr-17 21:01:22 -0400 => 1492304482
-50: Sat, 15-Apr-17 21:01:22 (hello there) => -1
-51: Sat, 15-Apr-17 21:01:22 11:22:33 => -1
-52: Sat, 15-Apr-17 ::00 21:01:22 => -1
-53: Sat, 15-Apr-17 boink:z 21:01:22 => -1
-54: Sat, 15-Apr-17 91:22:33 21:01:22 => -1
-55: Thu Apr 18 22:50:12 2007 GMT => 1176936612
-56: 22:50:12 Thu Apr 18 2007 GMT => 1176936612
-57: Thu 22:50:12 Apr 18 2007 GMT => 1176936612
-58: Thu Apr 22:50:12 18 2007 GMT => 1176936612
-59: Thu Apr 18 22:50:12 2007 GMT => 1176936612
-60: Thu Apr 18 2007 22:50:12 GMT => 1176936612
-61: Thu Apr 18 2007 GMT 22:50:12 => 1176936612
-62: Sat, 15-Apr-17 21:01:22 GMT => 1492290082
-63: 15-Sat, Apr-17 21:01:22 GMT => 1492290082
-64: 15-Sat, Apr 21:01:22 GMT 17 => 1492290082
-65: 15-Sat, Apr 21:01:22 GMT 2017 => 1492290082
-66: 15 Apr 21:01:22 2017 => 1492290082
-67: 15 17 Apr 21:01:22 => 1492290082
-68: Apr 15 17 21:01:22 => 1492290082
-69: Apr 15 21:01:22 17 => 1492290082
-70: 2017 April 15 21:01:22 => -1
-71: 15 April 2017 21:01:22 => -1
-72: 98 April 17 21:01:22 => -1
-73: Thu, 012-Aug-2008 20:49:07 GMT => 1218574147
-74: Thu, 999999999999-Aug-2007 20:49:07 GMT => -1
-75: Thu, 12-Aug-2007 20:61:99999999999 GMT => -1
-76: IAintNoDateFool => -1
-77: Thu Apr 18 22:50 2007 GMT => 1176936600
-78: 20110623 12:34:56 => 1308832496
-79: 20110632 12:34:56 => -1
-80: 20110623 56:34:56 => -1
-81: 20111323 12:34:56 => -1
-82: 20110623 12:34:79 => -1
-83: Wed, 31 Dec 2008 23:59:60 GMT => 1230768000
-84: 20110623 12:3 => 1308830580
-85: 20110623 1:3 => 1308790980
-86: 20110623 1:30 => 1308792600
-87: 20110623 12:12:3 => 1308831123
-88: 20110623 01:12:3 => 1308791523
-89: 20110623 01:99:30 => -1
 </stdout>
 
 # This test case previously tested an overflow case ("2094 Nov 6 =>
diff --git a/tests/data/test555 b/tests/data/test555
index 3aa2ef14a..18bbc43c0 100644
--- a/tests/data/test555
+++ b/tests/data/test555
@@ -106,10 +106,6 @@ chkhostname curlhost
 <strip>
 ^User-Agent: curl/.*
 </strip>
-<strippart>
-# remove CR that CURLOPT_TRANSFERTEXT added, when CharConv enabled:
-s/^(this is the blurb we want to upload)\r\n/$1\n/ if($has_charconv)
-</strippart>
 <protocol>
 POST http://test.remote.example.com/path/555 HTTP/1.1
 Host: test.remote.example.com
diff --git a/tests/data/test512 b/tests/data/test655
similarity index 62%
copy from tests/data/test512
copy to tests/data/test655
index d259f40df..d98729c08 100644
--- a/tests/data/test512
+++ b/tests/data/test655
@@ -2,7 +2,6 @@
 <info>
 <keywords>
 HTTP
-HTTP GET
 </keywords>
 </info>
 
@@ -10,13 +9,17 @@ HTTP GET
 # Server-side
 <reply>
 <data>
-HTTP/1.1 200 OK swsclose
+HTTP/1.1 200 OK
 Date: Thu, 09 Nov 2010 14:49:00 GMT
-Server: yes
+Server: test-server/fake swsclose
 Connection: close
+Content-Type: text/html
 
 hello
 </data>
+<datacheck>
+hello
+</datacheck>
 </reply>
 
 # Client-side
@@ -26,28 +29,22 @@ http
 </server>
 # tool is what to use instead of 'curl'
 <tool>
-lib512
+lib655
 </tool>
 
  <name>
-simple curl_easy_duplicate() test
+resolver start callback
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/512
+http://%HOSTIP:%HTTPPORT/655
 </command>
 </client>
 
 #
 # Verify data after the test has been "shot"
 <verify>
-<strip>
-^User-Agent:.*
-</strip>
-<protocol>
-GET /512 HTTP/1.1
-Host: %HOSTIP:%HTTPPORT
-Accept: */*
-
-</protocol>
+<errorcode>
+0
+</errorcode>
 </verify>
 </testcase>
diff --git a/tests/data/test911 b/tests/data/test911
index cc87349b8..f4c545830 100644
--- a/tests/data/test911
+++ b/tests/data/test911
@@ -40,7 +40,6 @@ DATA
 QUIT
 </protocol>
 <upload>
-
 .
 </upload>
 </verify>
diff --git a/tests/data/test900 b/tests/data/test951
similarity index 67%
copy from tests/data/test900
copy to tests/data/test951
index 0dd7f5273..7d2e17b1b 100644
--- a/tests/data/test900
+++ b/tests/data/test951
@@ -17,16 +17,13 @@ SMTP
 smtp
 </server>
  <name>
-SMTP
+SMTP data with dot as first character
  </name>
 <stdin>
-From: different
-To: another
-
-body
+.This first line starts with a dot
 </stdin>
- <command>
-smtp://%HOSTIP:%SMTPPORT/900 --mail-rcpt address@hidden --mail-from 
address@hidden -T -
+<command>
+smtp://%HOSTIP:%SMTPPORT/951 --mail-rcpt address@hidden --mail-from 
address@hidden -T -
 </command>
 </client>
 
@@ -34,17 +31,14 @@ smtp://%HOSTIP:%SMTPPORT/900 --mail-rcpt address@hidden 
--mail-from sende
 # Verify data after the test has been "shot"
 <verify>
 <protocol>
-EHLO 900
+EHLO 951
 MAIL FROM:<address@hidden>
 RCPT TO:<address@hidden>
 DATA
 QUIT
 </protocol>
 <upload>
-From: different
-To: another
-
-body
+..This first line starts with a dot
 .
 </upload>
 </verify>
diff --git a/tests/data/test911 b/tests/data/test952
similarity index 74%
copy from tests/data/test911
copy to tests/data/test952
index cc87349b8..54334b21e 100644
--- a/tests/data/test911
+++ b/tests/data/test952
@@ -17,15 +17,13 @@ SMTP
 smtp
 </server>
  <name>
-SMTP with no mail data
+SMTP data with single dot-only line
  </name>
-
-<stdin nonewline="yes">
-
+<stdin>
+.
 </stdin>
-
- <command>
-smtp://%HOSTIP:%SMTPPORT/911 --mail-rcpt address@hidden --mail-from 
address@hidden -T -
+<command>
+smtp://%HOSTIP:%SMTPPORT/952 --mail-rcpt address@hidden --mail-from 
address@hidden -T -
 </command>
 </client>
 
@@ -33,14 +31,14 @@ smtp://%HOSTIP:%SMTPPORT/911 --mail-rcpt address@hidden 
--mail-from sende
 # Verify data after the test has been "shot"
 <verify>
 <protocol>
-EHLO 911
+EHLO 952
 MAIL FROM:<address@hidden>
 RCPT TO:<address@hidden>
 DATA
 QUIT
 </protocol>
 <upload>
-
+..
 .
 </upload>
 </verify>
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 956275881..97f7b8ea5 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -6,7 +6,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2014, 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -920,7 +920,7 @@ sub DATA_smtp {
                 print FILE $line if(!$nosave);
 
                 $raw .= $line;
-                if($raw =~ /\x0d\x0a\x2e\x0d\x0a/) {
+                if($raw =~ /(?:^|\x0d\x0a)\x2e\x0d\x0a/) {
                     # end of data marker!
                     $eob = 1;
                 }
@@ -2708,7 +2708,7 @@ sub datasockf_state {
 }
 
 #**********************************************************************
-# nodataconn_str returns string of efective nodataconn command. Notice
+# nodataconn_str returns string of effective nodataconn command. Notice
 # that $nodataconn may be set alone or in addition to a $nodataconnXXX.
 #
 sub nodataconn_str {
@@ -2934,7 +2934,7 @@ while(@ARGV) {
 }
 
 #***************************************************************************
-# Initialize command line option dependant variables
+# Initialize command line option dependent variables
 #
 
 if(!$srcdir) {
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index e7a65ddb5..15fa2990c 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -49,6 +49,8 @@ test1022.pl Makefile.inc notexists.pl CMakeLists.txt 
mk-lib1521.pl
 
 CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
 
+CFLAGS += @CURL_CFLAG_EXTRAS@
+
 # Prevent LIBS from being used for all link targets
 LIBS = $(BLANK_AT_MAKETIME)
 
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index d8a55e21d..e7e8c486a 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -20,14 +20,14 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect   
             \
  lib559 lib560 lib562 lib564 lib565 lib566 lib567 lib568 lib569 lib570   \
  lib571 lib572 lib573 lib574 lib575 lib576        lib578 lib579 lib582   \
  lib583 lib585 lib586 lib587 lib589 lib590 lib591 lib597 lib598 lib599   \
- lib643 lib644 lib645 lib650 lib651 lib652 lib653 lib654 \
+ lib643 lib644 lib645 lib650 lib651 lib652 lib653 lib654 lib655 \
  lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \
  lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515         lib1517 \
  lib1520 lib1521 \
  lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
  lib1534 lib1535 lib1536 lib1537 lib1538 \
  lib1540 \
- lib1550 lib1551 lib1552 lib1553 lib1554 \
+ lib1550 lib1551 lib1552 lib1553 lib1554 lib1555 lib1556 \
  lib1900 \
  lib2033
 
@@ -327,6 +327,9 @@ lib653_CPPFLAGS = $(AM_CPPFLAGS)
 lib654_SOURCES = lib654.c $(SUPPORTFILES)
 lib654_CPPFLAGS = $(AM_CPPFLAGS)
 
+lib655_SOURCES = lib655.c $(SUPPORTFILES)
+lib655_CPPFLAGS = $(AM_CPPFLAGS)
+
 lib1500_SOURCES = lib1500.c $(SUPPORTFILES) $(TESTUTIL)
 lib1500_LDADD = $(TESTUTIL_LIBS)
 lib1500_CPPFLAGS = $(AM_CPPFLAGS)
@@ -477,6 +480,14 @@ lib1553_CPPFLAGS = $(AM_CPPFLAGS)
 lib1554_SOURCES = lib1554.c $(SUPPORTFILES)
 lib1554_CPPFLAGS = $(AM_CPPFLAGS)
 
+lib1555_SOURCES = lib1555.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib1555_LDADD = $(TESTUTIL_LIBS)
+lib1555_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1555
+
+lib1556_SOURCES = lib1556.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib1556_LDADD = $(TESTUTIL_LIBS)
+lib1556_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1556
+
 lib1900_SOURCES = lib1900.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
 lib1900_LDADD = $(TESTUTIL_LIBS)
 lib1900_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/tests/libtest/lib1513.c b/tests/libtest/lib1555.c
similarity index 74%
copy from tests/libtest/lib1513.c
copy to tests/libtest/lib1555.c
index 932ca7208..e4f2255ac 100644
--- a/tests/libtest/lib1513.c
+++ b/tests/libtest/lib1555.c
@@ -20,34 +20,37 @@
  *
  ***************************************************************************/
 /*
- * Test case converted from bug report #1318 by Petr Novak.
- *
- * Before the fix, this test program returned 52 (CURLE_GOT_NOTHING) instead
- * of 42 (CURLE_ABORTED_BY_CALLBACK).
+ * Verify that some API functions are locked from being called inside callback
  */
 
 #include "test.h"
 
 #include "memdebug.h"
 
-static int progressKiller(void *arg,
-                          double dltotal,
-                          double dlnow,
-                          double ultotal,
-                          double ulnow)
+static CURL *curl;
+
+static int progressCallback(void *arg,
+                            double dltotal,
+                            double dlnow,
+                            double ultotal,
+                            double ulnow)
 {
+  CURLcode res = 0;
   (void)arg;
   (void)dltotal;
   (void)dlnow;
   (void)ultotal;
   (void)ulnow;
-  printf("PROGRESSFUNCTION called\n");
+  res = curl_easy_recv(curl, NULL, 0, NULL);
+  printf("curl_easy_recv returned %d\n", res);
+  res = curl_easy_send(curl, NULL, 0, NULL);
+  printf("curl_easy_send returned %d\n", res);
+
   return 1;
 }
 
 int test(char *URL)
 {
-  CURL *curl;
   int res = 0;
 
   global_init(CURL_GLOBAL_ALL);
@@ -57,7 +60,7 @@ int test(char *URL)
   easy_setopt(curl, CURLOPT_URL, URL);
   easy_setopt(curl, CURLOPT_TIMEOUT, (long)7);
   easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1);
-  easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressKiller);
+  easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressCallback);
   easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL);
   easy_setopt(curl, CURLOPT_NOPROGRESS, (long)0);
 
diff --git a/tests/libtest/lib564.c b/tests/libtest/lib1556.c
similarity index 57%
copy from tests/libtest/lib564.c
copy to tests/libtest/lib1556.c
index f959f2043..fa0e60e24 100644
--- a/tests/libtest/lib564.c
+++ b/tests/libtest/lib1556.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2013, 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -21,72 +21,57 @@
  ***************************************************************************/
 #include "test.h"
 
-#include <fcntl.h>
-
 #include "testutil.h"
 #include "warnless.h"
 #include "memdebug.h"
 
-#define TEST_HANG_TIMEOUT 60 * 1000
+struct headerinfo {
+  size_t largest;
+};
+
+static size_t header(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+  size_t headersize = size * nmemb;
+  struct headerinfo *info = (struct headerinfo *)stream;
+  (void)ptr;
+
+  if(headersize > info->largest)
+    /* remember the longest header */
+    info->largest = headersize;
+
+  return nmemb * size;
+}
 
 int test(char *URL)
 {
-  int res = 0;
+  CURLcode code;
   CURL *curl = NULL;
-  int running;
-  CURLM *m = NULL;
-
-  start_test_timing();
+  int res = 0;
+  struct headerinfo info = {0};
 
   global_init(CURL_GLOBAL_ALL);
 
   easy_init(curl);
 
-  easy_setopt(curl, CURLOPT_URL, URL);
+  easy_setopt(curl, CURLOPT_HEADERFUNCTION, header);
+  easy_setopt(curl, CURLOPT_HEADERDATA, &info);
   easy_setopt(curl, CURLOPT_VERBOSE, 1L);
-  easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
-  easy_setopt(curl, CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4);
-
-  multi_init(m);
-
-  multi_add_handle(m, curl);
-
-  fprintf(stderr, "Start at URL 0\n");
-
-  for(;;) {
-    struct timeval interval;
-    fd_set rd, wr, exc;
-    int maxfd = -99;
-
-    interval.tv_sec = 1;
-    interval.tv_usec = 0;
-
-    multi_perform(m, &running);
-
-    abort_on_test_timeout();
-
-    if(!running)
-      break; /* done */
-
-    FD_ZERO(&rd);
-    FD_ZERO(&wr);
-    FD_ZERO(&exc);
-
-    multi_fdset(m, &rd, &wr, &exc, &maxfd);
-
-    /* At this point, maxfd is guaranteed to be greater or equal than -1. */
-
-    select_test(maxfd + 1, &rd, &wr, &exc, &interval);
+  easy_setopt(curl, CURLOPT_URL, URL);
 
-    abort_on_test_timeout();
+  code = curl_easy_perform(curl);
+  if(CURLE_OK != code) {
+    fprintf(stderr, "%s:%d curl_easy_perform() failed, "
+            "with code %d (%s)\n",
+            __FILE__, __LINE__, (int)code, curl_easy_strerror(code));
+    res = TEST_ERR_MAJOR_BAD;
+    goto test_cleanup;
   }
 
-test_cleanup:
+  printf("Max: %ld\n", (long)info.largest);
 
-  /* undocumented cleanup sequence - type UB */
+test_cleanup:
 
   curl_easy_cleanup(curl);
-  curl_multi_cleanup(m);
   curl_global_cleanup();
 
   return res;
diff --git a/tests/libtest/lib517.c b/tests/libtest/lib517.c
index af7b2aa7a..e7451907c 100644
--- a/tests/libtest/lib517.c
+++ b/tests/libtest/lib517.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -23,117 +23,141 @@
 
 #include "memdebug.h"
 
-static const char * const dates[]={
-  "Sun, 06 Nov 1994 08:49:37 GMT",
-  "Sunday, 06-Nov-94 08:49:37 GMT",
-  "Sun Nov  6 08:49:37 1994",
-  "06 Nov 1994 08:49:37 GMT",
-  "06-Nov-94 08:49:37 GMT",
-  "Nov  6 08:49:37 1994",
-  "06 Nov 1994 08:49:37",
-  "06-Nov-94 08:49:37",
-  "1994 Nov 6 08:49:37",
-  "GMT 08:49:37 06-Nov-94 Sunday",
-  "94 6 Nov 08:49:37",
-  "1994 Nov 6",
-  "06-Nov-94",
-  "Sun Nov 6 94",
-  "1994.Nov.6",
-  "Sun/Nov/6/94/GMT",
-  "Sun, 06 Nov 1994 08:49:37 CET",
-  "06 Nov 1994 08:49:37 EST",
-  "Sun, 12 Sep 2004 15:05:58 -0700",
-  "Sat, 11 Sep 2004 21:32:11 +0200",
-  "20040912 15:05:58 -0700",
-  "20040911 +0200",
-  "Thu, 01-Jan-1970 00:59:59 GMT",
-  "Thu, 01-Jan-1970 01:00:00 GMT",
-/*  "2094 Nov 6", See ../data/test517 for details */
-  "Sat, 15-Apr-17 21:01:22 GMT",
-  "Thu, 19-Apr-2007 16:00:00 GMT",
-  "Wed, 25 Apr 2007 21:02:13 GMT",
-  "Thu, 19/Apr\\2007 16:00:00 GMT",
-  "Fri, 1 Jan 2010 01:01:50 GMT",
-  "Wednesday, 1-Jan-2003 00:00:00 GMT",
-  ", 1-Jan-2003 00:00:00 GMT",
-  " 1-Jan-2003 00:00:00 GMT",
-  "1-Jan-2003 00:00:00 GMT",
-  "Wed,18-Apr-07 22:50:12 GMT",
-  "WillyWonka  , 18-Apr-07 22:50:12 GMT",
-  "WillyWonka  , 18-Apr-07 22:50:12",
-  "WillyWonka  ,  18-apr-07   22:50:12",
-  "Mon, 18-Apr-1977 22:50:13 GMT",
-  "Mon, 18-Apr-77 22:50:13 GMT",
-  "\"Sat, 15-Apr-17\\\"21:01:22\\\"GMT\"",
-  "Partyday, 18- April-07 22:50:12",
-  "Partyday, 18 - Apri-07 22:50:12",
-  "Wednes, 1-Januar-2003 00:00:00 GMT",
-  "Sat, 15-Apr-17 21:01:22",
-  "Sat, 15-Apr-17 21:01:22 GMT-2",
-  "Sat, 15-Apr-17 21:01:22 GMT BLAH",
-  "Sat, 15-Apr-17 21:01:22 GMT-0400",
-  "Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)",
-  "Sat, 15-Apr-17 21:01:22 DST",
-  "Sat, 15-Apr-17 21:01:22 -0400",
-  "Sat, 15-Apr-17 21:01:22 (hello there)",
-  "Sat, 15-Apr-17 21:01:22 11:22:33",
-  "Sat, 15-Apr-17 ::00 21:01:22",
-  "Sat, 15-Apr-17 boink:z 21:01:22",
-  "Sat, 15-Apr-17 91:22:33 21:01:22",
-  "Thu Apr 18 22:50:12 2007 GMT",
-  "22:50:12 Thu Apr 18 2007 GMT",
-  "Thu 22:50:12 Apr 18 2007 GMT",
-  "Thu Apr 22:50:12 18 2007 GMT",
-  "Thu Apr 18 22:50:12 2007 GMT",
-  "Thu Apr 18 2007 22:50:12 GMT",
-  "Thu Apr 18 2007 GMT 22:50:12",
-  "Sat, 15-Apr-17 21:01:22 GMT",
-  "15-Sat, Apr-17 21:01:22 GMT",
-  "15-Sat, Apr 21:01:22 GMT 17",
-  "15-Sat, Apr 21:01:22 GMT 2017",
-  "15 Apr 21:01:22 2017",
-  "15 17 Apr 21:01:22",
-  "Apr 15 17 21:01:22",
-  "Apr 15 21:01:22 17",
-  "2017 April 15 21:01:22",
-  "15 April 2017 21:01:22",
-  "98 April 17 21:01:22",
-  "Thu, 012-Aug-2008 20:49:07 GMT",
+struct dcheck {
+  const char *input;
+  time_t output;
+};
+
+static struct dcheck dates[] = {
+  {"Sun, 06 Nov 1994 08:49:37 GMT", 784111777 },
+  {"Sunday, 06-Nov-94 08:49:37 GMT", 784111777 },
+  {"Sun Nov  6 08:49:37 1994", 784111777 },
+  {"06 Nov 1994 08:49:37 GMT", 784111777 },
+  {"06-Nov-94 08:49:37 GMT", 784111777 },
+  {"Nov  6 08:49:37 1994", 784111777 },
+  {"06 Nov 1994 08:49:37", 784111777 },
+  {"06-Nov-94 08:49:37", 784111777 },
+  {"1994 Nov 6 08:49:37", 784111777 },
+  {"GMT 08:49:37 06-Nov-94 Sunday", 784111777 },
+  {"94 6 Nov 08:49:37", 784111777 },
+  {"1994 Nov 6", 784080000 },
+  {"06-Nov-94", 784080000 },
+  {"Sun Nov 6 94", 784080000 },
+  {"1994.Nov.6", 784080000 },
+  {"Sun/Nov/6/94/GMT", 784080000 },
+  {"Sun, 06 Nov 1994 08:49:37 CET", 784108177 },
+  {"06 Nov 1994 08:49:37 EST", 784129777 },
+  {"Sun, 12 Sep 2004 15:05:58 -0700", 1095026758 },
+  {"Sat, 11 Sep 2004 21:32:11 +0200", 1094931131 },
+  {"20040912 15:05:58 -0700", 1095026758 },
+  {"20040911 +0200", 1094853600 },
+  {"Thu, 01-Jan-1970 00:59:59 GMT", 3599 },
+  {"Thu, 01-Jan-1970 01:00:00 GMT", 3600 },
+  {"Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
+  {"Thu, 19-Apr-2007 16:00:00 GMT", 1176998400 },
+  {"Wed, 25 Apr 2007 21:02:13 GMT", 1177534933 },
+  {"Thu, 19/Apr\\2007 16:00:00 GMT", 1176998400 },
+  {"Fri, 1 Jan 2010 01:01:50 GMT", 1262307710 },
+  {"Wednesday, 1-Jan-2003 00:00:00 GMT", 1041379200 },
+  {", 1-Jan-2003 00:00:00 GMT", 1041379200 },
+  {"1-Jan-2003 00:00:00 GMT", 1041379200 },
+  {"1-Jan-2003 00:00:00 GMT", 1041379200 },
+  {"Wed,18-Apr-07 22:50:12 GMT", 1176936612 },
+  {"WillyWonka  , 18-Apr-07 22:50:12 GMT", -1 },
+  {"WillyWonka  , 18-Apr-07 22:50:12", -1 },
+  {"WillyWonka  ,  18-apr-07   22:50:12", -1 },
+  {"Mon, 18-Apr-1977 22:50:13 GMT", 230251813 },
+  {"Mon, 18-Apr-77 22:50:13 GMT", 230251813 },
+  {"Sat, 15-Apr-17\"21:01:22\"GMT", 1492290082 },
+  {"Partyday, 18- April-07 22:50:12", -1 },
+  {"Partyday, 18 - Apri-07 22:50:12", -1 },
+  {"Wednes, 1-Januar-2003 00:00:00 GMT", -1 },
+  {"Sat, 15-Apr-17 21:01:22", 1492290082 },
+  {"Sat, 15-Apr-17 21:01:22 GMT-2", 1492290082 },
+  {"Sat, 15-Apr-17 21:01:22 GMT BLAH", 1492290082 },
+  {"Sat, 15-Apr-17 21:01:22 GMT-0400", 1492290082 },
+  {"Sat, 15-Apr-17 21:01:22 GMT-0400 (EDT)", 1492290082 },
+  {"Sat, 15-Apr-17 21:01:22 DST", -1 },
+  {"Sat, 15-Apr-17 21:01:22 -0400", 1492304482 },
+  {"Sat, 15-Apr-17 21:01:22 (hello there)", -1 },
+  {"Sat, 15-Apr-17 21:01:22 11:22:33", -1 },
+  {"Sat, 15-Apr-17 ::00 21:01:22", -1 },
+  {"Sat, 15-Apr-17 boink:z 21:01:22", -1 },
+  {"Sat, 15-Apr-17 91:22:33 21:01:22", -1 },
+  {"Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
+  {"22:50:12 Thu Apr 18 2007 GMT", 1176936612 },
+  {"Thu 22:50:12 Apr 18 2007 GMT", 1176936612 },
+  {"Thu Apr 22:50:12 18 2007 GMT", 1176936612 },
+  {"Thu Apr 18 22:50:12 2007 GMT", 1176936612 },
+  {"Thu Apr 18 2007 22:50:12 GMT", 1176936612 },
+  {"Thu Apr 18 2007 GMT 22:50:12", 1176936612 },
+  {"Sat, 15-Apr-17 21:01:22 GMT", 1492290082 },
+  {"15-Sat, Apr-17 21:01:22 GMT", 1492290082 },
+  {"15-Sat, Apr 21:01:22 GMT 17", 1492290082 },
+  {"15-Sat, Apr 21:01:22 GMT 2017", 1492290082 },
+  {"15 Apr 21:01:22 2017", 1492290082 },
+  {"15 17 Apr 21:01:22", 1492290082 },
+  {"Apr 15 17 21:01:22", 1492290082 },
+  {"Apr 15 21:01:22 17", 1492290082 },
+  {"2017 April 15 21:01:22", -1 },
+  {"15 April 2017 21:01:22", -1 },
+  {"98 April 17 21:01:22", -1 },
+  {"Thu, 012-Aug-2008 20:49:07 GMT", 1218574147 },
+  {"Thu, 999999999999-Aug-2007 20:49:07 GMT", -1 },
+  {"Thu, 12-Aug-2007 20:61:99999999999 GMT", -1 },
+  {"IAintNoDateFool", -1 },
+  {"Thu Apr 18 22:50 2007 GMT", 1176936600 },
+  {"20110623 12:34:56", 1308832496 },
+  {"20110632 12:34:56", -1 },
+  {"20110623 56:34:56", -1 },
+  {"20111323 12:34:56", -1 },
+  {"20110623 12:34:79", -1 },
+  {"Wed, 31 Dec 2008 23:59:60 GMT", 1230768000 },
+  {"20110623 12:3", 1308830580 },
+  {"20110623 1:3", 1308790980 },
+  {"20110623 1:30", 1308792600 },
+  {"20110623 12:12:3", 1308831123 },
+  {"20110623 01:12:3", 1308791523 },
+  {"20110623 01:99:30", -1 },
+  {"Thu, 01-Jan-1970 00:00:00 GMT", 0 },
+  {"Thu, 31-Dec-1969 23:59:58 GMT", -2 },
+  {"Thu, 31-Dec-1969 23:59:59 GMT", 0 }, /* avoids -1 ! */
+#if SIZEOF_TIME_T > 4
+  {"Sun, 06 Nov 2044 08:49:37 GMT", 2362034977 },
+  {"Sun, 06 Nov 3144 08:49:37 GMT", 37074617377 },
+#ifndef HAVE_TIME_T_UNSIGNED
 #if 0
-  /* leaving out these strings since they differ between 32 and 64 bit
-     archs and the test suite has no good way to support two different outputs
-     like that */
-  "Thu, 12-Aug-31841 20:49:07 GMT",
-  "Thu, 12-Aug-9999999999 20:49:07 GMT",
+  /* causes warning on MSVC */
+  {"Sun, 06 Nov 1900 08:49:37 GMT", -2182259423 },
+#endif
+  {"Sun, 06 Nov 1800 08:49:37 GMT", -5337933023 },
+  {"Thu, 01-Jan-1583 00:00:00 GMT", -12212553600 },
+#endif
+  {"Thu, 01-Jan-1499 00:00:00 GMT", -1 },
+#else
+  {"Sun, 06 Nov 2044 08:49:37 GMT", -1 },
+#endif
+#ifndef HAVE_TIME_T_UNSIGNED
+  {"Sun, 06 Nov 1968 08:49:37 GMT", -36342623 },
 #endif
-  "Thu, 999999999999-Aug-2007 20:49:07 GMT",
-  "Thu, 12-Aug-2007 20:61:99999999999 GMT",
-  "IAintNoDateFool",
-  "Thu Apr 18 22:50 2007 GMT", /* without seconds */
-  "20110623 12:34:56",
-  "20110632 12:34:56",
-  "20110623 56:34:56",
-  "20111323 12:34:56",
-  "20110623 12:34:79",
-  "Wed, 31 Dec 2008 23:59:60 GMT", /* leap second */
-  "20110623 12:3",
-  "20110623 1:3",
-  "20110623 1:30",
-  "20110623 12:12:3",
-  "20110623 01:12:3",
-  "20110623 01:99:30",
-  NULL
+  { NULL, 0 }
 };
 
 int test(char *URL)
 {
   int i;
+  int error = 0;
 
   (void)URL; /* not used */
 
-  for(i = 0; dates[i]; i++) {
-    printf("%d: %s => %ld\n", i, dates[i], (long)curl_getdate(dates[i], NULL));
+  for(i = 0; dates[i].input; i++) {
+    time_t out = curl_getdate(dates[i].input, NULL);
+    if(out != dates[i].output) {
+      printf("WRONGLY %s => %ld (instead of %ld)\n",
+             dates[i].input, out, dates[i].output);
+      error++;
+    }
   }
 
-  return 0;
+  return error;
 }
diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c
index 1f832d2a6..cb1aefc87 100644
--- a/tests/libtest/lib544.c
+++ b/tests/libtest/lib544.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -26,9 +26,12 @@
 static char teststring[] =
 #ifdef CURL_DOES_CONVERSIONS
   /* ASCII representation with escape sequences for non-ASCII platforms */
-  "\x54\x68\x69\x73\x00\x20\x69\x73\x20\x74\x65\x73\x74\x20\x62\x69\x6e\x61"
-  "\x72\x79\x20\x64\x61\x74\x61\x20\x77\x69\x74\x68\x20\x61\x6e\x20\x65\x6d"
-  "\x62\x65\x64\x64\x65\x64\x20\x4e\x55\x4c\x20\x62\x79\x74\x65\x0a";
+{ '\x54', '\x68', '\x69', '\x73', '\x00', '\x20', '\x69', '\x73', '\x20',
+  '\x74', '\x65', '\x73', '\x74', '\x20', '\x62', '\x69', '\x6e', '\x61',
+  '\x72', '\x79', '\x20', '\x64', '\x61', '\x74', '\x61', '\x20', '\x77',
+  '\x69', '\x74', '\x68', '\x20', '\x61', '\x6e', '\x20', '\x65', '\x6d',
+  '\x62', '\x65', '\x64', '\x64', '\x65', '\x64', '\x20', '\x4e', '\x55',
+  '\x4c'};
 #else
 {   'T', 'h', 'i', 's', '\0', ' ', 'i', 's', ' ', 't', 'e', 's', 't', ' ',
     'b', 'i', 'n', 'a', 'r', 'y', ' ', 'd', 'a', 't', 'a', ' ',
diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c
index fc71bb643..c887b56f0 100644
--- a/tests/libtest/lib555.c
+++ b/tests/libtest/lib555.c
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -35,7 +35,15 @@
 
 #define TEST_HANG_TIMEOUT 60 * 1000
 
-#define UPLOADTHIS "this is the blurb we want to upload\n"
+static const char uploadthis[] =
+#ifdef CURL_DOES_CONVERSIONS
+  /* ASCII representation with escape sequences for non-ASCII platforms */
+  "\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x62\x6c\x75\x72"
+  "\x62\x20\x77\x65\x20\x77\x61\x6e\x74\x20\x74\x6f\x20\x75\x70\x6c"
+  "\x6f\x61\x64\x0a";
+#else
+  "this is the blurb we want to upload\n";
+#endif
 
 static size_t readcallback(void  *ptr,
                            size_t size,
@@ -51,10 +59,10 @@ static size_t readcallback(void  *ptr,
   }
   (*counter)++; /* bump */
 
-  if(size * nmemb > strlen(UPLOADTHIS)) {
+  if(size * nmemb > strlen(uploadthis)) {
     fprintf(stderr, "READ!\n");
-    strcpy(ptr, UPLOADTHIS);
-    return strlen(UPLOADTHIS);
+    strcpy(ptr, uploadthis);
+    return strlen(uploadthis);
   }
   fprintf(stderr, "READ NOT FINE!\n");
   return 0;
@@ -98,13 +106,9 @@ int test(char *URL)
   easy_setopt(curl, CURLOPT_READDATA, &counter);
   /* We CANNOT do the POST fine without setting the size (or choose
      chunked)! */
-  easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS));
+  easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(uploadthis));
 
   easy_setopt(curl, CURLOPT_POST, 1L);
-#ifdef CURL_DOES_CONVERSIONS
-  /* Convert the POST data to ASCII. */
-  easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L);
-#endif
   easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
   easy_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3);
   easy_setopt(curl, CURLOPT_PROXYAUTH,
diff --git a/tests/libtest/lib560.c b/tests/libtest/lib560.c
index 0093ea113..16045e6da 100644
--- a/tests/libtest/lib560.c
+++ b/tests/libtest/lib560.c
@@ -31,7 +31,7 @@
  * Simply download a HTTPS file!
  *
  * This test was added after the HTTPS-using-multi-interface with OpenSSL
- * regression of 7.19.1 to hopefully prevent this embarassing mistake from
+ * regression of 7.19.1 to hopefully prevent this embarrassing mistake from
  * appearing again... Unfortunately the bug wasn't triggered by this test,
  * which presumably is because the connect to a local server is too
  * fast/different compared to the real/distant servers we saw the bug happen
diff --git a/tests/libtest/lib655.c b/tests/libtest/lib655.c
new file mode 100644
index 000000000..8777b99ed
--- /dev/null
+++ b/tests/libtest/lib655.c
@@ -0,0 +1,112 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "test.h"
+
+#include "memdebug.h"
+
+static const char *TEST_DATA_STRING = "Test data";
+static int cb_count = 0;
+
+static int
+resolver_alloc_cb_fail(void *resolver_state, void *reserved, void *userdata)
+{
+  (void)resolver_state;
+  (void)reserved;
+
+  cb_count++;
+  if(strcmp(userdata, TEST_DATA_STRING)) {
+    fprintf(stderr, "Invalid test data received");
+    exit(1);
+  }
+
+  return 1;
+}
+
+static int
+resolver_alloc_cb_pass(void *resolver_state, void *reserved, void *userdata)
+{
+  (void)resolver_state;
+  (void)reserved;
+
+  cb_count++;
+  if(strcmp(userdata, TEST_DATA_STRING)) {
+    fprintf(stderr, "Invalid test data received");
+    exit(1);
+  }
+
+  return 0;
+}
+
+int test(char *URL)
+{
+  CURL *curl;
+  CURLcode res = CURLE_OK;
+
+  if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
+    fprintf(stderr, "curl_global_init() failed\n");
+    return TEST_ERR_MAJOR_BAD;
+  }
+  curl = curl_easy_init();
+  if(!curl) {
+    fprintf(stderr, "curl_easy_init() failed\n");
+    res = TEST_ERR_MAJOR_BAD;
+    goto test_cleanup;
+  }
+
+  /* First set the URL that is about to receive our request. */
+  test_setopt(curl, CURLOPT_URL, URL);
+
+  test_setopt(curl, CURLOPT_RESOLVER_START_DATA, TEST_DATA_STRING);
+  test_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_alloc_cb_fail);
+
+  /* this should fail */
+  res = curl_easy_perform(curl);
+  if(res != CURLE_COULDNT_RESOLVE_HOST) {
+    fprintf(stderr, "curl_easy_perform should have returned "
+            "CURLE_COULDNT_RESOLVE_HOST but instead returned error %d\n", res);
+    if(res == CURLE_OK)
+      res = TEST_ERR_FAILURE;
+    goto test_cleanup;
+  }
+
+  test_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_alloc_cb_pass);
+
+  /* this should succeed */
+  res = curl_easy_perform(curl);
+  if(res) {
+    fprintf(stderr, "curl_easy_perform failed.\n");
+    goto test_cleanup;
+  }
+
+  if(cb_count != 2) {
+    fprintf(stderr, "Unexpected number of callbacks: %d\n", cb_count);
+    res = TEST_ERR_FAILURE;
+    goto test_cleanup;
+  }
+
+test_cleanup:
+  /* always cleanup */
+  curl_easy_cleanup(curl);
+  curl_global_cleanup();
+
+  return (int)res;
+}
diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl
index 0b1d10d46..0b1efc4ab 100755
--- a/tests/libtest/mk-lib1521.pl
+++ b/tests/libtest/mk-lib1521.pl
@@ -71,7 +71,7 @@ struct data {
 /* Unexpected error.
     CURLE_NOT_BUILT_IN   - means disabled at build
     CURLE_UNKNOWN_OPTION - means no such option (anymore?)
-    CURLE_SSL_ENGINE_NOTFOUND - set unkown ssl engine
+    CURLE_SSL_ENGINE_NOTFOUND - set unknown ssl engine
     CURLE_UNSUPPORTED_PROTOCOL - set bad HTTP version
     CURLE_BAD_FUNCTION_ARGUMENT - unsupported value
    */
@@ -132,6 +132,7 @@ static curl_chunk_end_callback chunk_end_cb;
 static curl_fnmatch_callback fnmatch_cb;
 static curl_closesocket_callback closesocketcb;
 static curl_xferinfo_callback xferinfocb;
+static curl_resolver_start_callback resolver_start_cb;
 
 int test(char *URL)
 {
diff --git a/tests/nroff-scan.pl b/tests/nroff-scan.pl
index 1ab780f56..c868dd622 100755
--- a/tests/nroff-scan.pl
+++ b/tests/nroff-scan.pl
@@ -69,7 +69,7 @@ sub file {
             if($str =~ /((libcurl|gnurl)([^ ]*))\(3\)/i) {
                 my $man = "$1.3";
                 if(!manpresent($man)) {
-                    print STDERR "error: $f:$line: refering to non-existing 
man page $man\n";
+                    print STDERR "error: $f:$line: referring to non-existing 
man page $man\n";
                     $errors++;
                 }
                 if($pre ne "I") {
@@ -87,7 +87,7 @@ sub file {
             while($i =~ s/((lib|)gnurl([^ ]*)) *\"\(3\)(,|) *\" *//i ) {
                 my $man = "$1.3";
                 if(!manpresent($man)) {
-                    print STDERR "error: $f:$line: refering to non-existing 
man page $man\n";
+                    print STDERR "error: $f:$line: referring to non-existing 
man page $man\n";
                     $errors++;
                 }
             }
diff --git a/tests/pathhelp.pm b/tests/pathhelp.pm
index 10a87aaf9..bd91c91bf 100644
--- a/tests/pathhelp.pm
+++ b/tests/pathhelp.pm
@@ -451,7 +451,7 @@ sub build_sys_abs_path {
         return $path;
     }
     elsif(should_use_cygpath()) {
-        # 'cygpath' is avalable - use it.
+        # 'cygpath' is available - use it.
 
         my $has_final_slash = ($path =~ m{[\\/]$});
 
diff --git a/tests/python_dependencies/impacket/spnego.py 
b/tests/python_dependencies/impacket/spnego.py
index f177d18f7..43e65fb5c 100644
--- a/tests/python_dependencies/impacket/spnego.py
+++ b/tests/python_dependencies/impacket/spnego.py
@@ -226,7 +226,7 @@ class SPNEGO_NegTokenResp:
                     raise Exception('OID tag not found %x' % next_byte)
                 decode_data2 = decode_data2[1:]
                 item, total_bytes2 = asn1decode(decode_data2)
-                self['SuportedMech'] = item
+                self['SupportedMech'] = item
 
                 decode_data = decode_data[1:]
                 decode_data = decode_data[total_bytes:]
diff --git a/tests/runtests.pl b/tests/runtests.pl
index b7bacfc76..c4492655a 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -2772,6 +2772,7 @@ sub checksystem {
             }
            if ($libcurl =~ /winssl/i) {
                $has_winssl=1;
+               $has_sslpinning=1;
                $ssllib="WinSSL";
            }
            elsif ($libcurl =~ /openssl/i) {
diff --git a/tests/server/CMakeLists.txt b/tests/server/CMakeLists.txt
index 39c145007..b85f4b853 100644
--- a/tests/server/CMakeLists.txt
+++ b/tests/server/CMakeLists.txt
@@ -20,7 +20,7 @@ function(SETUP_EXECUTABLE TEST_NAME)    # ARGN are the files 
in the test
   target_link_libraries(${TEST_NAME} ${CURL_LIBS})
 
   # Test servers simply are standalone programs that do not use libcurl
-  # library.  For convinience and to ease portability of these servers,
+  # library.  For convenience and to ease portability of these servers,
   # some source code files from the libcurl subdirectory are also used
   # to build the servers.  In order to achieve proper linkage of these
   # files on Win32 targets it is necessary to build the test servers
diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc
index 208aa0fc8..c6233affa 100644
--- a/tests/server/Makefile.inc
+++ b/tests/server/Makefile.inc
@@ -4,13 +4,15 @@ CURLX_SRCS = \
  ../../lib/mprintf.c \
  ../../lib/nonblock.c \
  ../../lib/strtoofft.c \
- ../../lib/warnless.c
+ ../../lib/warnless.c \
+ ../../lib/curl_ctype.c
 
 CURLX_HDRS = \
  ../../lib/curlx.h \
  ../../lib/nonblock.h \
  ../../lib/strtoofft.h \
- ../../lib/warnless.h
+ ../../lib/warnless.h \
+ ../../lib/curl_ctype.h
 
 USEFUL = \
  getpart.c \
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index ceb04d8e8..40f5bdb48 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -1050,7 +1050,7 @@ static bool juggle(curl_socket_t *sockfdp,
 
        Commands:
 
-       DATA - plain pass-thru data
+       DATA - plain pass-through data
     */
 
     if(!read_stdin(buffer, 5))
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 1d47375ad..10a87746b 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -1347,7 +1347,7 @@ static curl_socket_t connect_to(const char *ipaddr, 
unsigned short port)
   serverfd = socket(socket_domain, SOCK_STREAM, 0);
   if(CURL_SOCKET_BAD == serverfd) {
     error = SOCKERRNO;
-    logmsg("Error creating socket for server conection: (%d) %s",
+    logmsg("Error creating socket for server connection: (%d) %s",
            error, strerror(error));
     return CURL_SOCKET_BAD;
   }
@@ -1358,7 +1358,7 @@ static curl_socket_t connect_to(const char *ipaddr, 
unsigned short port)
     curl_socklen_t flag = 1;
     if(0 != setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY,
                        (void *)&flag, sizeof(flag)))
-      logmsg("====> TCP_NODELAY for server conection failed");
+      logmsg("====> TCP_NODELAY for server connection failed");
   }
 #endif
 
@@ -1423,7 +1423,7 @@ static curl_socket_t connect_to(const char *ipaddr, 
unsigned short port)
  * either end.
  *
  * When doing FTP through a CONNECT proxy, we expect that the data connection
- * will be setup while the first connect is still being kept up. Therefor we
+ * will be setup while the first connect is still being kept up. Therefore we
  * must accept a new connection and deal with it appropriately.
  */
 
@@ -1567,7 +1567,7 @@ static void http_connect(curl_socket_t *infdp,
             curl_socklen_t flag = 1;
             if(0 != setsockopt(datafd, IPPROTO_TCP, TCP_NODELAY,
                                (void *)&flag, sizeof(flag)))
-              logmsg("====> TCP_NODELAY for client DATA conection failed");
+              logmsg("====> TCP_NODELAY for client DATA connection failed");
           }
 #endif
           req2.pipelining = FALSE;
diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am
index 61b72c0db..fab82d2b0 100644
--- a/tests/unit/Makefile.am
+++ b/tests/unit/Makefile.am
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -50,6 +50,8 @@ endif
 
 EXTRA_DIST = Makefile.inc CMakeLists.txt
 
+CFLAGS += @CURL_CFLAG_EXTRAS@
+
 # Prevent LIBS from being used for all link targets
 LIBS = $(BLANK_AT_MAKETIME)
 
diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc
index e4cfa2c99..17481f339 100644
--- a/tests/unit/Makefile.inc
+++ b/tests/unit/Makefile.inc
@@ -9,7 +9,7 @@ UNITPROGS = unit1300 unit1301 unit1302 unit1303 unit1304 
unit1305 unit1307      \
  unit1308 unit1309 unit1323 \
  unit1330 unit1394 unit1395 unit1396 unit1397 unit1398 \
  unit1399      \
- unit1600 unit1601 unit1602 unit1603 unit1604 unit1605 unit1606
+ unit1600 unit1601 unit1602 unit1603 unit1604 unit1605 unit1606 unit1607
 
 unit1300_SOURCES = unit1300.c $(UNITFILES)
 unit1300_CPPFLAGS = $(AM_CPPFLAGS)
@@ -85,3 +85,6 @@ unit1605_CPPFLAGS = $(AM_CPPFLAGS)
 
 unit1606_SOURCES = unit1606.c $(UNITFILES)
 unit1606_CPPFLAGS = $(AM_CPPFLAGS)
+
+unit1607_SOURCES = unit1607.c $(UNITFILES)
+unit1607_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c
index 266eed392..0d2257bf0 100644
--- a/tests/unit/unit1307.c
+++ b/tests/unit/unit1307.c
@@ -25,7 +25,6 @@
 
 #define MATCH   CURL_FNMATCH_MATCH
 #define NOMATCH CURL_FNMATCH_NOMATCH
-#define RE_ERR  CURL_FNMATCH_FAIL
 
 struct testcase {
   const char *pattern;
@@ -36,8 +35,8 @@ struct testcase {
 static const struct testcase tests[] = {
   /* brackets syntax */
   { "\\[",                      "[",                      MATCH },
-  { "[",                        "[",                      RE_ERR },
-  { "[]",                       "[]",                     RE_ERR },
+  { "[",                        "[",                      MATCH },
+  { "[]",                       "[]",                     MATCH },
   { "[][]",                     "[",                      MATCH },
   { "[][]",                     "]",                      MATCH },
   { "[[]",                      "[",                      MATCH },
@@ -49,6 +48,8 @@ static const struct testcase tests[] = {
   { "[][[[]",                   "[",                      MATCH },
   { "[[]",                      "]",                      NOMATCH },
 
+  { "address@hidden",                     "a",                      MATCH },
+
   { "[a-z]",                    "a",                      MATCH },
   { "[a-z]",                    "A",                      NOMATCH },
   { "?[a-z]",                   "?Z",                     NOMATCH },
@@ -77,6 +78,7 @@ static const struct testcase tests[] = {
   { "[][?*-]",                  "*",                      MATCH },
   { "[][?*-]",                  "-",                      MATCH },
   { "[]?*-]",                   "-",                      MATCH },
+  { "[\xFF]",                   "\xFF",                   MATCH },
   { "?/b/c",                    "a/b/c",                  MATCH },
   { "^_{}~",                    "^_{}~",                  MATCH },
   { "!#%+,-./01234567889",      "!#%+,-./01234567889",    MATCH },
@@ -97,8 +99,10 @@ static const struct testcase tests[] = {
   { "*[^a].t?t",                "a.txt",                  NOMATCH },
   { "*[^a].t?t",                "ba.txt",                 NOMATCH },
   { "*[^a].t?t",                "ab.txt",                 MATCH },
-  { "*[^a]",                    "",                       MATCH },
-  { "[!ÿ]",                     "",                       MATCH },
+  { "*[^a]",                    "",                       NOMATCH },
+  { "[!\xFF]",                  "",                       NOMATCH },
+  { "[!\xFF]",                  "\xFF",                   NOMATCH },
+  { "[!\xFF]",                  "a",                      MATCH },
   { "[!?*[]",                   "?",                      NOMATCH },
   { "[!!]",                     "!",                      NOMATCH },
   { "[!!]",                     "x",                      MATCH },
@@ -130,6 +134,8 @@ static const struct testcase tests[] = {
   { "[^[:blank:]]",             "\t",                     NOMATCH },
   { "[^[:print:]]",             "\10",                    MATCH },
   { "[[:lower:]][[:lower:]]",   "ll",                     MATCH },
+  { "[[:foo:]]",                "bar",                    NOMATCH },
+  { "[[:foo:]]",                "f]",                     MATCH },
 
   { "Curl[[:blank:]];-)",       "Curl ;-)",               MATCH },
   { "*[[:blank:]]*",            " ",                      MATCH },
@@ -167,7 +173,7 @@ static const struct testcase tests[] = {
   { "x",                        "",                       NOMATCH },
 
   /* backslash */
-  { "\\",                       "\\",                     RE_ERR },
+  { "\\",                       "\\",                     MATCH },
   { "\\\\",                     "\\",                     MATCH },
   { "\\\\",                     "\\\\",                   NOMATCH },
   { "\\?",                      "?",                      MATCH },
diff --git a/tests/unit/unit1309.c b/tests/unit/unit1309.c
index c53cbcbce..9a07c9332 100644
--- a/tests/unit/unit1309.c
+++ b/tests/unit/unit1309.c
@@ -22,6 +22,7 @@
 #include "curlcheck.h"
 
 #include "splay.h"
+#include "warnless.h"
 
 
 static CURLcode unit_setup(void)
@@ -86,7 +87,8 @@ UNITTEST_START
     key.tv_usec = (541*i)%1023;
     payload = (size_t) key.tv_usec;
 
-    nodes[i].payload = (void *)payload; /* for simplicity */
+    /* for simplicity */
+    nodes[i].payload = CURLX_INTEGER_TO_POINTER_CAST(payload);
     root = Curl_splayinsert(key, root, &nodes[i]);
   }
 
@@ -98,7 +100,7 @@ UNITTEST_START
     printf("Tree look:\n");
     splayprint(root, 0, 1);
     printf("remove pointer %d, payload %ld\n", rem,
-           (long)(nodes[rem].payload));
+           CURLX_POINTER_TO_INTEGER_CAST(nodes[rem].payload));
     rc = Curl_splayremovebyaddr(root, &nodes[rem], &root);
     if(rc) {
       /* failed! */
@@ -119,7 +121,8 @@ UNITTEST_START
     /* add some nodes with the same key */
     for(j = 0; j <= i % 3; j++) {
       size_t payload = key.tv_usec*10 + j;
-      nodes[i * 3 + j].payload = (void *)payload; /* for simplicity */
+      /* for simplicity */
+      nodes[i * 3 + j].payload = CURLX_INTEGER_TO_POINTER_CAST(payload);
       root = Curl_splayinsert(key, root, &nodes[i * 3 + j]);
     }
   }
@@ -130,8 +133,9 @@ UNITTEST_START
     tv_now.tv_usec = i;
     root = Curl_splaygetbest(tv_now, root, &removed);
     while(removed != NULL) {
-      printf("removed payload %ld[%ld]\n", (long)(removed->payload) / 10,
-             (long)(removed->payload) % 10);
+      printf("removed payload %ld[%ld]\n",
+             CURLX_POINTER_TO_INTEGER_CAST(removed->payload) / 10,
+             CURLX_POINTER_TO_INTEGER_CAST(removed->payload) % 10);
       root = Curl_splaygetbest(tv_now, root, &removed);
     }
   }
diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c
new file mode 100644
index 000000000..71c59939b
--- /dev/null
+++ b/tests/unit/unit1607.c
@@ -0,0 +1,213 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  Project                     ___| | | |  _ \| |
+ *                             / __| | | | |_) | |
+ *                            | (__| |_| |  _ <| |___
+ *                             \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "curlcheck.h"
+
+#include "urldata.h"
+#include "connect.h"
+#include "share.h"
+
+#include "memdebug.h" /* LAST include file */
+
+static struct Curl_easy *easy;
+static struct curl_hash *hostcache;
+
+static void unit_stop(void)
+{
+  curl_easy_cleanup(easy);
+  curl_global_cleanup();
+}
+
+static CURLcode unit_setup(void)
+{
+  int res = CURLE_OK;
+
+  global_init(CURL_GLOBAL_ALL);
+
+  easy = curl_easy_init();
+  if(!easy) {
+    curl_global_cleanup();
+    return CURLE_OUT_OF_MEMORY;
+  }
+
+  hostcache = Curl_global_host_cache_init();
+  if(!hostcache) {
+    unit_stop();
+    return CURLE_OUT_OF_MEMORY;
+  }
+
+  return res;
+}
+
+struct testcase {
+  /* host:port:address[,address]... */
+  const char *optval;
+
+  /* lowercase host and port to retrieve the addresses from hostcache */
+  const char *host;
+  int port;
+
+  /* 0 to 9 addresses expected from hostcache */
+  const char *address[10];
+};
+
+
+/* In builds without IPv6 support CURLOPT_RESOLVE should skip over those
+   addresses, so we have to do that as well. */
+static const char skip = 0;
+#ifdef ENABLE_IPV6
+#define IPV6ONLY(x) x
+#else
+#define IPV6ONLY(x) &skip
+#endif
+
+/* CURLOPT_RESOLVE address parsing tests */
+static const struct testcase tests[] = {
+  /* spaces aren't allowed, for now */
+  { "test.com:80:127.0.0.1, 127.0.0.2",
+    "test.com", 80, { NULL, }
+  },
+  { "TEST.com:80:,,127.0.0.1,,,127.0.0.2,,,,::1,,,",
+    "test.com", 80, { "127.0.0.1", "127.0.0.2", IPV6ONLY("::1"), }
+  },
+  { "test.com:80:::1,127.0.0.1",
+    "test.com", 80, { IPV6ONLY("::1"), "127.0.0.1", }
+  },
+  { "test.com:80:[::1],127.0.0.1",
+    "test.com", 80, { IPV6ONLY("::1"), "127.0.0.1", }
+  },
+  { "test.com:80:::1",
+    "test.com", 80, { IPV6ONLY("::1"), }
+  },
+  { "test.com:80:[::1]",
+    "test.com", 80, { IPV6ONLY("::1"), }
+  },
+  { "test.com:80:127.0.0.1",
+    "test.com", 80, { "127.0.0.1", }
+  },
+  { "test.com:80:,127.0.0.1",
+    "test.com", 80, { "127.0.0.1", }
+  },
+  { "test.com:80:127.0.0.1,",
+    "test.com", 80, { "127.0.0.1", }
+  },
+  { "test.com:0:127.0.0.1",
+    "test.com", 0, { "127.0.0.1", }
+  },
+};
+
+UNITTEST_START
+  int i;
+  int testnum = sizeof(tests) / sizeof(struct testcase);
+
+  for(i = 0; i < testnum; ++i, curl_easy_reset(easy)) {
+    int j;
+    int addressnum = sizeof tests[i].address / sizeof *tests[i].address;
+    struct Curl_addrinfo *addr;
+    struct Curl_dns_entry *dns;
+    struct curl_slist *list;
+    void *entry_id;
+    bool problem = false;
+
+    Curl_hostcache_clean(easy, hostcache);
+    easy->dns.hostcache = hostcache;
+    easy->dns.hostcachetype = HCACHE_GLOBAL;
+
+    list = curl_slist_append(NULL, tests[i].optval);
+    if(!list)
+        goto unit_test_abort;
+    curl_easy_setopt(easy, CURLOPT_RESOLVE, list);
+
+    Curl_loadhostpairs(easy);
+
+    entry_id = (void *)aprintf("%s:%d", tests[i].host, tests[i].port);
+    if(!entry_id) {
+      curl_slist_free_all(list);
+      goto unit_test_abort;
+    }
+    dns = Curl_hash_pick(easy->dns.hostcache, entry_id, strlen(entry_id) + 1);
+    free(entry_id);
+    entry_id = NULL;
+
+    addr = dns ? dns->addr : NULL;
+
+    for(j = 0; j < addressnum; ++j) {
+      long port = 0;
+      char ipaddress[MAX_IPADR_LEN] = {0};
+
+      if(!addr && !tests[i].address[j])
+        break;
+
+      if(tests[i].address[j] == &skip)
+        continue;
+
+      if(addr && !Curl_getaddressinfo(addr->ai_addr,
+                                      ipaddress, &port)) {
+        fprintf(stderr, "%s:%d tests[%d] failed. getaddressinfo failed.\n",
+                __FILE__, __LINE__, i);
+        problem = true;
+        break;
+      }
+
+      if(addr && !tests[i].address[j]) {
+        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                "is %s but tests[%d].address[%d] is NULL.\n",
+                __FILE__, __LINE__, i, ipaddress, i, j);
+        problem = true;
+        break;
+      }
+
+      if(!addr && tests[i].address[j]) {
+        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                "is NULL but tests[%d].address[%d] is %s.\n",
+                __FILE__, __LINE__, i, i, j, tests[i].address[j]);
+        problem = true;
+        break;
+      }
+
+      if(!curl_strequal(ipaddress, tests[i].address[j])) {
+        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved addr "
+                "%s is not equal to tests[%d].address[%d] %s.\n",
+                __FILE__, __LINE__, i, ipaddress, i, j, tests[i].address[j]);
+        problem = true;
+        break;
+      }
+
+      if(port != tests[i].port) {
+        fprintf(stderr, "%s:%d tests[%d] failed. the retrieved port "
+                "for tests[%d].address[%d] is %ld but tests[%d].port is %d.\n",
+                __FILE__, __LINE__, i, i, j, port, i, tests[i].port);
+        problem = true;
+        break;
+      }
+
+      addr = addr->ai_next;
+    }
+
+    Curl_hostcache_clean(easy, easy->dns.hostcache);
+    curl_slist_free_all(list);
+
+    if(problem) {
+      unitfail++;
+      continue;
+    }
+  }
+UNITTEST_STOP
diff --git a/winbuild/Makefile.vc b/winbuild/Makefile.vc
index cec9b14e7..46919fc2d 100644
--- a/winbuild/Makefile.vc
+++ b/winbuild/Makefile.vc
@@ -248,12 +248,12 @@ $(MODE):
        @SET DIROBJ=$(LIBCURL_DIROBJ)
        @SET MACRO_NAME=LIBCURL_OBJS
        @SET OUTFILE=LIBCURL_OBJS.inc
-       @gen_resp_file.bat $(LIBCURL_OBJS)
+       @CALL gen_resp_file.bat $(LIBCURL_OBJS)
 
        @SET DIROBJ=$(CURL_DIROBJ)
        @SET MACRO_NAME=CURL_OBJS
        @SET OUTFILE=CURL_OBJS.inc
-       @gen_resp_file.bat $(CURL_OBJS)
+       @CALL gen_resp_file.bat $(CURL_OBJS)
 
        @SET CONFIG_NAME_LIB=$(CONFIG_NAME_LIB)
        @SET MACHINE=$(MACHINE)
diff --git a/winbuild/MakefileBuild.vc b/winbuild/MakefileBuild.vc
index 32790ff86..28500aeba 100644
--- a/winbuild/MakefileBuild.vc
+++ b/winbuild/MakefileBuild.vc
@@ -45,6 +45,11 @@
 
 CFGSET=FALSE
 WINBUILD_DIR=`cd`
+
+# Utilities.
+# If a path is required that contains characters such as space, quote the path.
+MT         = mt.exe
+RC         = rc.exe
 ZIP        = zip.exe
 
 # Allow changing C compiler via environment variable CC (default cl.exe)
@@ -68,7 +73,7 @@ LNKDLL     = link.exe /DLL
 LNKLIB     = link.exe /lib
 
 CFLAGS_PDB = /Zi
-LFLAGS_PDB = /incremental:no /opt:ref,icf
+LFLAGS_PDB = /incremental:no /opt:ref,icf /DEBUG
 
 CFLAGS_LIBCURL_STATIC  = /DCURL_STATICLIB
 
@@ -176,12 +181,26 @@ CARES          = static
 CARES_CFLAGS   = /DUSE_ARES /I"$(DEVEL_INCLUDE)/cares"
 !ENDIF
 
+# Depending on how zlib is built the libraries have different names, we 
+# try to handle them all. 
 !IF "$(WITH_ZLIB)"=="dll"
+!IF EXISTS("$(DEVEL_LIB)\zlibwapi.lib")
+ZLIB_LIBS = zlibwapi.lib
+!ELSEIF EXISTS("$(DEVEL_LIB)\zdll.lib")
+ZLIB_LIBS   = zdll.lib
+!ELSE
 ZLIB_LIBS   = zlib.lib
+!ENDIF
 USE_ZLIB    = true
 ZLIB        = dll
 !ELSEIF "$(WITH_ZLIB)"=="static"
+!IF EXISTS("$(DEVEL_LIB)\zlibstat.lib")
+ZLIB_LIBS   = zlibstat.lib
+!ELSEIF EXISTS("$(DEVEL_LIB)\zlib.lib")
+ZLIB_LIBS   = zlib.lib
+!ELSE
 ZLIB_LIBS   = zlib_a.lib
+!ENDIF
 USE_ZLIB    = true
 ZLIB        = static
 !ENDIF
@@ -267,7 +286,7 @@ GEN_PDB = true
 
 
 !IFDEF EMBED_MANIFEST
-MANIFESTTOOL = mt -manifest $(DIRDIST)\bin\$(PROGRAM_NAME).manifest 
-outputresource:$(DIRDIST)\bin\$(PROGRAM_NAME);1
+MANIFESTTOOL = $(MT) -manifest $(DIRDIST)\bin\$(PROGRAM_NAME).manifest 
-outputresource:$(DIRDIST)\bin\$(PROGRAM_NAME);1
 !ENDIF
 
 # Runtime library configuration
@@ -496,7 +515,7 @@ $(CURL_DIROBJ):
        $(CURL_CC) $(CFLAGS) /Fo"$@"  $<
 
 $(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc
-       rc $(RC_FLAGS)
+       $(RC) $(RC_FLAGS)
 
 #
 # curl.exe
@@ -520,7 +539,8 @@ CURL_LIBCURL_LIBNAME=$(LIB_NAME_IMP)
 CURL_FROM_LIBCURL=$(CURL_DIROBJ)\tool_hugehelp.obj \
  $(CURL_DIROBJ)\nonblock.obj \
  $(CURL_DIROBJ)\strtoofft.obj \
- $(CURL_DIROBJ)\warnless.obj
+ $(CURL_DIROBJ)\warnless.obj \
+ $(CURL_DIROBJ)\curl_ctype.obj
  
 $(PROGRAM_NAME): $(CURL_DIROBJ) $(CURL_FROM_LIBCURL) $(EXE_OBJS)
        $(CURL_LINK) $(CURL_LFLAGS) $(CURL_LIBCURL_LIBNAME) $(WIN_LIBS) 
$(CURL_FROM_LIBCURL) $(EXE_OBJS)
@@ -537,6 +557,8 @@ $(CURL_DIROBJ)\strtoofft.obj: ../lib/strtoofft.c
        $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/strtoofft.c
 $(CURL_DIROBJ)\warnless.obj: ../lib/warnless.c
        $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/warnless.c
+$(CURL_DIROBJ)\curl_ctype.obj: ../lib/curl_ctype.c
+       $(CURL_CC) $(CURL_CFLAGS) /Fo"$@" ../lib/curl_ctype.c
 $(CURL_DIROBJ)\curl.res: $(CURL_SRC_DIR)\curl.rc
        rc $(CURL_RC_FLAGS)
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]