aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-02-10 16:45:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:12 +0300
commit49116032d905455a7b1c994e4a696afc885c1e71 (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/curl
parent4e839db24a3bbc9f1c610c43d6faaaa99824dcca (diff)
downloadydb-49116032d905455a7b1c994e4a696afc885c1e71.tar.gz
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/curl')
-rw-r--r--contrib/libs/curl/CHANGES10140
-rw-r--r--contrib/libs/curl/COPYING2
-rw-r--r--contrib/libs/curl/README14
-rw-r--r--contrib/libs/curl/RELEASE-NOTES456
-rw-r--r--contrib/libs/curl/include/curl/curl.h1040
-rw-r--r--contrib/libs/curl/include/curl/curlver.h16
-rw-r--r--contrib/libs/curl/include/curl/easy.h26
-rw-r--r--contrib/libs/curl/include/curl/mprintf.h4
-rw-r--r--contrib/libs/curl/include/curl/multi.h80
-rw-r--r--contrib/libs/curl/include/curl/options.h136
-rw-r--r--contrib/libs/curl/include/curl/stdcheaders.h4
-rw-r--r--contrib/libs/curl/include/curl/system.h42
-rw-r--r--contrib/libs/curl/include/curl/typecheck-gcc.h22
-rw-r--r--contrib/libs/curl/include/curl/urlapi.h8
-rw-r--r--contrib/libs/curl/lib/altsvc.c364
-rw-r--r--contrib/libs/curl/lib/altsvc.h24
-rw-r--r--contrib/libs/curl/lib/amigaos.c4
-rw-r--r--contrib/libs/curl/lib/amigaos.h4
-rw-r--r--contrib/libs/curl/lib/arpa_telnet.h4
-rw-r--r--contrib/libs/curl/lib/asyn-ares.c100
-rw-r--r--contrib/libs/curl/lib/asyn-thread.c114
-rw-r--r--contrib/libs/curl/lib/asyn.h12
-rw-r--r--contrib/libs/curl/lib/base64.c10
-rw-r--r--contrib/libs/curl/lib/config-amigaos.h6
-rw-r--r--contrib/libs/curl/lib/config-dos.h4
-rw-r--r--contrib/libs/curl/lib/config-mac.h4
-rw-r--r--contrib/libs/curl/lib/config-os400.h4
-rw-r--r--contrib/libs/curl/lib/config-plan9.h6
-rw-r--r--contrib/libs/curl/lib/config-riscos.h4
-rw-r--r--contrib/libs/curl/lib/config-tpf.h6
-rw-r--r--contrib/libs/curl/lib/config-vxworks.h4
-rw-r--r--contrib/libs/curl/lib/config-win32.h44
-rw-r--r--contrib/libs/curl/lib/config-win32ce.h4
-rw-r--r--contrib/libs/curl/lib/conncache.c154
-rw-r--r--contrib/libs/curl/lib/conncache.h54
-rw-r--r--contrib/libs/curl/lib/connect.c544
-rw-r--r--contrib/libs/curl/lib/connect.h10
-rw-r--r--contrib/libs/curl/lib/content_encoding.c326
-rw-r--r--contrib/libs/curl/lib/content_encoding.h28
-rw-r--r--contrib/libs/curl/lib/cookie.c140
-rw-r--r--contrib/libs/curl/lib/cookie.h6
-rw-r--r--contrib/libs/curl/lib/curl_addrinfo.c76
-rw-r--r--contrib/libs/curl/lib/curl_addrinfo.h20
-rw-r--r--contrib/libs/curl/lib/curl_base64.h4
-rw-r--r--contrib/libs/curl/lib/curl_config-android.h4
-rw-r--r--contrib/libs/curl/lib/curl_config-linux.h120
-rw-r--r--contrib/libs/curl/lib/curl_config.h80
-rw-r--r--contrib/libs/curl/lib/curl_ctype.c4
-rw-r--r--contrib/libs/curl/lib/curl_ctype.h4
-rw-r--r--contrib/libs/curl/lib/curl_des.c4
-rw-r--r--contrib/libs/curl/lib/curl_des.h4
-rw-r--r--contrib/libs/curl/lib/curl_endian.c6
-rw-r--r--contrib/libs/curl/lib/curl_endian.h4
-rw-r--r--contrib/libs/curl/lib/curl_fnmatch.c4
-rw-r--r--contrib/libs/curl/lib/curl_fnmatch.h4
-rw-r--r--contrib/libs/curl/lib/curl_get_line.c14
-rw-r--r--contrib/libs/curl/lib/curl_get_line.h4
-rw-r--r--contrib/libs/curl/lib/curl_gethostname.c6
-rw-r--r--contrib/libs/curl/lib/curl_gethostname.h6
-rw-r--r--contrib/libs/curl/lib/curl_gssapi.c4
-rw-r--r--contrib/libs/curl/lib/curl_gssapi.h4
-rw-r--r--contrib/libs/curl/lib/curl_hmac.h42
-rw-r--r--contrib/libs/curl/lib/curl_krb5.h102
-rw-r--r--contrib/libs/curl/lib/curl_ldap.h4
-rw-r--r--contrib/libs/curl/lib/curl_md4.h8
-rw-r--r--contrib/libs/curl/lib/curl_md5.h28
-rw-r--r--contrib/libs/curl/lib/curl_memory.h4
-rw-r--r--contrib/libs/curl/lib/curl_memrchr.c4
-rw-r--r--contrib/libs/curl/lib/curl_memrchr.h4
-rw-r--r--contrib/libs/curl/lib/curl_multibyte.c170
-rw-r--r--contrib/libs/curl/lib/curl_multibyte.h56
-rw-r--r--contrib/libs/curl/lib/curl_ntlm_core.c50
-rw-r--r--contrib/libs/curl/lib/curl_ntlm_core.h24
-rw-r--r--contrib/libs/curl/lib/curl_ntlm_wb.c172
-rw-r--r--contrib/libs/curl/lib/curl_ntlm_wb.h4
-rw-r--r--contrib/libs/curl/lib/curl_path.c10
-rw-r--r--contrib/libs/curl/lib/curl_path.h4
-rw-r--r--contrib/libs/curl/lib/curl_printf.h4
-rw-r--r--contrib/libs/curl/lib/curl_range.c4
-rw-r--r--contrib/libs/curl/lib/curl_range.h4
-rw-r--r--contrib/libs/curl/lib/curl_rtmp.c16
-rw-r--r--contrib/libs/curl/lib/curl_rtmp.h4
-rw-r--r--contrib/libs/curl/lib/curl_sasl.c48
-rw-r--r--contrib/libs/curl/lib/curl_sasl.h4
-rw-r--r--contrib/libs/curl/lib/curl_setup.h110
-rw-r--r--contrib/libs/curl/lib/curl_setup_once.h14
-rw-r--r--contrib/libs/curl/lib/curl_sha256.h14
-rw-r--r--contrib/libs/curl/lib/curl_sspi.c22
-rw-r--r--contrib/libs/curl/lib/curl_sspi.h4
-rw-r--r--contrib/libs/curl/lib/curl_threads.c10
-rw-r--r--contrib/libs/curl/lib/curl_threads.h4
-rw-r--r--contrib/libs/curl/lib/curlx.h30
-rw-r--r--contrib/libs/curl/lib/dict.c152
-rw-r--r--contrib/libs/curl/lib/dict.h4
-rw-r--r--contrib/libs/curl/lib/doh.c422
-rw-r--r--contrib/libs/curl/lib/doh.h30
-rw-r--r--contrib/libs/curl/lib/dotdot.c12
-rw-r--r--contrib/libs/curl/lib/dotdot.h4
-rw-r--r--contrib/libs/curl/lib/dynbuf.c510
-rw-r--r--contrib/libs/curl/lib/dynbuf.h176
-rw-r--r--contrib/libs/curl/lib/easy.c340
-rw-r--r--contrib/libs/curl/lib/easygetopt.c192
-rw-r--r--contrib/libs/curl/lib/easyif.h4
-rw-r--r--contrib/libs/curl/lib/easyoptions.c706
-rw-r--r--contrib/libs/curl/lib/easyoptions.h70
-rw-r--r--contrib/libs/curl/lib/escape.c82
-rw-r--r--contrib/libs/curl/lib/escape.h20
-rw-r--r--contrib/libs/curl/lib/file.c24
-rw-r--r--contrib/libs/curl/lib/file.h4
-rw-r--r--contrib/libs/curl/lib/fileinfo.c4
-rw-r--r--contrib/libs/curl/lib/fileinfo.h6
-rw-r--r--contrib/libs/curl/lib/formdata.c32
-rw-r--r--contrib/libs/curl/lib/formdata.h8
-rw-r--r--contrib/libs/curl/lib/ftp.c1112
-rw-r--r--contrib/libs/curl/lib/ftp.h8
-rw-r--r--contrib/libs/curl/lib/ftplistparser.c10
-rw-r--r--contrib/libs/curl/lib/ftplistparser.h4
-rw-r--r--contrib/libs/curl/lib/getenv.c72
-rw-r--r--contrib/libs/curl/lib/getinfo.c228
-rw-r--r--contrib/libs/curl/lib/getinfo.h4
-rw-r--r--contrib/libs/curl/lib/gopher.c44
-rw-r--r--contrib/libs/curl/lib/gopher.h4
-rw-r--r--contrib/libs/curl/lib/hash.c84
-rw-r--r--contrib/libs/curl/lib/hash.h50
-rw-r--r--contrib/libs/curl/lib/hmac.c92
-rw-r--r--contrib/libs/curl/lib/hostasyn.c12
-rw-r--r--contrib/libs/curl/lib/hostcheck.c4
-rw-r--r--contrib/libs/curl/lib/hostcheck.h4
-rw-r--r--contrib/libs/curl/lib/hostip.c232
-rw-r--r--contrib/libs/curl/lib/hostip.h68
-rw-r--r--contrib/libs/curl/lib/hostip4.c298
-rw-r--r--contrib/libs/curl/lib/hostip6.c52
-rw-r--r--contrib/libs/curl/lib/hostsyn.c4
-rw-r--r--contrib/libs/curl/lib/hsts.c1044
-rw-r--r--contrib/libs/curl/lib/hsts.h130
-rw-r--r--contrib/libs/curl/lib/http.c870
-rw-r--r--contrib/libs/curl/lib/http.h38
-rw-r--r--contrib/libs/curl/lib/http2.c602
-rw-r--r--contrib/libs/curl/lib/http2.h12
-rw-r--r--contrib/libs/curl/lib/http_chunks.c70
-rw-r--r--contrib/libs/curl/lib/http_chunks.h24
-rw-r--r--contrib/libs/curl/lib/http_digest.c16
-rw-r--r--contrib/libs/curl/lib/http_digest.h4
-rw-r--r--contrib/libs/curl/lib/http_negotiate.c26
-rw-r--r--contrib/libs/curl/lib/http_negotiate.h10
-rw-r--r--contrib/libs/curl/lib/http_ntlm.c24
-rw-r--r--contrib/libs/curl/lib/http_ntlm.h10
-rw-r--r--contrib/libs/curl/lib/http_proxy.c198
-rw-r--r--contrib/libs/curl/lib/http_proxy.h6
-rw-r--r--contrib/libs/curl/lib/idn_win32.c12
-rw-r--r--contrib/libs/curl/lib/if2ip.c30
-rw-r--r--contrib/libs/curl/lib/if2ip.h4
-rw-r--r--contrib/libs/curl/lib/imap.c92
-rw-r--r--contrib/libs/curl/lib/imap.h8
-rw-r--r--contrib/libs/curl/lib/inet_ntop.c2
-rw-r--r--contrib/libs/curl/lib/inet_ntop.h4
-rw-r--r--contrib/libs/curl/lib/inet_pton.c4
-rw-r--r--contrib/libs/curl/lib/inet_pton.h4
-rw-r--r--contrib/libs/curl/lib/krb5.c1162
-rw-r--r--contrib/libs/curl/lib/ldap.c126
-rw-r--r--contrib/libs/curl/lib/llist.c16
-rw-r--r--contrib/libs/curl/lib/llist.h32
-rw-r--r--contrib/libs/curl/lib/md4.c96
-rw-r--r--contrib/libs/curl/lib/md5.c156
-rw-r--r--contrib/libs/curl/lib/memdebug.c26
-rw-r--r--contrib/libs/curl/lib/memdebug.h12
-rw-r--r--contrib/libs/curl/lib/mime.c458
-rw-r--r--contrib/libs/curl/lib/mime.h64
-rw-r--r--contrib/libs/curl/lib/mprintf.c134
-rw-r--r--contrib/libs/curl/lib/mqtt.c1248
-rw-r--r--contrib/libs/curl/lib/mqtt.h118
-rw-r--r--contrib/libs/curl/lib/multi.c698
-rw-r--r--contrib/libs/curl/lib/multihandle.h54
-rw-r--r--contrib/libs/curl/lib/multiif.h16
-rw-r--r--contrib/libs/curl/lib/netrc.c6
-rw-r--r--contrib/libs/curl/lib/netrc.h4
-rw-r--r--contrib/libs/curl/lib/non-ascii.c4
-rw-r--r--contrib/libs/curl/lib/non-ascii.h4
-rw-r--r--contrib/libs/curl/lib/nonblock.c4
-rw-r--r--contrib/libs/curl/lib/nonblock.h4
-rw-r--r--contrib/libs/curl/lib/openldap.c26
-rw-r--r--contrib/libs/curl/lib/parsedate.c94
-rw-r--r--contrib/libs/curl/lib/parsedate.h16
-rw-r--r--contrib/libs/curl/lib/pingpong.c76
-rw-r--r--contrib/libs/curl/lib/pingpong.h18
-rw-r--r--contrib/libs/curl/lib/pop3.c34
-rw-r--r--contrib/libs/curl/lib/pop3.h4
-rw-r--r--contrib/libs/curl/lib/progress.c48
-rw-r--r--contrib/libs/curl/lib/progress.h6
-rw-r--r--contrib/libs/curl/lib/psl.c4
-rw-r--r--contrib/libs/curl/lib/psl.h4
-rw-r--r--contrib/libs/curl/lib/quic.h18
-rw-r--r--contrib/libs/curl/lib/rand.c4
-rw-r--r--contrib/libs/curl/lib/rand.h4
-rw-r--r--contrib/libs/curl/lib/rename.c142
-rw-r--r--contrib/libs/curl/lib/rename.h54
-rw-r--r--contrib/libs/curl/lib/rtsp.c188
-rw-r--r--contrib/libs/curl/lib/rtsp.h4
-rw-r--r--contrib/libs/curl/lib/select.c394
-rw-r--r--contrib/libs/curl/lib/select.h56
-rw-r--r--contrib/libs/curl/lib/sendf.c178
-rw-r--r--contrib/libs/curl/lib/sendf.h4
-rw-r--r--contrib/libs/curl/lib/setopt.c648
-rw-r--r--contrib/libs/curl/lib/setopt.h8
-rw-r--r--contrib/libs/curl/lib/setup-os400.h18
-rw-r--r--contrib/libs/curl/lib/setup-vms.h10
-rw-r--r--contrib/libs/curl/lib/setup-win32.h244
-rw-r--r--contrib/libs/curl/lib/sha256.c508
-rw-r--r--contrib/libs/curl/lib/share.c14
-rw-r--r--contrib/libs/curl/lib/share.h8
-rw-r--r--contrib/libs/curl/lib/sigpipe.h4
-rw-r--r--contrib/libs/curl/lib/slist.c4
-rw-r--r--contrib/libs/curl/lib/slist.h4
-rw-r--r--contrib/libs/curl/lib/smb.c40
-rw-r--r--contrib/libs/curl/lib/smb.h10
-rw-r--r--contrib/libs/curl/lib/smtp.c614
-rw-r--r--contrib/libs/curl/lib/smtp.h14
-rw-r--r--contrib/libs/curl/lib/sockaddr.h4
-rw-r--r--contrib/libs/curl/lib/socketpair.c242
-rw-r--r--contrib/libs/curl/lib/socketpair.h72
-rw-r--r--contrib/libs/curl/lib/socks.c1558
-rw-r--r--contrib/libs/curl/lib/socks.h40
-rw-r--r--contrib/libs/curl/lib/socks_gssapi.c24
-rw-r--r--contrib/libs/curl/lib/socks_sspi.c16
-rw-r--r--contrib/libs/curl/lib/speedcheck.c4
-rw-r--r--contrib/libs/curl/lib/speedcheck.h4
-rw-r--r--contrib/libs/curl/lib/splay.c10
-rw-r--r--contrib/libs/curl/lib/splay.h10
-rw-r--r--contrib/libs/curl/lib/strcase.c176
-rw-r--r--contrib/libs/curl/lib/strcase.h6
-rw-r--r--contrib/libs/curl/lib/strdup.c10
-rw-r--r--contrib/libs/curl/lib/strdup.h4
-rw-r--r--contrib/libs/curl/lib/strerror.c494
-rw-r--r--contrib/libs/curl/lib/strerror.h12
-rw-r--r--contrib/libs/curl/lib/strtok.c6
-rw-r--r--contrib/libs/curl/lib/strtok.h4
-rw-r--r--contrib/libs/curl/lib/strtoofft.c4
-rw-r--r--contrib/libs/curl/lib/strtoofft.h4
-rw-r--r--contrib/libs/curl/lib/system_win32.c18
-rw-r--r--contrib/libs/curl/lib/system_win32.h4
-rw-r--r--contrib/libs/curl/lib/telnet.c60
-rw-r--r--contrib/libs/curl/lib/telnet.h4
-rw-r--r--contrib/libs/curl/lib/tftp.c80
-rw-r--r--contrib/libs/curl/lib/tftp.h4
-rw-r--r--contrib/libs/curl/lib/timeval.c6
-rw-r--r--contrib/libs/curl/lib/timeval.h4
-rw-r--r--contrib/libs/curl/lib/transfer.c244
-rw-r--r--contrib/libs/curl/lib/transfer.h4
-rw-r--r--contrib/libs/curl/lib/url.c946
-rw-r--r--contrib/libs/curl/lib/url.h28
-rw-r--r--contrib/libs/curl/lib/urlapi-int.h6
-rw-r--r--contrib/libs/curl/lib/urlapi.c314
-rw-r--r--contrib/libs/curl/lib/urldata.h832
-rw-r--r--contrib/libs/curl/lib/vauth/cleartext.c8
-rw-r--r--contrib/libs/curl/lib/vauth/cram.c6
-rw-r--r--contrib/libs/curl/lib/vauth/digest.c70
-rw-r--r--contrib/libs/curl/lib/vauth/digest.h4
-rw-r--r--contrib/libs/curl/lib/vauth/digest_sspi.c26
-rw-r--r--contrib/libs/curl/lib/vauth/krb5_gssapi.c4
-rw-r--r--contrib/libs/curl/lib/vauth/krb5_sspi.c14
-rw-r--r--contrib/libs/curl/lib/vauth/ntlm.c26
-rw-r--r--contrib/libs/curl/lib/vauth/ntlm.h4
-rw-r--r--contrib/libs/curl/lib/vauth/ntlm_sspi.c12
-rw-r--r--contrib/libs/curl/lib/vauth/oauth2.c4
-rw-r--r--contrib/libs/curl/lib/vauth/spnego_gssapi.c4
-rw-r--r--contrib/libs/curl/lib/vauth/spnego_sspi.c12
-rw-r--r--contrib/libs/curl/lib/vauth/vauth.c8
-rw-r--r--contrib/libs/curl/lib/vauth/vauth.h6
-rw-r--r--contrib/libs/curl/lib/version.c368
-rw-r--r--contrib/libs/curl/lib/version_win32.c452
-rw-r--r--contrib/libs/curl/lib/version_win32.h106
-rw-r--r--contrib/libs/curl/lib/vquic/ngtcp2.c1198
-rw-r--r--contrib/libs/curl/lib/vquic/quiche.c256
-rw-r--r--contrib/libs/curl/lib/vquic/vquic.c170
-rw-r--r--contrib/libs/curl/lib/vssh/libssh.c448
-rw-r--r--contrib/libs/curl/lib/vssh/libssh2.c1038
-rw-r--r--contrib/libs/curl/lib/vssh/ssh.h540
-rw-r--r--contrib/libs/curl/lib/vssh/wolfssh.c2312
-rw-r--r--contrib/libs/curl/lib/vtls/bearssl.c1754
-rw-r--r--contrib/libs/curl/lib/vtls/bearssl.h64
-rw-r--r--contrib/libs/curl/lib/vtls/gskit.c28
-rw-r--r--contrib/libs/curl/lib/vtls/gskit.h4
-rw-r--r--contrib/libs/curl/lib/vtls/gtls.c422
-rw-r--r--contrib/libs/curl/lib/vtls/gtls.h4
-rw-r--r--contrib/libs/curl/lib/vtls/keylog.c312
-rw-r--r--contrib/libs/curl/lib/vtls/keylog.h112
-rw-r--r--contrib/libs/curl/lib/vtls/mbedtls.c222
-rw-r--r--contrib/libs/curl/lib/vtls/mbedtls.h4
-rw-r--r--contrib/libs/curl/lib/vtls/mbedtls_threadlock.c288
-rw-r--r--contrib/libs/curl/lib/vtls/mesalink.c30
-rw-r--r--contrib/libs/curl/lib/vtls/mesalink.h6
-rw-r--r--contrib/libs/curl/lib/vtls/nss.c216
-rw-r--r--contrib/libs/curl/lib/vtls/nssg.h4
-rw-r--r--contrib/libs/curl/lib/vtls/openssl.c1694
-rw-r--r--contrib/libs/curl/lib/vtls/openssl.h4
-rw-r--r--contrib/libs/curl/lib/vtls/schannel.c758
-rw-r--r--contrib/libs/curl/lib/vtls/schannel.h12
-rw-r--r--contrib/libs/curl/lib/vtls/schannel_verify.c340
-rw-r--r--contrib/libs/curl/lib/vtls/sectransp.c340
-rw-r--r--contrib/libs/curl/lib/vtls/sectransp.h4
-rw-r--r--contrib/libs/curl/lib/vtls/vtls.c254
-rw-r--r--contrib/libs/curl/lib/vtls/vtls.h74
-rw-r--r--contrib/libs/curl/lib/vtls/wolfssl.c490
-rw-r--r--contrib/libs/curl/lib/vtls/wolfssl.h4
-rw-r--r--contrib/libs/curl/lib/warnless.c4
-rw-r--r--contrib/libs/curl/lib/warnless.h4
-rw-r--r--contrib/libs/curl/lib/wildcard.c4
-rw-r--r--contrib/libs/curl/lib/wildcard.h14
-rw-r--r--contrib/libs/curl/lib/x509asn1.c76
-rw-r--r--contrib/libs/curl/lib/x509asn1.h72
-rw-r--r--contrib/libs/curl/ya.make62
311 files changed, 25880 insertions, 25880 deletions
diff --git a/contrib/libs/curl/CHANGES b/contrib/libs/curl/CHANGES
index 72697aabbb..56859b4993 100644
--- a/contrib/libs/curl/CHANGES
+++ b/contrib/libs/curl/CHANGES
@@ -6,7435 +6,7435 @@
Changelog
-Version 7.74.0 (9 Dec 2020)
-
-Daniel Stenberg (9 Dec 2020)
-- RELEASE-NOTES: synced
-
- for 7.74.0
-
-Jay Satiro (7 Dec 2020)
-- [Jacob Hoffman-Andrews brought this change]
-
- urldata: restore comment on ssl_connect_data.use
-
- This comment was originally on the `use` field, but was separated from
- its field in 62a2534.
-
- Closes https://github.com/curl/curl/pull/6287
-
-Daniel Stenberg (7 Dec 2020)
-- VERSIONS: refreshed
-
- We always use the patch number these days: all releases are
- "major.minor.patch"
-
-- [Jakub Zakrzewski brought this change]
-
- cmake: don't use reserved target name 'test'
-
- CMake up to 3.10 always reserves this name
-
- Fixes #6257
- Closes #6258
-
-- openssl: make the OCSP verification verify the certificate id
-
- CVE-2020-8286
-
- Reported by anonymous
-
- Bug: https://curl.se/docs/CVE-2020-8286.html
-
-- ftp: make wc_statemach loop instead of recurse
-
- CVE-2020-8285
-
- Fixes #6255
- Bug: https://curl.se/docs/CVE-2020-8285.html
- Reported-by: xnynx on github
-
-- ftp: CURLOPT_FTP_SKIP_PASV_IP by default
-
- The command line tool also independently sets --ftp-skip-pasv-ip by
- default.
-
- Ten test cases updated to adapt the modified --libcurl output.
-
- Bug: https://curl.se/docs/CVE-2020-8284.html
- CVE-2020-8284
-
- Reported-by: Varnavas Papaioannou
-
-- urlapi: don't accept blank port number field without scheme
-
- ... as it makes the URL parser accept "very-long-hostname://" as a valid
- host name and we don't want that. The parser now only accepts a blank
- (no digits) after the colon if the URL starts with a scheme.
-
- Reported-by: d4d on hackerone
-
- Closes #6283
+Version 7.74.0 (9 Dec 2020)
-- Revert "multi: implement wait using winsock events"
-
- This reverts commit d2a7d7c185f98df8f3e585e5620cbc0482e45fac.
-
- This commit also reverts the subsequent follow-ups to that commit, which
- were all done within windows #ifdefs that are removed in this
- change. Marc helped me verify this.
-
- Fixes #6146
- Closes #6281
+Daniel Stenberg (9 Dec 2020)
+- RELEASE-NOTES: synced
+
+ for 7.74.0
+
+Jay Satiro (7 Dec 2020)
+- [Jacob Hoffman-Andrews brought this change]
+
+ urldata: restore comment on ssl_connect_data.use
+
+ This comment was originally on the `use` field, but was separated from
+ its field in 62a2534.
+
+ Closes https://github.com/curl/curl/pull/6287
-- [Klaus Crusius brought this change]
-
- ftp: retry getpeername for FTP with TCP_FASTOPEN
+Daniel Stenberg (7 Dec 2020)
+- VERSIONS: refreshed
- In the case of TFO, the remote host name is not resolved at the
- connetion time.
-
- For FTP that has lead to missing hostname for the secondary connection.
- Therefore the name resolution is done at the time, when FTP requires it.
-
- Fixes #6252
- Closes #6265
- Closes #6282
+ We always use the patch number these days: all releases are
+ "major.minor.patch"
-- [Thomas Danielsson brought this change]
+- [Jakub Zakrzewski brought this change]
- scripts/completion.pl: parse all opts
+ cmake: don't use reserved target name 'test'
- For tab-completion it may be preferable to include all the
- available options.
+ CMake up to 3.10 always reserves this name
- Closes #6280
+ Fixes #6257
+ Closes #6258
-- RELEASE-NOTES: synced
-
-- openssl: use OPENSSL_init_ssl() with >= 1.1.0
+- openssl: make the OCSP verification verify the certificate id
+
+ CVE-2020-8286
+
+ Reported by anonymous
- Reported-by: Kovalkov Dmitrii and Per Nilsson
- Fixes #6254
- Fixes #6256
- Closes #6260
+ Bug: https://curl.se/docs/CVE-2020-8286.html
-- SECURITY-PROCESS: disclose on hackerone
+- ftp: make wc_statemach loop instead of recurse
- Once a vulnerability has been published, the hackerone issue should be
- disclosed. For tranparency.
+ CVE-2020-8285
- Closes #6275
+ Fixes #6255
+ Bug: https://curl.se/docs/CVE-2020-8285.html
+ Reported-by: xnynx on github
-Marc Hoersken (3 Dec 2020)
-- tests/util.py: fix compatibility with Python 2
+- ftp: CURLOPT_FTP_SKIP_PASV_IP by default
+
+ The command line tool also independently sets --ftp-skip-pasv-ip by
+ default.
+
+ Ten test cases updated to adapt the modified --libcurl output.
- Backporting the Python 3 implementation of setStream
- to ClosingFileHandler as a fallback within Python 2.
+ Bug: https://curl.se/docs/CVE-2020-8284.html
+ CVE-2020-8284
- Reported-by: Jay Satiro
-
- Fixes #6259
- Closes #6270
+ Reported-by: Varnavas Papaioannou
-Daniel Gustafsson (3 Dec 2020)
-- docs: fix typos and markup in ETag manpage sections
-
- Reported-by: emanruse on github
- Fixes #6273
+- urlapi: don't accept blank port number field without scheme
+
+ ... as it makes the URL parser accept "very-long-hostname://" as a valid
+ host name and we don't want that. The parser now only accepts a blank
+ (no digits) after the colon if the URL starts with a scheme.
+
+ Reported-by: d4d on hackerone
+
+ Closes #6283
-Daniel Stenberg (2 Dec 2020)
-- quiche: close the connection
-
- Reported-by: Junho Choi
- Fixes #6213
- Closes #6217
+- Revert "multi: implement wait using winsock events"
+
+ This reverts commit d2a7d7c185f98df8f3e585e5620cbc0482e45fac.
+
+ This commit also reverts the subsequent follow-ups to that commit, which
+ were all done within windows #ifdefs that are removed in this
+ change. Marc helped me verify this.
+
+ Fixes #6146
+ Closes #6281
+
+- [Klaus Crusius brought this change]
-Jay Satiro (2 Dec 2020)
-- ngtcp2: Fix build error due to symbol name change
+ ftp: retry getpeername for FTP with TCP_FASTOPEN
- - NGTCP2_CRYPTO_LEVEL_APP -> NGTCP2_CRYPTO_LEVEL_APPLICATION
+ In the case of TFO, the remote host name is not resolved at the
+ connetion time.
- ngtcp2/ngtcp2@76232e9 changed the name.
+ For FTP that has lead to missing hostname for the secondary connection.
+ Therefore the name resolution is done at the time, when FTP requires it.
- ngtcp2 master is required to build curl with http3 support.
-
- Closes https://github.com/curl/curl/pull/6271
+ Fixes #6252
+ Closes #6265
+ Closes #6282
-Daniel Stenberg (1 Dec 2020)
-- [Klaus Crusius brought this change]
-
- cmake: check for linux/tcp.h
+- [Thomas Danielsson brought this change]
+
+ scripts/completion.pl: parse all opts
- The HAVE_LINUX_TCP_H define was not set by cmake.
+ For tab-completion it may be preferable to include all the
+ available options.
- Closes #6252
+ Closes #6280
+
+- RELEASE-NOTES: synced
-- NEW-PROTOCOL: document what needs to be done to add one
+- openssl: use OPENSSL_init_ssl() with >= 1.1.0
- Closes #6263
+ Reported-by: Kovalkov Dmitrii and Per Nilsson
+ Fixes #6254
+ Fixes #6256
+ Closes #6260
-- splay: rename Curl_splayremovebyaddr to Curl_splayremove
+- SECURITY-PROCESS: disclose on hackerone
+
+ Once a vulnerability has been published, the hackerone issue should be
+ disclosed. For tranparency.
- ... and remove the old unused proto for the old Curl_splayremove
- version.
+ Closes #6275
+
+Marc Hoersken (3 Dec 2020)
+- tests/util.py: fix compatibility with Python 2
- Closes #6269
-
-- openssl: free mem_buf in error path
+ Backporting the Python 3 implementation of setStream
+ to ClosingFileHandler as a fallback within Python 2.
- To fix a memory-leak.
+ Reported-by: Jay Satiro
- Closes #6267
+ Fixes #6259
+ Closes #6270
-- openssl: remove #if 0 leftover
+Daniel Gustafsson (3 Dec 2020)
+- docs: fix typos and markup in ETag manpage sections
- Follow-up to 4c9768565ec3a9 (from Sep 2008)
+ Reported-by: emanruse on github
+ Fixes #6273
+
+Daniel Stenberg (2 Dec 2020)
+- quiche: close the connection
- Closes #6268
+ Reported-by: Junho Choi
+ Fixes #6213
+ Closes #6217
-- ntlm: avoid malloc(0) on zero length user and domain
+Jay Satiro (2 Dec 2020)
+- ngtcp2: Fix build error due to symbol name change
+
+ - NGTCP2_CRYPTO_LEVEL_APP -> NGTCP2_CRYPTO_LEVEL_APPLICATION
- ... and simplify the too-long checks somewhat.
-
- Detected by OSS-Fuzz
-
- Closes #6264
+ ngtcp2/ngtcp2@76232e9 changed the name.
+
+ ngtcp2 master is required to build curl with http3 support.
+
+ Closes https://github.com/curl/curl/pull/6271
-- RELEASE-NOTES: synced
+Daniel Stenberg (1 Dec 2020)
+- [Klaus Crusius brought this change]
-Marc Hoersken (28 Nov 2020)
-- tests/server/tftpd.c: close upload file in case of abort
+ cmake: check for linux/tcp.h
- Commit c353207 removed the closing right after do_tftp
- which covered the case of abort. This handles that case.
+ The HAVE_LINUX_TCP_H define was not set by cmake.
- Reviewed-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
+ Closes #6252
+
+- NEW-PROTOCOL: document what needs to be done to add one
- Follow up to #6209
- Closes #6234
+ Closes #6263
-Daniel Stenberg (26 Nov 2020)
-- [Daiki Ueno brought this change]
+- splay: rename Curl_splayremovebyaddr to Curl_splayremove
+
+ ... and remove the old unused proto for the old Curl_splayremove
+ version.
+
+ Closes #6269
- ngtcp2: use the minimal version of QUIC supported by ngtcp2
-
- Closes #6250
+- openssl: free mem_buf in error path
+
+ To fix a memory-leak.
+
+ Closes #6267
-- [Daiki Ueno brought this change]
+- openssl: remove #if 0 leftover
+
+ Follow-up to 4c9768565ec3a9 (from Sep 2008)
+
+ Closes #6268
- ngtcp2: advertise h3 ALPN unconditionally
-
- Closes #6250
+- ntlm: avoid malloc(0) on zero length user and domain
+
+ ... and simplify the too-long checks somewhat.
+
+ Detected by OSS-Fuzz
+
+ Closes #6264
-- [Daiki Ueno brought this change]
+- RELEASE-NOTES: synced
- vquic/ngtcp2.h: define local_addr as sockaddr_storage
+Marc Hoersken (28 Nov 2020)
+- tests/server/tftpd.c: close upload file in case of abort
+
+ Commit c353207 removed the closing right after do_tftp
+ which covered the case of abort. This handles that case.
- This field needs to be wide enough to hold sockaddr_in6 when
- connecting via IPv6. Otherwise, ngtcp2_conn_read_pkt will drop the
- packets because of the address mismatch:
- I00000022 [...] con ignore packet from unknown path
-
- We can safely assume that struct sockaddr_storage is available, as it
- is used in the public interface of ngtcp2.
-
- Closes #6250
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+
+ Follow up to #6209
+ Closes #6234
+
+Daniel Stenberg (26 Nov 2020)
+- [Daiki Ueno brought this change]
-- socks: check for DNS entries with the right port number
+ ngtcp2: use the minimal version of QUIC supported by ngtcp2
- The resolve call is done with the right port number, but the subsequent
- check used the wrong one, which then could find a previous resolve which
- would return and leave the fresh resolve "incomplete" and leaking
- memory.
+ Closes #6250
+
+- [Daiki Ueno brought this change]
+
+ ngtcp2: advertise h3 ALPN unconditionally
- Fixes #6247
- Closes #6253
+ Closes #6250
+
+- [Daiki Ueno brought this change]
-- curl_setup: USE_RESOLVE_ON_IPS is for Apple native resolver use
+ vquic/ngtcp2.h: define local_addr as sockaddr_storage
- ... so don't define it when instructed to use c-ares!
+ This field needs to be wide enough to hold sockaddr_in6 when
+ connecting via IPv6. Otherwise, ngtcp2_conn_read_pkt will drop the
+ packets because of the address mismatch:
+ I00000022 [...] con ignore packet from unknown path
+
+ We can safely assume that struct sockaddr_storage is available, as it
+ is used in the public interface of ngtcp2.
+
+ Closes #6250
-- test506: make it not run in c-ares builds
-
- As the asynch nature of it may trigger events in another order. A c-ares
- upgrade made it break.
-
- Reported-by: Marc Hörsken
- Fixes #6247
+- socks: check for DNS entries with the right port number
+
+ The resolve call is done with the right port number, but the subsequent
+ check used the wrong one, which then could find a previous resolve which
+ would return and leave the fresh resolve "incomplete" and leaking
+ memory.
+
+ Fixes #6247
+ Closes #6253
-- runtests: make 'c-ares' a "feature" to depend on
+- curl_setup: USE_RESOLVE_ON_IPS is for Apple native resolver use
- ... also added to the docs.
+ ... so don't define it when instructed to use c-ares!
-- tool_writeout: use off_t getinfo-types instead of doubles
+- test506: make it not run in c-ares builds
- Commit 3b80d3ca46b12e52342 (June 2017) introduced getinfo replacement
- variables that use curl_off_t instead of doubles. Switch the --write-out
- function over to use them.
+ As the asynch nature of it may trigger events in another order. A c-ares
+ upgrade made it break.
- Closes #6248
+ Reported-by: Marc Hörsken
+ Fixes #6247
-- [Emil Engler brought this change]
+- runtests: make 'c-ares' a "feature" to depend on
+
+ ... also added to the docs.
- file: avoid duplicated code sequence
+- tool_writeout: use off_t getinfo-types instead of doubles
- file_disconnect() is identical with file_do() except the function header
- but as the arguments are unused anyway so why not just return file_do()
- directly!
+ Commit 3b80d3ca46b12e52342 (June 2017) introduced getinfo replacement
+ variables that use curl_off_t instead of doubles. Switch the --write-out
+ function over to use them.
- Reviewed-by: Daniel Stenberg
- Closes #6249
+ Closes #6248
-- [Rikard Falkeborn brought this change]
+- [Emil Engler brought this change]
- infof/failf calls: fix format specifiers
+ file: avoid duplicated code sequence
- Update a few format specifiers to match what is being printed.
+ file_disconnect() is identical with file_do() except the function header
+ but as the arguments are unused anyway so why not just return file_do()
+ directly!
- Closes #6241
+ Reviewed-by: Daniel Stenberg
+ Closes #6249
-- docs/INTERNALS: remove reference to Curl_sendf()
+- [Rikard Falkeborn brought this change]
+
+ infof/failf calls: fix format specifiers
- The function has been removed from common usage. Also removed comment in
- gopher.c that still referenced it.
+ Update a few format specifiers to match what is being printed.
- Reported-by: Rikard Falkeborn
- Fixes #6242
- Closes #6243
+ Closes #6241
-- [Rikard Falkeborn brought this change]
+- docs/INTERNALS: remove reference to Curl_sendf()
+
+ The function has been removed from common usage. Also removed comment in
+ gopher.c that still referenced it.
+
+ Reported-by: Rikard Falkeborn
+ Fixes #6242
+ Closes #6243
- examples: update .gitignore
+- [Rikard Falkeborn brought this change]
+
+ examples: update .gitignore
+
+ Add files that are generated by 'make examples' and remove some that
+ have been renamed.
- Add files that are generated by 'make examples' and remove some that
- have been renamed.
-
- The commits that renamed the programs are e9625c5bc6c046a (imap.c and
- simplesmtp.c were renamed to imap-fetch.c and smtp-send.c) and
- ad39e7ec01e7 (pop3slist.c and pop3s.c were renamed to pop3-list.c and
- pop3-ssl.c).
-
- Closes #6240
+ The commits that renamed the programs are e9625c5bc6c046a (imap.c and
+ simplesmtp.c were renamed to imap-fetch.c and smtp-send.c) and
+ ad39e7ec01e7 (pop3slist.c and pop3s.c were renamed to pop3-list.c and
+ pop3-ssl.c).
+
+ Closes #6240
-- asyn: use 'struct thread_data *' instead of 'void *'
+- asyn: use 'struct thread_data *' instead of 'void *'
+
+ To reduce use of types that can't be checked at compile time. Also
+ removes several typecasts.
- To reduce use of types that can't be checked at compile time. Also
- removes several typecasts.
+ ... and rename the struct field from 'os_specific' to 'tdata'.
- ... and rename the struct field from 'os_specific' to 'tdata'.
-
- Closes #6239
- Reviewed-by: Jay Satiro
+ Closes #6239
+ Reviewed-by: Jay Satiro
-Viktor Szakats (23 Nov 2020)
-- Makefile.m32: add support for UNICODE builds
+Viktor Szakats (23 Nov 2020)
+- Makefile.m32: add support for UNICODE builds
+
+ It requires the linker to support the `-municode` option.
+ This is available in more recent mingw-w64 releases.
+
+ Ref: https://gcc.gnu.org/onlinedocs/gcc/x86-Windows-Options.html
+ Ref: https://stackoverflow.com/questions/3571250/wwinmain-unicode-and-mingw/11706847#11706847
- It requires the linker to support the `-municode` option.
- This is available in more recent mingw-w64 releases.
-
- Ref: https://gcc.gnu.org/onlinedocs/gcc/x86-Windows-Options.html
- Ref: https://stackoverflow.com/questions/3571250/wwinmain-unicode-and-mingw/11706847#11706847
-
- Reviewed-by: Jay Satiro
+ Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
-
- Closes #6228
+
+ Closes #6228
-Daniel Stenberg (23 Nov 2020)
-- urldata: remove 'void *protop' and create the union 'p'
+Daniel Stenberg (23 Nov 2020)
+- urldata: remove 'void *protop' and create the union 'p'
- ... to avoid the use of 'void *' for the protocol specific structs done
- per transfer.
+ ... to avoid the use of 'void *' for the protocol specific structs done
+ per transfer.
- Closes #6238
+ Closes #6238
-- winbuild: remove docs from Makefiles and refer to README.md
+- winbuild: remove docs from Makefiles and refer to README.md
+
+ Reduce risk for conflicting docs and makes it to a single place to fix
+ and polish.
- Reduce risk for conflicting docs and makes it to a single place to fix
- and polish.
+ add these missing options to the readme:
- add these missing options to the readme:
+ ENABLE_OPENSSL_AUTO_LOAD_CONFIG and ENABLE_UNICODE
- ENABLE_OPENSSL_AUTO_LOAD_CONFIG and ENABLE_UNICODE
+ clarify ENABLE_SCHANNEL default varies
- clarify ENABLE_SCHANNEL default varies
-
- Fixes #6216
- Closes #6227
- Co-Authored-by: Jay Satiro
+ Fixes #6216
+ Closes #6227
+ Co-Authored-by: Jay Satiro
+
+- [Daiki Ueno brought this change]
-- [Daiki Ueno brought this change]
-
- http3: use the master branch of GnuTLS for testing
+ http3: use the master branch of GnuTLS for testing
- Closes #6235
+ Closes #6235
-- KNOWN_BUGS: curl with wolfSSL lacks support for renegotiation
+- KNOWN_BUGS: curl with wolfSSL lacks support for renegotiation
- Closes #5839
+ Closes #5839
-- KNOWN_BUGS: wakeup socket disconnect causes havoc
+- KNOWN_BUGS: wakeup socket disconnect causes havoc
- Closes #6132
- Closes #6133
+ Closes #6132
+ Closes #6133
+
+- RELEASE-NOTES: synced
-- RELEASE-NOTES: synced
+- [Oliver Urbann brought this change]
-- [Oliver Urbann brought this change]
-
- curl: add compatibility for Amiga and GCC 6.5
+ curl: add compatibility for Amiga and GCC 6.5
- Changes are mainly reordering and adding of includes required
- to compile with a more recent version of GCC.
+ Changes are mainly reordering and adding of includes required
+ to compile with a more recent version of GCC.
- Closes #6220
+ Closes #6220
-Marc Hoersken (20 Nov 2020)
-- tests/server/tftpd.c: close upload file right after transfer
+Marc Hoersken (20 Nov 2020)
+- tests/server/tftpd.c: close upload file right after transfer
- Make sure uploaded file is no longer locked after the
- transfer while waiting for the final ACK to be handled.
+ Make sure uploaded file is no longer locked after the
+ transfer while waiting for the final ACK to be handled.
- Assisted-by: Daniel Stenberg
+ Assisted-by: Daniel Stenberg
- Bug: #6058
- Closes #6209
+ Bug: #6058
+ Closes #6209
-- CI/cirrus: simplify logic for disabled tests
+- CI/cirrus: simplify logic for disabled tests
- The OpenSSH server instance for the testsuite cannot
- be started on FreeBSD, therefore the SFTP and SCP
- tests are disabled right away from the beginning.
+ The OpenSSH server instance for the testsuite cannot
+ be started on FreeBSD, therefore the SFTP and SCP
+ tests are disabled right away from the beginning.
- The previous OS version specific logic for SKIP_TESTS
- is no longer needed/used and can therefore be removed.
+ The previous OS version specific logic for SKIP_TESTS
+ is no longer needed/used and can therefore be removed.
- Reviewed-by: Daniel Stenberg
+ Reviewed-by: Daniel Stenberg
- Follow up to #6211
- Closes #6229
-
-Daniel Gustafsson (20 Nov 2020)
-- mailmap: Daniel Hwang
+ Follow up to #6211
+ Closes #6229
+
+Daniel Gustafsson (20 Nov 2020)
+- mailmap: Daniel Hwang
+
+ Add Daniel Hwang to the mailmap to cover the alternative spelling
+ Daniel Lee Hwang which was used in one commit.
- Add Daniel Hwang to the mailmap to cover the alternative spelling
- Daniel Lee Hwang which was used in one commit.
-
- Closes #6230
- Reviewed-by: Daniel Stenberg <daniel@haxx.se>
+ Closes #6230
+ Reviewed-by: Daniel Stenberg <daniel@haxx.se>
-- openssl: guard against OOM on context creation
+- openssl: guard against OOM on context creation
- EVP_MD_CTX_create will allocate memory for the context and returns
- NULL in case the allocation fails. Make sure to catch any allocation
- failures and exit early if so.
+ EVP_MD_CTX_create will allocate memory for the context and returns
+ NULL in case the allocation fails. Make sure to catch any allocation
+ failures and exit early if so.
- In passing, also move to EVP_DigestInit rather than EVP_DigestInit_ex
- as the latter is intended for ENGINE selection which we don't do.
-
- Closes #6224
- Reviewed-by: Daniel Stenberg <daniel@haxx.se>
- Reviewed-by: Emil Engler <me@emilengler.com>
+ In passing, also move to EVP_DigestInit rather than EVP_DigestInit_ex
+ as the latter is intended for ENGINE selection which we don't do.
+
+ Closes #6224
+ Reviewed-by: Daniel Stenberg <daniel@haxx.se>
+ Reviewed-by: Emil Engler <me@emilengler.com>
+
+Daniel Stenberg (19 Nov 2020)
+- [Vincent Torri brought this change]
-Daniel Stenberg (19 Nov 2020)
-- [Vincent Torri brought this change]
-
- cmake: use libcurl.rc in all Windows builds
+ cmake: use libcurl.rc in all Windows builds
- Reviewed-by: Marcel Raad
- Closes #6215
+ Reviewed-by: Marcel Raad
+ Closes #6215
-- [Cristian Morales Vega brought this change]
+- [Cristian Morales Vega brought this change]
- cmake: make CURL_ZLIB a tri-state variable
+ cmake: make CURL_ZLIB a tri-state variable
- By differentiating between ON and AUTO it can make a missing zlib
- library a hard error when CURL_ZLIB=ON is used.
+ By differentiating between ON and AUTO it can make a missing zlib
+ library a hard error when CURL_ZLIB=ON is used.
- Reviewed-by: Jakub Zakrzewski
- Closes #6221
- Fixes #6173
+ Reviewed-by: Jakub Zakrzewski
+ Closes #6221
+ Fixes #6173
-- quiche: remove 'static' from local buffer
+- quiche: remove 'static' from local buffer
- For thread-safety
+ For thread-safety
- Closes #6223
-
-- KNOWN_BUGS: cmake: libspsl is not supported
+ Closes #6223
+
+- KNOWN_BUGS: cmake: libspsl is not supported
- Closes #6214
-
-- KNOWN_BUGS: cmake autodetects cert paths when cross-compiling
+ Closes #6214
+
+- KNOWN_BUGS: cmake autodetects cert paths when cross-compiling
- Closes #6178
+ Closes #6178
-- KNOWN_BUGS: cmake build doesn't fail if zlib not found
+- KNOWN_BUGS: cmake build doesn't fail if zlib not found
- Closes #6173
-
-- KNOWN_BUGS: cmake libcurl.pc uses absolute library paths
+ Closes #6173
+
+- KNOWN_BUGS: cmake libcurl.pc uses absolute library paths
- Closes #6169
+ Closes #6169
-- KNOWN_BUGS: cmake: generated .pc file contains strange entries
+- KNOWN_BUGS: cmake: generated .pc file contains strange entries
- Closes #6167
+ Closes #6167
-- KNOWN_BUGS: cmake uses -lpthread instead of Threads::Threads
+- KNOWN_BUGS: cmake uses -lpthread instead of Threads::Threads
- Closes #6166
+ Closes #6166
-- KNOWN_BUGS: cmake build in Linux links libcurl to libdl
+- KNOWN_BUGS: cmake build in Linux links libcurl to libdl
- Closes #6165
+ Closes #6165
-- KNOWN_BUGS: make a new section for cmake topics
-
- Closes #6219
+- KNOWN_BUGS: make a new section for cmake topics
+
+ Closes #6219
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- cirrus: build with FreeBSD 12.2 in CirrusCI
+ cirrus: build with FreeBSD 12.2 in CirrusCI
- Closes #6211
-
-Marc Hoersken (14 Nov 2020)
-- tests/*server.py: close log file after each log line
+ Closes #6211
+
+Marc Hoersken (14 Nov 2020)
+- tests/*server.py: close log file after each log line
+
+ Make sure the log file is not locked once a test has
+ finished and align with the behavior of our logmsg.
- Make sure the log file is not locked once a test has
- finished and align with the behavior of our logmsg.
+ Rename curl_test_data.py to be a general util.py.
+ Format and sort Python imports with isort/VSCode.
+
+ Bug: #6058
+ Closes #6206
+
+Daniel Stenberg (13 Nov 2020)
+- CURLOPT_HSTS.3: document the file format
- Rename curl_test_data.py to be a general util.py.
- Format and sort Python imports with isort/VSCode.
-
- Bug: #6058
- Closes #6206
+ Closes #6205
-Daniel Stenberg (13 Nov 2020)
-- CURLOPT_HSTS.3: document the file format
+- RELEASE-NOTES: synced
+
+- release-notes.pl: detect #[number] better for Ref: etc
+
+- curl: only warn not fail, if not finding the home dir
- Closes #6205
-
-- RELEASE-NOTES: synced
-
-- release-notes.pl: detect #[number] better for Ref: etc
-
-- curl: only warn not fail, if not finding the home dir
+ ... as there's no good reason to error out completely.
+
+ Reported-by: Andreas Fischer
+ Fixes #6200
+ Closes #6201
+
+- httpput-postfields.c: new example doing PUT with POSTFIELDS
- ... as there's no good reason to error out completely.
-
- Reported-by: Andreas Fischer
- Fixes #6200
- Closes #6201
+ Proposed-by: Jeroen Ooms
+ Ref: #6186
+ Closes #6188
-- httpput-postfields.c: new example doing PUT with POSTFIELDS
+- [Tobias Hieta brought this change]
+
+ cmake: correctly handle linker flags for static libs
- Proposed-by: Jeroen Ooms
- Ref: #6186
- Closes #6188
-
-- [Tobias Hieta brought this change]
-
- cmake: correctly handle linker flags for static libs
+ curl CMake was setting the the EXE flags for static libraries which made
+ the /manifest:no flag ended up when linking the static library, which is
+ not a valid flag for lib.exe or llvm-lib.exe and caused llvm-lib to exit
+ with an error.
- curl CMake was setting the the EXE flags for static libraries which made
- the /manifest:no flag ended up when linking the static library, which is
- not a valid flag for lib.exe or llvm-lib.exe and caused llvm-lib to exit
- with an error.
+ The better way to handle this is to make sure that we pass the correct
+ linker flags to CMAKE_STATIC_LINKER_FLAGS instead.
- The better way to handle this is to make sure that we pass the correct
- linker flags to CMAKE_STATIC_LINKER_FLAGS instead.
-
- Reviewed-by: Jakub Zakrzewski
- Closes #6195
+ Reviewed-by: Jakub Zakrzewski
+ Closes #6195
+
+- [Tobias Hieta brought this change]
-- [Tobias Hieta brought this change]
-
- cmake: don't pass -fvisibility=hidden to clang-cl on Windows
+ cmake: don't pass -fvisibility=hidden to clang-cl on Windows
+
+ When using clang-cl on windows -fvisibility=hidden is not an known
+ argument. Instead it behaves exactly like MSVC in this case. So let's
+ make sure we take that path.
- When using clang-cl on windows -fvisibility=hidden is not an known
- argument. Instead it behaves exactly like MSVC in this case. So let's
- make sure we take that path.
+ In CMake clang-cl sets both CMAKE_C_COMPILER_ID=clang and MSVC get's
+ defined since clang-cl is basically a MSVC emulator. So guarding like we
+ do in this patch seems logical.
- In CMake clang-cl sets both CMAKE_C_COMPILER_ID=clang and MSVC get's
- defined since clang-cl is basically a MSVC emulator. So guarding like we
- do in this patch seems logical.
-
- Reviewed-by: Jakub Zakrzewski
- Closes #6194
+ Reviewed-by: Jakub Zakrzewski
+ Closes #6194
-- http_proxy: use enum with state names for 'keepon'
+- http_proxy: use enum with state names for 'keepon'
- To make the code clearer, change the 'keepon' from an int to an enum
- with better state names.
+ To make the code clearer, change the 'keepon' from an int to an enum
+ with better state names.
- Reported-by: Niranjan Hasabnis
- Bug: https://curl.se/mail/lib-2020-11/0026.html
- Closes #6193
+ Reported-by: Niranjan Hasabnis
+ Bug: https://curl.se/mail/lib-2020-11/0026.html
+ Closes #6193
-- curl_easy_escape: limit output string length to 3 * max input
+- curl_easy_escape: limit output string length to 3 * max input
- ... instead of the limiting it to just the max input size. As every
- input byte can be expanded to 3 output bytes, this could limit the input
- string to 2.66 MB instead of the intended 8 MB.
+ ... instead of the limiting it to just the max input size. As every
+ input byte can be expanded to 3 output bytes, this could limit the input
+ string to 2.66 MB instead of the intended 8 MB.
- Reported-by: Marc Schlatter
- Closes #6192
+ Reported-by: Marc Schlatter
+ Closes #6192
-- docs: document the 8MB input string limit
+- docs: document the 8MB input string limit
- for curl_easy_escape and curl_easy_setopt()
+ for curl_easy_escape and curl_easy_setopt()
- The limit is there to catch mistakes and abuse. It is meant to be large
- enough to allow virtually all "fine" use cases.
+ The limit is there to catch mistakes and abuse. It is meant to be large
+ enough to allow virtually all "fine" use cases.
- Reported-by: Marc Schlatter
- Fixes #6190
- Closes #6191
+ Reported-by: Marc Schlatter
+ Fixes #6190
+ Closes #6191
-- mqttd: fclose test file when done
+- mqttd: fclose test file when done
- Reported-by: Marc Hörsken
- Reviewed-by: Jay Satiro
- Bug: #6058
- Closes #6189
+ Reported-by: Marc Hörsken
+ Reviewed-by: Jay Satiro
+ Bug: #6058
+ Closes #6189
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- THANKS-filter: ignore autobuild links
+- THANKS-filter: ignore autobuild links
-- Revert "libcurl.pc: make it relocatable"
+- Revert "libcurl.pc: make it relocatable"
- This reverts commit 3862c37b6373a55ca704171d45ba5ee91dec2c9f.
+ This reverts commit 3862c37b6373a55ca704171d45ba5ee91dec2c9f.
- That fix should either be done differently or with an option.
+ That fix should either be done differently or with an option.
- Reported-by: asavah on github
- Fixes #6157
- Closes #6183
+ Reported-by: asavah on github
+ Fixes #6157
+ Closes #6183
-- examples/httpput: remove use of CURLOPT_PUT
+- examples/httpput: remove use of CURLOPT_PUT
- It is deprecated and unnecessary since it already sets CURLOPT_UPLOAD.
+ It is deprecated and unnecessary since it already sets CURLOPT_UPLOAD.
- Reported-by: Jeroen Ooms
- Fixes #6186
- Closes #6187
-
-- Curl_pgrsStartNow: init speed limit time stamps at start
+ Reported-by: Jeroen Ooms
+ Fixes #6186
+ Closes #6187
+
+- Curl_pgrsStartNow: init speed limit time stamps at start
- By setting the speed limit time stamps unconditionally at transfer
- start, we can start off a transfer without speed limits and yet allow
- them to get set during transfer and have an effect.
+ By setting the speed limit time stamps unconditionally at transfer
+ start, we can start off a transfer without speed limits and yet allow
+ them to get set during transfer and have an effect.
- Reported-by: Kael1117 on github
- Fixes #6162
- Closes #6184
+ Reported-by: Kael1117 on github
+ Fixes #6162
+ Closes #6184
-- ngtcp2: adapt to recent nghttp3 updates
+- ngtcp2: adapt to recent nghttp3 updates
- 'reset_stream' was added to the nghttp3_conn_callbacks struct
+ 'reset_stream' was added to the nghttp3_conn_callbacks struct
- Closes #6185
-
-- configure: pass -pthread to Libs.private for pkg-config
+ Closes #6185
+
+- configure: pass -pthread to Libs.private for pkg-config
- Reported-by: Cristian Morales Vega
- Fixes #6168
- Closes #6181
+ Reported-by: Cristian Morales Vega
+ Fixes #6168
+ Closes #6181
-- altsvc: minimize variable scope and avoid "DEAD_STORE"
+- altsvc: minimize variable scope and avoid "DEAD_STORE"
- Closes #6182
-
-- FAQ: remove "Why is there a HTTP/1.1 in my HTTP/2 request?"
+ Closes #6182
+
+- FAQ: remove "Why is there a HTTP/1.1 in my HTTP/2 request?"
- This hasn't been the case for a while now, remove.
+ This hasn't been the case for a while now, remove.
-- FAQ: refresh "Why do I get "certificate verify failed"
+- FAQ: refresh "Why do I get "certificate verify failed"
- Add more details, remove references to ancient curl version.
+ Add more details, remove references to ancient curl version.
-- test493: verify --hsts upgrade and that %{url_effective} reflects that
+- test493: verify --hsts upgrade and that %{url_effective} reflects that
- Closes #6175
+ Closes #6175
-- url: make sure an HSTS upgrade updates URL and scheme correctly
+- url: make sure an HSTS upgrade updates URL and scheme correctly
- Closes #6175
+ Closes #6175
-- tool_operate: set HSTS with CURLOPT_HSTS to pass on filename
+- tool_operate: set HSTS with CURLOPT_HSTS to pass on filename
- Closes #6175
+ Closes #6175
-- hsts: remove debug code leftovers
+- hsts: remove debug code leftovers
- Closes #6175
+ Closes #6175
-- FAQ: refreshed
+- FAQ: refreshed
- - remove a few ancient questions
- - add configure with static libs question
- - updated wording in several places
- - lowercased curl
+ - remove a few ancient questions
+ - add configure with static libs question
+ - updated wording in several places
+ - lowercased curl
- Closes #6177
-
-Daniel Gustafsson (5 Nov 2020)
-- examples: fix comment syntax
+ Closes #6177
+
+Daniel Gustafsson (5 Nov 2020)
+- examples: fix comment syntax
- Commit ac0a88fd2 accidentally added a stray character outside of the
- comment which broke compilation. Fix by removing.
+ Commit ac0a88fd2 accidentally added a stray character outside of the
+ comment which broke compilation. Fix by removing.
- Reported-by: autobuild https://curl.se/dev/log.cgi?id=20201105084306-12742
+ Reported-by: autobuild https://curl.se/dev/log.cgi?id=20201105084306-12742
-- hsts: Remove pointless call to free in errorpath
+- hsts: Remove pointless call to free in errorpath
- The line variable will always be NULL in the error path, so remove
- the free call since it's pointless.
+ The line variable will always be NULL in the error path, so remove
+ the free call since it's pointless.
- Closes #6170
- Reviewed-by: Daniel Stenberg <daniel@haxx.se>
+ Closes #6170
+ Reviewed-by: Daniel Stenberg <daniel@haxx.se>
-- docs: Fix various typos in documentation
+- docs: Fix various typos in documentation
- Closes #6171
- Reviewed-by: Daniel Stenberg <daniel@haxx.se>
+ Closes #6171
+ Reviewed-by: Daniel Stenberg <daniel@haxx.se>
-Daniel Stenberg (5 Nov 2020)
-- copyright: fix year ranges
+Daniel Stenberg (5 Nov 2020)
+- copyright: fix year ranges
- Follow-up from 4d2f8006777
+ Follow-up from 4d2f8006777
-- HISTORY: the new domain
+- HISTORY: the new domain
-- curl.se: new home
+- curl.se: new home
- Closes #6172
+ Closes #6172
-- KNOWN_BUGS: FTPS with Schannel times out file list operation
-
- Reported-by: bobmitchell1956 on github
- Closes #5284
+- KNOWN_BUGS: FTPS with Schannel times out file list operation
+
+ Reported-by: bobmitchell1956 on github
+ Closes #5284
-- KNOWN_BUGS: SMB tests fail with Python 2
+- KNOWN_BUGS: SMB tests fail with Python 2
- Reported-by: Jay Satiro
- Closes #5983
+ Reported-by: Jay Satiro
+ Closes #5983
-- KNOWN_BUGS: LDAPS with NSS is slow
-
- Reported-by: nosajsnikta on github
- Closes #5874
+- KNOWN_BUGS: LDAPS with NSS is slow
+
+ Reported-by: nosajsnikta on github
+ Closes #5874
-Sergei Nikulov (4 Nov 2020)
-- travis: use ninja-build for CMake builds
+Sergei Nikulov (4 Nov 2020)
+- travis: use ninja-build for CMake builds
- Added package ninja-build to environment
- Use ninja to speed up CMake builds
+ Added package ninja-build to environment
+ Use ninja to speed up CMake builds
- Closes #6077
+ Closes #6077
-Daniel Stenberg (4 Nov 2020)
-- [Harry Sintonen brought this change]
+Daniel Stenberg (4 Nov 2020)
+- [Harry Sintonen brought this change]
- rtsp: error out on empty Session ID, unified the code
-
-- [Harry Sintonen brought this change]
-
- rtsp: fixed the RTST Session ID mismatch in test 570
+ rtsp: error out on empty Session ID, unified the code
+
+- [Harry Sintonen brought this change]
+
+ rtsp: fixed the RTST Session ID mismatch in test 570
- Closes #6161
+ Closes #6161
-- [Harry Sintonen brought this change]
-
- rtsp: fixed Session ID comparison to refuse prefix
+- [Harry Sintonen brought this change]
+
+ rtsp: fixed Session ID comparison to refuse prefix
- Closes #6161
+ Closes #6161
-- RELEASE-NOTES: synced
-
- (forgot to update the list of contributors)
+- RELEASE-NOTES: synced
+
+ (forgot to update the list of contributors)
- RELEASE-NOTES: synced
-- curlver: bumped to 7.74.0
+- curlver: bumped to 7.74.0
-- hsts: add read/write callbacks
+- hsts: add read/write callbacks
- - read/write callback options
- - man pages for the 4 new setopts
- - test 1915 verifies the callbacks
+ - read/write callback options
+ - man pages for the 4 new setopts
+ - test 1915 verifies the callbacks
- Closes #5896
+ Closes #5896
-- hsts: add support for Strict-Transport-Security
+- hsts: add support for Strict-Transport-Security
- - enable in the build (configure)
- - header parsing
- - host name lookup
- - unit tests for the above
- - CI build
- - CURL_VERSION_HSTS bit
- - curl_version_info support
- - curl -V output
- - curl-config --features
- - CURLOPT_HSTS_CTRL
- - man page for CURLOPT_HSTS_CTRL
- - curl --hsts (sets CURLOPT_HSTS_CTRL and works with --libcurl)
- - man page for --hsts
- - save cache to disk
- - load cache from disk
- - CURLOPT_HSTS
- - man page for CURLOPT_HSTS
- - added docs/HSTS.md
- - fixed --version docs
- - adjusted curl_easy_duphandle
+ - enable in the build (configure)
+ - header parsing
+ - host name lookup
+ - unit tests for the above
+ - CI build
+ - CURL_VERSION_HSTS bit
+ - curl_version_info support
+ - curl -V output
+ - curl-config --features
+ - CURLOPT_HSTS_CTRL
+ - man page for CURLOPT_HSTS_CTRL
+ - curl --hsts (sets CURLOPT_HSTS_CTRL and works with --libcurl)
+ - man page for --hsts
+ - save cache to disk
+ - load cache from disk
+ - CURLOPT_HSTS
+ - man page for CURLOPT_HSTS
+ - added docs/HSTS.md
+ - fixed --version docs
+ - adjusted curl_easy_duphandle
- Closes #5896
+ Closes #5896
-- [Sergei Nikulov brought this change]
+- [Sergei Nikulov brought this change]
- CI/tests: enable test target on TravisCI for CMake builds
+ CI/tests: enable test target on TravisCI for CMake builds
- Added test-nonflaky target to CMake builds
+ Added test-nonflaky target to CMake builds
- Disabled test 1139 because the cmake build doesn't create docs/curl.1
+ Disabled test 1139 because the cmake build doesn't create docs/curl.1
- Closes #6074
+ Closes #6074
-- tool_debug_cb: do not assume zero-terminated data
-
- Follow-up to d70a5b5a0f5e3
+- tool_debug_cb: do not assume zero-terminated data
+
+ Follow-up to d70a5b5a0f5e3
-- sendf: move the verbose-check into Curl_debug
+- sendf: move the verbose-check into Curl_debug
- Saves us from having the same check done everywhere.
+ Saves us from having the same check done everywhere.
- Closes #6159
+ Closes #6159
-- travis: use valgrind when running tests for debug builds
-
- Except the non-x86 and sanitizer builds
-
- Closes #6154
+- travis: use valgrind when running tests for debug builds
+
+ Except the non-x86 and sanitizer builds
+
+ Closes #6154
-- header.d: fix syntax mistake
+- header.d: fix syntax mistake
- follow-up from 1144886f38fd0
+ follow-up from 1144886f38fd0
-- [Harry Sintonen brought this change]
+- [Harry Sintonen brought this change]
- gnutls: fix memory leaks (certfields memory wasn't released)
-
- Closes #6153
+ gnutls: fix memory leaks (certfields memory wasn't released)
+
+ Closes #6153
-- tests: add missing global_init/cleanup calls
+- tests: add missing global_init/cleanup calls
- Without the cleanup call in these test files, the mbedTLS backend leaks
- memory.
-
- Closes #6156
+ Without the cleanup call in these test files, the mbedTLS backend leaks
+ memory.
+
+ Closes #6156
-- tool_operate: --retry for HTTP 408 responses too
+- tool_operate: --retry for HTTP 408 responses too
+
+ This was inadvertently dropped from the code when the parallel support
+ was added.
- This was inadvertently dropped from the code when the parallel support
- was added.
+ Regression since b88940850 (7.66.0)
- Regression since b88940850 (7.66.0)
-
- Reviewed-by: Jay Satiro
- Closes #6155
+ Reviewed-by: Jay Satiro
+ Closes #6155
-- http: pass correct header size to debug callback for chunked post
+- http: pass correct header size to debug callback for chunked post
- ... when the chunked framing was added, the size of the "body part" of
- the data was calculated wrongly so the debug callback would get told a
- header chunk a few bytes too big that would also contain the first few
- bytes of the request body.
+ ... when the chunked framing was added, the size of the "body part" of
+ the data was calculated wrongly so the debug callback would get told a
+ header chunk a few bytes too big that would also contain the first few
+ bytes of the request body.
- Reported-by: Dirk Wetter
- Ref: #6144
- Closes #6147
+ Reported-by: Dirk Wetter
+ Ref: #6144
+ Closes #6147
-- header.d: mention the "Transfer-Encoding: chunked" handling
+- header.d: mention the "Transfer-Encoding: chunked" handling
- Ref: #6144
- Closes #6148
+ Ref: #6144
+ Closes #6148
-- acinclude: detect manually set minimum macos/ipod version
-
- ... even if set in the CC or IPHONEOS/MACOSX_DEPLOYMENT_TARGET
- variables.
-
- Reported-by: hamstergene on github
- Fixes #6138
- Closes #6140
+- acinclude: detect manually set minimum macos/ipod version
+
+ ... even if set in the CC or IPHONEOS/MACOSX_DEPLOYMENT_TARGET
+ variables.
+
+ Reported-by: hamstergene on github
+ Fixes #6138
+ Closes #6140
-Jay Satiro (29 Oct 2020)
-- tests: fix some http/2 tests for older versions of nghttpx
+Jay Satiro (29 Oct 2020)
+- tests: fix some http/2 tests for older versions of nghttpx
+
+ - Add regex that strips http/2 server header name to those http/2 tests
+ that don't already have it.
- - Add regex that strips http/2 server header name to those http/2 tests
- that don't already have it.
+ - Improve that regex in all http/2 tests.
- - Improve that regex in all http/2 tests.
+ Tests 358 and 359 were failing for me before this change on a system
+ that uses an older version of nghttpx which includes its version number
+ in the server header.
- Tests 358 and 359 were failing for me before this change on a system
- that uses an older version of nghttpx which includes its version number
- in the server header.
-
- Closes https://github.com/curl/curl/pull/6139
+ Closes https://github.com/curl/curl/pull/6139
-Daniel Stenberg (30 Oct 2020)
+Daniel Stenberg (30 Oct 2020)
- RELEASE-NOTES: synced
-- [Cristian Morales Vega brought this change]
-
- configure: use pkgconfig to find openSSL when cross-compiling
+- [Cristian Morales Vega brought this change]
+
+ configure: use pkgconfig to find openSSL when cross-compiling
- This reverts 736a40fec (November 2004), which doesn't explain why it was
- done.
+ This reverts 736a40fec (November 2004), which doesn't explain why it was
+ done.
- Closes #6145
+ Closes #6145
-- tool_operate: bail out proper on errors for parallel setup
+- tool_operate: bail out proper on errors for parallel setup
+
+ ... otherwise for example trying to upload a missing file just causes a
+ loop.
- ... otherwise for example trying to upload a missing file just causes a
- loop.
-
- Reported-by: BrumBrum on hackerone
- Closes #6141
+ Reported-by: BrumBrum on hackerone
+ Closes #6141
+
+- [Sergei Nikulov brought this change]
-- [Sergei Nikulov brought this change]
-
- CMake: make BUILD_TESTING dependent option
+ CMake: make BUILD_TESTING dependent option
- CMake will now handle BUILD_TESTING depending on PERL_FOUND and
- CURL_DISABLE_TESTING
+ CMake will now handle BUILD_TESTING depending on PERL_FOUND and
+ CURL_DISABLE_TESTING
- Ref: #6036
- Closes #6072
-
-- libssh2: fix transport over HTTPS proxy
+ Ref: #6036
+ Closes #6072
+
+- libssh2: fix transport over HTTPS proxy
- The fix in #6021 was not enough. This fix makes sure SCP/SFTP content
- can also be transfered over a HTTPS proxy.
+ The fix in #6021 was not enough. This fix makes sure SCP/SFTP content
+ can also be transfered over a HTTPS proxy.
- Fixes #6113
- Closes #6128
+ Fixes #6113
+ Closes #6128
-- curl.1: add an "OUTPUT" section at the top of the manpage
+- curl.1: add an "OUTPUT" section at the top of the manpage
- Explain the basic concepts behind curl output.
+ Explain the basic concepts behind curl output.
- Inspired by #6124
+ Inspired by #6124
- Closes #6134
+ Closes #6134
+
+- mailmap: set Viktor Szakats's email
-- mailmap: set Viktor Szakats's email
-
-- runtests: show keywords when no tests ran
+- runtests: show keywords when no tests ran
- To help out future debugging, runtests now outputs the list of keywords
- when it fails because no tests ran.
+ To help out future debugging, runtests now outputs the list of keywords
+ when it fails because no tests ran.
- Ref: #6120
- Closes #6126
+ Ref: #6120
+ Closes #6126
-Jay Satiro (26 Oct 2020)
-- CURLOPT_DNS_USE_GLOBAL_CACHE.3: fix typo
+Jay Satiro (26 Oct 2020)
+- CURLOPT_DNS_USE_GLOBAL_CACHE.3: fix typo
- Reported-by: Rui LIU
+ Reported-by: Rui LIU
- Closes https://github.com/curl/curl/issues/6131
+ Closes https://github.com/curl/curl/issues/6131
-- range.d: fix typo
+- range.d: fix typo
- Follow-up to 15ae039 from earlier today.
+ Follow-up to 15ae039 from earlier today.
-Daniel Stenberg (26 Oct 2020)
-- CI/github: work-around for brew breakage on macOS
+Daniel Stenberg (26 Oct 2020)
+- CI/github: work-around for brew breakage on macOS
- ... and make it use OpenSSL 1.1 properly
+ ... and make it use OpenSSL 1.1 properly
- Fixes #6130
- Closes #6129
+ Fixes #6130
+ Closes #6129
-- [José Joaquín Atria brought this change]
+- [José Joaquín Atria brought this change]
- range.d: clarify that curl will not parse multipart responses
+ range.d: clarify that curl will not parse multipart responses
- Closes #6127
- Fixes #6124
+ Closes #6127
+ Fixes #6124
- RELEASE-NOTES: synced
-- [Baruch Siach brought this change]
+- [Baruch Siach brought this change]
- libssh2: fix build with disabled proxy support
+ libssh2: fix build with disabled proxy support
- Build breaks because the http_proxy field is missing:
+ Build breaks because the http_proxy field is missing:
- vssh/libssh2.c:3119:10: error: 'struct connectdata' has no member named 'http_proxy'
+ vssh/libssh2.c:3119:10: error: 'struct connectdata' has no member named 'http_proxy'
- Regression from #6021, shipped in curl 7.73.0
-
- Closes #6125
+ Regression from #6021, shipped in curl 7.73.0
+
+ Closes #6125
-- alt-svc: enable by default
+- alt-svc: enable by default
- Remove CURLALTSVC_IMMEDIATELY, which was never implemented/supported.
+ Remove CURLALTSVC_IMMEDIATELY, which was never implemented/supported.
- alt-svc support in curl is no longer considered experimental
+ alt-svc support in curl is no longer considered experimental
- Closes #5868
-
-- CI/appveyor: remove (unused) runtests.pl -b option
-
-- [Emil Engler brought this change]
-
- tool_help: make "output" description less confusing
+ Closes #5868
+
+- CI/appveyor: remove (unused) runtests.pl -b option
+
+- [Emil Engler brought this change]
+
+ tool_help: make "output" description less confusing
- Currently the description of "output" is misleading when comparing it
- "verbose".
+ Currently the description of "output" is misleading when comparing it
+ "verbose".
- Closes #6118
-
-- CI/appveyor: disable test 571 in two cmake builds
+ Closes #6118
+
+- CI/appveyor: disable test 571 in two cmake builds
+
+ ... they're simply too flaky there.
- ... they're simply too flaky there.
-
- Closes #6119
+ Closes #6119
-- cmake: set the unicode feature in curl-config on Windows
-
- ... if built that way. To make it match curl -V output.
-
- Reviewed-by: Marcel Raad
- Closes #6117
+- cmake: set the unicode feature in curl-config on Windows
+
+ ... if built that way. To make it match curl -V output.
+
+ Reviewed-by: Marcel Raad
+ Closes #6117
-- libssh2: require version 1.0 or later
+- libssh2: require version 1.0 or later
- ... and simplify the code accordingly. libssh2 version 1.0 was released
- in April 2009.
+ ... and simplify the code accordingly. libssh2 version 1.0 was released
+ in April 2009.
- Closes #6116
-
-- KNOWN_BUGS: mention the individual cmake issues
+ Closes #6116
+
+- KNOWN_BUGS: mention the individual cmake issues
- ... to make them easier to refer to and address separately and
- one-by-one.
+ ... to make them easier to refer to and address separately and
+ one-by-one.
-- CMake: store IDN2 information in curl_config.h
+- CMake: store IDN2 information in curl_config.h
- This allows the build to enable IDN properly and it makes test 1014
- happier.
+ This allows the build to enable IDN properly and it makes test 1014
+ happier.
- Ref: #6074
- Closes #6108
+ Ref: #6074
+ Closes #6108
-- CMake: call the feature unixsockets without dash
+- CMake: call the feature unixsockets without dash
- ... so that curl-config gets correct and makes test 1014 happy!
+ ... so that curl-config gets correct and makes test 1014 happy!
- Ref: #6074
- Closes #6108
-
-- CI/travis: add brotli and zstd to the libssh2 build
+ Ref: #6074
+ Closes #6108
+
+- CI/travis: add brotli and zstd to the libssh2 build
- ... to make sure such tests are run with valgrind. Suppress the zstd
- valgrind warnings we get with version 1.3.3 on Ubuntu 18.04 (for debug
- and non-debug builds).
+ ... to make sure such tests are run with valgrind. Suppress the zstd
+ valgrind warnings we get with version 1.3.3 on Ubuntu 18.04 (for debug
+ and non-debug builds).
- Closes #6105
+ Closes #6105
-- runtests: revert the mistaken edit of $CURL
-
- Regression from c4693adc62
+- runtests: revert the mistaken edit of $CURL
+
+ Regression from c4693adc62
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- curl_url_set.3: fix typo in the RETURN VALUE section
+- curl_url_set.3: fix typo in the RETURN VALUE section
- Reported-by: Basuke Suzuki
- Fixes #6102
+ Reported-by: Basuke Suzuki
+ Fixes #6102
+
+Jay Satiro (17 Oct 2020)
+- [Daniel Stenberg brought this change]
-Jay Satiro (17 Oct 2020)
-- [Daniel Stenberg brought this change]
-
- packages/OS400: make the source code-style compliant
+ packages/OS400: make the source code-style compliant
- ... and make sure 'make checksrc' in the root dir also verifies the
- packages/OS400 sources.
+ ... and make sure 'make checksrc' in the root dir also verifies the
+ packages/OS400 sources.
- Closes https://github.com/curl/curl/pull/6085
-
-- os400: Sync libcurl API options
+ Closes https://github.com/curl/curl/pull/6085
+
+- os400: Sync libcurl API options
- This fixes the OS400 build and also an incorrect entry for
- CURLINFO_APPCONNECT_TIME_T where it was treated as
- CURLINFO_STARTTRANSFER_TIME_T.
+ This fixes the OS400 build and also an incorrect entry for
+ CURLINFO_APPCONNECT_TIME_T where it was treated as
+ CURLINFO_STARTTRANSFER_TIME_T.
- Reported-by: Jon Rumsey
+ Reported-by: Jon Rumsey
- Fixes https://github.com/curl/curl/issues/6083
- Closes https://github.com/curl/curl/pull/6084
+ Fixes https://github.com/curl/curl/issues/6083
+ Closes https://github.com/curl/curl/pull/6084
-Daniel Stenberg (16 Oct 2020)
-- CURLOPT_NOBODY.3: fix typo
+Daniel Stenberg (16 Oct 2020)
+- CURLOPT_NOBODY.3: fix typo
- Reported-by: Basuke Suzuki
- Fixes #6097
+ Reported-by: Basuke Suzuki
+ Fixes #6097
-Marc Hoersken (16 Oct 2020)
-- CI/azure: improve on flakiness by avoiding libtool wrappers
+Marc Hoersken (16 Oct 2020)
+- CI/azure: improve on flakiness by avoiding libtool wrappers
- Install curl binaries into MinGW bin folder and use that
- for the tests in order to avoid libtool wrapper binaries.
+ Install curl binaries into MinGW bin folder and use that
+ for the tests in order to avoid libtool wrapper binaries.
- The libtool wrapper binaries (not scripts) on Windows seem
- to be one of the possible causes for the following issues:
+ The libtool wrapper binaries (not scripts) on Windows seem
+ to be one of the possible causes for the following issues:
- 1. Process output can be lost in the wrapper process chain.
- 2. Killing the wrapper process does not kill the actual one.
+ 1. Process output can be lost in the wrapper process chain.
+ 2. Killing the wrapper process does not kill the actual one.
- Derived from #5904
- Closes #6049
+ Derived from #5904
+ Closes #6049
-Daniel Stenberg (16 Oct 2020)
-- CURLOPT_URL.3: clarify SCP/SFTP URLs are for uploads as well
+Daniel Stenberg (16 Oct 2020)
+- CURLOPT_URL.3: clarify SCP/SFTP URLs are for uploads as well
-- [Zenju brought this change]
+- [Zenju brought this change]
- CURLOPT_TCP_NODELAY.3: fix comment in example code
+ CURLOPT_TCP_NODELAY.3: fix comment in example code
- Closes #6096
+ Closes #6096
-- openssl: acknowledge SRP disabling in configure properly
+- openssl: acknowledge SRP disabling in configure properly
+
+ Follow-up to 68a513247409
+
+ Use a new separate define that is the combination of both
+ HAVE_OPENSSL_SRP and USE_TLS_SRP: USE_OPENSSL_SRP
- Follow-up to 68a513247409
+ Bug: https://curl.haxx.se/mail/lib-2020-10/0037.html
- Use a new separate define that is the combination of both
- HAVE_OPENSSL_SRP and USE_TLS_SRP: USE_OPENSSL_SRP
-
- Bug: https://curl.haxx.se/mail/lib-2020-10/0037.html
-
- Closes #6094
+ Closes #6094
-Viktor Szakats (16 Oct 2020)
-- http3: fix two build errors, silence warnings
+Viktor Szakats (16 Oct 2020)
+- http3: fix two build errors, silence warnings
- * fix two build errors due to mismatch between function
- declarations and their definitions
- * silence two mismatched signs warnings via casts
+ * fix two build errors due to mismatch between function
+ declarations and their definitions
+ * silence two mismatched signs warnings via casts
- Approved-by: Daniel Stenberg
- Closes #6093
+ Approved-by: Daniel Stenberg
+ Closes #6093
-- Makefile.m32: add support for HTTP/3 via ngtcp2+nghttp3
-
- Approved-by: Daniel Stenberg
- Closes #6092
+- Makefile.m32: add support for HTTP/3 via ngtcp2+nghttp3
+
+ Approved-by: Daniel Stenberg
+ Closes #6092
-Daniel Stenberg (16 Oct 2020)
-- tool_operate: fix compiler warning when --libcurl is disabled
-
- Closes #6095
+Daniel Stenberg (16 Oct 2020)
+- tool_operate: fix compiler warning when --libcurl is disabled
+
+ Closes #6095
-- checksrc: warn on empty line before open brace
+- checksrc: warn on empty line before open brace
- ... and fix a few occurances
-
- Closes #6088
+ ... and fix a few occurances
+
+ Closes #6088
-- urlapi: URL encode a '+' in the query part
+- urlapi: URL encode a '+' in the query part
- ... when asked to with CURLU_URLENCODE.
+ ... when asked to with CURLU_URLENCODE.
- Extended test 1560 to verify.
- Reported-by: Dietmar Hauser
- Fixes #6086
- Closes #6087
+ Extended test 1560 to verify.
+ Reported-by: Dietmar Hauser
+ Fixes #6086
+ Closes #6087
-- [Cristian Morales Vega brought this change]
+- [Cristian Morales Vega brought this change]
- libcurl.pc: make it relocatable
+ libcurl.pc: make it relocatable
- It supposes when people specify the libdir/includedir they do it to
- change where under prefix/exec_prefix it should be, not to make it
- independent of prefix/exec_prefix.
+ It supposes when people specify the libdir/includedir they do it to
+ change where under prefix/exec_prefix it should be, not to make it
+ independent of prefix/exec_prefix.
- Closes #6061
+ Closes #6061
-- runtests: return error if no tests ran
-
- ... and make TESTFAIL stand out a little better by adding newlines
- before and after.
-
- Reported-by: Marc Hörsken
- Issue: #6052
- Closes #6053
+- runtests: return error if no tests ran
+
+ ... and make TESTFAIL stand out a little better by adding newlines
+ before and after.
+
+ Reported-by: Marc Hörsken
+ Issue: #6052
+ Closes #6053
-- docs/FEATURE: convert to markdown
+- docs/FEATURE: convert to markdown
- ... and clean it up a bit.
+ ... and clean it up a bit.
- Closes #6067
+ Closes #6067
+
+- [Philipp Klaus Krause brought this change]
-- [Philipp Klaus Krause brought this change]
-
- strerror: use 'const' as the string should never be modified
+ strerror: use 'const' as the string should never be modified
- Closes #6068
+ Closes #6068
-- [Jay Satiro brought this change]
+- [Jay Satiro brought this change]
- connect: repair build without ipv6 availability
+ connect: repair build without ipv6 availability
- Assisted-by: Daniel Stenberg
- Reported-by: Tom G. Christensen
+ Assisted-by: Daniel Stenberg
+ Reported-by: Tom G. Christensen
- Fixes https://github.com/curl/curl/issues/6069
- Closes https://github.com/curl/curl/pull/6071
+ Fixes https://github.com/curl/curl/issues/6069
+ Closes https://github.com/curl/curl/pull/6071
-- RELEASE-NOTES: synced
-
- Started over for the journey to next release.
+- RELEASE-NOTES: synced
+
+ Started over for the journey to next release.
-- src/tool_filetime: disable -Wformat on mingw for this file
+- src/tool_filetime: disable -Wformat on mingw for this file
+
+ With gcc 10 on mingw we otherwise get this warning:
- With gcc 10 on mingw we otherwise get this warning:
+ error: ISO C does not support the 'I' printf flag [-Werror=format=]
- error: ISO C does not support the 'I' printf flag [-Werror=format=]
-
- Fixes #6079
- Closes #6082
+ Fixes #6079
+ Closes #6082
-- test122[12]: remove these two tests
+- test122[12]: remove these two tests
- ... and remove the objnames scripts they tested. They're not used for
- anything anymore so testing them serves no purpose!
-
- Reported-by: Marc Hörsken
- Fixes #6080
- Closes #6081
+ ... and remove the objnames scripts they tested. They're not used for
+ anything anymore so testing them serves no purpose!
+
+ Reported-by: Marc Hörsken
+ Fixes #6080
+ Closes #6081
-Version 7.73.0 (14 Oct 2020)
+Version 7.73.0 (14 Oct 2020)
-Daniel Stenberg (14 Oct 2020)
-- RELEASE-NOTES: synced
+Daniel Stenberg (14 Oct 2020)
+- RELEASE-NOTES: synced
- for 7.73.0
+ for 7.73.0
-- THANKS: from 7.73.0 and .mailmap fixes
+- THANKS: from 7.73.0 and .mailmap fixes
-- mailmap: fixups of some contributors
+- mailmap: fixups of some contributors
-- projects/build-wolfssl.bat: fix the copyright year range
+- projects/build-wolfssl.bat: fix the copyright year range
-Marc Hoersken (14 Oct 2020)
-- [Sergei Nikulov brought this change]
+Marc Hoersken (14 Oct 2020)
+- [Sergei Nikulov brought this change]
- CI/tests: fix invocation of tests for CMake builds
+ CI/tests: fix invocation of tests for CMake builds
- Update appveyor.yml to set env variable TFLAGS and run tests
- Remove curly braces due to CMake error (${TFLAGS} -> $TFLAGS)
- Move testdeps build to build step (per review comments)
+ Update appveyor.yml to set env variable TFLAGS and run tests
+ Remove curly braces due to CMake error (${TFLAGS} -> $TFLAGS)
+ Move testdeps build to build step (per review comments)
- Reviewed-by: Marc Hörsken
+ Reviewed-by: Marc Hörsken
- Closes #6066
- Fixes #6052
+ Closes #6066
+ Fixes #6052
-- tests/server/util.c: fix support for Windows Unicode builds
+- tests/server/util.c: fix support for Windows Unicode builds
- Detected via #6066
- Closes #6070
+ Detected via #6066
+ Closes #6070
-Daniel Stenberg (13 Oct 2020)
-- [Jay Satiro brought this change]
+Daniel Stenberg (13 Oct 2020)
+- [Jay Satiro brought this change]
- strerror: Revert to local codepage for Windows error string
+ strerror: Revert to local codepage for Windows error string
- - Change get_winapi_error() to return the error string in the local
- codepage instead of UTF-8 encoding.
+ - Change get_winapi_error() to return the error string in the local
+ codepage instead of UTF-8 encoding.
- Two weeks ago bed5f84 fixed get_winapi_error() to work on xbox, but it
- also changed the error string's encoding from local codepage to UTF-8.
+ Two weeks ago bed5f84 fixed get_winapi_error() to work on xbox, but it
+ also changed the error string's encoding from local codepage to UTF-8.
- We return the local codepage version of the error string because if it
- is output to the user's terminal it will likely be with functions which
- expect the local codepage (eg fprintf, failf, infof).
+ We return the local codepage version of the error string because if it
+ is output to the user's terminal it will likely be with functions which
+ expect the local codepage (eg fprintf, failf, infof).
- This is essentially a partial revert of bed5f84. The support for xbox
- remains but the error string is reverted back to local codepage.
+ This is essentially a partial revert of bed5f84. The support for xbox
+ remains but the error string is reverted back to local codepage.
- Ref: https://github.com/curl/curl/pull/6005
-
- Reviewed-by: Marcel Raad
- Closes #6065
+ Ref: https://github.com/curl/curl/pull/6005
+
+ Reviewed-by: Marcel Raad
+ Closes #6065
-Marc Hoersken (13 Oct 2020)
-- CI/tests: use verification curl for test reporting APIs
+Marc Hoersken (13 Oct 2020)
+- CI/tests: use verification curl for test reporting APIs
- Avoid using our own, potentially installed, curl for
- the test reporting APIs in case it is broken.
+ Avoid using our own, potentially installed, curl for
+ the test reporting APIs in case it is broken.
- Reviewed-by: Daniel Stenberg
+ Reviewed-by: Daniel Stenberg
- Preparation for #6049
- Closes #6063
+ Preparation for #6049
+ Closes #6063
-Viktor Szakats (12 Oct 2020)
-- windows: fix comparison of mismatched types warning
+Viktor Szakats (12 Oct 2020)
+- windows: fix comparison of mismatched types warning
- clang 10, mingw-w64:
- ```
- vtls/openssl.c:2917:33: warning: comparison of integers of different signs: 'DWORD' (aka 'unsigned long') and 'HRESULT' (aka 'long')
- [-Wsign-compare]
- if(GetLastError() != CRYPT_E_NOT_FOUND)
- ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
- ```
+ clang 10, mingw-w64:
+ ```
+ vtls/openssl.c:2917:33: warning: comparison of integers of different signs: 'DWORD' (aka 'unsigned long') and 'HRESULT' (aka 'long')
+ [-Wsign-compare]
+ if(GetLastError() != CRYPT_E_NOT_FOUND)
+ ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
+ ```
- Approved-by: Daniel Stenberg
- Closes #6062
+ Approved-by: Daniel Stenberg
+ Closes #6062
-Daniel Stenberg (11 Oct 2020)
-- [Viktor Szakats brought this change]
+Daniel Stenberg (11 Oct 2020)
+- [Viktor Szakats brought this change]
- src/Makefile.m32: fix undefined curlx_dyn_* errors
+ src/Makefile.m32: fix undefined curlx_dyn_* errors
- by linking `lib/dynbuf.c` when building a static curl binary.
- Previously this source file was only included when building
- a dynamic curl binary. This was likely possibly because no
- functions from the `src/Makefile.inc` / `CURLX_CFILES` sources
- were actually required for a curl tool build. This has
- recently changed with the introduction of `curlx_dyn_*()`
- memory functions and their use by the tool sources.
+ by linking `lib/dynbuf.c` when building a static curl binary.
+ Previously this source file was only included when building
+ a dynamic curl binary. This was likely possibly because no
+ functions from the `src/Makefile.inc` / `CURLX_CFILES` sources
+ were actually required for a curl tool build. This has
+ recently changed with the introduction of `curlx_dyn_*()`
+ memory functions and their use by the tool sources.
- Closes #6060
+ Closes #6060
-- HISTORY: curl verifies SSL certs by default since version 7.10
+- HISTORY: curl verifies SSL certs by default since version 7.10
-Marc Hoersken (8 Oct 2020)
-- runtests.pl: use $LIBDIR variable instead of hardcoded path
+Marc Hoersken (8 Oct 2020)
+- runtests.pl: use $LIBDIR variable instead of hardcoded path
- Reviewed-by: Daniel Stenberg
- Closes #6051
-
-Daniel Stenberg (7 Oct 2020)
-- checksrc: detect // comments on column 0
+ Reviewed-by: Daniel Stenberg
+ Closes #6051
+
+Daniel Stenberg (7 Oct 2020)
+- checksrc: detect // comments on column 0
- Spotted while working on #6045
+ Spotted while working on #6045
- Closes #6048
+ Closes #6048
+
+- [Frederik Wedel-Heinen brought this change]
-- [Frederik Wedel-Heinen brought this change]
-
- mbedtls: add missing header when defining MBEDTLS_DEBUG
+ mbedtls: add missing header when defining MBEDTLS_DEBUG
- Closes #6045
-
-- curl: make sure setopt CURLOPT_IPRESOLVE passes on a long
+ Closes #6045
+
+- curl: make sure setopt CURLOPT_IPRESOLVE passes on a long
- Previously, it would pass on a define (int) which could make libcurl
- read junk as a value - which prevented the CURLOPT_IPRESOLVE option to
- "take". This could then make test 2100 do two DoH requests instead of
- one!
+ Previously, it would pass on a define (int) which could make libcurl
+ read junk as a value - which prevented the CURLOPT_IPRESOLVE option to
+ "take". This could then make test 2100 do two DoH requests instead of
+ one!
- Fixes #6042
- Closes #6043
-
-- RELEASE-NOTES: synced
-
-- scripts/release-notes.pl: don't "embed" $ in format string for printf()
+ Fixes #6042
+ Closes #6043
+
+- RELEASE-NOTES: synced
+
+- scripts/release-notes.pl: don't "embed" $ in format string for printf()
- ... since they might contain %-codes that mess up the output!
+ ... since they might contain %-codes that mess up the output!
-Jay Satiro (5 Oct 2020)
-- [M.R.T brought this change]
+Jay Satiro (5 Oct 2020)
+- [M.R.T brought this change]
- build-wolfssl: fix build with Visual Studio 2019
+ build-wolfssl: fix build with Visual Studio 2019
- Closes https://github.com/curl/curl/pull/6033
-
-Daniel Stenberg (4 Oct 2020)
-- runtests: add %repeat[]% for test files
+ Closes https://github.com/curl/curl/pull/6033
+
+Daniel Stenberg (4 Oct 2020)
+- runtests: add %repeat[]% for test files
- ... and use this new keywords in all the test files larger than 50K to reduce
- their sizes and make them a lot easier to read and understand.
+ ... and use this new keywords in all the test files larger than 50K to reduce
+ their sizes and make them a lot easier to read and understand.
- Closes #6040
+ Closes #6040
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- --help: move two options from the misc category
+ --help: move two options from the misc category
- The cmdline opts delegation and suppress-connect-headers
- fit better into auth and proxy rather than misc.
+ The cmdline opts delegation and suppress-connect-headers
+ fit better into auth and proxy rather than misc.
- Follow-up to aa8777f63febc
- Closes #6038
+ Follow-up to aa8777f63febc
+ Closes #6038
-- [Samanta Navarro brought this change]
+- [Samanta Navarro brought this change]
- docs/opts: fix typos in two manual pages
+ docs/opts: fix typos in two manual pages
- Closes #6039
-
-- ldap: reduce the amount of #ifdefs needed
+ Closes #6039
+
+- ldap: reduce the amount of #ifdefs needed
- Closes #6035
+ Closes #6035
-- runtests: provide curl's version string as %VERSION for tests
+- runtests: provide curl's version string as %VERSION for tests
- ... so that we can check HTTP requests for User-Agent: curl/%VERSION
+ ... so that we can check HTTP requests for User-Agent: curl/%VERSION
- Update 600+ test cases accordingly.
+ Update 600+ test cases accordingly.
- Closes #6037
+ Closes #6037
-- checksrc: warn on space after exclamation mark
+- checksrc: warn on space after exclamation mark
- Closes #6034
-
-- test1465: verify --libcurl with binary POST data
-
-- runtests: allow generating a binary sequence from hex
-
-- tool_setopt: escape binary data to hex, not octal
-
-- curl: make --libcurl show binary posts correctly
+ Closes #6034
+
+- test1465: verify --libcurl with binary POST data
+
+- runtests: allow generating a binary sequence from hex
+
+- tool_setopt: escape binary data to hex, not octal
+
+- curl: make --libcurl show binary posts correctly
- Reported-by: Stephan Mühlstrasser
- Fixes #6031
- Closes #6032
+ Reported-by: Stephan Mühlstrasser
+ Fixes #6031
+ Closes #6032
-Jay Satiro (1 Oct 2020)
-- strerror: fix null deref on winapi out-of-memory
+Jay Satiro (1 Oct 2020)
+- strerror: fix null deref on winapi out-of-memory
- Follow-up to bed5f84 from several days ago.
+ Follow-up to bed5f84 from several days ago.
- Ref: https://github.com/curl/curl/pull/6005
+ Ref: https://github.com/curl/curl/pull/6005
+
+Daniel Stenberg (1 Oct 2020)
+- [Kamil Dudka brought this change]
-Daniel Stenberg (1 Oct 2020)
-- [Kamil Dudka brought this change]
-
- vtls: deduplicate some DISABLE_PROXY ifdefs
+ vtls: deduplicate some DISABLE_PROXY ifdefs
- ... in the code of gtls, nss, and openssl
+ ... in the code of gtls, nss, and openssl
- Closes #5735
+ Closes #5735
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- TODO: Add OpenBSD libtool notice
+ TODO: Add OpenBSD libtool notice
- See #5862
- Closes #6030
+ See #5862
+ Closes #6030
-- tests/unit/README: convert to markdown
+- tests/unit/README: convert to markdown
- ... and add to dist!
+ ... and add to dist!
- Closes #6028
+ Closes #6028
-- tests/README: convert to markdown
+- tests/README: convert to markdown
- Closes #6028
-
-- include/README: convert to markdown
+ Closes #6028
+
+- include/README: convert to markdown
- Closes #6028
+ Closes #6028
-- examples/README: convert to markdown
-
- Closes #6028
+- examples/README: convert to markdown
+
+ Closes #6028
-- configure: don't say HTTPS-proxy is enabled when disabled!
+- configure: don't say HTTPS-proxy is enabled when disabled!
- Reported-by: Kamil Dudka
- Reviewed-by: Kamil Dudka
- Bug: https://github.com/curl/curl/pull/5735#issuecomment-701376388
- Closes #6029
-
-Daniel Gustafsson (30 Sep 2020)
-- src: Consistently spell whitespace without whitespace
+ Reported-by: Kamil Dudka
+ Reviewed-by: Kamil Dudka
+ Bug: https://github.com/curl/curl/pull/5735#issuecomment-701376388
+ Closes #6029
+
+Daniel Gustafsson (30 Sep 2020)
+- src: Consistently spell whitespace without whitespace
- Whitespace is spelled without a space between white and space, so
- make sure to consistently spell it that way across the codebase.
+ Whitespace is spelled without a space between white and space, so
+ make sure to consistently spell it that way across the codebase.
- Closes #6023
- Reviewed-by: Daniel Stenberg <daniel@haxx.se>
- Reviewed-by: Emil Engler <me@emilengler.com>
+ Closes #6023
+ Reviewed-by: Daniel Stenberg <daniel@haxx.se>
+ Reviewed-by: Emil Engler <me@emilengler.com>
-- MANUAL: update examples to resolve without redirects
-
- www.netscape.com is redirecting to a cookie consent form on Aol, and
- cool.haxx.se isn't responding to FTP anymore. Replace with examples
- that resolves in case users try out the commands when reading the
- manual.
-
- Closes #6024
- Reviewed-by: Daniel Stenberg <daniel@haxx.se>
- Reviewed-by: Emil Engler <me@emilengler.com>
+- MANUAL: update examples to resolve without redirects
+
+ www.netscape.com is redirecting to a cookie consent form on Aol, and
+ cool.haxx.se isn't responding to FTP anymore. Replace with examples
+ that resolves in case users try out the commands when reading the
+ manual.
+
+ Closes #6024
+ Reviewed-by: Daniel Stenberg <daniel@haxx.se>
+ Reviewed-by: Emil Engler <me@emilengler.com>
-Daniel Stenberg (30 Sep 2020)
-- HISTORY: add some 2020 events
+Daniel Stenberg (30 Sep 2020)
+- HISTORY: add some 2020 events
-- sectransp: make it build with --disable-proxy
-
- Follow-up from #5466 and f3d501dc678d80
- Reported-by: Javier Navarro
- Fixes #6025
- Closes #6026
+- sectransp: make it build with --disable-proxy
+
+ Follow-up from #5466 and f3d501dc678d80
+ Reported-by: Javier Navarro
+ Fixes #6025
+ Closes #6026
-- ECH: renamed from ESNI in docs and configure
+- ECH: renamed from ESNI in docs and configure
- Encrypted Client Hello (ECH) is the current name.
+ Encrypted Client Hello (ECH) is the current name.
- Closes #6022
+ Closes #6022
-- configure: use "no" instead of "disabled" for the end summary
-
- ... for consistency but also to make them more distinctly stand out next
- to the "enabled" lines.
+- configure: use "no" instead of "disabled" for the end summary
+
+ ... for consistency but also to make them more distinctly stand out next
+ to the "enabled" lines.
-- TODO: SSH over HTTPS proxy with more backends
-
- ... as right now only the libssh2 backend supports it.
+- TODO: SSH over HTTPS proxy with more backends
+
+ ... as right now only the libssh2 backend supports it.
-- libssh2: handle the SSH protocols done over HTTPS proxy
-
- Reported-by: Robin Douine
- Fixes #4295
- Closes #6021
+- libssh2: handle the SSH protocols done over HTTPS proxy
+
+ Reported-by: Robin Douine
+ Fixes #4295
+ Closes #6021
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- memdebug: remove 9 year old unused debug function
+ memdebug: remove 9 year old unused debug function
- There used to be a way to have memdebug fill allocated memory. 9 years
- later this has no value there (valgrind and ASAN etc are way better). If
- people need to know about it they can have a look at VCS logs.
+ There used to be a way to have memdebug fill allocated memory. 9 years
+ later this has no value there (valgrind and ASAN etc are way better). If
+ people need to know about it they can have a look at VCS logs.
- Closes #5973
+ Closes #5973
-- sendf: move Curl_sendf to dict.c and make it static
+- sendf: move Curl_sendf to dict.c and make it static
- ... as the only remaining user of that function. Also fix gopher.c to
- instead use Curl_write()
+ ... as the only remaining user of that function. Also fix gopher.c to
+ instead use Curl_write()
- Closes #6020
+ Closes #6020
-- ROADMAP: updates and cleanups
+- ROADMAP: updates and cleanups
+
+ Fix the HSTS PR
- Fix the HSTS PR
-
- Remove DoT, thread-safe init and hard-coded localhost. I feel very
- little interest for these with users so I downgrade them to plain "TODO"
- entries again.
+ Remove DoT, thread-safe init and hard-coded localhost. I feel very
+ little interest for these with users so I downgrade them to plain "TODO"
+ entries again.
-- schannel: return CURLE_PEER_FAILED_VERIFICATION for untrusted root
+- schannel: return CURLE_PEER_FAILED_VERIFICATION for untrusted root
- This matches what is returned in other TLS backends in the same
- situation.
+ This matches what is returned in other TLS backends in the same
+ situation.
- Reviewed-by: Jay Satiro
- Reviewed-by: Emil Engler
- Follow-up to 5a3efb1
- Reported-by: iammrtau on github
- Fixes #6003
- Closes #6018
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Emil Engler
+ Follow-up to 5a3efb1
+ Reported-by: iammrtau on github
+ Fixes #6003
+ Closes #6018
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- ftp: make a 552 response return CURLE_REMOTE_DISK_FULL
+- ftp: make a 552 response return CURLE_REMOTE_DISK_FULL
- Added test 348 to verify. Added a 'STOR' command to the test FTP
- server to enable test 348. Documented the command in FILEFORMAT.md
+ Added test 348 to verify. Added a 'STOR' command to the test FTP
+ server to enable test 348. Documented the command in FILEFORMAT.md
- Reported-by: Duncan Wilcox
- Fixes #6016
- Closes #6017
+ Reported-by: Duncan Wilcox
+ Fixes #6016
+ Closes #6017
-- pause: only trigger a reread if the unpause sticks
+- pause: only trigger a reread if the unpause sticks
+
+ As an unpause might itself get paused again and then triggering another
+ reread doesn't help.
- As an unpause might itself get paused again and then triggering another
- reread doesn't help.
+ Follow-up from e040146f22608fd9 (shipped since 7.69.1)
- Follow-up from e040146f22608fd9 (shipped since 7.69.1)
-
- Bug: https://curl.haxx.se/mail/lib-2020-09/0081.html
- Patch-by: Kunal Chandarana
- Fixes #5988
- Closes #6013
+ Bug: https://curl.haxx.se/mail/lib-2020-09/0081.html
+ Patch-by: Kunal Chandarana
+ Fixes #5988
+ Closes #6013
-- test163[12]: require http to be built-in to run
+- test163[12]: require http to be built-in to run
- ... as speaking over an HTTPS proxy implies http!
+ ... as speaking over an HTTPS proxy implies http!
- Closes #6014
-
-- ngtcp2: adapt to new NGTCP2_PROTO_VER_MAX define
+ Closes #6014
+
+- ngtcp2: adapt to new NGTCP2_PROTO_VER_MAX define
- Closes #6012
-
-- [Javier Blazquez brought this change]
-
- strerror: honor Unicode API choice on Windows
+ Closes #6012
+
+- [Javier Blazquez brought this change]
+
+ strerror: honor Unicode API choice on Windows
- Closes #6005
+ Closes #6005
-- imap: make imap_send use dynbuf for the send buffer management
+- imap: make imap_send use dynbuf for the send buffer management
- Reuses the buffer and thereby reduces number of mallocs over a transfer.
+ Reuses the buffer and thereby reduces number of mallocs over a transfer.
- Closes #6010
+ Closes #6010
-- Curl_send: return error when pre_receive_plain can't malloc
+- Curl_send: return error when pre_receive_plain can't malloc
- ... will probably trigger some false DEAD CODE positives on non-windows
- code analyzers for the conditional code.
+ ... will probably trigger some false DEAD CODE positives on non-windows
+ code analyzers for the conditional code.
- Closes #6011
+ Closes #6011
-- ftp: separate FTPS from FTP over "HTTPS proxy"
+- ftp: separate FTPS from FTP over "HTTPS proxy"
+
+ When using HTTPS proxy, SSL is used but not in the view of the FTP
+ protocol handler itself so separate the connection's use of SSL from the
+ FTP control connection's sue.
- When using HTTPS proxy, SSL is used but not in the view of the FTP
- protocol handler itself so separate the connection's use of SSL from the
- FTP control connection's sue.
-
- Reported-by: Mingtao Yang
- Fixes #5523
- Closes #6006
+ Reported-by: Mingtao Yang
+ Fixes #5523
+ Closes #6006
-Dan Fandrich (23 Sep 2020)
-- tests/data: Fix some mismatched XML tags in test cases
+Dan Fandrich (23 Sep 2020)
+- tests/data: Fix some mismatched XML tags in test cases
- This allows these test files to pass xmllint.
+ This allows these test files to pass xmllint.
-Daniel Stenberg (23 Sep 2020)
-- pingpong: use a dynbuf for the *_pp_sendf() function
+Daniel Stenberg (23 Sep 2020)
+- pingpong: use a dynbuf for the *_pp_sendf() function
- ... reuses the same dynamic buffer instead of doing repeated malloc/free
- cycles.
+ ... reuses the same dynamic buffer instead of doing repeated malloc/free
+ cycles.
- Test case 100 (FTP dir list PASV) does 7 fewer memory allocation calls
- after this change in my test setup (132 => 125), curl 7.72.0 needed 140
- calls for this.
+ Test case 100 (FTP dir list PASV) does 7 fewer memory allocation calls
+ after this change in my test setup (132 => 125), curl 7.72.0 needed 140
+ calls for this.
- Test case 103 makes 9 less allocations now (130). Down from 149 in
- 7.72.0.
+ Test case 103 makes 9 less allocations now (130). Down from 149 in
+ 7.72.0.
- Closes #6004
+ Closes #6004
-- dynbuf: add Curl_dyn_vaddf
+- dynbuf: add Curl_dyn_vaddf
- Closes #6004
+ Closes #6004
-- dynbuf: make *addf() not require extra mallocs
+- dynbuf: make *addf() not require extra mallocs
- ... by introducing a printf() function that appends directly into a
- dynbuf: Curl_dyn_vprintf(). This avoids the mandatory extra malloc so if
- the buffer is already big enough it can just printf directly into it.
+ ... by introducing a printf() function that appends directly into a
+ dynbuf: Curl_dyn_vprintf(). This avoids the mandatory extra malloc so if
+ the buffer is already big enough it can just printf directly into it.
- Since this less-malloc version requires tthe use of a library internal
- printf function, we only provide this version when building libcurl and
- not for the dynbuf code that is used when building the curl tool.
+ Since this less-malloc version requires tthe use of a library internal
+ printf function, we only provide this version when building libcurl and
+ not for the dynbuf code that is used when building the curl tool.
- Closes #5998
+ Closes #5998
-- KNOWN_BUGS: Unable to use PKCS12 certificate with Secure Transport
-
- Closes #5403
+- KNOWN_BUGS: Unable to use PKCS12 certificate with Secure Transport
+
+ Closes #5403
-- pingpong: remove a malloc per Curl_pp_vsendf call
+- pingpong: remove a malloc per Curl_pp_vsendf call
- This typically makes 7-9 fewer mallocs per FTP transfer.
+ This typically makes 7-9 fewer mallocs per FTP transfer.
- Closes #5997
-
-- symbian: drop support
+ Closes #5997
+
+- symbian: drop support
- The OS is deprecated. I see no traces of anyone having actually built
- curl for Symbian after 2012.
+ The OS is deprecated. I see no traces of anyone having actually built
+ curl for Symbian after 2012.
- The public headers are unmodified.
+ The public headers are unmodified.
- Closes #5989
+ Closes #5989
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- curl_krb5.h: rename from krb5.h
+- curl_krb5.h: rename from krb5.h
- Follow-up from f4873ebd0be32cf
-
- Turns out some older openssl installations go bananas otherwise.
- Reported-by: Tom van der Woerdt
- Fixes #5995
- Closes #5996
+ Follow-up from f4873ebd0be32cf
+
+ Turns out some older openssl installations go bananas otherwise.
+ Reported-by: Tom van der Woerdt
+ Fixes #5995
+ Closes #5996
-- test1297: verify GOT_NOTHING with http proxy tunnel
+- test1297: verify GOT_NOTHING with http proxy tunnel
-- http_proxy: do not count proxy headers in the header bytecount
+- http_proxy: do not count proxy headers in the header bytecount
- ... as that counter is subsequently used to detect if nothing was
- returned from the peer. This made curl return CURLE_OK when it should
- have returned CURLE_GOT_NOTHING.
+ ... as that counter is subsequently used to detect if nothing was
+ returned from the peer. This made curl return CURLE_OK when it should
+ have returned CURLE_GOT_NOTHING.
- Fixes #5992
- Reported-by: Tom van der Woerdt
- Closes #5994
+ Fixes #5992
+ Reported-by: Tom van der Woerdt
+ Closes #5994
-- setopt: return CURLE_BAD_FUNCTION_ARGUMENT on bad argument
-
- Fixed two return code mixups. CURLE_UNKNOWN_OPTION is saved for when the
- option is, yeah, not known. Clarified this in the setopt man page too.
-
- Closes #5993
+- setopt: return CURLE_BAD_FUNCTION_ARGUMENT on bad argument
+
+ Fixed two return code mixups. CURLE_UNKNOWN_OPTION is saved for when the
+ option is, yeah, not known. Clarified this in the setopt man page too.
+
+ Closes #5993
-- krb5: merged security.c and krb specific FTP functions in here
+- krb5: merged security.c and krb specific FTP functions in here
- These two files were always tightly connected and it was hard to
- understand what went into which. This also allows us to make the
- ftpsend() function static (moved from ftp.c).
+ These two files were always tightly connected and it was hard to
+ understand what went into which. This also allows us to make the
+ ftpsend() function static (moved from ftp.c).
- Removed security.c
- Renamed curl_sec.h to krb5.h
+ Removed security.c
+ Renamed curl_sec.h to krb5.h
- Closes #5987
+ Closes #5987
-- Curl_handler: add 'family' to each protocol
+- Curl_handler: add 'family' to each protocol
- Makes get_protocol_family() faster and it moves the knowledge about the
- "families" to each protocol handler, where it belongs.
+ Makes get_protocol_family() faster and it moves the knowledge about the
+ "families" to each protocol handler, where it belongs.
- Closes #5986
+ Closes #5986
-- parsedate: tune the date to epoch conversion
+- parsedate: tune the date to epoch conversion
- By avoiding an unnecessary error check and the temp use of the tm
- struct, the time2epoch conversion function gets a little bit faster.
- When repeating test 517, the updated version is perhaps 1% faster (on
- one particular build on one particular architecture).
+ By avoiding an unnecessary error check and the temp use of the tm
+ struct, the time2epoch conversion function gets a little bit faster.
+ When repeating test 517, the updated version is perhaps 1% faster (on
+ one particular build on one particular architecture).
- Closes #5985
+ Closes #5985
-- cmake: remove scary warning
+- cmake: remove scary warning
- Remove the text saying
+ Remove the text saying
- "the curl cmake build system is poorly maintained. Be aware"
+ "the curl cmake build system is poorly maintained. Be aware"
- ... not because anything changed just now, but to encourage users to use
- it and subsequently improve it.
+ ... not because anything changed just now, but to encourage users to use
+ it and subsequently improve it.
- Closes #5984
+ Closes #5984
-- docs/MQTT: remove outdated paaragraphs
+- docs/MQTT: remove outdated paaragraphs
-- docs/MQTT: not experimental anymore
-
- Follow-up to e37e4468688d8f
+- docs/MQTT: not experimental anymore
+
+ Follow-up to e37e4468688d8f
-- docs/RESOURCES: remove
+- docs/RESOURCES: remove
- This document is not maintained and rather than trying to refresh it,
- let's kill it. A more up-to-date document with relevant RFCs is this
- page on the curl website: https://curl.haxx.se/rfc/
+ This document is not maintained and rather than trying to refresh it,
+ let's kill it. A more up-to-date document with relevant RFCs is this
+ page on the curl website: https://curl.haxx.se/rfc/
- Closes #5980
+ Closes #5980
-- docs/TheArtOfHttpScripting: convert to markdown
+- docs/TheArtOfHttpScripting: convert to markdown
+
+ Makes it easier to browse on github etc. Offers (better) links.
- Makes it easier to browse on github etc. Offers (better) links.
+ It should be noted that this document is already mostly outdated and
+ "Everything curl" at https://ec.haxx.se/ is a better resource and
+ tutorial.
- It should be noted that this document is already mostly outdated and
- "Everything curl" at https://ec.haxx.se/ is a better resource and
- tutorial.
-
- Closes #5981
+ Closes #5981
-- BUGS: convert document to markdown
-
- Closes #5979
+- BUGS: convert document to markdown
+
+ Closes #5979
-- --help: strdup the category
+- --help: strdup the category
- ... since it is converted and the original pointer is freed on Windows
- unicode handling.
+ ... since it is converted and the original pointer is freed on Windows
+ unicode handling.
- Follow-up to aa8777f63febc
- Fixes #5977
- Closes #5978
- Reported-by: xwxbug on github
+ Follow-up to aa8777f63febc
+ Fixes #5977
+ Closes #5978
+ Reported-by: xwxbug on github
-- CHECKSRC: document two missing warnings
+- CHECKSRC: document two missing warnings
- RELEASE-NOTES: synced
-- ftp: avoid risk of reading uninitialized integers
+- ftp: avoid risk of reading uninitialized integers
- If the received PASV response doesn't match the expected pattern, we
- could end up reading uninitialized integers for IP address and port
- number.
+ If the received PASV response doesn't match the expected pattern, we
+ could end up reading uninitialized integers for IP address and port
+ number.
- Issue pointed out by muse.dev
- Closes #5972
+ Issue pointed out by muse.dev
+ Closes #5972
-- [Quentin Balland brought this change]
+- [Quentin Balland brought this change]
- easy_reset: clear retry counter
+ easy_reset: clear retry counter
- Closes #5975
- Fixes #5974
-
-- ftp: get rid of the PPSENDF macro
+ Closes #5975
+ Fixes #5974
+
+- ftp: get rid of the PPSENDF macro
- The use of such a macro hides some of what's actually going on to the
- reader and is generally disapproved of in the project.
-
- Closes #5971
+ The use of such a macro hides some of what's actually going on to the
+ reader and is generally disapproved of in the project.
+
+ Closes #5971
-- man pages: switch to https://example.com URLs
+- man pages: switch to https://example.com URLs
- Since HTTPS is "the new normal", this update changes a lot of man page
- examples to use https://example.com instead of the previous "http://..."
+ Since HTTPS is "the new normal", this update changes a lot of man page
+ examples to use https://example.com instead of the previous "http://..."
- Closes #5969
+ Closes #5969
-- github: remove the duplicate "Security vulnerability" entry
+- github: remove the duplicate "Security vulnerability" entry
- ... since github adds an entry automatically by itself.
+ ... since github adds an entry automatically by itself.
- Closes #5970
+ Closes #5970
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- github: use new issue template feature
+ github: use new issue template feature
- This helps us to avoid getting feature requests as well as security
- bugs reported into the issue tracker.
+ This helps us to avoid getting feature requests as well as security
+ bugs reported into the issue tracker.
- Closes #5936
+ Closes #5936
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- urlapi: use more Curl_safefree
+ urlapi: use more Curl_safefree
- Closes #5968
-
-Marc Hoersken (17 Sep 2020)
-- multi: align WinSock mask variables in Curl_multi_wait
+ Closes #5968
+
+Marc Hoersken (17 Sep 2020)
+- multi: align WinSock mask variables in Curl_multi_wait
- Also skip pre-checking sockets to set timeout_ms to 0
- after the first socket has been detected to be ready.
+ Also skip pre-checking sockets to set timeout_ms to 0
+ after the first socket has been detected to be ready.
- Reviewed-by: rcombs on github
- Reviewed-by: Daniel Stenberg
+ Reviewed-by: rcombs on github
+ Reviewed-by: Daniel Stenberg
- Follow up to #5886
+ Follow up to #5886
-- multi: reuse WinSock events variable in Curl_multi_wait
+- multi: reuse WinSock events variable in Curl_multi_wait
+
+ Since the struct is quite large (1 long and 10 ints) we
+ declare it once at the beginning of the function instead
+ of multiple times inside loops to avoid stack movements.
- Since the struct is quite large (1 long and 10 ints) we
- declare it once at the beginning of the function instead
- of multiple times inside loops to avoid stack movements.
+ Reviewed-by: Viktor Szakats
+ Reviewed-by: Daniel Stenberg
- Reviewed-by: Viktor Szakats
- Reviewed-by: Daniel Stenberg
-
- Closes #5886
+ Closes #5886
-Daniel Stenberg (16 Sep 2020)
-- TODO: dynamically decide to use socketpair
+Daniel Stenberg (16 Sep 2020)
+- TODO: dynamically decide to use socketpair
- Suggested-by: Anders Bakken
+ Suggested-by: Anders Bakken
- Closes #4829
-
-- TODO: add PR reference for native IDN support on macOS
+ Closes #4829
+
+- TODO: add PR reference for native IDN support on macOS
- As there was work started on this that never got completed.
+ As there was work started on this that never got completed.
- Closes #5371
-
-- tool_help.h: update copyright year range
+ Closes #5371
+
+- tool_help.h: update copyright year range
- Follow-up from aa8777f63febca
+ Follow-up from aa8777f63febca
-- CI/azure: disable test 571 in the msys2 builds
+- CI/azure: disable test 571 in the msys2 builds
- It's just too flaky there
+ It's just too flaky there
- Reviewed-by: Marc Hoersken
- Closes #5954
+ Reviewed-by: Marc Hoersken
+ Closes #5954
-- tool_writeout: protect fputs() from NULL
+- tool_writeout: protect fputs() from NULL
- When the code was changed to do fputs() instead of fprintf() it got
- sensitive for NULL pointers; add checks for that.
+ When the code was changed to do fputs() instead of fprintf() it got
+ sensitive for NULL pointers; add checks for that.
- Follow-up from 0c1e767e83ec66
+ Follow-up from 0c1e767e83ec66
- Closes #5963
+ Closes #5963
-- test3015: verify stdout "as text"
+- test3015: verify stdout "as text"
- Follow-up from 0c1e767e83e to please win32 tests
-
- Closes #5962
+ Follow-up from 0c1e767e83e to please win32 tests
+
+ Closes #5962
-- travis: use libressl v3.1.4 instead of master
+- travis: use libressl v3.1.4 instead of master
+
+ ... as their git master seems too fragile to use (and 3.2.1 which is the
+ latest has a build failure).
- ... as their git master seems too fragile to use (and 3.2.1 which is the
- latest has a build failure).
-
- Closes #5964
+ Closes #5964
-- tests/FILEFORMAT: document type=shell for <command>
+- tests/FILEFORMAT: document type=shell for <command>
-- tests/FILEFORMAT: document nonewline support for <file>
+- tests/FILEFORMAT: document nonewline support for <file>
- The one in <client>, that creates files.
+ The one in <client>, that creates files.
- Follow-up from b83947c8df7
+ Follow-up from b83947c8df7
-- [anio brought this change]
+- [anio brought this change]
- tool_writeout: add new writeout variable, %{num_headers}
+ tool_writeout: add new writeout variable, %{num_headers}
- This variable gives the number of headers.
+ This variable gives the number of headers.
- Closes #5947
+ Closes #5947
-- tool_urlglob: fix compiler warning "unreachable code"
+- tool_urlglob: fix compiler warning "unreachable code"
- (On Windows builds.)
+ (On Windows builds.)
- Follow-up to 70a3b003d9
+ Follow-up to 70a3b003d9
-- [Gergely Nagy brought this change]
+- [Gergely Nagy brought this change]
- vtls: deduplicate client certificates in ssl_config_data
+ vtls: deduplicate client certificates in ssl_config_data
- Closes #5629
+ Closes #5629
-- ftp: a 550 response to SIZE returns CURLE_REMOTE_FILE_NOT_FOUND
+- ftp: a 550 response to SIZE returns CURLE_REMOTE_FILE_NOT_FOUND
- This is primarily interesting for cases where CURLOPT_NOBODY is set as
- previously curl would not return an error for this case.
+ This is primarily interesting for cases where CURLOPT_NOBODY is set as
+ previously curl would not return an error for this case.
- MDTM getting 550 now also returns this error (it returned
- CURLE_FTP_COULDNT_RETR_FILE before) in order to unify return codes for
- missing files across protocols and specific FTP commands.
+ MDTM getting 550 now also returns this error (it returned
+ CURLE_FTP_COULDNT_RETR_FILE before) in order to unify return codes for
+ missing files across protocols and specific FTP commands.
- libcurl already returns error on a 550 as a MDTM response (when
- CURLOPT_FILETIME is set). If CURLOPT_NOBODY is not set, an error would
- happen subsequently anyway since the RETR command would fail.
+ libcurl already returns error on a 550 as a MDTM response (when
+ CURLOPT_FILETIME is set). If CURLOPT_NOBODY is not set, an error would
+ happen subsequently anyway since the RETR command would fail.
- Add test 1913 and 1914 to verify. Updated several tests accordingly due
- to the updated SIZE behavior.
+ Add test 1913 and 1914 to verify. Updated several tests accordingly due
+ to the updated SIZE behavior.
- Reported-by: Tomas Berger
- Fixes #5953
- Closes #5957
+ Reported-by: Tomas Berger
+ Fixes #5953
+ Closes #5957
-- curl: make checkpasswd use dynbuf
-
- Closes #5952
+- curl: make checkpasswd use dynbuf
+
+ Closes #5952
-- curl: make glob_match_url use dynbuf
-
- Closes #5952
+- curl: make glob_match_url use dynbuf
+
+ Closes #5952
-- curl: make file2memory use dynbuf
+- curl: make file2memory use dynbuf
- Closes #5952
+ Closes #5952
-- curl: make file2string use dynbuf
+- curl: make file2string use dynbuf
- Closes #5952
+ Closes #5952
-- [Antarpreet Singh brought this change]
+- [Antarpreet Singh brought this change]
- imap: set cselect_bits to CURL_CSELECT_IN initially
+ imap: set cselect_bits to CURL_CSELECT_IN initially
- ... when continuing a transfer from a FETCH response.
+ ... when continuing a transfer from a FETCH response.
- When the size of the file was small enough that the entirety of the
- transfer happens in a single go and schannel buffers holds the entire
- data. However, it wasn't completely read in Curl_pp_readresp since a
- line break was found before that could happen. So, by the time we are in
- imap_state_fetch_resp - there's data in buffers that needs to be read
- via Curl_read but nothing to read from the socket. After we setup a
- transfer (Curl_setup_transfer), curl just waits on the socket state to
- change - which doesn't happen since no new data ever comes.
+ When the size of the file was small enough that the entirety of the
+ transfer happens in a single go and schannel buffers holds the entire
+ data. However, it wasn't completely read in Curl_pp_readresp since a
+ line break was found before that could happen. So, by the time we are in
+ imap_state_fetch_resp - there's data in buffers that needs to be read
+ via Curl_read but nothing to read from the socket. After we setup a
+ transfer (Curl_setup_transfer), curl just waits on the socket state to
+ change - which doesn't happen since no new data ever comes.
- Closes #5961
+ Closes #5961
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- test434: test -K use in a single line without newline
+- test434: test -K use in a single line without newline
- Closes #5946
+ Closes #5946
-- runtests: allow creating files without newlines
+- runtests: allow creating files without newlines
- Closes #5946
+ Closes #5946
-- curl: use curlx_dynbuf for realloc when loading config files
+- curl: use curlx_dynbuf for realloc when loading config files
- ... fixes an integer overflow at the same time.
+ ... fixes an integer overflow at the same time.
- Reported-by: ihsinme on github
- Assisted-by: Jay Satiro
+ Reported-by: ihsinme on github
+ Assisted-by: Jay Satiro
- Closes #5946
+ Closes #5946
-- dynbuf: provide curlx_ names for reuse by the curl tool
+- dynbuf: provide curlx_ names for reuse by the curl tool
- Closes #5946
+ Closes #5946
-- dynbuf: make sure Curl_dyn_tail() zero terminates
+- dynbuf: make sure Curl_dyn_tail() zero terminates
- Closes #5959
+ Closes #5959
-- tests: add test1912 to the dist
+- tests: add test1912 to the dist
- Follow-up to 70984ce1be4cab6c
+ Follow-up to 70984ce1be4cab6c
-- docs/LICENSE-MIXING: remove
+- docs/LICENSE-MIXING: remove
- This document is not maintained and I feel that it doesn't provide much
- value to users anymore (if it ever did).
+ This document is not maintained and I feel that it doesn't provide much
+ value to users anymore (if it ever did).
- Closes #5955
+ Closes #5955
-- [Laramie Leavitt brought this change]
+- [Laramie Leavitt brought this change]
- http: consolidate nghttp2_session_mem_recv() call paths
+ http: consolidate nghttp2_session_mem_recv() call paths
+
+ Previously there were several locations that called
+ nghttp2_session_mem_recv and handled responses slightly differently.
+ Those have been converted to call the existing
+ h2_process_pending_input() function.
+
+ Moved the end-of-session check to h2_process_pending_input() since the
+ only place the end-of-session state can change is after nghttp2
+ processes additional input frames.
- Previously there were several locations that called
- nghttp2_session_mem_recv and handled responses slightly differently.
- Those have been converted to call the existing
- h2_process_pending_input() function.
+ This will likely fix the fuzzing error. While I don't have a root cause
+ the out-of-bounds read seems like a use after free, so moving the
+ nghttp2_session_check_request_allowed() call to a location with a
+ guaranteed nghttp2 session seems reasonable.
- Moved the end-of-session check to h2_process_pending_input() since the
- only place the end-of-session state can change is after nghttp2
- processes additional input frames.
+ Also updated a few nghttp2 callsites to include error messages and added
+ a few additional error checks.
- This will likely fix the fuzzing error. While I don't have a root cause
- the out-of-bounds read seems like a use after free, so moving the
- nghttp2_session_check_request_allowed() call to a location with a
- guaranteed nghttp2 session seems reasonable.
-
- Also updated a few nghttp2 callsites to include error messages and added
- a few additional error checks.
-
- Closes #5648
+ Closes #5648
-- HISTORY: mention alt-svc added in 2019
-
- ... and make 1996 the first year subtitle
+- HISTORY: mention alt-svc added in 2019
+
+ ... and make 1996 the first year subtitle
-- base64: also build for pop3 and imap
+- base64: also build for pop3 and imap
- Follow-up to the fix in 20417a13fb8f83
+ Follow-up to the fix in 20417a13fb8f83
- Reported-by: Michael Olbrich
- Fixes #5937
- Closes #5948
+ Reported-by: Michael Olbrich
+ Fixes #5937
+ Closes #5948
-- base64: enable in build with SMTP
+- base64: enable in build with SMTP
- The oauth2 support is used with SMTP and it uses base64 functions.
+ The oauth2 support is used with SMTP and it uses base64 functions.
- Reported-by: Michael Olbrich
- Fixes #5937
- Closes #5938
+ Reported-by: Michael Olbrich
+ Fixes #5937
+ Closes #5938
-- curl_mime_headers.3: fix the example's use of curl_slist_append
+- curl_mime_headers.3: fix the example's use of curl_slist_append
- Reported-by: sofaboss on github
- Fixes #5942
- Closes #5943
-
-- lib583: fix enum mixup
+ Reported-by: sofaboss on github
+ Fixes #5942
+ Closes #5943
+
+- lib583: fix enum mixup
- grrr the previous follow-up to 17fcdf6a31 was wrong
+ grrr the previous follow-up to 17fcdf6a31 was wrong
-- libtest: fix build errors
+- libtest: fix build errors
- Follow-up from 17fcdf6a310d4c8076
+ Follow-up from 17fcdf6a310d4c8076
-- lib: fix -Wassign-enum warnings
+- lib: fix -Wassign-enum warnings
- configure --enable-debug now enables -Wassign-enum with clang,
- identifying several enum "abuses" also fixed.
+ configure --enable-debug now enables -Wassign-enum with clang,
+ identifying several enum "abuses" also fixed.
- Reported-by: Gisle Vanem
- Bug: https://github.com/curl/curl/commit/879007f8118771f4896334731aaca5850a154675#commitcomment-42087553
+ Reported-by: Gisle Vanem
+ Bug: https://github.com/curl/curl/commit/879007f8118771f4896334731aaca5850a154675#commitcomment-42087553
- Closes #5929
+ Closes #5929
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- [Diven Qi brought this change]
+- [Diven Qi brought this change]
- url: use blank credentials when using proxy w/o username and password
+ url: use blank credentials when using proxy w/o username and password
- Fixes proxy regression brought in commit ad829b21ae (7.71.0)
+ Fixes proxy regression brought in commit ad829b21ae (7.71.0)
- Fixed #5911
- Closes #5914
+ Fixed #5911
+ Closes #5914
-- travis: add a build using libressl (from git master)
+- travis: add a build using libressl (from git master)
- The v3.2.1 tag (latest release atm) results in a broken build.
+ The v3.2.1 tag (latest release atm) results in a broken build.
- Closes #5932
+ Closes #5932
-- configure: let --enable-debug set -Wenum-conversion with gcc >= 10
+- configure: let --enable-debug set -Wenum-conversion with gcc >= 10
- Unfortunately, this option is not detecting the same issues as clang's
- -Wassign-enum flag, but should still be useful to detect future
- mistakes.
+ Unfortunately, this option is not detecting the same issues as clang's
+ -Wassign-enum flag, but should still be useful to detect future
+ mistakes.
- Closes #5930
+ Closes #5930
-- openssl: consider ALERT_CERTIFICATE_EXPIRED a failed verification
+- openssl: consider ALERT_CERTIFICATE_EXPIRED a failed verification
- If the error reason from the lib is
- SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED, libcurl will return
- CURLE_PEER_FAILED_VERIFICATION and not CURLE_SSL_CONNECT_ERROR.
+ If the error reason from the lib is
+ SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED, libcurl will return
+ CURLE_PEER_FAILED_VERIFICATION and not CURLE_SSL_CONNECT_ERROR.
- This unifies the libcurl return code and makes libressl run test 313
- (CRL testing) fine.
+ This unifies the libcurl return code and makes libressl run test 313
+ (CRL testing) fine.
- Closes #5934
+ Closes #5934
-- FAQ: refreshed some very old language
+- FAQ: refreshed some very old language
-- cmake: make HTTP_ONLY also disable MQTT
+- cmake: make HTTP_ONLY also disable MQTT
- ... and alphasort the order of disabling protocols to make it easier to
- browse.
+ ... and alphasort the order of disabling protocols to make it easier to
+ browse.
- Closes #5931
+ Closes #5931
-- libtest: remove lib1541 leftovers
+- libtest: remove lib1541 leftovers
- Caused automake errors.
+ Caused automake errors.
- Follow-up to 8ca54a03ea08a
+ Follow-up to 8ca54a03ea08a
-- tests/libtests: remove test 1900 and 2033
+- tests/libtests: remove test 1900 and 2033
- We already remove the test files, now remove the libtest codes as well.
+ We already remove the test files, now remove the libtest codes as well.
- Follow-up to e50a877df74
+ Follow-up to e50a877df74
-Marc Hoersken (7 Sep 2020)
-- CI/azure: add test number to title for display in analytics
+Marc Hoersken (7 Sep 2020)
+- CI/azure: add test number to title for display in analytics
+
+ To ease identification of tests the test number is added to
+ the test case title in order to have it on the Azure DevOps
+ Analytics pages and reports which currently do not show it.
- To ease identification of tests the test number is added to
- the test case title in order to have it on the Azure DevOps
- Analytics pages and reports which currently do not show it.
+ Bump test case revision to make Azure DevOps update titles.
- Bump test case revision to make Azure DevOps update titles.
-
- Closes #5927
+ Closes #5927
-Daniel Stenberg (6 Sep 2020)
-- altsvc: clone setting in curl_easy_duphandle
+Daniel Stenberg (6 Sep 2020)
+- altsvc: clone setting in curl_easy_duphandle
- The cache content is not duplicated, like other caches, but the setting
- and specified file name are.
+ The cache content is not duplicated, like other caches, but the setting
+ and specified file name are.
- Test 1908 is extended to verify this somewhat. Since the duplicated
- handle gets the same file name, the test unfortunately overwrites the
- same file twice (with different contents) which makes it hard to check
- automatically.
+ Test 1908 is extended to verify this somewhat. Since the duplicated
+ handle gets the same file name, the test unfortunately overwrites the
+ same file twice (with different contents) which makes it hard to check
+ automatically.
- Closes #5923
+ Closes #5923
-- test1541: remove since it is a known bug
+- test1541: remove since it is a known bug
+
+ A shared connection cache is not thread-safe is a known issue. Stop
+ testing this until we believe this issue is addressed. Reduces
+ occasional test failures we don't care about.
- A shared connection cache is not thread-safe is a known issue. Stop
- testing this until we believe this issue is addressed. Reduces
- occasional test failures we don't care about.
-
- The test code in lib1541.c is left in git to allow us to restore it when
- we get to fix this.
-
- Closes #5922
+ The test code in lib1541.c is left in git to allow us to restore it when
+ we get to fix this.
+
+ Closes #5922
-- tests: remove pipelining tests
+- tests: remove pipelining tests
- Remove the tests 530, 584, 1900, 1901, 1902, 1903 and 2033. They were
- previously disabled.
+ Remove the tests 530, 584, 1900, 1901, 1902, 1903 and 2033. They were
+ previously disabled.
- The Pipelining code was removed from curl in commit 2f44e94efb3df8e,
- April 2019.
+ The Pipelining code was removed from curl in commit 2f44e94efb3df8e,
+ April 2019.
- Closes #5921
+ Closes #5921
-- curl: retry delays in parallel mode no longer sleeps blocking
+- curl: retry delays in parallel mode no longer sleeps blocking
- The previous sleep for retries would block all other concurrent
- transfers. Starting now, the retry will instead be properly marked to
- not get restarted until after the delay time but other transfers can
- still continue in the mean time.
+ The previous sleep for retries would block all other concurrent
+ transfers. Starting now, the retry will instead be properly marked to
+ not get restarted until after the delay time but other transfers can
+ still continue in the mean time.
- Closes #5917
+ Closes #5917
-- curl:parallel_transfers: make sure retry readds the transfer
+- curl:parallel_transfers: make sure retry readds the transfer
- Reported-by: htasta on github
- Fixes #5905
- Closes #5917
+ Reported-by: htasta on github
+ Fixes #5905
+ Closes #5917
-- build: drop support for building with Watcom
+- build: drop support for building with Watcom
- These files are not maintained, they seem to have no users, Watcom
- compilers look like not having users nor releases anymore.
+ These files are not maintained, they seem to have no users, Watcom
+ compilers look like not having users nor releases anymore.
- Closes #5918
+ Closes #5918
-- winbuild/rundebug.cmd: remove
+- winbuild/rundebug.cmd: remove
- Seems to have been added by mistake? Not included in dists.
+ Seems to have been added by mistake? Not included in dists.
- Closes #5919
+ Closes #5919
-- curl: in retry output don't call all problems "transient"
+- curl: in retry output don't call all problems "transient"
- ... because when --retry-all-errors is used, the error isn't necessarily
- transient at all.
+ ... because when --retry-all-errors is used, the error isn't necessarily
+ transient at all.
- Closes #5916
+ Closes #5916
-- easygetopt: pass a valid enum to avoid compiler warning
+- easygetopt: pass a valid enum to avoid compiler warning
- "integer constant not in range of enumerated type 'CURLoption'"
+ "integer constant not in range of enumerated type 'CURLoption'"
- Reported-by: Gisle Vanem
- Bug: https://github.com/curl/curl/commit/6ebe63fac23f38df911edc348e8ccc72280f9434#commitcomment-42042843
+ Reported-by: Gisle Vanem
+ Bug: https://github.com/curl/curl/commit/6ebe63fac23f38df911edc348e8ccc72280f9434#commitcomment-42042843
- Closes #5915
+ Closes #5915
+
+- [Emil Engler brought this change]
-- [Emil Engler brought this change]
-
- tests: Add tests for new --help
+ tests: Add tests for new --help
- This commit is a part of "--help me if you can"
+ This commit is a part of "--help me if you can"
- Closes #5680
+ Closes #5680
-- [Emil Engler brought this change]
-
- tool: update --help with categories
+- [Emil Engler brought this change]
+
+ tool: update --help with categories
- This commit is a part of "--help me if you can"
+ This commit is a part of "--help me if you can"
- Closes #5680
+ Closes #5680
+
+- [Emil Engler brought this change]
-- [Emil Engler brought this change]
-
- docs: add categories to all cmdline opts
+ docs: add categories to all cmdline opts
- Adapted gen.pl with 'listcats'
+ Adapted gen.pl with 'listcats'
- This commit is a part of "--help me if you can"
+ This commit is a part of "--help me if you can"
- Closes #5680
+ Closes #5680
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- [ihsinme brought this change]
-
- connect.c: remove superfluous 'else' in Curl_getconnectinfo
+- [ihsinme brought this change]
+
+ connect.c: remove superfluous 'else' in Curl_getconnectinfo
- Closes #5912
+ Closes #5912
+
+- [Samuel Marks brought this change]
-- [Samuel Marks brought this change]
-
- CMake: remove explicit `CMAKE_ANSI_CFLAGS`
+ CMake: remove explicit `CMAKE_ANSI_CFLAGS`
- This variable was removed from cmake in commit
- https://gitlab.kitware.com/cmake/cmake/commit/5a834b0bb0bc288. A later
- CMake commit removes the variable from the tests, claiming that it was
- removed in CMake 2.6
+ This variable was removed from cmake in commit
+ https://gitlab.kitware.com/cmake/cmake/commit/5a834b0bb0bc288. A later
+ CMake commit removes the variable from the tests, claiming that it was
+ removed in CMake 2.6
- Reviewed-By: Peter Wu
- Closes #5439
+ Reviewed-By: Peter Wu
+ Closes #5439
-- [cbe brought this change]
-
- libssh2: pass on the error from ssh_force_knownhost_key_type
+- [cbe brought this change]
+
+ libssh2: pass on the error from ssh_force_knownhost_key_type
- Closes #5909
-
-- scripts/delta: add diffstat summary
+ Closes #5909
+
+- scripts/delta: add diffstat summary
- ... and make output more table-like
+ ... and make output more table-like
-- [Martin Bašti brought this change]
+- [Martin Bašti brought this change]
- http_proxy: do not crash with HTTPS_PROXY and NO_PROXY set
+ http_proxy: do not crash with HTTPS_PROXY and NO_PROXY set
+
+ ... in case NO_PROXY takes an effect
+
+ Without this patch, the following command crashes:
- ... in case NO_PROXY takes an effect
+ $ GIT_CURL_VERBOSE=1 NO_PROXY=github.com HTTPS_PROXY=https://example.com \
+ git clone https://github.com/curl/curl.git
- Without this patch, the following command crashes:
+ Minimal libcurl-based reproducer:
- $ GIT_CURL_VERBOSE=1 NO_PROXY=github.com HTTPS_PROXY=https://example.com \
- git clone https://github.com/curl/curl.git
+ #include <curl/curl.h>
- Minimal libcurl-based reproducer:
-
- #include <curl/curl.h>
-
- int main() {
- CURL *curl = curl_easy_init();
- if(curl) {
- CURLcode ret;
- curl_easy_setopt(curl, CURLOPT_URL, "https://github.com/");
- curl_easy_setopt(curl, CURLOPT_PROXY, "example.com");
- /* set the proxy type */
- curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
- curl_easy_setopt(curl, CURLOPT_NOPROXY, "github.com");
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- ret = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- return ret;
- }
- return -1;
- }
-
- Assisted-by: Kamil Dudka
- Bug: https://bugzilla.redhat.com/1873327
- Closes #5902
+ int main() {
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode ret;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://github.com/");
+ curl_easy_setopt(curl, CURLOPT_PROXY, "example.com");
+ /* set the proxy type */
+ curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
+ curl_easy_setopt(curl, CURLOPT_NOPROXY, "github.com");
+ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+ ret = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ return ret;
+ }
+ return -1;
+ }
+
+ Assisted-by: Kamil Dudka
+ Bug: https://bugzilla.redhat.com/1873327
+ Closes #5902
-- travis: add a CI job with openssl3 (from git master)
+- travis: add a CI job with openssl3 (from git master)
- Closes #5908
+ Closes #5908
-- openssl: avoid error conditions when importing native CA
+- openssl: avoid error conditions when importing native CA
- The code section that is OpenSSL 3+ specific now uses the same logic as
- is used in the version < 3 section. It caused a compiler error without
- it.
+ The code section that is OpenSSL 3+ specific now uses the same logic as
+ is used in the version < 3 section. It caused a compiler error without
+ it.
- Closes #5907
+ Closes #5907
-- setopt: avoid curl_ on local variable
+- setopt: avoid curl_ on local variable
- Closes #5906
+ Closes #5906
-- mqtt.c: avoid curl_ prefix on local variable
+- mqtt.c: avoid curl_ prefix on local variable
- Closes #5906
+ Closes #5906
-- wildcard: strip "curl_" prefix from private symbols
-
- Closes #5906
+- wildcard: strip "curl_" prefix from private symbols
+
+ Closes #5906
-- vtls: make it 'struct Curl_ssl_session'
+- vtls: make it 'struct Curl_ssl_session'
- Use uppercase C for internal symbols.
+ Use uppercase C for internal symbols.
- Closes #5906
+ Closes #5906
-- curl_threads: make it 'struct Curl_actual_call'
+- curl_threads: make it 'struct Curl_actual_call'
- Internal names should not be prefixed "curl_"
+ Internal names should not be prefixed "curl_"
- Closes #5906
+ Closes #5906
-- schannel: make it 'struct Curl_schannel*'
+- schannel: make it 'struct Curl_schannel*'
- As internal global names should use captical C.
+ As internal global names should use captical C.
- Closes #5906
+ Closes #5906
-- hash: make it 'struct Curl_hash'
+- hash: make it 'struct Curl_hash'
- As internal global names should use captical C.
+ As internal global names should use captical C.
- Closes #5906
+ Closes #5906
-- llist: make it "struct Curl_llist"
+- llist: make it "struct Curl_llist"
- As internal global names should use captical C.
+ As internal global names should use captical C.
- Closes #5906
+ Closes #5906
-Marc Hoersken (2 Sep 2020)
-- telnet.c: depend on static requirement of WinSock version 2
+Marc Hoersken (2 Sep 2020)
+- telnet.c: depend on static requirement of WinSock version 2
- Drop dynamic loading of ws2_32.dll and instead rely on the
- imported version which is now required to be at least 2.2.
+ Drop dynamic loading of ws2_32.dll and instead rely on the
+ imported version which is now required to be at least 2.2.
- Reviewed-by: Marcel Raad
- Reviewed-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Viktor Szakats
+ Reviewed-by: Marcel Raad
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Viktor Szakats
- Closes #5854
+ Closes #5854
-- win32: drop support for WinSock version 1, require version 2
+- win32: drop support for WinSock version 1, require version 2
- IPv6, telnet and now also the multi API require WinSock
- version 2 which is available starting with Windows 95.
+ IPv6, telnet and now also the multi API require WinSock
+ version 2 which is available starting with Windows 95.
- Therefore we think it is time to drop support for version 1.
+ Therefore we think it is time to drop support for version 1.
+
+ Reviewed-by: Marcel Raad
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Viktor Szakats
- Reviewed-by: Marcel Raad
- Reviewed-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Viktor Szakats
-
- Follow up to #5634
- Closes #5854
+ Follow up to #5634
+ Closes #5854
-- select: align poll emulation to return all relevant events
+- select: align poll emulation to return all relevant events
- The poll emulation via select already consumes POLLRDNORM,
- POLLWRNORM and POLLRDBAND as input events. Therefore it
- should also return them as output events if signaled.
+ The poll emulation via select already consumes POLLRDNORM,
+ POLLWRNORM and POLLRDBAND as input events. Therefore it
+ should also return them as output events if signaled.
- Also fix indentation in input event handling block.
+ Also fix indentation in input event handling block.
- Assisted-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
-
- Replaces #5852
- Closes #5883
+ Assisted-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+
+ Replaces #5852
+ Closes #5883
-- CI/azure: MQTT is now enabled by default
+- CI/azure: MQTT is now enabled by default
+
+ Reviewed-by: Daniel Stenberg
- Reviewed-by: Daniel Stenberg
-
- Follow up to #5858
- Closes #5903
+ Follow up to #5858
+ Closes #5903
-Daniel Stenberg (2 Sep 2020)
-- copyright.pl: ignore buildconf
+Daniel Stenberg (2 Sep 2020)
+- copyright.pl: ignore buildconf
-- test971: show test mismatches "inline"
-
-- lib/Makefile.am: bump VERSIONINFO due to new functions
+- test971: show test mismatches "inline"
+
+- lib/Makefile.am: bump VERSIONINFO due to new functions
- ... we're generally bad at this, but we are adding new functions for
- this release.
+ ... we're generally bad at this, but we are adding new functions for
+ this release.
- Closes #5899
+ Closes #5899
-- optiontable: use DEBUGBUILD
+- optiontable: use DEBUGBUILD
- Follow-up to commit 6e18568ba38 (#5877)
+ Follow-up to commit 6e18568ba38 (#5877)
-- cmdline-opts/gen.pl: generate nicer "See Also" in curl.1
+- cmdline-opts/gen.pl: generate nicer "See Also" in curl.1
+
+ If there are more than two items in the list, use commas for all but the
+ last separator which is set to 'and'. Reads better.
- If there are more than two items in the list, use commas for all but the
- last separator which is set to 'and'. Reads better.
-
- Closes #5898
+ Closes #5898
-- curl.1: add see also no-progress-meter on two spots
+- curl.1: add see also no-progress-meter on two spots
- Ref: #5894
+ Ref: #5894
- Closes #5897
+ Closes #5897
- RELEASE-NOTES: synced
-- mqtt: enable by default
+- mqtt: enable by default
- No longer considered experimental.
+ No longer considered experimental.
- Closes #5858
+ Closes #5858
-- [Michael Baentsch brought this change]
-
- tls: add CURLOPT_SSL_EC_CURVES and --curves
+- [Michael Baentsch brought this change]
+
+ tls: add CURLOPT_SSL_EC_CURVES and --curves
- Closes #5892
+ Closes #5892
+
+- url: remove funny embedded comments in Curl_disonnect calls
-- url: remove funny embedded comments in Curl_disonnect calls
+- [Chris Paulson-Ellis brought this change]
-- [Chris Paulson-Ellis brought this change]
-
- conn: check for connection being dead before reuse
+ conn: check for connection being dead before reuse
- Prevents incorrect reuse of an HTTP connection that has been prematurely
- shutdown() by the server.
+ Prevents incorrect reuse of an HTTP connection that has been prematurely
+ shutdown() by the server.
- Partial revert of 755083d00deb16
+ Partial revert of 755083d00deb16
- Fixes #5884
- Closes #5893
+ Fixes #5884
+ Closes #5893
-Marc Hoersken (29 Aug 2020)
-- buildconf: exec autoreconf to avoid additional process
+Marc Hoersken (29 Aug 2020)
+- buildconf: exec autoreconf to avoid additional process
- Also make buildconf exit with the return code of autoreconf.
+ Also make buildconf exit with the return code of autoreconf.
- Reviewed-by: Daniel Stenberg
+ Reviewed-by: Daniel Stenberg
- Follow up to #5853
- Closes #5890
+ Follow up to #5853
+ Closes #5890
-- CI/azure: no longer ignore results of test 1013
+- CI/azure: no longer ignore results of test 1013
- Follow up to #5771
- Closes #5889
-
-- docs: add description about CI platforms to CONTRIBUTE.md
+ Follow up to #5771
+ Closes #5889
+
+- docs: add description about CI platforms to CONTRIBUTE.md
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Marcel Raad
- Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Marcel Raad
+ Reviewed-by: Jay Satiro
- Closes #5882
+ Closes #5882
-Daniel Stenberg (29 Aug 2020)
-- tests/getpart: use MIME::Base64 instead of home-cooked
+Daniel Stenberg (29 Aug 2020)
+- tests/getpart: use MIME::Base64 instead of home-cooked
+
+ Since we already use the base64 package since a while back, we can just
+ as well switch to that here too.
- Since we already use the base64 package since a while back, we can just
- as well switch to that here too.
+ It also happens to use the exact same function name, which otherwise
+ causes a run-time warning.
- It also happens to use the exact same function name, which otherwise
- causes a run-time warning.
-
- Reported-by: Marc Hörsken
- Fixes #5885
- Closes #5887
+ Reported-by: Marc Hörsken
+ Fixes #5885
+ Closes #5887
-Marcel Raad (29 Aug 2020)
-- ntlm: fix condition for curl_ntlm_core usage
+Marcel Raad (29 Aug 2020)
+- ntlm: fix condition for curl_ntlm_core usage
- `USE_WINDOWS_SSPI` without `USE_WIN32_CRYPTO` but with any other DES
- backend is fine, but was excluded before.
+ `USE_WINDOWS_SSPI` without `USE_WIN32_CRYPTO` but with any other DES
+ backend is fine, but was excluded before.
- This also fixes test 1013 as the condition for SMB support in
- configure.ac didn't match the condition in the source code. Now it
- does.
+ This also fixes test 1013 as the condition for SMB support in
+ configure.ac didn't match the condition in the source code. Now it
+ does.
- Fixes https://github.com/curl/curl/issues/1262
- Closes https://github.com/curl/curl/pull/5771
+ Fixes https://github.com/curl/curl/issues/1262
+ Closes https://github.com/curl/curl/pull/5771
-- AppVeyor: switch 64-bit Schannel Debug CMake builds to Unicode
+- AppVeyor: switch 64-bit Schannel Debug CMake builds to Unicode
- The Schannel builds are the most useful to verify as they make the most
- use of the Windows API. Classic MinGW doesn't support Unicode at all,
- only MinGW-w64 and MSVC do.
+ The Schannel builds are the most useful to verify as they make the most
+ use of the Windows API. Classic MinGW doesn't support Unicode at all,
+ only MinGW-w64 and MSVC do.
- Closes https://github.com/curl/curl/pull/5843
+ Closes https://github.com/curl/curl/pull/5843
-- CMake: add option to enable Unicode on Windows
+- CMake: add option to enable Unicode on Windows
- As already existing for winbuild.
+ As already existing for winbuild.
- Closes https://github.com/curl/curl/pull/5843
-
-Marc Hoersken (29 Aug 2020)
-- select: simplify return code handling for poll and select
+ Closes https://github.com/curl/curl/pull/5843
+
+Marc Hoersken (29 Aug 2020)
+- select: simplify return code handling for poll and select
- poll and select already return -1 on error according to POSIX,
- so there is no need to perform a <0 to -1 conversion in code.
+ poll and select already return -1 on error according to POSIX,
+ so there is no need to perform a <0 to -1 conversion in code.
- Also we can just use one check with <= 0 on the return code.
+ Also we can just use one check with <= 0 on the return code.
- Assisted-by: Daniel Stenberg
- Reviewed-by: Jay Satiro
+ Assisted-by: Daniel Stenberg
+ Reviewed-by: Jay Satiro
- Replaces #5852
- Closes #5880
+ Replaces #5852
+ Closes #5880
-Daniel Stenberg (28 Aug 2020)
-- RELEASE-NOTES: synced
+Daniel Stenberg (28 Aug 2020)
+- RELEASE-NOTES: synced
-- [Jeroen Ooms brought this change]
+- [Jeroen Ooms brought this change]
- tests: add test1912 with typechecks
+ tests: add test1912 with typechecks
- Validates that gcc-typecheck macros match the new option type API.
+ Validates that gcc-typecheck macros match the new option type API.
- Closes #5873
+ Closes #5873
-- easyoptions: provide debug function when DEBUGBUILD
+- easyoptions: provide debug function when DEBUGBUILD
- ... not CURLDEBUG as they're not always set in conjunction.
+ ... not CURLDEBUG as they're not always set in conjunction.
- Follow-up to 6ebe63fac23f38df
-
- Fixes #5877
- Closes #5878
+ Follow-up to 6ebe63fac23f38df
+
+ Fixes #5877
+ Closes #5878
-Marc Hoersken (28 Aug 2020)
-- sockfilt: handle FD_CLOSE winsock event on write socket
+Marc Hoersken (28 Aug 2020)
+- sockfilt: handle FD_CLOSE winsock event on write socket
- Learn from the way Cygwin handles and maps the WinSock events
- to simulate correct and complete poll and select behaviour
- according to Richard W. Stevens Network Programming book.
+ Learn from the way Cygwin handles and maps the WinSock events
+ to simulate correct and complete poll and select behaviour
+ according to Richard W. Stevens Network Programming book.
- Follow up to #5867
- Closes #5879
-
-- multi: handle connection state winsock events
+ Follow up to #5867
+ Closes #5879
+
+- multi: handle connection state winsock events
- Learn from the way Cygwin handles and maps the WinSock events
- to simulate correct and complete poll and select behaviour
- according to Richard W. Stevens Network Programming book.
+ Learn from the way Cygwin handles and maps the WinSock events
+ to simulate correct and complete poll and select behaviour
+ according to Richard W. Stevens Network Programming book.
- Reviewed-by: Jay Satiro
- Reviewed-by: Marcel Raad
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Marcel Raad
- Follow up to #5634
- Closes #5867
-
-Daniel Stenberg (28 Aug 2020)
-- Curl_pgrsTime - return new time to avoid timeout integer overflow
+ Follow up to #5634
+ Closes #5867
+
+Daniel Stenberg (28 Aug 2020)
+- Curl_pgrsTime - return new time to avoid timeout integer overflow
- Setting a timeout to INT_MAX could cause an immediate error to get
- returned as timeout because of an overflow when different values of
- 'now' were used.
+ Setting a timeout to INT_MAX could cause an immediate error to get
+ returned as timeout because of an overflow when different values of
+ 'now' were used.
- This is primarily fixed by having Curl_pgrsTime() return the "now" when
- TIMER_STARTSINGLE is set so that the parent function will continue using
- that time.
+ This is primarily fixed by having Curl_pgrsTime() return the "now" when
+ TIMER_STARTSINGLE is set so that the parent function will continue using
+ that time.
- Reported-by: Ionuț-Francisc Oancea
- Fixes #5583
- Closes #5847
-
-- TLS: fix SRP detection by using the proper #ifdefs
+ Reported-by: Ionuț-Francisc Oancea
+ Fixes #5583
+ Closes #5847
+
+- TLS: fix SRP detection by using the proper #ifdefs
- USE_TLS_SRP will be true if *any* selected TLS backend can use SRP
+ USE_TLS_SRP will be true if *any* selected TLS backend can use SRP
- HAVE_OPENSSL_SRP is defined when OpenSSL can use it
+ HAVE_OPENSSL_SRP is defined when OpenSSL can use it
- HAVE_GNUTLS_SRP is defined when GnuTLS can use it
+ HAVE_GNUTLS_SRP is defined when GnuTLS can use it
- Clarify in the curl_verison_info docs that CURL_VERSION_TLSAUTH_SRP is
- set if at least one of the supported backends offers SRP.
+ Clarify in the curl_verison_info docs that CURL_VERSION_TLSAUTH_SRP is
+ set if at least one of the supported backends offers SRP.
- Reported-by: Stefan Strogin
- Fixes #5865
- Closes #5870
-
-- [Dan Kenigsberg brought this change]
-
- docs: SSLCERTS: fix English syntax
+ Reported-by: Stefan Strogin
+ Fixes #5865
+ Closes #5870
+
+- [Dan Kenigsberg brought this change]
+
+ docs: SSLCERTS: fix English syntax
- Signed-off-by: Dan Kenigsberg <danken@redhat.com>
+ Signed-off-by: Dan Kenigsberg <danken@redhat.com>
- Closes #5876
+ Closes #5876
-- [Alessandro Ghedini brought this change]
+- [Alessandro Ghedini brought this change]
- docs: non-existing macros in man pages
+ docs: non-existing macros in man pages
- As reported by man(1) when invoked as:
-
- man --warnings -E UTF-8 -l -Tutf8 -Z <file> >/dev/null
-
- Closes #5846
+ As reported by man(1) when invoked as:
+
+ man --warnings -E UTF-8 -l -Tutf8 -Z <file> >/dev/null
+
+ Closes #5846
-- [Alessandro Ghedini brought this change]
+- [Alessandro Ghedini brought this change]
- curl.1: fix typo invokved -> invoked
+ curl.1: fix typo invokved -> invoked
- Closes #5846
+ Closes #5846
-- buildconf: invoke 'autoreconf -fi' instead
-
- The custom script isn't necessary anymore - but remains for simplicity
- and just invokes autoreconf.
-
- Closes #5853
+- buildconf: invoke 'autoreconf -fi' instead
+
+ The custom script isn't necessary anymore - but remains for simplicity
+ and just invokes autoreconf.
+
+ Closes #5853
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- lib: make Curl_gethostname accept a const pointer
+ lib: make Curl_gethostname accept a const pointer
+
+ The address of that variable never gets changed, only the data in it so
+ why not make it a "char * const"?
- The address of that variable never gets changed, only the data in it so
- why not make it a "char * const"?
-
- Closes #5866
+ Closes #5866
-- docs/libcurl: update "Added in" version for curl_easy_option*
+- docs/libcurl: update "Added in" version for curl_easy_option*
- Follow-up to 6ebe63fac23f38
+ Follow-up to 6ebe63fac23f38
-- scripts: improve the "get latest curl release tag" logic
-
- ... by insiting on it matching "^curl-".
+- scripts: improve the "get latest curl release tag" logic
+
+ ... by insiting on it matching "^curl-".
-- configure: added --disable-get-easy-options
+- configure: added --disable-get-easy-options
- To allow disabling of the curl_easy_option APIs in a build.
+ To allow disabling of the curl_easy_option APIs in a build.
- Closes #5365
+ Closes #5365
-- options: API for meta-data about easy options
+- options: API for meta-data about easy options
+
+ const struct curl_easyoption *curl_easy_option_by_name(const char *name);
+
+ const struct curl_easyoption *curl_easy_option_by_id (CURLoption id);
+
+ const struct curl_easyoption *
+ curl_easy_option_next(const struct curl_easyoption *prev);
+
+ The purpose is to provide detailed enough information to allow for
+ example libcurl bindings to get option information at run-time about
+ what easy options that exist and what arguments they expect.
- const struct curl_easyoption *curl_easy_option_by_name(const char *name);
-
- const struct curl_easyoption *curl_easy_option_by_id (CURLoption id);
-
- const struct curl_easyoption *
- curl_easy_option_next(const struct curl_easyoption *prev);
-
- The purpose is to provide detailed enough information to allow for
- example libcurl bindings to get option information at run-time about
- what easy options that exist and what arguments they expect.
-
- Assisted-by: Jeroen Ooms
- Closes #5365
+ Assisted-by: Jeroen Ooms
+ Closes #5365
-- [Eric Curtin brought this change]
+- [Eric Curtin brought this change]
- HTTP/3: update to OpenSSL_1_1_1g-quic-draft-29
-
- Closes #5871
+ HTTP/3: update to OpenSSL_1_1_1g-quic-draft-29
+
+ Closes #5871
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-Jay Satiro (26 Aug 2020)
-- openssl: Fix wincrypt symbols conflict with BoringSSL
+Jay Satiro (26 Aug 2020)
+- openssl: Fix wincrypt symbols conflict with BoringSSL
- OpenSSL undefines the conflicting symbols but BoringSSL does not so we
- must do it ourselves.
+ OpenSSL undefines the conflicting symbols but BoringSSL does not so we
+ must do it ourselves.
- Reported-by: Samuel Tranchet
- Assisted-by: Javier Blazquez
+ Reported-by: Samuel Tranchet
+ Assisted-by: Javier Blazquez
- Ref: https://bugs.chromium.org/p/boringssl/issues/detail?id=371
- Ref: https://github.com/openssl/openssl/blob/OpenSSL_1_1_1g/include/openssl/ossl_typ.h#L66-L73
+ Ref: https://bugs.chromium.org/p/boringssl/issues/detail?id=371
+ Ref: https://github.com/openssl/openssl/blob/OpenSSL_1_1_1g/include/openssl/ossl_typ.h#L66-L73
- Fixes https://github.com/curl/curl/issues/5669
- Closes https://github.com/curl/curl/pull/5857
+ Fixes https://github.com/curl/curl/issues/5669
+ Closes https://github.com/curl/curl/pull/5857
-Daniel Stenberg (26 Aug 2020)
-- socketpair: allow CURL_DISABLE_SOCKETPAIR
+Daniel Stenberg (26 Aug 2020)
+- socketpair: allow CURL_DISABLE_SOCKETPAIR
- ... to completely disable the use of socketpair
+ ... to completely disable the use of socketpair
- Closes #5850
+ Closes #5850
-- curl_get_line: build only if cookies or alt-svc are enabled
+- curl_get_line: build only if cookies or alt-svc are enabled
- Closes #5851
-
-- [fullincome brought this change]
-
- schannel: fix memory leak when using get_cert_location
+ Closes #5851
+
+- [fullincome brought this change]
+
+ schannel: fix memory leak when using get_cert_location
- The get_cert_location function allocates memory only on success.
- Previously get_cert_location was able to allocate memory and return
- error. It wasn't obvious and in this case the memory wasn't
- released.
+ The get_cert_location function allocates memory only on success.
+ Previously get_cert_location was able to allocate memory and return
+ error. It wasn't obvious and in this case the memory wasn't
+ released.
- Fixes #5855
- Closes #5860
+ Fixes #5855
+ Closes #5860
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- git: ignore libtests in 3XXX area
+ git: ignore libtests in 3XXX area
- Currently the file tests/libtest/lib3010 is not getting
- ignored by git. This fixes it by adding the 3XXX area to
- the according .gitignore file.
+ Currently the file tests/libtest/lib3010 is not getting
+ ignored by git. This fixes it by adding the 3XXX area to
+ the according .gitignore file.
- Closes #5859
+ Closes #5859
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- doh: add error message for DOH_DNS_NAME_TOO_LONG
+ doh: add error message for DOH_DNS_NAME_TOO_LONG
- When this error code was introduced in b6a53fff6c1d07e8a9, it was
- forgotten to be added in the errors array and doh_strerror function.
-
- Closes #5863
+ When this error code was introduced in b6a53fff6c1d07e8a9, it was
+ forgotten to be added in the errors array and doh_strerror function.
+
+ Closes #5863
-- ngtcp2: adapt to the new pkt_info arguments
+- ngtcp2: adapt to the new pkt_info arguments
+
+ Guidance-by: Tatsuhiro Tsujikawa
- Guidance-by: Tatsuhiro Tsujikawa
-
- Closes #5864
+ Closes #5864
-- winbuild/README.md: make <options> visible
+- winbuild/README.md: make <options> visible
- Follow-up to be753add31c2d8c
+ Follow-up to be753add31c2d8c
-- winbuild: convert the instruction text to README.md
+- winbuild: convert the instruction text to README.md
- Closes #5861
+ Closes #5861
-- lib1560: verify "redirect" to double-slash leading URL
+- lib1560: verify "redirect" to double-slash leading URL
- Closes #5849
+ Closes #5849
-Marc Hoersken (25 Aug 2020)
-- multi: expand pre-check for socket readiness
+Marc Hoersken (25 Aug 2020)
+- multi: expand pre-check for socket readiness
- Check readiness of all sockets before waiting on them
- to avoid locking in case the one-time event FD_WRITE
- was already consumed by a previous wait operation.
+ Check readiness of all sockets before waiting on them
+ to avoid locking in case the one-time event FD_WRITE
+ was already consumed by a previous wait operation.
- More information about WinSock network events:
- https://docs.microsoft.com/en-us/windows/win32/api/
- winsock2/nf-winsock2-wsaeventselect#return-value
+ More information about WinSock network events:
+ https://docs.microsoft.com/en-us/windows/win32/api/
+ winsock2/nf-winsock2-wsaeventselect#return-value
- Closes #5634
+ Closes #5634
+
+- [rcombs brought this change]
-- [rcombs brought this change]
-
- multi: implement wait using winsock events
+ multi: implement wait using winsock events
- This avoids using a pair of TCP ports to provide wakeup functionality
- for every multi instance on Windows, where socketpair() is emulated
- using a TCP socket on loopback which could in turn lead to socket
- resource exhaustion.
+ This avoids using a pair of TCP ports to provide wakeup functionality
+ for every multi instance on Windows, where socketpair() is emulated
+ using a TCP socket on loopback which could in turn lead to socket
+ resource exhaustion.
- A previous version of this patch failed to account for how in WinSock,
- FD_WRITE is set only once when writing becomes possible and not again
- until after a send has failed due to the buffer filling. This contrasts
- to how FD_READ and FD_OOB continue to be set until the conditions they
- refer to no longer apply. This meant that if a user wrote some data to
- a socket, but not enough data to completely fill its send buffer, then
- waited on that socket to become writable, we'd erroneously stall until
- their configured timeout rather than returning immediately.
+ A previous version of this patch failed to account for how in WinSock,
+ FD_WRITE is set only once when writing becomes possible and not again
+ until after a send has failed due to the buffer filling. This contrasts
+ to how FD_READ and FD_OOB continue to be set until the conditions they
+ refer to no longer apply. This meant that if a user wrote some data to
+ a socket, but not enough data to completely fill its send buffer, then
+ waited on that socket to become writable, we'd erroneously stall until
+ their configured timeout rather than returning immediately.
- This version of the patch addresses that issue by checking each socket
- we're waiting on to become writable with select() before the wait, and
- zeroing the timeout if it's already writable.
-
- Assisted-by: Marc Hörsken
- Reviewed-by: Marcel Raad
- Reviewed-by: Daniel Stenberg
- Tested-by: Gergely Nagy
- Tested-by: Rasmus Melchior Jacobsen
- Tested-by: Tomas Berger
-
- Replaces #5397
- Reverts #5632
- Closes #5634
+ This version of the patch addresses that issue by checking each socket
+ we're waiting on to become writable with select() before the wait, and
+ zeroing the timeout if it's already writable.
+
+ Assisted-by: Marc Hörsken
+ Reviewed-by: Marcel Raad
+ Reviewed-by: Daniel Stenberg
+ Tested-by: Gergely Nagy
+ Tested-by: Rasmus Melchior Jacobsen
+ Tested-by: Tomas Berger
+
+ Replaces #5397
+ Reverts #5632
+ Closes #5634
-- select: reduce duplication of Curl_poll in Curl_socket_check
+- select: reduce duplication of Curl_poll in Curl_socket_check
- Change Curl_socket_check to use select-fallback in Curl_poll
- instead of implementing it in Curl_socket_check and Curl_poll.
+ Change Curl_socket_check to use select-fallback in Curl_poll
+ instead of implementing it in Curl_socket_check and Curl_poll.
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Jay Satiro
- Replaces #5262 and #5492
- Closes #5707
+ Replaces #5262 and #5492
+ Closes #5707
-- select: fix poll-based check not detecting connect failure
+- select: fix poll-based check not detecting connect failure
+
+ This commit changes Curl_socket_check to use POLLPRI to
+ check for connect failure on the write socket, because
+ POLLPRI maps to fds_err. This is in line with select(2).
- This commit changes Curl_socket_check to use POLLPRI to
- check for connect failure on the write socket, because
- POLLPRI maps to fds_err. This is in line with select(2).
+ The select-based socket check correctly checks for connect
+ failures by adding the write socket also to fds_err.
- The select-based socket check correctly checks for connect
- failures by adding the write socket also to fds_err.
+ The poll-based implementation (which internally can itself
+ fallback to select again) did not previously check for
+ connect failure by using POLLPRI with the write socket.
- The poll-based implementation (which internally can itself
- fallback to select again) did not previously check for
- connect failure by using POLLPRI with the write socket.
+ See the follow up commit to this for more information.
- See the follow up commit to this for more information.
+ This commit makes sure connect failures can be detected
+ and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel.
- This commit makes sure connect failures can be detected
- and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel.
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Jay Satiro
-
- Replaces #5509
- Prepares #5707
+ Replaces #5509
+ Prepares #5707
-- select.h: make socket validation macros test for INVALID_SOCKET
+- select.h: make socket validation macros test for INVALID_SOCKET
+
+ With Winsock the valid range is [0..INVALID_SOCKET-1] according to
+ https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2
+
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Marcel Raad
+ Reviewed-by: Daniel Stenberg
- With Winsock the valid range is [0..INVALID_SOCKET-1] according to
- https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2
+ Closes #5760
+
+Daniel Stenberg (24 Aug 2020)
+- docs: --output-dir is added in 7.73.0, nothing else
- Reviewed-by: Jay Satiro
- Reviewed-by: Marcel Raad
- Reviewed-by: Daniel Stenberg
-
- Closes #5760
+ Follow-up to 5620d2cc78c0
-Daniel Stenberg (24 Aug 2020)
-- docs: --output-dir is added in 7.73.0, nothing else
+- curl: add --output-dir
+
+ Works with --create-dirs and with -J
- Follow-up to 5620d2cc78c0
-
-- curl: add --output-dir
+ Add test 3008, 3009, 3011, 3012 and 3013 to verify.
- Works with --create-dirs and with -J
-
- Add test 3008, 3009, 3011, 3012 and 3013 to verify.
-
- Closes #5637
+ Closes #5637
-- configure: fix pkg-config detecting wolfssl
+- configure: fix pkg-config detecting wolfssl
- When amending the include path with "/wolfssl", this now properly strips
- off all whitespace from the path variable! Previously this would lead to
- pkg-config builds creating bad command lines.
-
- Closes #5848
+ When amending the include path with "/wolfssl", this now properly strips
+ off all whitespace from the path variable! Previously this would lead to
+ pkg-config builds creating bad command lines.
+
+ Closes #5848
-- [Michael Musset brought this change]
+- [Michael Musset brought this change]
- sftp: add the option CURLKHSTAT_FINE_REPLACE
+ sftp: add the option CURLKHSTAT_FINE_REPLACE
+
+ Replace the old fingerprint of the host with a new.
- Replace the old fingerprint of the host with a new.
-
- Closes #5685
+ Closes #5685
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
- The next release is now to become 7.73.0
+ The next release is now to become 7.73.0
-- checksrc: verify do-while and spaces between the braces
+- checksrc: verify do-while and spaces between the braces
- Updated mprintf.c to comply
+ Updated mprintf.c to comply
- Closes #5845
+ Closes #5845
-- curl: support XDG_CONFIG_HOME to find .curlrc
+- curl: support XDG_CONFIG_HOME to find .curlrc
- Added test433 to verify. Updated documentation.
+ Added test433 to verify. Updated documentation.
- Reviewed-by: Jay Satiro
- Suggested-by: Eli Schwartz
- Fixes #5829
- Closes #5837
+ Reviewed-by: Jay Satiro
+ Suggested-by: Eli Schwartz
+ Fixes #5829
+ Closes #5837
-- etag: save and use the full received contents
+- etag: save and use the full received contents
+
+ ... which makes it support weak tags and non-standard etags too!
- ... which makes it support weak tags and non-standard etags too!
+ Added test case 347 to verify blank incoming ETag:
- Added test case 347 to verify blank incoming ETag:
-
- Fixes #5610
- Closes #5833
+ Fixes #5610
+ Closes #5833
-- setopt: if the buffer exists, refuse the new BUFFERSIZE
+- setopt: if the buffer exists, refuse the new BUFFERSIZE
- The buffer only exists during transfer and then we shouldn't change the
- size (the setopt is not documented to work then).
+ The buffer only exists during transfer and then we shouldn't change the
+ size (the setopt is not documented to work then).
+
+ Reported-by: Harry Sintonen
+ Closes #5842
+
+- [COFFEETALES brought this change]
+
+ sftp: add new quote commands 'atime' and 'mtime'
- Reported-by: Harry Sintonen
- Closes #5842
+ Closes #5810
-- [COFFEETALES brought this change]
-
- sftp: add new quote commands 'atime' and 'mtime'
+- CURLE_PROXY: new error code
+
+ Failures clearly returned from a (SOCKS) proxy now causes this return
+ code. Previously the situation was not very clear as what would be
+ returned and when.
- Closes #5810
-
-- CURLE_PROXY: new error code
+ In addition: when this error code is returned, an application can use
+ CURLINFO_PROXY_ERROR to query libcurl for the detailed error, which then
+ returns a value from the new 'CURLproxycode' enum.
- Failures clearly returned from a (SOCKS) proxy now causes this return
- code. Previously the situation was not very clear as what would be
- returned and when.
-
- In addition: when this error code is returned, an application can use
- CURLINFO_PROXY_ERROR to query libcurl for the detailed error, which then
- returns a value from the new 'CURLproxycode' enum.
-
- Closes #5770
+ Closes #5770
-- runtests: make cleardir() erase dot files too
+- runtests: make cleardir() erase dot files too
+
+ Because test cases might use dot files.
- Because test cases might use dot files.
-
- Closes #5838
+ Closes #5838
-- KNOWN_BUGS: 'no_proxy' string-matches IPv6 numerical addreses
+- KNOWN_BUGS: 'no_proxy' string-matches IPv6 numerical addreses
- Also: the current behavior is now documented in the curl.1 and
- CURLOPT_NOPROXY.3 man pages.
+ Also: the current behavior is now documented in the curl.1 and
+ CURLOPT_NOPROXY.3 man pages.
- Reported-by: Andrew Barnes
- Closes #5745
- Closes #5841
+ Reported-by: Andrew Barnes
+ Closes #5745
+ Closes #5841
-Viktor Szakats (22 Aug 2020)
-- Makefile.m32: add ability to override zstd libs [ci skip]
+Viktor Szakats (22 Aug 2020)
+- Makefile.m32: add ability to override zstd libs [ci skip]
- Similarly to brotli, where this was already possible.
- E.g. it allows to link zstd statically to libcurl.dll.
+ Similarly to brotli, where this was already possible.
+ E.g. it allows to link zstd statically to libcurl.dll.
- Ref: https://github.com/curl/curl-for-win/issues/12
- Ref: https://github.com/curl/curl-for-win/commit/d9b266afd2e5d3f5604483010ef62340b5918c89
+ Ref: https://github.com/curl/curl-for-win/issues/12
+ Ref: https://github.com/curl/curl-for-win/commit/d9b266afd2e5d3f5604483010ef62340b5918c89
- Closes https://github.com/curl/curl/pull/5840
+ Closes https://github.com/curl/curl/pull/5840
-Daniel Stenberg (21 Aug 2020)
-- runtests: avoid 'fail to start' repeated messages in attempt loops
+Daniel Stenberg (21 Aug 2020)
+- runtests: avoid 'fail to start' repeated messages in attempt loops
- Closes #5834
+ Closes #5834
-- runtests: clear pid variables when failing to start a server
+- runtests: clear pid variables when failing to start a server
- ... as otherwise the parent doesn't detect the failure and believe it
- actually worked to start.
+ ... as otherwise the parent doesn't detect the failure and believe it
+ actually worked to start.
- Reported-by: Christian Weisgerber
- Bug: https://curl.haxx.se/mail/lib-2020-08/0018.html
- Closes #5834
+ Reported-by: Christian Weisgerber
+ Bug: https://curl.haxx.se/mail/lib-2020-08/0018.html
+ Closes #5834
-- TODO: Virtual external sockets
+- TODO: Virtual external sockets
- Closes #5835
+ Closes #5835
-- [Don J Olmstead brought this change]
+- [Don J Olmstead brought this change]
- dist: add missing CMake Find modules to the distribution
-
- Closes #5836
+ dist: add missing CMake Find modules to the distribution
+
+ Closes #5836
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
- ... and version bumped to 7.72.1
+ ... and version bumped to 7.72.1
-- tls: provide the CApath verbose log on its own line
+- tls: provide the CApath verbose log on its own line
- ... not newline separated from the previous line. This makes it output
- asterisk prefixed properly like other verbose putput!
-
- Reported-by: jmdavitt on github
- Fixes #5826
- Closes #5827
+ ... not newline separated from the previous line. This makes it output
+ asterisk prefixed properly like other verbose putput!
+
+ Reported-by: jmdavitt on github
+ Fixes #5826
+ Closes #5827
+
+Version 7.72.0 (19 Aug 2020)
-Version 7.72.0 (19 Aug 2020)
-
-Daniel Stenberg (19 Aug 2020)
-- RELEASE-NOTES: synced
+Daniel Stenberg (19 Aug 2020)
+- RELEASE-NOTES: synced
- The curl 7.72.0 release
+ The curl 7.72.0 release
-- THANKS: add names from curl 7.72.0 release
-
-Jay Satiro (18 Aug 2020)
-- KNOWN_BUGS: Schannel TLS 1.2 handshake bug in old Windows versions
+- THANKS: add names from curl 7.72.0 release
+
+Jay Satiro (18 Aug 2020)
+- KNOWN_BUGS: Schannel TLS 1.2 handshake bug in old Windows versions
- Reported-by: plujon@users.noreply.github.com
+ Reported-by: plujon@users.noreply.github.com
- Closes https://github.com/curl/curl/issues/5488
+ Closes https://github.com/curl/curl/issues/5488
-Daniel Stenberg (17 Aug 2020)
-- Curl_easy: remember last connection by id, not by pointer
+Daniel Stenberg (17 Aug 2020)
+- Curl_easy: remember last connection by id, not by pointer
- CVE-2020-8231
+ CVE-2020-8231
- Bug: https://curl.haxx.se/docs/CVE-2020-8231.html
+ Bug: https://curl.haxx.se/docs/CVE-2020-8231.html
- Reported-by: Marc Aldorasi
- Closes #5824
+ Reported-by: Marc Aldorasi
+ Closes #5824
-- examples/rtsp.c: correct the copyright year
+- examples/rtsp.c: correct the copyright year
-- RELEASE-PROCEDURE.md: add more future release dates
+- RELEASE-PROCEDURE.md: add more future release dates
-- [H3RSKO brought this change]
+- [H3RSKO brought this change]
- docs: change "web site" to "website"
+ docs: change "web site" to "website"
- According to wikipedia:
+ According to wikipedia:
- While "web site" was the original spelling, this variant has become
- rarely used, and "website" has become the standard spelling
+ While "web site" was the original spelling, this variant has become
+ rarely used, and "website" has become the standard spelling
- Closes #5822
+ Closes #5822
+
+- [Bevan Weiss brought this change]
-- [Bevan Weiss brought this change]
-
- CMake: don't complain about missing nroff
+ CMake: don't complain about missing nroff
- The curl_nroff_check() was always being called, and complaining if
- *NROFF wasn't found, even when not making the manual.
+ The curl_nroff_check() was always being called, and complaining if
+ *NROFF wasn't found, even when not making the manual.
- Only check for nroff (and complain) if actually making the manual
+ Only check for nroff (and complain) if actually making the manual
- Closes #5817
+ Closes #5817
-- [Brian Inglis brought this change]
+- [Brian Inglis brought this change]
- libtest/Makefile.am: add -no-undefined for libstubgss for Cygwin
+ libtest/Makefile.am: add -no-undefined for libstubgss for Cygwin
- copy the LDFLAGS approach for adding same option with `libhostname` in
- `libtest/Makefile.am`:
+ copy the LDFLAGS approach for adding same option with `libhostname` in
+ `libtest/Makefile.am`:
- - init `libstubgss_la_LDFLAGS_EXTRA` variable,
- - add option to variable inside conditional,
- - use variable in `libstubgss_la_LDFLAGS`
-
- Fixes #5819
- Closes #5820
+ - init `libstubgss_la_LDFLAGS_EXTRA` variable,
+ - add option to variable inside conditional,
+ - use variable in `libstubgss_la_LDFLAGS`
+
+ Fixes #5819
+ Closes #5820
-- docs: clarify MAX_SEND/RECV_SPEED functionality
+- docs: clarify MAX_SEND/RECV_SPEED functionality
- ... in particular what happens if the maximum speed limit is set to a
- value that's smaller than the transfer buffer size in use.
+ ... in particular what happens if the maximum speed limit is set to a
+ value that's smaller than the transfer buffer size in use.
- Reported-by: Tomas Berger
- Fixes #5788
- Closes #5813
+ Reported-by: Tomas Berger
+ Fixes #5788
+ Closes #5813
-- test1140: compare stdout
+- test1140: compare stdout
- To make problems more immediately obvious when tests fail.
+ To make problems more immediately obvious when tests fail.
- Closes #5814
+ Closes #5814
-- asyn-ares: correct some bad comments
+- asyn-ares: correct some bad comments
- Closes #5812
+ Closes #5812
+
+- [Emil Engler brought this change]
-- [Emil Engler brought this change]
-
- docs: Add video link to docs/CONTRIBUTE.md
+ docs: Add video link to docs/CONTRIBUTE.md
- Closes #5811
+ Closes #5811
-- curl-config: ignore REQUIRE_LIB_DEPS in --libs output
+- curl-config: ignore REQUIRE_LIB_DEPS in --libs output
- Fixes a curl-config issue on cygwin by making sure REQUIRE_LIB_DEPS is
- not considered for the --libs output.
+ Fixes a curl-config issue on cygwin by making sure REQUIRE_LIB_DEPS is
+ not considered for the --libs output.
- Reported-by: ramsay-jones on github
- Assisted-by: Brian Inglis and Ken Brown
- Fixes #5793
- Closes #5808
+ Reported-by: ramsay-jones on github
+ Assisted-by: Brian Inglis and Ken Brown
+ Fixes #5793
+ Closes #5808
-- copyright: update/correct the year range on a few files
+- copyright: update/correct the year range on a few files
-- scripts/copyright.pl: ignore .muse files
+- scripts/copyright.pl: ignore .muse files
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- multi: Remove 10-year old out-commented code
+ multi: Remove 10-year old out-commented code
- The code hasn't been touched since 2010-08-18
+ The code hasn't been touched since 2010-08-18
- Closes #5805
+ Closes #5805
-- KNOWN_BUGS: A shared connection cache is not thread-safe
+- KNOWN_BUGS: A shared connection cache is not thread-safe
- Closes #4915
- Closes #5802
+ Closes #4915
+ Closes #5802
-- CONTRIBUTE: extend git commit message description
+- CONTRIBUTE: extend git commit message description
- In particular how the first line works.
+ In particular how the first line works.
- Closes #5803
+ Closes #5803
+
+- RELEASE-NOTES: synced
+
+- [Stefan Yohansson brought this change]
-- RELEASE-NOTES: synced
-
-- [Stefan Yohansson brought this change]
-
- transfer: move retrycount from connect struct to easy handle
+ transfer: move retrycount from connect struct to easy handle
- This flag was applied to the connection struct that is released on
- retry. These changes move the retry counter into Curl_easy struct that
- lives across retries and retains the new connection.
+ This flag was applied to the connection struct that is released on
+ retry. These changes move the retry counter into Curl_easy struct that
+ lives across retries and retains the new connection.
- Reported-by: Cherish98 on github
- Fixes #5794
- Closes #5800
+ Reported-by: Cherish98 on github
+ Fixes #5794
+ Closes #5800
-- libssh2: s/ssherr/sftperr/
+- libssh2: s/ssherr/sftperr/
- The debug output used ssherr instead of sftperr which not only outputs
- the wrong error code but also casues a warning on Windows.
+ The debug output used ssherr instead of sftperr which not only outputs
+ the wrong error code but also casues a warning on Windows.
- Follow-up to 7370b4e39f1
+ Follow-up to 7370b4e39f1
- Reported-by: Gisle Vanem
- Bug: https://github.com/curl/curl/commit/7370b4e39f1390e701f5b68d910c619151daf72b#r41334700
- Closes #5799
+ Reported-by: Gisle Vanem
+ Bug: https://github.com/curl/curl/commit/7370b4e39f1390e701f5b68d910c619151daf72b#r41334700
+ Closes #5799
-- ftp: don't do ssl_shutdown instead of ssl_close
+- ftp: don't do ssl_shutdown instead of ssl_close
- The shutdown function is for downgrading a connection from TLS to plain,
- and this is not requested here.
+ The shutdown function is for downgrading a connection from TLS to plain,
+ and this is not requested here.
- Have ssl_close reset the TLS connection state.
+ Have ssl_close reset the TLS connection state.
- This partially reverts commit f002c850d98d
+ This partially reverts commit f002c850d98d
- Reported-by: Rasmus Melchior Jacobsen
- Reported-by: Denis Goleshchikhin
- Fixes #5797
+ Reported-by: Rasmus Melchior Jacobsen
+ Reported-by: Denis Goleshchikhin
+ Fixes #5797
-Marc Hoersken (9 Aug 2020)
-- CI/azure: fix test outcome values and use latest API version
+Marc Hoersken (9 Aug 2020)
+- CI/azure: fix test outcome values and use latest API version
- This makes sure that tests ignored or skipped are not shown
- just in the category "Other", but with their correct state.
+ This makes sure that tests ignored or skipped are not shown
+ just in the category "Other", but with their correct state.
- Closes #5796
+ Closes #5796
-- CI/azure: show runtime stats to investigate slowness
+- CI/azure: show runtime stats to investigate slowness
- Also avoid naming conflict of TFLAGS env and tflags variables.
+ Also avoid naming conflict of TFLAGS env and tflags variables.
- Closes #5776
+ Closes #5776
-Daniel Stenberg (8 Aug 2020)
-- TLS naming: fix more Winssl and Darwinssl leftovers
+Daniel Stenberg (8 Aug 2020)
+- TLS naming: fix more Winssl and Darwinssl leftovers
- The CMake option is now called CMAKE_USE_SCHANNEL
+ The CMake option is now called CMAKE_USE_SCHANNEL
- The winbuild flag is USE_SCHANNEL
+ The winbuild flag is USE_SCHANNEL
- The CI jobs and build scripts only use the new names and the new name
- options
+ The CI jobs and build scripts only use the new names and the new name
+ options
- Tests now require 'Schannel' (when necessary)
+ Tests now require 'Schannel' (when necessary)
- Closes #5795
-
-- smtp_parse_address: handle blank input string properly
+ Closes #5795
+
+- smtp_parse_address: handle blank input string properly
- Closes #5792
+ Closes #5792
-- runtests: run the DICT server on a random port number
+- runtests: run the DICT server on a random port number
- Removed support for -b (base port number)
+ Removed support for -b (base port number)
- Closes #5783
+ Closes #5783
- RELEASE-NOTES: synced
-- runtests: move the TELNET server to a dynamic port
+- runtests: move the TELNET server to a dynamic port
+
+ Rename the port variable to TELNETPORT to better match the existing
+ pattern.
- Rename the port variable to TELNETPORT to better match the existing
- pattern.
-
- Closes #5785
+ Closes #5785
-- ngtcp2: adapt to error code rename
+- ngtcp2: adapt to error code rename
- Closes #5786
+ Closes #5786
-- runtests: move the smbserver to use a dynamic port number
+- runtests: move the smbserver to use a dynamic port number
- Closes #5782
+ Closes #5782
-- runtests: run the http2 tests on a random port number
+- runtests: run the http2 tests on a random port number
- Closes #5779
-
-- gtls: survive not being able to get name/issuer
+ Closes #5779
+
+- gtls: survive not being able to get name/issuer
- Closes #5778
+ Closes #5778
-- runtests: move the gnutls-serv tests to a dynamic port
+- runtests: move the gnutls-serv tests to a dynamic port
- Affects test 320, 321, 322 and 324.
+ Affects test 320, 321, 322 and 324.
- Closes #5778
-
-- runtests: support dynamicly base64 encoded sections in tests
+ Closes #5778
+
+- runtests: support dynamicly base64 encoded sections in tests
- This allows us to make test cases to use base64 at run-time and still
- use and verify information determined at run-time, such as the IMAP test
- server's port number in test 842.
+ This allows us to make test cases to use base64 at run-time and still
+ use and verify information determined at run-time, such as the IMAP test
+ server's port number in test 842.
- This change makes 12 tests run again that basically never ran since we
- moved to dynamic port numbers.
+ This change makes 12 tests run again that basically never ran since we
+ moved to dynamic port numbers.
- ftpserver.pl is adjusted to load test instructions and test number from
- the preprocessed test file.
+ ftpserver.pl is adjusted to load test instructions and test number from
+ the preprocessed test file.
- FILEFORMAT.md now documents the new base64 encoding syntax.
+ FILEFORMAT.md now documents the new base64 encoding syntax.
- Reported-by: Marcel Raad
- Fixes #5761
- Closes #5775
+ Reported-by: Marcel Raad
+ Fixes #5761
+ Closes #5775
-- curl.1: add a few missing valid exit codes
+- curl.1: add a few missing valid exit codes
- 93 - 96 can be returned as well.
+ 93 - 96 can be returned as well.
- Closes #5777
+ Closes #5777
-- TODO: Use multiple parallel transfers for a single download
-
- Closes #5774
+- TODO: Use multiple parallel transfers for a single download
+
+ Closes #5774
-- TODO: Set the modification date on an uploaded file
+- TODO: Set the modification date on an uploaded file
- Closes #5768
+ Closes #5768
-- [Thomas M. DuBuisson brought this change]
+- [Thomas M. DuBuisson brought this change]
- CI: Add muse CI config
+ CI: Add muse CI config
- Closes #5772
+ Closes #5772
-- [Thomas M. DuBuisson brought this change]
+- [Thomas M. DuBuisson brought this change]
- travis/script.sh: fix use of `-n' with unquoted envvar
+ travis/script.sh: fix use of `-n' with unquoted envvar
- Shellcheck tells us "-n doesn't work with unquoted arguments. quote or
- use [[ ]]."
+ Shellcheck tells us "-n doesn't work with unquoted arguments. quote or
+ use [[ ]]."
- And testing shows:
+ And testing shows:
- ```
- docker run --rm -it ubuntu bash
- root@fe85ce156856:/# [ -n $DOES_NOT_EXIST ] && echo "I ran"
- I ran
- root@fe85ce156856:/# [ -n "$DOES_NOT_EXIST" ] && echo "I ran"
- root@fe85ce156856:/#
- ```
+ ```
+ docker run --rm -it ubuntu bash
+ root@fe85ce156856:/# [ -n $DOES_NOT_EXIST ] && echo "I ran"
+ I ran
+ root@fe85ce156856:/# [ -n "$DOES_NOT_EXIST" ] && echo "I ran"
+ root@fe85ce156856:/#
+ ```
- Closes #5773
+ Closes #5773
-- h2: repair trailer handling
+- h2: repair trailer handling
- The previous h2 trailer fix in 54a2b63 was wrong and caused a
- regression: it cannot deal with trailers immediately when read since
- they may be read off the connection by the wrong 'data' owner.
+ The previous h2 trailer fix in 54a2b63 was wrong and caused a
+ regression: it cannot deal with trailers immediately when read since
+ they may be read off the connection by the wrong 'data' owner.
- This change reverts the logic back to gathering all trailers into a
- single buffer, like before 54a2b63.
+ This change reverts the logic back to gathering all trailers into a
+ single buffer, like before 54a2b63.
- Reported-by: Tadej Vengust
- Fixes #5663
- Closes #5769
+ Reported-by: Tadej Vengust
+ Fixes #5663
+ Closes #5769
-Viktor Szakats (3 Aug 2020)
-- windows: disable Unix Sockets for old mingw
+Viktor Szakats (3 Aug 2020)
+- windows: disable Unix Sockets for old mingw
+
+ Classic mingw and 10y+ old versions of mingw-w64 don't ship with
+ Windows headers having the typedef necessary for Unix Sockets
+ support, so try detecting these environments to disable this
+ feature.
+
+ Ref: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/cf6afc57179a5910621215f8f4037d406892072c/
- Classic mingw and 10y+ old versions of mingw-w64 don't ship with
- Windows headers having the typedef necessary for Unix Sockets
- support, so try detecting these environments to disable this
- feature.
+ Reviewed-by: Daniel Stenberg
- Ref: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/cf6afc57179a5910621215f8f4037d406892072c/
-
- Reviewed-by: Daniel Stenberg
-
- Fixes #5674
- Closes #5758
+ Fixes #5674
+ Closes #5758
-Marcel Raad (3 Aug 2020)
-- test1908: treat file as text
+Marcel Raad (3 Aug 2020)
+- test1908: treat file as text
- Fixes the line endings on Windows.
+ Fixes the line endings on Windows.
- Closes https://github.com/curl/curl/pull/5767
+ Closes https://github.com/curl/curl/pull/5767
-- TrackMemory tests: ignore realloc and free in getenv.c
+- TrackMemory tests: ignore realloc and free in getenv.c
- These are only called for WIN32.
+ These are only called for WIN32.
- Closes https://github.com/curl/curl/pull/5767
+ Closes https://github.com/curl/curl/pull/5767
+
+Daniel Stenberg (3 Aug 2020)
+- tests/FILEFORMAT.md: mention %HTTP2PORT
-Daniel Stenberg (3 Aug 2020)
-- tests/FILEFORMAT.md: mention %HTTP2PORT
-
- RELEASE-NOTES: synced
-- tlsv1.3.d. only for TLS-using connections
+- tlsv1.3.d. only for TLS-using connections
- ... and rephrase that "not all" TLS backends support it.
+ ... and rephrase that "not all" TLS backends support it.
- Closes #5764
+ Closes #5764
-- tls-max.d: this option is only for TLS-using connections
-
- Ref: #5763
- Closes #5764
+- tls-max.d: this option is only for TLS-using connections
+
+ Ref: #5763
+ Closes #5764
-Marcel Raad (2 Aug 2020)
-- [Cameron Cawley brought this change]
-
- tool_doswin: Simplify Windows version detection
+Marcel Raad (2 Aug 2020)
+- [Cameron Cawley brought this change]
+
+ tool_doswin: Simplify Windows version detection
- Closes https://github.com/curl/curl/pull/5754
+ Closes https://github.com/curl/curl/pull/5754
-- [Cameron Cawley brought this change]
+- [Cameron Cawley brought this change]
- win32: Add Curl_verify_windows_version() to curlx
+ win32: Add Curl_verify_windows_version() to curlx
- Closes https://github.com/curl/curl/pull/5754
+ Closes https://github.com/curl/curl/pull/5754
-- runtests.pl: treat LibreSSL and BoringSSL as OpenSSL
+- runtests.pl: treat LibreSSL and BoringSSL as OpenSSL
- This makes the tests that require the OpenSSL feature also run for
- those two compatible libraries.
+ This makes the tests that require the OpenSSL feature also run for
+ those two compatible libraries.
- Closes https://github.com/curl/curl/pull/5762
+ Closes https://github.com/curl/curl/pull/5762
-Daniel Stenberg (1 Aug 2020)
-- multi: Condition 'extrawait' is always true
+Daniel Stenberg (1 Aug 2020)
+- multi: Condition 'extrawait' is always true
- Reported by Codacy.
+ Reported by Codacy.
- Reviewed-by: Marcel Raad
- Closes #5759
+ Reviewed-by: Marcel Raad
+ Closes #5759
-Marcel Raad (1 Aug 2020)
-- openssl: fix build with LibreSSL < 2.9.1
+Marcel Raad (1 Aug 2020)
+- openssl: fix build with LibreSSL < 2.9.1
- `SSL_CTX_add0_chain_cert` and `SSL_CTX_clear_chain_certs` were
- introduced in LibreSSL 2.9.1 [0].
+ `SSL_CTX_add0_chain_cert` and `SSL_CTX_clear_chain_certs` were
+ introduced in LibreSSL 2.9.1 [0].
- [0] https://github.com/libressl-portable/openbsd/commit/0db809ee178457c8170abfae3931d7bd13abf3ef
+ [0] https://github.com/libressl-portable/openbsd/commit/0db809ee178457c8170abfae3931d7bd13abf3ef
- Closes https://github.com/curl/curl/pull/5757
+ Closes https://github.com/curl/curl/pull/5757
-Daniel Stenberg (1 Aug 2020)
-- [Marc Aldorasi brought this change]
+Daniel Stenberg (1 Aug 2020)
+- [Marc Aldorasi brought this change]
- multi_remove_handle: close unused connect-only connections
+ multi_remove_handle: close unused connect-only connections
- Previously any connect-only connections in a multi handle would be kept
- alive until the multi handle was closed. Since these connections cannot
- be re-used, they can be marked for closure when the associated easy
- handle is removed from the multi handle.
+ Previously any connect-only connections in a multi handle would be kept
+ alive until the multi handle was closed. Since these connections cannot
+ be re-used, they can be marked for closure when the associated easy
+ handle is removed from the multi handle.
- Closes #5749
+ Closes #5749
-- checksrc: invoke script with -D to find .checksrc proper
+- checksrc: invoke script with -D to find .checksrc proper
- Without the -D command line option, checksrc.pl won't know which
- directory to load the ".checksrc" file from when building out of the
- source tree.
+ Without the -D command line option, checksrc.pl won't know which
+ directory to load the ".checksrc" file from when building out of the
+ source tree.
- Reported-by: Marcel Raad
- Fixes #5715
- Closes #5755
+ Reported-by: Marcel Raad
+ Fixes #5715
+ Closes #5755
-- [Carlo Marcelo Arenas Belón brought this change]
+- [Carlo Marcelo Arenas Belón brought this change]
- buildconf: retire ares buildconf invocation
+ buildconf: retire ares buildconf invocation
- no longer needed after 4259d2df7dd95637a4b1e3fb174fe5e5aef81069
+ no longer needed after 4259d2df7dd95637a4b1e3fb174fe5e5aef81069
-- [Carlo Marcelo Arenas Belón brought this change]
+- [Carlo Marcelo Arenas Belón brought this change]
- buildconf: excempt defunct reference to ACLOCAL_FLAGS
+ buildconf: excempt defunct reference to ACLOCAL_FLAGS
- retired with 09f278121e815028adb24d228d8092fc6cb022aa but kept around as
- the name is generic enough that it might be in use and relied upon from
- the environment.
+ retired with 09f278121e815028adb24d228d8092fc6cb022aa but kept around as
+ the name is generic enough that it might be in use and relied upon from
+ the environment.
-- [Carlo Marcelo Arenas Belón brought this change]
+- [Carlo Marcelo Arenas Belón brought this change]
- buildconf: avoid array concatenation in die()
+ buildconf: avoid array concatenation in die()
+
+ reported as error SC2145[1] by shellcheck, but not expected to cause
+ any behavioural differences otherwise.
+
+ [1] https://github.com/koalaman/shellcheck/wiki/SC2145
- reported as error SC2145[1] by shellcheck, but not expected to cause
- any behavioural differences otherwise.
-
- [1] https://github.com/koalaman/shellcheck/wiki/SC2145
-
- Closes #5701
+ Closes #5701
-- travis: add ppc64le and s390x builds
+- travis: add ppc64le and s390x builds
- Closes #5752
+ Closes #5752
-Marc Hoersken (31 Jul 2020)
-- connect: remove redundant message about connect failure
+Marc Hoersken (31 Jul 2020)
+- connect: remove redundant message about connect failure
- Reviewed-by: Daniel Stenberg
+ Reviewed-by: Daniel Stenberg
- Closes #5708
+ Closes #5708
-- tests/sshserver.pl: fix compatibility with OpenSSH for Windows
-
- Follow up to #5721
+- tests/sshserver.pl: fix compatibility with OpenSSH for Windows
+
+ Follow up to #5721
-- CI/azure: install libssh2 for use with msys2-based builds
+- CI/azure: install libssh2 for use with msys2-based builds
+
+ This enables building and running the SFTP tests.
+ Unfortunately OpenSSH for Windows does not support SCP (yet).
- This enables building and running the SFTP tests.
- Unfortunately OpenSSH for Windows does not support SCP (yet).
+ Reviewed-by: Daniel Stenberg
- Reviewed-by: Daniel Stenberg
-
- Closes #5721
+ Closes #5721
-- CI/azure: increase Windows job timeout once again
+- CI/azure: increase Windows job timeout once again
- Avoid aborted jobs due to performance issues on Azure DevOps.
+ Avoid aborted jobs due to performance issues on Azure DevOps.
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Jay Satiro
- Closes #5738
+ Closes #5738
-Jay Satiro (30 Jul 2020)
-- TODO: Schannel: 'Add option to allow abrupt server closure'
+Jay Satiro (30 Jul 2020)
+- TODO: Schannel: 'Add option to allow abrupt server closure'
+
+ We should offer an option to allow abrupt server closures (server closes
+ SSL transfer without sending a known termination point such as length of
+ transfer or close_notify alert). Abrupt server closures are usually
+ because of misconfigured or very old servers.
- We should offer an option to allow abrupt server closures (server closes
- SSL transfer without sending a known termination point such as length of
- transfer or close_notify alert). Abrupt server closures are usually
- because of misconfigured or very old servers.
-
- Closes https://github.com/curl/curl/issues/4427
+ Closes https://github.com/curl/curl/issues/4427
-- url: fix CURLU and location following
+- url: fix CURLU and location following
- Prior to this change if the user set a URL handle (CURLOPT_CURLU) it was
- incorrectly used for the location follow, resulting in infinite requests
- to the original location.
+ Prior to this change if the user set a URL handle (CURLOPT_CURLU) it was
+ incorrectly used for the location follow, resulting in infinite requests
+ to the original location.
- Reported-by: sspiri@users.noreply.github.com
+ Reported-by: sspiri@users.noreply.github.com
- Fixes https://github.com/curl/curl/issues/5709
- Closes https://github.com/curl/curl/pull/5713
+ Fixes https://github.com/curl/curl/issues/5709
+ Closes https://github.com/curl/curl/pull/5713
-Daniel Stenberg (30 Jul 2020)
+Daniel Stenberg (30 Jul 2020)
- RELEASE-NOTES: synced
-- [divinity76 brought this change]
-
- docs: add date of 7.20 to CURLM_CALL_MULTI_PERFORM mentions
+- [divinity76 brought this change]
+
+ docs: add date of 7.20 to CURLM_CALL_MULTI_PERFORM mentions
- it helps make it obvious that most developers don't have to care about
- the CURLM_CALL_MULTI_PERFORM value (last release using it is nearly 11
- years old, November 4 2009)
+ it helps make it obvious that most developers don't have to care about
+ the CURLM_CALL_MULTI_PERFORM value (last release using it is nearly 11
+ years old, November 4 2009)
- Closes #5744
+ Closes #5744
-Jay Satiro (29 Jul 2020)
-- tool_cb_wrt: fix outfile mode flags for Windows
+Jay Satiro (29 Jul 2020)
+- tool_cb_wrt: fix outfile mode flags for Windows
+
+ - Use S_IREAD and S_IWRITE mode permission flags to create the file
+ on Windows instead of S_IRUSR, S_IWUSR, etc.
- - Use S_IREAD and S_IWRITE mode permission flags to create the file
- on Windows instead of S_IRUSR, S_IWUSR, etc.
+ Windows only accepts a combination of S_IREAD and S_IWRITE. It does not
+ acknowledge other combinations, for which it may generate an assertion.
- Windows only accepts a combination of S_IREAD and S_IWRITE. It does not
- acknowledge other combinations, for which it may generate an assertion.
+ This is a follow-up to 81b4e99 from yesterday, which improved the
+ existing file check with -J.
- This is a follow-up to 81b4e99 from yesterday, which improved the
- existing file check with -J.
-
- Ref: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-wopen#remarks
- Ref: https://github.com/curl/curl/pull/5731
-
- Closes https://github.com/curl/curl/pull/5742
+ Ref: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-wopen#remarks
+ Ref: https://github.com/curl/curl/pull/5731
+
+ Closes https://github.com/curl/curl/pull/5742
-Daniel Stenberg (28 Jul 2020)
-- checksrc: ban gmtime/localtime
+Daniel Stenberg (28 Jul 2020)
+- checksrc: ban gmtime/localtime
- They're not thread-safe so they should not be used in libcurl code.
+ They're not thread-safe so they should not be used in libcurl code.
- Explictly enabled when deemed necessary and in examples and tests
+ Explictly enabled when deemed necessary and in examples and tests
- Reviewed-by: Nicolas Sterchele
- Closes #5732
+ Reviewed-by: Nicolas Sterchele
+ Closes #5732
-- transfer: fix data_pending for builds with both h2 and h3 enabled
+- transfer: fix data_pending for builds with both h2 and h3 enabled
- Closes #5734
+ Closes #5734
-- curl_multi_setopt: fix compiler warning "result is always false"
+- curl_multi_setopt: fix compiler warning "result is always false"
+
+ On systems with 32 bit long the expression is always false. Avoid
+ the warning.
- On systems with 32 bit long the expression is always false. Avoid
- the warning.
-
- Reported-by: Gisle Vanem
- Bug: https://github.com/curl/curl/commit/61a08508f6a458fe21bbb18cd2a9bac2f039452b#commitcomment-40941232
- Closes #5736
+ Reported-by: Gisle Vanem
+ Bug: https://github.com/curl/curl/commit/61a08508f6a458fe21bbb18cd2a9bac2f039452b#commitcomment-40941232
+ Closes #5736
-- curl: improve the existing file check with -J
+- curl: improve the existing file check with -J
- Previously a file that isn't user-readable but is user-writable would
- not be properly avoided and would get overwritten.
+ Previously a file that isn't user-readable but is user-writable would
+ not be properly avoided and would get overwritten.
- Reported-by: BrumBrum on hackerone
- Assisted-by: Jay Satiro
- Bug: https://hackerone.com/reports/926638
- Closes #5731
+ Reported-by: BrumBrum on hackerone
+ Assisted-by: Jay Satiro
+ Bug: https://hackerone.com/reports/926638
+ Closes #5731
-- [Jonathan Nieder brought this change]
+- [Jonathan Nieder brought this change]
- multi: update comment to say easyp list is linear
+ multi: update comment to say easyp list is linear
- Since 09b9fc900 (multi: remove 'Curl_one_easy' struct, phase 1,
- 2013-08-02), the easy handle list is not circular but ends with
- ->next pointing to NULL.
-
- Reported-by: Masaya Suzuki <masayasuzuki@google.com>
- Closes #5737
+ Since 09b9fc900 (multi: remove 'Curl_one_easy' struct, phase 1,
+ 2013-08-02), the easy handle list is not circular but ends with
+ ->next pointing to NULL.
+
+ Reported-by: Masaya Suzuki <masayasuzuki@google.com>
+ Closes #5737
-- CURLOPT_NOBODY.3: fix the syntax for referring to options
+- CURLOPT_NOBODY.3: fix the syntax for referring to options
- As test 1140 fails otherwise!
+ As test 1140 fails otherwise!
- Follow-up to e1bac81cc815
+ Follow-up to e1bac81cc815
-- ngtcp2: store address in sockaddr_storage
+- ngtcp2: store address in sockaddr_storage
- Reported-by: Tatsuhiro Tsujikawa
- Closes #5733
+ Reported-by: Tatsuhiro Tsujikawa
+ Closes #5733
-- CURLOPT_NOBODY.3: clarify what setting to 0 means
+- CURLOPT_NOBODY.3: clarify what setting to 0 means
- ... and mention that HTTP with other methods than HEAD might get a body and
- there's no option available to stop that.
+ ... and mention that HTTP with other methods than HEAD might get a body and
+ there's no option available to stop that.
- Closes #5729
+ Closes #5729
-- setopt: unset NOBODY switches to GET if still HEAD
+- setopt: unset NOBODY switches to GET if still HEAD
- Unsetting CURLOPT_NOBODY with 0L when doing HTTP has no documented
- action but before 7.71.0 that used to switch back to GET and with this
- change (assuming the method is still set to HEAD) this behavior is
- brought back.
+ Unsetting CURLOPT_NOBODY with 0L when doing HTTP has no documented
+ action but before 7.71.0 that used to switch back to GET and with this
+ change (assuming the method is still set to HEAD) this behavior is
+ brought back.
- Reported-by: causal-agent on github
- Fixes #5725
- Closes #5728
+ Reported-by: causal-agent on github
+ Fixes #5725
+ Closes #5728
-- [Ehren Bendler brought this change]
+- [Ehren Bendler brought this change]
- configure: cleanup wolfssl + pkg-config conflicts when cross compiling.
+ configure: cleanup wolfssl + pkg-config conflicts when cross compiling.
- Also choose a different wolfSSL function to test for NTLM support.
+ Also choose a different wolfSSL function to test for NTLM support.
- Fixes #5605
- Closes #5682
+ Fixes #5605
+ Closes #5682
-- configure: show zstd "no" in summary when built without it
+- configure: show zstd "no" in summary when built without it
- Reported-by: Marc Hörsken
- Fixes #5720
- Closes #5730
+ Reported-by: Marc Hörsken
+ Fixes #5720
+ Closes #5730
-- quiche: handle calling disconnect twice
-
- Reported-by: lilongyan-huawei on github
- Fixes #5726
- Closes #5727
+- quiche: handle calling disconnect twice
+
+ Reported-by: lilongyan-huawei on github
+ Fixes #5726
+ Closes #5727
-- [Nicolas Sterchele brought this change]
+- [Nicolas Sterchele brought this change]
- getinfo: reset retry-after value in initinfo
+ getinfo: reset retry-after value in initinfo
- - Avoid re-using retry_after value from preceding request
- - Add libtest 3010 to verify
+ - Avoid re-using retry_after value from preceding request
+ - Add libtest 3010 to verify
- Reported-by: joey-l-us on github
- Fixes #5661
- Closes #5672
+ Reported-by: joey-l-us on github
+ Fixes #5661
+ Closes #5672
-Marcel Raad (27 Jul 2020)
-- WIN32: stop forcing narrow-character API
+Marcel Raad (27 Jul 2020)
+- WIN32: stop forcing narrow-character API
- Except where the results are only used for character output.
- getenv is not touched because it's part of the public API, and having
- it return UTF-8 instead of ANSI would be a breaking change.
+ Except where the results are only used for character output.
+ getenv is not touched because it's part of the public API, and having
+ it return UTF-8 instead of ANSI would be a breaking change.
- Fixes https://github.com/curl/curl/issues/5658
- Fixes https://github.com/curl/curl/issues/5712
- Closes https://github.com/curl/curl/pull/5718
+ Fixes https://github.com/curl/curl/issues/5658
+ Fixes https://github.com/curl/curl/issues/5712
+ Closes https://github.com/curl/curl/pull/5718
-Jay Satiro (27 Jul 2020)
-- [Tobias Stoeckmann brought this change]
+Jay Satiro (27 Jul 2020)
+- [Tobias Stoeckmann brought this change]
- mprintf: Fix stack overflows
+ mprintf: Fix stack overflows
- Stack overflows can occur with precisions for integers and floats.
+ Stack overflows can occur with precisions for integers and floats.
- Proof of concepts:
- - curl_mprintf("%d, %.*1$d", 500, 1);
- - curl_mprintf("%d, %+0500.*1$f", 500, 1);
+ Proof of concepts:
+ - curl_mprintf("%d, %.*1$d", 500, 1);
+ - curl_mprintf("%d, %+0500.*1$f", 500, 1);
- Ideally, compile with -fsanitize=address which makes this undefined
- behavior a bit more defined for debug purposes.
+ Ideally, compile with -fsanitize=address which makes this undefined
+ behavior a bit more defined for debug purposes.
- The format strings are valid. The overflows occur due to invalid
- arguments. If these arguments are variables with contents controlled
- by an attacker, the function's stack can be corrupted.
+ The format strings are valid. The overflows occur due to invalid
+ arguments. If these arguments are variables with contents controlled
+ by an attacker, the function's stack can be corrupted.
- Also see CVE-2016-9586 which partially fixed the float aspect.
+ Also see CVE-2016-9586 which partially fixed the float aspect.
- Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
+ Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
- Closes https://github.com/curl/curl/pull/5722
+ Closes https://github.com/curl/curl/pull/5722
-- [Tobias Stoeckmann brought this change]
+- [Tobias Stoeckmann brought this change]
- mprintf: Fix dollar string handling
+ mprintf: Fix dollar string handling
- Verify that specified parameters are in range. If parameters are too
- large, fail early on and avoid out of boundary accesses.
+ Verify that specified parameters are in range. If parameters are too
+ large, fail early on and avoid out of boundary accesses.
- Also do not read behind boundaries of illegal format strings.
+ Also do not read behind boundaries of illegal format strings.
- These are defensive measures since it is expected that format strings
- are well-formed. Format strings should not be modifiable by user
- input due to possible generic format string attacks.
-
- Closes https://github.com/curl/curl/pull/5722
+ These are defensive measures since it is expected that format strings
+ are well-formed. Format strings should not be modifiable by user
+ input due to possible generic format string attacks.
+
+ Closes https://github.com/curl/curl/pull/5722
-Daniel Stenberg (26 Jul 2020)
-- ntlm: free target_info before (re-)malloc
+Daniel Stenberg (26 Jul 2020)
+- ntlm: free target_info before (re-)malloc
+
+ OSS-Fuzz found a way this could get called again with the pointer still
+ pointing to a malloc'ed memory, leading to a leak.
- OSS-Fuzz found a way this could get called again with the pointer still
- pointing to a malloc'ed memory, leading to a leak.
+ Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24379
- Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24379
-
- Closes #5724
+ Closes #5724
-Marcel Raad (26 Jul 2020)
-- CI/macos: set minimum macOS version
+Marcel Raad (26 Jul 2020)
+- CI/macos: set minimum macOS version
- This enables some deprecation warnings.
- Previously, autotools defaulted to 10.8.
+ This enables some deprecation warnings.
+ Previously, autotools defaulted to 10.8.
- Closes https://github.com/curl/curl/pull/5723
+ Closes https://github.com/curl/curl/pull/5723
-Daniel Stenberg (26 Jul 2020)
+Daniel Stenberg (26 Jul 2020)
- RELEASE-NOTES: synced
-Marcel Raad (25 Jul 2020)
-- CI/macos: enable warnings as errors for CMake builds
+Marcel Raad (25 Jul 2020)
+- CI/macos: enable warnings as errors for CMake builds
- Closes https://github.com/curl/curl/pull/5716
+ Closes https://github.com/curl/curl/pull/5716
-- CMake: fix test for warning suppressions
+- CMake: fix test for warning suppressions
+
+ GCC doesn't warn for unknown `-Wno-` options, except if there are other
+ warnings or errors [0]. This was problematic with `CURL_WERROR` as that
+ warning-as-error cannot be suppressed. Notably, this always happened
+ with `-Wno-pedantic-ms-format` when not targeting Windows. So test for
+ the positive form of the warning instead, which should always result in
+ a diagnostic if unknown.
- GCC doesn't warn for unknown `-Wno-` options, except if there are other
- warnings or errors [0]. This was problematic with `CURL_WERROR` as that
- warning-as-error cannot be suppressed. Notably, this always happened
- with `-Wno-pedantic-ms-format` when not targeting Windows. So test for
- the positive form of the warning instead, which should always result in
- a diagnostic if unknown.
-
- [0] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
-
- Closes https://github.com/curl/curl/pull/5714
+ [0] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
+
+ Closes https://github.com/curl/curl/pull/5714
-Jay Satiro (23 Jul 2020)
-- curl.h: update CURLINFO_LASTONE
+Jay Satiro (23 Jul 2020)
+- curl.h: update CURLINFO_LASTONE
- CURLINFO_LASTONE should have been updated when
- CURLINFO_EFFECTIVE_METHOD was added.
+ CURLINFO_LASTONE should have been updated when
+ CURLINFO_EFFECTIVE_METHOD was added.
- Reported-by: xwxbug@users.noreply.github.com
+ Reported-by: xwxbug@users.noreply.github.com
- Fixes https://github.com/curl/curl/issues/5711
+ Fixes https://github.com/curl/curl/issues/5711
-Marc Hoersken (22 Jul 2020)
-- CI/azure: unconditionally enable warnings-as-errors with autotools
+Marc Hoersken (22 Jul 2020)
+- CI/azure: unconditionally enable warnings-as-errors with autotools
- Reviewed-by: Marcel Raad
+ Reviewed-by: Marcel Raad
- Follow up to #5694
- Closes #5706
+ Follow up to #5694
+ Closes #5706
-Marcel Raad (21 Jul 2020)
-- doh: remove redundant cast
+Marcel Raad (21 Jul 2020)
+- doh: remove redundant cast
- Closes https://github.com/curl/curl/pull/5704
+ Closes https://github.com/curl/curl/pull/5704
-- CI/macos: unconditionally enable warnings-as-errors with autotools
+- CI/macos: unconditionally enable warnings-as-errors with autotools
- Previously, warnings were only visible in the output for most jobs.
+ Previously, warnings were only visible in the output for most jobs.
- Closes https://github.com/curl/curl/pull/5694
+ Closes https://github.com/curl/curl/pull/5694
-- util: silence conversion warnings
+- util: silence conversion warnings
- timeval::tv_usec might be a 32-bit integer and timespec::tv_nsec might
- be a 64-bit integer. This is the case when building for recent macOS
- versions, for example. Just treat tv_usec as an int, which should
- hopefully always be sufficient on systems with
- `HAVE_CLOCK_GETTIME_MONOTONIC`.
+ timeval::tv_usec might be a 32-bit integer and timespec::tv_nsec might
+ be a 64-bit integer. This is the case when building for recent macOS
+ versions, for example. Just treat tv_usec as an int, which should
+ hopefully always be sufficient on systems with
+ `HAVE_CLOCK_GETTIME_MONOTONIC`.
- Closes https://github.com/curl/curl/pull/5695
+ Closes https://github.com/curl/curl/pull/5695
-- md(4|5): don't use deprecated macOS functions
+- md(4|5): don't use deprecated macOS functions
- They are marked as deprecated for -mmacosx-version-min >= 10.15,
- which might result in warnings-as-errors.
+ They are marked as deprecated for -mmacosx-version-min >= 10.15,
+ which might result in warnings-as-errors.
- Closes https://github.com/curl/curl/pull/5695
+ Closes https://github.com/curl/curl/pull/5695
-Daniel Stenberg (18 Jul 2020)
-- strdup: remove the odd strlen check
+Daniel Stenberg (18 Jul 2020)
+- strdup: remove the odd strlen check
- It confuses code analyzers with its use of -1 for unsigned value. Also,
- a check that's not normally used in strdup() code - and not necessary.
+ It confuses code analyzers with its use of -1 for unsigned value. Also,
+ a check that's not normally used in strdup() code - and not necessary.
- Closes #5697
+ Closes #5697
-- [Alessandro Ghedini brought this change]
-
- travis: update quiche builds for new boringssl layout
+- [Alessandro Ghedini brought this change]
+
+ travis: update quiche builds for new boringssl layout
+
+ This is required after https://github.com/cloudflare/quiche/pull/593
+ moved BoringSSL around slightly.
- This is required after https://github.com/cloudflare/quiche/pull/593
- moved BoringSSL around slightly.
+ This also means that Go is not needed to build BoringSSL anymore (the
+ one provided by quiche anyway).
- This also means that Go is not needed to build BoringSSL anymore (the
- one provided by quiche anyway).
-
- Closes #5691
+ Closes #5691
-Marcel Raad (17 Jul 2020)
-- configure: allow disabling warnings
+Marcel Raad (17 Jul 2020)
+- configure: allow disabling warnings
- When using `--enable-warnings`, it was not possible to disable warnings
- via CFLAGS that got explicitly enabled. Now warnings are not enabled
- anymore if they are explicitly disabled (or enabled) in CFLAGS. This
- works for at least GCC, clang, and TCC as they have corresponding
- `-Wno-` options for every warning.
+ When using `--enable-warnings`, it was not possible to disable warnings
+ via CFLAGS that got explicitly enabled. Now warnings are not enabled
+ anymore if they are explicitly disabled (or enabled) in CFLAGS. This
+ works for at least GCC, clang, and TCC as they have corresponding
+ `-Wno-` options for every warning.
- Closes https://github.com/curl/curl/pull/5689
+ Closes https://github.com/curl/curl/pull/5689
-Daniel Stenberg (16 Jul 2020)
-- ngtcp2: adjust to recent sockaddr updates
+Daniel Stenberg (16 Jul 2020)
+- ngtcp2: adjust to recent sockaddr updates
- Closes #5690
+ Closes #5690
-- page-header: provide protocol details in the curl.1 man page
+- page-header: provide protocol details in the curl.1 man page
- Add protocol and version specific information about all protocols curl
- supports.
+ Add protocol and version specific information about all protocols curl
+ supports.
- Fixes #5679
- Reported-by: tbugfinder on github
- Closes #5686
+ Fixes #5679
+ Reported-by: tbugfinder on github
+ Closes #5686
-Daniel Gustafsson (16 Jul 2020)
-- docs: Update a few leftover mentions of DarwinSSL
+Daniel Gustafsson (16 Jul 2020)
+- docs: Update a few leftover mentions of DarwinSSL
- Commit 76a9c3c4be10b3d4d379d5b23ca76806bbae536a renamed DarwinSSL to the
- more correct/common name Secure Transport, but a few mentions in the docs
- remained.
+ Commit 76a9c3c4be10b3d4d379d5b23ca76806bbae536a renamed DarwinSSL to the
+ more correct/common name Secure Transport, but a few mentions in the docs
+ remained.
- Closes #5688
- Reviewed-by: Daniel Stenberg <daniel@haxx.se>
+ Closes #5688
+ Reviewed-by: Daniel Stenberg <daniel@haxx.se>
-Daniel Stenberg (16 Jul 2020)
-- file2memory: use a define instead of -1 unsigned value
+Daniel Stenberg (16 Jul 2020)
+- file2memory: use a define instead of -1 unsigned value
- ... to use the maximum value for 'size_t' when detecting integer overflow.
- Changed the limit to max/4 as already that seems unreasonably large.
+ ... to use the maximum value for 'size_t' when detecting integer overflow.
+ Changed the limit to max/4 as already that seems unreasonably large.
- Codacy didn't like the previous approach.
+ Codacy didn't like the previous approach.
- Closes #5683
+ Closes #5683
-- CURL_PUSH_ERROROUT: allow the push callback to fail the parent stream
+- CURL_PUSH_ERROROUT: allow the push callback to fail the parent stream
- ... by adding support for a new dedicated return code.
+ ... by adding support for a new dedicated return code.
- Suggested-by: Jonathan Cardoso
- Assisted-by: Erik Johansson
- URL: https://curl.haxx.se/mail/lib-2020-06/0099.html
- Closes #5636
+ Suggested-by: Jonathan Cardoso
+ Assisted-by: Erik Johansson
+ URL: https://curl.haxx.se/mail/lib-2020-06/0099.html
+ Closes #5636
+
+- [Baruch Siach brought this change]
-- [Baruch Siach brought this change]
-
- nss: fix build with disabled proxy support
+ nss: fix build with disabled proxy support
- Avoid reference to fields that do not exist when CURL_DISABLE_PROXY is
- defined.
+ Avoid reference to fields that do not exist when CURL_DISABLE_PROXY is
+ defined.
- Closes #5667
+ Closes #5667
-- test1139: make it display the difference on test failures
+- test1139: make it display the difference on test failures
-- test1119: verify stdout in the test
+- test1119: verify stdout in the test
- So that failures will be displayed in the terminal, as it makes test failures
- visually displayed easier and faster.
+ So that failures will be displayed in the terminal, as it makes test failures
+ visually displayed easier and faster.
- Closes #5644
-
-- curl: add %{method} to the -w variables
+ Closes #5644
+
+- curl: add %{method} to the -w variables
- Gets the CURLINFO_EFFECTIVE_METHOD from libcurl.
+ Gets the CURLINFO_EFFECTIVE_METHOD from libcurl.
- Added test 1197 to verify.
+ Added test 1197 to verify.
-- CURLINFO_EFFECTIVE_METHOD: added
+- CURLINFO_EFFECTIVE_METHOD: added
+
+ Provide the HTTP method that was used on the latest request, which might
+ be relevant for users when there was one or more redirects involved.
- Provide the HTTP method that was used on the latest request, which might
- be relevant for users when there was one or more redirects involved.
-
- Closes #5511
+ Closes #5511
-Viktor Szakats (14 Jul 2020)
-- windows: add unicode to feature list
+Viktor Szakats (14 Jul 2020)
+- windows: add unicode to feature list
- Reviewed-by: Marcel Raad
- Reviewed-by: Marc Hörsken
+ Reviewed-by: Marcel Raad
+ Reviewed-by: Marc Hörsken
+
+ Closes #5491
+
+Daniel Stenberg (14 Jul 2020)
+- multi: remove two checks always true
- Closes #5491
+ Detected by Codacy
+ Closes #5676
-Daniel Stenberg (14 Jul 2020)
-- multi: remove two checks always true
+Marc Hoersken (13 Jul 2020)
+- workflows: limit what branches to run CodeQL on
- Detected by Codacy
- Closes #5676
-
-Marc Hoersken (13 Jul 2020)
-- workflows: limit what branches to run CodeQL on
+ Align CodeQL action with existing CI actions:
+ - Update branch filter to avoid duplicate CI runs.
+ - Shorten workflow name due to informative job name.
- Align CodeQL action with existing CI actions:
- - Update branch filter to avoid duplicate CI runs.
- - Shorten workflow name due to informative job name.
+ Reviewed-by: Daniel Stenberg
- Reviewed-by: Daniel Stenberg
-
- Closes #5660
+ Closes #5660
-- appveyor: collect libcurl.dll variants with prefix or suffix
+- appveyor: collect libcurl.dll variants with prefix or suffix
- On some platforms libcurl is build with a platform-specific
- prefix and/or a version number suffix.
+ On some platforms libcurl is build with a platform-specific
+ prefix and/or a version number suffix.
- Assisted-by: Jay Satiro
+ Assisted-by: Jay Satiro
- Closes #5659
+ Closes #5659
-Daniel Stenberg (12 Jul 2020)
-- [ihsinme brought this change]
+Daniel Stenberg (12 Jul 2020)
+- [ihsinme brought this change]
- socks: use size_t for size variable
-
- Use the unsigned type (size_t) in the arithmetic of pointers. In this
- context, the signed type (ssize_t) is used unnecessarily.
-
- Authored-by: ihsinme on github
- Closes #5654
+ socks: use size_t for size variable
+
+ Use the unsigned type (size_t) in the arithmetic of pointers. In this
+ context, the signed type (ssize_t) is used unnecessarily.
+
+ Authored-by: ihsinme on github
+ Closes #5654
-- RELEASE-NOTES: synced
-
- ... and bumped to 7.72.0 as the next release version number
+- RELEASE-NOTES: synced
+
+ ... and bumped to 7.72.0 as the next release version number
-- [Gilles Vollant brought this change]
+- [Gilles Vollant brought this change]
- content_encoding: add zstd decoding support
-
- include zstd curl patch for Makefile.m32 from vszakats
- and include Add CMake support for zstd from Peter Wu
-
- Helped-by: Viktor Szakats
- Helped-by: Peter Wu
- Closes #5453
+ content_encoding: add zstd decoding support
+
+ include zstd curl patch for Makefile.m32 from vszakats
+ and include Add CMake support for zstd from Peter Wu
+
+ Helped-by: Viktor Szakats
+ Helped-by: Peter Wu
+ Closes #5453
-- asyn.h: remove the Curl_resolver_getsock define
-
- - not used
- - used the wrong number of arguments
- - confused the Codeacy code analyzer
-
- Closes #5647
+- asyn.h: remove the Curl_resolver_getsock define
+
+ - not used
+ - used the wrong number of arguments
+ - confused the Codeacy code analyzer
+
+ Closes #5647
-- [Nicolas Sterchele brought this change]
+- [Nicolas Sterchele brought this change]
- configure.ac: Sort features name in summary
+ configure.ac: Sort features name in summary
+
+ - Same as protocols
- - Same as protocols
-
- Closes #5656
+ Closes #5656
-- [Matthias Naegler brought this change]
+- [Matthias Naegler brought this change]
- cmake: fix windows xp build
+ cmake: fix windows xp build
- Reviewed-by: Marcel Raad
- Closes #5662
+ Reviewed-by: Marcel Raad
+ Closes #5662
-- ngtcp2: update to modified qlog callback prototype
+- ngtcp2: update to modified qlog callback prototype
- Closes #5675
+ Closes #5675
-- transfer: fix memory-leak with CURLOPT_CURLU in a duped handle
+- transfer: fix memory-leak with CURLOPT_CURLU in a duped handle
- Added test case 674 to reproduce and verify the bug report.
+ Added test case 674 to reproduce and verify the bug report.
- Fixes #5665
- Reported-by: NobodyXu on github
- Closes #5673
+ Fixes #5665
+ Reported-by: NobodyXu on github
+ Closes #5673
+
+- [Baruch Siach brought this change]
-- [Baruch Siach brought this change]
+ bearssl: fix build with disabled proxy support
+
+ Avoid reference to fields that do not exist when CURL_DISABLE_PROXY is
+ defined.
+
+ Reviewed-by: Nicolas Sterchele
+ Closes #5666
- bearssl: fix build with disabled proxy support
-
- Avoid reference to fields that do not exist when CURL_DISABLE_PROXY is
- defined.
-
- Reviewed-by: Nicolas Sterchele
- Closes #5666
+- RELEASE-NOTES: synced
-- RELEASE-NOTES: synced
+Jay Satiro (11 Jul 2020)
+- [Carlo Marcelo Arenas Belón brought this change]
-Jay Satiro (11 Jul 2020)
-- [Carlo Marcelo Arenas Belón brought this change]
-
- cirrus-ci: upgrade 11-STABLE to 11.4
+ cirrus-ci: upgrade 11-STABLE to 11.4
- Meant to be the last of the 11 series and so make sure that all
- other references reflect all 11 versions so they can be retired
- together later.
-
- Closes https://github.com/curl/curl/pull/5668
+ Meant to be the last of the 11 series and so make sure that all
+ other references reflect all 11 versions so they can be retired
+ together later.
+
+ Closes https://github.com/curl/curl/pull/5668
-- [Filip Salomonsson brought this change]
+- [Filip Salomonsson brought this change]
- CURLINFO_CERTINFO.3: fix typo
+ CURLINFO_CERTINFO.3: fix typo
- Closes https://github.com/curl/curl/pull/5655
-
-Daniel Stenberg (4 Jul 2020)
-- http2: only do the *done() cleanups for HTTP
+ Closes https://github.com/curl/curl/pull/5655
+
+Daniel Stenberg (4 Jul 2020)
+- http2: only do the *done() cleanups for HTTP
- Follow-up to ef86daf4d3
+ Follow-up to ef86daf4d3
- Closes #5650
- Fixes #5646
+ Closes #5650
+ Fixes #5646
-- [Alex Kiernan brought this change]
-
- gnutls: repair the build with `CURL_DISABLE_PROXY`
+- [Alex Kiernan brought this change]
+
+ gnutls: repair the build with `CURL_DISABLE_PROXY`
- `http_proxy`/`proxy_ssl`/`tunnel_proxy` will not be available in `conn`
- if `CURL_DISABLE_PROXY` is enabled. Repair the build with that
- configuration.
+ `http_proxy`/`proxy_ssl`/`tunnel_proxy` will not be available in `conn`
+ if `CURL_DISABLE_PROXY` is enabled. Repair the build with that
+ configuration.
- Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
- Closes #5645
+ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+ Closes #5645
-Alex Kiernan (3 Jul 2020)
-- gnutls: Fetch backend when using proxy
+Alex Kiernan (3 Jul 2020)
+- gnutls: Fetch backend when using proxy
- Fixes: 89865c149 ("gnutls: remove the BACKEND define kludge")
- Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+ Fixes: 89865c149 ("gnutls: remove the BACKEND define kludge")
+ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
-Daniel Stenberg (3 Jul 2020)
-- [Laramie Leavitt brought this change]
+Daniel Stenberg (3 Jul 2020)
+- [Laramie Leavitt brought this change]
- http2: close the http2 connection when no more requests may be sent
+ http2: close the http2 connection when no more requests may be sent
+
+ Well-behaving HTTP2 servers send two GOAWAY messages. The first
+ message is a warning that indicates that the server is going to
+ stop accepting streams. The second one actually closes the stream.
+
+ nghttp2 reports this state (and the other state of no more stream
+ identifiers) via the call nghttp2_session_check_request_allowed().
+ In this state the client should not create more streams on the
+ session (tcp connection), and in curl this means that the server
+ has requested that the connection is closed.
- Well-behaving HTTP2 servers send two GOAWAY messages. The first
- message is a warning that indicates that the server is going to
- stop accepting streams. The second one actually closes the stream.
+ It would be also be possible to put the connclose() call into the
+ on_http2_frame_recv() function that triggers on the GOAWAY message.
- nghttp2 reports this state (and the other state of no more stream
- identifiers) via the call nghttp2_session_check_request_allowed().
- In this state the client should not create more streams on the
- session (tcp connection), and in curl this means that the server
- has requested that the connection is closed.
+ This fixes a bug seen when the client sees the following sequence of
+ frames:
- It would be also be possible to put the connclose() call into the
- on_http2_frame_recv() function that triggers on the GOAWAY message.
+ // advisory GOAWAY
+ HTTP2 GOAWAY [stream-id = 0, promised-stream-id = -1]
+ ... some additional frames
- This fixes a bug seen when the client sees the following sequence of
- frames:
+ // final GOAWAY
+ HTTP2 GOAWAY [stream-id = 0, promised-stream-id = N ]
- // advisory GOAWAY
- HTTP2 GOAWAY [stream-id = 0, promised-stream-id = -1]
- ... some additional frames
+ Before this change, curl will attempt to reuse the connection even
+ after the last stream, will encounter this error:
- // final GOAWAY
- HTTP2 GOAWAY [stream-id = 0, promised-stream-id = N ]
+ * Found bundle for host localhost: 0x5595f0a694e0 [can multiplex]
+ * Re-using existing connection! (#0) with host localhost
+ * Connected to localhost (::1) port 10443 (#0)
+ * Using Stream ID: 9 (easy handle 0x5595f0a72e30)
+ > GET /index.html?5 HTTP/2
+ > Host: localhost:10443
+ > user-agent: curl/7.68.0
+ > accept: */*
+ >
+ * stopped the pause stream!
+ * Connection #0 to host localhost left intact
+ curl: (16) Error in the HTTP2 framing layer
- Before this change, curl will attempt to reuse the connection even
- after the last stream, will encounter this error:
-
- * Found bundle for host localhost: 0x5595f0a694e0 [can multiplex]
- * Re-using existing connection! (#0) with host localhost
- * Connected to localhost (::1) port 10443 (#0)
- * Using Stream ID: 9 (easy handle 0x5595f0a72e30)
- > GET /index.html?5 HTTP/2
- > Host: localhost:10443
- > user-agent: curl/7.68.0
- > accept: */*
- >
- * stopped the pause stream!
- * Connection #0 to host localhost left intact
- curl: (16) Error in the HTTP2 framing layer
-
- This error may posion the connection cache, causing future requests
- which resolve to the same curl connection to go through the same error
- path.
-
- Closes #5643
+ This error may posion the connection cache, causing future requests
+ which resolve to the same curl connection to go through the same error
+ path.
+
+ Closes #5643
-- ftpserver: don't verify SMTP MAIL FROM names
+- ftpserver: don't verify SMTP MAIL FROM names
- Rely on tests asking the names to get refused instead - test servers
- should be as dumb as possible. Edited test 914, 955 and 959 accordingly.
+ Rely on tests asking the names to get refused instead - test servers
+ should be as dumb as possible. Edited test 914, 955 and 959 accordingly.
- Closes #5639
+ Closes #5639
-- curl_version_info.3: CURL_VERSION_KERBEROS4 is deprecated
+- curl_version_info.3: CURL_VERSION_KERBEROS4 is deprecated
- This came up in #5640. It make sense to clarify this in the docs!
+ This came up in #5640. It make sense to clarify this in the docs!
- Reminded-by: Kamil Dudka
- Closes #5642
+ Reminded-by: Kamil Dudka
+ Closes #5642
-Kamil Dudka (3 Jul 2020)
-- tool_getparam: make --krb option work again
+Kamil Dudka (3 Jul 2020)
+- tool_getparam: make --krb option work again
- It was disabled by mistake in commit curl-7_37_1-23-ge38ba4301.
+ It was disabled by mistake in commit curl-7_37_1-23-ge38ba4301.
- Bug: https://bugzilla.redhat.com/1833193
- Closes #5640
-
-Daniel Stenberg (2 Jul 2020)
-- [Jeremy Maitin-Shepard brought this change]
-
- http2: fix nghttp2_strerror -> nghttp2_http2_strerror in debug messages
+ Bug: https://bugzilla.redhat.com/1833193
+ Closes #5640
+
+Daniel Stenberg (2 Jul 2020)
+- [Jeremy Maitin-Shepard brought this change]
+
+ http2: fix nghttp2_strerror -> nghttp2_http2_strerror in debug messages
- Confusingly, nghttp2 has two different error code enums:
+ Confusingly, nghttp2 has two different error code enums:
- - nghttp2_error, to be used with nghttp2_strerror
- - nghttp2_error_code, to be used with nghttp2_http2_strerror
+ - nghttp2_error, to be used with nghttp2_strerror
+ - nghttp2_error_code, to be used with nghttp2_http2_strerror
- Closes #5641
+ Closes #5641
-Marcel Raad (2 Jul 2020)
-- url: silence MSVC warning
+Marcel Raad (2 Jul 2020)
+- url: silence MSVC warning
- Since commit f3d501dc678, if proxy support is disabled, MSVC warns:
- url.c : warning C4701: potentially uninitialized local variable
- 'hostaddr' used
- url.c : error C4703: potentially uninitialized local pointer variable
- 'hostaddr' used
+ Since commit f3d501dc678, if proxy support is disabled, MSVC warns:
+ url.c : warning C4701: potentially uninitialized local variable
+ 'hostaddr' used
+ url.c : error C4703: potentially uninitialized local pointer variable
+ 'hostaddr' used
- That could actually only happen if both `conn->bits.proxy` and
- `CURL_DISABLE_PROXY` were enabled.
- Initialize it to NULL to silence the warning.
+ That could actually only happen if both `conn->bits.proxy` and
+ `CURL_DISABLE_PROXY` were enabled.
+ Initialize it to NULL to silence the warning.
- Closes https://github.com/curl/curl/pull/5638
+ Closes https://github.com/curl/curl/pull/5638
-Daniel Stenberg (1 Jul 2020)
+Daniel Stenberg (1 Jul 2020)
- RELEASE-NOTES: synced
-Version 7.71.1 (30 Jun 2020)
+Version 7.71.1 (30 Jun 2020)
+
+Daniel Stenberg (30 Jun 2020)
+- RELEASE-NOTES: curl 7.71.1
-Daniel Stenberg (30 Jun 2020)
-- RELEASE-NOTES: curl 7.71.1
+- THANKS: add contributors to 7.71.1
-- THANKS: add contributors to 7.71.1
+- scripts/copyright.pl: skip .dcignore
-- scripts/copyright.pl: skip .dcignore
-
-- Revert "multi: implement wait using winsock events"
+- Revert "multi: implement wait using winsock events"
- This reverts commit 8bc25c590e530de87595d1bb3577f699eb1309b9.
+ This reverts commit 8bc25c590e530de87595d1bb3577f699eb1309b9.
- That commit (from #5397) introduced a regression in 7.71.0.
+ That commit (from #5397) introduced a regression in 7.71.0.
- Reported-by: tmkk on github
- Fixes #5631
- Closes #5632
+ Reported-by: tmkk on github
+ Fixes #5631
+ Closes #5632
+
+- TODO: Add flag to specify download directory
+
+- TODO: return code to CURLMOPT_PUSHFUNCTION to fail connection
-- TODO: Add flag to specify download directory
-
-- TODO: return code to CURLMOPT_PUSHFUNCTION to fail connection
-
-- cirrus-ci: disable FreeBSD 13 (again)
+- cirrus-ci: disable FreeBSD 13 (again)
- It has been failing for a good while again. This time we better leave it
- disabled until we have more reason to believe it behaves.
+ It has been failing for a good while again. This time we better leave it
+ disabled until we have more reason to believe it behaves.
- Closes #5628
+ Closes #5628
-- ngtcp2: sync with current master
+- ngtcp2: sync with current master
- ngtcp2 added two new callbacks
-
- Reported-by: Lucien Zürcher
- Fixes #5624
- Closes #5627
+ ngtcp2 added two new callbacks
+
+ Reported-by: Lucien Zürcher
+ Fixes #5624
+ Closes #5627
-- examples/multithread.c: call curl_global_cleanup()
+- examples/multithread.c: call curl_global_cleanup()
- Reported-by: qiandu2006 on github
- Fixes #5622
- Closes #5623
+ Reported-by: qiandu2006 on github
+ Fixes #5622
+ Closes #5623
-- vtls: compare cert blob when finding a connection to reuse
+- vtls: compare cert blob when finding a connection to reuse
- Reported-by: Gergely Nagy
- Fixes #5617
- Closes #5619
+ Reported-by: Gergely Nagy
+ Fixes #5617
+ Closes #5619
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- terminology: call them null-terminated strings
+- terminology: call them null-terminated strings
+
+ Updated terminology in docs, comments and phrases to refer to C strings
+ as "null-terminated". Done to unify with how most other C oriented docs
+ refer of them and what users in general seem to prefer (based on a
+ single highly unscientific poll on twitter).
- Updated terminology in docs, comments and phrases to refer to C strings
- as "null-terminated". Done to unify with how most other C oriented docs
- refer of them and what users in general seem to prefer (based on a
- single highly unscientific poll on twitter).
-
- Reported-by: coinhubs on github
- Fixes #5598
- Closes #5608
+ Reported-by: coinhubs on github
+ Fixes #5598
+ Closes #5608
-- http: fix proxy auth with blank password
-
- Regression in 7.71.0
-
- Added test case 346 to verify.
-
- Reported-by: Kristoffer Gleditsch
- Fixes #5613
- Closes #5616
+- http: fix proxy auth with blank password
+
+ Regression in 7.71.0
+
+ Added test case 346 to verify.
+
+ Reported-by: Kristoffer Gleditsch
+ Fixes #5613
+ Closes #5616
-- .dcignore: ignore tests and docs directories
+- .dcignore: ignore tests and docs directories
- This is a config file for deepcode.ai, a static code analyzer.
+ This is a config file for deepcode.ai, a static code analyzer.
-Jay Satiro (26 Jun 2020)
-- tool_cb_hdr: Fix etag warning output and return code
+Jay Satiro (26 Jun 2020)
+- tool_cb_hdr: Fix etag warning output and return code
+
+ - Return 'failure' on failure, to follow the existing style.
+
+ - Put Warning: and the warning message on the same line.
- - Return 'failure' on failure, to follow the existing style.
+ Ref: https://github.com/curl/curl/issues/5610
- - Put Warning: and the warning message on the same line.
-
- Ref: https://github.com/curl/curl/issues/5610
-
- Closes https://github.com/curl/curl/pull/5612
+ Closes https://github.com/curl/curl/pull/5612
-Daniel Stenberg (26 Jun 2020)
-- CURLOPT_READFUNCTION.3: provide the upload data size up front
+Daniel Stenberg (26 Jun 2020)
+- CURLOPT_READFUNCTION.3: provide the upload data size up front
- Assisted-by: Jay Satiro
- Closes #5607
+ Assisted-by: Jay Satiro
+ Closes #5607
-- test1539: do a HTTP 1.0 POST without a set size (fails)
+- test1539: do a HTTP 1.0 POST without a set size (fails)
- Attempt to reproduce #5593. Test case 1514 is very similar but uses
- HTTP/1.1 and thus switches to chunked.
+ Attempt to reproduce #5593. Test case 1514 is very similar but uses
+ HTTP/1.1 and thus switches to chunked.
- Closes #5595
+ Closes #5595
-- [Baruch Siach brought this change]
+- [Baruch Siach brought this change]
- mbedtls: fix build with disabled proxy support
+ mbedtls: fix build with disabled proxy support
- Don't reference fields that do not exist. Fixes build failure:
+ Don't reference fields that do not exist. Fixes build failure:
- vtls/mbedtls.c: In function 'mbed_connect_step1':
- vtls/mbedtls.c:249:54: error: 'struct connectdata' has no member named 'http_proxy'
+ vtls/mbedtls.c: In function 'mbed_connect_step1':
+ vtls/mbedtls.c:249:54: error: 'struct connectdata' has no member named 'http_proxy'
- Closes #5615
-
-- codeql-analysis.yml: fix the 'languages' setting
+ Closes #5615
+
+- codeql-analysis.yml: fix the 'languages' setting
- It needs a 'with:' in front of it.
+ It needs a 'with:' in front of it.
-GitHub (26 Jun 2020)
-- [Daniel Stenberg brought this change]
+GitHub (26 Jun 2020)
+- [Daniel Stenberg brought this change]
- gtihub: codeql-analysis.yml
+ gtihub: codeql-analysis.yml
- enables code security scanning with github actions
+ enables code security scanning with github actions
-Daniel Stenberg (25 Jun 2020)
-- tests: verify newline in username and password for HTTP
+Daniel Stenberg (25 Jun 2020)
+- tests: verify newline in username and password for HTTP
- test 1296 is a simply command line test
+ test 1296 is a simply command line test
- test 1910 is a libcurl test including a redirect
-
-- url: allow user + password to contain "control codes" for HTTP(S)
+ test 1910 is a libcurl test including a redirect
+
+- url: allow user + password to contain "control codes" for HTTP(S)
- Reported-by: Jon Johnson Jr
- Fixes #5582
- Closes #5592
+ Reported-by: Jon Johnson Jr
+ Fixes #5582
+ Closes #5592
-- escape: make the URL decode able to reject only %00 bytes
+- escape: make the URL decode able to reject only %00 bytes
- ... or all "control codes" or nothing.
-
- Assisted-by: Nicolas Sterchele
+ ... or all "control codes" or nothing.
+
+ Assisted-by: Nicolas Sterchele
-- http2: set the correct URL in pushed transfers
+- http2: set the correct URL in pushed transfers
- ...previously CURLINFO_EFFECTIVE_URL would report the URL of the
- original "mother transfer", not the actually pushed resource.
+ ...previously CURLINFO_EFFECTIVE_URL would report the URL of the
+ original "mother transfer", not the actually pushed resource.
- Reported-by: Jonathan Cardoso Machado
- Fixes #5589
- Closes #5591
+ Reported-by: Jonathan Cardoso Machado
+ Fixes #5589
+ Closes #5591
-Jay Satiro (25 Jun 2020)
-- [Javier Blazquez brought this change]
+Jay Satiro (25 Jun 2020)
+- [Javier Blazquez brought this change]
- openssl: Fix compilation on Windows when ngtcp2 is enabled
+ openssl: Fix compilation on Windows when ngtcp2 is enabled
+
+ - Include wincrypt before OpenSSL includes so that the latter can
+ properly handle any conflicts between the two.
- - Include wincrypt before OpenSSL includes so that the latter can
- properly handle any conflicts between the two.
-
- Closes https://github.com/curl/curl/pull/5606
+ Closes https://github.com/curl/curl/pull/5606
-Daniel Stenberg (25 Jun 2020)
-- test543: extended to verify zero length input
+Daniel Stenberg (25 Jun 2020)
+- test543: extended to verify zero length input
- As was reported in #5601
+ As was reported in #5601
-- escape: zero length input should return a zero length output
+- escape: zero length input should return a zero length output
- Regression added in 7.71.0.
+ Regression added in 7.71.0.
- Fixes #5601
- Reported-by: Kristoffer Gleditsch
- Closes #5602
+ Fixes #5601
+ Reported-by: Kristoffer Gleditsch
+ Closes #5602
-- Curl_inet_ntop: always check the return code
+- Curl_inet_ntop: always check the return code
- Reported-by: Siva Sivaraman
- Fixes #5412
- Closes #5597
+ Reported-by: Siva Sivaraman
+ Fixes #5412
+ Closes #5597
-- sendf: improve the message on client write errors
+- sendf: improve the message on client write errors
- Replace "Failed writing body (X != Y)" with
- "Failure writing output to destination". Possibly slightly less cryptic.
+ Replace "Failed writing body (X != Y)" with
+ "Failure writing output to destination". Possibly slightly less cryptic.
- Reported-by: coinhubs on github
- Fixes #5594
- Closes #5596
+ Reported-by: coinhubs on github
+ Fixes #5594
+ Closes #5596
- RELEASE-NOTES: synced
-- curlver: start working on 7.71.1
+- curlver: start working on 7.71.1
-- [Denis Baručić brought this change]
+- [Denis Baručić brought this change]
- DYNBUF.md: fix a typo: trail => tail
+ DYNBUF.md: fix a typo: trail => tail
- Closes #5599
+ Closes #5599
-Version 7.71.0 (23 Jun 2020)
+Version 7.71.0 (23 Jun 2020)
-Daniel Stenberg (23 Jun 2020)
-- RELEASE-NOTES: curl 7.71.0 release
+Daniel Stenberg (23 Jun 2020)
+- RELEASE-NOTES: curl 7.71.0 release
-- THANKS: curl 7.71.0 additions
+- THANKS: curl 7.71.0 additions
-- url: make sure pushed streams get an allocated download buffer
+- url: make sure pushed streams get an allocated download buffer
+
+ Follow-up to c4e6968127e876b0
- Follow-up to c4e6968127e876b0
+ When a new transfer is created, as a resuly of an acknowledged push,
+ that transfer needs a download buffer allocated.
- When a new transfer is created, as a resuly of an acknowledged push,
- that transfer needs a download buffer allocated.
-
- Closes #5590
+ Closes #5590
-Jay Satiro (22 Jun 2020)
-- openssl: Don't ignore CA paths when using Windows CA store
+Jay Satiro (22 Jun 2020)
+- openssl: Don't ignore CA paths when using Windows CA store
- This commit changes the behavior of CURLSSLOPT_NATIVE_CA so that it does
- not override CURLOPT_CAINFO / CURLOPT_CAPATH, or the hardcoded default
- locations. Instead the CA store can now be used at the same time.
+ This commit changes the behavior of CURLSSLOPT_NATIVE_CA so that it does
+ not override CURLOPT_CAINFO / CURLOPT_CAPATH, or the hardcoded default
+ locations. Instead the CA store can now be used at the same time.
- The change is due to the impending release. The issue is still being
- discussed. The behavior of CURLSSLOPT_NATIVE_CA is subject to change and
- is now documented as experimental.
-
- Ref: bc052cc (parent commit)
- Ref: https://github.com/curl/curl/issues/5585
+ The change is due to the impending release. The issue is still being
+ discussed. The behavior of CURLSSLOPT_NATIVE_CA is subject to change and
+ is now documented as experimental.
+
+ Ref: bc052cc (parent commit)
+ Ref: https://github.com/curl/curl/issues/5585
-- tool_operate: Don't use Windows CA store as a fallback
+- tool_operate: Don't use Windows CA store as a fallback
+
+ Background:
- Background:
+ 148534d added CURLSSLOPT_NATIVE_CA to use the Windows OS certificate
+ store in libcurl w/ OpenSSL on Windows. CURLSSLOPT_NATIVE_CA overrides
+ CURLOPT_CAINFO if both are set. The curl tool will fall back to
+ CURLSSLOPT_NATIVE_CA if it could not find a certificate bundle to set
+ via CURLOPT_CAINFO.
- 148534d added CURLSSLOPT_NATIVE_CA to use the Windows OS certificate
- store in libcurl w/ OpenSSL on Windows. CURLSSLOPT_NATIVE_CA overrides
- CURLOPT_CAINFO if both are set. The curl tool will fall back to
- CURLSSLOPT_NATIVE_CA if it could not find a certificate bundle to set
- via CURLOPT_CAINFO.
+ Problem:
- Problem:
-
- libcurl may be built with hardcoded paths to a certificate bundle or
- directory, and if CURLSSLOPT_NATIVE_CA is used then those paths are
- ignored.
-
- Solution:
-
- A solution is still being discussed but since there's an impending
- release this commit removes using CURLSSLOPT_NATIVE_CA in the curl tool.
-
- Ref: https://github.com/curl/curl/issues/5585
+ libcurl may be built with hardcoded paths to a certificate bundle or
+ directory, and if CURLSSLOPT_NATIVE_CA is used then those paths are
+ ignored.
+
+ Solution:
+
+ A solution is still being discussed but since there's an impending
+ release this commit removes using CURLSSLOPT_NATIVE_CA in the curl tool.
+
+ Ref: https://github.com/curl/curl/issues/5585
-- openssl: Fix CA fallback logic for OpenSSL 3.0 build
-
- Prior to this change I assume a build error would occur when
- CURL_CA_FALLBACK was used.
-
- Closes https://github.com/curl/curl/pull/5587
+- openssl: Fix CA fallback logic for OpenSSL 3.0 build
+
+ Prior to this change I assume a build error would occur when
+ CURL_CA_FALLBACK was used.
+
+ Closes https://github.com/curl/curl/pull/5587
+
+Daniel Stenberg (22 Jun 2020)
+- copyright: update mismatched copyright years
-Daniel Stenberg (22 Jun 2020)
-- copyright: update mismatched copyright years
+- test1460: verify that -Ji is not ok
-- test1460: verify that -Ji is not ok
-
-- tool_getparam: -i is not OK if -J is used
+- tool_getparam: -i is not OK if -J is used
- Reported-by: sn on hackerone
- Bug: https://curl.haxx.se/docs/CVE-2020-8177.html
-
-- [Peter Wu brought this change]
-
- CMake: ignore INTERFACE_LIBRARY targets for pkg-config file
+ Reported-by: sn on hackerone
+ Bug: https://curl.haxx.se/docs/CVE-2020-8177.html
+
+- [Peter Wu brought this change]
+
+ CMake: ignore INTERFACE_LIBRARY targets for pkg-config file
- Reviewed-by: Marcel Raad
- Fixes #5512
- Closes #5517
+ Reviewed-by: Marcel Raad
+ Fixes #5512
+ Closes #5517
+
+- [Valentyn Korniienko brought this change]
+
+ multibyte: Fixed access-> waccess to file for Windows Plarform
+
+ Reviewed-by: Marcel Raad
+ Closes #5580
-- [Valentyn Korniienko brought this change]
+- altsvc: bump to h3-29
+
+ Closes #5584
- multibyte: Fixed access-> waccess to file for Windows Plarform
+- urlglob: treat literal IPv6 addresses with zone IDs as a host name
- Reviewed-by: Marcel Raad
- Closes #5580
-
-- altsvc: bump to h3-29
+ ... and not as a "glob". Now done by passing the supposed host to the
+ URL parser which supposedly will do a better job at identifying "real"
+ numerical IPv6 addresses.
- Closes #5584
-
-- urlglob: treat literal IPv6 addresses with zone IDs as a host name
+ Reported-by: puckipedia on github
+ Fixes #5576
+ Closes #5579
+
+- test1179: verify error message for non-existing cmdline option
+
+- tool_getparam: repair the error message for unknown flag
- ... and not as a "glob". Now done by passing the supposed host to the
- URL parser which supposedly will do a better job at identifying "real"
- numerical IPv6 addresses.
-
- Reported-by: puckipedia on github
- Fixes #5576
- Closes #5579
+ Follow-up to 9e5669f3880674
+ Detected by Coverity CID 1464582 ("Logically dead code")
+
+ Closes #5577
+
+- FILEFORMAT: describe verify/stderr
-- test1179: verify error message for non-existing cmdline option
-
-- tool_getparam: repair the error message for unknown flag
+- connect: improve happy eyeballs handling
- Follow-up to 9e5669f3880674
- Detected by Coverity CID 1464582 ("Logically dead code")
+ For QUIC but also for regular TCP when the second family runs out of IPs
+ with a failure while the first family is still trying to connect.
- Closes #5577
-
-- FILEFORMAT: describe verify/stderr
-
-- connect: improve happy eyeballs handling
-
- For QUIC but also for regular TCP when the second family runs out of IPs
- with a failure while the first family is still trying to connect.
-
- Separated the timeout handling for IPv4 and IPv6 connections when they
- both have a number of addresses to iterate over.
-
-- ngtcp2: never call fprintf() in lib code in release version
-
-- ngtcp2: fix happy eyeballs quic connect crash
-
- Reported-by: Peter Wu
- Fixes #5565
- Closes #5568
-
-- select: remove the unused ELAPSED_MS() macro
+ Separated the timeout handling for IPv4 and IPv6 connections when they
+ both have a number of addresses to iterate over.
+
+- ngtcp2: never call fprintf() in lib code in release version
+
+- ngtcp2: fix happy eyeballs quic connect crash
- Closes #5573
+ Reported-by: Peter Wu
+ Fixes #5565
+ Closes #5568
-Marc Hoersken (17 Jun 2020)
-- [rcombs brought this change]
-
- multi: implement wait using winsock events
-
- This avoids using a pair of TCP ports to provide wakeup functionality
- for every multi instance on Windows, where socketpair() is emulated
- using a TCP socket on loopback which could in turn lead to socket
- resource exhaustion.
+- select: remove the unused ELAPSED_MS() macro
- Reviewed-by: Gergely Nagy
- Reviewed-by: Marc Hörsken
+ Closes #5573
+
+Marc Hoersken (17 Jun 2020)
+- [rcombs brought this change]
+
+ multi: implement wait using winsock events
- Closes #5397
-
-Daniel Stenberg (17 Jun 2020)
-- manpage: add three missing environment variables
+ This avoids using a pair of TCP ports to provide wakeup functionality
+ for every multi instance on Windows, where socketpair() is emulated
+ using a TCP socket on loopback which could in turn lead to socket
+ resource exhaustion.
- CURL_SSL_BACKEND, QLOGDIR and SSLKEYLOGFILE
+ Reviewed-by: Gergely Nagy
+ Reviewed-by: Marc Hörsken
- Closes #5571
+ Closes #5397
-- RELEASE-NOTES: synced
-
-- configure: for wolfSSL, check for the DES func needed for NTLM
+Daniel Stenberg (17 Jun 2020)
+- manpage: add three missing environment variables
- Also adds pkg-config support for the wolfSSL detection.
+ CURL_SSL_BACKEND, QLOGDIR and SSLKEYLOGFILE
+
+ Closes #5571
-- [Ruurd Beerstra brought this change]
+- RELEASE-NOTES: synced
- ntlm: enable NTLM support with wolfSSL
+- configure: for wolfSSL, check for the DES func needed for NTLM
- When wolfSSL is built with its OpenSSL API layer, it fetures the same DES*
- functions that OpenSSL has. This change take advantage of that.
+ Also adds pkg-config support for the wolfSSL detection.
+
+- [Ruurd Beerstra brought this change]
+
+ ntlm: enable NTLM support with wolfSSL
- Co-authored-by: Daniel Stenberg
- Closes #5556
- Fixes #5548
-
-- http: move header storage to Curl_easy from connectdata
+ When wolfSSL is built with its OpenSSL API layer, it fetures the same DES*
+ functions that OpenSSL has. This change take advantage of that.
- Since the connection can be used by many independent requests (using
- HTTP/2 or HTTP/3), things like user-agent and other transfer-specific
- data MUST NOT be kept connection oriented as it could lead to requests
- getting the wrong string for their requests. This struct data was
- lingering like this due to old HTTP1 legacy thinking where it didn't
- mattered..
-
- Fixes #5566
- Closes #5567
+ Co-authored-by: Daniel Stenberg
+ Closes #5556
+ Fixes #5548
-- CODE_REVIEW.md: how to do code reviews in curl
+- http: move header storage to Curl_easy from connectdata
- Assisted-by: Daniel Gustafsson
- Assisted-by: Rich Salz
- Assisted-by: Hugo van Kemenade
- Assisted-by: James Fuller
- Assisted-by: Marc Hörsken
- Assisted-by: Jay Satiro
+ Since the connection can be used by many independent requests (using
+ HTTP/2 or HTTP/3), things like user-agent and other transfer-specific
+ data MUST NOT be kept connection oriented as it could lead to requests
+ getting the wrong string for their requests. This struct data was
+ lingering like this due to old HTTP1 legacy thinking where it didn't
+ mattered..
- Closes #5555
+ Fixes #5566
+ Closes #5567
-- altsvc: remove the num field from the altsvc struct
+- CODE_REVIEW.md: how to do code reviews in curl
- It was superfluous since we have the list.size alredy
+ Assisted-by: Daniel Gustafsson
+ Assisted-by: Rich Salz
+ Assisted-by: Hugo van Kemenade
+ Assisted-by: James Fuller
+ Assisted-by: Marc Hörsken
+ Assisted-by: Jay Satiro
- Reported-by: Jay Satiro
- Fixes #5553
- Closes #5563
-
-- version.d: expanded and alpha-sorted
+ Closes #5555
+
+- altsvc: remove the num field from the altsvc struct
- Added a few missing features not previously mentioned. Ordered them
- alphabetically.
+ It was superfluous since we have the list.size alredy
- Closes #5558
-
-- ABI.md: rename to .md and polish the markdown
+ Reported-by: Jay Satiro
+ Fixes #5553
+ Closes #5563
+
+- version.d: expanded and alpha-sorted
- Closes #5562
-
-- HELP-US: add a section for "smaller tasks"
+ Added a few missing features not previously mentioned. Ordered them
+ alphabetically.
- The point of this section is to meet the CII Best Practices gold level
- critera:
+ Closes #5558
+
+- ABI.md: rename to .md and polish the markdown
- "The project MUST clearly identify small tasks that can be performed by
- new or casual contributors"
-
- Closes #5560
+ Closes #5562
-- TODO: retry on the redirected-to URL
+- HELP-US: add a section for "smaller tasks"
+
+ The point of this section is to meet the CII Best Practices gold level
+ critera:
- Closes #5462
+ "The project MUST clearly identify small tasks that can be performed by
+ new or casual contributors"
+
+ Closes #5560
-- mailmap: Nicolas Sterchele
-
-- [Nicolas Sterchele brought this change]
-
- TODO: remove 19.3 section title
+- TODO: retry on the redirected-to URL
- Follow-up to ad6416986755e417c66e2c6, which caused wrong formatting on
- curl documentation website
+ Closes #5462
+
+- mailmap: Nicolas Sterchele
+
+- [Nicolas Sterchele brought this change]
+
+ TODO: remove 19.3 section title
+
+ Follow-up to ad6416986755e417c66e2c6, which caused wrong formatting on
+ curl documentation website
- Closes #5561
+ Closes #5561
-- [Martin V brought this change]
-
- test1560: avoid possibly negative association in wording
+- [Martin V brought this change]
+
+ test1560: avoid possibly negative association in wording
- Closes #5549
+ Closes #5549
-- share: don't set the share flag it something fails
+- share: don't set the share flag it something fails
- When asking for a specific feature to be shared in the share object,
- that bit was previously set unconditionally even if the shared feature
- failed or otherwise wouldn't work.
+ When asking for a specific feature to be shared in the share object,
+ that bit was previously set unconditionally even if the shared feature
+ failed or otherwise wouldn't work.
- Closes #5554
+ Closes #5554
-- buildconf: remove -print from the find command that removes files
+- buildconf: remove -print from the find command that removes files
- It's just too annoying and unnecessary to get a long list of files shown
+ It's just too annoying and unnecessary to get a long list of files shown
- RELEASE-NOTES: synced
-- wording: avoid blacklist/whitelist stereotypes
+- wording: avoid blacklist/whitelist stereotypes
- Instead of discussing if there's value or meaning (implied or not) in
- the colors, let's use words without the same possibly negative
- associations.
+ Instead of discussing if there's value or meaning (implied or not) in
+ the colors, let's use words without the same possibly negative
+ associations.
- Closes #5546
+ Closes #5546
-Jay Satiro (9 Jun 2020)
-- tool_getparam: fix memory leak in parse_args
+Jay Satiro (9 Jun 2020)
+- tool_getparam: fix memory leak in parse_args
- Prior to this change in Windows Unicode builds most parsed options would
- not be freed.
+ Prior to this change in Windows Unicode builds most parsed options would
+ not be freed.
- Found using _CrtDumpMemoryLeaks().
+ Found using _CrtDumpMemoryLeaks().
- Ref: https://github.com/curl/curl/issues/5545
+ Ref: https://github.com/curl/curl/issues/5545
-Daniel Stenberg (8 Jun 2020)
-- socks: detect connection close during handshake
+Daniel Stenberg (8 Jun 2020)
+- socks: detect connection close during handshake
- The SOCKS4/5 state machines weren't properly terminated when the proxy
- connection got closed, leading to a busy-loop.
+ The SOCKS4/5 state machines weren't properly terminated when the proxy
+ connection got closed, leading to a busy-loop.
- Reported-By: zloi-user on github
- Fixes #5532
- Closes #5542
+ Reported-By: zloi-user on github
+ Fixes #5532
+ Closes #5542
+
+- [James Fuller brought this change]
-- [James Fuller brought this change]
-
- multi: add defensive check on data->multi->num_alive
+ multi: add defensive check on data->multi->num_alive
- Closes #5540
-
-- Curl_addrinfo: use one malloc instead of three
+ Closes #5540
+
+- Curl_addrinfo: use one malloc instead of three
- To reduce the amount of allocations needed for creating a Curl_addrinfo
- struct, make a single larger malloc instead of three separate smaller
- ones.
+ To reduce the amount of allocations needed for creating a Curl_addrinfo
+ struct, make a single larger malloc instead of three separate smaller
+ ones.
- Closes #5533
+ Closes #5533
+
+- [Alessandro Ghedini brought this change]
-- [Alessandro Ghedini brought this change]
-
- quiche: update SSLKEYLOGFILE support
+ quiche: update SSLKEYLOGFILE support
- quiche now requires the application to explicitly set the keylog path
- for each connection, rather than reading the environment variable
- itself.
+ quiche now requires the application to explicitly set the keylog path
+ for each connection, rather than reading the environment variable
+ itself.
- Closes #5541
-
-- tests: add two simple tests for --login-options
+ Closes #5541
+
+- tests: add two simple tests for --login-options
- Test 895 and 896 - as a follow-up to a3e972313b
+ Test 895 and 896 - as a follow-up to a3e972313b
- Closes #5539
+ Closes #5539
-- ngtcp2: update with recent API changes
+- ngtcp2: update with recent API changes
- Syncs with ngtcp2 commit 7e9a917d386d98 merged June 7 2020.
+ Syncs with ngtcp2 commit 7e9a917d386d98 merged June 7 2020.
- Assisted-by: Tatsuhiro Tsujikawa
- Closes #5538
-
-- [James Fuller brought this change]
-
- socks: remove unreachable breaks in socks.c and mime.c
+ Assisted-by: Tatsuhiro Tsujikawa
+ Closes #5538
+
+- [James Fuller brought this change]
+
+ socks: remove unreachable breaks in socks.c and mime.c
+
+ Closes #5537
+
+- tool_cfgable: free login_options at exit
- Closes #5537
+ Memory leak
+ Reported-by: Geeknik Labs
+ Fixes #5535
+ Closes #5536
-- tool_cfgable: free login_options at exit
+- libssh2: keep sftp errors as 'unsigned long'
- Memory leak
- Reported-by: Geeknik Labs
- Fixes #5535
- Closes #5536
-
-- libssh2: keep sftp errors as 'unsigned long'
+ Remove weird work-around for storing the SFTP errors as int instead of
+ the "unsigned long" that libssh2 actually returns for SFTP errors.
- Remove weird work-around for storing the SFTP errors as int instead of
- the "unsigned long" that libssh2 actually returns for SFTP errors.
-
- Closes #5534
+ Closes #5534
-Marc Hoersken (6 Jun 2020)
-- timeouts: move ms timeouts to timediff_t from int and long
+Marc Hoersken (6 Jun 2020)
+- timeouts: move ms timeouts to timediff_t from int and long
+
+ Now that all functions in select.[ch] take timediff_t instead
+ of the limited int or long, we can remove type conversions
+ and related preprocessor checks to silence compiler warnings.
+
+ Avoiding conversions from time_t was already done in 842f73de.
- Now that all functions in select.[ch] take timediff_t instead
- of the limited int or long, we can remove type conversions
- and related preprocessor checks to silence compiler warnings.
-
- Avoiding conversions from time_t was already done in 842f73de.
-
- Based upon #5262
- Supersedes #5214, #5220 and #5221
- Follow up to #5343 and #5479
- Closes #5490
+ Based upon #5262
+ Supersedes #5214, #5220 and #5221
+ Follow up to #5343 and #5479
+ Closes #5490
-Daniel Stenberg (6 Jun 2020)
-- [François Rigault brought this change]
+Daniel Stenberg (6 Jun 2020)
+- [François Rigault brought this change]
- openssl: set FLAG_TRUSTED_FIRST unconditionally
-
- On some systems, openssl 1.0.x is still the default, but it has been
- patched to contain all the recent security fixes. As a result of this
- patching, it is possible for macro X509_V_FLAG_NO_ALT_CHAINS to be
- defined, while the previous behavior of openssl to not look at trusted
- chains first, remains.
-
- Fix it: ensure X509_V_FLAG_TRUSTED_FIRST is always set, do not try to
- probe for the behavior of openssl based on the existence ofmacros.
-
- Closes #5530
+ openssl: set FLAG_TRUSTED_FIRST unconditionally
+
+ On some systems, openssl 1.0.x is still the default, but it has been
+ patched to contain all the recent security fixes. As a result of this
+ patching, it is possible for macro X509_V_FLAG_NO_ALT_CHAINS to be
+ defined, while the previous behavior of openssl to not look at trusted
+ chains first, remains.
+
+ Fix it: ensure X509_V_FLAG_TRUSTED_FIRST is always set, do not try to
+ probe for the behavior of openssl based on the existence ofmacros.
+
+ Closes #5530
-- server/util: fix logmsg format using curl_off_t argument
-
- ... this caused segfaults on armv7.
-
- Regression added in dd0365d560aea5a (7.70.0)
-
- Reviewed-by: Jay Satiro
- Closes #5529
+- server/util: fix logmsg format using curl_off_t argument
+
+ ... this caused segfaults on armv7.
+
+ Regression added in dd0365d560aea5a (7.70.0)
+
+ Reviewed-by: Jay Satiro
+ Closes #5529
- RELEASE-NOTES: synced
-- [Cherish98 brought this change]
+- [Cherish98 brought this change]
- socks: fix expected length of SOCKS5 reply
+ socks: fix expected length of SOCKS5 reply
- Commit 4a4b63d forgot to set the expected SOCKS5 reply length when the
- reply ATYP is X'01'. This resulted in erroneously expecting more bytes
- when the request length is greater than the reply length (e.g., when
- remotely resolving the hostname).
+ Commit 4a4b63d forgot to set the expected SOCKS5 reply length when the
+ reply ATYP is X'01'. This resulted in erroneously expecting more bytes
+ when the request length is greater than the reply length (e.g., when
+ remotely resolving the hostname).
- Closes #5527
+ Closes #5527
-Marc Hoersken (5 Jun 2020)
-- .gitignore: add directory containing the stats repo
+Marc Hoersken (5 Jun 2020)
+- .gitignore: add directory containing the stats repo
- Since the new curl/stats repository is designed to be
- checked out into the curl repository working tree as stats/
- it should be on the ignore list to aid in commit staging.
-
-Daniel Stenberg (5 Jun 2020)
-- [Adnan Khan brought this change]
-
- HTTP3.md: clarify cargo build directory
+ Since the new curl/stats repository is designed to be
+ checked out into the curl repository working tree as stats/
+ it should be on the ignore list to aid in commit staging.
+
+Daniel Stenberg (5 Jun 2020)
+- [Adnan Khan brought this change]
+
+ HTTP3.md: clarify cargo build directory
- Cargo needs to be called from within the 'quiche' directory.
+ Cargo needs to be called from within the 'quiche' directory.
- Closes #5522
+ Closes #5522
-- user-agent.d: spell out what happens given a blank argument
+- user-agent.d: spell out what happens given a blank argument
- Closes #5525
-
-- trailers: switch h1-trailer logic to use dynbuf
+ Closes #5525
+
+- trailers: switch h1-trailer logic to use dynbuf
- In the continued effort to remove "manual" realloc schemes.
+ In the continued effort to remove "manual" realloc schemes.
- Closes #5524
+ Closes #5524
-- CURLINFO_ACTIVESOCKET.3: clarify the description
+- CURLINFO_ACTIVESOCKET.3: clarify the description
- Reported-by: Jay Satiro
- Fixes #5299
- Closes #5520
+ Reported-by: Jay Satiro
+ Fixes #5299
+ Closes #5520
-- mailmap: Don J Olmstead
+- mailmap: Don J Olmstead
-- configure: only strip first -L from LDFLAGS
+- configure: only strip first -L from LDFLAGS
- In the logic that works out if a given OpenSSL path works, it stripped
- off a possibly leading -L flag using an incorrect sed pattern which
- would remove all instances of -L in the string, including if the path
- itself contained that two-letter sequence!
+ In the logic that works out if a given OpenSSL path works, it stripped
+ off a possibly leading -L flag using an incorrect sed pattern which
+ would remove all instances of -L in the string, including if the path
+ itself contained that two-letter sequence!
- The same pattern was used and is now updated in multiple places. Now it
- only removes -L if it starts the strings.
+ The same pattern was used and is now updated in multiple places. Now it
+ only removes -L if it starts the strings.
- Reported-by: Mohamed Osama
- Fixes #5519
- Closes #5521
-
-Peter Wu (4 Jun 2020)
-- quiche: advertise draft 28 support
+ Reported-by: Mohamed Osama
+ Fixes #5519
+ Closes #5521
+
+Peter Wu (4 Jun 2020)
+- quiche: advertise draft 28 support
- Fix the verbose message while at it, quiche currently supports draft
- 27 and draft 28 simultaneously.
+ Fix the verbose message while at it, quiche currently supports draft
+ 27 and draft 28 simultaneously.
- Closes #5518
+ Closes #5518
-Daniel Stenberg (4 Jun 2020)
-- KNOWN_BUGS: RTSP authentication breaks without redirect support
+Daniel Stenberg (4 Jun 2020)
+- KNOWN_BUGS: RTSP authentication breaks without redirect support
- Closes #4750
-
-Jay Satiro (4 Jun 2020)
-- projects: Add crypt32.lib to dependencies for all OpenSSL configs
+ Closes #4750
+
+Jay Satiro (4 Jun 2020)
+- projects: Add crypt32.lib to dependencies for all OpenSSL configs
- Windows project configurations that use OpenSSL with USE_WIN32_CRYPTO
- need crypt32.
+ Windows project configurations that use OpenSSL with USE_WIN32_CRYPTO
+ need crypt32.
- Follow-up to 148534d which added CURLSSLOPT_NATIVE_CA for 7.71.0.
+ Follow-up to 148534d which added CURLSSLOPT_NATIVE_CA for 7.71.0.
- The changes that are in this commit were made by script.
+ The changes that are in this commit were made by script.
- Ref: https://gist.github.com/jay/a1861b50ecce2b32931237180f856e28
+ Ref: https://gist.github.com/jay/a1861b50ecce2b32931237180f856e28
- Closes https://github.com/curl/curl/pull/5516
+ Closes https://github.com/curl/curl/pull/5516
-Marc Hoersken (3 Jun 2020)
-- CI/macos: fix 'is already installed' errors by using bundle
+Marc Hoersken (3 Jun 2020)
+- CI/macos: fix 'is already installed' errors by using bundle
- Avoid failing CI builds due to nghttp2 being already installed.
+ Avoid failing CI builds due to nghttp2 being already installed.
- Closes #5513
+ Closes #5513
-Daniel Stenberg (3 Jun 2020)
-- altsvc: fix 'dsthost' may be used uninitialized in this function
+Daniel Stenberg (3 Jun 2020)
+- altsvc: fix 'dsthost' may be used uninitialized in this function
+
+- RELEASE-NOTES: synced
-- RELEASE-NOTES: synced
-
-- urldata: let the HTTP method be in the set.* struct
+- urldata: let the HTTP method be in the set.* struct
- When the method is updated inside libcurl we must still not change the
- method as set by the user as then repeated transfers with that same
- handle might not execute the same operation anymore!
+ When the method is updated inside libcurl we must still not change the
+ method as set by the user as then repeated transfers with that same
+ handle might not execute the same operation anymore!
- This fixes the libcurl part of #5462
-
- Test 1633 added to verify.
-
- Closes #5499
+ This fixes the libcurl part of #5462
+
+ Test 1633 added to verify.
+
+ Closes #5499
-- hostip: fix the memory-leak introduced in 67d2802
+- hostip: fix the memory-leak introduced in 67d2802
- Fixes #5503
- Closes #5504
-
-- test970: make it require proxy support
+ Fixes #5503
+ Closes #5504
+
+- test970: make it require proxy support
- This test verifies the -w %json output and the test case includes a full
- generated "blob". If there's no proxy support built into libcurl, it
- will return an error for proxy related info variables and they will not
- be included in the json, thus causing a mismatch and this test fails.
+ This test verifies the -w %json output and the test case includes a full
+ generated "blob". If there's no proxy support built into libcurl, it
+ will return an error for proxy related info variables and they will not
+ be included in the json, thus causing a mismatch and this test fails.
- Reported-by: Marc Hörsken
- Fixes #5501
- Closes #5502
+ Reported-by: Marc Hörsken
+ Fixes #5501
+ Closes #5502
-- [Radoslav Georgiev brought this change]
+- [Radoslav Georgiev brought this change]
- examples/http2-down/upload: add error checks
+ examples/http2-down/upload: add error checks
- If `index.html` does not exist in the directory from which the example
- is invoked, the fopen(upload, "rb") invocation in `setup` would fail,
- returning NULL. This value is subsequently passed as the FILE* argument
- of the `fread` invocation in the `read_callback` function, which is the
- actual cause of the crash (apparently `fread` assumes that argument to
- be non-null).
+ If `index.html` does not exist in the directory from which the example
+ is invoked, the fopen(upload, "rb") invocation in `setup` would fail,
+ returning NULL. This value is subsequently passed as the FILE* argument
+ of the `fread` invocation in the `read_callback` function, which is the
+ actual cause of the crash (apparently `fread` assumes that argument to
+ be non-null).
- In addition, mitigate some possible crashes of similar origin.
+ In addition, mitigate some possible crashes of similar origin.
- Closes #5463
+ Closes #5463
-- [kotoriのねこ brought this change]
+- [kotoriのねこ brought this change]
- examples/ephiperfifo: turn off interval when setting timerfd
-
- Reported-by: therealhirudo on github
- Fixes #5485
- Closes #5497
+ examples/ephiperfifo: turn off interval when setting timerfd
+
+ Reported-by: therealhirudo on github
+ Fixes #5485
+ Closes #5497
-- [Saleem Abdulrasool brought this change]
+- [Saleem Abdulrasool brought this change]
- vtls: repair the build with `CURL_DISABLE_PROXY`
+ vtls: repair the build with `CURL_DISABLE_PROXY`
- `http_proxy` will not be available in `conndata` if `CURL_DISABLE_PROXY`
- is enabled. Repair the build with that configuration.
+ `http_proxy` will not be available in `conndata` if `CURL_DISABLE_PROXY`
+ is enabled. Repair the build with that configuration.
- Follow-up to f3d501dc67
+ Follow-up to f3d501dc67
- Closes #5498
+ Closes #5498
-- transfer: remove k->str NULL check
+- transfer: remove k->str NULL check
- "Null-checking k->str suggests that it may be null, but it has already
- been dereferenced on all paths leading to the check" - and it can't
- legally be NULL at this point. Remove check.
+ "Null-checking k->str suggests that it may be null, but it has already
+ been dereferenced on all paths leading to the check" - and it can't
+ legally be NULL at this point. Remove check.
- Detected by Coverity CID 1463884
+ Detected by Coverity CID 1463884
- Closes #5495
+ Closes #5495
-Marc Hoersken (1 Jun 2020)
-- select: always use Sleep in Curl_wait_ms on Win32
+Marc Hoersken (1 Jun 2020)
+- select: always use Sleep in Curl_wait_ms on Win32
- Since Win32 almost always will also have USE_WINSOCK,
- we can reduce complexity and always use Sleep there.
+ Since Win32 almost always will also have USE_WINSOCK,
+ we can reduce complexity and always use Sleep there.
- Assisted-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
+ Assisted-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
- Follow up to #5343
- Closes #5489
+ Follow up to #5343
+ Closes #5489
-Daniel Stenberg (31 May 2020)
-- conncache: download buffer needs +1 size for trailing zero
+Daniel Stenberg (31 May 2020)
+- conncache: download buffer needs +1 size for trailing zero
- Follow-up to c4e6968127e
- Detected by OSS-Fuzz: https://oss-fuzz.com/testcase-detail/5727799779524608
+ Follow-up to c4e6968127e
+ Detected by OSS-Fuzz: https://oss-fuzz.com/testcase-detail/5727799779524608
-Marc Hoersken (31 May 2020)
-- azure: use matrix strategy to avoid configuration redundancy
+Marc Hoersken (31 May 2020)
+- azure: use matrix strategy to avoid configuration redundancy
- This also includes the following changes:
+ This also includes the following changes:
- - Use the same timeout for all jobs on Linux (60 minutes)
- and Windows (90 minutes)
- - Use CLI stable apt-get install -y instead of apt install
- which warns about that and run apt-get update first
- - Enable MQTT for Windows msys2 builds instead of
- legacy msys1 builds
- - Add ./configure --prefix parameter to the msys2 builds
- - The MSYSTEM environment variable is now preset inside
- the container images for the msys2 builds
+ - Use the same timeout for all jobs on Linux (60 minutes)
+ and Windows (90 minutes)
+ - Use CLI stable apt-get install -y instead of apt install
+ which warns about that and run apt-get update first
+ - Enable MQTT for Windows msys2 builds instead of
+ legacy msys1 builds
+ - Add ./configure --prefix parameter to the msys2 builds
+ - The MSYSTEM environment variable is now preset inside
+ the container images for the msys2 builds
- Note: on Azure Pipelines the matrix strategy is basically
- just a simple list of job copies and not really a matrix.
+ Note: on Azure Pipelines the matrix strategy is basically
+ just a simple list of job copies and not really a matrix.
- Closes #5468
+ Closes #5468
-Daniel Stenberg (30 May 2020)
-- build: disable more code/data when built without proxy support
+Daniel Stenberg (30 May 2020)
+- build: disable more code/data when built without proxy support
- Added build to travis to verify
+ Added build to travis to verify
- Closes #5466
+ Closes #5466
-- url: alloc the download buffer at transfer start
+- url: alloc the download buffer at transfer start
+
+ ... and free it as soon as the transfer is done. It removes the extra
+ alloc when a new size is set with setopt() and reduces memory for unused
+ easy handles.
- ... and free it as soon as the transfer is done. It removes the extra
- alloc when a new size is set with setopt() and reduces memory for unused
- easy handles.
+ In addition: the closure_handle now doesn't use an allocated buffer at
+ all but the smallest supported size as a stack based one.
- In addition: the closure_handle now doesn't use an allocated buffer at
- all but the smallest supported size as a stack based one.
-
- Closes #5472
+ Closes #5472
-- timeouts: change millisecond timeouts to timediff_t from time_t
+- timeouts: change millisecond timeouts to timediff_t from time_t
- For millisecond timers we like timediff_t better. Also, time_t can be
- unsigned so returning a negative value doesn't work then.
+ For millisecond timers we like timediff_t better. Also, time_t can be
+ unsigned so returning a negative value doesn't work then.
- Closes #5479
+ Closes #5479
-Marc Hoersken (30 May 2020)
-- select: add overflow checks for timeval conversions
+Marc Hoersken (30 May 2020)
+- select: add overflow checks for timeval conversions
- Using time_t and suseconds_t if suseconds_t is available,
- long on Windows (maybe others in the future) and int elsewhere.
+ Using time_t and suseconds_t if suseconds_t is available,
+ long on Windows (maybe others in the future) and int elsewhere.
- Also handle case of ULONG_MAX being greater or equal to INFINITE.
+ Also handle case of ULONG_MAX being greater or equal to INFINITE.
- Assisted-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
+ Assisted-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
- Part of #5343
+ Part of #5343
-- select: use timediff_t instead of time_t and int for timeout_ms
+- select: use timediff_t instead of time_t and int for timeout_ms
- Make all functions in select.[ch] take timeout_ms as timediff_t
- which should always be large enough and signed on all platforms
- to take all possible timeout values and avoid type conversions.
+ Make all functions in select.[ch] take timeout_ms as timediff_t
+ which should always be large enough and signed on all platforms
+ to take all possible timeout values and avoid type conversions.
- Reviewed-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
- Replaces #5107 and partially #5262
- Related to #5240 and #5286
- Closes #5343
-
-- unit1604.c: fix implicit conv from 'SANITIZEcode' to 'CURLcode'
+ Replaces #5107 and partially #5262
+ Related to #5240 and #5286
+ Closes #5343
+
+- unit1604.c: fix implicit conv from 'SANITIZEcode' to 'CURLcode'
- GCC 10 warns about this with warning: implicit conversion
- from 'SANITIZEcode' to 'CURLcode' [-Wenum-conversion]
+ GCC 10 warns about this with warning: implicit conversion
+ from 'SANITIZEcode' to 'CURLcode' [-Wenum-conversion]
- Since 'expected_result' is not really of type 'CURLcode' and
- it is not exposed in any way, we can just use 'SANITIZEcode'.
+ Since 'expected_result' is not really of type 'CURLcode' and
+ it is not exposed in any way, we can just use 'SANITIZEcode'.
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Marcel Raad
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Marcel Raad
- Closes #5476
+ Closes #5476
-- tests/libtest: fix undefined reference to 'curlx_win32_fopen'
+- tests/libtest: fix undefined reference to 'curlx_win32_fopen'
- Since curl_setup.h now makes use of curlx_win32_fopen for Win32
- builds with USE_WIN32_LARGE_FILES or USE_WIN32_SMALL_FILES defined,
- we need to include the relevant files for tests using fopen,
- because the libtest sources are also including curl_setup.h
+ Since curl_setup.h now makes use of curlx_win32_fopen for Win32
+ builds with USE_WIN32_LARGE_FILES or USE_WIN32_SMALL_FILES defined,
+ we need to include the relevant files for tests using fopen,
+ because the libtest sources are also including curl_setup.h
- Reviewed-by: Marcel Raad
- Reviewed-by: Daniel Stenberg
-
- Follow up to #3784 (ffdddb45d9)
- Closes #5475
+ Reviewed-by: Marcel Raad
+ Reviewed-by: Daniel Stenberg
+
+ Follow up to #3784 (ffdddb45d9)
+ Closes #5475
-- appveyor: add non-debug plain autotools-based build
+- appveyor: add non-debug plain autotools-based build
- This should enable us to catch linking issues with the
- testsuite early, like the one described/fixed in #5475.
+ This should enable us to catch linking issues with the
+ testsuite early, like the one described/fixed in #5475.
- Reviewed-by: Daniel Stenberg
- Reviewed-by: Marcel Raad
-
- Closes #5477
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Marcel Raad
+
+ Closes #5477
-Daniel Stenberg (29 May 2020)
+Daniel Stenberg (29 May 2020)
- RELEASE-NOTES: synced
-- Revert "buildconf: use find -execdir"
+- Revert "buildconf: use find -execdir"
- This partially reverts commit c712009838f44211958854de431315586995bc61.
+ This partially reverts commit c712009838f44211958854de431315586995bc61.
- Keep the ares_ files removed but bring back the older way to run find,
- to make it work with busybox's find, as apparently that's being used.
+ Keep the ares_ files removed but bring back the older way to run find,
+ to make it work with busybox's find, as apparently that's being used.
- Reported-by: Max Peal
- Fixes #5483
- Closes #5484
+ Reported-by: Max Peal
+ Fixes #5483
+ Closes #5484
-- server/sws: fix asan warning on use of uninitialized variable
+- server/sws: fix asan warning on use of uninitialized variable
-- libssh2: improved error output for wrong quote syntax
+- libssh2: improved error output for wrong quote syntax
- Reported-by: Werner Stolz
+ Reported-by: Werner Stolz
- Closes #5474
+ Closes #5474
-- mk-lib1521: generate code for testing BLOB options as well
+- mk-lib1521: generate code for testing BLOB options as well
- Follow-up to cac5374298b3
+ Follow-up to cac5374298b3
- Closes #5478
+ Closes #5478
-- configure: repair the check if argv can be written to
+- configure: repair the check if argv can be written to
+
+ Due to bad escaping of the test code, the test wouldn't build and thus
+ result in a negative test result, which would lead to the unconditional
+ assumption that overwriting the arguments doesn't work and thus curl
+ would never hide credentials given in the command line, even when it
+ would otherwise be possible.
- Due to bad escaping of the test code, the test wouldn't build and thus
- result in a negative test result, which would lead to the unconditional
- assumption that overwriting the arguments doesn't work and thus curl
- would never hide credentials given in the command line, even when it
- would otherwise be possible.
+ Regression from commit 2d4c2152c (7.60.0)
- Regression from commit 2d4c2152c (7.60.0)
-
- Reported-by: huzunhao on github
- Fixes #5470
- Closes #5471
+ Reported-by: huzunhao on github
+ Fixes #5470
+ Closes #5471
-Peter Wu (28 May 2020)
-- CMake: rebuild Makefile.inc.cmake when Makefile.inc changes
+Peter Wu (28 May 2020)
+- CMake: rebuild Makefile.inc.cmake when Makefile.inc changes
- Otherwise the build might fail due to missing source files, as
- demonstrated by the recent keylog.c addition on an existing build dir.
+ Otherwise the build might fail due to missing source files, as
+ demonstrated by the recent keylog.c addition on an existing build dir.
- Closes #5469
+ Closes #5469
-Daniel Stenberg (28 May 2020)
-- urldata: fix comments: Curl_done() is called multi_done() now
+Daniel Stenberg (28 May 2020)
+- urldata: fix comments: Curl_done() is called multi_done() now
- ... since 575e885db
-
-Peter Wu (27 May 2020)
-- ngtcp2: use common key log routine for better thread-safety
+ ... since 575e885db
+
+Peter Wu (27 May 2020)
+- ngtcp2: use common key log routine for better thread-safety
- Tested with ngtcp2 built against the OpenSSL library. Additionally
- tested with MultiSSL (NSS for TLS and ngtcp2+OpenSSL for QUIC).
+ Tested with ngtcp2 built against the OpenSSL library. Additionally
+ tested with MultiSSL (NSS for TLS and ngtcp2+OpenSSL for QUIC).
- The TLS backend (independent of QUIC) may or may not already have opened
- the keylog file before. Therefore Curl_tls_keylog_open is always called
- to ensure the file is open.
+ The TLS backend (independent of QUIC) may or may not already have opened
+ the keylog file before. Therefore Curl_tls_keylog_open is always called
+ to ensure the file is open.
-- wolfssl: add SSLKEYLOGFILE support
+- wolfssl: add SSLKEYLOGFILE support
- Tested following the same curl and tshark commands as in commit
- "vtls: Extract and simplify key log file handling from OpenSSL" using
- WolfSSL v4.4.0-stable-128-g5179503e8 from git master built with
- `./configure --enable-all --enable-debug CFLAGS=-DHAVE_SECRET_CALLBACK`.
+ Tested following the same curl and tshark commands as in commit
+ "vtls: Extract and simplify key log file handling from OpenSSL" using
+ WolfSSL v4.4.0-stable-128-g5179503e8 from git master built with
+ `./configure --enable-all --enable-debug CFLAGS=-DHAVE_SECRET_CALLBACK`.
- Full support for this feature requires certain wolfSSL build options,
- see "Availability note" in lib/vtls/wolfssl.c for details.
-
- Closes #5327
+ Full support for this feature requires certain wolfSSL build options,
+ see "Availability note" in lib/vtls/wolfssl.c for details.
+
+ Closes #5327
-- vtls: Extract and simplify key log file handling from OpenSSL
+- vtls: Extract and simplify key log file handling from OpenSSL
+
+ Create a set of routines for TLS key log file handling to enable reuse
+ with other TLS backends. Simplify the OpenSSL backend as follows:
- Create a set of routines for TLS key log file handling to enable reuse
- with other TLS backends. Simplify the OpenSSL backend as follows:
+ - Drop the ENABLE_SSLKEYLOGFILE macro as it is unconditionally enabled.
+ - Do not perform dynamic memory allocation when preparing a log entry.
+ Unless the TLS specifications change we can suffice with a reasonable
+ fixed-size buffer.
+ - Simplify state tracking when SSL_CTX_set_keylog_callback is
+ unavailable. My original sslkeylog.c code included this tracking in
+ order to handle multiple calls to SSL_connect and detect new keys
+ after renegotiation (via SSL_read/SSL_write). For curl however we can
+ be sure that a single master secret eventually becomes available
+ after SSL_connect, so a simple flag is sufficient. An alternative to
+ the flag is examining SSL_state(), but this seems more complex and is
+ not pursued. Capturing keys after server renegotiation was already
+ unsupported in curl and remains unsupported.
- - Drop the ENABLE_SSLKEYLOGFILE macro as it is unconditionally enabled.
- - Do not perform dynamic memory allocation when preparing a log entry.
- Unless the TLS specifications change we can suffice with a reasonable
- fixed-size buffer.
- - Simplify state tracking when SSL_CTX_set_keylog_callback is
- unavailable. My original sslkeylog.c code included this tracking in
- order to handle multiple calls to SSL_connect and detect new keys
- after renegotiation (via SSL_read/SSL_write). For curl however we can
- be sure that a single master secret eventually becomes available
- after SSL_connect, so a simple flag is sufficient. An alternative to
- the flag is examining SSL_state(), but this seems more complex and is
- not pursued. Capturing keys after server renegotiation was already
- unsupported in curl and remains unsupported.
+ Tested with curl built against OpenSSL 0.9.8zh, 1.0.2u, and 1.1.1f
+ (`SSLKEYLOGFILE=keys.txt curl -vkso /dev/null https://localhost:4433`)
+ against an OpenSSL 1.1.1f server configured with:
- Tested with curl built against OpenSSL 0.9.8zh, 1.0.2u, and 1.1.1f
- (`SSLKEYLOGFILE=keys.txt curl -vkso /dev/null https://localhost:4433`)
- against an OpenSSL 1.1.1f server configured with:
+ # Force non-TLSv1.3, use TLSv1.0 since 0.9.8 fails with 1.1 or 1.2
+ openssl s_server -www -tls1
+ # Likewise, but fail the server handshake.
+ openssl s_server -www -tls1 -Verify 2
+ # TLS 1.3 test. No need to test the failing server handshake.
+ openssl s_server -www -tls1_3
- # Force non-TLSv1.3, use TLSv1.0 since 0.9.8 fails with 1.1 or 1.2
- openssl s_server -www -tls1
- # Likewise, but fail the server handshake.
- openssl s_server -www -tls1 -Verify 2
- # TLS 1.3 test. No need to test the failing server handshake.
- openssl s_server -www -tls1_3
+ Verify that all secrets (1 for TLS 1.0, 4 for TLS 1.3) are correctly
+ written using Wireshark. For the first and third case, expect four
+ matches per connection (decrypted Server Finished, Client Finished, HTTP
+ Request, HTTP Response). For the second case where the handshake fails,
+ expect a decrypted Server Finished only.
- Verify that all secrets (1 for TLS 1.0, 4 for TLS 1.3) are correctly
- written using Wireshark. For the first and third case, expect four
- matches per connection (decrypted Server Finished, Client Finished, HTTP
- Request, HTTP Response). For the second case where the handshake fails,
- expect a decrypted Server Finished only.
+ tshark -i lo -pf tcp -otls.keylog_file:keys.txt -Tfields \
+ -eframe.number -eframe.time -etcp.stream -e_ws.col.Info \
+ -dtls.port==4433,http -ohttp.desegment_body:FALSE \
+ -Y 'tls.handshake.verify_data or http'
- tshark -i lo -pf tcp -otls.keylog_file:keys.txt -Tfields \
- -eframe.number -eframe.time -etcp.stream -e_ws.col.Info \
- -dtls.port==4433,http -ohttp.desegment_body:FALSE \
- -Y 'tls.handshake.verify_data or http'
-
- A single connection can easily be identified via the `tcp.stream` field.
+ A single connection can easily be identified via the `tcp.stream` field.
-Daniel Stenberg (27 May 2020)
-- FILEFORMAT: add more features that tests can depend on
+Daniel Stenberg (27 May 2020)
+- FILEFORMAT: add more features that tests can depend on
-- [Michael Kaufmann brought this change]
-
- transfer: close connection after excess data has been read
+- [Michael Kaufmann brought this change]
+
+ transfer: close connection after excess data has been read
+
+ For HTTP 1.x, it's a protocol error when the server sends more bytes
+ than announced. If this happens, don't reuse the connection, because the
+ start position of the next response is undefined.
- For HTTP 1.x, it's a protocol error when the server sends more bytes
- than announced. If this happens, don't reuse the connection, because the
- start position of the next response is undefined.
-
- Closes #5440
+ Closes #5440
-- [Estanislau Augé-Pujadas brought this change]
+- [Estanislau Augé-Pujadas brought this change]
- Revert "ssh: ignore timeouts during disconnect"
+ Revert "ssh: ignore timeouts during disconnect"
- This reverts commit f31760e63b4e9ef1eb25f8f211390f8239388515. Shipped in
- curl 7.54.1.
+ This reverts commit f31760e63b4e9ef1eb25f8f211390f8239388515. Shipped in
+ curl 7.54.1.
- Bug: https://curl.haxx.se/mail/lib-2020-05/0068.html
- Closes #5465
-
-- urldata: connect related booleans live in struct ConnectBits
+ Bug: https://curl.haxx.se/mail/lib-2020-05/0068.html
+ Closes #5465
+
+- urldata: connect related booleans live in struct ConnectBits
- And remove a few unused booleans!
+ And remove a few unused booleans!
- Closes #5461
+ Closes #5461
-- hostip: on macOS avoid DoH when given a numerical IP address
+- hostip: on macOS avoid DoH when given a numerical IP address
- When USE_RESOLVE_ON_IPS is set (defined on macOS), it means that
- numerical IP addresses still need to get "resolved" - but not with DoH.
+ When USE_RESOLVE_ON_IPS is set (defined on macOS), it means that
+ numerical IP addresses still need to get "resolved" - but not with DoH.
- Reported-by: Viktor Szakats
- Fixes #5454
- Closes #5459
+ Reported-by: Viktor Szakats
+ Fixes #5454
+ Closes #5459
-- ngtcp2: cleanup memory when failing to connect
+- ngtcp2: cleanup memory when failing to connect
- Reported-by: Peter Wu
- Fixes #5447 (the ngtcp2 side of it)
- Closes #5451
-
-- quiche: clean up memory properly when failing to connect
+ Reported-by: Peter Wu
+ Fixes #5447 (the ngtcp2 side of it)
+ Closes #5451
+
+- quiche: clean up memory properly when failing to connect
- Addresses the quiche side of #5447
- Reported-by: Peter Wu
- Closes #5450
+ Addresses the quiche side of #5447
+ Reported-by: Peter Wu
+ Closes #5450
-- cleanup: use a single space after equals sign in assignments
-
-- url: accept "any length" credentials for proxy auth
+- cleanup: use a single space after equals sign in assignments
+
+- url: accept "any length" credentials for proxy auth
+
+ They're only limited to the maximum string input restrictions, not to
+ 256 bytes.
- They're only limited to the maximum string input restrictions, not to
- 256 bytes.
+ Added test 1178 to verify
- Added test 1178 to verify
-
- Reported-by: Will Roberts
- Fixes #5448
- Closes #5449
+ Reported-by: Will Roberts
+ Fixes #5448
+ Closes #5449
+
+- [Maksim Stsepanenka brought this change]
-- [Maksim Stsepanenka brought this change]
-
- test1167: fixes in badsymbols.pl
+ test1167: fixes in badsymbols.pl
- Closes #5442
+ Closes #5442
-- altsvc: fix parser for lines ending with CRLF
+- altsvc: fix parser for lines ending with CRLF
- Fixed the alt-svc parser to treat a newline as end of line.
+ Fixed the alt-svc parser to treat a newline as end of line.
- The unit tests in test 1654 were done without CRLF and thus didn't quite
- match the real world. Now they use CRLF as well.
+ The unit tests in test 1654 were done without CRLF and thus didn't quite
+ match the real world. Now they use CRLF as well.
- Reported-by: Peter Wu
- Assisted-by: Peter Wu
- Assisted-by: Jay Satiro
- Fixes #5445
- Closes #5446
+ Reported-by: Peter Wu
+ Assisted-by: Peter Wu
+ Assisted-by: Jay Satiro
+ Fixes #5445
+ Closes #5446
-Viktor Szakats (25 May 2020)
-- all: fix codespell errors
+Viktor Szakats (25 May 2020)
+- all: fix codespell errors
- Reviewed-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
- Closes https://github.com/curl/curl/pull/5452
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
+ Closes https://github.com/curl/curl/pull/5452
-Peter Wu (25 May 2020)
-- ngtcp2: fix build with current ngtcp2 master implementing draft 28
+Peter Wu (25 May 2020)
+- ngtcp2: fix build with current ngtcp2 master implementing draft 28
- Based on client.cc changes from ngtcp2. Tested with current git master,
- ngtcp2 commit c77d5731ce92, nghttp3 commit 65ff479d4380.
+ Based on client.cc changes from ngtcp2. Tested with current git master,
+ ngtcp2 commit c77d5731ce92, nghttp3 commit 65ff479d4380.
- Fixes #5444
- Closes #5443
-
-Daniel Stenberg (25 May 2020)
-- RELEASE-NOTES: synced
+ Fixes #5444
+ Closes #5443
+
+Daniel Stenberg (25 May 2020)
+- RELEASE-NOTES: synced
- moved the new setopts up to a "change"
+ moved the new setopts up to a "change"
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
+
+- copyright: updated year ranges out of sync
+
+ ... and whitelisted a few more files in the the copyright.pl script.
-- copyright: updated year ranges out of sync
-
- ... and whitelisted a few more files in the the copyright.pl script.
+- [Gilles Vollant brought this change]
-- [Gilles Vollant brought this change]
-
- setopt: add CURLOPT_PROXY_ISSUERCERT(_BLOB) for coherency
+ setopt: add CURLOPT_PROXY_ISSUERCERT(_BLOB) for coherency
- Closes #5431
+ Closes #5431
-- curl: remove -J "informational" written on stdout
+- curl: remove -J "informational" written on stdout
- curl would previously show "curl: Saved to filename 'name from header'"
- if -J was used and a name was picked from the Content-Disposition
- header. That output could interfer with other stdout output, such as -w.
+ curl would previously show "curl: Saved to filename 'name from header'"
+ if -J was used and a name was picked from the Content-Disposition
+ header. That output could interfer with other stdout output, such as -w.
- This commit removes that output line.
- Bug: https://curl.haxx.se/mail/archive-2020-05/0044.html
- Reported-by: Коваленко Анатолий Викторович
- Closes #5435
+ This commit removes that output line.
+ Bug: https://curl.haxx.se/mail/archive-2020-05/0044.html
+ Reported-by: Коваленко Анатолий Викторович
+ Closes #5435
-Peter Wu (22 May 2020)
-- travis: simplify quiche build instructions wrt boringssl
+Peter Wu (22 May 2020)
+- travis: simplify quiche build instructions wrt boringssl
+
+ quiche builds boringssl as static library, reuse that instead of
+ building another shared library.
- quiche builds boringssl as static library, reuse that instead of
- building another shared library.
+ Closes #5438
+
+- configure: fix pthread check with static boringssl
- Closes #5438
+ A shared boringssl/OpenSSL library requires -lcrypto only for linking.
+ A static build additionally requires `-ldl -lpthread`. In the latter
+ case `-lpthread` is added to LIBS which prevented `-pthread` from being
+ added to CFLAGS. Clear LIBS to fix linking failures for libtest tests.
-- configure: fix pthread check with static boringssl
+Daniel Stenberg (22 May 2020)
+- Revert "sendf: make failf() use the mvsnprintf() return code"
- A shared boringssl/OpenSSL library requires -lcrypto only for linking.
- A static build additionally requires `-ldl -lpthread`. In the latter
- case `-lpthread` is added to LIBS which prevented `-pthread` from being
- added to CFLAGS. Clear LIBS to fix linking failures for libtest tests.
-
-Daniel Stenberg (22 May 2020)
-- Revert "sendf: make failf() use the mvsnprintf() return code"
+ This reverts commit 74623551f306990e70c7c5515b88972005604a74.
- This reverts commit 74623551f306990e70c7c5515b88972005604a74.
+ Instead mark the function call with (void). Getting the return code and
+ using it instead triggered Coverity warning CID 1463596 because
+ snprintf() can return a negative value...
- Instead mark the function call with (void). Getting the return code and
- using it instead triggered Coverity warning CID 1463596 because
- snprintf() can return a negative value...
+ Closes #5441
+
+- typecheck-gcc.h: CURLINFO_PRIVATE does not need a 'char *'
- Closes #5441
-
-- typecheck-gcc.h: CURLINFO_PRIVATE does not need a 'char *'
+ Reported-by: Billyzou0741326 on github
+ Fixes #5432
+ Closes #5436
+
+- tests/server/util.h: add extern to silence compiler warning
- Reported-by: Billyzou0741326 on github
- Fixes #5432
- Closes #5436
+ Follow-up from a3b0699d5c1
-- tests/server/util.h: add extern to silence compiler warning
+- typecheck-gcc.h: fix the OFF_T check
- Follow-up from a3b0699d5c1
-
-- typecheck-gcc.h: fix the OFF_T check
+ The option number also needs to be less than CURLOPTTYPE_BLOB.
- The option number also needs to be less than CURLOPTTYPE_BLOB.
-
- Follow-up to cac5374298
- Reported-by: Jeroen Ooms
- Bug: https://github.com/curl/curl/pull/5365#issuecomment-631084114
+ Follow-up to cac5374298
+ Reported-by: Jeroen Ooms
+ Bug: https://github.com/curl/curl/pull/5365#issuecomment-631084114
-- TODO: --dry-run
+- TODO: --dry-run
- Closes #5426
-
-- TODO: Ratelimit or wait between serial requests
+ Closes #5426
+
+- TODO: Ratelimit or wait between serial requests
- Closes #5406
+ Closes #5406
-- tool_paramhlp: fixup C89 mistake
-
- Follow-up to c5f0a9db22.
+- tool_paramhlp: fixup C89 mistake
+
+ Follow-up to c5f0a9db22.
-- [Siva Sivaraman brought this change]
+- [Siva Sivaraman brought this change]
- tool_paramhlp: fixed potentially uninitialized strtol() variable
+ tool_paramhlp: fixed potentially uninitialized strtol() variable
- Seems highly unlikely to actually be possible, but better safe than
- sorry.
+ Seems highly unlikely to actually be possible, but better safe than
+ sorry.
- Closes #5417
+ Closes #5417
-- [Siva Sivaraman brought this change]
-
- tool_operate: fixed potentially uninitialized variables
+- [Siva Sivaraman brought this change]
+
+ tool_operate: fixed potentially uninitialized variables
- ... in curl_easy_getinfo() calls. They're harmless but clearing the
- variables makes the code safer and comforts the reader.
+ ... in curl_easy_getinfo() calls. They're harmless but clearing the
+ variables makes the code safer and comforts the reader.
- Closes #5416
+ Closes #5416
-- sha256: move assign to the declaration line
+- sha256: move assign to the declaration line
- Follow-up to fae30656. Should've been squashed with that commit...
+ Follow-up to fae30656. Should've been squashed with that commit...
-- [Siva Sivaraman brought this change]
+- [Siva Sivaraman brought this change]
- sha256: fixed potentially uninitialized variable
+ sha256: fixed potentially uninitialized variable
- Closes #5414
+ Closes #5414
-- sendf: make failf() use the mvsnprintf() return code
+- sendf: make failf() use the mvsnprintf() return code
- ... and avoid a strlen() call. Fixes a MonocleAI warning.
+ ... and avoid a strlen() call. Fixes a MonocleAI warning.
- Reported-by: MonocleAI
- Fixes #5413
- Closes #5420
+ Reported-by: MonocleAI
+ Fixes #5413
+ Closes #5420
-- hostip: make Curl_printable_address not return anything
+- hostip: make Curl_printable_address not return anything
- It was not used much anyway and instead we let it store a blank buffer
- in case of failure.
+ It was not used much anyway and instead we let it store a blank buffer
+ in case of failure.
- Reported-by: MonocleAI
- Fixes #5411
- Closes #5418
+ Reported-by: MonocleAI
+ Fixes #5411
+ Closes #5418
-- ftp: mark return-ignoring calls to Curl_GetFTPResponse with (void)
+- ftp: mark return-ignoring calls to Curl_GetFTPResponse with (void)
- They're done on purpose, make that visible in the code.
- Reported-by: MonocleAI
- Fixes #5412
- Closes #549
+ They're done on purpose, make that visible in the code.
+ Reported-by: MonocleAI
+ Fixes #5412
+ Closes #549
-- TODO: forbid TLS post-handshake auth and do TLS record padding
+- TODO: forbid TLS post-handshake auth and do TLS record padding
- Closes #5396
- Closes #5398
+ Closes #5396
+ Closes #5398
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-- dynbuf: return NULL when there's no buffer length
+- dynbuf: return NULL when there's no buffer length
- ... as returning a "" is not a good idea as the string is supposed to be
- allocated and returning a const string will cause issues.
+ ... as returning a "" is not a good idea as the string is supposed to be
+ allocated and returning a const string will cause issues.
- Reported-by: Brian Carpenter
- Follow-up to ed35d6590e72c
- Closes #5405
-
-Peter Wu (16 May 2020)
-- travis: upgrade to bionic, clang-9, improve readability
+ Reported-by: Brian Carpenter
+ Follow-up to ed35d6590e72c
+ Closes #5405
+
+Peter Wu (16 May 2020)
+- travis: upgrade to bionic, clang-9, improve readability
- Changes, partially to reduce build failures from external dependencies:
- - Upgrade Ubuntu and drop unnecessary third-party repos.
- - Properly clone apt config to ensure retries.
- - Upgrade to clang-9 from the standard repos.
- - Use Ubuntu 20.04 focal for the libssh build, use of ssh_get_publickey
- fails on -Werror=deprecated-declarations in Ubuntu 18.04. Do not use
- focal everywhere yet since Travis CI has not documented this option.
- In focal, python-impacket (Py2.7) has been removed, leaving only
- python3-impacket. Since it is only needed for SMB tests and not SSH,
- skip it for the libssh job since it might need more work.
- - apt: Remove gcc-8 and libstdc++-8-dev, already installed via g++-8.
+ Changes, partially to reduce build failures from external dependencies:
+ - Upgrade Ubuntu and drop unnecessary third-party repos.
+ - Properly clone apt config to ensure retries.
+ - Upgrade to clang-9 from the standard repos.
+ - Use Ubuntu 20.04 focal for the libssh build, use of ssh_get_publickey
+ fails on -Werror=deprecated-declarations in Ubuntu 18.04. Do not use
+ focal everywhere yet since Travis CI has not documented this option.
+ In focal, python-impacket (Py2.7) has been removed, leaving only
+ python3-impacket. Since it is only needed for SMB tests and not SSH,
+ skip it for the libssh job since it might need more work.
+ - apt: Remove gcc-8 and libstdc++-8-dev, already installed via g++-8.
- Non-functional cleanups:
- - Simplify test matrix, drop redundant os and compiler keys.
- - Deprecation fixes: remove sudo, rename matrix -> jobs.
- - Every job has an 'env' key, put this key first in a list item.
+ Non-functional cleanups:
+ - Simplify test matrix, drop redundant os and compiler keys.
+ - Deprecation fixes: remove sudo, rename matrix -> jobs.
+ - Every job has an 'env' key, put this key first in a list item.
- Closes #5370
-
-- travis: whitespace-only changes for consistency
+ Closes #5370
+
+- travis: whitespace-only changes for consistency
- Automatically apply a consistent indentation with:
+ Automatically apply a consistent indentation with:
- python3 -c 'from ruamel.yaml import YAML;y=YAML();d=y.load(open(".travis.yml"));y.width=500;y.dump(d,open(".travis.yml.new","w"))'
+ python3 -c 'from ruamel.yaml import YAML;y=YAML();d=y.load(open(".travis.yml"));y.width=500;y.dump(d,open(".travis.yml.new","w"))'
- followed by manually re-indenting three comments.
+ followed by manually re-indenting three comments.
- Closes #5370
+ Closes #5370
-- CMake: add libssh build support
+- CMake: add libssh build support
- Closes #5372
+ Closes #5372
-Daniel Stenberg (15 May 2020)
-- KNOWN_BUGS: wolfssh: publickey auth doesn't work
+Daniel Stenberg (15 May 2020)
+- KNOWN_BUGS: wolfssh: publickey auth doesn't work
- Closes #4820
+ Closes #4820
-- KNOWN_BUGS: OS400 port requires deprecated IBM library
+- KNOWN_BUGS: OS400 port requires deprecated IBM library
- Closes #5176
+ Closes #5176
-- [Vyron Tsingaras brought this change]
+- [Vyron Tsingaras brought this change]
- http2: keep trying to send pending frames after req.upload_done
+ http2: keep trying to send pending frames after req.upload_done
- Fixes #1410
- Closes #5401
+ Fixes #1410
+ Closes #5401
-- [Gilles Vollant brought this change]
+- [Gilles Vollant brought this change]
- setopt: support certificate options in memory with struct curl_blob
+ setopt: support certificate options in memory with struct curl_blob
- This change introduces a generic way to provide binary data in setopt
- options, called BLOBs.
-
- This change introduces these new setopts:
-
- CURLOPT_ISSUERCERT_BLOB, CURLOPT_PROXY_SSLCERT_BLOB,
- CURLOPT_PROXY_SSLKEY_BLOB, CURLOPT_SSLCERT_BLOB and CURLOPT_SSLKEY_BLOB.
-
- Reviewed-by: Daniel Stenberg
- Closes #5357
+ This change introduces a generic way to provide binary data in setopt
+ options, called BLOBs.
+
+ This change introduces these new setopts:
+
+ CURLOPT_ISSUERCERT_BLOB, CURLOPT_PROXY_SSLCERT_BLOB,
+ CURLOPT_PROXY_SSLKEY_BLOB, CURLOPT_SSLCERT_BLOB and CURLOPT_SSLKEY_BLOB.
+
+ Reviewed-by: Daniel Stenberg
+ Closes #5357
-- source cleanup: remove all custom typedef structs
+- source cleanup: remove all custom typedef structs
- - Stick to a single unified way to use structs
- - Make checksrc complain on 'typedef struct {'
- - Allow them in tests, public headers and examples
+ - Stick to a single unified way to use structs
+ - Make checksrc complain on 'typedef struct {'
+ - Allow them in tests, public headers and examples
- - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually
- typedef different types/structs depending on build conditions.
-
- Closes #5338
+ - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually
+ typedef different types/structs depending on build conditions.
+
+ Closes #5338
+
+- travis: remove the .checksrc fiddling
-- travis: remove the .checksrc fiddling
-
-- ftp: make domore_getsock() return the secondary socket properly
+- ftp: make domore_getsock() return the secondary socket properly
- Previously, after PASV and immediately after the data connection has
- connected, the function would only return the control socket to wait for
- which then made the data connection simply timeout and not get polled
- correctly. This become obvious when running test 1631 and 1632 event-
- based.
+ Previously, after PASV and immediately after the data connection has
+ connected, the function would only return the control socket to wait for
+ which then made the data connection simply timeout and not get polled
+ correctly. This become obvious when running test 1631 and 1632 event-
+ based.
-- test1632: verify FTP through HTTPS-proxy with connection re-use
-
-- test1631: verify FTP download through HTTPS-proxy
-
-- sws: as last resort, get test number from server cmd file
+- test1632: verify FTP through HTTPS-proxy with connection re-use
+
+- test1631: verify FTP download through HTTPS-proxy
+
+- sws: as last resort, get test number from server cmd file
+
+ If it can't be found in the request. Also support --cmdfile to set it to
+ a custom file name.
- If it can't be found in the request. Also support --cmdfile to set it to
- a custom file name.
-
- runtests.pl always writes this file with the test number in it since a
- while back.
+ runtests.pl always writes this file with the test number in it since a
+ while back.
-- ftp: shut down the secondary connection properly when SSL is used
+- ftp: shut down the secondary connection properly when SSL is used
- Reported-by: Neal Poole
- Fixes #5340
- Closes #5385
+ Reported-by: Neal Poole
+ Fixes #5340
+ Closes #5385
-Marcel Raad (14 May 2020)
-- KNOWN_BUGS: adapt 5.5 to recent changes
+Marcel Raad (14 May 2020)
+- KNOWN_BUGS: adapt 5.5 to recent changes
- It only applies to non-Unicode builds now.
- Also merge 5.10 into it as it's effectively a duplicate.
+ It only applies to non-Unicode builds now.
+ Also merge 5.10 into it as it's effectively a duplicate.
- Closes https://github.com/curl/curl/pull/3784
+ Closes https://github.com/curl/curl/pull/3784
-- curl_setup: support Unicode functions to open files on Windows
+- curl_setup: support Unicode functions to open files on Windows
- Use them only if `_UNICODE` is defined, in which case command-line
- arguments have been converted to UTF-8.
+ Use them only if `_UNICODE` is defined, in which case command-line
+ arguments have been converted to UTF-8.
- Closes https://github.com/curl/curl/pull/3784
+ Closes https://github.com/curl/curl/pull/3784
-- tool: support UTF-16 command line on Windows
+- tool: support UTF-16 command line on Windows
- - use `wmain` instead of `main` when `_UNICODE` is defined [0]
- - define `argv_item_t` as `wchar_t *` in this case
- - use the curl_multibyte gear to convert the command-line arguments to
- UTF-8
+ - use `wmain` instead of `main` when `_UNICODE` is defined [0]
+ - define `argv_item_t` as `wchar_t *` in this case
+ - use the curl_multibyte gear to convert the command-line arguments to
+ UTF-8
- This makes it possible to pass parameters with characters outside of
- the current locale on Windows, which is required for some tests, e.g.
- the IDN tests. Out of the box, this currently only works with the
- Visual Studio project files, which default to Unicode, and winbuild
- with the `ENABLE_UNICODE` option.
+ This makes it possible to pass parameters with characters outside of
+ the current locale on Windows, which is required for some tests, e.g.
+ the IDN tests. Out of the box, this currently only works with the
+ Visual Studio project files, which default to Unicode, and winbuild
+ with the `ENABLE_UNICODE` option.
- [0] https://devblogs.microsoft.com/oldnewthing/?p=40643
+ [0] https://devblogs.microsoft.com/oldnewthing/?p=40643
- Ref: https://github.com/curl/curl/issues/3747
- Closes https://github.com/curl/curl/pull/3784
+ Ref: https://github.com/curl/curl/issues/3747
+ Closes https://github.com/curl/curl/pull/3784
-- curl_multibyte: add to curlx
+- curl_multibyte: add to curlx
- This will also be needed in the tool and tests.
+ This will also be needed in the tool and tests.
- Ref: https://github.com/curl/curl/pull/3758#issuecomment-482197512
- Closes https://github.com/curl/curl/pull/3784
+ Ref: https://github.com/curl/curl/pull/3758#issuecomment-482197512
+ Closes https://github.com/curl/curl/pull/3784
-Daniel Stenberg (14 May 2020)
-- url: make the updated credentials URL-encoded in the URL
+Daniel Stenberg (14 May 2020)
+- url: make the updated credentials URL-encoded in the URL
- Found-by: Gregory Jefferis
- Reported-by: Jeroen Ooms
- Added test 1168 to verify. Bug spotted when doing a redirect.
- Bug: https://github.com/jeroen/curl/issues/224
- Closes #5400
+ Found-by: Gregory Jefferis
+ Reported-by: Jeroen Ooms
+ Added test 1168 to verify. Bug spotted when doing a redirect.
+ Bug: https://github.com/jeroen/curl/issues/224
+ Closes #5400
-- tests: add https-proxy support to the test suite
+- tests: add https-proxy support to the test suite
- Initial test 1630 added with basic HTTPS-proxy use. HTTPS-proxy is like
- HTTP proxy but with a full TLS connection to the proxy.
+ Initial test 1630 added with basic HTTPS-proxy use. HTTPS-proxy is like
+ HTTP proxy but with a full TLS connection to the proxy.
- Closes #5399
+ Closes #5399
-- mailmap: James Fuller
+- mailmap: James Fuller
-- [Major_Tom brought this change]
+- [Major_Tom brought this change]
- vauth/cleartext: fix theoretical integer overflow
+ vauth/cleartext: fix theoretical integer overflow
- Fix theoretical integer overflow in Curl_auth_create_plain_message.
+ Fix theoretical integer overflow in Curl_auth_create_plain_message.
- The security impact of the overflow was discussed on hackerone. We
- agreed this is more of a theoretical vulnerability, as the integer
- overflow would only be triggerable on systems using 32-bits size_t with
- over 4GB of available memory space for the process.
-
- Closes #5391
+ The security impact of the overflow was discussed on hackerone. We
+ agreed this is more of a theoretical vulnerability, as the integer
+ overflow would only be triggerable on systems using 32-bits size_t with
+ over 4GB of available memory space for the process.
+
+ Closes #5391
-Jay Satiro (13 May 2020)
-- curl.1: Quote globbed URLs
+Jay Satiro (13 May 2020)
+- curl.1: Quote globbed URLs
+
+ - Quote the globbing example URLs that contain characters [] {} since
+ otherwise they may be interpreted as shell metacharacters.
- - Quote the globbing example URLs that contain characters [] {} since
- otherwise they may be interpreted as shell metacharacters.
+ Bug: https://github.com/curl/curl/issues/5388
+ Reported-by: John Simpson
- Bug: https://github.com/curl/curl/issues/5388
- Reported-by: John Simpson
-
- Closes https://github.com/curl/curl/pull/5394
+ Closes https://github.com/curl/curl/pull/5394
-Daniel Stenberg (14 May 2020)
-- checksrc: enhance the ASTERISKSPACE and update code accordingly
+Daniel Stenberg (14 May 2020)
+- checksrc: enhance the ASTERISKSPACE and update code accordingly
- Fine: "struct hello *world"
+ Fine: "struct hello *world"
- Not fine: "struct hello* world" (and variations)
+ Not fine: "struct hello* world" (and variations)
- Closes #5386
+ Closes #5386
-- docs/options-in-versions: which version added each cmdline option
+- docs/options-in-versions: which version added each cmdline option
- Added test 971 to verify that the list is in sync with the files in
- cmdline-opts. The check also verifies that .d-files that uses Added:
- specify the same version number as the options-in-versions file does.
-
- Closes #5381
+ Added test 971 to verify that the list is in sync with the files in
+ cmdline-opts. The check also verifies that .d-files that uses Added:
+ specify the same version number as the options-in-versions file does.
+
+ Closes #5381
-- docs: unify protocol lists
+- docs: unify protocol lists
+
+ We boast support for 25 transfer protocols. Make sure the lists are
+ consistent
- We boast support for 25 transfer protocols. Make sure the lists are
- consistent
-
- Closes #5384
+ Closes #5384
-- OpenSSL: have CURLOPT_CRLFILE imply CURLSSLOPT_NO_PARTIALCHAIN
+- OpenSSL: have CURLOPT_CRLFILE imply CURLSSLOPT_NO_PARTIALCHAIN
+
+ ... to avoid an OpenSSL bug that otherwise makes the CRL check to fail.
- ... to avoid an OpenSSL bug that otherwise makes the CRL check to fail.
-
- Reported-by: Michael Kaufmann
- Fixes #5374
- Closes #5376
+ Reported-by: Michael Kaufmann
+ Fixes #5374
+ Closes #5376
-- tls13-ciphers.d: shorten the Arg
+- tls13-ciphers.d: shorten the Arg
-- sasl-authzid.d: add Arg: and shorten the desc
+- sasl-authzid.d: add Arg: and shorten the desc
-- cert-type.d: mention the available types in the desc
-
-- tool: shorten 3 --help descriptions
+- cert-type.d: mention the available types in the desc
+
+- tool: shorten 3 --help descriptions
- --happy-eyeballs-timeout-ms, --resolve and --ssl-revoke-best-effort
+ --happy-eyeballs-timeout-ms, --resolve and --ssl-revoke-best-effort
- gen.pl already warned about these lines but we didn't listen
+ gen.pl already warned about these lines but we didn't listen
- Closes #5379
+ Closes #5379
-- configure: the wolfssh backend does not provide SCP
+- configure: the wolfssh backend does not provide SCP
- Closes #5387
+ Closes #5387
- RELEASE-NOTES: synced
-- url: reject too long input when parsing credentials
+- url: reject too long input when parsing credentials
- Since input passed to libcurl with CURLOPT_USERPWD and
- CURLOPT_PROXYUSERPWD circumvents the regular string length check we have
- in Curl_setstropt(), the input length limit is enforced in
- Curl_parse_login_details too, separately.
+ Since input passed to libcurl with CURLOPT_USERPWD and
+ CURLOPT_PROXYUSERPWD circumvents the regular string length check we have
+ in Curl_setstropt(), the input length limit is enforced in
+ Curl_parse_login_details too, separately.
- Reported-by: Thomas Bouzerar
- Closes #5383
+ Reported-by: Thomas Bouzerar
+ Closes #5383
-- list-only.d: this option existed already in 4.0
+- list-only.d: this option existed already in 4.0
-Jay Satiro (12 May 2020)
-- retry-all-errors.d: Shorten the summary line
+Jay Satiro (12 May 2020)
+- retry-all-errors.d: Shorten the summary line
- Follow-up to b995bb5 from a few moments ago.
+ Follow-up to b995bb5 from a few moments ago.
- Reported-by: Daniel Stenberg
+ Reported-by: Daniel Stenberg
- Ref: https://github.com/curl/curl/commit/b995bb5#r39108929
+ Ref: https://github.com/curl/curl/commit/b995bb5#r39108929
+
+- [denzor brought this change]
-- [denzor brought this change]
-
- easy: fix dangling pointer on easy_perform fail
+ easy: fix dangling pointer on easy_perform fail
- Closes https://github.com/curl/curl/pull/5363
+ Closes https://github.com/curl/curl/pull/5363
+
+- tool: Add option --retry-all-errors to retry on any error
+
+ The "sledgehammer" of retrying.
+
+ Closes https://github.com/curl/curl/pull/5185
+
+Daniel Stenberg (12 May 2020)
+- [James Le Cuirot brought this change]
-- tool: Add option --retry-all-errors to retry on any error
+ libcurl.pc: Merge Libs.private into Libs for static-only builds
- The "sledgehammer" of retrying.
+ A project being built entirely statically will call pkg-config with
+ --static, which utilises the Libs.private field. Conversely it will
+ not use --static when not being built entirely statically, even if
+ there is only a static build of libcurl available. This will most
+ likely cause the build to fail due to underlinking unless we merge the
+ Libs fields.
- Closes https://github.com/curl/curl/pull/5185
+ Consider that this is what the Meson build system does when it
+ generates pkg-config files.
+
+ I have also reflected this in the --libs argument of curl-config even
+ though REQUIRE_LIB_DEPS always seems to be "yes" anyway.
+
+ Closes #5373
-Daniel Stenberg (12 May 2020)
-- [James Le Cuirot brought this change]
+- [Peter Wu brought this change]
- libcurl.pc: Merge Libs.private into Libs for static-only builds
+ CMake: fix runtests.pl with CMake, add new test targets
+
+ * runtests.pl:
+ - Fix out-of-tree build under CMake when srcdir is not set. Default
+ srcdir to the location of runtests.pl.
+ - Add a hack to allow CMake to use the TFLAGS option as documented
+ in tests/README and used in scripts/travis/script.sh.
+ * Bump CMake version to 3.2 for USES_TERMINAL, dropping Debian Jessie
+ support (no one should care, it is already EOL.).
+ * Remove CTest since it defines its own 'test' target with no tests
+ since all unittests are already broken and not built by default.
+ * Add new test targets based on the options from Makefile.am. Since
+ new test targets are rarely added, I opted for duplicating the
+ runtests.pl options as opposed to creating a new Makefile.inc file.
+ Use top-level target names (test-x) instead of x-test since that is
+ used by CI and others.
- A project being built entirely statically will call pkg-config with
- --static, which utilises the Libs.private field. Conversely it will
- not use --static when not being built entirely statically, even if
- there is only a static build of libcurl available. This will most
- likely cause the build to fail due to underlinking unless we merge the
- Libs fields.
+ Closes #5358
+
+- [Peter Wu brought this change]
+
+ CMake: do not build test programs by default
- Consider that this is what the Meson build system does when it
- generates pkg-config files.
+ The default target should only build libcurl and curl. Add a dedicated
+ 'testdeps' target which will be used later when running tests. Note that
+ unittests are currently broken in CMake and already excluded.
- I have also reflected this in the --libs argument of curl-config even
- though REQUIRE_LIB_DEPS always seems to be "yes" anyway.
-
- Closes #5373
+ Closes #5368
-- [Peter Wu brought this change]
-
- CMake: fix runtests.pl with CMake, add new test targets
+- FILEFORMAT: moved up the variables section and further polished
+
+- runtests: remove ftp2 support, not used
- * runtests.pl:
- - Fix out-of-tree build under CMake when srcdir is not set. Default
- srcdir to the location of runtests.pl.
- - Add a hack to allow CMake to use the TFLAGS option as documented
- in tests/README and used in scripts/travis/script.sh.
- * Bump CMake version to 3.2 for USES_TERMINAL, dropping Debian Jessie
- support (no one should care, it is already EOL.).
- * Remove CTest since it defines its own 'test' target with no tests
- since all unittests are already broken and not built by default.
- * Add new test targets based on the options from Makefile.am. Since
- new test targets are rarely added, I opted for duplicating the
- runtests.pl options as opposed to creating a new Makefile.inc file.
- Use top-level target names (test-x) instead of x-test since that is
- used by CI and others.
+ We once supported two separate ftp instances in the test suite. Has not
+ been used the last decade.
- Closes #5358
-
-- [Peter Wu brought this change]
-
- CMake: do not build test programs by default
+ Closes #5375
+
+- url: sort the protocol schemes in rough popularity order
- The default target should only build libcurl and curl. Add a dedicated
- 'testdeps' target which will be used later when running tests. Note that
- unittests are currently broken in CMake and already excluded.
+ When looking for a protocol match among supported schemes, check the
+ most "popular" schemes first. It has zero functionality difference and
+ for all practical purposes a speed difference will not be measureable
+ but it still think it makes sense to put the least likely matches last.
- Closes #5368
-
-- FILEFORMAT: moved up the variables section and further polished
-
-- runtests: remove ftp2 support, not used
+ "Popularity" based on the 2019 user survey.
- We once supported two separate ftp instances in the test suite. Has not
- been used the last decade.
+ Closes #5377
+
+Marc Hoersken (11 May 2020)
+- test1238: avoid tftpd being busy for tests shortly following
- Closes #5375
-
-- url: sort the protocol schemes in rough popularity order
+ The tftpd server may still be busy if the total timeout of
+ 25 seconds has not been reached or no sread error was received
+ during or after the execution of the timeout test 1238.
- When looking for a protocol match among supported schemes, check the
- most "popular" schemes first. It has zero functionality difference and
- for all practical purposes a speed difference will not be measureable
- but it still think it makes sense to put the least likely matches last.
+ Once the next TFTP test comes around (eg. 1242 or 1243),
+ those will fail because the tftpd server is still waiting
+ on data from curl due to the UDP protocol being stateless
+ and having no connection close. On Linux this error may not
+ happen, because ICMP errors generated due to a swrite error
+ can also be returned async on the next sread call instead.
- "Popularity" based on the 2019 user survey.
+ Therefore we will now just kill the tftpd server after test
+ 1238 to make sure that the following tests are not affected.
- Closes #5377
-
-Marc Hoersken (11 May 2020)
-- test1238: avoid tftpd being busy for tests shortly following
+ This enables us to no longer ignore tests 1242, 1243, 2002
+ and 2003 on the CI platforms CirrusCI and AppVeyor.
- The tftpd server may still be busy if the total timeout of
- 25 seconds has not been reached or no sread error was received
- during or after the execution of the timeout test 1238.
+ Assisted-by: Peter Wu
+ Closes #5364
+
+Daniel Stenberg (11 May 2020)
+- write-out.d: added "response_code"
+
+- KNOWN_BUGS: Build with staticly built dependency
- Once the next TFTP test comes around (eg. 1242 or 1243),
- those will fail because the tftpd server is still waiting
- on data from curl due to the UDP protocol being stateless
- and having no connection close. On Linux this error may not
- happen, because ICMP errors generated due to a swrite error
- can also be returned async on the next sread call instead.
+ I rewrote the item 5.4 to be more generic about static dependencies.
+
+- ROADMAP: remove old entries
- Therefore we will now just kill the tftpd server after test
- 1238 to make sure that the following tests are not affected.
+ MQTT - the start has already landed
- This enables us to no longer ignore tests 1242, 1243, 2002
- and 2003 on the CI platforms CirrusCI and AppVeyor.
+ tiny-curl - also mostly landed and is a continuous work
- Assisted-by: Peter Wu
- Closes #5364
-
-Daniel Stenberg (11 May 2020)
-- write-out.d: added "response_code"
-
-- KNOWN_BUGS: Build with staticly built dependency
-
- I rewrote the item 5.4 to be more generic about static dependencies.
-
-- ROADMAP: remove old entries
-
- MQTT - the start has already landed
-
- tiny-curl - also mostly landed and is a continuous work
-
- make menuconfig - basically no interest from users, not pushing there
+ make menuconfig - basically no interest from users, not pushing there
+
+- [Peter Wu brought this change]
-- [Peter Wu brought this change]
-
- travis: Add ngtcp2 and quiche tests for CMake
+ travis: Add ngtcp2 and quiche tests for CMake
- To avoid an explosion of jobs, extend the existing CMake tests with
- ngtcp2 and quiche support. macOS was previously moved to GitHub actions,
- so the non-Linux case can be dropped.
-
-- [Peter Wu brought this change]
-
- CMake: add ENABLE_ALT_SVC option
+ To avoid an explosion of jobs, extend the existing CMake tests with
+ ngtcp2 and quiche support. macOS was previously moved to GitHub actions,
+ so the non-Linux case can be dropped.
+
+- [Peter Wu brought this change]
+
+ CMake: add ENABLE_ALT_SVC option
- Tested alt-svc with quiche. While at it, add missing MultiSSL reporting
- (not tested).
+ Tested alt-svc with quiche. While at it, add missing MultiSSL reporting
+ (not tested).
+
+- [Peter Wu brought this change]
-- [Peter Wu brought this change]
-
- CMake: add HTTP/3 support (ngtcp2+nghttp3, quiche)
+ CMake: add HTTP/3 support (ngtcp2+nghttp3, quiche)
- Add three new CMake Find modules (using the curl license, but I grant
- others the right to apply the CMake BSD license instead).
+ Add three new CMake Find modules (using the curl license, but I grant
+ others the right to apply the CMake BSD license instead).
- This CMake config is simpler than the autotools one because it assumes
- ngtcp2 and nghttp3 to be used together. Another difference is that this
- CMake config checks whether QUIC is actually supported by the TLS
- library (patched OpenSSL or boringssl) since this can be a common
- configuration mistake that could result in build errors later.
+ This CMake config is simpler than the autotools one because it assumes
+ ngtcp2 and nghttp3 to be used together. Another difference is that this
+ CMake config checks whether QUIC is actually supported by the TLS
+ library (patched OpenSSL or boringssl) since this can be a common
+ configuration mistake that could result in build errors later.
- Unlike autotools, CMake does not warn you that the features are
- experimental. The user is supposed to already know that and read the
- documentation. It requires a very special build environment anyway.
+ Unlike autotools, CMake does not warn you that the features are
+ experimental. The user is supposed to already know that and read the
+ documentation. It requires a very special build environment anyway.
- Tested with ngtcp2+OpenSSL+nghttp3 and quiche+boringssl, both built from
- current git master. Use `LD_DEBUG=files src/curl |& grep need` to figure
- out which features (libldap-2.4, libssh2) to disable due to conflicts
- with boringssl.
+ Tested with ngtcp2+OpenSSL+nghttp3 and quiche+boringssl, both built from
+ current git master. Use `LD_DEBUG=files src/curl |& grep need` to figure
+ out which features (libldap-2.4, libssh2) to disable due to conflicts
+ with boringssl.
- Closes #5359
+ Closes #5359
-Marc Hoersken (10 May 2020)
-- tests/server/tftpd.c: fix include and enhance debug logging
+Marc Hoersken (10 May 2020)
+- tests/server/tftpd.c: fix include and enhance debug logging
- setjmp.h should only be included if HAVE_SETJMP_H is defined.
+ setjmp.h should only be included if HAVE_SETJMP_H is defined.
- Add additional log statements to see wether reads and writes
- are blocking or finishing before an alarm signal is received.
+ Add additional log statements to see wether reads and writes
+ are blocking or finishing before an alarm signal is received.
- Assisted-by: Peter Wu
- Part of #5364
-
-Daniel Stenberg (10 May 2020)
-- tool_operate: only set CURLOPT_SSL_OPTIONS if SSL support is present
+ Assisted-by: Peter Wu
+ Part of #5364
+
+Daniel Stenberg (10 May 2020)
+- tool_operate: only set CURLOPT_SSL_OPTIONS if SSL support is present
- Reported-by: Marcel Raad
- Follow-up to 148534db5
- Fixes #5367
- Closes #5369
+ Reported-by: Marcel Raad
+ Follow-up to 148534db5
+ Fixes #5367
+ Closes #5369
-Marc Hoersken (9 May 2020)
-- appveyor: update comments to be clear about toolchain
+Marc Hoersken (9 May 2020)
+- appveyor: update comments to be clear about toolchain
+
+ - CMake-based MSYS builds use mingw-w64 to cross-compile.
+ - autotools-based builds are compiled using msys2-devel.
- - CMake-based MSYS builds use mingw-w64 to cross-compile.
- - autotools-based builds are compiled using msys2-devel.
+ The difference is that the later ones are not cross-compiled
+ to Windows and instead require the msys2 runtime to be present.
- The difference is that the later ones are not cross-compiled
- to Windows and instead require the msys2 runtime to be present.
-
- At the moment only the Azure Pipelines CI builds actually
- run autotools-based cross-compilation builds for Windows.
+ At the moment only the Azure Pipelines CI builds actually
+ run autotools-based cross-compilation builds for Windows.
-- TODO: update regarding missing Schannel features
+- TODO: update regarding missing Schannel features
- Some aspects have already been implemented over the years.
+ Some aspects have already been implemented over the years.
- 15.1 Client certificates are now supported:
+ 15.1 Client certificates are now supported:
- - System stores via e35b0256eb34f1fe562e3e2a2615beb50a391c52
- - PKCS#12 files via 0fdf96512613574591f501d63fe49495ba40e1d5
+ - System stores via e35b0256eb34f1fe562e3e2a2615beb50a391c52
+ - PKCS#12 files via 0fdf96512613574591f501d63fe49495ba40e1d5
- 15.2 Ciphers can now be specified through:
+ 15.2 Ciphers can now be specified through:
- - Algorithms via 9aefbff30d280c60fc9d8cc3e0b2f19fc70a2f28
-
- Reviewed-by: Daniel Stenberg and Marcel Raad
- Closes #5358
+ - Algorithms via 9aefbff30d280c60fc9d8cc3e0b2f19fc70a2f28
+
+ Reviewed-by: Daniel Stenberg and Marcel Raad
+ Closes #5358
-Daniel Stenberg (8 May 2020)
-- checksrc: close the .checksrc file handle when done reading
+Daniel Stenberg (8 May 2020)
+- checksrc: close the .checksrc file handle when done reading
-- RELEASE-NOTES: synced
-
- And bumped next version to 7.71.0
+- RELEASE-NOTES: synced
+
+ And bumped next version to 7.71.0
-- [Gilles Vollant brought this change]
+- [Gilles Vollant brought this change]
- CURLOPT_SSL_OPTIONS: add *_NATIVE_CA to use Windows CA store (with openssl)
+ CURLOPT_SSL_OPTIONS: add *_NATIVE_CA to use Windows CA store (with openssl)
- Closes #4346
+ Closes #4346
-- TODO: native IDN support on macOS
+- TODO: native IDN support on macOS
-- urlapi: accept :: as a valid IPv6 address
+- urlapi: accept :: as a valid IPv6 address
- Text 1560 is extended to verify.
+ Text 1560 is extended to verify.
- Reported-by: Pavel Volgarev
- Fixes #5344
- Closes #5351
+ Reported-by: Pavel Volgarev
+ Fixes #5344
+ Closes #5351
+
+- THANKS-filter: Peter Wang
-- THANKS-filter: Peter Wang
+- [Peter Wang brought this change]
-- [Peter Wang brought this change]
-
- *_sspi: fix bad uses of CURLE_NOT_BUILT_IN
+ *_sspi: fix bad uses of CURLE_NOT_BUILT_IN
+
+ Return CURLE_AUTH_ERROR instead of CURLE_NOT_BUILT_IN for other
+ instances of QuerySecurityPackageInfo failing, as in
+ commit 2a81439553286f12cd04a4bdcdf66d8e026d8201.
- Return CURLE_AUTH_ERROR instead of CURLE_NOT_BUILT_IN for other
- instances of QuerySecurityPackageInfo failing, as in
- commit 2a81439553286f12cd04a4bdcdf66d8e026d8201.
-
- Closes #5355
+ Closes #5355
-- docs/HTTP3: add qlog to the quiche build instruction
+- docs/HTTP3: add qlog to the quiche build instruction
-- ngtcp2: introduce qlog support
+- ngtcp2: introduce qlog support
- If the QLOGDIR environment variable is set, enable qlogging.
+ If the QLOGDIR environment variable is set, enable qlogging.
- ... and create Curl_qlogdir() in the new generic vquic/vquic.c file for
- QUIC functions that are backend independent.
+ ... and create Curl_qlogdir() in the new generic vquic/vquic.c file for
+ QUIC functions that are backend independent.
- Closes #5353
-
-- ntlm_sspi: fix bad use of CURLE_NOT_BUILT_IN
+ Closes #5353
+
+- ntlm_sspi: fix bad use of CURLE_NOT_BUILT_IN
- That return code is reserved for build-time conditional code not being
- present while this was a regular run-time error from a Windows API.
+ That return code is reserved for build-time conditional code not being
+ present while this was a regular run-time error from a Windows API.
- Reported-by: wangp on github
- Fixes #5349
- Closes #5350
-
-- runtests: show elapsed test time with higher precision (ms)
-
-- RELEASE-NOTES: synced
-
-- http2: simplify and clean up trailer handling
+ Reported-by: wangp on github
+ Fixes #5349
+ Closes #5350
+
+- runtests: show elapsed test time with higher precision (ms)
+
+- RELEASE-NOTES: synced
+
+- http2: simplify and clean up trailer handling
- Triggered by a crash detected by OSS-Fuzz after the dynbuf introduction in
- ed35d6590e72. This should make the trailer handling more straight forward and
- hopefully less error-prone.
+ Triggered by a crash detected by OSS-Fuzz after the dynbuf introduction in
+ ed35d6590e72. This should make the trailer handling more straight forward and
+ hopefully less error-prone.
- Deliver the trailer header to the callback already at receive-time. No
- longer caches the trailers to get delivered at end of stream.
+ Deliver the trailer header to the callback already at receive-time. No
+ longer caches the trailers to get delivered at end of stream.
- Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22030
- Closes #5348
+ Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22030
+ Closes #5348
-Marc Hoersken (7 May 2020)
-- appveyor: disable test 1139 instead of ignoring it
-
- Spending time on manpage checking makes no sense
- for these builds due to lacking manpage support.
+Marc Hoersken (7 May 2020)
+- appveyor: disable test 1139 instead of ignoring it
+
+ Spending time on manpage checking makes no sense
+ for these builds due to lacking manpage support.
-- appveyor: disable flaky test 1501 and ignore broken 1056
+- appveyor: disable flaky test 1501 and ignore broken 1056
- Test 1501 is flaky on Windows CI due to being time sensitive
- and the testsuite relying on taskkill.exe to check for the
- existance of processes which can take to much time itself.
+ Test 1501 is flaky on Windows CI due to being time sensitive
+ and the testsuite relying on taskkill.exe to check for the
+ existance of processes which can take to much time itself.
- Test 1056 is broken in autotools-based Windows builds due
- to scope ID support missing in these builds at the moment.
+ Test 1056 is broken in autotools-based Windows builds due
+ to scope ID support missing in these builds at the moment.
-- test613.pl: make tests 613 and 614 work with OpenSSH for Windows
+- test613.pl: make tests 613 and 614 work with OpenSSH for Windows
- OpenSSH for Windows shows group and other/world permissions as *,
- because those concepts do not exist on Windows. It also does not
- show the current or parent directory, so we just ignore those.
+ OpenSSH for Windows shows group and other/world permissions as *,
+ because those concepts do not exist on Windows. It also does not
+ show the current or parent directory, so we just ignore those.
- Reviewed-by: Daniel Stenberg
- Closes #5328
+ Reviewed-by: Daniel Stenberg
+ Closes #5328
-Daniel Stenberg (6 May 2020)
-- runtests: set +x mode again
+Daniel Stenberg (6 May 2020)
+- runtests: set +x mode again
-- libssh2: convert over to use dynbuf
+- libssh2: convert over to use dynbuf
- In my very basic test that lists sftp://127.0.0.1/tmp/, this patched
- code makes 161 allocations compared to 194 in git master. A 17%
- reduction.
+ In my very basic test that lists sftp://127.0.0.1/tmp/, this patched
+ code makes 161 allocations compared to 194 in git master. A 17%
+ reduction.
- Closes #5336
+ Closes #5336
-- travis: add "qlog" as feature in the quiche build
+- travis: add "qlog" as feature in the quiche build
-- quiche: enable qlog output
+- quiche: enable qlog output
+
+ quiche has the potential to log qlog files. To enable this, you must
+ build quiche with the qlog feature enabled `cargo build --features
+ qlog`. curl then passes a file descriptor to quiche, which takes
+ ownership of the file. The FD transfer only works on UNIX.
- quiche has the potential to log qlog files. To enable this, you must
- build quiche with the qlog feature enabled `cargo build --features
- qlog`. curl then passes a file descriptor to quiche, which takes
- ownership of the file. The FD transfer only works on UNIX.
+ The convention is to enable logging when the QLOGDIR environment is
+ set. This should be a path to a folder where files are written with the
+ naming template <SCID>.qlog.
- The convention is to enable logging when the QLOGDIR environment is
- set. This should be a path to a folder where files are written with the
- naming template <SCID>.qlog.
-
- Co-authored-by: Lucas Pardue
- Replaces #5337
- Closes #5341
+ Co-authored-by: Lucas Pardue
+ Replaces #5337
+ Closes #5341
-- urldata.h: remove #define HEADERSIZE, not used anymore
+- urldata.h: remove #define HEADERSIZE, not used anymore
- Follow-up to ed35d6590e72c
-
-- ngtcp2: convert to dynbuf
+ Follow-up to ed35d6590e72c
+
+- ngtcp2: convert to dynbuf
- Closes #5335
+ Closes #5335
-- connect: make happy eyeballs work for QUIC (again)
+- connect: make happy eyeballs work for QUIC (again)
- Follow-up from dbd16c3e256c6c (regression in 7.70.0)
+ Follow-up from dbd16c3e256c6c (regression in 7.70.0)
- Closes #5334
+ Closes #5334
-- connect: add two asserts to clue code analyzers in a little
+- connect: add two asserts to clue code analyzers in a little
-- http_proxy: ported to use dynbuf instead of a static size buffer
+- http_proxy: ported to use dynbuf instead of a static size buffer
- Removes a 16K static buffer from the easy handle. Simplifies the code.
+ Removes a 16K static buffer from the easy handle. Simplifies the code.
-- dynbuf: introduce internal generic dynamic buffer functions
+- dynbuf: introduce internal generic dynamic buffer functions
- A common set of functions instead of many separate implementations for
- creating buffers that can grow when appending data to them. Existing
- functionality has been ported over.
+ A common set of functions instead of many separate implementations for
+ creating buffers that can grow when appending data to them. Existing
+ functionality has been ported over.
- In my early basic testing, the total number of allocations seem at
- roughly the same amount as before, possibly a few less.
+ In my early basic testing, the total number of allocations seem at
+ roughly the same amount as before, possibly a few less.
- See docs/DYNBUF.md for a description of the API.
+ See docs/DYNBUF.md for a description of the API.
- Closes #5300
+ Closes #5300
-- runtests: remove sleep calls
+- runtests: remove sleep calls
- Remove many one second sleeps that were done *after* each newly started
- test server already has been verified. They should not have any purpose
- there.
+ Remove many one second sleeps that were done *after* each newly started
+ test server already has been verified. They should not have any purpose
+ there.
- Closes #5323
+ Closes #5323
-- asyn-*: remove support for never-used NULL entry pointers
+- asyn-*: remove support for never-used NULL entry pointers
- ... and instead convert those to asserts to make sure they are truly
- never NULL.
+ ... and instead convert those to asserts to make sure they are truly
+ never NULL.
- Closes #5324
+ Closes #5324
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- doc: Rename VERSIONS to VERSIONS.md as it already has Markdown syntax
+ doc: Rename VERSIONS to VERSIONS.md as it already has Markdown syntax
- Closes #5325
+ Closes #5325
-Jay Satiro (2 May 2020)
-- asyn-thread: fix cppcheck warning
+Jay Satiro (2 May 2020)
+- asyn-thread: fix cppcheck warning
- - Check for NULL entry parameter before attempting to deref entry in
- Curl_resolver_is_resolved, like is already done in asyn-ares.
+ - Check for NULL entry parameter before attempting to deref entry in
+ Curl_resolver_is_resolved, like is already done in asyn-ares.
- This is to silence cppcheck which does not seem to understand that
- asyn-ares and asyn-thread have separate Curl_resolver_is_resolved
- and those units are mutually exclusive. Prior to this change it warned
- of a scenario where asyn-thread's Curl_resolver_is_resolved is called
- with a NULL entry from asyn-ares, but that couldn't happen.
+ This is to silence cppcheck which does not seem to understand that
+ asyn-ares and asyn-thread have separate Curl_resolver_is_resolved
+ and those units are mutually exclusive. Prior to this change it warned
+ of a scenario where asyn-thread's Curl_resolver_is_resolved is called
+ with a NULL entry from asyn-ares, but that couldn't happen.
- Reported-by: rl1987@users.noreply.github.com
+ Reported-by: rl1987@users.noreply.github.com
- Fixes https://github.com/curl/curl/issues/5326
+ Fixes https://github.com/curl/curl/issues/5326
-- select: fix overflow protection in Curl_socket_check
+- select: fix overflow protection in Curl_socket_check
+
+ Follow-up to a96c752 which changed the timeout_ms type from time_t to
+ timediff_t.
- Follow-up to a96c752 which changed the timeout_ms type from time_t to
- timediff_t.
+ Ref: https://github.com/curl/curl/pull/5240
- Ref: https://github.com/curl/curl/pull/5240
-
- Closes https://github.com/curl/curl/pull/5286
+ Closes https://github.com/curl/curl/pull/5286
-Marc Hoersken (2 May 2020)
-- sockfilt: make select_ws stop waiting on exit signal event
+Marc Hoersken (2 May 2020)
+- sockfilt: make select_ws stop waiting on exit signal event
- This makes sure that select_ws behaves similar to real select
- which stops waiting on a signal handler being triggered.
+ This makes sure that select_ws behaves similar to real select
+ which stops waiting on a signal handler being triggered.
- This makes it possible to gracefully stop sockfilt.exe on
- Windows with taskkill /IM sockfilt.exe (without /F force flag).
+ This makes it possible to gracefully stop sockfilt.exe on
+ Windows with taskkill /IM sockfilt.exe (without /F force flag).
- Reviewed-by: Jay Satiro
- Part of #5260
+ Reviewed-by: Jay Satiro
+ Part of #5260
-- tests/server/util.[ch]: add exit event to stop waiting on Windows
+- tests/server/util.[ch]: add exit event to stop waiting on Windows
- This commit adds a global exit event to the test servers that
- Windows-specific wait routines can use to get triggered if the
- program was signaled to be terminated, eg. select_ws in sockfilt.c
+ This commit adds a global exit event to the test servers that
+ Windows-specific wait routines can use to get triggered if the
+ program was signaled to be terminated, eg. select_ws in sockfilt.c
- The exit event will be managed by the signal handling code and is
- set to not reset automatically to support multiple wait routines.
+ The exit event will be managed by the signal handling code and is
+ set to not reset automatically to support multiple wait routines.
- Reviewed-by: Jay Satiro
- Closes #5260
+ Reviewed-by: Jay Satiro
+ Closes #5260
-- tests/server/util.c: fix thread handle not being closed
-
- Reviewed-by: Jay Satiro
- Part of #5260
+- tests/server/util.c: fix thread handle not being closed
+
+ Reviewed-by: Jay Satiro
+ Part of #5260
-- tests/server/util.c: use raise instead of calling signal handler
+- tests/server/util.c: use raise instead of calling signal handler
- Use raise to trigger signal handler instead of calling it
- directly and causing potential unexpected control flow.
+ Use raise to trigger signal handler instead of calling it
+ directly and causing potential unexpected control flow.
- Reviewed-by: Jay Satiro
- Part of #5260
+ Reviewed-by: Jay Satiro
+ Part of #5260
-- tests: add support for SSH server variant specific transfer paths
+- tests: add support for SSH server variant specific transfer paths
- OpenSSH for Windows requires paths in the format of /C:/
- instead of the pseudo-POSIX paths /cygdrive/c/ or just /c/
+ OpenSSH for Windows requires paths in the format of /C:/
+ instead of the pseudo-POSIX paths /cygdrive/c/ or just /c/
- Reviewed-by: Daniel Stenberg
- Closes #5298
+ Reviewed-by: Daniel Stenberg
+ Closes #5298
-Daniel Stenberg (2 May 2020)
+Daniel Stenberg (2 May 2020)
- RELEASE-NOTES: synced
-- libssh2: set the expected total size in SCP upload init
+- libssh2: set the expected total size in SCP upload init
- ... as otherwise the progress callback gets called without that
- information, making the progress meter have less info.
+ ... as otherwise the progress callback gets called without that
+ information, making the progress meter have less info.
- Reported-by: Murugan Balraj
- Bug: https://curl.haxx.se/mail/archive-2020-05/0000.html
- Closes #5317
+ Reported-by: Murugan Balraj
+ Bug: https://curl.haxx.se/mail/archive-2020-05/0000.html
+ Closes #5317
-- runtests: make the logmsg from the ssh server only show in verbose
-
-- tests: make test 1248 + 1249 use %NOLISTENPORT
+- runtests: make the logmsg from the ssh server only show in verbose
+
+- tests: make test 1248 + 1249 use %NOLISTENPORT
- ... instead of a port of a non-running server so that it works
- stand-alone.
+ ... instead of a port of a non-running server so that it works
+ stand-alone.
- Closes #5318
+ Closes #5318
-- examples: remove asiohiper.cpp
+- examples: remove asiohiper.cpp
- This example has repeatedly been reported to contain bugs, and as users
- copy and paste code from this into production, I now deem it better to
- not provide the example at all.
+ This example has repeatedly been reported to contain bugs, and as users
+ copy and paste code from this into production, I now deem it better to
+ not provide the example at all.
- Closes #5090
- Closes #5322
+ Closes #5090
+ Closes #5322
+
+- [Emil Engler brought this change]
-- [Emil Engler brought this change]
-
- doc: add missing closing parenthesis in CURLINFO_SSL_VERIFYRESULT.3
+ doc: add missing closing parenthesis in CURLINFO_SSL_VERIFYRESULT.3
- Closes #5320
+ Closes #5320
-- [Emil Engler brought this change]
-
- KNOWN_BUGS: Remove "curl --upload-file . hang if delay in STDIN"
+- [Emil Engler brought this change]
+
+ KNOWN_BUGS: Remove "curl --upload-file . hang if delay in STDIN"
- It was fixed in 9a2cbf3
+ It was fixed in 9a2cbf3
- Closes #5319
+ Closes #5319
-- cirrus: disable SFTP and SCP tests
+- cirrus: disable SFTP and SCP tests
- ... as we can't seem to start the sshd server on it. Those problems
- existed before d1239b50bececd (running the SSH server on a random port),
- but they're more noticable now since there are more failed attempts in
- the logs.
+ ... as we can't seem to start the sshd server on it. Those problems
+ existed before d1239b50bececd (running the SSH server on a random port),
+ but they're more noticable now since there are more failed attempts in
+ the logs.
- Closes #5315
+ Closes #5315
+
+- [Emil Engler brought this change]
-- [Emil Engler brought this change]
-
- runtests: fix typo in the existence of disabled tests checker
+ runtests: fix typo in the existence of disabled tests checker
- Closes #5316
-
-Dan Fandrich (30 Apr 2020)
-- test75: Remove precheck test
+ Closes #5316
+
+Dan Fandrich (30 Apr 2020)
+- test75: Remove precheck test
- This has not been needed since commit 9fa42bed and often prevents it
- from running at all with dynamic test ports.
+ This has not been needed since commit 9fa42bed and often prevents it
+ from running at all with dynamic test ports.
-- tests: Stop referring to server ports when they're not used
-
- Several tests referred to specific server ports even when the test
- didn't actually use that server or specify that it's needed. In such
- cases, the test harness substitutes the text "[not running]" as the port
- number which causes many such tests to fail due to the inability to
- parse the URL. These tests are changed to use %NOLISTENPORT which will
- always be substituted correctly.
+- tests: Stop referring to server ports when they're not used
+
+ Several tests referred to specific server ports even when the test
+ didn't actually use that server or specify that it's needed. In such
+ cases, the test harness substitutes the text "[not running]" as the port
+ number which causes many such tests to fail due to the inability to
+ parse the URL. These tests are changed to use %NOLISTENPORT which will
+ always be substituted correctly.
-Daniel Stenberg (30 Apr 2020)
-- [Emil Engler brought this change]
+Daniel Stenberg (30 Apr 2020)
+- [Emil Engler brought this change]
- GnuTLS: Backend support for CURLINFO_SSL_VERIFYRESULT
+ GnuTLS: Backend support for CURLINFO_SSL_VERIFYRESULT
- Closes #5287
+ Closes #5287
-- conncache: various concept cleanups
+- conncache: various concept cleanups
- More connection cache accesses are protected by locks.
+ More connection cache accesses are protected by locks.
- CONNCACHE_* is a beter prefix for the connection cache lock macros.
+ CONNCACHE_* is a beter prefix for the connection cache lock macros.
- Curl_attach_connnection: now called as soon as there's a connection
- struct available and before the connection is added to the connection
- cache.
-
- Curl_disconnect: now assumes that the connection is already removed from
- the connection cache.
-
- Ref: #4915
- Closes #5009
+ Curl_attach_connnection: now called as soon as there's a connection
+ struct available and before the connection is added to the connection
+ cache.
+
+ Curl_disconnect: now assumes that the connection is already removed from
+ the connection cache.
+
+ Ref: #4915
+ Closes #5009
-- tests: tests: run stunnel for HTTPS and FTPS on dynamic ports
+- tests: tests: run stunnel for HTTPS and FTPS on dynamic ports
- As stunnel is an external tool and it has no specific option to export
- the actually used port number when asked to listen to 0, runtests
- instead iterates over ten randomly picked high number ports and sticks
- to the first one stunnel can listen to.
+ As stunnel is an external tool and it has no specific option to export
+ the actually used port number when asked to listen to 0, runtests
+ instead iterates over ten randomly picked high number ports and sticks
+ to the first one stunnel can listen to.
- Closes #5267
+ Closes #5267
-- tests: pick a random port number for SSH
+- tests: pick a random port number for SSH
- Since sshd doesn't have such an option by itself, we iterate over a
- series of random ports until one works.
+ Since sshd doesn't have such an option by itself, we iterate over a
+ series of random ports until one works.
- Closes #5273
+ Closes #5273
-- [Rikard Falkeborn brought this change]
+- [Rikard Falkeborn brought this change]
- libtest/cmake: Remove commented code
+ libtest/cmake: Remove commented code
- These were commented out in e9dd0998706a when Makefile.inc was included
- instead. 11 years have passed since then and the commented code is of
- course very outdated. Remove it to avoid confusion.
+ These were commented out in e9dd0998706a when Makefile.inc was included
+ instead. 11 years have passed since then and the commented code is of
+ course very outdated. Remove it to avoid confusion.
- Closes #5311
-
-- schannel: source code reindent
+ Closes #5311
+
+- schannel: source code reindent
- White space edits only. Conform better to standard curl source code
- indenting style.
+ White space edits only. Conform better to standard curl source code
+ indenting style.
- Closes #5305
+ Closes #5305
-Kamil Dudka (29 Apr 2020)
-- test1177: look for curl.h in source directory
+Kamil Dudka (29 Apr 2020)
+- test1177: look for curl.h in source directory
- If we use a separate build directory, there is no copy of the header.
+ If we use a separate build directory, there is no copy of the header.
- Closes #5310
+ Closes #5310
-- tests: look for preprocessed tests in build directory
+- tests: look for preprocessed tests in build directory
- ... which is not always the same directory as source directory
+ ... which is not always the same directory as source directory
- Closes #5310
+ Closes #5310
-Daniel Stenberg (29 Apr 2020)
-- RELEASE-NOTES: synced
+Daniel Stenberg (29 Apr 2020)
+- RELEASE-NOTES: synced
- ... and bumped curlver.h to 7.70.1
+ ... and bumped curlver.h to 7.70.1
-Version 7.70.0 (29 Apr 2020)
+Version 7.70.0 (29 Apr 2020)
-Daniel Stenberg (29 Apr 2020)
-- RELEASE-NOTES: 7.70.0
+Daniel Stenberg (29 Apr 2020)
+- RELEASE-NOTES: 7.70.0
-- THANKS: synced with the 7.70.0 release
+- THANKS: synced with the 7.70.0 release
-- headers: copyright range fix
+- headers: copyright range fix
-- [Rikard Falkeborn brought this change]
+- [Rikard Falkeborn brought this change]
- doh: Constify some input pointers
+ doh: Constify some input pointers
- Closes #5306
-
-- nss: check for PK11_CreateDigestContext() returning NULL
+ Closes #5306
+
+- nss: check for PK11_CreateDigestContext() returning NULL
- ... to avoid crashes!
+ ... to avoid crashes!
- Reported-by: Hao Wu
- Fixes #5302
- Closes #5303
+ Reported-by: Hao Wu
+ Fixes #5302
+ Closes #5303
-- travis: bump the wolfssl CI build to use 4.4.0
+- travis: bump the wolfssl CI build to use 4.4.0
- Closes #5301
-
-- copyright updates: adjust year ranges
-
-Marc Hoersken (26 Apr 2020)
-- CI: do not include */ci branches in PR builds
+ Closes #5301
+
+- copyright updates: adjust year ranges
+
+Marc Hoersken (26 Apr 2020)
+- CI: do not include */ci branches in PR builds
- Align Azure Pipelines with GitHub Actions.
+ Align Azure Pipelines with GitHub Actions.
-Daniel Stenberg (25 Apr 2020)
-- runtests: check for the disabled tests relative srcdir
+Daniel Stenberg (25 Apr 2020)
+- runtests: check for the disabled tests relative srcdir
- To make it work correctly for out-of-tree builds.
+ To make it work correctly for out-of-tree builds.
- Follow-up to 75e8feb6fb08b
+ Follow-up to 75e8feb6fb08b
- Bug: https://github.com/curl/curl/pull/5288#issuecomment-619346389
- Reported-by: Marcel Raad
- Closes #5297
-
-- runtests: revert commenting out a line I did for debugging
+ Bug: https://github.com/curl/curl/pull/5288#issuecomment-619346389
+ Reported-by: Marcel Raad
+ Closes #5297
+
+- runtests: revert commenting out a line I did for debugging
- Follow-up to 11091cd4d. It was not meant to be pushed!
-
-- smtp: set auth correctly
+ Follow-up to 11091cd4d. It was not meant to be pushed!
+
+- smtp: set auth correctly
- Regression since 7.69.0 and 68fb25fa3fcff.
+ Regression since 7.69.0 and 68fb25fa3fcff.
- The code wrongly assigned 'from' instead of 'auth' which probably was a
- copy and paste mistake from other code, leading to that auth could
- remain NULL and later cause an error to be returned.
+ The code wrongly assigned 'from' instead of 'auth' which probably was a
+ copy and paste mistake from other code, leading to that auth could
+ remain NULL and later cause an error to be returned.
- Assisted-by: Eric Sauvageau
- Fixes #5294
- Closes #5295
-
-Marcel Raad (25 Apr 2020)
-- lib: clean up whitespace
+ Assisted-by: Eric Sauvageau
+ Fixes #5294
+ Closes #5295
+
+Marcel Raad (25 Apr 2020)
+- lib: clean up whitespace
- This fixes CodeFactor warnings.
-
-Daniel Stenberg (25 Apr 2020)
-- [Anderson Toshiyuki Sasaki brought this change]
-
- libssh: avoid options override by configuration files
+ This fixes CodeFactor warnings.
+
+Daniel Stenberg (25 Apr 2020)
+- [Anderson Toshiyuki Sasaki brought this change]
+
+ libssh: avoid options override by configuration files
- Previously, options set explicitly through command line options could be
- overridden by the configuration files parsed automatically when
- ssh_connect() was called.
+ Previously, options set explicitly through command line options could be
+ overridden by the configuration files parsed automatically when
+ ssh_connect() was called.
- By calling ssh_options_parse_config() explicitly, the configuration
- files are parsed before setting the options, avoiding the options
- override. Once the configuration files are parsed, the automatic
- configuration parsing is not executed.
+ By calling ssh_options_parse_config() explicitly, the configuration
+ files are parsed before setting the options, avoiding the options
+ override. Once the configuration files are parsed, the automatic
+ configuration parsing is not executed.
- Fixes #4972
- Closes #5283
- Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
-
-- runtests: when <killserver> mentions http, kill http/2 too
+ Fixes #4972
+ Closes #5283
+ Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
+
+- runtests: when <killserver> mentions http, kill http/2 too
- Since the http2 test server is a mere proxy that needs to know about the
- dynamic port the HTTP server is using, it too needs to get restarted
- when the http server is killed.
+ Since the http2 test server is a mere proxy that needs to know about the
+ dynamic port the HTTP server is using, it too needs to get restarted
+ when the http server is killed.
- A regression caused by 80d6515.
+ A regression caused by 80d6515.
- Fixes #5289
- Closes #5291
+ Fixes #5289
+ Closes #5291
-- [Yuri Slobodyanyuk brought this change]
+- [Yuri Slobodyanyuk brought this change]
- docs: fix two typos
+ docs: fix two typos
- Closes #5292
+ Closes #5292
+
+- [Emil Engler brought this change]
-- [Emil Engler brought this change]
-
- tests/git: ignore mqttd and port files
+ tests/git: ignore mqttd and port files
- Closes #5290
+ Closes #5290
-- tests: make runtests check that disabled tests exists
+- tests: make runtests check that disabled tests exists
- ... and error out if so. Removed '536' from DISABLED as there is no such
- test file.
+ ... and error out if so. Removed '536' from DISABLED as there is no such
+ test file.
- Closes #5288
+ Closes #5288
-- test1154: set a proper name
+- test1154: set a proper name
-- select: make Curl_socket_check take timediff_t timeout
+- select: make Curl_socket_check take timediff_t timeout
- Coverity found CID 1461718:
+ Coverity found CID 1461718:
- Integer handling issues (CONSTANT_EXPRESSION_RESULT) "timeout_ms >
- 9223372036854775807L" is always false regardless of the values of its
- operands. This occurs as the logical second operand of "||".
-
- Closes #5240
+ Integer handling issues (CONSTANT_EXPRESSION_RESULT) "timeout_ms >
+ 9223372036854775807L" is always false regardless of the values of its
+ operands. This occurs as the logical second operand of "||".
+
+ Closes #5240
-- [i-ky brought this change]
+- [i-ky brought this change]
- libcurl-multi.3: added missing full stop
+ libcurl-multi.3: added missing full stop
- Closes #5285
+ Closes #5285
-Jay Satiro (22 Apr 2020)
-- transfer: Switch PUT to GET/HEAD on 303 redirect
+Jay Satiro (22 Apr 2020)
+- transfer: Switch PUT to GET/HEAD on 303 redirect
- Prior to this change if there was a 303 reply to a PUT request then
- the subsequent request to respond to that redirect would also be a PUT.
- It was determined that was most likely incorrect based on the language
- of the RFCs. Basically 303 means "see other" resource, which implies it
- is most likely not the same resource, therefore we should not try to PUT
- to that different resource.
+ Prior to this change if there was a 303 reply to a PUT request then
+ the subsequent request to respond to that redirect would also be a PUT.
+ It was determined that was most likely incorrect based on the language
+ of the RFCs. Basically 303 means "see other" resource, which implies it
+ is most likely not the same resource, therefore we should not try to PUT
+ to that different resource.
- Refer to the discussions in #5237 and #5248 for more information.
+ Refer to the discussions in #5237 and #5248 for more information.
- Fixes https://github.com/curl/curl/issues/5237
- Closes https://github.com/curl/curl/pull/5248
+ Fixes https://github.com/curl/curl/issues/5237
+ Closes https://github.com/curl/curl/pull/5248
-Daniel Stenberg (22 Apr 2020)
-- lib/mk-ca-bundle: skip empty certs
+Daniel Stenberg (22 Apr 2020)
+- lib/mk-ca-bundle: skip empty certs
- Reviewed-by: Emil Engler
- Reported-by: Ashwin Metpalli
- Fixes #5278
- Closes #5280
+ Reviewed-by: Emil Engler
+ Reported-by: Ashwin Metpalli
+ Fixes #5278
+ Closes #5280
-- version: skip idn2_check_version() check and add precaution
+- version: skip idn2_check_version() check and add precaution
- A gcc-10's -fanalyze complaint made me spot and do these improvements.
+ A gcc-10's -fanalyze complaint made me spot and do these improvements.
- Closes #5281
+ Closes #5281
+
+- RELEASE-NOTES: synced
+
+- [Brian Bergeron brought this change]
-- RELEASE-NOTES: synced
-
-- [Brian Bergeron brought this change]
-
- curl.h: update comment typo
+ curl.h: update comment typo
- "routines with be invoked" -> "routines will be invoked"
+ "routines with be invoked" -> "routines will be invoked"
- Closes #5279
+ Closes #5279
-- [Emil Engler brought this change]
+- [Emil Engler brought this change]
- GnuTLS: Don't skip really long certificate fields
+ GnuTLS: Don't skip really long certificate fields
- Closes #5271
+ Closes #5271
-- gnutls: bump lowest supported version to 3.1.10
+- gnutls: bump lowest supported version to 3.1.10
- GnuTLS 3.1.10 added new functions we want to use. That version was
- released on Mar 22, 2013. Removing support for older versions also
- greatly simplifies the code.
+ GnuTLS 3.1.10 added new functions we want to use. That version was
+ released on Mar 22, 2013. Removing support for older versions also
+ greatly simplifies the code.
- Ref: #5271
- Closes #5276
-
-- mqtt: make NOSTATE get within the debug name array
-
-- tests: run the RTSP test server on a dynamic port number
+ Ref: #5271
+ Closes #5276
+
+- mqtt: make NOSTATE get within the debug name array
+
+- tests: run the RTSP test server on a dynamic port number
- To avoid port collisions.
+ To avoid port collisions.
- Closes #5272
+ Closes #5272
-- tests: add %NOLISTENPORT and use it
+- tests: add %NOLISTENPORT and use it
+
+ The purpose with this variable is to provide a port number that is
+ reasonably likely to not have a listener on the local host so that tests
+ can try connect failures against it. It uses port 47 - "reserved"
+ according to IANA.
- The purpose with this variable is to provide a port number that is
- reasonably likely to not have a listener on the local host so that tests
- can try connect failures against it. It uses port 47 - "reserved"
- according to IANA.
-
- Updated six tests to use it instead of the previous different ports.
-
- Assisted-by: Emil Engler
- Closes #5270
+ Updated six tests to use it instead of the previous different ports.
+
+ Assisted-by: Emil Engler
+ Closes #5270
-- mqtt: remove code with no purpose
+- mqtt: remove code with no purpose
+
+ Detected by Coverity. CID 1462319.
- Detected by Coverity. CID 1462319.
-
- "The same code is executed when the condition result is true or false,
- because the code in the if-then branch and after the if statement is
- identical."
-
- Closes #5275
+ "The same code is executed when the condition result is true or false,
+ because the code in the if-then branch and after the if statement is
+ identical."
+
+ Closes #5275
-- mqtt: fix Curl_read() error handling while reading remaining length
+- mqtt: fix Curl_read() error handling while reading remaining length
- Detected by Coverity. CID 1462320.
+ Detected by Coverity. CID 1462320.
- Closes #5274
+ Closes #5274
-- server/tftpd: fix compiler warning
+- server/tftpd: fix compiler warning
- Follow-up from 369ce38ac1d
- Reported-by: Marc Hörsken
+ Follow-up from 369ce38ac1d
+ Reported-by: Marc Hörsken
-- http: free memory when Alt-Used header creation fails due to OOM
+- http: free memory when Alt-Used header creation fails due to OOM
- Reported-by: James Fuller
- Fixes #5268
- Closes #5269
+ Reported-by: James Fuller
+ Fixes #5268
+ Closes #5269
-Daniel Gustafsson (20 Apr 2020)
-- lib: fix typos in comments and errormessages
+Daniel Gustafsson (20 Apr 2020)
+- lib: fix typos in comments and errormessages
- This fixes a few randomly spotted typos in recently merged code, most
- notably one in a userfacing errormessage the schannel code.
+ This fixes a few randomly spotted typos in recently merged code, most
+ notably one in a userfacing errormessage the schannel code.
-Daniel Stenberg (20 Apr 2020)
-- tests: run the SOCKS test server on a dynamic port number
+Daniel Stenberg (20 Apr 2020)
+- tests: run the SOCKS test server on a dynamic port number
- Closes #5266
+ Closes #5266
-- [Johannes Schindelin brought this change]
+- [Johannes Schindelin brought this change]
- multi-ssl: reset the SSL backend on `Curl_global_cleanup()`
+ multi-ssl: reset the SSL backend on `Curl_global_cleanup()`
+
+ When cURL is compiled with support for multiple SSL backends, it is
+ possible to configure an SSL backend via `curl_global_sslset()`, but
+ only *before* `curl_global_init()` was called.
- When cURL is compiled with support for multiple SSL backends, it is
- possible to configure an SSL backend via `curl_global_sslset()`, but
- only *before* `curl_global_init()` was called.
+ If another SSL backend should be used after that, a user might be
+ tempted to call `curl_global_cleanup()` to start over. However, we did
+ not foresee that use case and forgot to reset the SSL backend in that
+ cleanup.
- If another SSL backend should be used after that, a user might be
- tempted to call `curl_global_cleanup()` to start over. However, we did
- not foresee that use case and forgot to reset the SSL backend in that
- cleanup.
+ Let's allow that use case.
- Let's allow that use case.
-
- Fixes #5255
- Closes #5257
- Reported-by: davidedec on github
- Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+ Fixes #5255
+ Closes #5257
+ Reported-by: davidedec on github
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
-- tests: run the TFTP test server on a dynamic port number
+- tests: run the TFTP test server on a dynamic port number
+
+ Picking a dynamic unused port is better than a fixed to avoid the
+ collision risk.
- Picking a dynamic unused port is better than a fixed to avoid the
- collision risk.
-
- Closes #5265
+ Closes #5265
-- mqtt: improve the state machine
+- mqtt: improve the state machine
- To handle PUBLISH before SUBACK and more.
+ To handle PUBLISH before SUBACK and more.
- Updated the existing tests and added three new ones.
+ Updated the existing tests and added three new ones.
- Reported-by: Christoph Krey
- Bug: https://curl.haxx.se/mail/lib-2020-04/0021.html
- Closes #5246
+ Reported-by: Christoph Krey
+ Bug: https://curl.haxx.se/mail/lib-2020-04/0021.html
+ Closes #5246
-- runtests: always put test number in servercmd file
+- runtests: always put test number in servercmd file
- RELEASE-NOTES: synced
-- release-notes.pl: fix parsing typo
+- release-notes.pl: fix parsing typo
-James Fuller (20 Apr 2020)
-- ensure all references to ports are replaced by vars
+James Fuller (20 Apr 2020)
+- ensure all references to ports are replaced by vars
-- add more alt-svc test coverage
+- add more alt-svc test coverage
-Daniel Stenberg (20 Apr 2020)
-- test1247: use http server to get the port number set
+Daniel Stenberg (20 Apr 2020)
+- test1247: use http server to get the port number set
- Follow-up to 0f5db7b263f
+ Follow-up to 0f5db7b263f
-- runtests: use a unix domain socket path with the pid in the name
+- runtests: use a unix domain socket path with the pid in the name
- To make it impossible for test cases to access the file name without
- using the proper variable for the purpose.
+ To make it impossible for test cases to access the file name without
+ using the proper variable for the purpose.
- Closes #5264
+ Closes #5264
-Daniel Gustafsson (19 Apr 2020)
-- [Mipsters on github brought this change]
+Daniel Gustafsson (19 Apr 2020)
+- [Mipsters on github brought this change]
- src: Remove C99 constructs to ensure C89 compliance
+ src: Remove C99 constructs to ensure C89 compliance
- This fixes the error: 'for' loop initial declaration used outside C99
- mode by declaring the loop increment variable in the beginning of the
- block instead of inside the for loop.
+ This fixes the error: 'for' loop initial declaration used outside C99
+ mode by declaring the loop increment variable in the beginning of the
+ block instead of inside the for loop.
+
+ Fixes #5254
+ Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
+
+Daniel Stenberg (19 Apr 2020)
+- runtests: dummy init the ports variables to avoid warnings
- Fixes #5254
- Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
+ ... and generate something that can help debug test cases.
-Daniel Stenberg (19 Apr 2020)
-- runtests: dummy init the ports variables to avoid warnings
-
- ... and generate something that can help debug test cases.
+- [Patrick Monnerat brought this change]
-- [Patrick Monnerat brought this change]
-
- mime: properly check Content-Type even if it has parameters
+ mime: properly check Content-Type even if it has parameters
- New test 669 checks this fix is effective.
+ New test 669 checks this fix is effective.
- Fixes #5256
- Closes #5258
- Reported-by: thanhchungbtc on github
+ Fixes #5256
+ Closes #5258
+ Reported-by: thanhchungbtc on github
-- tests/FILEFORMAT: converted to markdown and extended
+- tests/FILEFORMAT: converted to markdown and extended
- Closes #5261
+ Closes #5261
-- test1245: make it work with dynamic FTP server port
-
-- test1055: make it work with dynamic FTP port
-
-- test1028: make it run on dynamic FTP server port
-
-- tests: move pingpong server to dynamic listening port
+- test1245: make it work with dynamic FTP server port
+
+- test1055: make it work with dynamic FTP port
+
+- test1028: make it run on dynamic FTP server port
+
+- tests: move pingpong server to dynamic listening port
- FTP, IMAP, POP3, SMTP and their IPv6 versions are now all on dynamic
- ports
+ FTP, IMAP, POP3, SMTP and their IPv6 versions are now all on dynamic
+ ports
- Test 842-845 are unfortunately a bit hard to move over to this concept
- right now and require "default port" still...
+ Test 842-845 are unfortunately a bit hard to move over to this concept
+ right now and require "default port" still...
-- test1056: work with dynamic HTTP ipv6 port
+- test1056: work with dynamic HTTP ipv6 port
-- test1448: work with dynamic HTTP server port
-
-- tests: introduce preprocessed test cases
+- test1448: work with dynamic HTTP server port
+
+- tests: introduce preprocessed test cases
- The runtests script now always performs variable replacement on the
- entire test source file before the test gets executed, and saves the
- updated version in a temporary file (log/test[num]) so that all test
- case readers/servers can use that version (if present) and thus enjoy
- the powers of test case variable substitution.
+ The runtests script now always performs variable replacement on the
+ entire test source file before the test gets executed, and saves the
+ updated version in a temporary file (log/test[num]) so that all test
+ case readers/servers can use that version (if present) and thus enjoy
+ the powers of test case variable substitution.
- This is necessary to allow complete port number freedom.
+ This is necessary to allow complete port number freedom.
- Test 309 is updated to work with a non-fixed port number thanks to this.
+ Test 309 is updated to work with a non-fixed port number thanks to this.
-- tests: make 2006-2010 handle different port number lengths
+- tests: make 2006-2010 handle different port number lengths
-- tests: run the sws server on "any port"
+- tests: run the sws server on "any port"
- Makes the test servers for HTTP and Gopher pop up on a currently unused
- port and runtests adapts to that!
+ Makes the test servers for HTTP and Gopher pop up on a currently unused
+ port and runtests adapts to that!
- Closes #5247
+ Closes #5247
-Marc Hoersken (18 Apr 2020)
-- sockfilt: tidy variable naming and data structure in select_ws
+Marc Hoersken (18 Apr 2020)
+- sockfilt: tidy variable naming and data structure in select_ws
- This commit does not introduce any logical changes to the code.
+ This commit does not introduce any logical changes to the code.
- Reviewed-by: Jay Satiro and Marcel Raad
- Closes #5238
+ Reviewed-by: Jay Satiro and Marcel Raad
+ Closes #5238
-Daniel Stenberg (17 Apr 2020)
-- [Anderson Toshiyuki Sasaki brought this change]
+Daniel Stenberg (17 Apr 2020)
+- [Anderson Toshiyuki Sasaki brought this change]
- libssh: Use new ECDSA key types to check known hosts
+ libssh: Use new ECDSA key types to check known hosts
- From libssh 0.9.0, ssh_key_type() returns different key types for ECDSA
- keys depending on the curve.
+ From libssh 0.9.0, ssh_key_type() returns different key types for ECDSA
+ keys depending on the curve.
- Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
- Fixes #5252
- Closes #5253
-
-Marcel Raad (17 Apr 2020)
-- appveyor: add Unicode winbuild jobs
+ Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
+ Fixes #5252
+ Closes #5253
+
+Marcel Raad (17 Apr 2020)
+- appveyor: add Unicode winbuild jobs
- These are cheap as they don't build tests.
-
- Closes https://github.com/curl/curl/pull/5063
+ These are cheap as they don't build tests.
+
+ Closes https://github.com/curl/curl/pull/5063
-Daniel Stenberg (16 Apr 2020)
-- mqttd: s/errno/SOCKERRNO
+Daniel Stenberg (16 Apr 2020)
+- mqttd: s/errno/SOCKERRNO
- To behave proper on Windows
- Reported-by: Gisle Vanem
- Bug: https://github.com/curl/curl/commit/5e855bbd18f84a02c951be7cac6188276818cdac#r38507132
- Closes #5241
+ To behave proper on Windows
+ Reported-by: Gisle Vanem
+ Bug: https://github.com/curl/curl/commit/5e855bbd18f84a02c951be7cac6188276818cdac#r38507132
+ Closes #5241
-- buildconf: use find -execdir instead, remove -print and the ares files
+- buildconf: use find -execdir instead, remove -print and the ares files
- Follow-up to 1e41bec96a6e
+ Follow-up to 1e41bec96a6e
- Suggested-by: Marc Hörsken
+ Suggested-by: Marc Hörsken
-- [Alexander V. Tikhonov brought this change]
+- [Alexander V. Tikhonov brought this change]
- buildconf: avoid using tempfile when removing files
+ buildconf: avoid using tempfile when removing files
- Closes #5213
+ Closes #5213
+
+- copyright: bump the copyright year range
-- copyright: bump the copyright year range
+- scripts/release-notes.pl: accept colon after the Fixes/Closes keywords
-- scripts/release-notes.pl: accept colon after the Fixes/Closes keywords
+- [JP Mens brought this change]
-- [JP Mens brought this change]
-
- docs/MQTT: replace confusing 80 by 75
+ docs/MQTT: replace confusing 80 by 75
- I was a bit surprised by the `80`: first thought: what's HTTP doing
- here? ;)
+ I was a bit surprised by the `80`: first thought: what's HTTP doing
+ here? ;)
- Closes #5236
+ Closes #5236
-- [Brad King brought this change]
+- [Brad King brought this change]
- cmake: Avoid MSVC C4273 warnings in send/recv checks
+ cmake: Avoid MSVC C4273 warnings in send/recv checks
- We use `check_c_source_compiles` to check possible send/recv signatures
- by reproducing the forward declarations from system headers. On Windows
- the `winsock2.h` header adds dll linkage settings to its forward
- declaration. If ours does not match the compiler warns:
+ We use `check_c_source_compiles` to check possible send/recv signatures
+ by reproducing the forward declarations from system headers. On Windows
+ the `winsock2.h` header adds dll linkage settings to its forward
+ declaration. If ours does not match the compiler warns:
- warning C4273: 'recv': inconsistent dll linkage
+ warning C4273: 'recv': inconsistent dll linkage
- Add `WINSOCK_API_LINKAGE` to our test signatures when it is defined so
- that our linkage is consistent with that from `winsock2.h`.
-
- Fixes #4764
- Closes #5232
+ Add `WINSOCK_API_LINKAGE` to our test signatures when it is defined so
+ that our linkage is consistent with that from `winsock2.h`.
+
+ Fixes #4764
+ Closes #5232
-Jay Satiro (14 Apr 2020)
-- KNOWN_BUGS: Add entry 'Blocking socket operations'
+Jay Satiro (14 Apr 2020)
+- KNOWN_BUGS: Add entry 'Blocking socket operations'
+
+ - Add threaded resolver cleanup and GSSAPI for FTP to the TODO list of
+ known blocking operations.
- - Add threaded resolver cleanup and GSSAPI for FTP to the TODO list of
- known blocking operations.
+ - New known bugs entry 'Blocking socket operations in non-blocking API'
+ that directs to the TODO's list of known blocking operations.
- - New known bugs entry 'Blocking socket operations in non-blocking API'
- that directs to the TODO's list of known blocking operations.
+ Ref: https://github.com/curl/curl/pull/5214#issuecomment-612488021
- Ref: https://github.com/curl/curl/pull/5214#issuecomment-612488021
-
- Reported-by: Marc Hoersken
-
- Closes https://github.com/curl/curl/pull/5216
+ Reported-by: Marc Hoersken
+
+ Closes https://github.com/curl/curl/pull/5216
-Marc Hoersken (14 Apr 2020)
-- test2043: use revoked.badssl.com instead of revoked.grc.com
+Marc Hoersken (14 Apr 2020)
+- test2043: use revoked.badssl.com instead of revoked.grc.com
- The certificate of revoked.grc.com has expired on 2020-04-13.
+ The certificate of revoked.grc.com has expired on 2020-04-13.
- Reviewed-by: Jay Satiro
+ Reviewed-by: Jay Satiro
- Closes #5233
+ Closes #5233
-- sockfilt: fix broken pipe on Windows to be ready in select_ws
+- sockfilt: fix broken pipe on Windows to be ready in select_ws
- Closes #5228
+ Closes #5228
-Daniel Stenberg (14 Apr 2020)
+Daniel Stenberg (14 Apr 2020)
- RELEASE-NOTES: synced
-- scripts/release-notes: fix duplicate output header
+- scripts/release-notes: fix duplicate output header
+
+- github/workflow: enable MQTT in the macOS debug build
+
+- azure: add mqtt support to one of the Windows builds
+
+- travis: add mqtt job on Linux
+
+- tests: add four MQTT tests 1190 - 1193
-- github/workflow: enable MQTT in the macOS debug build
+- tests: add the mqtt test server mqttd
-- azure: add mqtt support to one of the Windows builds
-
-- travis: add mqtt job on Linux
-
-- tests: add four MQTT tests 1190 - 1193
-
-- tests: add the mqtt test server mqttd
-
-- tests: support hex encoded data and mqtt server
+- tests: support hex encoded data and mqtt server
- The mqtt server is started using a "random" port.
-
-- [Björn Stenberg brought this change]
-
- mqtt: add new experimental protocol
+ The mqtt server is started using a "random" port.
+
+- [Björn Stenberg brought this change]
+
+ mqtt: add new experimental protocol
- Closes #5173
-
-- TODO: Consider convenience options for JSON and XML?
+ Closes #5173
+
+- TODO: Consider convenience options for JSON and XML?
- Closes #5203
+ Closes #5203
-- tool: do not declare functions with Curl_ prefix
+- tool: do not declare functions with Curl_ prefix
+
+ To avoid collision risks with private libcurl symbols when linked with
+ static versions (or just versions not hiding internal symbols).
- To avoid collision risks with private libcurl symbols when linked with
- static versions (or just versions not hiding internal symbols).
-
- Reported-by: hydra3333 on github
- Fixes #5219
- Closes #5234
+ Reported-by: hydra3333 on github
+ Fixes #5219
+ Closes #5234
-- [Nathaniel R. Lewis brought this change]
+- [Nathaniel R. Lewis brought this change]
- cmake: add aliases so exported target names are available in tree
-
- Reviewed-by: Brad King
- Closes #5206
+ cmake: add aliases so exported target names are available in tree
+
+ Reviewed-by: Brad King
+ Closes #5206
-- version: increase buffer space for ssl version output
+- version: increase buffer space for ssl version output
- To avoid it getting truncated, especially when several SSL backends are
- built-in.
+ To avoid it getting truncated, especially when several SSL backends are
+ built-in.
- Reported-by: Gisle Vanem
- Fixes #5222
- Closes #5226
+ Reported-by: Gisle Vanem
+ Fixes #5222
+ Closes #5226
-Marc Hoersken (13 Apr 2020)
-- cirrus: no longer ignore test 504 which is working again
-
- The test is working again, because TCP blackholing is disabled.
+Marc Hoersken (13 Apr 2020)
+- cirrus: no longer ignore test 504 which is working again
+
+ The test is working again, because TCP blackholing is disabled.
-- appveyor: completely disable tests that fail to timeout early
+- appveyor: completely disable tests that fail to timeout early
- The tests changed from ignored to disabled are tests that are
- about connecting to non-listening socket. On AppVeyor these
- tests are not reliable, because for some unknown reason the
- connect is not timing out before the test time limit is reached.
-
-Daniel Stenberg (13 Apr 2020)
-- test1908: avoid using fixed port number in test data
+ The tests changed from ignored to disabled are tests that are
+ about connecting to non-listening socket. On AppVeyor these
+ tests are not reliable, because for some unknown reason the
+ connect is not timing out before the test time limit is reached.
+
+Daniel Stenberg (13 Apr 2020)
+- test1908: avoid using fixed port number in test data
- Closes #5225
+ Closes #5225
-Jay Satiro (12 Apr 2020)
-- [Andrew Kurushin brought this change]
+Jay Satiro (12 Apr 2020)
+- [Andrew Kurushin brought this change]
- schannel: Fix blocking timeout logic
+ schannel: Fix blocking timeout logic
- - Fix schannel_send for the case when no timeout was set.
+ - Fix schannel_send for the case when no timeout was set.
- Prior to this change schannel would error if the socket was not ready
- to send data and no timeout was set.
+ Prior to this change schannel would error if the socket was not ready
+ to send data and no timeout was set.
- This commit is similar to parent commit 89dc6e0 which recently made the
- same change for SOCKS, for the same reason. Basically it was not well
- understood that when Curl_timeleft returns 0 it is not a timeout of 0 ms
- but actually means no timeout.
-
- Fixes https://github.com/curl/curl/issues/5177
- Closes https://github.com/curl/curl/pull/5221
+ This commit is similar to parent commit 89dc6e0 which recently made the
+ same change for SOCKS, for the same reason. Basically it was not well
+ understood that when Curl_timeleft returns 0 it is not a timeout of 0 ms
+ but actually means no timeout.
+
+ Fixes https://github.com/curl/curl/issues/5177
+ Closes https://github.com/curl/curl/pull/5221
-- socks: Fix blocking timeout logic
+- socks: Fix blocking timeout logic
+
+ - Document in Curl_timeleft's comment block that returning 0 signals no
+ timeout (ie there's infinite time left).
- - Document in Curl_timeleft's comment block that returning 0 signals no
- timeout (ie there's infinite time left).
+ - Fix SOCKS' Curl_blockread_all for the case when no timeout was set.
- - Fix SOCKS' Curl_blockread_all for the case when no timeout was set.
+ Prior to this change if the timeout had a value of 0 and that was passed
+ to SOCKET_READABLE it would return right away instead of blocking. That
+ was likely because it was not well understood that when Curl_timeleft
+ returns 0 it is not a timeout of 0 ms but actually means no timeout.
- Prior to this change if the timeout had a value of 0 and that was passed
- to SOCKET_READABLE it would return right away instead of blocking. That
- was likely because it was not well understood that when Curl_timeleft
- returns 0 it is not a timeout of 0 ms but actually means no timeout.
+ Ref: https://github.com/curl/curl/pull/5214#issuecomment-612512360
- Ref: https://github.com/curl/curl/pull/5214#issuecomment-612512360
-
- Closes https://github.com/curl/curl/pull/5220
+ Closes https://github.com/curl/curl/pull/5220
-- [Marc Hoersken brought this change]
-
- gopher: check remaining time left during write busy loop
+- [Marc Hoersken brought this change]
+
+ gopher: check remaining time left during write busy loop
- Prior to this change gopher's blocking code would block forever,
- ignoring any set timeout value.
+ Prior to this change gopher's blocking code would block forever,
+ ignoring any set timeout value.
- Assisted-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
+ Assisted-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
- Similar to #5220 and #5221
- Closes #5214
+ Similar to #5220 and #5221
+ Closes #5214
-Daniel Stenberg (13 Apr 2020)
-- [Dirkjan Bussink brought this change]
+Daniel Stenberg (13 Apr 2020)
+- [Dirkjan Bussink brought this change]
- gnutls: ensure TLS 1.3 when SRP isn't requested
+ gnutls: ensure TLS 1.3 when SRP isn't requested
- When SRP is requested in the priority string, GnuTLS will disable
- support for TLS 1.3. Before this change, curl would always add +SRP to
- the priority list, effectively always disabling TLS 1.3 support.
+ When SRP is requested in the priority string, GnuTLS will disable
+ support for TLS 1.3. Before this change, curl would always add +SRP to
+ the priority list, effectively always disabling TLS 1.3 support.
- With this change, +SRP is only added to the priority list when SRP
- authentication is also requested. This also allows updating the error
- handling here to not have to retry without SRP. This is because SRP is
- only added when requested and in that case a retry is not needed.
+ With this change, +SRP is only added to the priority list when SRP
+ authentication is also requested. This also allows updating the error
+ handling here to not have to retry without SRP. This is because SRP is
+ only added when requested and in that case a retry is not needed.
- Closes #5223
+ Closes #5223
-Marc Hoersken (12 Apr 2020)
-- tests/server: add hidden window to gracefully handle WM_CLOSE
+Marc Hoersken (12 Apr 2020)
+- tests/server: add hidden window to gracefully handle WM_CLOSE
- Forward Window events as signals to existing signal event handler.
+ Forward Window events as signals to existing signal event handler.
-- tests/server: add CTRL event handler for Win32 consoles
+- tests/server: add CTRL event handler for Win32 consoles
- Forward CTRL events as signals to existing signal event handler.
+ Forward CTRL events as signals to existing signal event handler.
-- tests/server: move all signal handling routines to util.[ch]
+- tests/server: move all signal handling routines to util.[ch]
- Avoid code duplication to prepare for portability enhancements.
+ Avoid code duplication to prepare for portability enhancements.
-Daniel Stenberg (12 Apr 2020)
-- compressed.d: stress that the headers are not modified
+Daniel Stenberg (12 Apr 2020)
+- compressed.d: stress that the headers are not modified
- Suggested-by: Michael Osipov
- Assisted-by: Jay Satiro
- Bug: https://github.com/curl/curl/issues/5182#issuecomment-611638008
- Closes #5217
+ Suggested-by: Michael Osipov
+ Assisted-by: Jay Satiro
+ Bug: https://github.com/curl/curl/issues/5182#issuecomment-611638008
+ Closes #5217
-Marc Hoersken (11 Apr 2020)
-- tests/server/util.c: use curl_off_t instead of long for pid
+Marc Hoersken (11 Apr 2020)
+- tests/server/util.c: use curl_off_t instead of long for pid
- Avoid potential overflow of huge PIDs on Windows.
+ Avoid potential overflow of huge PIDs on Windows.
- Related to #5188
- Assisted-by: Marcel Raad
+ Related to #5188
+ Assisted-by: Marcel Raad
-- tests: use Cygwin/msys PIDs for stunnel and sshd on Windows
+- tests: use Cygwin/msys PIDs for stunnel and sshd on Windows
+
+ Since the Windows versions of both programs would write Windows
+ PIDs to their pidfiles which we cannot handle, we need to use
+ our known perl.exe Cygwin/msys PID together with exec() in order
+ to tie the spawned processes to the existance of our perl.exe
- Since the Windows versions of both programs would write Windows
- PIDs to their pidfiles which we cannot handle, we need to use
- our known perl.exe Cygwin/msys PID together with exec() in order
- to tie the spawned processes to the existance of our perl.exe
+ The perl.exe that is executing secureserver.pl and sshserver.pl
+ has a Cygwin/msys PID, because it is started inside Cygwin/msys.
- The perl.exe that is executing secureserver.pl and sshserver.pl
- has a Cygwin/msys PID, because it is started inside Cygwin/msys.
-
- Related to #5188
+ Related to #5188
-- tests: add Windows compatible pidwait like pidkill and pidterm
-
- Related to #5188
+- tests: add Windows compatible pidwait like pidkill and pidterm
+
+ Related to #5188
-- tests: fix conflict between Cygwin/msys and Windows PIDs
+- tests: fix conflict between Cygwin/msys and Windows PIDs
- Add 65536 to Windows PIDs to allow Windows specific treatment
- by having disjunct ranges for Cygwin/msys and Windows PIDs.
+ Add 65536 to Windows PIDs to allow Windows specific treatment
+ by having disjunct ranges for Cygwin/msys and Windows PIDs.
- See also:
- - https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
- h=b5e1003722cb14235c4f166be72c09acdffc62ea
- - https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
- h=448cf5aa4b429d5a9cebf92a0da4ab4b5b6d23fe
+ See also:
+ - https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
+ h=b5e1003722cb14235c4f166be72c09acdffc62ea
+ - https://cygwin.com/git/?p=newlib-cygwin.git;a=commit; ↵
+ h=448cf5aa4b429d5a9cebf92a0da4ab4b5b6d23fe
- Replaces #5178
- Closes #5188
+ Replaces #5178
+ Closes #5188
+
+Daniel Stenberg (11 Apr 2020)
+- RELEASE-NOTES: synced
-Daniel Stenberg (11 Apr 2020)
-- RELEASE-NOTES: synced
+- release-notes.pl: detect the start of the references in cleanup mode
-- release-notes.pl: detect the start of the references in cleanup mode
-
-- Revert "file: on Windows, refuse paths that start with \\"
+- Revert "file: on Windows, refuse paths that start with \\"
+
+ This reverts commit 1b71bc532bde8621fd3260843f8197182a467ff2.
- This reverts commit 1b71bc532bde8621fd3260843f8197182a467ff2.
+ Reminded-by: Chris Roberts
+ Bug: https://curl.haxx.se/mail/archive-2020-04/0013.html
- Reminded-by: Chris Roberts
- Bug: https://curl.haxx.se/mail/archive-2020-04/0013.html
-
- Closes #5215
+ Closes #5215
-Jay Satiro (11 Apr 2020)
-- lib: fix conversion warnings for SOCKET_WRITABLE/READABLE
+Jay Satiro (11 Apr 2020)
+- lib: fix conversion warnings for SOCKET_WRITABLE/READABLE
- - If loss of data may occur converting a timediff_t to time_t and
- the time value is > TIME_T_MAX then treat it as TIME_T_MAX.
+ - If loss of data may occur converting a timediff_t to time_t and
+ the time value is > TIME_T_MAX then treat it as TIME_T_MAX.
- This is a follow-up to 8843678 which removed the (time_t) typecast
- from the macros so that conversion warnings could be identified.
+ This is a follow-up to 8843678 which removed the (time_t) typecast
+ from the macros so that conversion warnings could be identified.
- Closes https://github.com/curl/curl/pull/5199
+ Closes https://github.com/curl/curl/pull/5199
-- test1148: tolerate progress updates better (again)
+- test1148: tolerate progress updates better (again)
+
+ - Ignore intermediate progress updates.
- - Ignore intermediate progress updates.
+ - Support locales that use a character other than period as decimal
+ separator (eg 100,0%).
- - Support locales that use a character other than period as decimal
- separator (eg 100,0%).
+ test1148 checks that the progress finishes at 100% and has the right
+ bar width. Prior to this change the test assumed that the only progress
+ reported for such a quick transfer was 100%, however in rare instances
+ (like in the CI where transfer time can slow considerably) there may be
+ intermediate updates. For example, below is stderrlog1148 from a failed
+ CI run with explicit \r and \n added (it is one line; broken up so that
+ it's easier to understand).
- test1148 checks that the progress finishes at 100% and has the right
- bar width. Prior to this change the test assumed that the only progress
- reported for such a quick transfer was 100%, however in rare instances
- (like in the CI where transfer time can slow considerably) there may be
- intermediate updates. For example, below is stderrlog1148 from a failed
- CI run with explicit \r and \n added (it is one line; broken up so that
- it's easier to understand).
+ \r
+ \r################################## 48.3%
+ \r######################################################################## 100.0%
+ \n
- \r
- \r################################## 48.3%
- \r######################################################################## 100.0%
- \n
-
- Closes https://github.com/curl/curl/pull/5194
+ Closes https://github.com/curl/curl/pull/5194
-Marc Hoersken (10 Apr 2020)
-- sshserver.pl: use cached Win32 environment check variable
+Marc Hoersken (10 Apr 2020)
+- sshserver.pl: use cached Win32 environment check variable
+
+- appveyor: partially revert 3413a110 to keep build without proxy
+
+ Ref: #5211 and #4526
+ Reported-by: Marcel Raad
-- appveyor: partially revert 3413a110 to keep build without proxy
+- appveyor: ignore failing 'connect to non-listening proxy' tests
- Ref: #5211 and #4526
- Reported-by: Marcel Raad
+ Closes #5211
-- appveyor: ignore failing 'connect to non-listening proxy' tests
-
- Closes #5211
+- CI/macos: convert CRLF to LF and align indentation
-- CI/macos: convert CRLF to LF and align indentation
-
-Daniel Stenberg (9 Apr 2020)
-- url: allow non-HTTPS altsvc-matching for debug builds
+Daniel Stenberg (9 Apr 2020)
+- url: allow non-HTTPS altsvc-matching for debug builds
- This is already partly supported but this part was missing.
- Reported-by: James Fuller
+ This is already partly supported but this part was missing.
+ Reported-by: James Fuller
- Closes #5205
-
-- server/resolve: remove AI_CANONNAME to make macos tell the truth
+ Closes #5205
+
+- server/resolve: remove AI_CANONNAME to make macos tell the truth
- With this bit set, my mac successfully resolves "ip6-localhost" when in
- fact there is no such host known to my machine! That in turn made test
- 241 wrongly execute and fail.
+ With this bit set, my mac successfully resolves "ip6-localhost" when in
+ fact there is no such host known to my machine! That in turn made test
+ 241 wrongly execute and fail.
- Closes #5202
-
-- runtests: fix warning about using an undefined variable
+ Closes #5202
+
+- runtests: fix warning about using an undefined variable
- Follow-up from 4d939ef6ceb2db1
+ Follow-up from 4d939ef6ceb2db1
-- release-notes: fix the initial reference list output
+- release-notes: fix the initial reference list output
-- github actions: run when pushed to master or */ci + PRs
+- github actions: run when pushed to master or */ci + PRs
- Avoid double-builds when using "local" branches for PRs. For both macos
- and fuzz jobs.
+ Avoid double-builds when using "local" branches for PRs. For both macos
+ and fuzz jobs.
- Closes #5201
+ Closes #5201
+
+- runtests: provide nicer errormsg when protocol "dump" file is empty
-- runtests: provide nicer errormsg when protocol "dump" file is empty
+- [Gilles Vollant brought this change]
-- [Gilles Vollant brought this change]
-
- schannel: support .P12 or .PFX client certificates
+ schannel: support .P12 or .PFX client certificates
- Used with curl command line option like this: --cert
- <filename>:<password> --cert-type p12
+ Used with curl command line option like this: --cert
+ <filename>:<password> --cert-type p12
- Closes #5193
+ Closes #5193
-- tests: verify split initial HTTP requests with CURL_SMALLREQSEND
+- tests: verify split initial HTTP requests with CURL_SMALLREQSEND
- test1294: "split request" being when the entire request isn't sent in
- the first go, and the remainder is sent in the PERFORM state. A GET
- request is otherwise not sending anything during PERFORM.
+ test1294: "split request" being when the entire request isn't sent in
+ the first go, and the remainder is sent in the PERFORM state. A GET
+ request is otherwise not sending anything during PERFORM.
- test1295: same kind of split but with POST
+ test1295: same kind of split but with POST
- Closes #5197
+ Closes #5197
-- http: don't consider upload done if the request isn't completely sent off
+- http: don't consider upload done if the request isn't completely sent off
- Fixes #4919
- Closes #5197
+ Fixes #4919
+ Closes #5197
-- http: allow Curl_add_buffer_send() to do a short first send by force
-
- In a debug build, settting the environment variable "CURL_SMALLREQSEND"
- will make the first HTTP request send not send more bytes than the set
- amount, thus ending up verifying that the logic for handling a split
- HTTP request send works correctly.
+- http: allow Curl_add_buffer_send() to do a short first send by force
+
+ In a debug build, settting the environment variable "CURL_SMALLREQSEND"
+ will make the first HTTP request send not send more bytes than the set
+ amount, thus ending up verifying that the logic for handling a split
+ HTTP request send works correctly.
-- connect: store connection info for QUIC connections
+- connect: store connection info for QUIC connections
+
+ Restores the --head functionality to the curl utility which extracts
+ 'protocol' that is stored that way.
- Restores the --head functionality to the curl utility which extracts
- 'protocol' that is stored that way.
-
- Reported-by: James Fuller
- Fixes #5196
- Closes #5198
+ Reported-by: James Fuller
+ Fixes #5196
+ Closes #5198
-- tests/README: update the port numbers list
+- tests/README: update the port numbers list
- Since the pipelining server is long gone.
- Reported-by: James Fuller
+ Since the pipelining server is long gone.
+ Reported-by: James Fuller
-- select: remove typecast from SOCKET_WRITABLE/READABLE macros
+- select: remove typecast from SOCKET_WRITABLE/READABLE macros
- So that they don't hide conversions-by-mistake
+ So that they don't hide conversions-by-mistake
- Reviewed-by: Jay Satiro
- Closes #5190
+ Reviewed-by: Jay Satiro
+ Closes #5190
-- CURLOPT_WRITEFUNCTION.3: add inline example and new see-also
-
- Closes #5192
+- CURLOPT_WRITEFUNCTION.3: add inline example and new see-also
+
+ Closes #5192
+
+- release-notes: output trailing references sorted numerically
+
+- cleanup: correct copyright year range on a few files
-- release-notes: output trailing references sorted numerically
-
-- cleanup: correct copyright year range on a few files
-
-- configure: remove use of -vec-report0 from CFLAGS with icc
+- configure: remove use of -vec-report0 from CFLAGS with icc
- ... as it apparently isn't (always) supported.
- Reported-by: Alain Miniussi
- Fixes #5096
- Closes #5191
-
-- warnless: remove code block for icc that didn't work
+ ... as it apparently isn't (always) supported.
+ Reported-by: Alain Miniussi
+ Fixes #5096
+ Closes #5191
+
+- warnless: remove code block for icc that didn't work
- Reported-by: Alain Miniussi
- Fixes #5096
+ Reported-by: Alain Miniussi
+ Fixes #5096
-Marc Hoersken (6 Apr 2020)
-- dist: add missing setup-win32.h
-
- Follow up to d820224b8b
+Marc Hoersken (6 Apr 2020)
+- dist: add missing setup-win32.h
+
+ Follow up to d820224b8b
-Daniel Stenberg (6 Apr 2020)
-- RELEASE-NOTES: synced
+Daniel Stenberg (6 Apr 2020)
+- RELEASE-NOTES: synced
-- scripts/release-notes.pl: add helper script for RELEASE-NOTES maintenance
+- scripts/release-notes.pl: add helper script for RELEASE-NOTES maintenance
- This script helps putting entries in the RELEASE-NOTES using a coherent
- style and sorting with a minimal human editing effort - as long as the
- first line in the commit message is good enough! There's a short howto
- at the top of the file.
+ This script helps putting entries in the RELEASE-NOTES using a coherent
+ style and sorting with a minimal human editing effort - as long as the
+ first line in the commit message is good enough! There's a short howto
+ at the top of the file.
-- [Dennis Felsing brought this change]
+- [Dennis Felsing brought this change]
- configure: don't check for Security.framework when cross-compiling
+ configure: don't check for Security.framework when cross-compiling
- Since it checks for the local file, not the cross-compiled one.
+ Since it checks for the local file, not the cross-compiled one.
- Closes #5189
+ Closes #5189
-- TODO: Option to make -Z merge lined based outputs on stdout
+- TODO: Option to make -Z merge lined based outputs on stdout
- Closes #5175
+ Closes #5175
-- lib: never define CURL_CA_BUNDLE with a getenv
+- lib: never define CURL_CA_BUNDLE with a getenv
- - it breaks the build (since 6de756c9b1de34b7a1)
- - it's not documented and not consistent across platforms
- - the curl tool does that getenv magic
+ - it breaks the build (since 6de756c9b1de34b7a1)
+ - it's not documented and not consistent across platforms
+ - the curl tool does that getenv magic
- Bug: https://github.com/curl/curl/commit/6de756c#r38127030
- Reported-by: Gisle Vanem
+ Bug: https://github.com/curl/curl/commit/6de756c#r38127030
+ Reported-by: Gisle Vanem
- Closes #5187
+ Closes #5187
-Marc Hoersken (5 Apr 2020)
-- lib670: use the same Win32 API check as all other lib tests
+Marc Hoersken (5 Apr 2020)
+- lib670: use the same Win32 API check as all other lib tests
-- appveyor: use random test server ports based upon APPVEYOR_API_URL
+- appveyor: use random test server ports based upon APPVEYOR_API_URL
- Avoid conflicts of test server ports with AppVeyor API on localhost.
+ Avoid conflicts of test server ports with AppVeyor API on localhost.
- Closes #5034
+ Closes #5034
-- appveyor: sort builds by type and add two new variants
+- appveyor: sort builds by type and add two new variants
- Related to #5034 and #5063
-
-- appveyor: show failed tests in log even if test is ignored
+ Related to #5034 and #5063
+
+- appveyor: show failed tests in log even if test is ignored
- And print API response with newline only if there is one
+ And print API response with newline only if there is one
-- appveyor: turn disabled tests into ignored result tests
-
-Daniel Stenberg (5 Apr 2020)
-- KNOWN_BUGS: fixed "USE_UNIX_SOCKETS on Windows"
+- appveyor: turn disabled tests into ignored result tests
+
+Daniel Stenberg (5 Apr 2020)
+- KNOWN_BUGS: fixed "USE_UNIX_SOCKETS on Windows"
- Fixed with #5170 (commit 23a870f2fd041278)
+ Fixed with #5170 (commit 23a870f2fd041278)
-- test1566: verify --etag-compare that gets a 304 back
+- test1566: verify --etag-compare that gets a 304 back
- Verifies the fix in #5183
+ Verifies the fix in #5183
- Closes #5186
+ Closes #5186
-- [Kwon-Young Choi brought this change]
+- [Kwon-Young Choi brought this change]
- CURLINFO_CONDITION_UNMET: return true for 304 http status code
+ CURLINFO_CONDITION_UNMET: return true for 304 http status code
- In libcurl, CURLINFO_CONDITION_UNMET is used to avoid writing to the
- output file if the server did not transfered a file based on time
- condition. In the same manner, getting a 304 HTTP response back from the
- server, for example after passing a custom If-Match-* header, also
- fulfill this condition.
+ In libcurl, CURLINFO_CONDITION_UNMET is used to avoid writing to the
+ output file if the server did not transfered a file based on time
+ condition. In the same manner, getting a 304 HTTP response back from the
+ server, for example after passing a custom If-Match-* header, also
+ fulfill this condition.
- Fixes #5181
- Closes #5183
+ Fixes #5181
+ Closes #5183
-- [Kwon-Young Choi brought this change]
+- [Kwon-Young Choi brought this change]
- curl: allow both --etag-compare and --etag-save with same file name
+ curl: allow both --etag-compare and --etag-save with same file name
+
+ This change inverse the order of processing for the --etag-compare and
+ --etag-save option to process first --etag-compare. This in turn allows
+ to use the same file name to compare and save an etag.
- This change inverse the order of processing for the --etag-compare and
- --etag-save option to process first --etag-compare. This in turn allows
- to use the same file name to compare and save an etag.
+ The original behavior of not failing if the etag file does not exists is
+ conserved.
- The original behavior of not failing if the etag file does not exists is
- conserved.
-
- Fixes #5179
- Closes #5180
+ Fixes #5179
+ Closes #5180
-Viktor Szakats (4 Apr 2020)
-- windows: enable UnixSockets with all build toolchains
+Viktor Szakats (4 Apr 2020)
+- windows: enable UnixSockets with all build toolchains
- Extend existing unix socket support in Windows builds to be
- enabled for all toolchain vendors or versions. (Previously
- it was only supported with certain MSVC versions + more recent
- Windows 10 SDKs)
+ Extend existing unix socket support in Windows builds to be
+ enabled for all toolchain vendors or versions. (Previously
+ it was only supported with certain MSVC versions + more recent
+ Windows 10 SDKs)
- Ref: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
- Ref: https://github.com/curl/curl/issues/5162
- Closes: https://github.com/curl/curl/pull/5170
+ Ref: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
+ Ref: https://github.com/curl/curl/issues/5162
+ Closes: https://github.com/curl/curl/pull/5170
-Daniel Stenberg (4 Apr 2020)
-- KNOWN_BUGS: Store TLS context per transfer instead of per connection
-
- Closes #5102
+Daniel Stenberg (4 Apr 2020)
+- KNOWN_BUGS: Store TLS context per transfer instead of per connection
+
+ Closes #5102
-Marc Hoersken (3 Apr 2020)
-- sockfilt: remove redundancy in timeout handling
+Marc Hoersken (3 Apr 2020)
+- sockfilt: remove redundancy in timeout handling
- And update other logmsg output in select_ws on Windows.
-
-- sockfilt: fix handling of ready closed sockets on Windows
+ And update other logmsg output in select_ws on Windows.
+
+- sockfilt: fix handling of ready closed sockets on Windows
- Replace the incomplete workaround regarding FD_CLOSE
- only signalling once by instead doing a pre-check with
- standard select and storing the result for later use.
+ Replace the incomplete workaround regarding FD_CLOSE
+ only signalling once by instead doing a pre-check with
+ standard select and storing the result for later use.
- select keeps triggering on closed sockets on Windows while
- WSAEventSelect fires only once with data still available.
- By doing the pre-check we do not run in a deadlock
- due to waiting forever for another FD_CLOSE event.
-
-- sockfilt: fix race-condition of waiting threads and event handling
+ select keeps triggering on closed sockets on Windows while
+ WSAEventSelect fires only once with data still available.
+ By doing the pre-check we do not run in a deadlock
+ due to waiting forever for another FD_CLOSE event.
+
+- sockfilt: fix race-condition of waiting threads and event handling
- Fix race-condition of waiting threads finishing while events are
- already being processed which lead to invalid or skipped events.
+ Fix race-condition of waiting threads finishing while events are
+ already being processed which lead to invalid or skipped events.
- Use mutex to check for one event at a time or do post-processing.
- In addition to mutex-based locking use specific event as signal.
-
- Closes #5156
+ Use mutex to check for one event at a time or do post-processing.
+ In addition to mutex-based locking use specific event as signal.
+
+ Closes #5156
+
+Daniel Stenberg (2 Apr 2020)
+- [Leo Neat brought this change]
-Daniel Stenberg (2 Apr 2020)
-- [Leo Neat brought this change]
-
- CI-fuzz: increase fuzz time to 40 minutes
+ CI-fuzz: increase fuzz time to 40 minutes
- Closes #5174
+ Closes #5174
-Marc Hoersken (2 Apr 2020)
-- CI: increase Azure Pipelines timeouts due to performance issues
+Marc Hoersken (2 Apr 2020)
+- CI: increase Azure Pipelines timeouts due to performance issues
- The current demand on Azure negatively impacts the CI performance.
+ The current demand on Azure negatively impacts the CI performance.
-- runtests.pl: log host OS as detected by Perl environment
-
-- ftpserver.pl: log before and after data connection is closed
-
-Daniel Stenberg (1 Apr 2020)
+- runtests.pl: log host OS as detected by Perl environment
+
+- ftpserver.pl: log before and after data connection is closed
+
+Daniel Stenberg (1 Apr 2020)
- RELEASE-NOTES: synced
-- RELEASE-PROCEDURE.md: run the copyright.pl script!
-
-- vquic/ngtcp2.h: update copyright year range
+- RELEASE-PROCEDURE.md: run the copyright.pl script!
+
+- vquic/ngtcp2.h: update copyright year range
- Follow-up to 0736ee73d346a52
+ Follow-up to 0736ee73d346a52
+
+- [Daiki Ueno brought this change]
-- [Daiki Ueno brought this change]
+ CI: add build with ngtcp2 + gnutls on Travis CI
- CI: add build with ngtcp2 + gnutls on Travis CI
-
-- [Daiki Ueno brought this change]
-
- vquic: add support for GnuTLS backend of ngtcp2
+- [Daiki Ueno brought this change]
+
+ vquic: add support for GnuTLS backend of ngtcp2
- Currently, the TLS backend used by vquic/ngtcp2.c is selected at compile
- time. Therefore OpenSSL support needs to be explicitly disabled.
+ Currently, the TLS backend used by vquic/ngtcp2.c is selected at compile
+ time. Therefore OpenSSL support needs to be explicitly disabled.
- Signed-off-by: Daiki Ueno <dueno@redhat.com>
- Closes #5148
+ Signed-off-by: Daiki Ueno <dueno@redhat.com>
+ Closes #5148
-- [Gisle Vanem brought this change]
+- [Gisle Vanem brought this change]
- examples/sessioninfo.c: add include to fix compiler warning
+ examples/sessioninfo.c: add include to fix compiler warning
- Fixes #5171
-
-- misc: copyright year updates
+ Fixes #5171
+
+- misc: copyright year updates
- Follow-up to 7a71965e9
+ Follow-up to 7a71965e9
-- [Harry Sintonen brought this change]
+- [Harry Sintonen brought this change]
- build: fixed build for systems with select() in unistd.h
+ build: fixed build for systems with select() in unistd.h
- Closes #5169
-
-- memdebug: don't log free(NULL)
+ Closes #5169
+
+- memdebug: don't log free(NULL)
- ... it serves no purpose and fills up the log.
+ ... it serves no purpose and fills up the log.
-- cleanup: insert newline after if() conditions
-
- Our code style mandates we put the conditional block on a separate
- line. These mistakes are now detected by the updated checksrc.
+- cleanup: insert newline after if() conditions
+
+ Our code style mandates we put the conditional block on a separate
+ line. These mistakes are now detected by the updated checksrc.
-- checksrc: warn on obvious conditional blocks on the same line as if()
+- checksrc: warn on obvious conditional blocks on the same line as if()
- Closes #5164
+ Closes #5164
-- [Roger Orr brought this change]
+- [Roger Orr brought this change]
- cmake: add CMAKE_MSVC_RUNTIME_LIBRARY
+ cmake: add CMAKE_MSVC_RUNTIME_LIBRARY
- Fixes #5165
- Closes #5167
+ Fixes #5165
+ Closes #5167
-- [Daiki Ueno brought this change]
+- [Daiki Ueno brought this change]
- ngtcp2: update to git master for the key installation API change
+ ngtcp2: update to git master for the key installation API change
- This updates the ngtcp2 OpenSSL backend to follow the API change in
- commit 32e703164 of ngtcp2.
+ This updates the ngtcp2 OpenSSL backend to follow the API change in
+ commit 32e703164 of ngtcp2.
- Notable changes are:
- - ngtcp2_crypto_derive_and_install_{rx,tx}_key have been added to replace
- ngtcp2_crypto_derive_and_install_key
- - the 'side' argument of ngtcp2_crypto_derive_and_install_initial_key
- has been removed
+ Notable changes are:
+ - ngtcp2_crypto_derive_and_install_{rx,tx}_key have been added to replace
+ ngtcp2_crypto_derive_and_install_key
+ - the 'side' argument of ngtcp2_crypto_derive_and_install_initial_key
+ has been removed
- Fixes #5166
- Closes #5168
-
-- [Cyrus brought this change]
-
- SECURITY.md: minor rephrase
+ Fixes #5166
+ Closes #5168
+
+- [Cyrus brought this change]
+
+ SECURITY.md: minor rephrase
- Closes #5158
+ Closes #5158
-- output.d: quote the URL when globbing
+- output.d: quote the URL when globbing
- Some shells do globbing of their own unless the URL is quoted, so maybe
- encourage this.
+ Some shells do globbing of their own unless the URL is quoted, so maybe
+ encourage this.
- Co-authored-by: Jay Satiro
- Closes #5160
+ Co-authored-by: Jay Satiro
+ Closes #5160
-- dist: add tests/version-scan.pl to tarball
+- dist: add tests/version-scan.pl to tarball
- ... used in test 1177.
+ ... used in test 1177.
- Follow-up to a97d826f6de3
+ Follow-up to a97d826f6de3
-- test1177: verify that all the CURL_VERSION_ bits are documented
+- test1177: verify that all the CURL_VERSION_ bits are documented
-- curl.h: remnove CURL_VERSION_ESNI. Never supported nor documented
+- curl.h: remnove CURL_VERSION_ESNI. Never supported nor documented
- Considered experimental and therefore we can do this.
+ Considered experimental and therefore we can do this.
- Closes #5157
-
-- KNOWN_BUGS: DoH doesn't inherit all transfer options
+ Closes #5157
+
+- KNOWN_BUGS: DoH doesn't inherit all transfer options
- Closes #4578
- Closes #4579
+ Closes #4578
+ Closes #4579
-- KNOWN_BUGS: DoH leaks memory after followlocation
+- KNOWN_BUGS: DoH leaks memory after followlocation
- Closes #4592
+ Closes #4592
-- KNOWN_BUGS: "FTPS needs session reuse"
+- KNOWN_BUGS: "FTPS needs session reuse"
- Closes #4654
+ Closes #4654
-- KNOWN_BUGS: "stick to same family over SOCKS pro" is presumed fixed
+- KNOWN_BUGS: "stick to same family over SOCKS pro" is presumed fixed
-- TODO: Set custom client ip when using haproxy protocol
+- TODO: Set custom client ip when using haproxy protocol
- Closes #5125
+ Closes #5125
-Michael Kaufmann (27 Mar 2020)
-- writeout_json: Fix data type issues
+Michael Kaufmann (27 Mar 2020)
+- writeout_json: Fix data type issues
- Load long values correctly (e.g. for http_code).
+ Load long values correctly (e.g. for http_code).
- Use curl_off_t (not long) for:
- - size_download (CURLINFO_SIZE_DOWNLOAD_T)
- - size_upload (CURLINFO_SIZE_UPLOAD_T)
+ Use curl_off_t (not long) for:
+ - size_download (CURLINFO_SIZE_DOWNLOAD_T)
+ - size_upload (CURLINFO_SIZE_UPLOAD_T)
- The unit for these values is bytes/second, not microseconds:
- - speed_download (CURLINFO_SPEED_DOWNLOAD_T)
- - speed_upload (CURLINFO_SPEED_UPLOAD_T)
+ The unit for these values is bytes/second, not microseconds:
+ - speed_download (CURLINFO_SPEED_DOWNLOAD_T)
+ - speed_upload (CURLINFO_SPEED_UPLOAD_T)
- Fixes #5131
- Closes #5152
+ Fixes #5131
+ Closes #5152
-Daniel Stenberg (27 Mar 2020)
-- mailmap: fixup a few author names/fields
+Daniel Stenberg (27 Mar 2020)
+- mailmap: fixup a few author names/fields
- Douglas Steinwand, Gökhan Şengün, Jessa Chandler, Julian Z and
- Svyatoslav Mishyn
+ Douglas Steinwand, Gökhan Şengün, Jessa Chandler, Julian Z and
+ Svyatoslav Mishyn
-- version: add 'cainfo' and 'capath' to version info struct
+- version: add 'cainfo' and 'capath' to version info struct
- Suggested-by: Timothe Litt
- URL: https://curl.haxx.se/mail/lib-2020-03/0090.html
- Reviewed-by: Jay Satiro
+ Suggested-by: Timothe Litt
+ URL: https://curl.haxx.se/mail/lib-2020-03/0090.html
+ Reviewed-by: Jay Satiro
- Closes #5150
+ Closes #5150
-- RELEASE-NOTES: synced
+- RELEASE-NOTES: synced
-Jay Satiro (26 Mar 2020)
-- SSLCERTS.md: Fix example code for setting CA cert file
+Jay Satiro (26 Mar 2020)
+- SSLCERTS.md: Fix example code for setting CA cert file
- Prior to this change the documentation erroneously said use
- CURLOPT_CAPATH to set a CA cert file.
+ Prior to this change the documentation erroneously said use
+ CURLOPT_CAPATH to set a CA cert file.
- Bug: https://curl.haxx.se/mail/lib-2020-03/0121.html
- Reported-by: Timothe Litt
+ Bug: https://curl.haxx.se/mail/lib-2020-03/0121.html
+ Reported-by: Timothe Litt
- Closes https://github.com/curl/curl/pull/5151
+ Closes https://github.com/curl/curl/pull/5151
-Marc Hoersken (26 Mar 2020)
-- sockfilt: add logmsg output to select_ws_wait_thread on Windows
+Marc Hoersken (26 Mar 2020)
+- sockfilt: add logmsg output to select_ws_wait_thread on Windows
- Assisted-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
+ Assisted-by: Jay Satiro
+ Reviewed-by: Daniel Stenberg
- Closes #5086
+ Closes #5086
-Daniel Stenberg (26 Mar 2020)
-- docs/make: generate curl.1 from listed files only
+Daniel Stenberg (26 Mar 2020)
+- docs/make: generate curl.1 from listed files only
+
+ Previously it rendered the page from files matching "*.d" in the correct
+ directory, which worked fine in git builds when the files were added but
+ made it easy to forget adding the files to the dist.
- Previously it rendered the page from files matching "*.d" in the correct
- directory, which worked fine in git builds when the files were added but
- made it easy to forget adding the files to the dist.
+ Now, only man page sections listed in DPAGES in Makefile.inc will be
+ used, thus "forcing" us to update this to get the man page right and get
+ it included in the dist at the same time.
- Now, only man page sections listed in DPAGES in Makefile.inc will be
- used, thus "forcing" us to update this to get the man page right and get
- it included in the dist at the same time.
-
- Ref: #5146
- Closes #5149
+ Ref: #5146
+ Closes #5149
-- openssl: adapt to functions marked as deprecated since version 3
+- openssl: adapt to functions marked as deprecated since version 3
- OpenSSL 3 deprecates SSL_CTX_load_verify_locations and the MD4, DES
- functions we use.
+ OpenSSL 3 deprecates SSL_CTX_load_verify_locations and the MD4, DES
+ functions we use.
- Fix the MD4 and SSL_CTX_load_verify_locations warnings.
+ Fix the MD4 and SSL_CTX_load_verify_locations warnings.
- In configure, detect OpenSSL v3 and if so, inhibit the deprecation
- warnings. OpenSSL v3 deprecates the DES functions we use for NTLM and
- until we rewrite the code to use non-deprecated functions we better
- ignore these warnings as they don't help us.
+ In configure, detect OpenSSL v3 and if so, inhibit the deprecation
+ warnings. OpenSSL v3 deprecates the DES functions we use for NTLM and
+ until we rewrite the code to use non-deprecated functions we better
+ ignore these warnings as they don't help us.
- Closes #5139
+ Closes #5139
-- dist: add mail-rcpt-allowfails.d to the tarball
+- dist: add mail-rcpt-allowfails.d to the tarball
- Reported-by: Maksim Stsepanenka
- Reviewed-by: Jat Satiro
+ Reported-by: Maksim Stsepanenka
+ Reviewed-by: Jat Satiro
- Closes #5146
+ Closes #5146
diff --git a/contrib/libs/curl/COPYING b/contrib/libs/curl/COPYING
index ed69df226b..9d9e4af8d8 100644
--- a/contrib/libs/curl/COPYING
+++ b/contrib/libs/curl/COPYING
@@ -1,6 +1,6 @@
COPYRIGHT AND PERMISSION NOTICE
-Copyright (c) 1996 - 2020, Daniel Stenberg, <daniel@haxx.se>, and many
+Copyright (c) 1996 - 2020, Daniel Stenberg, <daniel@haxx.se>, and many
contributors, see the THANKS file.
All rights reserved.
diff --git a/contrib/libs/curl/README b/contrib/libs/curl/README
index a84f4571e6..b690816e1f 100644
--- a/contrib/libs/curl/README
+++ b/contrib/libs/curl/README
@@ -17,22 +17,22 @@ README
You find answers to the most frequent questions we get in the FAQ document.
- Study the COPYING file for distribution terms.
+ Study the COPYING file for distribution terms.
+
+ Those documents and more can be found in the docs/ directory.
- Those documents and more can be found in the docs/ directory.
-
CONTACT
If you have problems, questions, ideas or suggestions, please contact us
- by posting to a suitable mailing list. See https://curl.se/mail/
+ by posting to a suitable mailing list. See https://curl.se/mail/
All contributors to the project are listed in the THANKS document.
-WEBSITE
+WEBSITE
- Visit the curl website for the latest news and downloads:
+ Visit the curl website for the latest news and downloads:
- https://curl.se/
+ https://curl.se/
GIT
diff --git a/contrib/libs/curl/RELEASE-NOTES b/contrib/libs/curl/RELEASE-NOTES
index 990e538865..a967629614 100644
--- a/contrib/libs/curl/RELEASE-NOTES
+++ b/contrib/libs/curl/RELEASE-NOTES
@@ -1,248 +1,248 @@
-curl and libcurl 7.74.0
+curl and libcurl 7.74.0
- Public curl releases: 196
- Command line options: 235
- curl_easy_setopt() options: 284
- Public functions in libcurl: 85
- Contributors: 2287
+ Public curl releases: 196
+ Command line options: 235
+ curl_easy_setopt() options: 284
+ Public functions in libcurl: 85
+ Contributors: 2287
This release includes the following changes:
- o hsts: add experimental support for Strict-Transport-Security [37]
+ o hsts: add experimental support for Strict-Transport-Security [37]
This release includes the following bugfixes:
- o CVE-2020-8286: Inferior OCSP verification [93]
- o CVE-2020-8285: FTP wildcard stack overflow [95]
- o CVE-2020-8284: trusting FTP PASV responses [97]
- o acinclude: detect manually set minimum macos/ipod version [46]
- o alt-svc: enable (in the build) by default [20]
- o alt-svc: minimize variable scope and avoid "DEAD_STORE" [51]
- o asyn: use 'struct thread_data *' instead of 'void *' [84]
- o checksrc: warn on empty line before open brace [13]
- o CI/appveyor: disable test 571 in two cmake builds [22]
- o CI/azure: improve on flakiness by avoiding libtool wrappers [7]
- o CI/tests: enable test target on TravisCI for CMake builds [38]
- o CI/travis: add brotli and zstd to the libssh2 build [27]
- o cirrus: build with FreeBSD 12.2 in CirrusCI [80]
- o cmake: call the feature unixsockets without dash [26]
- o cmake: check for linux/tcp.h [91]
- o cmake: correctly handle linker flags for static libs [52]
- o cmake: don't pass -fvisibility=hidden to clang-cl on Windows [53]
- o cmake: don't use reserved target name 'test' [79]
- o cmake: make BUILD_TESTING dependent option [30]
- o cmake: make CURL_ZLIB a tri-state variable [70]
- o cmake: set the unicode feature in curl-config on Windows [23]
- o cmake: store IDN2 information in curl_config.h [25]
- o cmake: use libcurl.rc in all Windows builds [69]
- o configure: pass -pthread to Libs.private for pkg-config [50]
- o configure: use pkgconfig to find openSSL when cross-compiling [28]
- o connect: repair build without ipv6 availability [19]
- o curl.1: add an "OUTPUT" section at the top of the manpage [32]
- o curl.se: new home [59]
- o curl: add compatibility for Amiga and GCC 6.5 [61]
- o curl: only warn not fail, if not finding the home dir [15]
- o curl_easy_escape: limit output string length to 3 * max input [55]
- o Curl_pgrsStartNow: init speed limit time stamps at start [48]
- o curl_setup: USE_RESOLVE_ON_IPS is for Apple native resolver use
- o curl_url_set.3: fix typo in the RETURN VALUE section [3]
- o CURLOPT_DNS_USE_GLOBAL_CACHE.3: fix typo [34]
- o CURLOPT_HSTS.3: document the file format [82]
- o CURLOPT_NOBODY.3: fix typo [6]
- o CURLOPT_TCP_NODELAY.3: fix comment in example code [8]
- o CURLOPT_URL.3: clarify SCP/SFTP URLs are for uploads as well
- o docs: document the 8MB input string limit [57]
- o docs: fix typos and markup in ETag manpage sections [87]
- o docs: Fix various typos in documentation [58]
- o examples/httpput: remove use of CURLOPT_PUT [39]
- o FAQ: refreshed [56]
- o file: avoid duplicated code sequence [77]
- o ftp: retry getpeername for FTP with TCP_FASTOPEN [100]
- o gnutls: fix memory leaks (certfields memory wasn't released) [41]
- o header.d: mention the "Transfer-Encoding: chunked" handling [45]
- o HISTORY: the new domain
- o http3: fix two build errors, silence warnings [10]
- o http3: use the master branch of GnuTLS for testing [88]
- o http: pass correct header size to debug callback for chunked post [44]
- o http_proxy: use enum with state names for 'keepon' [54]
- o httpput-postfields.c: new example doing PUT with POSTFIELDS [35]
- o infof/failf calls: fix format specifiers [78]
- o libssh2: fix build with disabled proxy support [17]
- o libssh2: fix transport over HTTPS proxy [31]
- o libssh2: require version 1.0 or later [24]
- o Makefile.m32: add support for HTTP/3 via ngtcp2+nghttp3 [11]
- o Makefile.m32: add support for UNICODE builds [85]
- o mqttd: fclose test file when done [60]
- o NEW-PROTOCOL: document what needs to be done to add one [92]
- o ngtcp2: adapt to recent nghttp3 updates [49]
- o ngtcp2: advertise h3 ALPN unconditionally [72]
- o ngtcp2: Fix build error due to symbol name change [90]
- o ngtcp2: use the minimal version of QUIC supported by ngtcp2 [67]
- o ntlm: avoid malloc(0) on zero length user and domain [96]
- o openssl: acknowledge SRP disabling in configure properly [9]
- o openssl: free mem_buf in error path [94]
- o openssl: guard against OOM on context creation [68]
- o openssl: use OPENSSL_init_ssl() with >= 1.1.0 [66]
- o os400: Sync libcurl API options [5]
- o packages/OS400: make the source code-style compliant [4]
- o quiche: close the connection [89]
- o quiche: remove 'static' from local buffer [71]
- o range.d: clarify that curl will not parse multipart responses [36]
- o range.d: fix typo
- o Revert "multi: implement wait using winsock events" [99]
- o rtsp: error out on empty Session ID, unified the code
- o rtsp: fixed Session ID comparison to refuse prefix [65]
- o rtsp: fixed the RTST Session ID mismatch in test 570 [64]
- o runtests: return error if no tests ran [16]
- o runtests: revert the mistaken edit of $CURL
- o runtests: show keywords when no tests ran [33]
- o scripts/completion.pl: parse all opts [101]
- o socks: check for DNS entries with the right port number [74]
- o src/tool_filetime: disable -Wformat on mingw for this file [2]
- o strerror: use 'const' as the string should never be modified [18]
- o test122[12]: remove these two tests [1]
- o test506: make it not run in c-ares builds [75]
- o tests/*server.py: close log file after each log line [81]
- o tests/server/tftpd.c: close upload file right after transfer [62]
- o tests/util.py: fix compatibility with Python 2 [83]
- o tests: add missing global_init/cleanup calls [42]
- o tests: fix some http/2 tests for older versions of nghttpx [47]
- o tool_debug_cb: do not assume zero-terminated data
- o tool_help: make "output" description less confusing [21]
- o tool_operate: --retry for HTTP 408 responses too [43]
- o tool_operate: bail out proper on errors during parallel transfers [29]
- o tool_operate: fix compiler warning when --libcurl is disabled [12]
- o tool_writeout: use off_t getinfo-types instead of doubles [76]
- o travis: use ninja-build for CMake builds [63]
- o travis: use valgrind when running tests for debug builds [40]
- o urlapi: don't accept blank port number field without scheme [98]
- o urlapi: URL encode a '+' in the query part [14]
- o urldata: remove 'void *protop' and create the union 'p' [86]
- o vquic/ngtcp2.h: define local_addr as sockaddr_storage [73]
+ o CVE-2020-8286: Inferior OCSP verification [93]
+ o CVE-2020-8285: FTP wildcard stack overflow [95]
+ o CVE-2020-8284: trusting FTP PASV responses [97]
+ o acinclude: detect manually set minimum macos/ipod version [46]
+ o alt-svc: enable (in the build) by default [20]
+ o alt-svc: minimize variable scope and avoid "DEAD_STORE" [51]
+ o asyn: use 'struct thread_data *' instead of 'void *' [84]
+ o checksrc: warn on empty line before open brace [13]
+ o CI/appveyor: disable test 571 in two cmake builds [22]
+ o CI/azure: improve on flakiness by avoiding libtool wrappers [7]
+ o CI/tests: enable test target on TravisCI for CMake builds [38]
+ o CI/travis: add brotli and zstd to the libssh2 build [27]
+ o cirrus: build with FreeBSD 12.2 in CirrusCI [80]
+ o cmake: call the feature unixsockets without dash [26]
+ o cmake: check for linux/tcp.h [91]
+ o cmake: correctly handle linker flags for static libs [52]
+ o cmake: don't pass -fvisibility=hidden to clang-cl on Windows [53]
+ o cmake: don't use reserved target name 'test' [79]
+ o cmake: make BUILD_TESTING dependent option [30]
+ o cmake: make CURL_ZLIB a tri-state variable [70]
+ o cmake: set the unicode feature in curl-config on Windows [23]
+ o cmake: store IDN2 information in curl_config.h [25]
+ o cmake: use libcurl.rc in all Windows builds [69]
+ o configure: pass -pthread to Libs.private for pkg-config [50]
+ o configure: use pkgconfig to find openSSL when cross-compiling [28]
+ o connect: repair build without ipv6 availability [19]
+ o curl.1: add an "OUTPUT" section at the top of the manpage [32]
+ o curl.se: new home [59]
+ o curl: add compatibility for Amiga and GCC 6.5 [61]
+ o curl: only warn not fail, if not finding the home dir [15]
+ o curl_easy_escape: limit output string length to 3 * max input [55]
+ o Curl_pgrsStartNow: init speed limit time stamps at start [48]
+ o curl_setup: USE_RESOLVE_ON_IPS is for Apple native resolver use
+ o curl_url_set.3: fix typo in the RETURN VALUE section [3]
+ o CURLOPT_DNS_USE_GLOBAL_CACHE.3: fix typo [34]
+ o CURLOPT_HSTS.3: document the file format [82]
+ o CURLOPT_NOBODY.3: fix typo [6]
+ o CURLOPT_TCP_NODELAY.3: fix comment in example code [8]
+ o CURLOPT_URL.3: clarify SCP/SFTP URLs are for uploads as well
+ o docs: document the 8MB input string limit [57]
+ o docs: fix typos and markup in ETag manpage sections [87]
+ o docs: Fix various typos in documentation [58]
+ o examples/httpput: remove use of CURLOPT_PUT [39]
+ o FAQ: refreshed [56]
+ o file: avoid duplicated code sequence [77]
+ o ftp: retry getpeername for FTP with TCP_FASTOPEN [100]
+ o gnutls: fix memory leaks (certfields memory wasn't released) [41]
+ o header.d: mention the "Transfer-Encoding: chunked" handling [45]
+ o HISTORY: the new domain
+ o http3: fix two build errors, silence warnings [10]
+ o http3: use the master branch of GnuTLS for testing [88]
+ o http: pass correct header size to debug callback for chunked post [44]
+ o http_proxy: use enum with state names for 'keepon' [54]
+ o httpput-postfields.c: new example doing PUT with POSTFIELDS [35]
+ o infof/failf calls: fix format specifiers [78]
+ o libssh2: fix build with disabled proxy support [17]
+ o libssh2: fix transport over HTTPS proxy [31]
+ o libssh2: require version 1.0 or later [24]
+ o Makefile.m32: add support for HTTP/3 via ngtcp2+nghttp3 [11]
+ o Makefile.m32: add support for UNICODE builds [85]
+ o mqttd: fclose test file when done [60]
+ o NEW-PROTOCOL: document what needs to be done to add one [92]
+ o ngtcp2: adapt to recent nghttp3 updates [49]
+ o ngtcp2: advertise h3 ALPN unconditionally [72]
+ o ngtcp2: Fix build error due to symbol name change [90]
+ o ngtcp2: use the minimal version of QUIC supported by ngtcp2 [67]
+ o ntlm: avoid malloc(0) on zero length user and domain [96]
+ o openssl: acknowledge SRP disabling in configure properly [9]
+ o openssl: free mem_buf in error path [94]
+ o openssl: guard against OOM on context creation [68]
+ o openssl: use OPENSSL_init_ssl() with >= 1.1.0 [66]
+ o os400: Sync libcurl API options [5]
+ o packages/OS400: make the source code-style compliant [4]
+ o quiche: close the connection [89]
+ o quiche: remove 'static' from local buffer [71]
+ o range.d: clarify that curl will not parse multipart responses [36]
+ o range.d: fix typo
+ o Revert "multi: implement wait using winsock events" [99]
+ o rtsp: error out on empty Session ID, unified the code
+ o rtsp: fixed Session ID comparison to refuse prefix [65]
+ o rtsp: fixed the RTST Session ID mismatch in test 570 [64]
+ o runtests: return error if no tests ran [16]
+ o runtests: revert the mistaken edit of $CURL
+ o runtests: show keywords when no tests ran [33]
+ o scripts/completion.pl: parse all opts [101]
+ o socks: check for DNS entries with the right port number [74]
+ o src/tool_filetime: disable -Wformat on mingw for this file [2]
+ o strerror: use 'const' as the string should never be modified [18]
+ o test122[12]: remove these two tests [1]
+ o test506: make it not run in c-ares builds [75]
+ o tests/*server.py: close log file after each log line [81]
+ o tests/server/tftpd.c: close upload file right after transfer [62]
+ o tests/util.py: fix compatibility with Python 2 [83]
+ o tests: add missing global_init/cleanup calls [42]
+ o tests: fix some http/2 tests for older versions of nghttpx [47]
+ o tool_debug_cb: do not assume zero-terminated data
+ o tool_help: make "output" description less confusing [21]
+ o tool_operate: --retry for HTTP 408 responses too [43]
+ o tool_operate: bail out proper on errors during parallel transfers [29]
+ o tool_operate: fix compiler warning when --libcurl is disabled [12]
+ o tool_writeout: use off_t getinfo-types instead of doubles [76]
+ o travis: use ninja-build for CMake builds [63]
+ o travis: use valgrind when running tests for debug builds [40]
+ o urlapi: don't accept blank port number field without scheme [98]
+ o urlapi: URL encode a '+' in the query part [14]
+ o urldata: remove 'void *protop' and create the union 'p' [86]
+ o vquic/ngtcp2.h: define local_addr as sockaddr_storage [73]
This release includes the following known bugs:
- o see docs/KNOWN_BUGS (https://curl.se/docs/knownbugs.html)
+ o see docs/KNOWN_BUGS (https://curl.se/docs/knownbugs.html)
This release would not have looked like this without help, code, reports and
advice from friends like these:
- Andreas Fischer, asavah on github, b9a1 on github, Baruch Siach,
- Basuke Suzuki, bobmitchell1956 on github, BrumBrum on hackerone,
- Cristian Morales Vega, d4d on hackerone, Daiki Ueno, Daniel Gustafsson,
- Daniel Stenberg, Dietmar Hauser, Dirk Wetter, emanruse on github,
- Emil Engler, hamstergene on github, Harry Sintonen, Jacob Hoffman-Andrews,
- Jakub Zakrzewski, Jeroen Ooms, Jon Rumsey, José Joaquín Atria, Junho Choi,
- Kael1117 on github, Klaus Crusius, Kovalkov Dmitrii, Marcel Raad,
- Marc Hörsken, Marc Schlatter, Niranjan Hasabnis, nosajsnikta on github,
- Oliver Urbann, Per Nilsson, Philipp Klaus Krause, Ray Satiro,
- Rikard Falkeborn, Rui LIU, Sergei Nikulov, Thomas Danielsson, Tobias Hieta,
- Tom G. Christensen, Varnavas Papaioannou, Viktor Szakats, Vincent Torri,
- xnynx on github,
+ Andreas Fischer, asavah on github, b9a1 on github, Baruch Siach,
+ Basuke Suzuki, bobmitchell1956 on github, BrumBrum on hackerone,
+ Cristian Morales Vega, d4d on hackerone, Daiki Ueno, Daniel Gustafsson,
+ Daniel Stenberg, Dietmar Hauser, Dirk Wetter, emanruse on github,
+ Emil Engler, hamstergene on github, Harry Sintonen, Jacob Hoffman-Andrews,
+ Jakub Zakrzewski, Jeroen Ooms, Jon Rumsey, José Joaquín Atria, Junho Choi,
+ Kael1117 on github, Klaus Crusius, Kovalkov Dmitrii, Marcel Raad,
+ Marc Hörsken, Marc Schlatter, Niranjan Hasabnis, nosajsnikta on github,
+ Oliver Urbann, Per Nilsson, Philipp Klaus Krause, Ray Satiro,
+ Rikard Falkeborn, Rui LIU, Sergei Nikulov, Thomas Danielsson, Tobias Hieta,
+ Tom G. Christensen, Varnavas Papaioannou, Viktor Szakats, Vincent Torri,
+ xnynx on github,
(46 contributors)
Thanks! (and sorry if I forgot to mention someone)
References to bug reports and discussions on issues:
- [1] = https://curl.se/bug/?i=6080
- [2] = https://curl.se/bug/?i=6079
- [3] = https://curl.se/bug/?i=6102
- [4] = https://curl.se/bug/?i=6085
- [5] = https://curl.se/bug/?i=6083
- [6] = https://curl.se/bug/?i=6097
- [7] = https://curl.se/bug/?i=6049
- [8] = https://curl.se/bug/?i=6096
- [9] = https://curl.se/mail/lib-2020-10/0037.html
- [10] = https://curl.se/bug/?i=6093
- [11] = https://curl.se/bug/?i=6092
- [12] = https://curl.se/bug/?i=6095
- [13] = https://curl.se/bug/?i=6088
- [14] = https://curl.se/bug/?i=6086
- [15] = https://curl.se/bug/?i=6200
- [16] = https://curl.se/bug/?i=6053
- [17] = https://curl.se/bug/?i=6125
- [18] = https://curl.se/bug/?i=6068
- [19] = https://curl.se/bug/?i=6069
- [20] = https://curl.se/bug/?i=5868
- [21] = https://curl.se/bug/?i=6118
- [22] = https://curl.se/bug/?i=6119
- [23] = https://curl.se/bug/?i=6117
- [24] = https://curl.se/bug/?i=6116
- [25] = https://curl.se/bug/?i=6108
- [26] = https://curl.se/bug/?i=6108
- [27] = https://curl.se/bug/?i=6105
- [28] = https://curl.se/bug/?i=6145
- [29] = https://curl.se/bug/?i=6141
- [30] = https://curl.se/bug/?i=6072
- [31] = https://curl.se/bug/?i=6113
- [32] = https://curl.se/bug/?i=6134
- [33] = https://curl.se/bug/?i=6126
- [34] = https://curl.se/bug/?i=6131
- [35] = https://curl.se/bug/?i=6188
- [36] = https://curl.se/bug/?i=6124
- [37] = https://curl.se/bug/?i=5896
- [38] = https://curl.se/bug/?i=6074
- [39] = https://curl.se/bug/?i=6186
- [40] = https://curl.se/bug/?i=6154
- [41] = https://curl.se/bug/?i=6153
- [42] = https://curl.se/bug/?i=6156
- [43] = https://curl.se/bug/?i=6155
- [44] = https://curl.se/bug/?i=6147
- [45] = https://curl.se/bug/?i=6148
- [46] = https://curl.se/bug/?i=6138
- [47] = https://curl.se/bug/?i=6139
- [48] = https://curl.se/bug/?i=6162
- [49] = https://curl.se/bug/?i=6185
- [50] = https://curl.se/bug/?i=6168
- [51] = https://curl.se/bug/?i=6182
- [52] = https://curl.se/bug/?i=6195
- [53] = https://curl.se/bug/?i=6194
- [54] = https://curl.se/mail/lib-2020-11/0026.html
- [55] = https://curl.se/bug/?i=6192
- [56] = https://curl.se/bug/?i=6177
- [57] = https://curl.se/bug/?i=6190
- [58] = https://curl.se/bug/?i=6171
- [59] = https://curl.se/bug/?i=6172
- [60] = https://curl.se/bug/?i=6058
- [61] = https://curl.se/bug/?i=6220
- [62] = https://curl.se/bug/?i=6058
- [63] = https://curl.se/bug/?i=6077
- [64] = https://curl.se/bug/?i=6161
- [65] = https://curl.se/bug/?i=6161
- [66] = https://curl.se/bug/?i=6254
- [67] = https://curl.se/bug/?i=6250
- [68] = https://curl.se/bug/?i=6224
- [69] = https://curl.se/bug/?i=6215
- [70] = https://curl.se/bug/?i=6173
- [71] = https://curl.se/bug/?i=6223
- [72] = https://curl.se/bug/?i=6250
- [73] = https://curl.se/bug/?i=6250
- [74] = https://curl.se/bug/?i=6247
- [75] = https://curl.se/bug/?i=6247
- [76] = https://curl.se/bug/?i=6248
- [77] = https://curl.se/bug/?i=6249
- [78] = https://curl.se/bug/?i=6241
- [79] = https://curl.se/bug/?i=6257
- [80] = https://curl.se/bug/?i=6211
- [81] = https://curl.se/bug/?i=6058
- [82] = https://curl.se/bug/?i=6205
- [83] = https://curl.se/bug/?i=6259
- [84] = https://curl.se/bug/?i=6239
- [85] = https://curl.se/bug/?i=6228
- [86] = https://curl.se/bug/?i=6238
- [87] = https://curl.se/bug/?i=6273
- [88] = https://curl.se/bug/?i=6235
- [89] = https://curl.se/bug/?i=6213
- [90] = https://curl.se/bug/?i=6271
- [91] = https://curl.se/bug/?i=6252
- [92] = https://curl.se/bug/?i=6263
- [93] = https://curl.se/docs/CVE-2020-8286.html
- [94] = https://curl.se/bug/?i=6267
- [95] = https://curl.se/docs/CVE-2020-8285.html
- [96] = https://curl.se/bug/?i=6264
- [97] = https://curl.se/docs/CVE-2020-8284.html
- [98] = https://curl.se/bug/?i=6283
- [99] = https://curl.se/bug/?i=6146
- [100] = https://curl.se/bug/?i=6252
- [101] = https://curl.se/bug/?i=6280
+ [1] = https://curl.se/bug/?i=6080
+ [2] = https://curl.se/bug/?i=6079
+ [3] = https://curl.se/bug/?i=6102
+ [4] = https://curl.se/bug/?i=6085
+ [5] = https://curl.se/bug/?i=6083
+ [6] = https://curl.se/bug/?i=6097
+ [7] = https://curl.se/bug/?i=6049
+ [8] = https://curl.se/bug/?i=6096
+ [9] = https://curl.se/mail/lib-2020-10/0037.html
+ [10] = https://curl.se/bug/?i=6093
+ [11] = https://curl.se/bug/?i=6092
+ [12] = https://curl.se/bug/?i=6095
+ [13] = https://curl.se/bug/?i=6088
+ [14] = https://curl.se/bug/?i=6086
+ [15] = https://curl.se/bug/?i=6200
+ [16] = https://curl.se/bug/?i=6053
+ [17] = https://curl.se/bug/?i=6125
+ [18] = https://curl.se/bug/?i=6068
+ [19] = https://curl.se/bug/?i=6069
+ [20] = https://curl.se/bug/?i=5868
+ [21] = https://curl.se/bug/?i=6118
+ [22] = https://curl.se/bug/?i=6119
+ [23] = https://curl.se/bug/?i=6117
+ [24] = https://curl.se/bug/?i=6116
+ [25] = https://curl.se/bug/?i=6108
+ [26] = https://curl.se/bug/?i=6108
+ [27] = https://curl.se/bug/?i=6105
+ [28] = https://curl.se/bug/?i=6145
+ [29] = https://curl.se/bug/?i=6141
+ [30] = https://curl.se/bug/?i=6072
+ [31] = https://curl.se/bug/?i=6113
+ [32] = https://curl.se/bug/?i=6134
+ [33] = https://curl.se/bug/?i=6126
+ [34] = https://curl.se/bug/?i=6131
+ [35] = https://curl.se/bug/?i=6188
+ [36] = https://curl.se/bug/?i=6124
+ [37] = https://curl.se/bug/?i=5896
+ [38] = https://curl.se/bug/?i=6074
+ [39] = https://curl.se/bug/?i=6186
+ [40] = https://curl.se/bug/?i=6154
+ [41] = https://curl.se/bug/?i=6153
+ [42] = https://curl.se/bug/?i=6156
+ [43] = https://curl.se/bug/?i=6155
+ [44] = https://curl.se/bug/?i=6147
+ [45] = https://curl.se/bug/?i=6148
+ [46] = https://curl.se/bug/?i=6138
+ [47] = https://curl.se/bug/?i=6139
+ [48] = https://curl.se/bug/?i=6162
+ [49] = https://curl.se/bug/?i=6185
+ [50] = https://curl.se/bug/?i=6168
+ [51] = https://curl.se/bug/?i=6182
+ [52] = https://curl.se/bug/?i=6195
+ [53] = https://curl.se/bug/?i=6194
+ [54] = https://curl.se/mail/lib-2020-11/0026.html
+ [55] = https://curl.se/bug/?i=6192
+ [56] = https://curl.se/bug/?i=6177
+ [57] = https://curl.se/bug/?i=6190
+ [58] = https://curl.se/bug/?i=6171
+ [59] = https://curl.se/bug/?i=6172
+ [60] = https://curl.se/bug/?i=6058
+ [61] = https://curl.se/bug/?i=6220
+ [62] = https://curl.se/bug/?i=6058
+ [63] = https://curl.se/bug/?i=6077
+ [64] = https://curl.se/bug/?i=6161
+ [65] = https://curl.se/bug/?i=6161
+ [66] = https://curl.se/bug/?i=6254
+ [67] = https://curl.se/bug/?i=6250
+ [68] = https://curl.se/bug/?i=6224
+ [69] = https://curl.se/bug/?i=6215
+ [70] = https://curl.se/bug/?i=6173
+ [71] = https://curl.se/bug/?i=6223
+ [72] = https://curl.se/bug/?i=6250
+ [73] = https://curl.se/bug/?i=6250
+ [74] = https://curl.se/bug/?i=6247
+ [75] = https://curl.se/bug/?i=6247
+ [76] = https://curl.se/bug/?i=6248
+ [77] = https://curl.se/bug/?i=6249
+ [78] = https://curl.se/bug/?i=6241
+ [79] = https://curl.se/bug/?i=6257
+ [80] = https://curl.se/bug/?i=6211
+ [81] = https://curl.se/bug/?i=6058
+ [82] = https://curl.se/bug/?i=6205
+ [83] = https://curl.se/bug/?i=6259
+ [84] = https://curl.se/bug/?i=6239
+ [85] = https://curl.se/bug/?i=6228
+ [86] = https://curl.se/bug/?i=6238
+ [87] = https://curl.se/bug/?i=6273
+ [88] = https://curl.se/bug/?i=6235
+ [89] = https://curl.se/bug/?i=6213
+ [90] = https://curl.se/bug/?i=6271
+ [91] = https://curl.se/bug/?i=6252
+ [92] = https://curl.se/bug/?i=6263
+ [93] = https://curl.se/docs/CVE-2020-8286.html
+ [94] = https://curl.se/bug/?i=6267
+ [95] = https://curl.se/docs/CVE-2020-8285.html
+ [96] = https://curl.se/bug/?i=6264
+ [97] = https://curl.se/docs/CVE-2020-8284.html
+ [98] = https://curl.se/bug/?i=6283
+ [99] = https://curl.se/bug/?i=6146
+ [100] = https://curl.se/bug/?i=6252
+ [101] = https://curl.se/bug/?i=6280
diff --git a/contrib/libs/curl/include/curl/curl.h b/contrib/libs/curl/include/curl/curl.h
index b85f446584..8efbe22885 100644
--- a/contrib/libs/curl/include/curl/curl.h
+++ b/contrib/libs/curl/include/curl/curl.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -24,7 +24,7 @@
/*
* If you have libcurl problems, all docs and details are found here:
- * https://curl.se/libcurl/
+ * https://curl.se/libcurl/
*
* curl-library mailing list subscription and unsubscription web interface:
* https://cool.haxx.se/mailman/listinfo/curl-library/
@@ -38,12 +38,12 @@
#include "system.h" /* determine things run-time */
/*
- * Define CURL_WIN32 when build target is Win32 API
+ * Define CURL_WIN32 when build target is Win32 API
*/
-#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && \
- !defined(__SYMBIAN32__)
-#define CURL_WIN32
+#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && \
+ !defined(__SYMBIAN32__)
+#define CURL_WIN32
#endif
#include <stdio.h>
@@ -58,7 +58,7 @@
#include <sys/types.h>
#include <time.h>
-#if defined(CURL_WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
+#if defined(CURL_WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
#if !(defined(_WINSOCK_H) || \
defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H))
/* The check above prevents the winsock2 inclusion if winsock.h already was
@@ -74,16 +74,16 @@
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
- defined(__CYGWIN__) || defined(AMIGA) || \
+ defined(__CYGWIN__) || defined(AMIGA) || \
(defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
#include <sys/select.h>
#endif
-#if !defined(CURL_WIN32) && !defined(_WIN32_WCE)
+#if !defined(CURL_WIN32) && !defined(_WIN32_WCE)
#include <sys/socket.h>
#endif
-#if !defined(CURL_WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
+#if !defined(CURL_WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
#include <sys/time.h>
#endif
@@ -114,7 +114,7 @@ typedef void CURLSH;
#ifdef CURL_STATICLIB
# define CURL_EXTERN
-#elif defined(CURL_WIN32) || defined(__SYMBIAN32__) || \
+#elif defined(CURL_WIN32) || defined(__SYMBIAN32__) || \
(__has_declspec_attribute(dllexport) && \
__has_declspec_attribute(dllimport))
# if defined(BUILDING_LIBCURL)
@@ -130,7 +130,7 @@ typedef void CURLSH;
#ifndef curl_socket_typedef
/* socket typedef */
-#if defined(CURL_WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
+#if defined(CURL_WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
typedef SOCKET curl_socket_t;
#define CURL_SOCKET_BAD INVALID_SOCKET
#else
@@ -154,8 +154,8 @@ typedef enum {
CURLSSLBACKEND_SECURETRANSPORT = 9,
CURLSSLBACKEND_AXTLS = 10, /* never used since 7.63.0 */
CURLSSLBACKEND_MBEDTLS = 11,
- CURLSSLBACKEND_MESALINK = 12,
- CURLSSLBACKEND_BEARSSL = 13
+ CURLSSLBACKEND_MESALINK = 12,
+ CURLSSLBACKEND_BEARSSL = 13
} curl_sslbackend;
/* aliases for library clones and renames */
@@ -210,11 +210,11 @@ struct curl_httppost {
set. Added in 7.46.0 */
};
-
-/* This is a return code for the progress callback that, when returned, will
- signal libcurl to continue executing the default progress function */
-#define CURL_PROGRESSFUNC_CONTINUE 0x10000001
-
+
+/* This is a return code for the progress callback that, when returned, will
+ signal libcurl to continue executing the default progress function */
+#define CURL_PROGRESSFUNC_CONTINUE 0x10000001
+
/* This is the CURLOPT_PROGRESSFUNCTION callback prototype. It is now
considered deprecated but was the only choice up until 7.31.0 */
typedef int (*curl_progress_callback)(void *clientp,
@@ -608,9 +608,9 @@ typedef enum {
inside a callback */
CURLE_AUTH_ERROR, /* 94 - an authentication function returned an
error */
- CURLE_HTTP3, /* 95 - An HTTP/3 layer problem */
- CURLE_QUIC_CONNECT_ERROR, /* 96 - QUIC connection error */
- CURLE_PROXY, /* 97 - proxy handshake error */
+ CURLE_HTTP3, /* 95 - An HTTP/3 layer problem */
+ CURLE_QUIC_CONNECT_ERROR, /* 96 - QUIC connection error */
+ CURLE_PROXY, /* 97 - proxy handshake error */
CURL_LAST /* never use! */
} CURLcode;
@@ -690,48 +690,48 @@ typedef enum {
#endif /*!CURL_NO_OLDIES*/
-/*
- * Proxy error codes. Returned in CURLINFO_PROXY_ERROR if CURLE_PROXY was
- * return for the transfers.
- */
-typedef enum {
- CURLPX_OK,
- CURLPX_BAD_ADDRESS_TYPE,
- CURLPX_BAD_VERSION,
- CURLPX_CLOSED,
- CURLPX_GSSAPI,
- CURLPX_GSSAPI_PERMSG,
- CURLPX_GSSAPI_PROTECTION,
- CURLPX_IDENTD,
- CURLPX_IDENTD_DIFFER,
- CURLPX_LONG_HOSTNAME,
- CURLPX_LONG_PASSWD,
- CURLPX_LONG_USER,
- CURLPX_NO_AUTH,
- CURLPX_RECV_ADDRESS,
- CURLPX_RECV_AUTH,
- CURLPX_RECV_CONNECT,
- CURLPX_RECV_REQACK,
- CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED,
- CURLPX_REPLY_COMMAND_NOT_SUPPORTED,
- CURLPX_REPLY_CONNECTION_REFUSED,
- CURLPX_REPLY_GENERAL_SERVER_FAILURE,
- CURLPX_REPLY_HOST_UNREACHABLE,
- CURLPX_REPLY_NETWORK_UNREACHABLE,
- CURLPX_REPLY_NOT_ALLOWED,
- CURLPX_REPLY_TTL_EXPIRED,
- CURLPX_REPLY_UNASSIGNED,
- CURLPX_REQUEST_FAILED,
- CURLPX_RESOLVE_HOST,
- CURLPX_SEND_AUTH,
- CURLPX_SEND_CONNECT,
- CURLPX_SEND_REQUEST,
- CURLPX_UNKNOWN_FAIL,
- CURLPX_UNKNOWN_MODE,
- CURLPX_USER_REJECTED,
- CURLPX_LAST /* never use */
-} CURLproxycode;
-
+/*
+ * Proxy error codes. Returned in CURLINFO_PROXY_ERROR if CURLE_PROXY was
+ * return for the transfers.
+ */
+typedef enum {
+ CURLPX_OK,
+ CURLPX_BAD_ADDRESS_TYPE,
+ CURLPX_BAD_VERSION,
+ CURLPX_CLOSED,
+ CURLPX_GSSAPI,
+ CURLPX_GSSAPI_PERMSG,
+ CURLPX_GSSAPI_PROTECTION,
+ CURLPX_IDENTD,
+ CURLPX_IDENTD_DIFFER,
+ CURLPX_LONG_HOSTNAME,
+ CURLPX_LONG_PASSWD,
+ CURLPX_LONG_USER,
+ CURLPX_NO_AUTH,
+ CURLPX_RECV_ADDRESS,
+ CURLPX_RECV_AUTH,
+ CURLPX_RECV_CONNECT,
+ CURLPX_RECV_REQACK,
+ CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED,
+ CURLPX_REPLY_COMMAND_NOT_SUPPORTED,
+ CURLPX_REPLY_CONNECTION_REFUSED,
+ CURLPX_REPLY_GENERAL_SERVER_FAILURE,
+ CURLPX_REPLY_HOST_UNREACHABLE,
+ CURLPX_REPLY_NETWORK_UNREACHABLE,
+ CURLPX_REPLY_NOT_ALLOWED,
+ CURLPX_REPLY_TTL_EXPIRED,
+ CURLPX_REPLY_UNASSIGNED,
+ CURLPX_REQUEST_FAILED,
+ CURLPX_RESOLVE_HOST,
+ CURLPX_SEND_AUTH,
+ CURLPX_SEND_CONNECT,
+ CURLPX_SEND_REQUEST,
+ CURLPX_UNKNOWN_FAIL,
+ CURLPX_UNKNOWN_MODE,
+ CURLPX_USER_REJECTED,
+ CURLPX_LAST /* never use */
+} CURLproxycode;
+
/* This prototype applies to all conversion callbacks */
typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
@@ -817,7 +817,7 @@ enum curl_khtype {
};
struct curl_khkey {
- const char *key; /* points to a null-terminated string encoded with base64
+ const char *key; /* points to a null-terminated string encoded with base64
if len is zero, otherwise to the "raw" data */
size_t len;
enum curl_khtype keytype;
@@ -832,7 +832,7 @@ enum curl_khstat {
CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so
this causes a CURLE_DEFER error but otherwise the
connection will be left intact etc */
- CURLKHSTAT_FINE_REPLACE, /* accept and replace the wrong key*/
+ CURLKHSTAT_FINE_REPLACE, /* accept and replace the wrong key*/
CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */
};
@@ -873,19 +873,19 @@ typedef enum {
SSL backends where such behavior is present. */
#define CURLSSLOPT_NO_REVOKE (1<<1)
-/* - NO_PARTIALCHAIN tells libcurl to *NOT* accept a partial certificate chain
- if possible. The OpenSSL backend has this ability. */
-#define CURLSSLOPT_NO_PARTIALCHAIN (1<<2)
-
-/* - REVOKE_BEST_EFFORT tells libcurl to ignore certificate revocation offline
- checks and ignore missing revocation list for those SSL backends where such
- behavior is present. */
-#define CURLSSLOPT_REVOKE_BEST_EFFORT (1<<3)
-
-/* - CURLSSLOPT_NATIVE_CA tells libcurl to use standard certificate store of
- operating system. Currently implemented under MS-Windows. */
-#define CURLSSLOPT_NATIVE_CA (1<<4)
-
+/* - NO_PARTIALCHAIN tells libcurl to *NOT* accept a partial certificate chain
+ if possible. The OpenSSL backend has this ability. */
+#define CURLSSLOPT_NO_PARTIALCHAIN (1<<2)
+
+/* - REVOKE_BEST_EFFORT tells libcurl to ignore certificate revocation offline
+ checks and ignore missing revocation list for those SSL backends where such
+ behavior is present. */
+#define CURLSSLOPT_REVOKE_BEST_EFFORT (1<<3)
+
+/* - CURLSSLOPT_NATIVE_CA tells libcurl to use standard certificate store of
+ operating system. Currently implemented under MS-Windows. */
+#define CURLSSLOPT_NATIVE_CA (1<<4)
+
/* 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. */
@@ -954,37 +954,37 @@ typedef enum {
#define CURLALTSVC_H2 (1<<4)
#define CURLALTSVC_H3 (1<<5)
-
-struct curl_hstsentry {
- char *name;
- size_t namelen;
- unsigned int includeSubDomains:1;
- char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */
-};
-
-struct curl_index {
- size_t index; /* the provided entry's "index" or count */
- size_t total; /* total number of entries to save */
-};
-
-typedef enum {
- CURLSTS_OK,
- CURLSTS_DONE,
- CURLSTS_FAIL
-} CURLSTScode;
-
-typedef CURLSTScode (*curl_hstsread_callback)(CURL *easy,
- struct curl_hstsentry *e,
- void *userp);
-typedef CURLSTScode (*curl_hstswrite_callback)(CURL *easy,
- struct curl_hstsentry *e,
- struct curl_index *i,
- void *userp);
-
-/* CURLHSTS_* are bits for the CURLOPT_HSTS option */
-#define CURLHSTS_ENABLE (long)(1<<0)
-#define CURLHSTS_READONLYFILE (long)(1<<1)
-
+
+struct curl_hstsentry {
+ char *name;
+ size_t namelen;
+ unsigned int includeSubDomains:1;
+ char expire[18]; /* YYYYMMDD HH:MM:SS [null-terminated] */
+};
+
+struct curl_index {
+ size_t index; /* the provided entry's "index" or count */
+ size_t total; /* total number of entries to save */
+};
+
+typedef enum {
+ CURLSTS_OK,
+ CURLSTS_DONE,
+ CURLSTS_FAIL
+} CURLSTScode;
+
+typedef CURLSTScode (*curl_hstsread_callback)(CURL *easy,
+ struct curl_hstsentry *e,
+ void *userp);
+typedef CURLSTScode (*curl_hstswrite_callback)(CURL *easy,
+ struct curl_hstsentry *e,
+ struct curl_index *i,
+ void *userp);
+
+/* CURLHSTS_* are bits for the CURLOPT_HSTS option */
+#define CURLHSTS_ENABLE (long)(1<<0)
+#define CURLHSTS_READONLYFILE (long)(1<<1)
+
/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
#define CURLPROTO_HTTP (1<<0)
#define CURLPROTO_HTTPS (1<<1)
@@ -1014,7 +1014,7 @@ typedef CURLSTScode (*curl_hstswrite_callback)(CURL *easy,
#define CURLPROTO_GOPHER (1<<25)
#define CURLPROTO_SMB (1<<26)
#define CURLPROTO_SMBS (1<<27)
-#define CURLPROTO_MQTT (1<<28)
+#define CURLPROTO_MQTT (1<<28)
#define CURLPROTO_ALL (~0) /* enable everything */
/* long may be 32 or 64 bits, but we should never depend on anything else
@@ -1023,73 +1023,73 @@ typedef CURLSTScode (*curl_hstswrite_callback)(CURL *easy,
#define CURLOPTTYPE_OBJECTPOINT 10000
#define CURLOPTTYPE_FUNCTIONPOINT 20000
#define CURLOPTTYPE_OFF_T 30000
-#define CURLOPTTYPE_BLOB 40000
+#define CURLOPTTYPE_BLOB 40000
/* *STRINGPOINT is an alias for OBJECTPOINT to allow tools to extract the
string options from the header file */
-#define CURLOPT(na,t,nu) na = t + nu
+#define CURLOPT(na,t,nu) na = t + nu
+
+/* CURLOPT aliases that make no run-time difference */
+
+/* 'char *' argument to a string with a trailing zero */
+#define CURLOPTTYPE_STRINGPOINT CURLOPTTYPE_OBJECTPOINT
-/* CURLOPT aliases that make no run-time difference */
-
-/* 'char *' argument to a string with a trailing zero */
-#define CURLOPTTYPE_STRINGPOINT CURLOPTTYPE_OBJECTPOINT
-
-/* 'struct curl_slist *' argument */
+/* 'struct curl_slist *' argument */
#define CURLOPTTYPE_SLISTPOINT CURLOPTTYPE_OBJECTPOINT
-/* 'void *' argument passed untouched to callback */
-#define CURLOPTTYPE_CBPOINT CURLOPTTYPE_OBJECTPOINT
-
-/* 'long' argument with a set of values/bitmask */
-#define CURLOPTTYPE_VALUES CURLOPTTYPE_LONG
-
+/* 'void *' argument passed untouched to callback */
+#define CURLOPTTYPE_CBPOINT CURLOPTTYPE_OBJECTPOINT
+
+/* 'long' argument with a set of values/bitmask */
+#define CURLOPTTYPE_VALUES CURLOPTTYPE_LONG
+
/*
- * All CURLOPT_* values.
+ * All CURLOPT_* values.
*/
typedef enum {
/* This is the FILE * or void * the regular output should be written to. */
- CURLOPT(CURLOPT_WRITEDATA, CURLOPTTYPE_CBPOINT, 1),
+ CURLOPT(CURLOPT_WRITEDATA, CURLOPTTYPE_CBPOINT, 1),
/* The full URL to get/put */
- CURLOPT(CURLOPT_URL, CURLOPTTYPE_STRINGPOINT, 2),
+ CURLOPT(CURLOPT_URL, CURLOPTTYPE_STRINGPOINT, 2),
/* Port number to connect to, if other than default. */
- CURLOPT(CURLOPT_PORT, CURLOPTTYPE_LONG, 3),
+ CURLOPT(CURLOPT_PORT, CURLOPTTYPE_LONG, 3),
/* Name of proxy to use. */
- CURLOPT(CURLOPT_PROXY, CURLOPTTYPE_STRINGPOINT, 4),
+ CURLOPT(CURLOPT_PROXY, CURLOPTTYPE_STRINGPOINT, 4),
/* "user:password;options" to use when fetching. */
- CURLOPT(CURLOPT_USERPWD, CURLOPTTYPE_STRINGPOINT, 5),
+ CURLOPT(CURLOPT_USERPWD, CURLOPTTYPE_STRINGPOINT, 5),
/* "user:password" to use with proxy. */
- CURLOPT(CURLOPT_PROXYUSERPWD, CURLOPTTYPE_STRINGPOINT, 6),
+ CURLOPT(CURLOPT_PROXYUSERPWD, CURLOPTTYPE_STRINGPOINT, 6),
/* Range to get, specified as an ASCII string. */
- CURLOPT(CURLOPT_RANGE, CURLOPTTYPE_STRINGPOINT, 7),
+ CURLOPT(CURLOPT_RANGE, CURLOPTTYPE_STRINGPOINT, 7),
/* not used */
/* Specified file stream to upload from (use as input): */
- CURLOPT(CURLOPT_READDATA, CURLOPTTYPE_CBPOINT, 9),
+ CURLOPT(CURLOPT_READDATA, CURLOPTTYPE_CBPOINT, 9),
/* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
* bytes big. */
- CURLOPT(CURLOPT_ERRORBUFFER, CURLOPTTYPE_OBJECTPOINT, 10),
+ CURLOPT(CURLOPT_ERRORBUFFER, CURLOPTTYPE_OBJECTPOINT, 10),
/* Function that will be called to store the output (instead of fwrite). The
* parameters will use fwrite() syntax, make sure to follow them. */
- CURLOPT(CURLOPT_WRITEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 11),
+ CURLOPT(CURLOPT_WRITEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 11),
/* Function that will be called to read the input (instead of fread). The
* parameters will use fread() syntax, make sure to follow them. */
- CURLOPT(CURLOPT_READFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 12),
+ CURLOPT(CURLOPT_READFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 12),
/* Time-out the read operation after this amount of seconds */
- CURLOPT(CURLOPT_TIMEOUT, CURLOPTTYPE_LONG, 13),
+ CURLOPT(CURLOPT_TIMEOUT, CURLOPTTYPE_LONG, 13),
/* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
* how large the file being sent really is. That allows better error
@@ -1100,20 +1100,20 @@ typedef enum {
* which takes an off_t type, allowing platforms with larger off_t
* sizes to handle larger files. See below for INFILESIZE_LARGE.
*/
- CURLOPT(CURLOPT_INFILESIZE, CURLOPTTYPE_LONG, 14),
+ CURLOPT(CURLOPT_INFILESIZE, CURLOPTTYPE_LONG, 14),
/* POST static input fields. */
- CURLOPT(CURLOPT_POSTFIELDS, CURLOPTTYPE_OBJECTPOINT, 15),
+ CURLOPT(CURLOPT_POSTFIELDS, CURLOPTTYPE_OBJECTPOINT, 15),
/* Set the referrer page (needed by some CGIs) */
- CURLOPT(CURLOPT_REFERER, CURLOPTTYPE_STRINGPOINT, 16),
+ CURLOPT(CURLOPT_REFERER, CURLOPTTYPE_STRINGPOINT, 16),
/* Set the FTP PORT string (interface name, named or numerical IP address)
Use i.e '-' to use default address. */
- CURLOPT(CURLOPT_FTPPORT, CURLOPTTYPE_STRINGPOINT, 17),
+ CURLOPT(CURLOPT_FTPPORT, CURLOPTTYPE_STRINGPOINT, 17),
/* Set the User-Agent string (examined by some CGIs) */
- CURLOPT(CURLOPT_USERAGENT, CURLOPTTYPE_STRINGPOINT, 18),
+ CURLOPT(CURLOPT_USERAGENT, CURLOPTTYPE_STRINGPOINT, 18),
/* If the download receives less than "low speed limit" bytes/second
* during "low speed time" seconds, the operations is aborted.
@@ -1122,10 +1122,10 @@ typedef enum {
*/
/* Set the "low speed limit" */
- CURLOPT(CURLOPT_LOW_SPEED_LIMIT, CURLOPTTYPE_LONG, 19),
+ CURLOPT(CURLOPT_LOW_SPEED_LIMIT, CURLOPTTYPE_LONG, 19),
/* Set the "low speed time" */
- CURLOPT(CURLOPT_LOW_SPEED_TIME, CURLOPTTYPE_LONG, 20),
+ CURLOPT(CURLOPT_LOW_SPEED_TIME, CURLOPTTYPE_LONG, 20),
/* Set the continuation offset.
*
@@ -1133,48 +1133,48 @@ typedef enum {
* off_t types, allowing for large file offsets on platforms which
* use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
*/
- CURLOPT(CURLOPT_RESUME_FROM, CURLOPTTYPE_LONG, 21),
+ CURLOPT(CURLOPT_RESUME_FROM, CURLOPTTYPE_LONG, 21),
/* Set cookie in request: */
- CURLOPT(CURLOPT_COOKIE, CURLOPTTYPE_STRINGPOINT, 22),
+ CURLOPT(CURLOPT_COOKIE, CURLOPTTYPE_STRINGPOINT, 22),
/* This points to a linked list of headers, struct curl_slist kind. This
list is also used for RTSP (in spite of its name) */
- CURLOPT(CURLOPT_HTTPHEADER, CURLOPTTYPE_SLISTPOINT, 23),
+ CURLOPT(CURLOPT_HTTPHEADER, CURLOPTTYPE_SLISTPOINT, 23),
/* This points to a linked list of post entries, struct curl_httppost */
- CURLOPT(CURLOPT_HTTPPOST, CURLOPTTYPE_OBJECTPOINT, 24),
+ CURLOPT(CURLOPT_HTTPPOST, CURLOPTTYPE_OBJECTPOINT, 24),
/* name of the file keeping your private SSL-certificate */
- CURLOPT(CURLOPT_SSLCERT, CURLOPTTYPE_STRINGPOINT, 25),
+ CURLOPT(CURLOPT_SSLCERT, CURLOPTTYPE_STRINGPOINT, 25),
/* password for the SSL or SSH private key */
- CURLOPT(CURLOPT_KEYPASSWD, CURLOPTTYPE_STRINGPOINT, 26),
+ CURLOPT(CURLOPT_KEYPASSWD, CURLOPTTYPE_STRINGPOINT, 26),
/* send TYPE parameter? */
- CURLOPT(CURLOPT_CRLF, CURLOPTTYPE_LONG, 27),
+ CURLOPT(CURLOPT_CRLF, CURLOPTTYPE_LONG, 27),
/* send linked-list of QUOTE commands */
- CURLOPT(CURLOPT_QUOTE, CURLOPTTYPE_SLISTPOINT, 28),
+ CURLOPT(CURLOPT_QUOTE, CURLOPTTYPE_SLISTPOINT, 28),
/* send FILE * or void * to store headers to, if you use a callback it
is simply passed to the callback unmodified */
- CURLOPT(CURLOPT_HEADERDATA, CURLOPTTYPE_CBPOINT, 29),
+ CURLOPT(CURLOPT_HEADERDATA, CURLOPTTYPE_CBPOINT, 29),
/* point to a file to read the initial cookies from, also enables
"cookie awareness" */
- CURLOPT(CURLOPT_COOKIEFILE, CURLOPTTYPE_STRINGPOINT, 31),
+ CURLOPT(CURLOPT_COOKIEFILE, CURLOPTTYPE_STRINGPOINT, 31),
/* What version to specifically try to use.
See CURL_SSLVERSION defines below. */
- CURLOPT(CURLOPT_SSLVERSION, CURLOPTTYPE_VALUES, 32),
+ CURLOPT(CURLOPT_SSLVERSION, CURLOPTTYPE_VALUES, 32),
/* What kind of HTTP time condition to use, see defines */
- CURLOPT(CURLOPT_TIMECONDITION, CURLOPTTYPE_VALUES, 33),
+ CURLOPT(CURLOPT_TIMECONDITION, CURLOPTTYPE_VALUES, 33),
/* Time to use with the above condition. Specified in number of seconds
since 1 Jan 1970 */
- CURLOPT(CURLOPT_TIMEVALUE, CURLOPTTYPE_LONG, 34),
+ CURLOPT(CURLOPT_TIMEVALUE, CURLOPTTYPE_LONG, 34),
/* 35 = OBSOLETE */
@@ -1182,326 +1182,326 @@ typedef enum {
HTTP: DELETE, TRACE and others
FTP: to use a different list command
*/
- CURLOPT(CURLOPT_CUSTOMREQUEST, CURLOPTTYPE_STRINGPOINT, 36),
+ CURLOPT(CURLOPT_CUSTOMREQUEST, CURLOPTTYPE_STRINGPOINT, 36),
/* FILE handle to use instead of stderr */
- CURLOPT(CURLOPT_STDERR, CURLOPTTYPE_OBJECTPOINT, 37),
+ CURLOPT(CURLOPT_STDERR, CURLOPTTYPE_OBJECTPOINT, 37),
/* 38 is not used */
/* send linked-list of post-transfer QUOTE commands */
- CURLOPT(CURLOPT_POSTQUOTE, CURLOPTTYPE_SLISTPOINT, 39),
-
- /* OBSOLETE, do not use! */
- CURLOPT(CURLOPT_OBSOLETE40, CURLOPTTYPE_OBJECTPOINT, 40),
-
- /* talk a lot */
- CURLOPT(CURLOPT_VERBOSE, CURLOPTTYPE_LONG, 41),
-
- /* throw the header out too */
- CURLOPT(CURLOPT_HEADER, CURLOPTTYPE_LONG, 42),
-
- /* shut off the progress meter */
- CURLOPT(CURLOPT_NOPROGRESS, CURLOPTTYPE_LONG, 43),
-
- /* use HEAD to get http document */
- CURLOPT(CURLOPT_NOBODY, CURLOPTTYPE_LONG, 44),
-
- /* no output on http error codes >= 400 */
- CURLOPT(CURLOPT_FAILONERROR, CURLOPTTYPE_LONG, 45),
-
- /* this is an upload */
- CURLOPT(CURLOPT_UPLOAD, CURLOPTTYPE_LONG, 46),
-
- /* HTTP POST method */
- CURLOPT(CURLOPT_POST, CURLOPTTYPE_LONG, 47),
-
- /* bare names when listing directories */
- CURLOPT(CURLOPT_DIRLISTONLY, CURLOPTTYPE_LONG, 48),
-
- /* Append instead of overwrite on upload! */
- CURLOPT(CURLOPT_APPEND, CURLOPTTYPE_LONG, 50),
-
+ CURLOPT(CURLOPT_POSTQUOTE, CURLOPTTYPE_SLISTPOINT, 39),
+
+ /* OBSOLETE, do not use! */
+ CURLOPT(CURLOPT_OBSOLETE40, CURLOPTTYPE_OBJECTPOINT, 40),
+
+ /* talk a lot */
+ CURLOPT(CURLOPT_VERBOSE, CURLOPTTYPE_LONG, 41),
+
+ /* throw the header out too */
+ CURLOPT(CURLOPT_HEADER, CURLOPTTYPE_LONG, 42),
+
+ /* shut off the progress meter */
+ CURLOPT(CURLOPT_NOPROGRESS, CURLOPTTYPE_LONG, 43),
+
+ /* use HEAD to get http document */
+ CURLOPT(CURLOPT_NOBODY, CURLOPTTYPE_LONG, 44),
+
+ /* no output on http error codes >= 400 */
+ CURLOPT(CURLOPT_FAILONERROR, CURLOPTTYPE_LONG, 45),
+
+ /* this is an upload */
+ CURLOPT(CURLOPT_UPLOAD, CURLOPTTYPE_LONG, 46),
+
+ /* HTTP POST method */
+ CURLOPT(CURLOPT_POST, CURLOPTTYPE_LONG, 47),
+
+ /* bare names when listing directories */
+ CURLOPT(CURLOPT_DIRLISTONLY, CURLOPTTYPE_LONG, 48),
+
+ /* Append instead of overwrite on upload! */
+ CURLOPT(CURLOPT_APPEND, CURLOPTTYPE_LONG, 50),
+
/* Specify whether to read the user+password from the .netrc or the URL.
* This must be one of the CURL_NETRC_* enums below. */
- CURLOPT(CURLOPT_NETRC, CURLOPTTYPE_VALUES, 51),
+ CURLOPT(CURLOPT_NETRC, CURLOPTTYPE_VALUES, 51),
+
+ /* use Location: Luke! */
+ CURLOPT(CURLOPT_FOLLOWLOCATION, CURLOPTTYPE_LONG, 52),
- /* use Location: Luke! */
- CURLOPT(CURLOPT_FOLLOWLOCATION, CURLOPTTYPE_LONG, 52),
+ /* transfer data in text/ASCII format */
+ CURLOPT(CURLOPT_TRANSFERTEXT, CURLOPTTYPE_LONG, 53),
- /* transfer data in text/ASCII format */
- CURLOPT(CURLOPT_TRANSFERTEXT, CURLOPTTYPE_LONG, 53),
+ /* HTTP PUT */
+ CURLOPT(CURLOPT_PUT, CURLOPTTYPE_LONG, 54),
- /* HTTP PUT */
- CURLOPT(CURLOPT_PUT, CURLOPTTYPE_LONG, 54),
-
/* 55 = OBSOLETE */
/* DEPRECATED
* Function that will be called instead of the internal progress display
* function. This function should be defined as the curl_progress_callback
* prototype defines. */
- CURLOPT(CURLOPT_PROGRESSFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 56),
+ CURLOPT(CURLOPT_PROGRESSFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 56),
/* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION
callbacks */
- CURLOPT(CURLOPT_XFERINFODATA, CURLOPTTYPE_CBPOINT, 57),
-#define CURLOPT_PROGRESSDATA CURLOPT_XFERINFODATA
+ CURLOPT(CURLOPT_XFERINFODATA, CURLOPTTYPE_CBPOINT, 57),
+#define CURLOPT_PROGRESSDATA CURLOPT_XFERINFODATA
/* We want the referrer field set automatically when following locations */
- CURLOPT(CURLOPT_AUTOREFERER, CURLOPTTYPE_LONG, 58),
+ CURLOPT(CURLOPT_AUTOREFERER, CURLOPTTYPE_LONG, 58),
/* Port of the proxy, can be set in the proxy string as well with:
"[host]:[port]" */
- CURLOPT(CURLOPT_PROXYPORT, CURLOPTTYPE_LONG, 59),
+ CURLOPT(CURLOPT_PROXYPORT, CURLOPTTYPE_LONG, 59),
/* size of the POST input data, if strlen() is not good to use */
- CURLOPT(CURLOPT_POSTFIELDSIZE, CURLOPTTYPE_LONG, 60),
+ CURLOPT(CURLOPT_POSTFIELDSIZE, CURLOPTTYPE_LONG, 60),
/* tunnel non-http operations through a HTTP proxy */
- CURLOPT(CURLOPT_HTTPPROXYTUNNEL, CURLOPTTYPE_LONG, 61),
+ CURLOPT(CURLOPT_HTTPPROXYTUNNEL, CURLOPTTYPE_LONG, 61),
/* Set the interface string to use as outgoing network interface */
- CURLOPT(CURLOPT_INTERFACE, CURLOPTTYPE_STRINGPOINT, 62),
+ CURLOPT(CURLOPT_INTERFACE, CURLOPTTYPE_STRINGPOINT, 62),
/* Set the krb4/5 security level, this also enables krb4/5 awareness. This
* is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
* is set but doesn't match one of these, 'private' will be used. */
- CURLOPT(CURLOPT_KRBLEVEL, CURLOPTTYPE_STRINGPOINT, 63),
+ CURLOPT(CURLOPT_KRBLEVEL, CURLOPTTYPE_STRINGPOINT, 63),
/* Set if we should verify the peer in ssl handshake, set 1 to verify. */
- CURLOPT(CURLOPT_SSL_VERIFYPEER, CURLOPTTYPE_LONG, 64),
+ CURLOPT(CURLOPT_SSL_VERIFYPEER, CURLOPTTYPE_LONG, 64),
/* The CApath or CAfile used to validate the peer certificate
this option is used only if SSL_VERIFYPEER is true */
- CURLOPT(CURLOPT_CAINFO, CURLOPTTYPE_STRINGPOINT, 65),
+ CURLOPT(CURLOPT_CAINFO, CURLOPTTYPE_STRINGPOINT, 65),
/* 66 = OBSOLETE */
/* 67 = OBSOLETE */
/* Maximum number of http redirects to follow */
- CURLOPT(CURLOPT_MAXREDIRS, CURLOPTTYPE_LONG, 68),
+ CURLOPT(CURLOPT_MAXREDIRS, CURLOPTTYPE_LONG, 68),
/* Pass a long set to 1 to get the date of the requested document (if
possible)! Pass a zero to shut it off. */
- CURLOPT(CURLOPT_FILETIME, CURLOPTTYPE_LONG, 69),
+ CURLOPT(CURLOPT_FILETIME, CURLOPTTYPE_LONG, 69),
/* This points to a linked list of telnet options */
- CURLOPT(CURLOPT_TELNETOPTIONS, CURLOPTTYPE_SLISTPOINT, 70),
+ CURLOPT(CURLOPT_TELNETOPTIONS, CURLOPTTYPE_SLISTPOINT, 70),
/* Max amount of cached alive connections */
- CURLOPT(CURLOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 71),
+ CURLOPT(CURLOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 71),
- /* OBSOLETE, do not use! */
- CURLOPT(CURLOPT_OBSOLETE72, CURLOPTTYPE_LONG, 72),
+ /* OBSOLETE, do not use! */
+ CURLOPT(CURLOPT_OBSOLETE72, CURLOPTTYPE_LONG, 72),
/* 73 = OBSOLETE */
/* Set to explicitly use a new connection for the upcoming transfer.
Do not use this unless you're absolutely sure of this, as it makes the
operation slower and is less friendly for the network. */
- CURLOPT(CURLOPT_FRESH_CONNECT, CURLOPTTYPE_LONG, 74),
+ CURLOPT(CURLOPT_FRESH_CONNECT, CURLOPTTYPE_LONG, 74),
/* Set to explicitly forbid the upcoming transfer's connection to be re-used
when done. Do not use this unless you're absolutely sure of this, as it
makes the operation slower and is less friendly for the network. */
- CURLOPT(CURLOPT_FORBID_REUSE, CURLOPTTYPE_LONG, 75),
+ CURLOPT(CURLOPT_FORBID_REUSE, CURLOPTTYPE_LONG, 75),
/* Set to a file name that contains random data for libcurl to use to
seed the random engine when doing SSL connects. */
- CURLOPT(CURLOPT_RANDOM_FILE, CURLOPTTYPE_STRINGPOINT, 76),
+ CURLOPT(CURLOPT_RANDOM_FILE, CURLOPTTYPE_STRINGPOINT, 76),
/* Set to the Entropy Gathering Daemon socket pathname */
- CURLOPT(CURLOPT_EGDSOCKET, CURLOPTTYPE_STRINGPOINT, 77),
+ CURLOPT(CURLOPT_EGDSOCKET, CURLOPTTYPE_STRINGPOINT, 77),
/* Time-out connect operations after this amount of seconds, if connects are
OK within this time, then fine... This only aborts the connect phase. */
- CURLOPT(CURLOPT_CONNECTTIMEOUT, CURLOPTTYPE_LONG, 78),
+ CURLOPT(CURLOPT_CONNECTTIMEOUT, CURLOPTTYPE_LONG, 78),
/* Function that will be called to store headers (instead of fwrite). The
* parameters will use fwrite() syntax, make sure to follow them. */
- CURLOPT(CURLOPT_HEADERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 79),
+ CURLOPT(CURLOPT_HEADERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 79),
/* Set this to force the HTTP request to get back to GET. Only really usable
if POST, PUT or a custom request have been used first.
*/
- CURLOPT(CURLOPT_HTTPGET, CURLOPTTYPE_LONG, 80),
+ CURLOPT(CURLOPT_HTTPGET, CURLOPTTYPE_LONG, 80),
/* Set if we should verify the Common name from the peer certificate in ssl
* handshake, set 1 to check existence, 2 to ensure that it matches the
* provided hostname. */
- CURLOPT(CURLOPT_SSL_VERIFYHOST, CURLOPTTYPE_LONG, 81),
+ CURLOPT(CURLOPT_SSL_VERIFYHOST, CURLOPTTYPE_LONG, 81),
/* Specify which file name to write all known cookies in after completed
operation. Set file name to "-" (dash) to make it go to stdout. */
- CURLOPT(CURLOPT_COOKIEJAR, CURLOPTTYPE_STRINGPOINT, 82),
+ CURLOPT(CURLOPT_COOKIEJAR, CURLOPTTYPE_STRINGPOINT, 82),
/* Specify which SSL ciphers to use */
- CURLOPT(CURLOPT_SSL_CIPHER_LIST, CURLOPTTYPE_STRINGPOINT, 83),
+ CURLOPT(CURLOPT_SSL_CIPHER_LIST, CURLOPTTYPE_STRINGPOINT, 83),
/* Specify which HTTP version to use! This must be set to one of the
CURL_HTTP_VERSION* enums set below. */
- CURLOPT(CURLOPT_HTTP_VERSION, CURLOPTTYPE_VALUES, 84),
+ CURLOPT(CURLOPT_HTTP_VERSION, CURLOPTTYPE_VALUES, 84),
/* Specifically switch on or off the FTP engine's use of the EPSV command. By
default, that one will always be attempted before the more traditional
PASV command. */
- CURLOPT(CURLOPT_FTP_USE_EPSV, CURLOPTTYPE_LONG, 85),
+ CURLOPT(CURLOPT_FTP_USE_EPSV, CURLOPTTYPE_LONG, 85),
/* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
- CURLOPT(CURLOPT_SSLCERTTYPE, CURLOPTTYPE_STRINGPOINT, 86),
+ CURLOPT(CURLOPT_SSLCERTTYPE, CURLOPTTYPE_STRINGPOINT, 86),
/* name of the file keeping your private SSL-key */
- CURLOPT(CURLOPT_SSLKEY, CURLOPTTYPE_STRINGPOINT, 87),
+ CURLOPT(CURLOPT_SSLKEY, CURLOPTTYPE_STRINGPOINT, 87),
/* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
- CURLOPT(CURLOPT_SSLKEYTYPE, CURLOPTTYPE_STRINGPOINT, 88),
+ CURLOPT(CURLOPT_SSLKEYTYPE, CURLOPTTYPE_STRINGPOINT, 88),
/* crypto engine for the SSL-sub system */
- CURLOPT(CURLOPT_SSLENGINE, CURLOPTTYPE_STRINGPOINT, 89),
+ CURLOPT(CURLOPT_SSLENGINE, CURLOPTTYPE_STRINGPOINT, 89),
/* set the crypto engine for the SSL-sub system as default
the param has no meaning...
*/
- CURLOPT(CURLOPT_SSLENGINE_DEFAULT, CURLOPTTYPE_LONG, 90),
+ CURLOPT(CURLOPT_SSLENGINE_DEFAULT, CURLOPTTYPE_LONG, 90),
/* Non-zero value means to use the global dns cache */
- /* DEPRECATED, do not use! */
- CURLOPT(CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOPTTYPE_LONG, 91),
+ /* DEPRECATED, do not use! */
+ CURLOPT(CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOPTTYPE_LONG, 91),
/* DNS cache timeout */
- CURLOPT(CURLOPT_DNS_CACHE_TIMEOUT, CURLOPTTYPE_LONG, 92),
+ CURLOPT(CURLOPT_DNS_CACHE_TIMEOUT, CURLOPTTYPE_LONG, 92),
/* send linked-list of pre-transfer QUOTE commands */
- CURLOPT(CURLOPT_PREQUOTE, CURLOPTTYPE_SLISTPOINT, 93),
+ CURLOPT(CURLOPT_PREQUOTE, CURLOPTTYPE_SLISTPOINT, 93),
/* set the debug function */
- CURLOPT(CURLOPT_DEBUGFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 94),
+ CURLOPT(CURLOPT_DEBUGFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 94),
/* set the data for the debug function */
- CURLOPT(CURLOPT_DEBUGDATA, CURLOPTTYPE_CBPOINT, 95),
+ CURLOPT(CURLOPT_DEBUGDATA, CURLOPTTYPE_CBPOINT, 95),
/* mark this as start of a cookie session */
- CURLOPT(CURLOPT_COOKIESESSION, CURLOPTTYPE_LONG, 96),
+ CURLOPT(CURLOPT_COOKIESESSION, CURLOPTTYPE_LONG, 96),
/* The CApath directory used to validate the peer certificate
this option is used only if SSL_VERIFYPEER is true */
- CURLOPT(CURLOPT_CAPATH, CURLOPTTYPE_STRINGPOINT, 97),
+ CURLOPT(CURLOPT_CAPATH, CURLOPTTYPE_STRINGPOINT, 97),
/* Instruct libcurl to use a smaller receive buffer */
- CURLOPT(CURLOPT_BUFFERSIZE, CURLOPTTYPE_LONG, 98),
+ CURLOPT(CURLOPT_BUFFERSIZE, CURLOPTTYPE_LONG, 98),
/* Instruct libcurl to not use any signal/alarm handlers, even when using
timeouts. This option is useful for multi-threaded applications.
See libcurl-the-guide for more background information. */
- CURLOPT(CURLOPT_NOSIGNAL, CURLOPTTYPE_LONG, 99),
+ CURLOPT(CURLOPT_NOSIGNAL, CURLOPTTYPE_LONG, 99),
/* Provide a CURLShare for mutexing non-ts data */
- CURLOPT(CURLOPT_SHARE, CURLOPTTYPE_OBJECTPOINT, 100),
+ CURLOPT(CURLOPT_SHARE, CURLOPTTYPE_OBJECTPOINT, 100),
/* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
CURLPROXY_HTTPS, CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and
CURLPROXY_SOCKS5. */
- CURLOPT(CURLOPT_PROXYTYPE, CURLOPTTYPE_VALUES, 101),
+ CURLOPT(CURLOPT_PROXYTYPE, CURLOPTTYPE_VALUES, 101),
/* Set the Accept-Encoding string. Use this to tell a server you would like
the response to be compressed. Before 7.21.6, this was known as
CURLOPT_ENCODING */
- CURLOPT(CURLOPT_ACCEPT_ENCODING, CURLOPTTYPE_STRINGPOINT, 102),
+ CURLOPT(CURLOPT_ACCEPT_ENCODING, CURLOPTTYPE_STRINGPOINT, 102),
/* Set pointer to private data */
- CURLOPT(CURLOPT_PRIVATE, CURLOPTTYPE_OBJECTPOINT, 103),
+ CURLOPT(CURLOPT_PRIVATE, CURLOPTTYPE_OBJECTPOINT, 103),
/* Set aliases for HTTP 200 in the HTTP Response header */
- CURLOPT(CURLOPT_HTTP200ALIASES, CURLOPTTYPE_SLISTPOINT, 104),
+ CURLOPT(CURLOPT_HTTP200ALIASES, CURLOPTTYPE_SLISTPOINT, 104),
/* Continue to send authentication (user+password) when following locations,
even when hostname changed. This can potentially send off the name
and password to whatever host the server decides. */
- CURLOPT(CURLOPT_UNRESTRICTED_AUTH, CURLOPTTYPE_LONG, 105),
+ CURLOPT(CURLOPT_UNRESTRICTED_AUTH, CURLOPTTYPE_LONG, 105),
/* Specifically switch on or off the FTP engine's use of the EPRT command (
it also disables the LPRT attempt). By default, those ones will always be
attempted before the good old traditional PORT command. */
- CURLOPT(CURLOPT_FTP_USE_EPRT, CURLOPTTYPE_LONG, 106),
+ CURLOPT(CURLOPT_FTP_USE_EPRT, CURLOPTTYPE_LONG, 106),
/* Set this to a bitmask value to enable the particular authentications
methods you like. Use this in combination with CURLOPT_USERPWD.
Note that setting multiple bits may cause extra network round-trips. */
- CURLOPT(CURLOPT_HTTPAUTH, CURLOPTTYPE_VALUES, 107),
+ CURLOPT(CURLOPT_HTTPAUTH, CURLOPTTYPE_VALUES, 107),
/* Set the ssl context callback function, currently only for OpenSSL or
WolfSSL ssl_ctx, or mbedTLS mbedtls_ssl_config in the second argument.
The function must match the curl_ssl_ctx_callback prototype. */
- CURLOPT(CURLOPT_SSL_CTX_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 108),
+ CURLOPT(CURLOPT_SSL_CTX_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 108),
/* Set the userdata for the ssl context callback function's third
argument */
- CURLOPT(CURLOPT_SSL_CTX_DATA, CURLOPTTYPE_CBPOINT, 109),
+ CURLOPT(CURLOPT_SSL_CTX_DATA, CURLOPTTYPE_CBPOINT, 109),
/* FTP Option that causes missing dirs to be created on the remote server.
In 7.19.4 we introduced the convenience enums for this option using the
CURLFTP_CREATE_DIR prefix.
*/
- CURLOPT(CURLOPT_FTP_CREATE_MISSING_DIRS, CURLOPTTYPE_LONG, 110),
+ CURLOPT(CURLOPT_FTP_CREATE_MISSING_DIRS, CURLOPTTYPE_LONG, 110),
/* Set this to a bitmask value to enable the particular authentications
methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
Note that setting multiple bits may cause extra network round-trips. */
- CURLOPT(CURLOPT_PROXYAUTH, CURLOPTTYPE_VALUES, 111),
+ CURLOPT(CURLOPT_PROXYAUTH, CURLOPTTYPE_VALUES, 111),
/* FTP option that changes the timeout, in seconds, associated with
getting a response. This is different from transfer timeout time and
essentially places a demand on the FTP server to acknowledge commands
in a timely manner. */
- CURLOPT(CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOPTTYPE_LONG, 112),
+ CURLOPT(CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOPTTYPE_LONG, 112),
#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
/* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
tell libcurl to resolve names to those IP versions only. This only has
affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
- CURLOPT(CURLOPT_IPRESOLVE, CURLOPTTYPE_VALUES, 113),
+ CURLOPT(CURLOPT_IPRESOLVE, CURLOPTTYPE_VALUES, 113),
/* Set this option to limit the size of a file that will be downloaded from
an HTTP or FTP server.
Note there is also _LARGE version which adds large file support for
platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
- CURLOPT(CURLOPT_MAXFILESIZE, CURLOPTTYPE_LONG, 114),
+ CURLOPT(CURLOPT_MAXFILESIZE, CURLOPTTYPE_LONG, 114),
/* See the comment for INFILESIZE above, but in short, specifies
* the size of the file being uploaded. -1 means unknown.
*/
- CURLOPT(CURLOPT_INFILESIZE_LARGE, CURLOPTTYPE_OFF_T, 115),
+ CURLOPT(CURLOPT_INFILESIZE_LARGE, CURLOPTTYPE_OFF_T, 115),
- /* Sets the continuation offset. There is also a CURLOPTTYPE_LONG version
- * of this; look above for RESUME_FROM.
+ /* Sets the continuation offset. There is also a CURLOPTTYPE_LONG version
+ * of this; look above for RESUME_FROM.
*/
- CURLOPT(CURLOPT_RESUME_FROM_LARGE, CURLOPTTYPE_OFF_T, 116),
+ CURLOPT(CURLOPT_RESUME_FROM_LARGE, CURLOPTTYPE_OFF_T, 116),
/* Sets the maximum size of data that will be downloaded from
* an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
*/
- CURLOPT(CURLOPT_MAXFILESIZE_LARGE, CURLOPTTYPE_OFF_T, 117),
+ CURLOPT(CURLOPT_MAXFILESIZE_LARGE, CURLOPTTYPE_OFF_T, 117),
/* Set this option to the file name of your .netrc file you want libcurl
to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
a poor attempt to find the user's home directory and check for a .netrc
file in there. */
- CURLOPT(CURLOPT_NETRC_FILE, CURLOPTTYPE_STRINGPOINT, 118),
+ CURLOPT(CURLOPT_NETRC_FILE, CURLOPTTYPE_STRINGPOINT, 118),
/* Enable SSL/TLS for FTP, pick one of:
CURLUSESSL_TRY - try using SSL, proceed anyway otherwise
CURLUSESSL_CONTROL - SSL for the control connection or fail
CURLUSESSL_ALL - SSL for all communication or fail
*/
- CURLOPT(CURLOPT_USE_SSL, CURLOPTTYPE_VALUES, 119),
+ CURLOPT(CURLOPT_USE_SSL, CURLOPTTYPE_VALUES, 119),
/* The _LARGE version of the standard POSTFIELDSIZE option */
- CURLOPT(CURLOPT_POSTFIELDSIZE_LARGE, CURLOPTTYPE_OFF_T, 120),
+ CURLOPT(CURLOPT_POSTFIELDSIZE_LARGE, CURLOPTTYPE_OFF_T, 120),
/* Enable/disable the TCP Nagle algorithm */
- CURLOPT(CURLOPT_TCP_NODELAY, CURLOPTTYPE_LONG, 121),
+ CURLOPT(CURLOPT_TCP_NODELAY, CURLOPTTYPE_LONG, 121),
/* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
/* 123 OBSOLETE. Gone in 7.16.0 */
@@ -1521,143 +1521,143 @@ typedef enum {
CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
*/
- CURLOPT(CURLOPT_FTPSSLAUTH, CURLOPTTYPE_VALUES, 129),
+ CURLOPT(CURLOPT_FTPSSLAUTH, CURLOPTTYPE_VALUES, 129),
- CURLOPT(CURLOPT_IOCTLFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 130),
- CURLOPT(CURLOPT_IOCTLDATA, CURLOPTTYPE_CBPOINT, 131),
+ CURLOPT(CURLOPT_IOCTLFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 130),
+ CURLOPT(CURLOPT_IOCTLDATA, CURLOPTTYPE_CBPOINT, 131),
/* 132 OBSOLETE. Gone in 7.16.0 */
/* 133 OBSOLETE. Gone in 7.16.0 */
- /* null-terminated string for pass on to the FTP server when asked for
+ /* null-terminated string for pass on to the FTP server when asked for
"account" info */
- CURLOPT(CURLOPT_FTP_ACCOUNT, CURLOPTTYPE_STRINGPOINT, 134),
+ CURLOPT(CURLOPT_FTP_ACCOUNT, CURLOPTTYPE_STRINGPOINT, 134),
/* feed cookie into cookie engine */
- CURLOPT(CURLOPT_COOKIELIST, CURLOPTTYPE_STRINGPOINT, 135),
+ CURLOPT(CURLOPT_COOKIELIST, CURLOPTTYPE_STRINGPOINT, 135),
/* ignore Content-Length */
- CURLOPT(CURLOPT_IGNORE_CONTENT_LENGTH, CURLOPTTYPE_LONG, 136),
+ CURLOPT(CURLOPT_IGNORE_CONTENT_LENGTH, CURLOPTTYPE_LONG, 136),
/* Set to non-zero to skip the IP address received in a 227 PASV FTP server
response. Typically used for FTP-SSL purposes but is not restricted to
that. libcurl will then instead use the same IP address it used for the
control connection. */
- CURLOPT(CURLOPT_FTP_SKIP_PASV_IP, CURLOPTTYPE_LONG, 137),
+ CURLOPT(CURLOPT_FTP_SKIP_PASV_IP, CURLOPTTYPE_LONG, 137),
/* Select "file method" to use when doing FTP, see the curl_ftpmethod
above. */
- CURLOPT(CURLOPT_FTP_FILEMETHOD, CURLOPTTYPE_VALUES, 138),
+ CURLOPT(CURLOPT_FTP_FILEMETHOD, CURLOPTTYPE_VALUES, 138),
/* Local port number to bind the socket to */
- CURLOPT(CURLOPT_LOCALPORT, CURLOPTTYPE_LONG, 139),
+ CURLOPT(CURLOPT_LOCALPORT, CURLOPTTYPE_LONG, 139),
/* Number of ports to try, including the first one set with LOCALPORT.
Thus, setting it to 1 will make no additional attempts but the first.
*/
- CURLOPT(CURLOPT_LOCALPORTRANGE, CURLOPTTYPE_LONG, 140),
+ CURLOPT(CURLOPT_LOCALPORTRANGE, CURLOPTTYPE_LONG, 140),
/* no transfer, set up connection and let application use the socket by
extracting it with CURLINFO_LASTSOCKET */
- CURLOPT(CURLOPT_CONNECT_ONLY, CURLOPTTYPE_LONG, 141),
+ CURLOPT(CURLOPT_CONNECT_ONLY, CURLOPTTYPE_LONG, 141),
/* Function that will be called to convert from the
network encoding (instead of using the iconv calls in libcurl) */
- CURLOPT(CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 142),
+ CURLOPT(CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 142),
/* Function that will be called to convert to the
network encoding (instead of using the iconv calls in libcurl) */
- CURLOPT(CURLOPT_CONV_TO_NETWORK_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 143),
+ CURLOPT(CURLOPT_CONV_TO_NETWORK_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 143),
/* Function that will be called to convert from UTF8
(instead of using the iconv calls in libcurl)
Note that this is used only for SSL certificate processing */
- CURLOPT(CURLOPT_CONV_FROM_UTF8_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 144),
+ CURLOPT(CURLOPT_CONV_FROM_UTF8_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 144),
/* if the connection proceeds too quickly then need to slow it down */
/* limit-rate: maximum number of bytes per second to send or receive */
- CURLOPT(CURLOPT_MAX_SEND_SPEED_LARGE, CURLOPTTYPE_OFF_T, 145),
- CURLOPT(CURLOPT_MAX_RECV_SPEED_LARGE, CURLOPTTYPE_OFF_T, 146),
+ CURLOPT(CURLOPT_MAX_SEND_SPEED_LARGE, CURLOPTTYPE_OFF_T, 145),
+ CURLOPT(CURLOPT_MAX_RECV_SPEED_LARGE, CURLOPTTYPE_OFF_T, 146),
/* Pointer to command string to send if USER/PASS fails. */
- CURLOPT(CURLOPT_FTP_ALTERNATIVE_TO_USER, CURLOPTTYPE_STRINGPOINT, 147),
+ CURLOPT(CURLOPT_FTP_ALTERNATIVE_TO_USER, CURLOPTTYPE_STRINGPOINT, 147),
/* callback function for setting socket options */
- CURLOPT(CURLOPT_SOCKOPTFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 148),
- CURLOPT(CURLOPT_SOCKOPTDATA, CURLOPTTYPE_CBPOINT, 149),
+ CURLOPT(CURLOPT_SOCKOPTFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 148),
+ CURLOPT(CURLOPT_SOCKOPTDATA, CURLOPTTYPE_CBPOINT, 149),
/* set to 0 to disable session ID re-use for this transfer, default is
enabled (== 1) */
- CURLOPT(CURLOPT_SSL_SESSIONID_CACHE, CURLOPTTYPE_LONG, 150),
+ CURLOPT(CURLOPT_SSL_SESSIONID_CACHE, CURLOPTTYPE_LONG, 150),
/* allowed SSH authentication methods */
- CURLOPT(CURLOPT_SSH_AUTH_TYPES, CURLOPTTYPE_VALUES, 151),
+ CURLOPT(CURLOPT_SSH_AUTH_TYPES, CURLOPTTYPE_VALUES, 151),
/* Used by scp/sftp to do public/private key authentication */
- CURLOPT(CURLOPT_SSH_PUBLIC_KEYFILE, CURLOPTTYPE_STRINGPOINT, 152),
- CURLOPT(CURLOPT_SSH_PRIVATE_KEYFILE, CURLOPTTYPE_STRINGPOINT, 153),
+ CURLOPT(CURLOPT_SSH_PUBLIC_KEYFILE, CURLOPTTYPE_STRINGPOINT, 152),
+ CURLOPT(CURLOPT_SSH_PRIVATE_KEYFILE, CURLOPTTYPE_STRINGPOINT, 153),
/* Send CCC (Clear Command Channel) after authentication */
- CURLOPT(CURLOPT_FTP_SSL_CCC, CURLOPTTYPE_LONG, 154),
+ CURLOPT(CURLOPT_FTP_SSL_CCC, CURLOPTTYPE_LONG, 154),
/* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
- CURLOPT(CURLOPT_TIMEOUT_MS, CURLOPTTYPE_LONG, 155),
- CURLOPT(CURLOPT_CONNECTTIMEOUT_MS, CURLOPTTYPE_LONG, 156),
+ CURLOPT(CURLOPT_TIMEOUT_MS, CURLOPTTYPE_LONG, 155),
+ CURLOPT(CURLOPT_CONNECTTIMEOUT_MS, CURLOPTTYPE_LONG, 156),
/* set to zero to disable the libcurl's decoding and thus pass the raw body
data to the application even when it is encoded/compressed */
- CURLOPT(CURLOPT_HTTP_TRANSFER_DECODING, CURLOPTTYPE_LONG, 157),
- CURLOPT(CURLOPT_HTTP_CONTENT_DECODING, CURLOPTTYPE_LONG, 158),
+ CURLOPT(CURLOPT_HTTP_TRANSFER_DECODING, CURLOPTTYPE_LONG, 157),
+ CURLOPT(CURLOPT_HTTP_CONTENT_DECODING, CURLOPTTYPE_LONG, 158),
/* Permission used when creating new files and directories on the remote
server for protocols that support it, SFTP/SCP/FILE */
- CURLOPT(CURLOPT_NEW_FILE_PERMS, CURLOPTTYPE_LONG, 159),
- CURLOPT(CURLOPT_NEW_DIRECTORY_PERMS, CURLOPTTYPE_LONG, 160),
+ CURLOPT(CURLOPT_NEW_FILE_PERMS, CURLOPTTYPE_LONG, 159),
+ CURLOPT(CURLOPT_NEW_DIRECTORY_PERMS, CURLOPTTYPE_LONG, 160),
/* Set the behaviour of POST when redirecting. Values must be set to one
of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
- CURLOPT(CURLOPT_POSTREDIR, CURLOPTTYPE_VALUES, 161),
+ CURLOPT(CURLOPT_POSTREDIR, CURLOPTTYPE_VALUES, 161),
/* used by scp/sftp to verify the host's public key */
- CURLOPT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, CURLOPTTYPE_STRINGPOINT, 162),
+ CURLOPT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, CURLOPTTYPE_STRINGPOINT, 162),
/* Callback function for opening socket (instead of socket(2)). Optionally,
callback is able change the address or refuse to connect returning
CURL_SOCKET_BAD. The callback should have type
curl_opensocket_callback */
- CURLOPT(CURLOPT_OPENSOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 163),
- CURLOPT(CURLOPT_OPENSOCKETDATA, CURLOPTTYPE_CBPOINT, 164),
+ CURLOPT(CURLOPT_OPENSOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 163),
+ CURLOPT(CURLOPT_OPENSOCKETDATA, CURLOPTTYPE_CBPOINT, 164),
/* POST volatile input fields. */
- CURLOPT(CURLOPT_COPYPOSTFIELDS, CURLOPTTYPE_OBJECTPOINT, 165),
+ CURLOPT(CURLOPT_COPYPOSTFIELDS, CURLOPTTYPE_OBJECTPOINT, 165),
/* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
- CURLOPT(CURLOPT_PROXY_TRANSFER_MODE, CURLOPTTYPE_LONG, 166),
+ CURLOPT(CURLOPT_PROXY_TRANSFER_MODE, CURLOPTTYPE_LONG, 166),
/* Callback function for seeking in the input stream */
- CURLOPT(CURLOPT_SEEKFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 167),
- CURLOPT(CURLOPT_SEEKDATA, CURLOPTTYPE_CBPOINT, 168),
+ CURLOPT(CURLOPT_SEEKFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 167),
+ CURLOPT(CURLOPT_SEEKDATA, CURLOPTTYPE_CBPOINT, 168),
/* CRL file */
- CURLOPT(CURLOPT_CRLFILE, CURLOPTTYPE_STRINGPOINT, 169),
+ CURLOPT(CURLOPT_CRLFILE, CURLOPTTYPE_STRINGPOINT, 169),
/* Issuer certificate */
- CURLOPT(CURLOPT_ISSUERCERT, CURLOPTTYPE_STRINGPOINT, 170),
+ CURLOPT(CURLOPT_ISSUERCERT, CURLOPTTYPE_STRINGPOINT, 170),
/* (IPv6) Address scope */
- CURLOPT(CURLOPT_ADDRESS_SCOPE, CURLOPTTYPE_LONG, 171),
+ CURLOPT(CURLOPT_ADDRESS_SCOPE, CURLOPTTYPE_LONG, 171),
/* Collect certificate chain info and allow it to get retrievable with
CURLINFO_CERTINFO after the transfer is complete. */
- CURLOPT(CURLOPT_CERTINFO, CURLOPTTYPE_LONG, 172),
+ CURLOPT(CURLOPT_CERTINFO, CURLOPTTYPE_LONG, 172),
/* "name" and "pwd" to use when fetching. */
- CURLOPT(CURLOPT_USERNAME, CURLOPTTYPE_STRINGPOINT, 173),
- CURLOPT(CURLOPT_PASSWORD, CURLOPTTYPE_STRINGPOINT, 174),
+ CURLOPT(CURLOPT_USERNAME, CURLOPTTYPE_STRINGPOINT, 173),
+ CURLOPT(CURLOPT_PASSWORD, CURLOPTTYPE_STRINGPOINT, 174),
/* "name" and "pwd" to use with Proxy when fetching. */
- CURLOPT(CURLOPT_PROXYUSERNAME, CURLOPTTYPE_STRINGPOINT, 175),
- CURLOPT(CURLOPT_PROXYPASSWORD, CURLOPTTYPE_STRINGPOINT, 176),
+ CURLOPT(CURLOPT_PROXYUSERNAME, CURLOPTTYPE_STRINGPOINT, 175),
+ CURLOPT(CURLOPT_PROXYPASSWORD, CURLOPTTYPE_STRINGPOINT, 176),
/* Comma separated list of hostnames defining no-proxy zones. These should
match both hostnames directly, and hostnames within a domain. For
@@ -1666,103 +1666,103 @@ typedef enum {
implementations of this, .local.com will be considered to be the same as
local.com. A single * is the only valid wildcard, and effectively
disables the use of proxy. */
- CURLOPT(CURLOPT_NOPROXY, CURLOPTTYPE_STRINGPOINT, 177),
+ CURLOPT(CURLOPT_NOPROXY, CURLOPTTYPE_STRINGPOINT, 177),
/* block size for TFTP transfers */
- CURLOPT(CURLOPT_TFTP_BLKSIZE, CURLOPTTYPE_LONG, 178),
+ CURLOPT(CURLOPT_TFTP_BLKSIZE, CURLOPTTYPE_LONG, 178),
/* Socks Service */
- /* DEPRECATED, do not use! */
- CURLOPT(CURLOPT_SOCKS5_GSSAPI_SERVICE, CURLOPTTYPE_STRINGPOINT, 179),
+ /* DEPRECATED, do not use! */
+ CURLOPT(CURLOPT_SOCKS5_GSSAPI_SERVICE, CURLOPTTYPE_STRINGPOINT, 179),
/* Socks Service */
- CURLOPT(CURLOPT_SOCKS5_GSSAPI_NEC, CURLOPTTYPE_LONG, 180),
+ CURLOPT(CURLOPT_SOCKS5_GSSAPI_NEC, CURLOPTTYPE_LONG, 180),
/* set the bitmask for the protocols that are allowed to be used for the
transfer, which thus helps the app which takes URLs from users or other
external inputs and want to restrict what protocol(s) to deal
with. Defaults to CURLPROTO_ALL. */
- CURLOPT(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181),
+ CURLOPT(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181),
/* set the bitmask for the protocols that libcurl is allowed to follow to,
as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
to be set in both bitmasks to be allowed to get redirected to. */
- CURLOPT(CURLOPT_REDIR_PROTOCOLS, CURLOPTTYPE_LONG, 182),
+ CURLOPT(CURLOPT_REDIR_PROTOCOLS, CURLOPTTYPE_LONG, 182),
/* set the SSH knownhost file name to use */
- CURLOPT(CURLOPT_SSH_KNOWNHOSTS, CURLOPTTYPE_STRINGPOINT, 183),
+ CURLOPT(CURLOPT_SSH_KNOWNHOSTS, CURLOPTTYPE_STRINGPOINT, 183),
/* set the SSH host key callback, must point to a curl_sshkeycallback
function */
- CURLOPT(CURLOPT_SSH_KEYFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 184),
+ CURLOPT(CURLOPT_SSH_KEYFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 184),
/* set the SSH host key callback custom pointer */
- CURLOPT(CURLOPT_SSH_KEYDATA, CURLOPTTYPE_CBPOINT, 185),
+ CURLOPT(CURLOPT_SSH_KEYDATA, CURLOPTTYPE_CBPOINT, 185),
/* set the SMTP mail originator */
- CURLOPT(CURLOPT_MAIL_FROM, CURLOPTTYPE_STRINGPOINT, 186),
+ CURLOPT(CURLOPT_MAIL_FROM, CURLOPTTYPE_STRINGPOINT, 186),
/* set the list of SMTP mail receiver(s) */
- CURLOPT(CURLOPT_MAIL_RCPT, CURLOPTTYPE_SLISTPOINT, 187),
+ CURLOPT(CURLOPT_MAIL_RCPT, CURLOPTTYPE_SLISTPOINT, 187),
/* FTP: send PRET before PASV */
- CURLOPT(CURLOPT_FTP_USE_PRET, CURLOPTTYPE_LONG, 188),
+ CURLOPT(CURLOPT_FTP_USE_PRET, CURLOPTTYPE_LONG, 188),
/* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
- CURLOPT(CURLOPT_RTSP_REQUEST, CURLOPTTYPE_VALUES, 189),
+ CURLOPT(CURLOPT_RTSP_REQUEST, CURLOPTTYPE_VALUES, 189),
/* The RTSP session identifier */
- CURLOPT(CURLOPT_RTSP_SESSION_ID, CURLOPTTYPE_STRINGPOINT, 190),
+ CURLOPT(CURLOPT_RTSP_SESSION_ID, CURLOPTTYPE_STRINGPOINT, 190),
/* The RTSP stream URI */
- CURLOPT(CURLOPT_RTSP_STREAM_URI, CURLOPTTYPE_STRINGPOINT, 191),
+ CURLOPT(CURLOPT_RTSP_STREAM_URI, CURLOPTTYPE_STRINGPOINT, 191),
/* The Transport: header to use in RTSP requests */
- CURLOPT(CURLOPT_RTSP_TRANSPORT, CURLOPTTYPE_STRINGPOINT, 192),
+ CURLOPT(CURLOPT_RTSP_TRANSPORT, CURLOPTTYPE_STRINGPOINT, 192),
/* Manually initialize the client RTSP CSeq for this handle */
- CURLOPT(CURLOPT_RTSP_CLIENT_CSEQ, CURLOPTTYPE_LONG, 193),
+ CURLOPT(CURLOPT_RTSP_CLIENT_CSEQ, CURLOPTTYPE_LONG, 193),
/* Manually initialize the server RTSP CSeq for this handle */
- CURLOPT(CURLOPT_RTSP_SERVER_CSEQ, CURLOPTTYPE_LONG, 194),
+ CURLOPT(CURLOPT_RTSP_SERVER_CSEQ, CURLOPTTYPE_LONG, 194),
/* The stream to pass to INTERLEAVEFUNCTION. */
- CURLOPT(CURLOPT_INTERLEAVEDATA, CURLOPTTYPE_CBPOINT, 195),
+ CURLOPT(CURLOPT_INTERLEAVEDATA, CURLOPTTYPE_CBPOINT, 195),
/* Let the application define a custom write method for RTP data */
- CURLOPT(CURLOPT_INTERLEAVEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 196),
+ CURLOPT(CURLOPT_INTERLEAVEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 196),
/* Turn on wildcard matching */
- CURLOPT(CURLOPT_WILDCARDMATCH, CURLOPTTYPE_LONG, 197),
+ CURLOPT(CURLOPT_WILDCARDMATCH, CURLOPTTYPE_LONG, 197),
/* Directory matching callback called before downloading of an
individual file (chunk) started */
- CURLOPT(CURLOPT_CHUNK_BGN_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 198),
+ CURLOPT(CURLOPT_CHUNK_BGN_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 198),
/* Directory matching callback called after the file (chunk)
was downloaded, or skipped */
- CURLOPT(CURLOPT_CHUNK_END_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 199),
+ CURLOPT(CURLOPT_CHUNK_END_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 199),
/* Change match (fnmatch-like) callback for wildcard matching */
- CURLOPT(CURLOPT_FNMATCH_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 200),
+ CURLOPT(CURLOPT_FNMATCH_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 200),
/* Let the application define custom chunk data pointer */
- CURLOPT(CURLOPT_CHUNK_DATA, CURLOPTTYPE_CBPOINT, 201),
+ CURLOPT(CURLOPT_CHUNK_DATA, CURLOPTTYPE_CBPOINT, 201),
/* FNMATCH_FUNCTION user pointer */
- CURLOPT(CURLOPT_FNMATCH_DATA, CURLOPTTYPE_CBPOINT, 202),
+ CURLOPT(CURLOPT_FNMATCH_DATA, CURLOPTTYPE_CBPOINT, 202),
/* send linked-list of name:port:address sets */
- CURLOPT(CURLOPT_RESOLVE, CURLOPTTYPE_SLISTPOINT, 203),
+ CURLOPT(CURLOPT_RESOLVE, CURLOPTTYPE_SLISTPOINT, 203),
/* Set a username for authenticated TLS */
- CURLOPT(CURLOPT_TLSAUTH_USERNAME, CURLOPTTYPE_STRINGPOINT, 204),
+ CURLOPT(CURLOPT_TLSAUTH_USERNAME, CURLOPTTYPE_STRINGPOINT, 204),
/* Set a password for authenticated TLS */
- CURLOPT(CURLOPT_TLSAUTH_PASSWORD, CURLOPTTYPE_STRINGPOINT, 205),
+ CURLOPT(CURLOPT_TLSAUTH_PASSWORD, CURLOPTTYPE_STRINGPOINT, 205),
/* Set authentication type for authenticated TLS */
- CURLOPT(CURLOPT_TLSAUTH_TYPE, CURLOPTTYPE_STRINGPOINT, 206),
+ CURLOPT(CURLOPT_TLSAUTH_TYPE, CURLOPTTYPE_STRINGPOINT, 206),
/* Set to 1 to enable the "TE:" header in HTTP requests to ask for
compressed transfer-encoded responses. Set to 0 to disable the use of TE:
@@ -1774,305 +1774,305 @@ typedef enum {
option is set to 1.
*/
- CURLOPT(CURLOPT_TRANSFER_ENCODING, CURLOPTTYPE_LONG, 207),
+ CURLOPT(CURLOPT_TRANSFER_ENCODING, CURLOPTTYPE_LONG, 207),
/* Callback function for closing socket (instead of close(2)). The callback
should have type curl_closesocket_callback */
- CURLOPT(CURLOPT_CLOSESOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 208),
- CURLOPT(CURLOPT_CLOSESOCKETDATA, CURLOPTTYPE_CBPOINT, 209),
+ CURLOPT(CURLOPT_CLOSESOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 208),
+ CURLOPT(CURLOPT_CLOSESOCKETDATA, CURLOPTTYPE_CBPOINT, 209),
/* allow GSSAPI credential delegation */
- CURLOPT(CURLOPT_GSSAPI_DELEGATION, CURLOPTTYPE_VALUES, 210),
+ CURLOPT(CURLOPT_GSSAPI_DELEGATION, CURLOPTTYPE_VALUES, 210),
/* Set the name servers to use for DNS resolution */
- CURLOPT(CURLOPT_DNS_SERVERS, CURLOPTTYPE_STRINGPOINT, 211),
+ CURLOPT(CURLOPT_DNS_SERVERS, CURLOPTTYPE_STRINGPOINT, 211),
/* Time-out accept operations (currently for FTP only) after this amount
of milliseconds. */
- CURLOPT(CURLOPT_ACCEPTTIMEOUT_MS, CURLOPTTYPE_LONG, 212),
+ CURLOPT(CURLOPT_ACCEPTTIMEOUT_MS, CURLOPTTYPE_LONG, 212),
/* Set TCP keepalive */
- CURLOPT(CURLOPT_TCP_KEEPALIVE, CURLOPTTYPE_LONG, 213),
+ CURLOPT(CURLOPT_TCP_KEEPALIVE, CURLOPTTYPE_LONG, 213),
/* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
- CURLOPT(CURLOPT_TCP_KEEPIDLE, CURLOPTTYPE_LONG, 214),
- CURLOPT(CURLOPT_TCP_KEEPINTVL, CURLOPTTYPE_LONG, 215),
+ CURLOPT(CURLOPT_TCP_KEEPIDLE, CURLOPTTYPE_LONG, 214),
+ CURLOPT(CURLOPT_TCP_KEEPINTVL, CURLOPTTYPE_LONG, 215),
/* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
- CURLOPT(CURLOPT_SSL_OPTIONS, CURLOPTTYPE_VALUES, 216),
+ CURLOPT(CURLOPT_SSL_OPTIONS, CURLOPTTYPE_VALUES, 216),
/* Set the SMTP auth originator */
- CURLOPT(CURLOPT_MAIL_AUTH, CURLOPTTYPE_STRINGPOINT, 217),
+ CURLOPT(CURLOPT_MAIL_AUTH, CURLOPTTYPE_STRINGPOINT, 217),
/* Enable/disable SASL initial response */
- CURLOPT(CURLOPT_SASL_IR, CURLOPTTYPE_LONG, 218),
+ CURLOPT(CURLOPT_SASL_IR, CURLOPTTYPE_LONG, 218),
/* Function that will be called instead of the internal progress display
* function. This function should be defined as the curl_xferinfo_callback
* prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
- CURLOPT(CURLOPT_XFERINFOFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 219),
+ CURLOPT(CURLOPT_XFERINFOFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 219),
/* The XOAUTH2 bearer token */
- CURLOPT(CURLOPT_XOAUTH2_BEARER, CURLOPTTYPE_STRINGPOINT, 220),
+ CURLOPT(CURLOPT_XOAUTH2_BEARER, CURLOPTTYPE_STRINGPOINT, 220),
/* Set the interface string to use as outgoing network
* interface for DNS requests.
* Only supported by the c-ares DNS backend */
- CURLOPT(CURLOPT_DNS_INTERFACE, CURLOPTTYPE_STRINGPOINT, 221),
+ CURLOPT(CURLOPT_DNS_INTERFACE, CURLOPTTYPE_STRINGPOINT, 221),
/* Set the local IPv4 address to use for outgoing DNS requests.
* Only supported by the c-ares DNS backend */
- CURLOPT(CURLOPT_DNS_LOCAL_IP4, CURLOPTTYPE_STRINGPOINT, 222),
+ CURLOPT(CURLOPT_DNS_LOCAL_IP4, CURLOPTTYPE_STRINGPOINT, 222),
/* Set the local IPv6 address to use for outgoing DNS requests.
* Only supported by the c-ares DNS backend */
- CURLOPT(CURLOPT_DNS_LOCAL_IP6, CURLOPTTYPE_STRINGPOINT, 223),
+ CURLOPT(CURLOPT_DNS_LOCAL_IP6, CURLOPTTYPE_STRINGPOINT, 223),
/* Set authentication options directly */
- CURLOPT(CURLOPT_LOGIN_OPTIONS, CURLOPTTYPE_STRINGPOINT, 224),
+ CURLOPT(CURLOPT_LOGIN_OPTIONS, CURLOPTTYPE_STRINGPOINT, 224),
/* Enable/disable TLS NPN extension (http2 over ssl might fail without) */
- CURLOPT(CURLOPT_SSL_ENABLE_NPN, CURLOPTTYPE_LONG, 225),
+ CURLOPT(CURLOPT_SSL_ENABLE_NPN, CURLOPTTYPE_LONG, 225),
/* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */
- CURLOPT(CURLOPT_SSL_ENABLE_ALPN, CURLOPTTYPE_LONG, 226),
+ CURLOPT(CURLOPT_SSL_ENABLE_ALPN, CURLOPTTYPE_LONG, 226),
/* Time to wait for a response to a HTTP request containing an
* Expect: 100-continue header before sending the data anyway. */
- CURLOPT(CURLOPT_EXPECT_100_TIMEOUT_MS, CURLOPTTYPE_LONG, 227),
+ CURLOPT(CURLOPT_EXPECT_100_TIMEOUT_MS, CURLOPTTYPE_LONG, 227),
/* This points to a linked list of headers used for proxy requests only,
struct curl_slist kind */
- CURLOPT(CURLOPT_PROXYHEADER, CURLOPTTYPE_SLISTPOINT, 228),
+ CURLOPT(CURLOPT_PROXYHEADER, CURLOPTTYPE_SLISTPOINT, 228),
/* Pass in a bitmask of "header options" */
- CURLOPT(CURLOPT_HEADEROPT, CURLOPTTYPE_VALUES, 229),
+ CURLOPT(CURLOPT_HEADEROPT, CURLOPTTYPE_VALUES, 229),
/* The public key in DER form used to validate the peer public key
this option is used only if SSL_VERIFYPEER is true */
- CURLOPT(CURLOPT_PINNEDPUBLICKEY, CURLOPTTYPE_STRINGPOINT, 230),
+ CURLOPT(CURLOPT_PINNEDPUBLICKEY, CURLOPTTYPE_STRINGPOINT, 230),
/* Path to Unix domain socket */
- CURLOPT(CURLOPT_UNIX_SOCKET_PATH, CURLOPTTYPE_STRINGPOINT, 231),
+ CURLOPT(CURLOPT_UNIX_SOCKET_PATH, CURLOPTTYPE_STRINGPOINT, 231),
/* Set if we should verify the certificate status. */
- CURLOPT(CURLOPT_SSL_VERIFYSTATUS, CURLOPTTYPE_LONG, 232),
+ CURLOPT(CURLOPT_SSL_VERIFYSTATUS, CURLOPTTYPE_LONG, 232),
/* Set if we should enable TLS false start. */
- CURLOPT(CURLOPT_SSL_FALSESTART, CURLOPTTYPE_LONG, 233),
+ CURLOPT(CURLOPT_SSL_FALSESTART, CURLOPTTYPE_LONG, 233),
/* Do not squash dot-dot sequences */
- CURLOPT(CURLOPT_PATH_AS_IS, CURLOPTTYPE_LONG, 234),
+ CURLOPT(CURLOPT_PATH_AS_IS, CURLOPTTYPE_LONG, 234),
/* Proxy Service Name */
- CURLOPT(CURLOPT_PROXY_SERVICE_NAME, CURLOPTTYPE_STRINGPOINT, 235),
+ CURLOPT(CURLOPT_PROXY_SERVICE_NAME, CURLOPTTYPE_STRINGPOINT, 235),
/* Service Name */
- CURLOPT(CURLOPT_SERVICE_NAME, CURLOPTTYPE_STRINGPOINT, 236),
+ CURLOPT(CURLOPT_SERVICE_NAME, CURLOPTTYPE_STRINGPOINT, 236),
/* Wait/don't wait for pipe/mutex to clarify */
- CURLOPT(CURLOPT_PIPEWAIT, CURLOPTTYPE_LONG, 237),
+ CURLOPT(CURLOPT_PIPEWAIT, CURLOPTTYPE_LONG, 237),
/* Set the protocol used when curl is given a URL without a protocol */
- CURLOPT(CURLOPT_DEFAULT_PROTOCOL, CURLOPTTYPE_STRINGPOINT, 238),
+ CURLOPT(CURLOPT_DEFAULT_PROTOCOL, CURLOPTTYPE_STRINGPOINT, 238),
/* Set stream weight, 1 - 256 (default is 16) */
- CURLOPT(CURLOPT_STREAM_WEIGHT, CURLOPTTYPE_LONG, 239),
+ CURLOPT(CURLOPT_STREAM_WEIGHT, CURLOPTTYPE_LONG, 239),
/* Set stream dependency on another CURL handle */
- CURLOPT(CURLOPT_STREAM_DEPENDS, CURLOPTTYPE_OBJECTPOINT, 240),
+ CURLOPT(CURLOPT_STREAM_DEPENDS, CURLOPTTYPE_OBJECTPOINT, 240),
/* Set E-xclusive stream dependency on another CURL handle */
- CURLOPT(CURLOPT_STREAM_DEPENDS_E, CURLOPTTYPE_OBJECTPOINT, 241),
+ CURLOPT(CURLOPT_STREAM_DEPENDS_E, CURLOPTTYPE_OBJECTPOINT, 241),
/* Do not send any tftp option requests to the server */
- CURLOPT(CURLOPT_TFTP_NO_OPTIONS, CURLOPTTYPE_LONG, 242),
+ CURLOPT(CURLOPT_TFTP_NO_OPTIONS, CURLOPTTYPE_LONG, 242),
/* Linked-list of host:port:connect-to-host:connect-to-port,
overrides the URL's host:port (only for the network layer) */
- CURLOPT(CURLOPT_CONNECT_TO, CURLOPTTYPE_SLISTPOINT, 243),
+ CURLOPT(CURLOPT_CONNECT_TO, CURLOPTTYPE_SLISTPOINT, 243),
/* Set TCP Fast Open */
- CURLOPT(CURLOPT_TCP_FASTOPEN, CURLOPTTYPE_LONG, 244),
+ CURLOPT(CURLOPT_TCP_FASTOPEN, CURLOPTTYPE_LONG, 244),
/* Continue to send data if the server responds early with an
* HTTP status code >= 300 */
- CURLOPT(CURLOPT_KEEP_SENDING_ON_ERROR, CURLOPTTYPE_LONG, 245),
+ CURLOPT(CURLOPT_KEEP_SENDING_ON_ERROR, CURLOPTTYPE_LONG, 245),
/* The CApath or CAfile used to validate the proxy certificate
this option is used only if PROXY_SSL_VERIFYPEER is true */
- CURLOPT(CURLOPT_PROXY_CAINFO, CURLOPTTYPE_STRINGPOINT, 246),
+ CURLOPT(CURLOPT_PROXY_CAINFO, CURLOPTTYPE_STRINGPOINT, 246),
/* The CApath directory used to validate the proxy certificate
this option is used only if PROXY_SSL_VERIFYPEER is true */
- CURLOPT(CURLOPT_PROXY_CAPATH, CURLOPTTYPE_STRINGPOINT, 247),
+ CURLOPT(CURLOPT_PROXY_CAPATH, CURLOPTTYPE_STRINGPOINT, 247),
/* Set if we should verify the proxy in ssl handshake,
set 1 to verify. */
- CURLOPT(CURLOPT_PROXY_SSL_VERIFYPEER, CURLOPTTYPE_LONG, 248),
+ CURLOPT(CURLOPT_PROXY_SSL_VERIFYPEER, CURLOPTTYPE_LONG, 248),
/* Set if we should verify the Common name from the proxy certificate in ssl
* handshake, set 1 to check existence, 2 to ensure that it matches
* the provided hostname. */
- CURLOPT(CURLOPT_PROXY_SSL_VERIFYHOST, CURLOPTTYPE_LONG, 249),
+ CURLOPT(CURLOPT_PROXY_SSL_VERIFYHOST, CURLOPTTYPE_LONG, 249),
/* What version to specifically try to use for proxy.
See CURL_SSLVERSION defines below. */
- CURLOPT(CURLOPT_PROXY_SSLVERSION, CURLOPTTYPE_VALUES, 250),
+ CURLOPT(CURLOPT_PROXY_SSLVERSION, CURLOPTTYPE_VALUES, 250),
/* Set a username for authenticated TLS for proxy */
- CURLOPT(CURLOPT_PROXY_TLSAUTH_USERNAME, CURLOPTTYPE_STRINGPOINT, 251),
+ CURLOPT(CURLOPT_PROXY_TLSAUTH_USERNAME, CURLOPTTYPE_STRINGPOINT, 251),
/* Set a password for authenticated TLS for proxy */
- CURLOPT(CURLOPT_PROXY_TLSAUTH_PASSWORD, CURLOPTTYPE_STRINGPOINT, 252),
+ CURLOPT(CURLOPT_PROXY_TLSAUTH_PASSWORD, CURLOPTTYPE_STRINGPOINT, 252),
/* Set authentication type for authenticated TLS for proxy */
- CURLOPT(CURLOPT_PROXY_TLSAUTH_TYPE, CURLOPTTYPE_STRINGPOINT, 253),
+ CURLOPT(CURLOPT_PROXY_TLSAUTH_TYPE, CURLOPTTYPE_STRINGPOINT, 253),
/* name of the file keeping your private SSL-certificate for proxy */
- CURLOPT(CURLOPT_PROXY_SSLCERT, CURLOPTTYPE_STRINGPOINT, 254),
+ CURLOPT(CURLOPT_PROXY_SSLCERT, CURLOPTTYPE_STRINGPOINT, 254),
/* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") for
proxy */
- CURLOPT(CURLOPT_PROXY_SSLCERTTYPE, CURLOPTTYPE_STRINGPOINT, 255),
+ CURLOPT(CURLOPT_PROXY_SSLCERTTYPE, CURLOPTTYPE_STRINGPOINT, 255),
/* name of the file keeping your private SSL-key for proxy */
- CURLOPT(CURLOPT_PROXY_SSLKEY, CURLOPTTYPE_STRINGPOINT, 256),
+ CURLOPT(CURLOPT_PROXY_SSLKEY, CURLOPTTYPE_STRINGPOINT, 256),
/* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") for
proxy */
- CURLOPT(CURLOPT_PROXY_SSLKEYTYPE, CURLOPTTYPE_STRINGPOINT, 257),
+ CURLOPT(CURLOPT_PROXY_SSLKEYTYPE, CURLOPTTYPE_STRINGPOINT, 257),
/* password for the SSL private key for proxy */
- CURLOPT(CURLOPT_PROXY_KEYPASSWD, CURLOPTTYPE_STRINGPOINT, 258),
+ CURLOPT(CURLOPT_PROXY_KEYPASSWD, CURLOPTTYPE_STRINGPOINT, 258),
/* Specify which SSL ciphers to use for proxy */
- CURLOPT(CURLOPT_PROXY_SSL_CIPHER_LIST, CURLOPTTYPE_STRINGPOINT, 259),
+ CURLOPT(CURLOPT_PROXY_SSL_CIPHER_LIST, CURLOPTTYPE_STRINGPOINT, 259),
/* CRL file for proxy */
- CURLOPT(CURLOPT_PROXY_CRLFILE, CURLOPTTYPE_STRINGPOINT, 260),
+ CURLOPT(CURLOPT_PROXY_CRLFILE, CURLOPTTYPE_STRINGPOINT, 260),
/* Enable/disable specific SSL features with a bitmask for proxy, see
CURLSSLOPT_* */
- CURLOPT(CURLOPT_PROXY_SSL_OPTIONS, CURLOPTTYPE_LONG, 261),
+ CURLOPT(CURLOPT_PROXY_SSL_OPTIONS, CURLOPTTYPE_LONG, 261),
/* Name of pre proxy to use. */
- CURLOPT(CURLOPT_PRE_PROXY, CURLOPTTYPE_STRINGPOINT, 262),
+ CURLOPT(CURLOPT_PRE_PROXY, CURLOPTTYPE_STRINGPOINT, 262),
/* The public key in DER form used to validate the proxy public key
this option is used only if PROXY_SSL_VERIFYPEER is true */
- CURLOPT(CURLOPT_PROXY_PINNEDPUBLICKEY, CURLOPTTYPE_STRINGPOINT, 263),
+ CURLOPT(CURLOPT_PROXY_PINNEDPUBLICKEY, CURLOPTTYPE_STRINGPOINT, 263),
/* Path to an abstract Unix domain socket */
- CURLOPT(CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOPTTYPE_STRINGPOINT, 264),
+ CURLOPT(CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOPTTYPE_STRINGPOINT, 264),
/* Suppress proxy CONNECT response headers from user callbacks */
- CURLOPT(CURLOPT_SUPPRESS_CONNECT_HEADERS, CURLOPTTYPE_LONG, 265),
+ CURLOPT(CURLOPT_SUPPRESS_CONNECT_HEADERS, CURLOPTTYPE_LONG, 265),
/* The request target, instead of extracted from the URL */
- CURLOPT(CURLOPT_REQUEST_TARGET, CURLOPTTYPE_STRINGPOINT, 266),
+ CURLOPT(CURLOPT_REQUEST_TARGET, CURLOPTTYPE_STRINGPOINT, 266),
/* bitmask of allowed auth methods for connections to SOCKS5 proxies */
- CURLOPT(CURLOPT_SOCKS5_AUTH, CURLOPTTYPE_LONG, 267),
+ CURLOPT(CURLOPT_SOCKS5_AUTH, CURLOPTTYPE_LONG, 267),
/* Enable/disable SSH compression */
- CURLOPT(CURLOPT_SSH_COMPRESSION, CURLOPTTYPE_LONG, 268),
+ CURLOPT(CURLOPT_SSH_COMPRESSION, CURLOPTTYPE_LONG, 268),
/* Post MIME data. */
- CURLOPT(CURLOPT_MIMEPOST, CURLOPTTYPE_OBJECTPOINT, 269),
+ CURLOPT(CURLOPT_MIMEPOST, CURLOPTTYPE_OBJECTPOINT, 269),
/* Time to use with the CURLOPT_TIMECONDITION. Specified in number of
seconds since 1 Jan 1970. */
- CURLOPT(CURLOPT_TIMEVALUE_LARGE, CURLOPTTYPE_OFF_T, 270),
+ CURLOPT(CURLOPT_TIMEVALUE_LARGE, CURLOPTTYPE_OFF_T, 270),
/* Head start in milliseconds to give happy eyeballs. */
- CURLOPT(CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, CURLOPTTYPE_LONG, 271),
+ CURLOPT(CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, CURLOPTTYPE_LONG, 271),
/* Function that will be called before a resolver request is made */
- CURLOPT(CURLOPT_RESOLVER_START_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 272),
+ CURLOPT(CURLOPT_RESOLVER_START_FUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 272),
/* User data to pass to the resolver start callback. */
- CURLOPT(CURLOPT_RESOLVER_START_DATA, CURLOPTTYPE_CBPOINT, 273),
+ CURLOPT(CURLOPT_RESOLVER_START_DATA, CURLOPTTYPE_CBPOINT, 273),
/* send HAProxy PROXY protocol header? */
- CURLOPT(CURLOPT_HAPROXYPROTOCOL, CURLOPTTYPE_LONG, 274),
+ CURLOPT(CURLOPT_HAPROXYPROTOCOL, CURLOPTTYPE_LONG, 274),
/* shuffle addresses before use when DNS returns multiple */
- CURLOPT(CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOPTTYPE_LONG, 275),
+ CURLOPT(CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOPTTYPE_LONG, 275),
/* Specify which TLS 1.3 ciphers suites to use */
- CURLOPT(CURLOPT_TLS13_CIPHERS, CURLOPTTYPE_STRINGPOINT, 276),
- CURLOPT(CURLOPT_PROXY_TLS13_CIPHERS, CURLOPTTYPE_STRINGPOINT, 277),
+ CURLOPT(CURLOPT_TLS13_CIPHERS, CURLOPTTYPE_STRINGPOINT, 276),
+ CURLOPT(CURLOPT_PROXY_TLS13_CIPHERS, CURLOPTTYPE_STRINGPOINT, 277),
/* Disallow specifying username/login in URL. */
- CURLOPT(CURLOPT_DISALLOW_USERNAME_IN_URL, CURLOPTTYPE_LONG, 278),
+ CURLOPT(CURLOPT_DISALLOW_USERNAME_IN_URL, CURLOPTTYPE_LONG, 278),
/* DNS-over-HTTPS URL */
- CURLOPT(CURLOPT_DOH_URL, CURLOPTTYPE_STRINGPOINT, 279),
+ CURLOPT(CURLOPT_DOH_URL, CURLOPTTYPE_STRINGPOINT, 279),
/* Preferred buffer size to use for uploads */
- CURLOPT(CURLOPT_UPLOAD_BUFFERSIZE, CURLOPTTYPE_LONG, 280),
+ CURLOPT(CURLOPT_UPLOAD_BUFFERSIZE, CURLOPTTYPE_LONG, 280),
/* Time in ms between connection upkeep calls for long-lived connections. */
- CURLOPT(CURLOPT_UPKEEP_INTERVAL_MS, CURLOPTTYPE_LONG, 281),
+ CURLOPT(CURLOPT_UPKEEP_INTERVAL_MS, CURLOPTTYPE_LONG, 281),
/* Specify URL using CURL URL API. */
- CURLOPT(CURLOPT_CURLU, CURLOPTTYPE_OBJECTPOINT, 282),
+ CURLOPT(CURLOPT_CURLU, CURLOPTTYPE_OBJECTPOINT, 282),
/* add trailing data just after no more data is available */
- CURLOPT(CURLOPT_TRAILERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 283),
+ CURLOPT(CURLOPT_TRAILERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 283),
/* pointer to be passed to HTTP_TRAILER_FUNCTION */
- CURLOPT(CURLOPT_TRAILERDATA, CURLOPTTYPE_CBPOINT, 284),
+ CURLOPT(CURLOPT_TRAILERDATA, CURLOPTTYPE_CBPOINT, 284),
/* set this to 1L to allow HTTP/0.9 responses or 0L to disallow */
- CURLOPT(CURLOPT_HTTP09_ALLOWED, CURLOPTTYPE_LONG, 285),
+ CURLOPT(CURLOPT_HTTP09_ALLOWED, CURLOPTTYPE_LONG, 285),
/* alt-svc control bitmask */
- CURLOPT(CURLOPT_ALTSVC_CTRL, CURLOPTTYPE_LONG, 286),
+ CURLOPT(CURLOPT_ALTSVC_CTRL, CURLOPTTYPE_LONG, 286),
/* alt-svc cache file name to possibly read from/write to */
- CURLOPT(CURLOPT_ALTSVC, CURLOPTTYPE_STRINGPOINT, 287),
+ CURLOPT(CURLOPT_ALTSVC, CURLOPTTYPE_STRINGPOINT, 287),
/* maximum age of a connection to consider it for reuse (in seconds) */
- CURLOPT(CURLOPT_MAXAGE_CONN, CURLOPTTYPE_LONG, 288),
+ CURLOPT(CURLOPT_MAXAGE_CONN, CURLOPTTYPE_LONG, 288),
/* SASL authorisation identity */
- CURLOPT(CURLOPT_SASL_AUTHZID, CURLOPTTYPE_STRINGPOINT, 289),
-
- /* allow RCPT TO command to fail for some recipients */
- CURLOPT(CURLOPT_MAIL_RCPT_ALLLOWFAILS, CURLOPTTYPE_LONG, 290),
-
- /* the private SSL-certificate as a "blob" */
- CURLOPT(CURLOPT_SSLCERT_BLOB, CURLOPTTYPE_BLOB, 291),
- CURLOPT(CURLOPT_SSLKEY_BLOB, CURLOPTTYPE_BLOB, 292),
- CURLOPT(CURLOPT_PROXY_SSLCERT_BLOB, CURLOPTTYPE_BLOB, 293),
- CURLOPT(CURLOPT_PROXY_SSLKEY_BLOB, CURLOPTTYPE_BLOB, 294),
- CURLOPT(CURLOPT_ISSUERCERT_BLOB, CURLOPTTYPE_BLOB, 295),
-
- /* Issuer certificate for proxy */
- CURLOPT(CURLOPT_PROXY_ISSUERCERT, CURLOPTTYPE_STRINGPOINT, 296),
- CURLOPT(CURLOPT_PROXY_ISSUERCERT_BLOB, CURLOPTTYPE_BLOB, 297),
-
- /* the EC curves requested by the TLS client (RFC 8422, 5.1);
- * OpenSSL support via 'set_groups'/'set_curves':
- * https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set1_groups.html
- */
- CURLOPT(CURLOPT_SSL_EC_CURVES, CURLOPTTYPE_STRINGPOINT, 298),
-
- /* HSTS bitmask */
- CURLOPT(CURLOPT_HSTS_CTRL, CURLOPTTYPE_LONG, 299),
- /* HSTS file name */
- CURLOPT(CURLOPT_HSTS, CURLOPTTYPE_STRINGPOINT, 300),
-
- /* HSTS read callback */
- CURLOPT(CURLOPT_HSTSREADFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 301),
- CURLOPT(CURLOPT_HSTSREADDATA, CURLOPTTYPE_CBPOINT, 302),
-
- /* HSTS write callback */
- CURLOPT(CURLOPT_HSTSWRITEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 303),
- CURLOPT(CURLOPT_HSTSWRITEDATA, CURLOPTTYPE_CBPOINT, 304),
-
+ CURLOPT(CURLOPT_SASL_AUTHZID, CURLOPTTYPE_STRINGPOINT, 289),
+
+ /* allow RCPT TO command to fail for some recipients */
+ CURLOPT(CURLOPT_MAIL_RCPT_ALLLOWFAILS, CURLOPTTYPE_LONG, 290),
+
+ /* the private SSL-certificate as a "blob" */
+ CURLOPT(CURLOPT_SSLCERT_BLOB, CURLOPTTYPE_BLOB, 291),
+ CURLOPT(CURLOPT_SSLKEY_BLOB, CURLOPTTYPE_BLOB, 292),
+ CURLOPT(CURLOPT_PROXY_SSLCERT_BLOB, CURLOPTTYPE_BLOB, 293),
+ CURLOPT(CURLOPT_PROXY_SSLKEY_BLOB, CURLOPTTYPE_BLOB, 294),
+ CURLOPT(CURLOPT_ISSUERCERT_BLOB, CURLOPTTYPE_BLOB, 295),
+
+ /* Issuer certificate for proxy */
+ CURLOPT(CURLOPT_PROXY_ISSUERCERT, CURLOPTTYPE_STRINGPOINT, 296),
+ CURLOPT(CURLOPT_PROXY_ISSUERCERT_BLOB, CURLOPTTYPE_BLOB, 297),
+
+ /* the EC curves requested by the TLS client (RFC 8422, 5.1);
+ * OpenSSL support via 'set_groups'/'set_curves':
+ * https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set1_groups.html
+ */
+ CURLOPT(CURLOPT_SSL_EC_CURVES, CURLOPTTYPE_STRINGPOINT, 298),
+
+ /* HSTS bitmask */
+ CURLOPT(CURLOPT_HSTS_CTRL, CURLOPTTYPE_LONG, 299),
+ /* HSTS file name */
+ CURLOPT(CURLOPT_HSTS, CURLOPTTYPE_STRINGPOINT, 300),
+
+ /* HSTS read callback */
+ CURLOPT(CURLOPT_HSTSREADFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 301),
+ CURLOPT(CURLOPT_HSTSREADDATA, CURLOPTTYPE_CBPOINT, 302),
+
+ /* HSTS write callback */
+ CURLOPT(CURLOPT_HSTSWRITEFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 303),
+ CURLOPT(CURLOPT_HSTSWRITEDATA, CURLOPTTYPE_CBPOINT, 304),
+
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;
@@ -2220,7 +2220,7 @@ typedef enum {
CURL_TIMECOND_LAST
} curl_TimeCond;
-/* Special size_t value signaling a null-terminated string. */
+/* Special size_t value signaling a null-terminated string. */
#define CURL_ZERO_TERMINATED ((size_t) -1)
/* curl_strequal() and curl_strnequal() are subject for removal in a future
@@ -2229,8 +2229,8 @@ CURL_EXTERN int curl_strequal(const char *s1, const char *s2);
CURL_EXTERN int curl_strnequal(const char *s1, const char *s2, size_t n);
/* Mime/form handling support. */
-typedef struct curl_mime curl_mime; /* Mime context. */
-typedef struct curl_mimepart curl_mimepart; /* Mime part context. */
+typedef struct curl_mime curl_mime; /* Mime context. */
+typedef struct curl_mimepart curl_mimepart; /* Mime part context. */
/*
* NAME curl_mime_init()
@@ -2354,30 +2354,30 @@ CURL_EXTERN CURLcode curl_mime_headers(curl_mimepart *part,
int take_ownership);
typedef enum {
- CURLFORM_NOTHING, /********* the first one is unused ************/
- CURLFORM_COPYNAME,
- CURLFORM_PTRNAME,
- CURLFORM_NAMELENGTH,
- CURLFORM_COPYCONTENTS,
- CURLFORM_PTRCONTENTS,
- CURLFORM_CONTENTSLENGTH,
- CURLFORM_FILECONTENT,
- CURLFORM_ARRAY,
- CURLFORM_OBSOLETE,
- CURLFORM_FILE,
-
- CURLFORM_BUFFER,
- CURLFORM_BUFFERPTR,
- CURLFORM_BUFFERLENGTH,
-
- CURLFORM_CONTENTTYPE,
- CURLFORM_CONTENTHEADER,
- CURLFORM_FILENAME,
- CURLFORM_END,
- CURLFORM_OBSOLETE2,
-
- CURLFORM_STREAM,
- CURLFORM_CONTENTLEN, /* added in 7.46.0, provide a curl_off_t length */
+ CURLFORM_NOTHING, /********* the first one is unused ************/
+ CURLFORM_COPYNAME,
+ CURLFORM_PTRNAME,
+ CURLFORM_NAMELENGTH,
+ CURLFORM_COPYCONTENTS,
+ CURLFORM_PTRCONTENTS,
+ CURLFORM_CONTENTSLENGTH,
+ CURLFORM_FILECONTENT,
+ CURLFORM_ARRAY,
+ CURLFORM_OBSOLETE,
+ CURLFORM_FILE,
+
+ CURLFORM_BUFFER,
+ CURLFORM_BUFFERPTR,
+ CURLFORM_BUFFERLENGTH,
+
+ CURLFORM_CONTENTTYPE,
+ CURLFORM_CONTENTHEADER,
+ CURLFORM_FILENAME,
+ CURLFORM_END,
+ CURLFORM_OBSOLETE2,
+
+ CURLFORM_STREAM,
+ CURLFORM_CONTENTLEN, /* added in 7.46.0, provide a curl_off_t length */
CURLFORM_LASTENTRY /* the last unused */
} CURLformoption;
@@ -2552,7 +2552,7 @@ CURL_EXTERN CURLcode curl_global_init(long flags);
* initialize libcurl and set user defined memory management callback
* functions. Users can implement memory management routines to check for
* memory leaks, check for mis-use of the curl library etc. User registered
- * callback routines will be invoked by this library instead of the system
+ * callback routines will be invoked by this library instead of the system
* memory management routines like malloc, free etc.
*/
CURL_EXTERN CURLcode curl_global_init_mem(long flags,
@@ -2604,11 +2604,11 @@ struct curl_slist {
* subsequent attempt to change it will result in a CURLSSLSET_TOO_LATE.
*/
-struct curl_ssl_backend {
+struct curl_ssl_backend {
curl_sslbackend id;
const char *name;
-};
-typedef struct curl_ssl_backend curl_ssl_backend;
+};
+typedef struct curl_ssl_backend curl_ssl_backend;
typedef enum {
CURLSSLSET_OK = 0,
@@ -2744,10 +2744,10 @@ typedef enum {
CURLINFO_REDIRECT_TIME_T = CURLINFO_OFF_T + 55,
CURLINFO_APPCONNECT_TIME_T = CURLINFO_OFF_T + 56,
CURLINFO_RETRY_AFTER = CURLINFO_OFF_T + 57,
- CURLINFO_EFFECTIVE_METHOD = CURLINFO_STRING + 58,
- CURLINFO_PROXY_ERROR = CURLINFO_LONG + 59,
+ CURLINFO_EFFECTIVE_METHOD = CURLINFO_STRING + 58,
+ CURLINFO_PROXY_ERROR = CURLINFO_LONG + 59,
- CURLINFO_LASTONE = 59
+ CURLINFO_LASTONE = 59
} CURLINFO;
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
@@ -2847,8 +2847,8 @@ typedef enum {
CURLVERSION_FOURTH,
CURLVERSION_FIFTH,
CURLVERSION_SIXTH,
- CURLVERSION_SEVENTH,
- CURLVERSION_EIGHTH,
+ CURLVERSION_SEVENTH,
+ CURLVERSION_EIGHTH,
CURLVERSION_LAST /* never actually use this */
} CURLversion;
@@ -2857,9 +2857,9 @@ typedef enum {
meant to be a built-in version number for what kind of struct the caller
expects. If the struct ever changes, we redefine the NOW to another enum
from above. */
-#define CURLVERSION_NOW CURLVERSION_EIGHTH
+#define CURLVERSION_NOW CURLVERSION_EIGHTH
-struct curl_version_info_data {
+struct curl_version_info_data {
CURLversion age; /* age of the returned struct */
const char *version; /* LIBCURL_VERSION */
unsigned int version_num; /* LIBCURL_VERSION_NUM */
@@ -2897,20 +2897,20 @@ struct curl_version_info_data {
const char *quic_version; /* human readable quic (+ HTTP/3) library +
version or NULL */
- /* These fields were added in CURLVERSION_SEVENTH */
- const char *cainfo; /* the built-in default CURLOPT_CAINFO, might
- be NULL */
- const char *capath; /* the built-in default CURLOPT_CAPATH, might
- be NULL */
-
- /* These fields were added in CURLVERSION_EIGHTH */
- unsigned int zstd_ver_num; /* Numeric Zstd version
- (MAJOR << 24) | (MINOR << 12) | PATCH */
- const char *zstd_version; /* human readable string. */
-
-};
-typedef struct curl_version_info_data curl_version_info_data;
-
+ /* These fields were added in CURLVERSION_SEVENTH */
+ const char *cainfo; /* the built-in default CURLOPT_CAINFO, might
+ be NULL */
+ const char *capath; /* the built-in default CURLOPT_CAPATH, might
+ be NULL */
+
+ /* These fields were added in CURLVERSION_EIGHTH */
+ unsigned int zstd_ver_num; /* Numeric Zstd version
+ (MAJOR << 24) | (MINOR << 12) | PATCH */
+ const char *zstd_version; /* human readable string. */
+
+};
+typedef struct curl_version_info_data curl_version_info_data;
+
#define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
#define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported
(deprecated) */
@@ -2942,9 +2942,9 @@ typedef struct curl_version_info_data curl_version_info_data;
#define CURL_VERSION_BROTLI (1<<23) /* Brotli features are present. */
#define CURL_VERSION_ALTSVC (1<<24) /* Alt-Svc handling built-in */
#define CURL_VERSION_HTTP3 (1<<25) /* HTTP3 support built-in */
-#define CURL_VERSION_ZSTD (1<<26) /* zstd features are present */
-#define CURL_VERSION_UNICODE (1<<27) /* Unicode support on Windows */
-#define CURL_VERSION_HSTS (1<<28) /* HSTS is supported */
+#define CURL_VERSION_ZSTD (1<<26) /* zstd features are present */
+#define CURL_VERSION_UNICODE (1<<27) /* Unicode support on Windows */
+#define CURL_VERSION_HSTS (1<<28) /* HSTS is supported */
/*
* NAME curl_version_info()
@@ -3007,7 +3007,7 @@ CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
#include "easy.h" /* nothing in curl is fun without the easy stuff */
#include "multi.h"
#include "urlapi.h"
-#include "options.h"
+#include "options.h"
/* the typechecker doesn't work in C++ (yet) */
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
diff --git a/contrib/libs/curl/include/curl/curlver.h b/contrib/libs/curl/include/curl/curlver.h
index 0c4d48703c..0acb5a8cbf 100644
--- a/contrib/libs/curl/include/curl/curlver.h
+++ b/contrib/libs/curl/include/curl/curlver.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,20 +26,20 @@
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 - 2020 Daniel Stenberg, <daniel@haxx.se>."
+#define LIBCURL_COPYRIGHT "1996 - 2020 Daniel Stenberg, <daniel@haxx.se>."
/* This is the version number of the libcurl package from which this header
file origins: */
-#define LIBCURL_VERSION "7.74.0"
+#define LIBCURL_VERSION "7.74.0"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
-#define LIBCURL_VERSION_MINOR 74
+#define LIBCURL_VERSION_MINOR 74
#define LIBCURL_VERSION_PATCH 0
/* This is the numeric version of the libcurl version number, meant for easier
- parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
+ parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax:
0xXXYYZZ
@@ -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 0x074a00
+#define LIBCURL_VERSION_NUM 0x074a00
/*
* This is the date and time when the full source package was created. The
@@ -68,7 +68,7 @@
*
* "2007-11-23"
*/
-#define LIBCURL_TIMESTAMP "2020-12-09"
+#define LIBCURL_TIMESTAMP "2020-12-09"
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
#define CURL_AT_LEAST_VERSION(x,y,z) \
diff --git a/contrib/libs/curl/include/curl/easy.h b/contrib/libs/curl/include/curl/easy.h
index 9ffd020d50..2dbfb26b5b 100644
--- a/contrib/libs/curl/include/curl/easy.h
+++ b/contrib/libs/curl/include/curl/easy.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -25,17 +25,17 @@
extern "C" {
#endif
-/* Flag bits in the curl_blob struct: */
-#define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */
-#define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */
-
-struct curl_blob {
- void *data;
- size_t len;
- unsigned int flags; /* bit 0 is defined, the rest are reserved and should be
- left zeroes */
-};
-
+/* Flag bits in the curl_blob struct: */
+#define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */
+#define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */
+
+struct curl_blob {
+ void *data;
+ size_t len;
+ unsigned int flags; /* bit 0 is defined, the rest are reserved and should be
+ left zeroes */
+};
+
CURL_EXTERN CURL *curl_easy_init(void);
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
diff --git a/contrib/libs/curl/include/curl/mprintf.h b/contrib/libs/curl/include/curl/mprintf.h
index 86974e9d3f..3549552dba 100644
--- a/contrib/libs/curl/include/curl/mprintf.h
+++ b/contrib/libs/curl/include/curl/mprintf.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/include/curl/multi.h b/contrib/libs/curl/include/curl/multi.h
index 9222c40b3e..37f9829b3b 100644
--- a/contrib/libs/curl/include/curl/multi.h
+++ b/contrib/libs/curl/include/curl/multi.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -72,8 +72,8 @@ typedef enum {
attempted to get added - again */
CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
callback */
- CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */
- CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */
+ CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */
+ CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */
CURLM_LAST
} CURLMcode;
@@ -189,15 +189,15 @@ CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle,
int timeout_ms,
int *ret);
-/*
- * Name: curl_multi_wakeup()
- *
- * Desc: wakes up a sleeping curl_multi_poll call.
- *
- * Returns: CURLMcode type, general multi error code.
- */
-CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);
-
+/*
+ * Name: curl_multi_wakeup()
+ *
+ * Desc: wakes up a sleeping curl_multi_poll call.
+ *
+ * Returns: CURLMcode type, general multi error code.
+ */
+CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);
+
/*
* Name: curl_multi_perform()
*
@@ -267,7 +267,7 @@ CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
* value into the equivalent human readable error string. This is
* useful for printing meaningful error messages.
*
- * Returns: A pointer to a null-terminated error message.
+ * Returns: A pointer to a null-terminated error message.
*/
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
@@ -346,55 +346,55 @@ CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
typedef enum {
/* This is the socket callback function pointer */
- CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1),
+ CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1),
/* This is the argument passed to the socket callback */
- CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2),
+ CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2),
/* set to 1 to enable pipelining for this multi handle */
- CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3),
+ CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3),
/* This is the timer callback function pointer */
- CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4),
+ CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4),
/* This is the argument passed to the timer callback */
- CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5),
+ CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5),
/* maximum number of entries in the connection cache */
- CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6),
+ CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6),
/* maximum number of (pipelining) connections to one host */
- CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7),
+ CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7),
/* maximum number of requests in a pipeline */
- CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8),
+ CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8),
/* a connection with a content-length longer than this
will not be considered for pipelining */
- CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9),
+ CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9),
/* a connection with a chunk length longer than this
will not be considered for pipelining */
- CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10),
+ CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10),
- /* a list of site names(+port) that are blocked from pipelining */
- CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11),
+ /* a list of site names(+port) that are blocked from pipelining */
+ CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11),
- /* a list of server types that are blocked from pipelining */
- CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12),
+ /* a list of server types that are blocked from pipelining */
+ CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12),
/* maximum number of open connections in total */
- CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13),
+ CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13),
/* This is the server push callback function pointer */
- CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14),
+ CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14),
/* This is the argument passed to the server push callback */
- CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15),
+ CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15),
+
+ /* maximum number of concurrent streams to support on a connection */
+ CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),
- /* maximum number of concurrent streams to support on a connection */
- CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),
-
CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;
@@ -427,14 +427,14 @@ CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
* Name: curl_push_callback
*
* Desc: This callback gets called when a new stream is being pushed by the
- * server. It approves or denies the new stream. It can also decide
- * to completely fail the connection.
+ * server. It approves or denies the new stream. It can also decide
+ * to completely fail the connection.
*
- * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT
+ * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT
*/
-#define CURL_PUSH_OK 0
-#define CURL_PUSH_DENY 1
-#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */
+#define CURL_PUSH_OK 0
+#define CURL_PUSH_DENY 1
+#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */
struct curl_pushheaders; /* forward declaration only */
diff --git a/contrib/libs/curl/include/curl/options.h b/contrib/libs/curl/include/curl/options.h
index 6e138a29db..14373b551c 100644
--- a/contrib/libs/curl/include/curl/options.h
+++ b/contrib/libs/curl/include/curl/options.h
@@ -1,68 +1,68 @@
-#ifndef CURLINC_OPTIONS_H
-#define CURLINC_OPTIONS_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
- *
- ***************************************************************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- CURLOT_LONG, /* long (a range of values) */
- CURLOT_VALUES, /* (a defined set or bitmask) */
- CURLOT_OFF_T, /* curl_off_t (a range of values) */
- CURLOT_OBJECT, /* pointer (void *) */
- CURLOT_STRING, /* (char * to zero terminated buffer) */
- CURLOT_SLIST, /* (struct curl_slist *) */
- CURLOT_CBPTR, /* (void * passed as-is to a callback) */
- CURLOT_BLOB, /* blob (struct curl_blob *) */
- CURLOT_FUNCTION /* function pointer */
-} curl_easytype;
-
-/* Flag bits */
-
-/* "alias" means it is provided for old programs to remain functional,
- we prefer another name */
-#define CURLOT_FLAG_ALIAS (1<<0)
-
-/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
- to use for curl_easy_setopt() for the given id */
-struct curl_easyoption {
- const char *name;
- CURLoption id;
- curl_easytype type;
- unsigned int flags;
-};
-
-CURL_EXTERN const struct curl_easyoption *
-curl_easy_option_by_name(const char *name);
-
-CURL_EXTERN const struct curl_easyoption *
-curl_easy_option_by_id (CURLoption id);
-
-CURL_EXTERN const struct curl_easyoption *
-curl_easy_option_next(const struct curl_easyoption *prev);
-
-#ifdef __cplusplus
-} /* end of extern "C" */
-#endif
-#endif /* CURLINC_OPTIONS_H */
+#ifndef CURLINC_OPTIONS_H
+#define CURLINC_OPTIONS_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
+ *
+ ***************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ CURLOT_LONG, /* long (a range of values) */
+ CURLOT_VALUES, /* (a defined set or bitmask) */
+ CURLOT_OFF_T, /* curl_off_t (a range of values) */
+ CURLOT_OBJECT, /* pointer (void *) */
+ CURLOT_STRING, /* (char * to zero terminated buffer) */
+ CURLOT_SLIST, /* (struct curl_slist *) */
+ CURLOT_CBPTR, /* (void * passed as-is to a callback) */
+ CURLOT_BLOB, /* blob (struct curl_blob *) */
+ CURLOT_FUNCTION /* function pointer */
+} curl_easytype;
+
+/* Flag bits */
+
+/* "alias" means it is provided for old programs to remain functional,
+ we prefer another name */
+#define CURLOT_FLAG_ALIAS (1<<0)
+
+/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
+ to use for curl_easy_setopt() for the given id */
+struct curl_easyoption {
+ const char *name;
+ CURLoption id;
+ curl_easytype type;
+ unsigned int flags;
+};
+
+CURL_EXTERN const struct curl_easyoption *
+curl_easy_option_by_name(const char *name);
+
+CURL_EXTERN const struct curl_easyoption *
+curl_easy_option_by_id (CURLoption id);
+
+CURL_EXTERN const struct curl_easyoption *
+curl_easy_option_next(const struct curl_easyoption *prev);
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+#endif /* CURLINC_OPTIONS_H */
diff --git a/contrib/libs/curl/include/curl/stdcheaders.h b/contrib/libs/curl/include/curl/stdcheaders.h
index 33ebecfc9a..60596c7568 100644
--- a/contrib/libs/curl/include/curl/stdcheaders.h
+++ b/contrib/libs/curl/include/curl/stdcheaders.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/include/curl/system.h b/contrib/libs/curl/include/curl/system.h
index f8ea2cb01f..faf8fcf84f 100644
--- a/contrib/libs/curl/include/curl/system.h
+++ b/contrib/libs/curl/include/curl/system.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -137,26 +137,26 @@
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__LCC__)
-# if defined(__e2k__) /* MCST eLbrus C Compiler */
-# define CURL_TYPEOF_CURL_OFF_T long
-# define CURL_FORMAT_CURL_OFF_T "ld"
-# define CURL_FORMAT_CURL_OFF_TU "lu"
-# define CURL_SUFFIX_CURL_OFF_T L
-# define CURL_SUFFIX_CURL_OFF_TU UL
-# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
-# define CURL_PULL_SYS_TYPES_H 1
-# define CURL_PULL_SYS_SOCKET_H 1
-# else /* Local (or Little) C Compiler */
-# define CURL_TYPEOF_CURL_OFF_T long
-# define CURL_FORMAT_CURL_OFF_T "ld"
-# define CURL_FORMAT_CURL_OFF_TU "lu"
-# define CURL_SUFFIX_CURL_OFF_T L
-# define CURL_SUFFIX_CURL_OFF_TU UL
-# define CURL_TYPEOF_CURL_SOCKLEN_T int
-# endif
+# if defined(__e2k__) /* MCST eLbrus C Compiler */
+# define CURL_TYPEOF_CURL_OFF_T long
+# define CURL_FORMAT_CURL_OFF_T "ld"
+# define CURL_FORMAT_CURL_OFF_TU "lu"
+# define CURL_SUFFIX_CURL_OFF_T L
+# define CURL_SUFFIX_CURL_OFF_TU UL
+# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
+# define CURL_PULL_SYS_TYPES_H 1
+# define CURL_PULL_SYS_SOCKET_H 1
+# else /* Local (or Little) C Compiler */
+# define CURL_TYPEOF_CURL_OFF_T long
+# define CURL_FORMAT_CURL_OFF_T "ld"
+# define CURL_FORMAT_CURL_OFF_TU "lu"
+# define CURL_SUFFIX_CURL_OFF_T L
+# define CURL_SUFFIX_CURL_OFF_TU UL
+# define CURL_TYPEOF_CURL_SOCKLEN_T int
+# endif
#elif defined(__SYMBIAN32__)
-# if defined(__EABI__) /* Treat all ARM compilers equally */
+# if defined(__EABI__) /* Treat all ARM compilers equally */
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
@@ -387,7 +387,7 @@
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
- defined(__e2k__) || \
+ defined(__e2k__) || \
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
(defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
# define CURL_TYPEOF_CURL_OFF_T long
diff --git a/contrib/libs/curl/include/curl/typecheck-gcc.h b/contrib/libs/curl/include/curl/typecheck-gcc.h
index c507df1d92..6d84150dc2 100644
--- a/contrib/libs/curl/include/curl/typecheck-gcc.h
+++ b/contrib/libs/curl/include/curl/typecheck-gcc.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -248,7 +248,7 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
#define curlcheck_off_t_option(option) \
- (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))
+ (((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))
/* evaluates to true if option takes a char* argument */
#define curlcheck_string_option(option) \
@@ -273,7 +273,7 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_FTPPORT || \
(option) == CURLOPT_FTP_ACCOUNT || \
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
- (option) == CURLOPT_HSTS || \
+ (option) == CURLOPT_HSTS || \
(option) == CURLOPT_INTERFACE || \
(option) == CURLOPT_ISSUERCERT || \
(option) == CURLOPT_KEYPASSWD || \
@@ -293,7 +293,7 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_PROXY_CAINFO || \
(option) == CURLOPT_PROXY_CAPATH || \
(option) == CURLOPT_PROXY_CRLFILE || \
- (option) == CURLOPT_PROXY_ISSUERCERT || \
+ (option) == CURLOPT_PROXY_ISSUERCERT || \
(option) == CURLOPT_PROXY_KEYPASSWD || \
(option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
(option) == CURLOPT_PROXY_SERVICE_NAME || \
@@ -336,7 +336,7 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_USERNAME || \
(option) == CURLOPT_USERPWD || \
(option) == CURLOPT_XOAUTH2_BEARER || \
- (option) == CURLOPT_SSL_EC_CURVES || \
+ (option) == CURLOPT_SSL_EC_CURVES || \
0)
/* evaluates to true if option takes a curl_write_callback argument */
@@ -357,8 +357,8 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
(option) == CURLOPT_DEBUGDATA || \
(option) == CURLOPT_FNMATCH_DATA || \
(option) == CURLOPT_HEADERDATA || \
- (option) == CURLOPT_HSTSREADDATA || \
- (option) == CURLOPT_HSTSWRITEDATA || \
+ (option) == CURLOPT_HSTSREADDATA || \
+ (option) == CURLOPT_HSTSWRITEDATA || \
(option) == CURLOPT_INTERLEAVEDATA || \
(option) == CURLOPT_IOCTLDATA || \
(option) == CURLOPT_OPENSOCKETDATA || \
@@ -396,9 +396,9 @@ CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
/* groups of curl_easy_getinfo infos that take the same type of argument */
/* evaluates to true if info expects a pointer to char * argument */
-#define curlcheck_string_info(info) \
- (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
- (info) != CURLINFO_PRIVATE)
+#define curlcheck_string_info(info) \
+ (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
+ (info) != CURLINFO_PRIVATE)
/* evaluates to true if info expects a pointer to long argument */
#define curlcheck_long_info(info) \
diff --git a/contrib/libs/curl/include/curl/urlapi.h b/contrib/libs/curl/include/curl/urlapi.h
index c1b6afcab7..7343cb659e 100644
--- a/contrib/libs/curl/include/curl/urlapi.h
+++ b/contrib/libs/curl/include/curl/urlapi.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -77,8 +77,8 @@ typedef enum {
#define CURLU_URLENCODE (1<<7) /* URL encode on set */
#define CURLU_APPENDQUERY (1<<8) /* append a form style part */
#define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */
-#define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the
- scheme is unknown. */
+#define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the
+ scheme is unknown. */
typedef struct Curl_URL CURLU;
diff --git a/contrib/libs/curl/lib/altsvc.c b/contrib/libs/curl/lib/altsvc.c
index dcde69c1c7..4ab77fdfc8 100644
--- a/contrib/libs/curl/lib/altsvc.c
+++ b/contrib/libs/curl/lib/altsvc.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -25,7 +25,7 @@
*/
#include "curl_setup.h"
-#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
#include <curl/curl.h>
#include "urldata.h"
#include "altsvc.h"
@@ -34,8 +34,8 @@
#include "parsedate.h"
#include "sendf.h"
#include "warnless.h"
-#include "rand.h"
-#include "rename.h"
+#include "rand.h"
+#include "rename.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -50,21 +50,21 @@
#define MAX_ALTSVC_ALPNLENSTR "10"
#define MAX_ALTSVC_ALPNLEN 10
-#if defined(USE_QUICHE) && !defined(UNITTESTS)
-#define H3VERSION "h3-29"
-#elif defined(USE_NGTCP2) && !defined(UNITTESTS)
-#define H3VERSION "h3-29"
-#else
-#define H3VERSION "h3"
-#endif
-
+#if defined(USE_QUICHE) && !defined(UNITTESTS)
+#define H3VERSION "h3-29"
+#elif defined(USE_NGTCP2) && !defined(UNITTESTS)
+#define H3VERSION "h3-29"
+#else
+#define H3VERSION "h3"
+#endif
+
static enum alpnid alpn2alpnid(char *name)
{
if(strcasecompare(name, "h1"))
return ALPN_h1;
if(strcasecompare(name, "h2"))
return ALPN_h2;
- if(strcasecompare(name, H3VERSION))
+ if(strcasecompare(name, H3VERSION))
return ALPN_h3;
return ALPN_none; /* unknown, probably rubbish input */
}
@@ -78,7 +78,7 @@ const char *Curl_alpnid2str(enum alpnid id)
case ALPN_h2:
return "h2";
case ALPN_h3:
- return H3VERSION;
+ return H3VERSION;
default:
return ""; /* bad */
}
@@ -162,7 +162,7 @@ static CURLcode altsvc_add(struct altsvcinfo *asi, char *line)
date, &persist, &prio);
if(9 == rc) {
struct altsvc *as;
- time_t expires = Curl_getdate_capped(date);
+ time_t expires = Curl_getdate_capped(date);
as = altsvc_create(srchost, dsthost, srcalpn, dstalpn, srcport, dstport);
if(as) {
as->expires = expires;
@@ -188,16 +188,16 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
{
CURLcode result = CURLE_OK;
char *line = NULL;
- FILE *fp;
-
- /* we need a private copy of the file name so that the altsvc cache file
- name survives an easy handle reset */
- free(asi->filename);
- asi->filename = strdup(file);
- if(!asi->filename)
- return CURLE_OUT_OF_MEMORY;
-
- fp = fopen(file, FOPEN_READTEXT);
+ FILE *fp;
+
+ /* we need a private copy of the file name so that the altsvc cache file
+ name survives an easy handle reset */
+ free(asi->filename);
+ asi->filename = strdup(file);
+ if(!asi->filename)
+ return CURLE_OUT_OF_MEMORY;
+
+ fp = fopen(file, FOPEN_READTEXT);
if(fp) {
line = malloc(MAX_ALTSVC_LINE);
if(!line)
@@ -218,7 +218,7 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
return result;
fail:
- Curl_safefree(asi->filename);
+ Curl_safefree(asi->filename);
free(line);
fclose(fp);
return CURLE_OUT_OF_MEMORY;
@@ -302,77 +302,77 @@ CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl)
* Curl_altsvc_cleanup() frees an altsvc cache instance and all associated
* resources.
*/
-void Curl_altsvc_cleanup(struct altsvcinfo **altsvcp)
+void Curl_altsvc_cleanup(struct altsvcinfo **altsvcp)
{
- struct Curl_llist_element *e;
- struct Curl_llist_element *n;
- if(*altsvcp) {
- struct altsvcinfo *altsvc = *altsvcp;
+ struct Curl_llist_element *e;
+ struct Curl_llist_element *n;
+ if(*altsvcp) {
+ struct altsvcinfo *altsvc = *altsvcp;
for(e = altsvc->list.head; e; e = n) {
struct altsvc *as = e->ptr;
n = e->next;
altsvc_free(as);
}
- free(altsvc->filename);
+ free(altsvc->filename);
free(altsvc);
- *altsvcp = NULL; /* clear the pointer */
+ *altsvcp = NULL; /* clear the pointer */
}
}
/*
* Curl_altsvc_save() writes the altsvc cache to a file.
*/
-CURLcode Curl_altsvc_save(struct Curl_easy *data,
- struct altsvcinfo *altsvc, const char *file)
+CURLcode Curl_altsvc_save(struct Curl_easy *data,
+ struct altsvcinfo *altsvc, const char *file)
{
- struct Curl_llist_element *e;
- struct Curl_llist_element *n;
+ struct Curl_llist_element *e;
+ struct Curl_llist_element *n;
CURLcode result = CURLE_OK;
FILE *out;
- char *tempstore;
- unsigned char randsuffix[9];
+ char *tempstore;
+ unsigned char randsuffix[9];
if(!altsvc)
/* no cache activated */
return CURLE_OK;
- /* if not new name is given, use the one we stored from the load */
- if(!file && altsvc->filename)
- file = altsvc->filename;
-
- if((altsvc->flags & CURLALTSVC_READONLYFILE) || !file || !file[0])
- /* marked as read-only, no file or zero length file name */
+ /* if not new name is given, use the one we stored from the load */
+ if(!file && altsvc->filename)
+ file = altsvc->filename;
+
+ if((altsvc->flags & CURLALTSVC_READONLYFILE) || !file || !file[0])
+ /* marked as read-only, no file or zero length file name */
return CURLE_OK;
-
- if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
- return CURLE_FAILED_INIT;
-
- tempstore = aprintf("%s.%s.tmp", file, randsuffix);
- if(!tempstore)
- return CURLE_OUT_OF_MEMORY;
-
- out = fopen(tempstore, FOPEN_WRITETEXT);
+
+ if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
+ return CURLE_FAILED_INIT;
+
+ tempstore = aprintf("%s.%s.tmp", file, randsuffix);
+ if(!tempstore)
+ return CURLE_OUT_OF_MEMORY;
+
+ out = fopen(tempstore, FOPEN_WRITETEXT);
if(!out)
- result = CURLE_WRITE_ERROR;
- else {
- fputs("# Your alt-svc cache. https://curl.se/docs/alt-svc.html\n"
- "# This file was generated by libcurl! Edit at your own risk.\n",
- out);
- for(e = altsvc->list.head; e; e = n) {
- struct altsvc *as = e->ptr;
- n = e->next;
- result = altsvc_out(as, out);
- if(result)
- break;
- }
- fclose(out);
- if(!result && Curl_rename(tempstore, file))
- result = CURLE_WRITE_ERROR;
-
+ result = CURLE_WRITE_ERROR;
+ else {
+ fputs("# Your alt-svc cache. https://curl.se/docs/alt-svc.html\n"
+ "# This file was generated by libcurl! Edit at your own risk.\n",
+ out);
+ for(e = altsvc->list.head; e; e = n) {
+ struct altsvc *as = e->ptr;
+ n = e->next;
+ result = altsvc_out(as, out);
+ if(result)
+ break;
+ }
+ fclose(out);
+ if(!result && Curl_rename(tempstore, file))
+ result = CURLE_WRITE_ERROR;
+
if(result)
- unlink(tempstore);
+ unlink(tempstore);
}
- free(tempstore);
+ free(tempstore);
return result;
}
@@ -387,7 +387,7 @@ static CURLcode getalnum(const char **ptr, char *alpnbuf, size_t buflen)
while(*p && !ISBLANK(*p) && (*p != ';') && (*p != '='))
p++;
len = p - protop;
- *ptr = p;
+ *ptr = p;
if(!len || (len >= buflen))
return CURLE_BAD_FUNCTION_ARGUMENT;
@@ -401,8 +401,8 @@ static CURLcode getalnum(const char **ptr, char *alpnbuf, size_t buflen)
static void altsvc_flush(struct altsvcinfo *asi, enum alpnid srcalpnid,
const char *srchost, unsigned short srcport)
{
- struct Curl_llist_element *e;
- struct Curl_llist_element *n;
+ struct Curl_llist_element *e;
+ struct Curl_llist_element *n;
for(e = asi->list.head; e; e = n) {
struct altsvc *as = e->ptr;
n = e->next;
@@ -431,18 +431,18 @@ static time_t debugtime(void *unused)
#define time(x) debugtime(x)
#endif
-#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
-
+#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
+
/*
* Curl_altsvc_parse() takes an incoming alt-svc response header and stores
* the data correctly in the cache.
*
* 'value' points to the header *value*. That's contents to the right of the
* header name.
- *
- * Currently this function rejects invalid data without returning an error.
- * Invalid host name, port number will result in the specific alternative
- * being rejected. Unknown protocols are skipped.
+ *
+ * Currently this function rejects invalid data without returning an error.
+ * Invalid host name, port number will result in the specific alternative
+ * being rejected. Unknown protocols are skipped.
*/
CURLcode Curl_altsvc_parse(struct Curl_easy *data,
struct altsvcinfo *asi, const char *value,
@@ -456,13 +456,13 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
struct altsvc *as;
unsigned short dstport = srcport; /* the same by default */
CURLcode result = getalnum(&p, alpnbuf, sizeof(alpnbuf));
-#ifdef CURL_DISABLE_VERBOSE_STRINGS
- (void)data;
-#endif
- if(result) {
- infof(data, "Excessive alt-svc header, ignoring...\n");
- return CURLE_OK;
- }
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+ (void)data;
+#endif
+ if(result) {
+ infof(data, "Excessive alt-svc header, ignoring...\n");
+ return CURLE_OK;
+ }
DEBUGASSERT(asi);
@@ -477,17 +477,17 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
do {
if(*p == '=') {
/* [protocol]="[host][:port]" */
- enum alpnid dstalpnid = alpn2alpnid(alpnbuf); /* the same by default */
+ enum alpnid dstalpnid = alpn2alpnid(alpnbuf); /* the same by default */
p++;
if(*p == '\"') {
- const char *dsthost = "";
- const char *value_ptr;
- char option[32];
- unsigned long num;
- char *end_ptr;
- bool quoted = FALSE;
- time_t maxage = 24 * 3600; /* default is 24 hours */
- bool persist = FALSE;
+ const char *dsthost = "";
+ const char *value_ptr;
+ char option[32];
+ unsigned long num;
+ char *end_ptr;
+ bool quoted = FALSE;
+ time_t maxage = 24 * 3600; /* default is 24 hours */
+ bool persist = FALSE;
p++;
if(*p != ':') {
/* host name starts here */
@@ -495,15 +495,15 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
while(*p && (ISALNUM(*p) || (*p == '.') || (*p == '-')))
p++;
len = p - hostp;
- if(!len || (len >= MAX_ALTSVC_HOSTLEN)) {
- infof(data, "Excessive alt-svc host name, ignoring...\n");
- dstalpnid = ALPN_none;
- }
- else {
- memcpy(namebuf, hostp, len);
- namebuf[len] = 0;
- dsthost = namebuf;
- }
+ if(!len || (len >= MAX_ALTSVC_HOSTLEN)) {
+ infof(data, "Excessive alt-svc host name, ignoring...\n");
+ dstalpnid = ALPN_none;
+ }
+ else {
+ memcpy(namebuf, hostp, len);
+ namebuf[len] = 0;
+ dsthost = namebuf;
+ }
}
else {
/* no destination name, use source host */
@@ -514,82 +514,82 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
unsigned long port = strtoul(++p, &end_ptr, 10);
if(port > USHRT_MAX || end_ptr == p || *end_ptr != '\"') {
infof(data, "Unknown alt-svc port number, ignoring...\n");
- dstalpnid = ALPN_none;
+ dstalpnid = ALPN_none;
}
p = end_ptr;
dstport = curlx_ultous(port);
}
if(*p++ != '\"')
- break;
- /* Handle the optional 'ma' and 'persist' flags. Unknown flags
- are skipped. */
- for(;;) {
- while(ISBLANK(*p))
- p++;
- if(*p != ';')
- break;
- p++; /* pass the semicolon */
- if(!*p || ISNEWLINE(*p))
- break;
- result = getalnum(&p, option, sizeof(option));
- if(result) {
- /* skip option if name is too long */
- option[0] = '\0';
- }
- while(*p && ISBLANK(*p))
- p++;
- if(*p != '=')
- return CURLE_OK;
- p++;
- while(*p && ISBLANK(*p))
- p++;
- if(!*p)
- return CURLE_OK;
- if(*p == '\"') {
- /* quoted value */
- p++;
- quoted = TRUE;
- }
- value_ptr = p;
- if(quoted) {
- while(*p && *p != '\"')
- p++;
- if(!*p++)
- return CURLE_OK;
- }
- else {
- while(*p && !ISBLANK(*p) && *p!= ';' && *p != ',')
- p++;
- }
- num = strtoul(value_ptr, &end_ptr, 10);
- if((end_ptr != value_ptr) && (num < ULONG_MAX)) {
- if(strcasecompare("ma", option))
- maxage = num;
- else if(strcasecompare("persist", option) && (num == 1))
- persist = TRUE;
- }
+ break;
+ /* Handle the optional 'ma' and 'persist' flags. Unknown flags
+ are skipped. */
+ for(;;) {
+ while(ISBLANK(*p))
+ p++;
+ if(*p != ';')
+ break;
+ p++; /* pass the semicolon */
+ if(!*p || ISNEWLINE(*p))
+ break;
+ result = getalnum(&p, option, sizeof(option));
+ if(result) {
+ /* skip option if name is too long */
+ option[0] = '\0';
+ }
+ while(*p && ISBLANK(*p))
+ p++;
+ if(*p != '=')
+ return CURLE_OK;
+ p++;
+ while(*p && ISBLANK(*p))
+ p++;
+ if(!*p)
+ return CURLE_OK;
+ if(*p == '\"') {
+ /* quoted value */
+ p++;
+ quoted = TRUE;
+ }
+ value_ptr = p;
+ if(quoted) {
+ while(*p && *p != '\"')
+ p++;
+ if(!*p++)
+ return CURLE_OK;
+ }
+ else {
+ while(*p && !ISBLANK(*p) && *p!= ';' && *p != ',')
+ p++;
+ }
+ num = strtoul(value_ptr, &end_ptr, 10);
+ if((end_ptr != value_ptr) && (num < ULONG_MAX)) {
+ if(strcasecompare("ma", option))
+ maxage = num;
+ else if(strcasecompare("persist", option) && (num == 1))
+ persist = TRUE;
+ }
+ }
+ if(dstalpnid) {
+ as = altsvc_createid(srchost, dsthost,
+ srcalpnid, dstalpnid,
+ srcport, dstport);
+ if(as) {
+ /* The expires time also needs to take the Age: value (if any) into
+ account. [See RFC 7838 section 3.1] */
+ as->expires = maxage + time(NULL);
+ as->persist = persist;
+ Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
+ infof(data, "Added alt-svc: %s:%d over %s\n", dsthost, dstport,
+ Curl_alpnid2str(dstalpnid));
+ }
+ }
+ else {
+ infof(data, "Unknown alt-svc protocol \"%s\", skipping...\n",
+ alpnbuf);
}
- if(dstalpnid) {
- as = altsvc_createid(srchost, dsthost,
- srcalpnid, dstalpnid,
- srcport, dstport);
- if(as) {
- /* The expires time also needs to take the Age: value (if any) into
- account. [See RFC 7838 section 3.1] */
- as->expires = maxage + time(NULL);
- as->persist = persist;
- Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
- infof(data, "Added alt-svc: %s:%d over %s\n", dsthost, dstport,
- Curl_alpnid2str(dstalpnid));
- }
- }
- else {
- infof(data, "Unknown alt-svc protocol \"%s\", skipping...\n",
- alpnbuf);
- }
}
- else
- break;
+ else
+ break;
/* after the double quote there can be a comma if there's another
string or a semicolon if no more */
if(*p == ',') {
@@ -597,11 +597,11 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
p++;
result = getalnum(&p, alpnbuf, sizeof(alpnbuf));
if(result)
- break;
+ break;
}
}
- else
- break;
+ else
+ break;
} while(*p && (*p != ';') && (*p != '\n') && (*p != '\r'));
return CURLE_OK;
@@ -616,8 +616,8 @@ bool Curl_altsvc_lookup(struct altsvcinfo *asi,
struct altsvc **dstentry,
const int versions) /* one or more bits */
{
- struct Curl_llist_element *e;
- struct Curl_llist_element *n;
+ struct Curl_llist_element *e;
+ struct Curl_llist_element *n;
time_t now = time(NULL);
DEBUGASSERT(asi);
DEBUGASSERT(srchost);
@@ -644,4 +644,4 @@ bool Curl_altsvc_lookup(struct altsvcinfo *asi,
return FALSE;
}
-#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */
+#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */
diff --git a/contrib/libs/curl/lib/altsvc.h b/contrib/libs/curl/lib/altsvc.h
index a69c89beb4..2ab89e7059 100644
--- a/contrib/libs/curl/lib/altsvc.h
+++ b/contrib/libs/curl/lib/altsvc.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -23,7 +23,7 @@
***************************************************************************/
#include "curl_setup.h"
-#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
#include <curl/curl.h>
#include "llist.h"
@@ -46,22 +46,22 @@ struct altsvc {
time_t expires;
bool persist;
int prio;
- struct Curl_llist_element node;
+ struct Curl_llist_element node;
};
struct altsvcinfo {
char *filename;
- struct Curl_llist list; /* list of entries */
+ struct Curl_llist list; /* list of entries */
long flags; /* the publicly set bitmask */
};
const char *Curl_alpnid2str(enum alpnid id);
struct altsvcinfo *Curl_altsvc_init(void);
CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file);
-CURLcode Curl_altsvc_save(struct Curl_easy *data,
- struct altsvcinfo *asi, const char *file);
+CURLcode Curl_altsvc_save(struct Curl_easy *data,
+ struct altsvcinfo *asi, const char *file);
CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl);
-void Curl_altsvc_cleanup(struct altsvcinfo **altsvc);
+void Curl_altsvc_cleanup(struct altsvcinfo **altsvc);
CURLcode Curl_altsvc_parse(struct Curl_easy *data,
struct altsvcinfo *altsvc, const char *value,
enum alpnid srcalpn, const char *srchost,
@@ -70,10 +70,10 @@ bool Curl_altsvc_lookup(struct altsvcinfo *asi,
enum alpnid srcalpnid, const char *srchost,
int srcport,
struct altsvc **dstentry,
- const int versions); /* CURLALTSVC_H* bits */
+ const int versions); /* CURLALTSVC_H* bits */
#else
/* disabled */
-#define Curl_altsvc_save(a,b,c)
-#define Curl_altsvc_cleanup(x)
-#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */
+#define Curl_altsvc_save(a,b,c)
+#define Curl_altsvc_cleanup(x)
+#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */
#endif /* HEADER_CURL_ALTSVC_H */
diff --git a/contrib/libs/curl/lib/amigaos.c b/contrib/libs/curl/lib/amigaos.c
index 8cee60b90e..d3b00d9083 100644
--- a/contrib/libs/curl/lib/amigaos.c
+++ b/contrib/libs/curl/lib/amigaos.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/amigaos.h b/contrib/libs/curl/lib/amigaos.h
index 50c58b1327..02e5bb546a 100644
--- a/contrib/libs/curl/lib/amigaos.h
+++ b/contrib/libs/curl/lib/amigaos.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/arpa_telnet.h b/contrib/libs/curl/lib/arpa_telnet.h
index a493456bad..cbe31de5a3 100644
--- a/contrib/libs/curl/lib/arpa_telnet.h
+++ b/contrib/libs/curl/lib/arpa_telnet.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/asyn-ares.c b/contrib/libs/curl/lib/asyn-ares.c
index 4b79a0b78c..1747571889 100644
--- a/contrib/libs/curl/lib/asyn-ares.c
+++ b/contrib/libs/curl/lib/asyn-ares.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -67,8 +67,8 @@
#include "select.h"
#include "progress.h"
-# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
- defined(WIN32)
+# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
+ defined(WIN32)
# define CARES_STATICLIB
# endif
# include <ares.h>
@@ -85,10 +85,10 @@
#include "curl_memory.h"
#include "memdebug.h"
-struct thread_data {
+struct thread_data {
int num_pending; /* number of ares_gethostbyname() requests */
- struct Curl_addrinfo *temp_ai; /* intermediary result while fetching c-ares
- parts */
+ struct Curl_addrinfo *temp_ai; /* intermediary result while fetching c-ares
+ parts */
int last_status;
struct curltime happy_eyeballs_dns_time; /* when this timer started, or 0 */
};
@@ -229,8 +229,8 @@ static void destroy_async_data(struct Curl_async *async)
{
free(async->hostname);
- if(async->tdata) {
- struct thread_data *res = async->tdata;
+ if(async->tdata) {
+ struct thread_data *res = async->tdata;
if(res) {
if(res->temp_ai) {
Curl_freeaddrinfo(res->temp_ai);
@@ -238,7 +238,7 @@ static void destroy_async_data(struct Curl_async *async)
}
free(res);
}
- async->tdata = NULL;
+ async->tdata = NULL;
}
async->hostname = NULL;
@@ -286,7 +286,7 @@ int Curl_resolver_getsock(struct connectdata *conn,
* return number of sockets it worked on
*/
-static int waitperform(struct connectdata *conn, timediff_t timeout_ms)
+static int waitperform(struct connectdata *conn, timediff_t timeout_ms)
{
struct Curl_easy *data = conn->data;
int nfds;
@@ -349,11 +349,11 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **dns)
{
struct Curl_easy *data = conn->data;
- struct thread_data *res = conn->async.tdata;
+ struct thread_data *res = conn->async.tdata;
CURLcode result = CURLE_OK;
- DEBUGASSERT(dns);
- *dns = NULL;
+ DEBUGASSERT(dns);
+ *dns = NULL;
waitperform(conn, 0);
@@ -381,18 +381,18 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
}
if(res && !res->num_pending) {
- (void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
- /* temp_ai ownership is moved to the connection, so we need not free-up
- them */
- res->temp_ai = NULL;
-
+ (void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
+ /* temp_ai ownership is moved to the connection, so we need not free-up
+ them */
+ res->temp_ai = NULL;
+
if(!conn->async.dns) {
failf(data, "Could not resolve: %s (%s)",
conn->async.hostname, ares_strerror(conn->async.status));
result = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
CURLE_COULDNT_RESOLVE_HOST;
}
- else
+ else
*dns = conn->async.dns;
destroy_async_data(&conn->async);
@@ -407,7 +407,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
* Waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang".
*
- * 'entry' MUST be non-NULL.
+ * 'entry' MUST be non-NULL.
*
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
@@ -420,8 +420,8 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
timediff_t timeout;
struct curltime now = Curl_now();
- DEBUGASSERT(entry);
- *entry = NULL; /* clear on entry */
+ DEBUGASSERT(entry);
+ *entry = NULL; /* clear on entry */
timeout = Curl_timeleft(data, &now, TRUE);
if(timeout < 0) {
@@ -436,13 +436,13 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
while(!result) {
struct timeval *tvp, tv, store;
int itimeout;
- timediff_t timeout_ms;
+ timediff_t timeout_ms;
-#if TIMEDIFF_T_MAX > INT_MAX
- itimeout = (timeout > INT_MAX) ? INT_MAX : (int)timeout;
-#else
- itimeout = (int)timeout;
-#endif
+#if TIMEDIFF_T_MAX > INT_MAX
+ itimeout = (timeout > INT_MAX) ? INT_MAX : (int)timeout;
+#else
+ itimeout = (int)timeout;
+#endif
store.tv_sec = itimeout/1000;
store.tv_usec = (itimeout%1000)*1000;
@@ -453,12 +453,12 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
second is left, otherwise just use 1000ms to make sure the progress
callback gets called frequent enough */
if(!tvp->tv_sec)
- timeout_ms = (timediff_t)(tvp->tv_usec/1000);
+ timeout_ms = (timediff_t)(tvp->tv_usec/1000);
else
timeout_ms = 1000;
waitperform(conn, timeout_ms);
- result = Curl_resolver_is_resolved(conn, entry);
+ result = Curl_resolver_is_resolved(conn, entry);
if(result || conn->async.done)
break;
@@ -473,7 +473,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
else if(timediff > timeout)
timeout = -1;
else
- timeout -= timediff;
+ timeout -= timediff;
now = now2; /* for next loop */
}
if(timeout < 0)
@@ -497,10 +497,10 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
}
/* Connects results to the list */
-static void compound_results(struct thread_data *res,
- struct Curl_addrinfo *ai)
+static void compound_results(struct thread_data *res,
+ struct Curl_addrinfo *ai)
{
- struct Curl_addrinfo *ai_tail;
+ struct Curl_addrinfo *ai_tail;
if(!ai)
return;
ai_tail = ai;
@@ -526,7 +526,7 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
struct hostent *hostent)
{
struct connectdata *conn = (struct connectdata *)arg;
- struct thread_data *res;
+ struct thread_data *res;
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
(void)timeouts; /* ignored */
@@ -537,12 +537,12 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
be valid so only defer it when we know the 'status' says its fine! */
return;
- res = conn->async.tdata;
+ res = conn->async.tdata;
if(res) {
res->num_pending--;
if(CURL_ASYNC_SUCCESS == status) {
- struct Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port);
+ struct Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port);
if(ai) {
compound_results(res, ai);
}
@@ -621,10 +621,10 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
* memory we need to free after use. That memory *MUST* be freed with
* Curl_freeaddrinfo(), nothing else.
*/
-struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp)
+struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
{
char *bufp;
struct Curl_easy *data = conn->data;
@@ -632,7 +632,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
*waitp = 0; /* default to synchronous response */
-#ifdef ENABLE_IPV6
+#ifdef ENABLE_IPV6
switch(conn->ip_version) {
default:
#if ARES_VERSION >= 0x010601
@@ -648,30 +648,30 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
family = PF_INET6;
break;
}
-#endif /* ENABLE_IPV6 */
+#endif /* ENABLE_IPV6 */
bufp = strdup(hostname);
if(bufp) {
- struct thread_data *res = NULL;
+ struct thread_data *res = NULL;
free(conn->async.hostname);
conn->async.hostname = bufp;
conn->async.port = port;
conn->async.done = FALSE; /* not done */
conn->async.status = 0; /* clear */
conn->async.dns = NULL; /* clear */
- res = calloc(sizeof(struct thread_data), 1);
+ res = calloc(sizeof(struct thread_data), 1);
if(!res) {
free(conn->async.hostname);
conn->async.hostname = NULL;
return NULL;
}
- conn->async.tdata = res;
+ conn->async.tdata = res;
/* initial status - failed */
res->last_status = ARES_ENOTFOUND;
-#ifdef ENABLE_IPV6
+#ifdef ENABLE_IPV6
if(family == PF_UNSPEC) {
- if(Curl_ipv6works(conn)) {
+ if(Curl_ipv6works(conn)) {
res->num_pending = 2;
/* areschannel is already setup in the Curl_open() function */
@@ -689,7 +689,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
}
}
else
-#endif /* ENABLE_IPV6 */
+#endif /* ENABLE_IPV6 */
{
res->num_pending = 1;
diff --git a/contrib/libs/curl/lib/asyn-thread.c b/contrib/libs/curl/lib/asyn-thread.c
index fc018b1cd5..c49878bb55 100644
--- a/contrib/libs/curl/lib/asyn-thread.c
+++ b/contrib/libs/curl/lib/asyn-thread.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -21,7 +21,7 @@
***************************************************************************/
#include "curl_setup.h"
-#include "socketpair.h"
+#include "socketpair.h"
/***********************************************************************
* Only for threaded name resolves builds
@@ -74,7 +74,7 @@
#include "inet_ntop.h"
#include "curl_threads.h"
#include "connect.h"
-#include "socketpair.h"
+#include "socketpair.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -209,18 +209,18 @@ static bool init_resolve_thread(struct connectdata *conn,
/* Data for synchronization between resolver thread and its parent */
struct thread_sync_data {
- curl_mutex_t *mtx;
+ curl_mutex_t *mtx;
int done;
char *hostname; /* hostname to resolve, Curl_async.hostname
duplicate */
int port;
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
struct connectdata *conn;
curl_socket_t sock_pair[2]; /* socket pair */
#endif
int sock_error;
- struct Curl_addrinfo *res;
+ struct Curl_addrinfo *res;
#ifdef HAVE_GETADDRINFO
struct addrinfo hints;
#endif
@@ -230,7 +230,7 @@ struct thread_sync_data {
struct thread_data {
curl_thread_t thread_hnd;
unsigned int poll_interval;
- timediff_t interval_end;
+ timediff_t interval_end;
struct thread_sync_data tsd;
/* 'reserved' memory must be available in case the thread is orphaned */
void *reserved;
@@ -238,12 +238,12 @@ struct thread_data {
static struct thread_sync_data *conn_thread_sync_data(struct connectdata *conn)
{
- return &(conn->async.tdata->tsd);
+ return &(conn->async.tdata->tsd);
}
/* Destroy resolver thread synchronization data */
static
-void destroy_thread_sync_data(struct thread_sync_data *tsd)
+void destroy_thread_sync_data(struct thread_sync_data *tsd)
{
if(tsd->mtx) {
Curl_mutex_destroy(tsd->mtx);
@@ -255,7 +255,7 @@ void destroy_thread_sync_data(struct thread_sync_data *tsd)
if(tsd->res)
Curl_freeaddrinfo(tsd->res);
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
/*
* close one end of the socket pair (may be done in resolver thread);
* the other end (for reading) is always closed in the parent thread.
@@ -269,10 +269,10 @@ void destroy_thread_sync_data(struct thread_sync_data *tsd)
/* Initialize resolver thread synchronization data */
static
-int init_thread_sync_data(struct thread_data *td,
- const char *hostname,
- int port,
- const struct addrinfo *hints)
+int init_thread_sync_data(struct thread_data *td,
+ const char *hostname,
+ int port,
+ const struct addrinfo *hints)
{
struct thread_sync_data *tsd = &td->tsd;
@@ -301,9 +301,9 @@ int init_thread_sync_data(struct thread_data *td,
goto err_exit;
}
-#ifdef USE_SOCKETPAIR
- /* create socket pair, avoid AF_LOCAL since it doesn't build on Solaris */
- if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, &tsd->sock_pair[0]) < 0) {
+#ifdef USE_SOCKETPAIR
+ /* create socket pair, avoid AF_LOCAL since it doesn't build on Solaris */
+ if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, &tsd->sock_pair[0]) < 0) {
tsd->sock_pair[0] = CURL_SOCKET_BAD;
tsd->sock_pair[1] = CURL_SOCKET_BAD;
goto err_exit;
@@ -351,12 +351,12 @@ static int getaddrinfo_complete(struct connectdata *conn)
*/
static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
{
- struct thread_sync_data *tsd = (struct thread_sync_data *)arg;
+ struct thread_sync_data *tsd = (struct thread_sync_data *)arg;
struct thread_data *td = tsd->td;
struct thread_list *orphan = NULL;
char service[12];
int rc;
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
char buf[1];
#endif
@@ -382,11 +382,11 @@ static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
free(td);
}
else {
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
if(tsd->sock_pair[1] != CURL_SOCKET_BAD) {
/* DNS has been resolved, signal client task */
buf[0] = 1;
- if(swrite(tsd->sock_pair[1], buf, sizeof(buf)) < 0) {
+ if(swrite(tsd->sock_pair[1], buf, sizeof(buf)) < 0) {
/* update sock_erro to errno */
tsd->sock_error = SOCKERRNO;
}
@@ -447,10 +447,10 @@ static unsigned int CURL_STDCALL gethostbyname_thread(void *arg)
*/
static void destroy_async_data(struct Curl_async *async)
{
- if(async->tdata) {
- struct thread_data *td = async->tdata;
+ if(async->tdata) {
+ struct thread_data *td = async->tdata;
int done;
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
curl_socket_t sock_rd = td->tsd.sock_pair[0];
struct connectdata *conn = td->tsd.conn;
#endif
@@ -510,7 +510,7 @@ static void destroy_async_data(struct Curl_async *async)
free(td->reserved);
free(td);
}
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
/*
* ensure CURLMOPT_SOCKETFUNCTION fires CURL_POLL_REMOVE
* before the FD is invalidated to avoid EBADF on EPOLL_CTL_DEL
@@ -520,7 +520,7 @@ static void destroy_async_data(struct Curl_async *async)
sclose(sock_rd);
#endif
}
- async->tdata = NULL;
+ async->tdata = NULL;
free(async->hostname);
async->hostname = NULL;
@@ -539,7 +539,7 @@ static bool init_resolve_thread(struct connectdata *conn,
struct thread_data *td = calloc(1, sizeof(struct thread_data));
int err = ENOMEM;
- conn->async.tdata = td;
+ conn->async.tdata = td;
if(!td)
goto errno_exit;
@@ -551,7 +551,7 @@ static bool init_resolve_thread(struct connectdata *conn,
td->reserved = calloc(1, sizeof(struct thread_list));
if(!td->reserved || !init_thread_sync_data(td, hostname, port, hints)) {
- conn->async.tdata = NULL;
+ conn->async.tdata = NULL;
free(td->reserved);
free(td);
goto errno_exit;
@@ -598,14 +598,14 @@ static CURLcode resolver_error(struct connectdata *conn)
const char *host_or_proxy;
CURLcode result;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy) {
host_or_proxy = "proxy";
result = CURLE_COULDNT_RESOLVE_PROXY;
}
- else
-#endif
- {
+ else
+#endif
+ {
host_or_proxy = "host";
result = CURLE_COULDNT_RESOLVE_HOST;
}
@@ -616,14 +616,14 @@ static CURLcode resolver_error(struct connectdata *conn)
return result;
}
-/*
- * 'entry' may be NULL and then no data is returned
- */
+/*
+ * 'entry' may be NULL and then no data is returned
+ */
static CURLcode thread_wait_resolv(struct connectdata *conn,
struct Curl_dns_entry **entry,
bool report)
{
- struct thread_data *td = conn->async.tdata;
+ struct thread_data *td = conn->async.tdata;
CURLcode result = CURLE_OK;
DEBUGASSERT(conn && td);
@@ -661,7 +661,7 @@ static CURLcode thread_wait_resolv(struct connectdata *conn,
*/
void Curl_resolver_kill(struct connectdata *conn)
{
- struct thread_data *td = conn->async.tdata;
+ struct thread_data *td = conn->async.tdata;
/* If we're still resolving, we must wait for the threads to fully clean up,
unfortunately. Otherwise, we can simply cancel to clean up any resolver
@@ -700,10 +700,10 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **entry)
{
struct Curl_easy *data = conn->data;
- struct thread_data *td = conn->async.tdata;
+ struct thread_data *td = conn->async.tdata;
int done = 0;
- DEBUGASSERT(entry);
+ DEBUGASSERT(entry);
*entry = NULL;
if(!td) {
@@ -729,8 +729,8 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
else {
/* poll for name lookup done with exponential backoff up to 250ms */
/* should be fine even if this converts to 32 bit */
- timediff_t elapsed = Curl_timediff(Curl_now(),
- data->progress.t_startsingle);
+ timediff_t elapsed = Curl_timediff(Curl_now(),
+ data->progress.t_startsingle);
if(elapsed < 0)
elapsed = 0;
@@ -755,17 +755,17 @@ int Curl_resolver_getsock(struct connectdata *conn,
curl_socket_t *socks)
{
int ret_val = 0;
- timediff_t milli;
+ timediff_t milli;
timediff_t ms;
struct Curl_easy *data = conn->data;
struct resdata *reslv = (struct resdata *)data->state.resolver;
-#ifdef USE_SOCKETPAIR
- struct thread_data *td = conn->async.tdata;
+#ifdef USE_SOCKETPAIR
+ struct thread_data *td = conn->async.tdata;
#else
(void)socks;
#endif
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
if(td) {
/* return read fd to client for polling the DNS resolution status */
socks[0] = td->tsd.sock_pair[0];
@@ -779,13 +779,13 @@ int Curl_resolver_getsock(struct connectdata *conn,
if(ms < 3)
milli = 0;
else if(ms <= 50)
- milli = ms/3;
+ milli = ms/3;
else if(ms <= 250)
milli = 50;
else
milli = 200;
Curl_expire(data, milli, EXPIRE_ASYNC_NAME);
-#ifdef USE_SOCKETPAIR
+#ifdef USE_SOCKETPAIR
}
#endif
@@ -797,10 +797,10 @@ int Curl_resolver_getsock(struct connectdata *conn,
/*
* Curl_getaddrinfo() - for platforms without getaddrinfo
*/
-struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp)
+struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
{
struct Curl_easy *data = conn->data;
struct resdata *reslv = (struct resdata *)data->state.resolver;
@@ -825,10 +825,10 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
/*
* Curl_resolver_getaddrinfo() - for getaddrinfo
*/
-struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp)
+struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
{
struct addrinfo hints;
int pf = PF_INET;
@@ -853,7 +853,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
break;
}
- if((pf != PF_INET) && !Curl_ipv6works(conn))
+ if((pf != PF_INET) && !Curl_ipv6works(conn))
/* The stack seems to be a non-IPv6 one */
pf = PF_INET;
#endif /* CURLRES_IPV6 */
diff --git a/contrib/libs/curl/lib/asyn.h b/contrib/libs/curl/lib/asyn.h
index 1b7b7652bd..73a9b7268f 100644
--- a/contrib/libs/curl/lib/asyn.h
+++ b/contrib/libs/curl/lib/asyn.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -153,10 +153,10 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
* Each resolver backend must of course make sure to return data in the
* correct format to comply with this.
*/
-struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp);
+struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp);
#ifndef CURLRES_ASYNCH
/* convert these functions if an asynch resolver isn't used */
diff --git a/contrib/libs/curl/lib/base64.c b/contrib/libs/curl/lib/base64.c
index dfb5ad347f..be6f163dc4 100644
--- a/contrib/libs/curl/lib/base64.c
+++ b/contrib/libs/curl/lib/base64.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,9 +26,9 @@
#if !defined(CURL_DISABLE_HTTP_AUTH) || defined(USE_SSH) || \
!defined(CURL_DISABLE_LDAP) || \
- !defined(CURL_DISABLE_SMTP) || \
- !defined(CURL_DISABLE_POP3) || \
- !defined(CURL_DISABLE_IMAP) || \
+ !defined(CURL_DISABLE_SMTP) || \
+ !defined(CURL_DISABLE_POP3) || \
+ !defined(CURL_DISABLE_IMAP) || \
!defined(CURL_DISABLE_DOH) || defined(USE_SSL)
#include "urldata.h" /* for the Curl_easy definition */
diff --git a/contrib/libs/curl/lib/config-amigaos.h b/contrib/libs/curl/lib/config-amigaos.h
index 22bd1e2381..3c9d76ef3d 100644
--- a/contrib/libs/curl/lib/config-amigaos.h
+++ b/contrib/libs/curl/lib/config-amigaos.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -96,7 +96,7 @@
#define OS "AmigaOS"
#define PACKAGE "curl"
-#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/"
+#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/"
#define PACKAGE_NAME "curl"
#define PACKAGE_STRING "curl -"
#define PACKAGE_TARNAME "curl"
diff --git a/contrib/libs/curl/lib/config-dos.h b/contrib/libs/curl/lib/config-dos.h
index a3503949c6..50816ac756 100644
--- a/contrib/libs/curl/lib/config-dos.h
+++ b/contrib/libs/curl/lib/config-dos.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/config-mac.h b/contrib/libs/curl/lib/config-mac.h
index 6224a80592..4e610562f6 100644
--- a/contrib/libs/curl/lib/config-mac.h
+++ b/contrib/libs/curl/lib/config-mac.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/config-os400.h b/contrib/libs/curl/lib/config-os400.h
index e5062b68fd..b8676113d7 100644
--- a/contrib/libs/curl/lib/config-os400.h
+++ b/contrib/libs/curl/lib/config-os400.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/config-plan9.h b/contrib/libs/curl/lib/config-plan9.h
index 58ebb1e849..cc8adde725 100644
--- a/contrib/libs/curl/lib/config-plan9.h
+++ b/contrib/libs/curl/lib/config-plan9.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -33,7 +33,7 @@
#define OS "plan9"
#define PACKAGE "curl"
#define PACKAGE_NAME "curl"
-#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/"
+#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/"
#define PACKAGE_STRING "curl -"
#define PACKAGE_TARNAME "curl"
#define PACKAGE_VERSION "-"
diff --git a/contrib/libs/curl/lib/config-riscos.h b/contrib/libs/curl/lib/config-riscos.h
index c162754f62..9b5f8da921 100644
--- a/contrib/libs/curl/lib/config-riscos.h
+++ b/contrib/libs/curl/lib/config-riscos.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/config-tpf.h b/contrib/libs/curl/lib/config-tpf.h
index 5ce2faf259..bf69179fd5 100644
--- a/contrib/libs/curl/lib/config-tpf.h
+++ b/contrib/libs/curl/lib/config-tpf.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -561,7 +561,7 @@
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT \
- "a suitable curl mailing list => https://curl.se/mail/"
+ "a suitable curl mailing list => https://curl.se/mail/"
/* Define to the full name of this package. */
#define PACKAGE_NAME "curl"
diff --git a/contrib/libs/curl/lib/config-vxworks.h b/contrib/libs/curl/lib/config-vxworks.h
index 3810570e59..73edd530b4 100644
--- a/contrib/libs/curl/lib/config-vxworks.h
+++ b/contrib/libs/curl/lib/config-vxworks.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/config-win32.h b/contrib/libs/curl/lib/config-win32.h
index 778f05d753..e3095576f8 100644
--- a/contrib/libs/curl/lib/config-win32.h
+++ b/contrib/libs/curl/lib/config-win32.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -183,7 +183,7 @@
/* #define HAVE_DOPRNT 1 */
/* Define if you have the ftruncate function. */
-/* #define HAVE_FTRUNCATE 1 */
+/* #define HAVE_FTRUNCATE 1 */
/* Define to 1 if you have the `getpeername' function. */
#define HAVE_GETPEERNAME 1
@@ -714,24 +714,24 @@ Vista
#endif
/* Define to use the Windows crypto library. */
-#if !defined(CURL_WINDOWS_APP)
+#if !defined(CURL_WINDOWS_APP)
#define USE_WIN32_CRYPTO
-#endif
+#endif
-/* On MinGW the ADDRESS_FAMILY typedef was committed alongside LUP_SECURE,
- so we use it to check for the presence of the typedef. */
-#include <ws2tcpip.h>
-#if !defined(__MINGW32__) || defined(LUP_SECURE)
+/* On MinGW the ADDRESS_FAMILY typedef was committed alongside LUP_SECURE,
+ so we use it to check for the presence of the typedef. */
+#include <ws2tcpip.h>
+#if !defined(__MINGW32__) || defined(LUP_SECURE)
/* Define to use Unix sockets. */
#define USE_UNIX_SOCKETS
-#if !defined(UNIX_PATH_MAX)
- /* Replicating logic present in afunix.h of newer Windows 10 SDK versions */
-# define UNIX_PATH_MAX 108
- /* !checksrc! disable TYPEDEFSTRUCT 1 */
- typedef struct sockaddr_un {
- ADDRESS_FAMILY sun_family;
- char sun_path[UNIX_PATH_MAX];
- } SOCKADDR_UN, *PSOCKADDR_UN;
+#if !defined(UNIX_PATH_MAX)
+ /* Replicating logic present in afunix.h of newer Windows 10 SDK versions */
+# define UNIX_PATH_MAX 108
+ /* !checksrc! disable TYPEDEFSTRUCT 1 */
+ typedef struct sockaddr_un {
+ ADDRESS_FAMILY sun_family;
+ char sun_path[UNIX_PATH_MAX];
+ } SOCKADDR_UN, *PSOCKADDR_UN;
#endif
#endif
@@ -745,12 +745,12 @@ Vista
#define OS "i386-pc-win32"
#elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (MSVC >=2005 or gcc) */
#define OS "x86_64-pc-win32"
-#elif defined(_M_IA64) || defined(__ia64__) /* Itanium */
+#elif defined(_M_IA64) || defined(__ia64__) /* Itanium */
#define OS "ia64-pc-win32"
-#elif defined(_M_ARM_NT) || defined(__arm__) /* ARMv7-Thumb2 (Windows RT) */
-#define OS "thumbv7a-pc-win32"
-#elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */
-#define OS "aarch64-pc-win32"
+#elif defined(_M_ARM_NT) || defined(__arm__) /* ARMv7-Thumb2 (Windows RT) */
+#define OS "thumbv7a-pc-win32"
+#elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */
+#define OS "aarch64-pc-win32"
#else
#define OS "unknown-pc-win32"
#endif
diff --git a/contrib/libs/curl/lib/config-win32ce.h b/contrib/libs/curl/lib/config-win32ce.h
index 493d725742..9060836944 100644
--- a/contrib/libs/curl/lib/config-win32ce.h
+++ b/contrib/libs/curl/lib/config-win32ce.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/conncache.c b/contrib/libs/curl/lib/conncache.c
index d74c2a6860..cb3170c480 100644
--- a/contrib/libs/curl/lib/conncache.c
+++ b/contrib/libs/curl/lib/conncache.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2016, Linus Nielsen Feltzing, <linus@haxx.se>
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -49,57 +49,57 @@ static void conn_llist_dtor(void *user, void *element)
conn->bundle = NULL;
}
-static CURLcode bundle_create(struct connectbundle **bundlep)
+static CURLcode bundle_create(struct connectbundle **bundlep)
{
- DEBUGASSERT(*bundlep == NULL);
- *bundlep = malloc(sizeof(struct connectbundle));
- if(!*bundlep)
+ DEBUGASSERT(*bundlep == NULL);
+ *bundlep = malloc(sizeof(struct connectbundle));
+ if(!*bundlep)
return CURLE_OUT_OF_MEMORY;
- (*bundlep)->num_connections = 0;
- (*bundlep)->multiuse = BUNDLE_UNKNOWN;
+ (*bundlep)->num_connections = 0;
+ (*bundlep)->multiuse = BUNDLE_UNKNOWN;
- Curl_llist_init(&(*bundlep)->conn_list, (Curl_llist_dtor) conn_llist_dtor);
+ Curl_llist_init(&(*bundlep)->conn_list, (Curl_llist_dtor) conn_llist_dtor);
return CURLE_OK;
}
-static void bundle_destroy(struct connectbundle *bundle)
+static void bundle_destroy(struct connectbundle *bundle)
{
- if(!bundle)
+ if(!bundle)
return;
- Curl_llist_destroy(&bundle->conn_list, NULL);
+ Curl_llist_destroy(&bundle->conn_list, NULL);
- free(bundle);
+ free(bundle);
}
/* Add a connection to a bundle */
-static void bundle_add_conn(struct connectbundle *bundle,
+static void bundle_add_conn(struct connectbundle *bundle,
struct connectdata *conn)
{
- Curl_llist_insert_next(&bundle->conn_list, bundle->conn_list.tail, conn,
+ Curl_llist_insert_next(&bundle->conn_list, bundle->conn_list.tail, conn,
&conn->bundle_node);
- conn->bundle = bundle;
- bundle->num_connections++;
+ conn->bundle = bundle;
+ bundle->num_connections++;
}
/* Remove a connection from a bundle */
-static int bundle_remove_conn(struct connectbundle *bundle,
+static int bundle_remove_conn(struct connectbundle *bundle,
struct connectdata *conn)
{
- struct Curl_llist_element *curr;
+ struct Curl_llist_element *curr;
- curr = bundle->conn_list.head;
+ curr = bundle->conn_list.head;
while(curr) {
if(curr->ptr == conn) {
- Curl_llist_remove(&bundle->conn_list, curr, NULL);
- bundle->num_connections--;
+ Curl_llist_remove(&bundle->conn_list, curr, NULL);
+ bundle->num_connections--;
conn->bundle = NULL;
return 1; /* we removed a handle */
}
curr = curr->next;
}
- DEBUGASSERT(0);
+ DEBUGASSERT(0);
return 0;
}
@@ -121,8 +121,8 @@ int Curl_conncache_init(struct conncache *connc, int size)
rc = Curl_hash_init(&connc->hash, size, Curl_hash_str,
Curl_str_key_compare, free_bundle_hash_entry);
- if(rc)
- Curl_close(&connc->closure_handle);
+ if(rc)
+ Curl_close(&connc->closure_handle);
else
connc->closure_handle->state.conn_cache = connc;
@@ -143,16 +143,16 @@ static void hashkey(struct connectdata *conn, char *buf,
const char *hostname;
long port = conn->remote_port;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
hostname = conn->http_proxy.host.name;
port = conn->port;
}
else
-#endif
- if(conn->bits.conn_to_host)
- hostname = conn->conn_to_host.name;
- else
+#endif
+ if(conn->bits.conn_to_host)
+ hostname = conn->conn_to_host.name;
+ else
hostname = conn->host.name;
if(hostp)
@@ -169,9 +169,9 @@ static void hashkey(struct connectdata *conn, char *buf,
size_t Curl_conncache_size(struct Curl_easy *data)
{
size_t num;
- CONNCACHE_LOCK(data);
+ CONNCACHE_LOCK(data);
num = data->state.conn_cache->num_conn;
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
return num;
}
@@ -184,7 +184,7 @@ struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn,
const char **hostp)
{
struct connectbundle *bundle = NULL;
- CONNCACHE_LOCK(conn->data);
+ CONNCACHE_LOCK(conn->data);
if(connc) {
char key[HASHKEY_SIZE];
hashkey(conn, key, sizeof(key), hostp);
@@ -206,8 +206,8 @@ static bool conncache_add_bundle(struct conncache *connc,
static void conncache_remove_bundle(struct conncache *connc,
struct connectbundle *bundle)
{
- struct Curl_hash_iterator iter;
- struct Curl_hash_element *he;
+ struct Curl_hash_iterator iter;
+ struct Curl_hash_element *he;
if(!connc)
return;
@@ -231,7 +231,7 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc,
struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct connectbundle *bundle = NULL;
+ struct connectbundle *bundle = NULL;
struct Curl_easy *data = conn->data;
/* *find_bundle() locks the connection cache */
@@ -240,16 +240,16 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc,
int rc;
char key[HASHKEY_SIZE];
- result = bundle_create(&bundle);
+ result = bundle_create(&bundle);
if(result) {
goto unlock;
}
hashkey(conn, key, sizeof(key), NULL);
- rc = conncache_add_bundle(data->state.conn_cache, key, bundle);
+ rc = conncache_add_bundle(data->state.conn_cache, key, bundle);
if(!rc) {
- bundle_destroy(bundle);
+ bundle_destroy(bundle);
result = CURLE_OUT_OF_MEMORY;
goto unlock;
}
@@ -264,17 +264,17 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc,
conn->connection_id, connc->num_conn));
unlock:
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
return result;
}
/*
- * Removes the connectdata object from the connection cache, but does *not*
- * clear the conn->data association. The transfer still owns this connection.
- *
- * Pass TRUE/FALSE in the 'lock' argument depending on if the parent function
- * already holds the lock or not.
+ * Removes the connectdata object from the connection cache, but does *not*
+ * clear the conn->data association. The transfer still owns this connection.
+ *
+ * Pass TRUE/FALSE in the 'lock' argument depending on if the parent function
+ * already holds the lock or not.
*/
void Curl_conncache_remove_conn(struct Curl_easy *data,
struct connectdata *conn, bool lock)
@@ -286,7 +286,7 @@ void Curl_conncache_remove_conn(struct Curl_easy *data,
due to a failed connection attempt, before being added to a bundle */
if(bundle) {
if(lock) {
- CONNCACHE_LOCK(data);
+ CONNCACHE_LOCK(data);
}
bundle_remove_conn(bundle, conn);
if(bundle->num_connections == 0)
@@ -298,7 +298,7 @@ void Curl_conncache_remove_conn(struct Curl_easy *data,
connc->num_conn));
}
if(lock) {
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
}
}
}
@@ -320,14 +320,14 @@ bool Curl_conncache_foreach(struct Curl_easy *data,
void *param,
int (*func)(struct connectdata *conn, void *param))
{
- struct Curl_hash_iterator iter;
- struct Curl_llist_element *curr;
- struct Curl_hash_element *he;
+ struct Curl_hash_iterator iter;
+ struct Curl_llist_element *curr;
+ struct Curl_hash_element *he;
if(!connc)
return FALSE;
- CONNCACHE_LOCK(data);
+ CONNCACHE_LOCK(data);
Curl_hash_start_iterate(&connc->hash, &iter);
he = Curl_hash_next_element(&iter);
@@ -345,12 +345,12 @@ bool Curl_conncache_foreach(struct Curl_easy *data,
curr = curr->next;
if(1 == func(conn, param)) {
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
return TRUE;
}
}
}
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
return FALSE;
}
@@ -363,15 +363,15 @@ bool Curl_conncache_foreach(struct Curl_easy *data,
static struct connectdata *
conncache_find_first_connection(struct conncache *connc)
{
- struct Curl_hash_iterator iter;
- struct Curl_hash_element *he;
+ struct Curl_hash_iterator iter;
+ struct Curl_hash_element *he;
struct connectbundle *bundle;
Curl_hash_start_iterate(&connc->hash, &iter);
he = Curl_hash_next_element(&iter);
while(he) {
- struct Curl_llist_element *curr;
+ struct Curl_llist_element *curr;
bundle = he->ptr;
curr = bundle->conn_list.head;
@@ -391,8 +391,8 @@ conncache_find_first_connection(struct conncache *connc)
*
* Return TRUE if stored, FALSE if closed.
*/
-bool Curl_conncache_return_conn(struct Curl_easy *data,
- struct connectdata *conn)
+bool Curl_conncache_return_conn(struct Curl_easy *data,
+ struct connectdata *conn)
{
/* data->multi->maxconnects can be negative, deal with it. */
size_t maxconnects =
@@ -429,7 +429,7 @@ struct connectdata *
Curl_conncache_extract_bundle(struct Curl_easy *data,
struct connectbundle *bundle)
{
- struct Curl_llist_element *curr;
+ struct Curl_llist_element *curr;
timediff_t highscore = -1;
timediff_t score;
struct curltime now;
@@ -477,9 +477,9 @@ struct connectdata *
Curl_conncache_extract_oldest(struct Curl_easy *data)
{
struct conncache *connc = data->state.conn_cache;
- struct Curl_hash_iterator iter;
- struct Curl_llist_element *curr;
- struct Curl_hash_element *he;
+ struct Curl_hash_iterator iter;
+ struct Curl_llist_element *curr;
+ struct Curl_hash_element *he;
timediff_t highscore =- 1;
timediff_t score;
struct curltime now;
@@ -489,7 +489,7 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
now = Curl_now();
- CONNCACHE_LOCK(data);
+ CONNCACHE_LOCK(data);
Curl_hash_start_iterate(&connc->hash, &iter);
he = Curl_hash_next_element(&iter);
@@ -502,8 +502,8 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
while(curr) {
conn = curr->ptr;
- if(!CONN_INUSE(conn) && !conn->data && !conn->bits.close &&
- !conn->bits.connect_only) {
+ if(!CONN_INUSE(conn) && !conn->data && !conn->bits.close &&
+ !conn->bits.connect_only) {
/* Set higher score for the age passed since the connection was used */
score = Curl_timediff(now, conn->lastused);
@@ -526,7 +526,7 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
connc->num_conn));
conn_candidate->data = data; /* associate! */
}
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
return conn_candidate;
}
@@ -534,11 +534,11 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
void Curl_conncache_close_all_connections(struct conncache *connc)
{
struct connectdata *conn;
- char buffer[READBUFFER_MIN + 1];
- if(!connc->closure_handle)
- return;
- connc->closure_handle->state.buffer = buffer;
- connc->closure_handle->set.buffer_size = READBUFFER_MIN;
+ char buffer[READBUFFER_MIN + 1];
+ if(!connc->closure_handle)
+ return;
+ connc->closure_handle->state.buffer = buffer;
+ connc->closure_handle->set.buffer_size = READBUFFER_MIN;
conn = conncache_find_first_connection(connc);
while(conn) {
@@ -548,21 +548,21 @@ void Curl_conncache_close_all_connections(struct conncache *connc)
sigpipe_ignore(conn->data, &pipe_st);
/* This will remove the connection from the cache */
connclose(conn, "kill all");
- Curl_conncache_remove_conn(conn->data, conn, TRUE);
+ Curl_conncache_remove_conn(conn->data, conn, TRUE);
(void)Curl_disconnect(connc->closure_handle, conn, FALSE);
sigpipe_restore(&pipe_st);
conn = conncache_find_first_connection(connc);
}
- connc->closure_handle->state.buffer = NULL;
+ connc->closure_handle->state.buffer = NULL;
if(connc->closure_handle) {
SIGPIPE_VARIABLE(pipe_st);
sigpipe_ignore(connc->closure_handle, &pipe_st);
Curl_hostcache_clean(connc->closure_handle,
connc->closure_handle->dns.hostcache);
- Curl_close(&connc->closure_handle);
+ Curl_close(&connc->closure_handle);
sigpipe_restore(&pipe_st);
}
}
@@ -571,9 +571,9 @@ void Curl_conncache_close_all_connections(struct conncache *connc)
/* Useful for debugging the connection cache */
void Curl_conncache_print(struct conncache *connc)
{
- struct Curl_hash_iterator iter;
- struct Curl_llist_element *curr;
- struct Curl_hash_element *he;
+ struct Curl_hash_iterator iter;
+ struct Curl_llist_element *curr;
+ struct Curl_hash_element *he;
if(!connc)
return;
diff --git a/contrib/libs/curl/lib/conncache.h b/contrib/libs/curl/lib/conncache.h
index 12c7d3f700..ac5460ff4b 100644
--- a/contrib/libs/curl/lib/conncache.h
+++ b/contrib/libs/curl/lib/conncache.h
@@ -7,12 +7,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2015 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2015 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2014, Linus Nielsen Feltzing, <linus@haxx.se>
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -30,7 +30,7 @@
*/
struct conncache {
- struct Curl_hash hash;
+ struct Curl_hash hash;
size_t num_conn;
long next_connection_id;
struct curltime last_cleanup;
@@ -42,31 +42,31 @@ struct conncache {
#define BUNDLE_UNKNOWN 0 /* initial value */
#define BUNDLE_MULTIPLEX 2
-#ifdef CURLDEBUG
-/* the debug versions of these macros make extra certain that the lock is
- never doubly locked or unlocked */
-#define CONNCACHE_LOCK(x) if((x)->share) { \
- Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE); \
- DEBUGASSERT(!(x)->state.conncache_lock); \
- (x)->state.conncache_lock = TRUE; \
- }
-
-#define CONNCACHE_UNLOCK(x) if((x)->share) { \
- DEBUGASSERT((x)->state.conncache_lock); \
- (x)->state.conncache_lock = FALSE; \
- Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT); \
- }
-#else
-#define CONNCACHE_LOCK(x) if((x)->share) \
- Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE)
-#define CONNCACHE_UNLOCK(x) if((x)->share) \
- Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT)
-#endif
-
+#ifdef CURLDEBUG
+/* the debug versions of these macros make extra certain that the lock is
+ never doubly locked or unlocked */
+#define CONNCACHE_LOCK(x) if((x)->share) { \
+ Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE); \
+ DEBUGASSERT(!(x)->state.conncache_lock); \
+ (x)->state.conncache_lock = TRUE; \
+ }
+
+#define CONNCACHE_UNLOCK(x) if((x)->share) { \
+ DEBUGASSERT((x)->state.conncache_lock); \
+ (x)->state.conncache_lock = FALSE; \
+ Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT); \
+ }
+#else
+#define CONNCACHE_LOCK(x) if((x)->share) \
+ Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE)
+#define CONNCACHE_UNLOCK(x) if((x)->share) \
+ Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT)
+#endif
+
struct connectbundle {
int multiuse; /* supports multi-use */
size_t num_connections; /* Number of connections in the bundle */
- struct Curl_llist conn_list; /* The connectdata members of the bundle */
+ struct Curl_llist conn_list; /* The connectdata members of the bundle */
};
/* returns 1 on error, 0 is fine */
@@ -80,8 +80,8 @@ struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn,
/* returns number of connections currently held in the connection cache */
size_t Curl_conncache_size(struct Curl_easy *data);
-bool Curl_conncache_return_conn(struct Curl_easy *data,
- struct connectdata *conn);
+bool Curl_conncache_return_conn(struct Curl_easy *data,
+ struct connectdata *conn);
CURLcode Curl_conncache_add_conn(struct conncache *connc,
struct connectdata *conn) WARN_UNUSED_RESULT;
void Curl_conncache_remove_conn(struct Curl_easy *data,
diff --git a/contrib/libs/curl/lib/connect.c b/contrib/libs/curl/lib/connect.c
index 413ac2c7cd..e65d24d9e9 100644
--- a/contrib/libs/curl/lib/connect.c
+++ b/contrib/libs/curl/lib/connect.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -74,7 +74,7 @@
#include "warnless.h"
#include "conncache.h"
#include "multihandle.h"
-#include "version_win32.h"
+#include "version_win32.h"
#include "quic.h"
#include "socks.h"
@@ -161,13 +161,13 @@ tcpkeepalive(struct Curl_easy *data,
static CURLcode
singleipconnect(struct connectdata *conn,
- const struct Curl_addrinfo *ai, /* start connecting to this */
- int tempindex); /* 0 or 1 among the temp ones */
+ const struct Curl_addrinfo *ai, /* start connecting to this */
+ int tempindex); /* 0 or 1 among the temp ones */
/*
* Curl_timeleft() returns the amount of milliseconds left allowed for the
- * transfer/connection. If the value is 0, there's no timeout (ie there's
- * infinite time left). If the value is negative, the timeout time has already
+ * transfer/connection. If the value is 0, there's no timeout (ie there's
+ * infinite time left). If the value is negative, the timeout time has already
* elapsed.
*
* The start time is stored in progress.t_startsingle - as set with
@@ -551,22 +551,22 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
return rc;
}
-/* update tempaddr[tempindex] (to the next entry), makes sure to stick
- to the correct family */
-static struct Curl_addrinfo *ainext(struct connectdata *conn,
- int tempindex,
- bool next) /* use next entry? */
-{
- struct Curl_addrinfo *ai = conn->tempaddr[tempindex];
- if(ai && next)
- ai = ai->ai_next;
- while(ai && (ai->ai_family != conn->tempfamily[tempindex]))
- ai = ai->ai_next;
- conn->tempaddr[tempindex] = ai;
- return ai;
-}
-
-/* Used within the multi interface. Try next IP address, returns error if no
+/* update tempaddr[tempindex] (to the next entry), makes sure to stick
+ to the correct family */
+static struct Curl_addrinfo *ainext(struct connectdata *conn,
+ int tempindex,
+ bool next) /* use next entry? */
+{
+ struct Curl_addrinfo *ai = conn->tempaddr[tempindex];
+ if(ai && next)
+ ai = ai->ai_next;
+ while(ai && (ai->ai_family != conn->tempfamily[tempindex]))
+ ai = ai->ai_next;
+ conn->tempaddr[tempindex] = ai;
+ return ai;
+}
+
+/* Used within the multi interface. Try next IP address, returns error if no
more address exists or error */
static CURLcode trynextip(struct connectdata *conn,
int sockindex,
@@ -582,13 +582,13 @@ static CURLcode trynextip(struct connectdata *conn,
conn->tempsock[tempindex] = CURL_SOCKET_BAD;
if(sockindex == FIRSTSOCKET) {
- struct Curl_addrinfo *ai = conn->tempaddr[tempindex];
+ struct Curl_addrinfo *ai = conn->tempaddr[tempindex];
while(ai) {
if(ai) {
result = singleipconnect(conn, ai, tempindex);
if(result == CURLE_COULDNT_CONNECT) {
- ai = ainext(conn, tempindex, TRUE);
+ ai = ainext(conn, tempindex, TRUE);
continue;
}
}
@@ -652,7 +652,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
#endif
#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)
case AF_UNIX:
- if(salen > (curl_socklen_t)sizeof(sa_family_t)) {
+ if(salen > (curl_socklen_t)sizeof(sa_family_t)) {
su = (struct sockaddr_un*)sa;
msnprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
}
@@ -673,155 +673,155 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
/* retrieves the start/end point information of a socket of an established
connection */
-void Curl_conninfo_remote(struct connectdata *conn, curl_socket_t sockfd)
+void Curl_conninfo_remote(struct connectdata *conn, curl_socket_t sockfd)
{
-#ifdef HAVE_GETPEERNAME
- char buffer[STRERROR_LEN];
- struct Curl_sockaddr_storage ssrem;
- curl_socklen_t plen;
- plen = sizeof(struct Curl_sockaddr_storage);
- if(getpeername(sockfd, (struct sockaddr*) &ssrem, &plen)) {
- int error = SOCKERRNO;
- failf(conn->data, "getpeername() failed with errno %d: %s",
- error, Curl_strerror(error, buffer, sizeof(buffer)));
+#ifdef HAVE_GETPEERNAME
+ char buffer[STRERROR_LEN];
+ struct Curl_sockaddr_storage ssrem;
+ curl_socklen_t plen;
+ plen = sizeof(struct Curl_sockaddr_storage);
+ if(getpeername(sockfd, (struct sockaddr*) &ssrem, &plen)) {
+ int error = SOCKERRNO;
+ failf(conn->data, "getpeername() failed with errno %d: %s",
+ error, Curl_strerror(error, buffer, sizeof(buffer)));
return;
- }
- if(!Curl_addr2string((struct sockaddr*)&ssrem, plen,
- conn->primary_ip, &conn->primary_port)) {
- failf(conn->data, "ssrem inet_ntop() failed with errno %d: %s",
- errno, Curl_strerror(errno, buffer, sizeof(buffer)));
- return;
- }
- memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);
-#else
- (void)conn;
- (void)sockfd;
-#endif
-}
-
-/* retrieves the start/end point information of a socket of an established
- connection */
-void Curl_conninfo_local(struct connectdata *conn, curl_socket_t sockfd)
-{
+ }
+ if(!Curl_addr2string((struct sockaddr*)&ssrem, plen,
+ conn->primary_ip, &conn->primary_port)) {
+ failf(conn->data, "ssrem inet_ntop() failed with errno %d: %s",
+ errno, Curl_strerror(errno, buffer, sizeof(buffer)));
+ return;
+ }
+ memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);
+#else
+ (void)conn;
+ (void)sockfd;
+#endif
+}
+
+/* retrieves the start/end point information of a socket of an established
+ connection */
+void Curl_conninfo_local(struct connectdata *conn, curl_socket_t sockfd)
+{
#ifdef HAVE_GETSOCKNAME
- char buffer[STRERROR_LEN];
- struct Curl_sockaddr_storage ssloc;
- curl_socklen_t slen;
- slen = sizeof(struct Curl_sockaddr_storage);
- memset(&ssloc, 0, sizeof(ssloc));
- if(getsockname(sockfd, (struct sockaddr*) &ssloc, &slen)) {
- int error = SOCKERRNO;
- failf(conn->data, "getsockname() failed with errno %d: %s",
- error, Curl_strerror(error, buffer, sizeof(buffer)));
- return;
+ char buffer[STRERROR_LEN];
+ struct Curl_sockaddr_storage ssloc;
+ curl_socklen_t slen;
+ slen = sizeof(struct Curl_sockaddr_storage);
+ memset(&ssloc, 0, sizeof(ssloc));
+ if(getsockname(sockfd, (struct sockaddr*) &ssloc, &slen)) {
+ int error = SOCKERRNO;
+ failf(conn->data, "getsockname() failed with errno %d: %s",
+ error, Curl_strerror(error, buffer, sizeof(buffer)));
+ return;
}
- if(!Curl_addr2string((struct sockaddr*)&ssloc, slen,
- conn->local_ip, &conn->local_port)) {
- failf(conn->data, "ssloc inet_ntop() failed with errno %d: %s",
- errno, Curl_strerror(errno, buffer, sizeof(buffer)));
- return;
- }
-#else
- (void)conn;
- (void)sockfd;
+ if(!Curl_addr2string((struct sockaddr*)&ssloc, slen,
+ conn->local_ip, &conn->local_port)) {
+ failf(conn->data, "ssloc inet_ntop() failed with errno %d: %s",
+ errno, Curl_strerror(errno, buffer, sizeof(buffer)));
+ return;
+ }
+#else
+ (void)conn;
+ (void)sockfd;
#endif
-}
-
-/* retrieves the start/end point information of a socket of an established
- connection */
-void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd)
-{
- if(conn->transport == TRNSPRT_TCP) {
- if(!conn->bits.reuse && !conn->bits.tcp_fastopen) {
- Curl_conninfo_remote(conn, sockfd);
- Curl_conninfo_local(conn, sockfd);
- }
- } /* end of TCP-only section */
-
+}
+
+/* retrieves the start/end point information of a socket of an established
+ connection */
+void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd)
+{
+ if(conn->transport == TRNSPRT_TCP) {
+ if(!conn->bits.reuse && !conn->bits.tcp_fastopen) {
+ Curl_conninfo_remote(conn, sockfd);
+ Curl_conninfo_local(conn, sockfd);
+ }
+ } /* end of TCP-only section */
+
/* persist connection info in session handle */
Curl_persistconninfo(conn);
}
-/* After a TCP connection to the proxy has been verified, this function does
- the next magic steps. If 'done' isn't set TRUE, it is not done yet and
- must be called again.
+/* After a TCP connection to the proxy has been verified, this function does
+ the next magic steps. If 'done' isn't set TRUE, it is not done yet and
+ must be called again.
Note: this function's sub-functions call failf()
*/
-static CURLcode connect_SOCKS(struct connectdata *conn, int sockindex,
- bool *done)
+static CURLcode connect_SOCKS(struct connectdata *conn, int sockindex,
+ bool *done)
{
CURLcode result = CURLE_OK;
-#ifndef CURL_DISABLE_PROXY
- CURLproxycode pxresult = CURLPX_OK;
+#ifndef CURL_DISABLE_PROXY
+ CURLproxycode pxresult = CURLPX_OK;
if(conn->bits.socksproxy) {
/* for the secondary socket (FTP), use the "connect to host"
* but ignore the "connect to port" (use the secondary port)
*/
- const char * const host =
- conn->bits.httpproxy ?
- conn->http_proxy.host.name :
- conn->bits.conn_to_host ?
- conn->conn_to_host.name :
- sockindex == SECONDARYSOCKET ?
- conn->secondaryhostname : conn->host.name;
- const int port =
- conn->bits.httpproxy ? (int)conn->http_proxy.port :
- sockindex == SECONDARYSOCKET ? conn->secondary_port :
- conn->bits.conn_to_port ? conn->conn_to_port :
- conn->remote_port;
+ const char * const host =
+ conn->bits.httpproxy ?
+ conn->http_proxy.host.name :
+ conn->bits.conn_to_host ?
+ conn->conn_to_host.name :
+ sockindex == SECONDARYSOCKET ?
+ conn->secondaryhostname : conn->host.name;
+ const int port =
+ conn->bits.httpproxy ? (int)conn->http_proxy.port :
+ sockindex == SECONDARYSOCKET ? conn->secondary_port :
+ conn->bits.conn_to_port ? conn->conn_to_port :
+ conn->remote_port;
switch(conn->socks_proxy.proxytype) {
case CURLPROXY_SOCKS5:
case CURLPROXY_SOCKS5_HOSTNAME:
- pxresult = Curl_SOCKS5(conn->socks_proxy.user, conn->socks_proxy.passwd,
- host, port, sockindex, conn, done);
+ pxresult = Curl_SOCKS5(conn->socks_proxy.user, conn->socks_proxy.passwd,
+ host, port, sockindex, conn, done);
break;
case CURLPROXY_SOCKS4:
case CURLPROXY_SOCKS4A:
- pxresult = Curl_SOCKS4(conn->socks_proxy.user, host, port, sockindex,
- conn, done);
+ pxresult = Curl_SOCKS4(conn->socks_proxy.user, host, port, sockindex,
+ conn, done);
break;
default:
failf(conn->data, "unknown proxytype option given");
result = CURLE_COULDNT_CONNECT;
} /* switch proxytype */
- if(pxresult) {
- result = CURLE_PROXY;
- conn->data->info.pxcode = pxresult;
- }
- }
- else
+ if(pxresult) {
+ result = CURLE_PROXY;
+ conn->data->info.pxcode = pxresult;
+ }
+ }
+ else
#else
- (void)conn;
- (void)sockindex;
+ (void)conn;
+ (void)sockindex;
#endif /* CURL_DISABLE_PROXY */
- *done = TRUE; /* no SOCKS proxy, so consider us connected */
+ *done = TRUE; /* no SOCKS proxy, so consider us connected */
return result;
}
/*
- * post_SOCKS() is called after a successful connect to the peer, which
- * *could* be a SOCKS proxy
- */
-static void post_SOCKS(struct connectdata *conn,
- int sockindex,
- bool *connected)
-{
- conn->bits.tcpconnect[sockindex] = TRUE;
-
- *connected = TRUE;
- if(sockindex == FIRSTSOCKET)
- Curl_pgrsTime(conn->data, TIMER_CONNECT); /* connect done */
- Curl_updateconninfo(conn, conn->sock[sockindex]);
- Curl_verboseconnect(conn);
- conn->data->info.numconnects++; /* to track the number of connections made */
-}
-
-/*
+ * post_SOCKS() is called after a successful connect to the peer, which
+ * *could* be a SOCKS proxy
+ */
+static void post_SOCKS(struct connectdata *conn,
+ int sockindex,
+ bool *connected)
+{
+ conn->bits.tcpconnect[sockindex] = TRUE;
+
+ *connected = TRUE;
+ if(sockindex == FIRSTSOCKET)
+ Curl_pgrsTime(conn->data, TIMER_CONNECT); /* connect done */
+ Curl_updateconninfo(conn, conn->sock[sockindex]);
+ Curl_verboseconnect(conn);
+ conn->data->info.numconnects++; /* to track the number of connections made */
+}
+
+/*
* Curl_is_connected() checks if the socket has connected.
*/
@@ -834,8 +834,8 @@ CURLcode Curl_is_connected(struct connectdata *conn,
timediff_t allow;
int error = 0;
struct curltime now;
- int rc = 0;
- unsigned int i;
+ int rc = 0;
+ unsigned int i;
DEBUGASSERT(sockindex >= FIRSTSOCKET && sockindex <= SECONDARYSOCKET);
@@ -858,62 +858,62 @@ CURLcode Curl_is_connected(struct connectdata *conn,
return CURLE_OPERATION_TIMEDOUT;
}
- if(SOCKS_STATE(conn->cnnct.state)) {
- /* still doing SOCKS */
- result = connect_SOCKS(conn, sockindex, connected);
- if(!result && *connected)
- post_SOCKS(conn, sockindex, connected);
- return result;
- }
-
+ if(SOCKS_STATE(conn->cnnct.state)) {
+ /* still doing SOCKS */
+ result = connect_SOCKS(conn, sockindex, connected);
+ if(!result && *connected)
+ post_SOCKS(conn, sockindex, connected);
+ return result;
+ }
+
for(i = 0; i<2; i++) {
const int other = i ^ 1;
if(conn->tempsock[i] == CURL_SOCKET_BAD)
continue;
- error = 0;
+ error = 0;
#ifdef ENABLE_QUIC
if(conn->transport == TRNSPRT_QUIC) {
result = Curl_quic_is_connected(conn, i, connected);
- if(!result && *connected) {
+ if(!result && *connected) {
/* use this socket from now on */
conn->sock[sockindex] = conn->tempsock[i];
conn->ip_addr = conn->tempaddr[i];
conn->tempsock[i] = CURL_SOCKET_BAD;
- post_SOCKS(conn, sockindex, connected);
+ post_SOCKS(conn, sockindex, connected);
connkeep(conn, "HTTP/3 default");
- return CURLE_OK;
+ return CURLE_OK;
}
- if(result)
- error = SOCKERRNO;
+ if(result)
+ error = SOCKERRNO;
}
- else
+ else
#endif
- {
+ {
#ifdef mpeix
- /* Call this function once now, and ignore the results. We do this to
- "clear" the error state on the socket so that we can later read it
- reliably. This is reported necessary on the MPE/iX operating
- system. */
- (void)verifyconnect(conn->tempsock[i], NULL);
+ /* Call this function once now, and ignore the results. We do this to
+ "clear" the error state on the socket so that we can later read it
+ reliably. This is reported necessary on the MPE/iX operating
+ system. */
+ (void)verifyconnect(conn->tempsock[i], NULL);
#endif
- /* check socket for connect */
- rc = SOCKET_WRITABLE(conn->tempsock[i], 0);
- }
+ /* check socket for connect */
+ rc = SOCKET_WRITABLE(conn->tempsock[i], 0);
+ }
if(rc == 0) { /* no connection yet */
- if(Curl_timediff(now, conn->connecttime) >=
- conn->timeoutms_per_addr[i]) {
+ if(Curl_timediff(now, conn->connecttime) >=
+ conn->timeoutms_per_addr[i]) {
infof(data, "After %" CURL_FORMAT_TIMEDIFF_T
- "ms connect time, move on!\n", conn->timeoutms_per_addr[i]);
+ "ms connect time, move on!\n", conn->timeoutms_per_addr[i]);
error = ETIMEDOUT;
}
/* should we try another protocol family? */
- if(i == 0 && !conn->bits.parallel_connect &&
+ if(i == 0 && !conn->bits.parallel_connect &&
(Curl_timediff(now, conn->connecttime) >=
data->set.happy_eyeballs_timeout)) {
- conn->bits.parallel_connect = TRUE; /* starting now */
+ conn->bits.parallel_connect = TRUE; /* starting now */
trynextip(conn, sockindex, 1);
}
}
@@ -935,20 +935,20 @@ CURLcode Curl_is_connected(struct connectdata *conn,
conn->tempsock[other] = CURL_SOCKET_BAD;
}
- /* see if we need to kick off any SOCKS proxy magic once we
- connected */
- result = connect_SOCKS(conn, sockindex, connected);
- if(result || !*connected)
+ /* see if we need to kick off any SOCKS proxy magic once we
+ connected */
+ result = connect_SOCKS(conn, sockindex, connected);
+ if(result || !*connected)
return result;
- post_SOCKS(conn, sockindex, connected);
+ post_SOCKS(conn, sockindex, connected);
return CURLE_OK;
}
}
- else if(rc & CURL_CSELECT_ERR) {
+ else if(rc & CURL_CSELECT_ERR) {
(void)verifyconnect(conn->tempsock[i], &error);
- }
+ }
/*
* The connection failed here, we should attempt to connect to the "next
@@ -959,19 +959,19 @@ CURLcode Curl_is_connected(struct connectdata *conn,
SET_SOCKERRNO(error);
if(conn->tempaddr[i]) {
CURLcode status;
-#ifndef CURL_DISABLE_VERBOSE_STRINGS
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
char ipaddress[MAX_IPADR_LEN];
char buffer[STRERROR_LEN];
- Curl_printable_address(conn->tempaddr[i], ipaddress,
- sizeof(ipaddress));
+ Curl_printable_address(conn->tempaddr[i], ipaddress,
+ sizeof(ipaddress));
infof(data, "connect to %s port %ld failed: %s\n",
ipaddress, conn->port,
Curl_strerror(error, buffer, sizeof(buffer)));
-#endif
+#endif
- conn->timeoutms_per_addr[i] = conn->tempaddr[i]->ai_next == NULL ?
+ conn->timeoutms_per_addr[i] = conn->tempaddr[i]->ai_next == NULL ?
allow : allow / 2;
- ainext(conn, i, TRUE);
+ ainext(conn, i, TRUE);
status = trynextip(conn, sockindex, i);
if((status != CURLE_COULDNT_CONNECT) ||
conn->tempsock[other] == CURL_SOCKET_BAD)
@@ -981,48 +981,48 @@ CURLcode Curl_is_connected(struct connectdata *conn,
}
}
- if(result &&
- (conn->tempsock[0] == CURL_SOCKET_BAD) &&
- (conn->tempsock[1] == CURL_SOCKET_BAD)) {
+ if(result &&
+ (conn->tempsock[0] == CURL_SOCKET_BAD) &&
+ (conn->tempsock[1] == CURL_SOCKET_BAD)) {
/* no more addresses to try */
const char *hostname;
char buffer[STRERROR_LEN];
- /* if the first address family runs out of addresses to try before the
- happy eyeball timeout, go ahead and try the next family now */
- result = trynextip(conn, sockindex, 1);
- if(!result)
- return result;
+ /* if the first address family runs out of addresses to try before the
+ happy eyeball timeout, go ahead and try the next family now */
+ result = trynextip(conn, sockindex, 1);
+ if(!result)
+ return result;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.socksproxy)
hostname = conn->socks_proxy.host.name;
else if(conn->bits.httpproxy)
hostname = conn->http_proxy.host.name;
else
-#endif
- if(conn->bits.conn_to_host)
- hostname = conn->conn_to_host.name;
- else
+#endif
+ if(conn->bits.conn_to_host)
+ hostname = conn->conn_to_host.name;
+ else
hostname = conn->host.name;
failf(data, "Failed to connect to %s port %ld: %s",
hostname, conn->port,
Curl_strerror(error, buffer, sizeof(buffer)));
-
- Curl_quic_disconnect(conn, 0);
- Curl_quic_disconnect(conn, 1);
-
-#ifdef WSAETIMEDOUT
- if(WSAETIMEDOUT == data->state.os_errno)
- result = CURLE_OPERATION_TIMEDOUT;
-#elif defined(ETIMEDOUT)
- if(ETIMEDOUT == data->state.os_errno)
- result = CURLE_OPERATION_TIMEDOUT;
-#endif
+
+ Curl_quic_disconnect(conn, 0);
+ Curl_quic_disconnect(conn, 1);
+
+#ifdef WSAETIMEDOUT
+ if(WSAETIMEDOUT == data->state.os_errno)
+ result = CURLE_OPERATION_TIMEDOUT;
+#elif defined(ETIMEDOUT)
+ if(ETIMEDOUT == data->state.os_errno)
+ result = CURLE_OPERATION_TIMEDOUT;
+#endif
}
- else
- result = CURLE_OK; /* still trying */
+ else
+ result = CURLE_OK; /* still trying */
return result;
}
@@ -1030,12 +1030,12 @@ CURLcode Curl_is_connected(struct connectdata *conn,
static void tcpnodelay(struct connectdata *conn, curl_socket_t sockfd)
{
#if defined(TCP_NODELAY)
- curl_socklen_t onoff = (curl_socklen_t) 1;
- int level = IPPROTO_TCP;
+ curl_socklen_t onoff = (curl_socklen_t) 1;
+ int level = IPPROTO_TCP;
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
struct Curl_easy *data = conn->data;
char buffer[STRERROR_LEN];
-#else
+#else
(void) conn;
#endif
@@ -1096,8 +1096,8 @@ void Curl_sndbufset(curl_socket_t sockfd)
static int detectOsState = DETECT_OS_NONE;
if(detectOsState == DETECT_OS_NONE) {
- if(curlx_verify_windows_version(6, 0, PLATFORM_WINNT,
- VERSION_GREATER_THAN_EQUAL))
+ if(curlx_verify_windows_version(6, 0, PLATFORM_WINNT,
+ VERSION_GREATER_THAN_EQUAL))
detectOsState = DETECT_OS_VISTA_OR_LATER;
else
detectOsState = DETECT_OS_PREVISTA;
@@ -1124,8 +1124,8 @@ void Curl_sndbufset(curl_socket_t sockfd)
* having connected.
*/
static CURLcode singleipconnect(struct connectdata *conn,
- const struct Curl_addrinfo *ai,
- int tempindex)
+ const struct Curl_addrinfo *ai,
+ int tempindex)
{
struct Curl_sockaddr_ex addr;
int rc = -1;
@@ -1141,12 +1141,12 @@ static CURLcode singleipconnect(struct connectdata *conn,
int optval = 1;
#endif
char buffer[STRERROR_LEN];
- curl_socket_t *sockp = &conn->tempsock[tempindex];
+ curl_socket_t *sockp = &conn->tempsock[tempindex];
*sockp = CURL_SOCKET_BAD;
result = Curl_socket(conn, ai, &addr, &sockfd);
if(result)
- return result;
+ return result;
/* store remote address and port used in this connection attempt */
if(!Curl_addr2string((struct sockaddr*)&addr.sa_addr, addr.addrlen,
@@ -1214,10 +1214,10 @@ static CURLcode singleipconnect(struct connectdata *conn,
(void)curlx_nonblock(sockfd, TRUE);
conn->connecttime = Curl_now();
- if(conn->num_addr > 1) {
- Curl_expire(data, conn->timeoutms_per_addr[0], EXPIRE_DNS_PER_NAME);
- Curl_expire(data, conn->timeoutms_per_addr[1], EXPIRE_DNS_PER_NAME2);
- }
+ if(conn->num_addr > 1) {
+ Curl_expire(data, conn->timeoutms_per_addr[0], EXPIRE_DNS_PER_NAME);
+ Curl_expire(data, conn->timeoutms_per_addr[1], EXPIRE_DNS_PER_NAME2);
+ }
/* Connect TCP and QUIC sockets */
if(!isconnected && (conn->transport != TRNSPRT_UDP)) {
@@ -1268,7 +1268,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
else if(conn->transport == TRNSPRT_QUIC) {
/* pass in 'sockfd' separately since it hasn't been put into the
tempsock array at this point */
- result = Curl_quic_connect(conn, sockfd, tempindex,
+ result = Curl_quic_connect(conn, sockfd, tempindex,
&addr.sa_addr, addr.addrlen);
if(result)
error = SOCKERRNO;
@@ -1325,8 +1325,8 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
{
struct Curl_easy *data = conn->data;
CURLcode result = CURLE_COULDNT_CONNECT;
- int i;
- timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ int i;
+ timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* a precaution, no need to continue if time already is up */
@@ -1335,39 +1335,39 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
}
conn->num_addr = Curl_num_addresses(remotehost->addr);
- conn->tempaddr[0] = conn->tempaddr[1] = remotehost->addr;
- conn->tempsock[0] = conn->tempsock[1] = CURL_SOCKET_BAD;
+ conn->tempaddr[0] = conn->tempaddr[1] = remotehost->addr;
+ conn->tempsock[0] = conn->tempsock[1] = CURL_SOCKET_BAD;
/* Max time for the next connection attempt */
- conn->timeoutms_per_addr[0] =
+ conn->timeoutms_per_addr[0] =
conn->tempaddr[0]->ai_next == NULL ? timeout_ms : timeout_ms / 2;
- conn->timeoutms_per_addr[1] =
- conn->tempaddr[1]->ai_next == NULL ? timeout_ms : timeout_ms / 2;
-
- conn->tempfamily[0] = conn->tempaddr[0]?
- conn->tempaddr[0]->ai_family:0;
-#ifdef ENABLE_IPV6
- conn->tempfamily[1] = conn->tempfamily[0] == AF_INET6 ?
- AF_INET : AF_INET6;
-#else
- conn->tempfamily[1] = AF_UNSPEC;
-#endif
- ainext(conn, 1, FALSE); /* assigns conn->tempaddr[1] accordingly */
-
- DEBUGF(infof(data, "family0 == %s, family1 == %s\n",
- conn->tempfamily[0] == AF_INET ? "v4" : "v6",
- conn->tempfamily[1] == AF_INET ? "v4" : "v6"));
-
- /* get through the list in family order in case of quick failures */
- for(i = 0; (i < 2) && result; i++) {
- while(conn->tempaddr[i]) {
- result = singleipconnect(conn, conn->tempaddr[i], i);
- if(!result)
- break;
- ainext(conn, i, TRUE);
- }
+ conn->timeoutms_per_addr[1] =
+ conn->tempaddr[1]->ai_next == NULL ? timeout_ms : timeout_ms / 2;
+
+ conn->tempfamily[0] = conn->tempaddr[0]?
+ conn->tempaddr[0]->ai_family:0;
+#ifdef ENABLE_IPV6
+ conn->tempfamily[1] = conn->tempfamily[0] == AF_INET6 ?
+ AF_INET : AF_INET6;
+#else
+ conn->tempfamily[1] = AF_UNSPEC;
+#endif
+ ainext(conn, 1, FALSE); /* assigns conn->tempaddr[1] accordingly */
+
+ DEBUGF(infof(data, "family0 == %s, family1 == %s\n",
+ conn->tempfamily[0] == AF_INET ? "v4" : "v6",
+ conn->tempfamily[1] == AF_INET ? "v4" : "v6"));
+
+ /* get through the list in family order in case of quick failures */
+ for(i = 0; (i < 2) && result; i++) {
+ while(conn->tempaddr[i]) {
+ result = singleipconnect(conn, conn->tempaddr[i], i);
+ if(!result)
+ break;
+ ainext(conn, i, TRUE);
+ }
}
- if(result)
+ if(result)
return result;
Curl_expire(conn->data, data->set.happy_eyeballs_timeout,
@@ -1377,15 +1377,15 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
}
struct connfind {
- long id_tofind;
- struct connectdata *found;
+ long id_tofind;
+ struct connectdata *found;
};
static int conn_is_conn(struct connectdata *conn, void *param)
{
struct connfind *f = (struct connfind *)param;
- if(conn->connection_id == f->id_tofind) {
- f->found = conn;
+ if(conn->connection_id == f->id_tofind) {
+ f->found = conn;
return 1;
}
return 0;
@@ -1407,22 +1407,22 @@ curl_socket_t Curl_getconnectinfo(struct Curl_easy *data,
* - that is associated with a multi handle, and whose connection
* was detached with CURLOPT_CONNECT_ONLY
*/
- if((data->state.lastconnect_id != -1) && (data->multi_easy || data->multi)) {
- struct connectdata *c;
+ if((data->state.lastconnect_id != -1) && (data->multi_easy || data->multi)) {
+ struct connectdata *c;
struct connfind find;
- find.id_tofind = data->state.lastconnect_id;
- find.found = NULL;
+ find.id_tofind = data->state.lastconnect_id;
+ find.found = NULL;
Curl_conncache_foreach(data, data->multi_easy?
&data->multi_easy->conn_cache:
&data->multi->conn_cache, &find, conn_is_conn);
if(!find.found) {
- data->state.lastconnect_id = -1;
+ data->state.lastconnect_id = -1;
return CURL_SOCKET_BAD;
}
- c = find.found;
+ c = find.found;
if(connp) {
/* only store this if the caller cares for it */
*connp = c;
@@ -1430,7 +1430,7 @@ curl_socket_t Curl_getconnectinfo(struct Curl_easy *data,
}
return c->sock[FIRSTSOCKET];
}
- return CURL_SOCKET_BAD;
+ return CURL_SOCKET_BAD;
}
/*
@@ -1469,11 +1469,11 @@ int Curl_closesocket(struct connectdata *conn,
curl_socket_t sock)
{
if(conn && conn->fclosesocket) {
- if((sock == conn->sock[SECONDARYSOCKET]) && conn->bits.sock_accepted)
+ if((sock == conn->sock[SECONDARYSOCKET]) && conn->bits.sock_accepted)
/* if this socket matches the second socket, and that was created with
accept, then we MUST NOT call the callback but clear the accepted
status */
- conn->bits.sock_accepted = FALSE;
+ conn->bits.sock_accepted = FALSE;
else {
int rc;
Curl_multi_closed(conn->data, sock);
@@ -1503,7 +1503,7 @@ int Curl_closesocket(struct connectdata *conn,
*
*/
CURLcode Curl_socket(struct connectdata *conn,
- const struct Curl_addrinfo *ai,
+ const struct Curl_addrinfo *ai,
struct Curl_sockaddr_ex *addr,
curl_socket_t *sockfd)
{
@@ -1556,11 +1556,11 @@ CURLcode Curl_socket(struct connectdata *conn,
/* no socket, no connection */
return CURLE_COULDNT_CONNECT;
- if(conn->transport == TRNSPRT_QUIC) {
- /* QUIC sockets need to be nonblocking */
- (void)curlx_nonblock(*sockfd, TRUE);
- }
-
+ if(conn->transport == TRNSPRT_QUIC) {
+ /* QUIC sockets need to be nonblocking */
+ (void)curlx_nonblock(*sockfd, TRUE);
+ }
+
#if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
if(conn->scope_id && (addr->family == AF_INET6)) {
struct sockaddr_in6 * const sa6 = (void *)&addr->sa_addr;
@@ -1585,7 +1585,7 @@ void Curl_conncontrol(struct connectdata *conn,
/* close if a connection, or a stream that isn't multiplexed */
bool closeit = (ctrl == CONNCTRL_CONNECTION) ||
((ctrl == CONNCTRL_STREAM) && !(conn->handler->flags & PROTOPT_STREAM));
- DEBUGASSERT(conn);
+ DEBUGASSERT(conn);
if((ctrl == CONNCTRL_STREAM) &&
(conn->handler->flags & PROTOPT_STREAM))
DEBUGF(infof(conn->data, "Kill stream: %s\n", reason));
@@ -1601,7 +1601,7 @@ void Curl_conncontrol(struct connectdata *conn,
bool Curl_conn_data_pending(struct connectdata *conn, int sockindex)
{
int readable;
- DEBUGASSERT(conn);
+ DEBUGASSERT(conn);
if(Curl_ssl_data_pending(conn, sockindex) ||
Curl_recv_has_postponed_data(conn, sockindex))
diff --git a/contrib/libs/curl/lib/connect.h b/contrib/libs/curl/lib/connect.h
index d3bcf460b3..9b1faf8fb7 100644
--- a/contrib/libs/curl/lib/connect.h
+++ b/contrib/libs/curl/lib/connect.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -75,8 +75,8 @@ void Curl_sndbufset(curl_socket_t sockfd);
#endif
void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd);
-void Curl_conninfo_remote(struct connectdata *conn, curl_socket_t sockfd);
-void Curl_conninfo_local(struct connectdata *conn, curl_socket_t sockfd);
+void Curl_conninfo_remote(struct connectdata *conn, curl_socket_t sockfd);
+void Curl_conninfo_local(struct connectdata *conn, curl_socket_t sockfd);
void Curl_persistconninfo(struct connectdata *conn);
int Curl_closesocket(struct connectdata *conn, curl_socket_t sock);
@@ -107,7 +107,7 @@ struct Curl_sockaddr_ex {
*
*/
CURLcode Curl_socket(struct connectdata *conn,
- const struct Curl_addrinfo *ai,
+ const struct Curl_addrinfo *ai,
struct Curl_sockaddr_ex *addr,
curl_socket_t *sockfd);
diff --git a/contrib/libs/curl/lib/content_encoding.c b/contrib/libs/curl/lib/content_encoding.c
index 7550ce25a0..68da3fa1cf 100644
--- a/contrib/libs/curl/lib/content_encoding.c
+++ b/contrib/libs/curl/lib/content_encoding.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -34,10 +34,10 @@
#error #include <brotli/decode.h>
#endif
-#ifdef HAVE_ZSTD
-#error #include <zstd.h>
-#endif
-
+#ifdef HAVE_ZSTD
+#error #include <zstd.h>
+#endif
+
#include "sendf.h"
#include "http.h"
#include "content_encoding.h"
@@ -81,11 +81,11 @@ typedef enum {
} zlibInitState;
/* Writer parameters. */
-struct zlib_params {
+struct zlib_params {
zlibInitState zlib_init; /* zlib init state */
uInt trailerlen; /* Remaining trailer byte count. */
z_stream z; /* State structure for zlib. */
-};
+};
static voidpf
@@ -133,8 +133,8 @@ exit_zlib(struct connectdata *conn,
return result;
}
-static CURLcode process_trailer(struct connectdata *conn,
- struct zlib_params *zp)
+static CURLcode process_trailer(struct connectdata *conn,
+ struct zlib_params *zp)
{
z_stream *z = &zp->z;
CURLcode result = CURLE_OK;
@@ -158,10 +158,10 @@ static CURLcode process_trailer(struct connectdata *conn,
}
static CURLcode inflate_stream(struct connectdata *conn,
- struct contenc_writer *writer,
- zlibInitState started)
+ struct contenc_writer *writer,
+ zlibInitState started)
{
- struct zlib_params *zp = (struct zlib_params *) &writer->params;
+ struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
uInt nread = z->avail_in;
Bytef *orig_in = z->next_in;
@@ -261,9 +261,9 @@ static CURLcode inflate_stream(struct connectdata *conn,
/* Deflate handler. */
static CURLcode deflate_init_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
- struct zlib_params *zp = (struct zlib_params *) &writer->params;
+ struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
if(!writer->downstream)
@@ -280,10 +280,10 @@ static CURLcode deflate_init_writer(struct connectdata *conn,
}
static CURLcode deflate_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
- struct zlib_params *zp = (struct zlib_params *) &writer->params;
+ struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
/* Set the compressed input when this function is called */
@@ -298,29 +298,29 @@ static CURLcode deflate_unencode_write(struct connectdata *conn,
}
static void deflate_close_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
- struct zlib_params *zp = (struct zlib_params *) &writer->params;
+ struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
exit_zlib(conn, z, &zp->zlib_init, CURLE_OK);
}
-static const struct content_encoding deflate_encoding = {
+static const struct content_encoding deflate_encoding = {
"deflate",
NULL,
deflate_init_writer,
deflate_unencode_write,
deflate_close_writer,
- sizeof(struct zlib_params)
+ sizeof(struct zlib_params)
};
/* Gzip handler. */
static CURLcode gzip_init_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
- struct zlib_params *zp = (struct zlib_params *) &writer->params;
+ struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
if(!writer->downstream)
@@ -434,10 +434,10 @@ static enum {
#endif
static CURLcode gzip_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
- struct zlib_params *zp = (struct zlib_params *) &writer->params;
+ struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
if(zp->zlib_init == ZLIB_INIT_GZIP) {
@@ -562,21 +562,21 @@ static CURLcode gzip_unencode_write(struct connectdata *conn,
}
static void gzip_close_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
- struct zlib_params *zp = (struct zlib_params *) &writer->params;
+ struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
exit_zlib(conn, z, &zp->zlib_init, CURLE_OK);
}
-static const struct content_encoding gzip_encoding = {
+static const struct content_encoding gzip_encoding = {
"gzip",
"x-gzip",
gzip_init_writer,
gzip_unencode_write,
gzip_close_writer,
- sizeof(struct zlib_params)
+ sizeof(struct zlib_params)
};
#endif /* HAVE_LIBZ */
@@ -584,9 +584,9 @@ static const struct content_encoding gzip_encoding = {
#ifdef HAVE_BROTLI
/* Writer parameters. */
-struct brotli_params {
+struct brotli_params {
BrotliDecoderState *br; /* State structure for brotli. */
-};
+};
static CURLcode brotli_map_error(BrotliDecoderErrorCode be)
{
@@ -627,9 +627,9 @@ static CURLcode brotli_map_error(BrotliDecoderErrorCode be)
}
static CURLcode brotli_init_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
- struct brotli_params *bp = (struct brotli_params *) &writer->params;
+ struct brotli_params *bp = (struct brotli_params *) &writer->params;
(void) conn;
if(!writer->downstream)
@@ -640,10 +640,10 @@ static CURLcode brotli_init_writer(struct connectdata *conn,
}
static CURLcode brotli_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
- struct brotli_params *bp = (struct brotli_params *) &writer->params;
+ struct brotli_params *bp = (struct brotli_params *) &writer->params;
const uint8_t *src = (const uint8_t *) buf;
char *decomp;
uint8_t *dst;
@@ -688,9 +688,9 @@ static CURLcode brotli_unencode_write(struct connectdata *conn,
}
static void brotli_close_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
- struct brotli_params *bp = (struct brotli_params *) &writer->params;
+ struct brotli_params *bp = (struct brotli_params *) &writer->params;
(void) conn;
if(bp->br) {
@@ -699,129 +699,129 @@ static void brotli_close_writer(struct connectdata *conn,
}
}
-static const struct content_encoding brotli_encoding = {
+static const struct content_encoding brotli_encoding = {
"br",
NULL,
brotli_init_writer,
brotli_unencode_write,
brotli_close_writer,
- sizeof(struct brotli_params)
+ sizeof(struct brotli_params)
+};
+#endif
+
+
+#ifdef HAVE_ZSTD
+/* Writer parameters. */
+struct zstd_params {
+ ZSTD_DStream *zds; /* State structure for zstd. */
+ void *decomp;
+};
+
+static CURLcode zstd_init_writer(struct connectdata *conn,
+ struct contenc_writer *writer)
+{
+ struct zstd_params *zp = (struct zstd_params *)&writer->params;
+ (void)conn;
+
+ if(!writer->downstream)
+ return CURLE_WRITE_ERROR;
+
+ zp->zds = ZSTD_createDStream();
+ zp->decomp = NULL;
+ return zp->zds ? CURLE_OK : CURLE_OUT_OF_MEMORY;
+}
+
+static CURLcode zstd_unencode_write(struct connectdata *conn,
+ struct contenc_writer *writer,
+ const char *buf, size_t nbytes)
+{
+ CURLcode result = CURLE_OK;
+ struct zstd_params *zp = (struct zstd_params *)&writer->params;
+ ZSTD_inBuffer in;
+ ZSTD_outBuffer out;
+ size_t errorCode;
+
+ if(!zp->decomp) {
+ zp->decomp = malloc(DSIZ);
+ if(!zp->decomp)
+ return CURLE_OUT_OF_MEMORY;
+ }
+ in.pos = 0;
+ in.src = buf;
+ in.size = nbytes;
+
+ for(;;) {
+ out.pos = 0;
+ out.dst = zp->decomp;
+ out.size = DSIZ;
+
+ errorCode = ZSTD_decompressStream(zp->zds, &out, &in);
+ if(ZSTD_isError(errorCode)) {
+ return CURLE_BAD_CONTENT_ENCODING;
+ }
+ if(out.pos > 0) {
+ result = Curl_unencode_write(conn, writer->downstream,
+ zp->decomp, out.pos);
+ if(result)
+ break;
+ }
+ if((in.pos == nbytes) && (out.pos < out.size))
+ break;
+ }
+
+ return result;
+}
+
+static void zstd_close_writer(struct connectdata *conn,
+ struct contenc_writer *writer)
+{
+ struct zstd_params *zp = (struct zstd_params *)&writer->params;
+ (void)conn;
+
+ if(zp->decomp) {
+ free(zp->decomp);
+ zp->decomp = NULL;
+ }
+ if(zp->zds) {
+ ZSTD_freeDStream(zp->zds);
+ zp->zds = NULL;
+ }
+}
+
+static const struct content_encoding zstd_encoding = {
+ "zstd",
+ NULL,
+ zstd_init_writer,
+ zstd_unencode_write,
+ zstd_close_writer,
+ sizeof(struct zstd_params)
};
#endif
-#ifdef HAVE_ZSTD
-/* Writer parameters. */
-struct zstd_params {
- ZSTD_DStream *zds; /* State structure for zstd. */
- void *decomp;
-};
-
-static CURLcode zstd_init_writer(struct connectdata *conn,
- struct contenc_writer *writer)
-{
- struct zstd_params *zp = (struct zstd_params *)&writer->params;
- (void)conn;
-
- if(!writer->downstream)
- return CURLE_WRITE_ERROR;
-
- zp->zds = ZSTD_createDStream();
- zp->decomp = NULL;
- return zp->zds ? CURLE_OK : CURLE_OUT_OF_MEMORY;
-}
-
-static CURLcode zstd_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
- const char *buf, size_t nbytes)
-{
- CURLcode result = CURLE_OK;
- struct zstd_params *zp = (struct zstd_params *)&writer->params;
- ZSTD_inBuffer in;
- ZSTD_outBuffer out;
- size_t errorCode;
-
- if(!zp->decomp) {
- zp->decomp = malloc(DSIZ);
- if(!zp->decomp)
- return CURLE_OUT_OF_MEMORY;
- }
- in.pos = 0;
- in.src = buf;
- in.size = nbytes;
-
- for(;;) {
- out.pos = 0;
- out.dst = zp->decomp;
- out.size = DSIZ;
-
- errorCode = ZSTD_decompressStream(zp->zds, &out, &in);
- if(ZSTD_isError(errorCode)) {
- return CURLE_BAD_CONTENT_ENCODING;
- }
- if(out.pos > 0) {
- result = Curl_unencode_write(conn, writer->downstream,
- zp->decomp, out.pos);
- if(result)
- break;
- }
- if((in.pos == nbytes) && (out.pos < out.size))
- break;
- }
-
- return result;
-}
-
-static void zstd_close_writer(struct connectdata *conn,
- struct contenc_writer *writer)
-{
- struct zstd_params *zp = (struct zstd_params *)&writer->params;
- (void)conn;
-
- if(zp->decomp) {
- free(zp->decomp);
- zp->decomp = NULL;
- }
- if(zp->zds) {
- ZSTD_freeDStream(zp->zds);
- zp->zds = NULL;
- }
-}
-
-static const struct content_encoding zstd_encoding = {
- "zstd",
- NULL,
- zstd_init_writer,
- zstd_unencode_write,
- zstd_close_writer,
- sizeof(struct zstd_params)
-};
-#endif
-
-
/* Identity handler. */
static CURLcode identity_init_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
(void) conn;
return writer->downstream? CURLE_OK: CURLE_WRITE_ERROR;
}
static CURLcode identity_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
return Curl_unencode_write(conn, writer->downstream, buf, nbytes);
}
static void identity_close_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
(void) conn;
(void) writer;
}
-static const struct content_encoding identity_encoding = {
+static const struct content_encoding identity_encoding = {
"identity",
"none",
identity_init_writer,
@@ -832,7 +832,7 @@ static const struct content_encoding identity_encoding = {
/* supported content encodings table. */
-static const struct content_encoding * const encodings[] = {
+static const struct content_encoding * const encodings[] = {
&identity_encoding,
#ifdef HAVE_LIBZ
&deflate_encoding,
@@ -841,9 +841,9 @@ static const struct content_encoding * const encodings[] = {
#ifdef HAVE_BROTLI
&brotli_encoding,
#endif
-#ifdef HAVE_ZSTD
- &zstd_encoding,
-#endif
+#ifdef HAVE_ZSTD
+ &zstd_encoding,
+#endif
NULL
};
@@ -852,8 +852,8 @@ static const struct content_encoding * const encodings[] = {
char *Curl_all_content_encodings(void)
{
size_t len = 0;
- const struct content_encoding * const *cep;
- const struct content_encoding *ce;
+ const struct content_encoding * const *cep;
+ const struct content_encoding *ce;
char *ace;
for(cep = encodings; *cep; cep++) {
@@ -886,14 +886,14 @@ char *Curl_all_content_encodings(void)
/* Real client writer: no downstream. */
static CURLcode client_init_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
(void) conn;
return writer->downstream? CURLE_WRITE_ERROR: CURLE_OK;
}
static CURLcode client_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
struct Curl_easy *data = conn->data;
@@ -908,13 +908,13 @@ static CURLcode client_unencode_write(struct connectdata *conn,
}
static void client_close_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
(void) conn;
(void) writer;
}
-static const struct content_encoding client_encoding = {
+static const struct content_encoding client_encoding = {
NULL,
NULL,
client_init_writer,
@@ -926,14 +926,14 @@ static const struct content_encoding client_encoding = {
/* Deferred error dummy writer. */
static CURLcode error_init_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
(void) conn;
return writer->downstream? CURLE_OK: CURLE_WRITE_ERROR;
}
static CURLcode error_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
char *all = Curl_all_content_encodings();
@@ -951,13 +951,13 @@ static CURLcode error_unencode_write(struct connectdata *conn,
}
static void error_close_writer(struct connectdata *conn,
- struct contenc_writer *writer)
+ struct contenc_writer *writer)
{
(void) conn;
(void) writer;
}
-static const struct content_encoding error_encoding = {
+static const struct content_encoding error_encoding = {
NULL,
NULL,
error_init_writer,
@@ -967,13 +967,13 @@ static const struct content_encoding error_encoding = {
};
/* Create an unencoding writer stage using the given handler. */
-static struct contenc_writer *
-new_unencoding_writer(struct connectdata *conn,
- const struct content_encoding *handler,
- struct contenc_writer *downstream)
+static struct contenc_writer *
+new_unencoding_writer(struct connectdata *conn,
+ const struct content_encoding *handler,
+ struct contenc_writer *downstream)
{
- size_t sz = offsetof(struct contenc_writer, params) + handler->paramsize;
- struct contenc_writer *writer = (struct contenc_writer *)calloc(1, sz);
+ size_t sz = offsetof(struct contenc_writer, params) + handler->paramsize;
+ struct contenc_writer *writer = (struct contenc_writer *)calloc(1, sz);
if(writer) {
writer->handler = handler;
@@ -988,8 +988,8 @@ new_unencoding_writer(struct connectdata *conn,
}
/* Write data using an unencoding writer stack. */
-CURLcode Curl_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+CURLcode Curl_unencode_write(struct connectdata *conn,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
if(!nbytes)
@@ -1002,7 +1002,7 @@ void Curl_unencode_cleanup(struct connectdata *conn)
{
struct Curl_easy *data = conn->data;
struct SingleRequest *k = &data->req;
- struct contenc_writer *writer = k->writer_stack;
+ struct contenc_writer *writer = k->writer_stack;
while(writer) {
k->writer_stack = writer->downstream;
@@ -1013,13 +1013,13 @@ void Curl_unencode_cleanup(struct connectdata *conn)
}
/* Find the content encoding by name. */
-static const struct content_encoding *find_encoding(const char *name,
- size_t len)
+static const struct content_encoding *find_encoding(const char *name,
+ size_t len)
{
- const struct content_encoding * const *cep;
+ const struct content_encoding * const *cep;
for(cep = encodings; *cep; cep++) {
- const struct content_encoding *ce = *cep;
+ const struct content_encoding *ce = *cep;
if((strncasecompare(name, ce->name, len) && !ce->name[len]) ||
(ce->alias && strncasecompare(name, ce->alias, len) && !ce->alias[len]))
return ce;
@@ -1055,8 +1055,8 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
Curl_httpchunk_init(conn); /* init our chunky engine. */
}
else if(namelen) {
- const struct content_encoding *encoding = find_encoding(name, namelen);
- struct contenc_writer *writer;
+ const struct content_encoding *encoding = find_encoding(name, namelen);
+ struct contenc_writer *writer;
if(!k->writer_stack) {
k->writer_stack = new_unencoding_writer(conn, &client_encoding, NULL);
@@ -1090,8 +1090,8 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
return CURLE_NOT_BUILT_IN;
}
-CURLcode Curl_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+CURLcode Curl_unencode_write(struct connectdata *conn,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes)
{
(void) conn;
diff --git a/contrib/libs/curl/lib/content_encoding.h b/contrib/libs/curl/lib/content_encoding.h
index b91c028902..70310875a0 100644
--- a/contrib/libs/curl/lib/content_encoding.h
+++ b/contrib/libs/curl/lib/content_encoding.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -23,31 +23,31 @@
***************************************************************************/
#include "curl_setup.h"
-struct contenc_writer {
- const struct content_encoding *handler; /* Encoding handler. */
- struct contenc_writer *downstream; /* Downstream writer. */
+struct contenc_writer {
+ const struct content_encoding *handler; /* Encoding handler. */
+ struct contenc_writer *downstream; /* Downstream writer. */
void *params; /* Encoding-specific storage (variable length). */
};
/* Content encoding writer. */
-struct content_encoding {
+struct content_encoding {
const char *name; /* Encoding name. */
const char *alias; /* Encoding name alias. */
- CURLcode (*init_writer)(struct connectdata *conn,
- struct contenc_writer *writer);
- CURLcode (*unencode_write)(struct connectdata *conn,
- struct contenc_writer *writer,
+ CURLcode (*init_writer)(struct connectdata *conn,
+ struct contenc_writer *writer);
+ CURLcode (*unencode_write)(struct connectdata *conn,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes);
- void (*close_writer)(struct connectdata *conn,
- struct contenc_writer *writer);
+ void (*close_writer)(struct connectdata *conn,
+ struct contenc_writer *writer);
size_t paramsize;
};
CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
const char *enclist, int maybechunked);
-CURLcode Curl_unencode_write(struct connectdata *conn,
- struct contenc_writer *writer,
+CURLcode Curl_unencode_write(struct connectdata *conn,
+ struct contenc_writer *writer,
const char *buf, size_t nbytes);
void Curl_unencode_cleanup(struct connectdata *conn);
char *Curl_all_content_encodings(void);
diff --git a/contrib/libs/curl/lib/cookie.c b/contrib/libs/curl/lib/cookie.c
index c74b6430b4..e88678c219 100644
--- a/contrib/libs/curl/lib/cookie.c
+++ b/contrib/libs/curl/lib/cookie.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -96,9 +96,9 @@ Example set of cookies:
#include "curl_get_line.h"
#include "curl_memrchr.h"
#include "inet_pton.h"
-#include "parsedate.h"
-#include "rand.h"
-#include "rename.h"
+#include "parsedate.h"
+#include "rand.h"
+#include "rename.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -245,17 +245,17 @@ pathmatched:
*/
static const char *get_top_domain(const char * const domain, size_t *outlen)
{
- size_t len = 0;
+ size_t len = 0;
const char *first = NULL, *last;
- if(domain) {
- len = strlen(domain);
- last = memrchr(domain, '.', len);
- if(last) {
- first = memrchr(domain, '.', (last - domain));
- if(first)
- len -= (++first - domain);
- }
+ if(domain) {
+ len = strlen(domain);
+ last = memrchr(domain, '.', len);
+ if(last) {
+ first = memrchr(domain, '.', (last - domain));
+ if(first)
+ len -= (++first - domain);
+ }
}
if(outlen)
@@ -538,9 +538,9 @@ Curl_cookie_add(struct Curl_easy *data,
* only test for names where that can possibly be true.
*/
if(nlen > 3 && name[0] == '_' && name[1] == '_') {
- if(!strncmp("__Secure-", name, 9))
+ if(!strncmp("__Secure-", name, 9))
co->prefix |= COOKIE_PREFIX__SECURE;
- else if(!strncmp("__Host-", name, 7))
+ else if(!strncmp("__Host-", name, 7))
co->prefix |= COOKIE_PREFIX__HOST;
}
@@ -717,7 +717,7 @@ Curl_cookie_add(struct Curl_easy *data,
else if(co->expirestr) {
/* Note that if the date couldn't get parsed for whatever reason,
the cookie will be treated as a session cookie */
- co->expires = Curl_getdate_capped(co->expirestr);
+ co->expires = Curl_getdate_capped(co->expirestr);
/* Session cookies have expires set to 0 so if we get that back
from the date parser let's add a second to make it a
@@ -755,7 +755,7 @@ Curl_cookie_add(struct Curl_easy *data,
co->path = malloc(pathlen + 1); /* one extra for the zero byte */
if(co->path) {
memcpy(co->path, path, pathlen);
- co->path[pathlen] = 0; /* null-terminate */
+ co->path[pathlen] = 0; /* null-terminate */
co->spath = sanitize_cookie_path(co->path);
if(!co->spath)
badcookie = TRUE; /* out of memory bad */
@@ -1047,7 +1047,7 @@ Curl_cookie_add(struct Curl_easy *data,
*clist = *co; /* then store all the new data */
- free(co); /* free the newly allocated memory */
+ free(co); /* free the newly allocated memory */
co = clist; /* point to the previous struct instead */
/* We have replaced a cookie, now skip the rest of the list but
@@ -1092,8 +1092,8 @@ Curl_cookie_add(struct Curl_easy *data,
*
* If 'newsession' is TRUE, discard all "session cookies" on read from file.
*
- * Note that 'data' might be called as NULL pointer.
- *
+ * Note that 'data' might be called as NULL pointer.
+ *
* Returns NULL on out of memory. Invalid cookies are ignored.
****************************************************************************/
struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
@@ -1164,8 +1164,8 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
}
c->running = TRUE; /* now, we're running */
- if(data)
- data->state.cookie_engine = TRUE;
+ if(data)
+ data->state.cookie_engine = TRUE;
return c;
@@ -1502,14 +1502,14 @@ static char *get_netscape_format(const struct Cookie *co)
*
* The function returns non-zero on write failure.
*/
-static int cookie_output(struct Curl_easy *data,
- struct CookieInfo *c, const char *filename)
+static int cookie_output(struct Curl_easy *data,
+ struct CookieInfo *c, const char *filename)
{
struct Cookie *co;
- FILE *out = NULL;
+ FILE *out = NULL;
bool use_stdout = FALSE;
- char *tempstore = NULL;
- bool error = false;
+ char *tempstore = NULL;
+ bool error = false;
if(!c)
/* no cookie engine alive */
@@ -1518,58 +1518,58 @@ static int cookie_output(struct Curl_easy *data,
/* at first, remove expired cookies */
remove_expired(c);
- if(!strcmp("-", filename)) {
+ if(!strcmp("-", filename)) {
/* use stdout */
out = stdout;
use_stdout = TRUE;
}
else {
- unsigned char randsuffix[9];
-
- if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
- return 2;
-
- tempstore = aprintf("%s.%s.tmp", filename, randsuffix);
- if(!tempstore)
- return 1;
-
- out = fopen(tempstore, FOPEN_WRITETEXT);
- if(!out)
- goto error;
+ unsigned char randsuffix[9];
+
+ if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
+ return 2;
+
+ tempstore = aprintf("%s.%s.tmp", filename, randsuffix);
+ if(!tempstore)
+ return 1;
+
+ out = fopen(tempstore, FOPEN_WRITETEXT);
+ if(!out)
+ goto error;
}
fputs("# Netscape HTTP Cookie File\n"
- "# https://curl.se/docs/http-cookies.html\n"
+ "# https://curl.se/docs/http-cookies.html\n"
"# This file was generated by libcurl! Edit at your own risk.\n\n",
out);
if(c->numcookies) {
unsigned int i;
- size_t nvalid = 0;
+ size_t nvalid = 0;
struct Cookie **array;
- array = calloc(1, sizeof(struct Cookie *) * c->numcookies);
+ array = calloc(1, sizeof(struct Cookie *) * c->numcookies);
if(!array) {
- goto error;
+ goto error;
}
- /* only sort the cookies with a domain property */
+ /* only sort the cookies with a domain property */
for(i = 0; i < COOKIE_HASH_SIZE; i++) {
for(co = c->cookies[i]; co; co = co->next) {
if(!co->domain)
continue;
- array[nvalid++] = co;
+ array[nvalid++] = co;
}
}
- qsort(array, nvalid, sizeof(struct Cookie *), cookie_sort_ct);
+ qsort(array, nvalid, sizeof(struct Cookie *), cookie_sort_ct);
- for(i = 0; i < nvalid; i++) {
+ for(i = 0; i < nvalid; i++) {
char *format_ptr = get_netscape_format(array[i]);
if(format_ptr == NULL) {
fprintf(out, "#\n# Fatal libcurl error\n");
free(array);
- goto error;
+ goto error;
}
fprintf(out, "%s\n", format_ptr);
free(format_ptr);
@@ -1577,24 +1577,24 @@ static int cookie_output(struct Curl_easy *data,
free(array);
}
-
- if(!use_stdout) {
+
+ if(!use_stdout) {
+ fclose(out);
+ out = NULL;
+ if(Curl_rename(tempstore, filename)) {
+ unlink(tempstore);
+ goto error;
+ }
+ }
+
+ goto cleanup;
+error:
+ error = true;
+cleanup:
+ if(out && !use_stdout)
fclose(out);
- out = NULL;
- if(Curl_rename(tempstore, filename)) {
- unlink(tempstore);
- goto error;
- }
- }
-
- goto cleanup;
-error:
- error = true;
-cleanup:
- if(out && !use_stdout)
- fclose(out);
- free(tempstore);
- return error ? 1 : 0;
+ free(tempstore);
+ return error ? 1 : 0;
}
static struct curl_slist *cookie_list(struct Curl_easy *data)
@@ -1640,7 +1640,7 @@ struct curl_slist *Curl_cookie_list(struct Curl_easy *data)
return list;
}
-void Curl_flush_cookies(struct Curl_easy *data, bool cleanup)
+void Curl_flush_cookies(struct Curl_easy *data, bool cleanup)
{
if(data->set.str[STRING_COOKIEJAR]) {
if(data->change.cookielist) {
@@ -1653,7 +1653,7 @@ void Curl_flush_cookies(struct Curl_easy *data, bool cleanup)
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
/* if we have a destination file for all the cookies to get dumped to */
- if(cookie_output(data, data->cookies, data->set.str[STRING_COOKIEJAR]))
+ if(cookie_output(data, data->cookies, data->set.str[STRING_COOKIEJAR]))
infof(data, "WARNING: failed to save cookies in %s\n",
data->set.str[STRING_COOKIEJAR]);
}
@@ -1669,7 +1669,7 @@ void Curl_flush_cookies(struct Curl_easy *data, bool cleanup)
if(cleanup && (!data->share || (data->cookies != data->share->cookies))) {
Curl_cookie_cleanup(data->cookies);
- data->cookies = NULL;
+ data->cookies = NULL;
}
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
}
diff --git a/contrib/libs/curl/lib/cookie.h b/contrib/libs/curl/lib/cookie.h
index 88da182baa..066396f0d5 100644
--- a/contrib/libs/curl/lib/cookie.h
+++ b/contrib/libs/curl/lib/cookie.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -109,7 +109,7 @@ void Curl_cookie_clearsess(struct CookieInfo *cookies);
#define Curl_cookie_cleanup(x) Curl_nop_stmt
#define Curl_flush_cookies(x,y) Curl_nop_stmt
#else
-void Curl_flush_cookies(struct Curl_easy *data, bool cleanup);
+void Curl_flush_cookies(struct Curl_easy *data, bool cleanup);
void Curl_cookie_cleanup(struct CookieInfo *);
struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
const char *, struct CookieInfo *, bool);
diff --git a/contrib/libs/curl/lib/curl_addrinfo.c b/contrib/libs/curl/lib/curl_addrinfo.c
index 4ff14a1dc6..9007259d4c 100644
--- a/contrib/libs/curl/lib/curl_addrinfo.c
+++ b/contrib/libs/curl/lib/curl_addrinfo.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -78,12 +78,12 @@
#endif
void
-Curl_freeaddrinfo(struct Curl_addrinfo *cahead)
+Curl_freeaddrinfo(struct Curl_addrinfo *cahead)
{
- struct Curl_addrinfo *vqualifier canext;
- struct Curl_addrinfo *ca;
+ struct Curl_addrinfo *vqualifier canext;
+ struct Curl_addrinfo *ca;
- for(ca = cahead; ca; ca = canext) {
+ for(ca = cahead; ca; ca = canext) {
canext = ca->ai_next;
free(ca);
}
@@ -109,13 +109,13 @@ int
Curl_getaddrinfo_ex(const char *nodename,
const char *servname,
const struct addrinfo *hints,
- struct Curl_addrinfo **result)
+ struct Curl_addrinfo **result)
{
const struct addrinfo *ai;
struct addrinfo *aihead;
- struct Curl_addrinfo *cafirst = NULL;
- struct Curl_addrinfo *calast = NULL;
- struct Curl_addrinfo *ca;
+ struct Curl_addrinfo *cafirst = NULL;
+ struct Curl_addrinfo *calast = NULL;
+ struct Curl_addrinfo *ca;
size_t ss_size;
int error;
@@ -128,7 +128,7 @@ Curl_getaddrinfo_ex(const char *nodename,
/* traverse the addrinfo list */
for(ai = aihead; ai != NULL; ai = ai->ai_next) {
- size_t namelen = ai->ai_canonname ? strlen(ai->ai_canonname) + 1 : 0;
+ size_t namelen = ai->ai_canonname ? strlen(ai->ai_canonname) + 1 : 0;
/* ignore elements with unsupported address family, */
/* settle family-specific sockaddr structure size. */
if(ai->ai_family == AF_INET)
@@ -148,7 +148,7 @@ Curl_getaddrinfo_ex(const char *nodename,
if((size_t)ai->ai_addrlen < ss_size)
continue;
- ca = malloc(sizeof(struct Curl_addrinfo) + ss_size + namelen);
+ ca = malloc(sizeof(struct Curl_addrinfo) + ss_size + namelen);
if(!ca) {
error = EAI_MEMORY;
break;
@@ -166,12 +166,12 @@ Curl_getaddrinfo_ex(const char *nodename,
ca->ai_canonname = NULL;
ca->ai_next = NULL;
- ca->ai_addr = (void *)((char *)ca + sizeof(struct Curl_addrinfo));
+ ca->ai_addr = (void *)((char *)ca + sizeof(struct Curl_addrinfo));
memcpy(ca->ai_addr, ai->ai_addr, ss_size);
- if(namelen) {
- ca->ai_canonname = (void *)((char *)ca->ai_addr + ss_size);
- memcpy(ca->ai_canonname, ai->ai_canonname, namelen);
+ if(namelen) {
+ ca->ai_canonname = (void *)((char *)ca->ai_addr + ss_size);
+ memcpy(ca->ai_canonname, ai->ai_canonname, namelen);
}
/* if the return list is empty, this becomes the first element */
@@ -255,12 +255,12 @@ Curl_getaddrinfo_ex(const char *nodename,
* #define h_addr h_addr_list[0]
*/
-struct Curl_addrinfo *
+struct Curl_addrinfo *
Curl_he2ai(const struct hostent *he, int port)
{
- struct Curl_addrinfo *ai;
- struct Curl_addrinfo *prevai = NULL;
- struct Curl_addrinfo *firstai = NULL;
+ struct Curl_addrinfo *ai;
+ struct Curl_addrinfo *prevai = NULL;
+ struct Curl_addrinfo *firstai = NULL;
struct sockaddr_in *addr;
#ifdef ENABLE_IPV6
struct sockaddr_in6 *addr6;
@@ -277,7 +277,7 @@ Curl_he2ai(const struct hostent *he, int port)
for(i = 0; (curr = he->h_addr_list[i]) != NULL; i++) {
size_t ss_size;
- size_t namelen = strlen(he->h_name) + 1; /* include zero termination */
+ size_t namelen = strlen(he->h_name) + 1; /* include zero termination */
#ifdef ENABLE_IPV6
if(he->h_addrtype == AF_INET6)
ss_size = sizeof(struct sockaddr_in6);
@@ -285,17 +285,17 @@ Curl_he2ai(const struct hostent *he, int port)
#endif
ss_size = sizeof(struct sockaddr_in);
- /* allocate memory to told the struct, the address and the name */
- ai = calloc(1, sizeof(struct Curl_addrinfo) + ss_size + namelen);
+ /* allocate memory to told the struct, the address and the name */
+ ai = calloc(1, sizeof(struct Curl_addrinfo) + ss_size + namelen);
if(!ai) {
result = CURLE_OUT_OF_MEMORY;
break;
}
- /* put the address after the struct */
- ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
- /* then put the name after the address */
- ai->ai_canonname = (char *)ai->ai_addr + ss_size;
- memcpy(ai->ai_canonname, he->h_name, namelen);
+ /* put the address after the struct */
+ ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
+ /* then put the name after the address */
+ ai->ai_canonname = (char *)ai->ai_addr + ss_size;
+ memcpy(ai->ai_canonname, he->h_name, namelen);
if(!firstai)
/* store the pointer we want to return from this function */
@@ -368,10 +368,10 @@ struct namebuff {
* given address/host
*/
-struct Curl_addrinfo *
+struct Curl_addrinfo *
Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port)
{
- struct Curl_addrinfo *ai;
+ struct Curl_addrinfo *ai;
#if defined(__VMS) && \
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
@@ -444,7 +444,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port)
* Given an IPv4 or IPv6 dotted string address, this converts it to a proper
* allocated Curl_addrinfo struct and returns it.
*/
-struct Curl_addrinfo *Curl_str2addr(char *address, int port)
+struct Curl_addrinfo *Curl_str2addr(char *address, int port)
{
struct in_addr in;
if(Curl_inet_pton(AF_INET, address, &in) > 0)
@@ -467,19 +467,19 @@ struct Curl_addrinfo *Curl_str2addr(char *address, int port)
* struct initialized with this path.
* Set '*longpath' to TRUE if the error is a too long path.
*/
-struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
- bool abstract)
+struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
+ bool abstract)
{
- struct Curl_addrinfo *ai;
+ struct Curl_addrinfo *ai;
struct sockaddr_un *sa_un;
size_t path_len;
*longpath = FALSE;
- ai = calloc(1, sizeof(struct Curl_addrinfo) + sizeof(struct sockaddr_un));
+ ai = calloc(1, sizeof(struct Curl_addrinfo) + sizeof(struct sockaddr_un));
if(!ai)
return NULL;
- ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
+ ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
sa_un = (void *) ai->ai_addr;
sa_un->sun_family = AF_UNIX;
@@ -569,9 +569,9 @@ curl_dbg_getaddrinfo(const char *hostname,
* Work-arounds the sin6_port is always zero bug on iOS 9.3.2 and Mac OS X
* 10.11.5.
*/
-void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port)
+void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port)
{
- struct Curl_addrinfo *ca;
+ struct Curl_addrinfo *ca;
struct sockaddr_in *addr;
#ifdef ENABLE_IPV6
struct sockaddr_in6 *addr6;
diff --git a/contrib/libs/curl/lib/curl_addrinfo.h b/contrib/libs/curl/lib/curl_addrinfo.h
index 7bd53169ef..73a8c1b334 100644
--- a/contrib/libs/curl/lib/curl_addrinfo.h
+++ b/contrib/libs/curl/lib/curl_addrinfo.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -59,27 +59,27 @@ struct Curl_addrinfo {
};
void
-Curl_freeaddrinfo(struct Curl_addrinfo *cahead);
+Curl_freeaddrinfo(struct Curl_addrinfo *cahead);
#ifdef HAVE_GETADDRINFO
int
Curl_getaddrinfo_ex(const char *nodename,
const char *servname,
const struct addrinfo *hints,
- struct Curl_addrinfo **result);
+ struct Curl_addrinfo **result);
#endif
-struct Curl_addrinfo *
+struct Curl_addrinfo *
Curl_he2ai(const struct hostent *he, int port);
-struct Curl_addrinfo *
+struct Curl_addrinfo *
Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port);
-struct Curl_addrinfo *Curl_str2addr(char *dotted, int port);
+struct Curl_addrinfo *Curl_str2addr(char *dotted, int port);
#ifdef USE_UNIX_SOCKETS
-struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
- bool abstract);
+struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
+ bool abstract);
#endif
#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \
@@ -97,7 +97,7 @@ curl_dbg_getaddrinfo(const char *hostname, const char *service,
#ifdef HAVE_GETADDRINFO
#ifdef USE_RESOLVE_ON_IPS
-void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port);
+void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port);
#else
#define Curl_addrinfo_set_port(x,y)
#endif
diff --git a/contrib/libs/curl/lib/curl_base64.h b/contrib/libs/curl/lib/curl_base64.h
index 25f2c5a53d..d48edc4241 100644
--- a/contrib/libs/curl/lib/curl_base64.h
+++ b/contrib/libs/curl/lib/curl_base64.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_config-android.h b/contrib/libs/curl/lib/curl_config-android.h
index f5f10e09fe..42719f78b0 100644
--- a/contrib/libs/curl/lib/curl_config-android.h
+++ b/contrib/libs/curl/lib/curl_config-android.h
@@ -1,2 +1,2 @@
-#pragma once
-#include "curl_config-linux.h"
+#pragma once
+#include "curl_config-linux.h"
diff --git a/contrib/libs/curl/lib/curl_config-linux.h b/contrib/libs/curl/lib/curl_config-linux.h
index 0f029d6d17..0dfa912535 100644
--- a/contrib/libs/curl/lib/curl_config-linux.h
+++ b/contrib/libs/curl/lib/curl_config-linux.h
@@ -16,9 +16,9 @@
/* Default SSL backend */
/* #undef CURL_DEFAULT_SSL_BACKEND */
-/* disable alt-svc */
-/* #undef CURL_DISABLE_ALTSVC */
-
+/* disable alt-svc */
+/* #undef CURL_DISABLE_ALTSVC */
+
/* to disable cookies support */
/* #undef CURL_DISABLE_COOKIES */
@@ -37,9 +37,9 @@
/* to disable FTP */
/* #undef CURL_DISABLE_FTP */
-/* to disable curl_easy_options */
-/* #undef CURL_DISABLE_GETOPTIONS */
-
+/* to disable curl_easy_options */
+/* #undef CURL_DISABLE_GETOPTIONS */
+
/* to disable Gopher */
/* #undef CURL_DISABLE_GOPHER */
@@ -64,9 +64,9 @@
/* disable mime API */
/* #undef CURL_DISABLE_MIME */
-/* to disable MQTT */
-/* #undef CURL_DISABLE_MQTT */
-
+/* to disable MQTT */
+/* #undef CURL_DISABLE_MQTT */
+
/* disable netrc parsing */
/* #undef CURL_DISABLE_NETRC */
@@ -97,9 +97,9 @@
/* to disable SMTP */
/* #undef CURL_DISABLE_SMTP */
-/* to disable socketpair support */
-/* #undef CURL_DISABLE_SOCKETPAIR */
-
+/* to disable socketpair support */
+/* #undef CURL_DISABLE_SOCKETPAIR */
+
/* to disable TELNET */
/* #undef CURL_DISABLE_TELNET */
@@ -438,15 +438,15 @@
/* Define to 1 if you have the `ssl' library (-lssl). */
#define HAVE_LIBSSL 1
-/* Define to 1 if you have the `wolfssh' library (-lwolfssh). */
-/* #undef HAVE_LIBWOLFSSH */
-
+/* Define to 1 if you have the `wolfssh' library (-lwolfssh). */
+/* #undef HAVE_LIBWOLFSSH */
+
/* if zlib is available */
#define HAVE_LIBZ 1
-/* Define to 1 if you have the `zstd' library (-lzstd). */
-/* #undef HAVE_LIBZSTD */
-
+/* Define to 1 if you have the `zstd' library (-lzstd). */
+/* #undef HAVE_LIBZSTD */
+
/* Define to 1 if you have the <linux/tcp.h> header file. */
#define HAVE_LINUX_TCP_H 1
@@ -508,9 +508,9 @@
*/
/* #undef HAVE_OLD_GSSMIT */
-/* Define to 1 if using OpenSSL 3 or later. */
-/* #undef HAVE_OPENSSL3 */
-
+/* Define to 1 if using OpenSSL 3 or later. */
+/* #undef HAVE_OPENSSL3 */
+
/* Define to 1 if you have the <openssl/crypto.h> header file. */
#define HAVE_OPENSSL_CRYPTO_H 1
@@ -565,9 +565,9 @@
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
-/* Define to 1 if you have the `quiche_conn_set_qlog_fd' function. */
-/* #undef HAVE_QUICHE_CONN_SET_QLOG_FD */
-
+/* Define to 1 if you have the `quiche_conn_set_qlog_fd' function. */
+/* #undef HAVE_QUICHE_CONN_SET_QLOG_FD */
+
/* Define to 1 if you have the <quiche.h> header file. */
/* #undef HAVE_QUICHE_H */
@@ -643,9 +643,9 @@
/* Define to 1 if you have the `SSLv2_client_method' function. */
/* #undef HAVE_SSLV2_CLIENT_METHOD */
-/* Define to 1 if you have the `SSL_get_ech_status' function. */
-/* #undef HAVE_SSL_GET_ECH_STATUS */
-
+/* Define to 1 if you have the `SSL_get_ech_status' function. */
+/* #undef HAVE_SSL_GET_ECH_STATUS */
+
/* Define to 1 if you have the <ssl.h> header file. */
/* #undef HAVE_SSL_H */
@@ -689,7 +689,7 @@
/* #undef HAVE_STRNICMP */
/* Define to 1 if you have the <stropts.h> header file. */
-/* #undef HAVE_STROPTS_H */
+/* #undef HAVE_STROPTS_H */
/* Define to 1 if you have the strstr function. */
#define HAVE_STRSTR 1
@@ -706,9 +706,9 @@
/* Define to 1 if you have the timeval struct. */
#define HAVE_STRUCT_TIMEVAL 1
-/* Define to 1 if suseconds_t is an available type. */
-#define HAVE_SUSECONDS_T 1
-
+/* Define to 1 if suseconds_t is an available type. */
+#define HAVE_SUSECONDS_T 1
+
/* Define to 1 if you have the <sys/filio.h> header file. */
/* #undef HAVE_SYS_FILIO_H */
@@ -805,15 +805,15 @@
/* Define to 1 if you have the winsock.h header file. */
/* #undef HAVE_WINSOCK_H */
-/* Define to 1 if you have the <wolfssh/ssh.h> header file. */
-/* #undef HAVE_WOLFSSH_SSH_H */
-
+/* Define to 1 if you have the <wolfssh/ssh.h> header file. */
+/* #undef HAVE_WOLFSSH_SSH_H */
+
/* Define to 1 if you have the `wolfSSLv3_client_method' function. */
/* #undef HAVE_WOLFSSLV3_CLIENT_METHOD */
-/* if you have wolfSSL_DES_ecb_encrypt */
-/* #undef HAVE_WOLFSSL_DES_ECB_ENCRYPT */
-
+/* if you have wolfSSL_DES_ecb_encrypt */
+/* #undef HAVE_WOLFSSL_DES_ECB_ENCRYPT */
+
/* Define to 1 if you have the `wolfSSL_get_peer_certificate' function. */
/* #undef HAVE_WOLFSSL_GET_PEER_CERTIFICATE */
@@ -821,7 +821,7 @@
/* #undef HAVE_WOLFSSL_USEALPN */
/* Define this symbol if your OS supports changing the contents of argv */
-#define HAVE_WRITABLE_ARGV 1
+#define HAVE_WRITABLE_ARGV 1
/* Define to 1 if you have the writev function. */
#define HAVE_WRITEV 1
@@ -835,12 +835,12 @@
/* if you have the zlib.h header file */
#define HAVE_ZLIB_H 1
-/* if libzstd is in use */
-/* #undef HAVE_ZSTD */
-
-/* Define to 1 if you have the <zstd.h> header file. */
-/* #undef HAVE_ZSTD_H */
-
+/* if libzstd is in use */
+/* #undef HAVE_ZSTD */
+
+/* Define to 1 if you have the <zstd.h> header file. */
+/* #undef HAVE_ZSTD_H */
+
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
@@ -872,7 +872,7 @@
#define PACKAGE "curl"
/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"
+#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"
/* Define to the full name of this package. */
#define PACKAGE_NAME "curl"
@@ -990,21 +990,21 @@
/* Define to enable c-ares support */
#define USE_ARES 1
-/* if BearSSL is enabled */
-/* #undef USE_BEARSSL */
-
-/* if ECH support is available */
-/* #undef USE_ECH */
-
+/* if BearSSL is enabled */
+/* #undef USE_BEARSSL */
+
+/* if ECH support is available */
+/* #undef USE_ECH */
+
/* if GnuTLS is enabled */
/* #undef USE_GNUTLS */
/* if GnuTLS uses nettle as crypto backend */
/* #undef USE_GNUTLS_NETTLE */
-/* to enable HSTS */
-/* #undef USE_HSTS */
-
+/* to enable HSTS */
+/* #undef USE_HSTS */
+
/* PSL support enabled */
/* #undef USE_LIBPSL */
@@ -1038,9 +1038,9 @@
/* if ngtcp2 is in use */
/* #undef USE_NGTCP2 */
-/* if ngtcp2_crypto_gnutls is in use */
-/* #undef USE_NGTCP2_CRYPTO_GNUTLS */
-
+/* if ngtcp2_crypto_gnutls is in use */
+/* #undef USE_NGTCP2_CRYPTO_GNUTLS */
+
/* if ngtcp2_crypto_openssl is in use */
/* #undef USE_NGTCP2_CRYPTO_OPENSSL */
@@ -1091,9 +1091,9 @@
/* to enable SSPI support */
/* #undef USE_WINDOWS_SSPI */
-/* if wolfSSH is in use */
-/* #undef USE_WOLFSSH */
-
+/* if wolfSSH is in use */
+/* #undef USE_WOLFSSH */
+
/* if wolfSSL is enabled */
/* #undef USE_WOLFSSL */
diff --git a/contrib/libs/curl/lib/curl_config.h b/contrib/libs/curl/lib/curl_config.h
index 224269b3ee..e58dec7079 100644
--- a/contrib/libs/curl/lib/curl_config.h
+++ b/contrib/libs/curl/lib/curl_config.h
@@ -17,51 +17,51 @@
#else
# include "curl_config-linux.h"
#endif
-
+
#if defined(_musl_)
# include "curl_config-musl.h"
#endif
-// Do not misrepresent host on Android and iOS.
-#undef OS
+// Do not misrepresent host on Android and iOS.
+#undef OS
#define OS "arcadia"
-// c-ares resolver is known to be buggy.
-//
-// There is no way to configure it properly without a JVM on Android,
-// because Android lacks traditional resolv.conf.
-//
-// For standalone Android programs, it is impossible
-// to contact ConnectionManager outside the JVM; this breaks c-ares DNS resolution.
-// As we can not distinguish builds of Android apps from standalone Android programs.
-//
-// During mapkit experiments, c-ares was adding about 10ms to each query timespan.
-//
-//
-// On Linux it caches /etc/resolv.conf contents and does not invalidate it properly
+// c-ares resolver is known to be buggy.
+//
+// There is no way to configure it properly without a JVM on Android,
+// because Android lacks traditional resolv.conf.
+//
+// For standalone Android programs, it is impossible
+// to contact ConnectionManager outside the JVM; this breaks c-ares DNS resolution.
+// As we can not distinguish builds of Android apps from standalone Android programs.
+//
+// During mapkit experiments, c-ares was adding about 10ms to each query timespan.
+//
+//
+// On Linux it caches /etc/resolv.conf contents and does not invalidate it properly
-#if defined(ARCADIA_CURL_DNS_RESOLVER_ARES)
- #define USE_ARES
-#elif defined(ARCADIA_CURL_DNS_RESOLVER_MULTITHREADED)
- #if defined(USE_ARES)
- #undef USE_ARES
- #endif
- #if defined(__linux__) && !defined(USE_THREADS_POSIX)
- #define USE_THREADS_POSIX 1
- #elif defined(_MSC_VER) && !defined(USE_THREADS_WIN32)
- #define USE_THREADS_WIN32 1
- #endif
-#elif defined(ARCADIA_CURL_DNS_RESOLVER_SYNCHRONOUS)
- // force using synchronous resolver by disabling thread support
- #if defined(USE_ARES)
- #undef USE_ARES
- #endif
- #if defined(USE_THREADS_POSIX)
- #undef USE_THREADS_POSIX
- #endif
- #if defined(USE_THREADS_WIN32)
- #undef USE_THREADS_WIN32
- #endif
-#else
- #error "No dns resolver is specified or resolver specification is wrong"
+#if defined(ARCADIA_CURL_DNS_RESOLVER_ARES)
+ #define USE_ARES
+#elif defined(ARCADIA_CURL_DNS_RESOLVER_MULTITHREADED)
+ #if defined(USE_ARES)
+ #undef USE_ARES
+ #endif
+ #if defined(__linux__) && !defined(USE_THREADS_POSIX)
+ #define USE_THREADS_POSIX 1
+ #elif defined(_MSC_VER) && !defined(USE_THREADS_WIN32)
+ #define USE_THREADS_WIN32 1
+ #endif
+#elif defined(ARCADIA_CURL_DNS_RESOLVER_SYNCHRONOUS)
+ // force using synchronous resolver by disabling thread support
+ #if defined(USE_ARES)
+ #undef USE_ARES
+ #endif
+ #if defined(USE_THREADS_POSIX)
+ #undef USE_THREADS_POSIX
+ #endif
+ #if defined(USE_THREADS_WIN32)
+ #undef USE_THREADS_WIN32
+ #endif
+#else
+ #error "No dns resolver is specified or resolver specification is wrong"
#endif
diff --git a/contrib/libs/curl/lib/curl_ctype.c b/contrib/libs/curl/lib/curl_ctype.c
index 7aeda2bcf8..d6cd08a077 100644
--- a/contrib/libs/curl/lib/curl_ctype.c
+++ b/contrib/libs/curl/lib/curl_ctype.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_ctype.h b/contrib/libs/curl/lib/curl_ctype.h
index d167e6b31a..17dfaa0942 100644
--- a/contrib/libs/curl/lib/curl_ctype.h
+++ b/contrib/libs/curl/lib/curl_ctype.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_des.c b/contrib/libs/curl/lib/curl_des.c
index f5f928a886..8c5af19cd2 100644
--- a/contrib/libs/curl/lib/curl_des.c
+++ b/contrib/libs/curl/lib/curl_des.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2015 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2015 - 2020, Steve Holme, <steve_holme@hotmail.com>.
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_des.h b/contrib/libs/curl/lib/curl_des.h
index 4cd8431897..438706a0d2 100644
--- a/contrib/libs/curl/lib/curl_des.h
+++ b/contrib/libs/curl/lib/curl_des.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2015 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2015 - 2020, Steve Holme, <steve_holme@hotmail.com>.
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_endian.c b/contrib/libs/curl/lib/curl_endian.c
index b54ee61063..2fc25bc173 100644
--- a/contrib/libs/curl/lib/curl_endian.c
+++ b/contrib/libs/curl/lib/curl_endian.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -81,7 +81,7 @@ unsigned short Curl_read16_be(const unsigned char *buf)
((unsigned short)buf[1]));
}
-#if (CURL_SIZEOF_CURL_OFF_T > 4)
+#if (CURL_SIZEOF_CURL_OFF_T > 4)
/*
* write32_le()
*
diff --git a/contrib/libs/curl/lib/curl_endian.h b/contrib/libs/curl/lib/curl_endian.h
index 083b6b94ef..341dfaf3cc 100644
--- a/contrib/libs/curl/lib/curl_endian.h
+++ b/contrib/libs/curl/lib/curl_endian.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_fnmatch.c b/contrib/libs/curl/lib/curl_fnmatch.c
index c4b0cfd38b..4bfa58598e 100644
--- a/contrib/libs/curl/lib/curl_fnmatch.c
+++ b/contrib/libs/curl/lib/curl_fnmatch.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_fnmatch.h b/contrib/libs/curl/lib/curl_fnmatch.h
index d6f169fabf..1c80ea7793 100644
--- a/contrib/libs/curl/lib/curl_fnmatch.h
+++ b/contrib/libs/curl/lib/curl_fnmatch.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_get_line.c b/contrib/libs/curl/lib/curl_get_line.c
index 84fa07ab03..438ede7046 100644
--- a/contrib/libs/curl/lib/curl_get_line.c
+++ b/contrib/libs/curl/lib/curl_get_line.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -22,9 +22,9 @@
#include "curl_setup.h"
-#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
- defined(USE_HSTS)
-
+#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
+ defined(USE_HSTS)
+
#include "curl_get_line.h"
#include "curl_memory.h"
/* The last #include file should be: */
@@ -56,5 +56,5 @@ char *Curl_get_line(char *buf, int len, FILE *input)
}
return NULL;
}
-
-#endif /* if not disabled */
+
+#endif /* if not disabled */
diff --git a/contrib/libs/curl/lib/curl_get_line.h b/contrib/libs/curl/lib/curl_get_line.h
index d7ba9d0664..597aa09a9c 100644
--- a/contrib/libs/curl/lib/curl_get_line.h
+++ b/contrib/libs/curl/lib/curl_get_line.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_gethostname.c b/contrib/libs/curl/lib/curl_gethostname.c
index d242a129ad..2d5ff61cf6 100644
--- a/contrib/libs/curl/lib/curl_gethostname.c
+++ b/contrib/libs/curl/lib/curl_gethostname.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -48,7 +48,7 @@
* For libcurl static library release builds no overriding takes place.
*/
-int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen)
+int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen)
{
#ifndef HAVE_GETHOSTNAME
diff --git a/contrib/libs/curl/lib/curl_gethostname.h b/contrib/libs/curl/lib/curl_gethostname.h
index 771989c724..2161c40ac3 100644
--- a/contrib/libs/curl/lib/curl_gethostname.h
+++ b/contrib/libs/curl/lib/curl_gethostname.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,6 +26,6 @@
#define HOSTNAME_MAX 1024
/* This returns the local machine's un-qualified hostname */
-int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen);
+int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen);
#endif /* HEADER_CURL_GETHOSTNAME_H */
diff --git a/contrib/libs/curl/lib/curl_gssapi.c b/contrib/libs/curl/lib/curl_gssapi.c
index 23d9378b92..f72430b26f 100644
--- a/contrib/libs/curl/lib/curl_gssapi.c
+++ b/contrib/libs/curl/lib/curl_gssapi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_gssapi.h b/contrib/libs/curl/lib/curl_gssapi.h
index 50786ed31b..466d09ed0a 100644
--- a/contrib/libs/curl/lib/curl_gssapi.h
+++ b/contrib/libs/curl/lib/curl_gssapi.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_hmac.h b/contrib/libs/curl/lib/curl_hmac.h
index 68f313b74e..84c73121bd 100644
--- a/contrib/libs/curl/lib/curl_hmac.h
+++ b/contrib/libs/curl/lib/curl_hmac.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -24,8 +24,8 @@
#ifndef CURL_DISABLE_CRYPTO_AUTH
-#define HMAC_MD5_LENGTH 16
-
+#define HMAC_MD5_LENGTH 16
+
typedef void (* HMAC_hinit_func)(void *context);
typedef void (* HMAC_hupdate_func)(void *context,
const unsigned char *data,
@@ -34,39 +34,39 @@ typedef void (* HMAC_hfinal_func)(unsigned char *result, void *context);
/* Per-hash function HMAC parameters. */
-struct HMAC_params {
- HMAC_hinit_func
- hmac_hinit; /* Initialize context procedure. */
+struct HMAC_params {
+ HMAC_hinit_func
+ hmac_hinit; /* Initialize context procedure. */
HMAC_hupdate_func hmac_hupdate; /* Update context with data. */
HMAC_hfinal_func hmac_hfinal; /* Get final result procedure. */
unsigned int hmac_ctxtsize; /* Context structure size. */
unsigned int hmac_maxkeylen; /* Maximum key length (bytes). */
unsigned int hmac_resultlen; /* Result length (bytes). */
-};
+};
/* HMAC computation context. */
-struct HMAC_context {
- const struct HMAC_params *hmac_hash; /* Hash function definition. */
+struct HMAC_context {
+ const struct HMAC_params *hmac_hash; /* Hash function definition. */
void *hmac_hashctxt1; /* Hash function context 1. */
void *hmac_hashctxt2; /* Hash function context 2. */
-};
+};
/* Prototypes. */
-struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams,
- const unsigned char *key,
- unsigned int keylen);
-int Curl_HMAC_update(struct HMAC_context *context,
+struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams,
+ const unsigned char *key,
+ unsigned int keylen);
+int Curl_HMAC_update(struct HMAC_context *context,
const unsigned char *data,
unsigned int len);
-int Curl_HMAC_final(struct HMAC_context *context, unsigned char *result);
+int Curl_HMAC_final(struct HMAC_context *context, unsigned char *result);
+
+CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
+ const unsigned char *key, const size_t keylen,
+ const unsigned char *data, const size_t datalen,
+ unsigned char *output);
-CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
- const unsigned char *key, const size_t keylen,
- const unsigned char *data, const size_t datalen,
- unsigned char *output);
-
#endif
#endif /* HEADER_CURL_HMAC_H */
diff --git a/contrib/libs/curl/lib/curl_krb5.h b/contrib/libs/curl/lib/curl_krb5.h
index a4ed769cc4..f0a6fa69be 100644
--- a/contrib/libs/curl/lib/curl_krb5.h
+++ b/contrib/libs/curl/lib/curl_krb5.h
@@ -1,51 +1,51 @@
-#ifndef HEADER_CURL_KRB5_H
-#define HEADER_CURL_KRB5_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
- *
- ***************************************************************************/
-
-struct Curl_sec_client_mech {
- const char *name;
- size_t size;
- int (*init)(void *);
- int (*auth)(void *, struct connectdata *);
- void (*end)(void *);
- int (*check_prot)(void *, int);
- int (*overhead)(void *, int, int);
- int (*encode)(void *, const void *, int, int, void **);
- int (*decode)(void *, void *, int, int, struct connectdata *);
-};
-
-#define AUTH_OK 0
-#define AUTH_CONTINUE 1
-#define AUTH_ERROR 2
-
-#ifdef HAVE_GSSAPI
-int Curl_sec_read_msg(struct connectdata *conn, char *,
- enum protection_level);
-void Curl_sec_end(struct connectdata *);
-CURLcode Curl_sec_login(struct connectdata *);
-int Curl_sec_request_prot(struct connectdata *conn, const char *level);
-#else
-#define Curl_sec_end(x)
-#endif
-
-#endif /* HEADER_CURL_KRB5_H */
+#ifndef HEADER_CURL_KRB5_H
+#define HEADER_CURL_KRB5_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
+ *
+ ***************************************************************************/
+
+struct Curl_sec_client_mech {
+ const char *name;
+ size_t size;
+ int (*init)(void *);
+ int (*auth)(void *, struct connectdata *);
+ void (*end)(void *);
+ int (*check_prot)(void *, int);
+ int (*overhead)(void *, int, int);
+ int (*encode)(void *, const void *, int, int, void **);
+ int (*decode)(void *, void *, int, int, struct connectdata *);
+};
+
+#define AUTH_OK 0
+#define AUTH_CONTINUE 1
+#define AUTH_ERROR 2
+
+#ifdef HAVE_GSSAPI
+int Curl_sec_read_msg(struct connectdata *conn, char *,
+ enum protection_level);
+void Curl_sec_end(struct connectdata *);
+CURLcode Curl_sec_login(struct connectdata *);
+int Curl_sec_request_prot(struct connectdata *conn, const char *level);
+#else
+#define Curl_sec_end(x)
+#endif
+
+#endif /* HEADER_CURL_KRB5_H */
diff --git a/contrib/libs/curl/lib/curl_ldap.h b/contrib/libs/curl/lib/curl_ldap.h
index f4890a3f2c..124e18b133 100644
--- a/contrib/libs/curl/lib/curl_ldap.h
+++ b/contrib/libs/curl/lib/curl_ldap.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_md4.h b/contrib/libs/curl/lib/curl_md4.h
index fc959dd8d1..f9dafcb53c 100644
--- a/contrib/libs/curl/lib/curl_md4.h
+++ b/contrib/libs/curl/lib/curl_md4.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -28,8 +28,8 @@
#define MD4_DIGEST_LENGTH 16
-void Curl_md4it(unsigned char *output, const unsigned char *input,
- const size_t len);
+void Curl_md4it(unsigned char *output, const unsigned char *input,
+ const size_t len);
#endif /* !defined(CURL_DISABLE_CRYPTO_AUTH) */
diff --git a/contrib/libs/curl/lib/curl_md5.h b/contrib/libs/curl/lib/curl_md5.h
index 56c6871697..5739c89ca4 100644
--- a/contrib/libs/curl/lib/curl_md5.h
+++ b/contrib/libs/curl/lib/curl_md5.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -33,30 +33,30 @@ typedef void (* Curl_MD5_update_func)(void *context,
unsigned int len);
typedef void (* Curl_MD5_final_func)(unsigned char *result, void *context);
-struct MD5_params {
+struct MD5_params {
Curl_MD5_init_func md5_init_func; /* Initialize context procedure */
Curl_MD5_update_func md5_update_func; /* Update context with data */
Curl_MD5_final_func md5_final_func; /* Get final result procedure */
unsigned int md5_ctxtsize; /* Context structure size */
unsigned int md5_resultlen; /* Result length (bytes) */
-};
+};
-struct MD5_context {
- const struct MD5_params *md5_hash; /* Hash function definition */
+struct MD5_context {
+ const struct MD5_params *md5_hash; /* Hash function definition */
void *md5_hashctx; /* Hash function context */
-};
+};
-extern const struct MD5_params Curl_DIGEST_MD5[1];
-extern const struct HMAC_params Curl_HMAC_MD5[1];
+extern const struct MD5_params Curl_DIGEST_MD5[1];
+extern const struct HMAC_params Curl_HMAC_MD5[1];
-void Curl_md5it(unsigned char *output, const unsigned char *input,
- const size_t len);
+void Curl_md5it(unsigned char *output, const unsigned char *input,
+ const size_t len);
-struct MD5_context *Curl_MD5_init(const struct MD5_params *md5params);
-CURLcode Curl_MD5_update(struct MD5_context *context,
+struct MD5_context *Curl_MD5_init(const struct MD5_params *md5params);
+CURLcode Curl_MD5_update(struct MD5_context *context,
const unsigned char *data,
unsigned int len);
-CURLcode Curl_MD5_final(struct MD5_context *context, unsigned char *result);
+CURLcode Curl_MD5_final(struct MD5_context *context, unsigned char *result);
#endif
diff --git a/contrib/libs/curl/lib/curl_memory.h b/contrib/libs/curl/lib/curl_memory.h
index b253d462fd..5806290637 100644
--- a/contrib/libs/curl/lib/curl_memory.h
+++ b/contrib/libs/curl/lib/curl_memory.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_memrchr.c b/contrib/libs/curl/lib/curl_memrchr.c
index b79cc69488..0bd845f690 100644
--- a/contrib/libs/curl/lib/curl_memrchr.c
+++ b/contrib/libs/curl/lib/curl_memrchr.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_memrchr.h b/contrib/libs/curl/lib/curl_memrchr.h
index 5968d0a40c..c8394bb433 100644
--- a/contrib/libs/curl/lib/curl_memrchr.h
+++ b/contrib/libs/curl/lib/curl_memrchr.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_multibyte.c b/contrib/libs/curl/lib/curl_multibyte.c
index c10982c7ec..d327c8ba77 100644
--- a/contrib/libs/curl/lib/curl_multibyte.c
+++ b/contrib/libs/curl/lib/curl_multibyte.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -20,21 +20,21 @@
*
***************************************************************************/
-/*
- * This file is 'mem-include-scan' clean. See test 1132.
- */
-
+/*
+ * This file is 'mem-include-scan' clean. See test 1132.
+ */
+
#include "curl_setup.h"
-#if defined(WIN32)
+#if defined(WIN32)
#include "curl_multibyte.h"
-/*
- * MultiByte conversions using Windows kernel32 library.
- */
+/*
+ * MultiByte conversions using Windows kernel32 library.
+ */
-wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8)
+wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8)
{
wchar_t *str_w = NULL;
@@ -56,7 +56,7 @@ wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8)
return str_w;
}
-char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w)
+char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w)
{
char *str_utf8 = NULL;
@@ -78,76 +78,76 @@ char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w)
return str_utf8;
}
-#endif /* WIN32 */
-
-#if defined(USE_WIN32_LARGE_FILES) || defined(USE_WIN32_SMALL_FILES)
-
-FILE *curlx_win32_fopen(const char *filename, const char *mode)
-{
-#ifdef _UNICODE
- FILE *result = NULL;
- wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename);
- wchar_t *mode_w = curlx_convert_UTF8_to_wchar(mode);
- if(filename_w && mode_w)
- result = _wfopen(filename_w, mode_w);
- free(filename_w);
- free(mode_w);
- if(result)
- return result;
-#endif
-
- return (fopen)(filename, mode);
-}
-
-int curlx_win32_stat(const char *path, struct_stat *buffer)
-{
- int result = -1;
-#ifdef _UNICODE
- wchar_t *path_w = curlx_convert_UTF8_to_wchar(path);
-#endif /* _UNICODE */
-
-#if defined(USE_WIN32_SMALL_FILES)
-#if defined(_UNICODE)
- if(path_w)
- result = _wstat(path_w, buffer);
- else
-#endif /* _UNICODE */
- result = _stat(path, buffer);
-#else /* USE_WIN32_SMALL_FILES */
-#if defined(_UNICODE)
- if(path_w)
- result = _wstati64(path_w, buffer);
- else
-#endif /* _UNICODE */
- result = _stati64(path, buffer);
-#endif /* USE_WIN32_SMALL_FILES */
-
-#ifdef _UNICODE
- free(path_w);
-#endif
-
- return result;
-}
-
-int curlx_win32_access(const char *path, int mode)
-{
- int result = -1;
-#ifdef _UNICODE
- wchar_t *path_w = curlx_convert_UTF8_to_wchar(path);
-#endif /* _UNICODE */
-
-#if defined(_UNICODE)
- if(path_w)
- result = _waccess(path_w, mode);
- else
-#endif /* _UNICODE */
- result = _access(path, mode);
-
-#ifdef _UNICODE
- free(path_w);
-#endif
-
- return result;
-}
-
-#endif /* USE_WIN32_LARGE_FILES || USE_WIN32_SMALL_FILES */
+#endif /* WIN32 */
+
+#if defined(USE_WIN32_LARGE_FILES) || defined(USE_WIN32_SMALL_FILES)
+
+FILE *curlx_win32_fopen(const char *filename, const char *mode)
+{
+#ifdef _UNICODE
+ FILE *result = NULL;
+ wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename);
+ wchar_t *mode_w = curlx_convert_UTF8_to_wchar(mode);
+ if(filename_w && mode_w)
+ result = _wfopen(filename_w, mode_w);
+ free(filename_w);
+ free(mode_w);
+ if(result)
+ return result;
+#endif
+
+ return (fopen)(filename, mode);
+}
+
+int curlx_win32_stat(const char *path, struct_stat *buffer)
+{
+ int result = -1;
+#ifdef _UNICODE
+ wchar_t *path_w = curlx_convert_UTF8_to_wchar(path);
+#endif /* _UNICODE */
+
+#if defined(USE_WIN32_SMALL_FILES)
+#if defined(_UNICODE)
+ if(path_w)
+ result = _wstat(path_w, buffer);
+ else
+#endif /* _UNICODE */
+ result = _stat(path, buffer);
+#else /* USE_WIN32_SMALL_FILES */
+#if defined(_UNICODE)
+ if(path_w)
+ result = _wstati64(path_w, buffer);
+ else
+#endif /* _UNICODE */
+ result = _stati64(path, buffer);
+#endif /* USE_WIN32_SMALL_FILES */
+
+#ifdef _UNICODE
+ free(path_w);
+#endif
+
+ return result;
+}
+
+int curlx_win32_access(const char *path, int mode)
+{
+ int result = -1;
+#ifdef _UNICODE
+ wchar_t *path_w = curlx_convert_UTF8_to_wchar(path);
+#endif /* _UNICODE */
+
+#if defined(_UNICODE)
+ if(path_w)
+ result = _waccess(path_w, mode);
+ else
+#endif /* _UNICODE */
+ result = _access(path, mode);
+
+#ifdef _UNICODE
+ free(path_w);
+#endif
+
+ return result;
+}
+
+#endif /* USE_WIN32_LARGE_FILES || USE_WIN32_SMALL_FILES */
diff --git a/contrib/libs/curl/lib/curl_multibyte.h b/contrib/libs/curl/lib/curl_multibyte.h
index 101a2148be..8adaf49784 100644
--- a/contrib/libs/curl/lib/curl_multibyte.h
+++ b/contrib/libs/curl/lib/curl_multibyte.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -23,46 +23,46 @@
***************************************************************************/
#include "curl_setup.h"
-#if defined(WIN32)
+#if defined(WIN32)
/*
* MultiByte conversions using Windows kernel32 library.
*/
-wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8);
-char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w);
+wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8);
+char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w);
-#endif /* WIN32 */
+#endif /* WIN32 */
/*
- * Macros curlx_convert_UTF8_to_tchar(), curlx_convert_tchar_to_UTF8()
- * and curlx_unicodefree() main purpose is to minimize the number of
+ * Macros curlx_convert_UTF8_to_tchar(), curlx_convert_tchar_to_UTF8()
+ * and curlx_unicodefree() main purpose is to minimize the number of
* preprocessor conditional directives needed by code using these
* to differentiate UNICODE from non-UNICODE builds.
*
- * When building with UNICODE defined, these two macros
- * curlx_convert_UTF8_to_tchar() and curlx_convert_tchar_to_UTF8()
+ * When building with UNICODE defined, these two macros
+ * curlx_convert_UTF8_to_tchar() and curlx_convert_tchar_to_UTF8()
* return a pointer to a newly allocated memory area holding result.
* When the result is no longer needed, allocated memory is intended
- * to be free'ed with curlx_unicodefree().
+ * to be free'ed with curlx_unicodefree().
*
* When building without UNICODE defined, this macros
- * curlx_convert_UTF8_to_tchar() and curlx_convert_tchar_to_UTF8()
- * return the pointer received as argument. curlx_unicodefree() does
+ * curlx_convert_UTF8_to_tchar() and curlx_convert_tchar_to_UTF8()
+ * return the pointer received as argument. curlx_unicodefree() does
* no actual free'ing of this pointer it is simply set to NULL.
*/
-#if defined(UNICODE) && defined(WIN32)
+#if defined(UNICODE) && defined(WIN32)
-#define curlx_convert_UTF8_to_tchar(ptr) curlx_convert_UTF8_to_wchar((ptr))
-#define curlx_convert_tchar_to_UTF8(ptr) curlx_convert_wchar_to_UTF8((ptr))
-#define curlx_unicodefree(ptr) \
- do { \
- if(ptr) { \
- (free)(ptr); \
- (ptr) = NULL; \
- } \
- } while(0)
+#define curlx_convert_UTF8_to_tchar(ptr) curlx_convert_UTF8_to_wchar((ptr))
+#define curlx_convert_tchar_to_UTF8(ptr) curlx_convert_wchar_to_UTF8((ptr))
+#define curlx_unicodefree(ptr) \
+ do { \
+ if(ptr) { \
+ (free)(ptr); \
+ (ptr) = NULL; \
+ } \
+ } while(0)
typedef union {
unsigned short *tchar_ptr;
@@ -73,10 +73,10 @@ typedef union {
#else
-#define curlx_convert_UTF8_to_tchar(ptr) (ptr)
-#define curlx_convert_tchar_to_UTF8(ptr) (ptr)
-#define curlx_unicodefree(ptr) \
- do {(ptr) = NULL;} while(0)
+#define curlx_convert_UTF8_to_tchar(ptr) (ptr)
+#define curlx_convert_tchar_to_UTF8(ptr) (ptr)
+#define curlx_unicodefree(ptr) \
+ do {(ptr) = NULL;} while(0)
typedef union {
char *tchar_ptr;
@@ -85,6 +85,6 @@ typedef union {
const unsigned char *const_tbyte_ptr;
} xcharp_u;
-#endif /* UNICODE && WIN32 */
+#endif /* UNICODE && WIN32 */
#endif /* HEADER_CURL_MULTIBYTE_H */
diff --git a/contrib/libs/curl/lib/curl_ntlm_core.c b/contrib/libs/curl/lib/curl_ntlm_core.c
index d4d8c1b107..b35b566a71 100644
--- a/contrib/libs/curl/lib/curl_ntlm_core.c
+++ b/contrib/libs/curl/lib/curl_ntlm_core.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -22,7 +22,7 @@
#include "curl_setup.h"
-#if defined(USE_CURL_NTLM_CORE)
+#if defined(USE_CURL_NTLM_CORE)
/*
* NTLM details:
@@ -50,18 +50,18 @@
in NTLM type-3 messages.
*/
-#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
-#ifdef USE_WOLFSSL
-#error #include <wolfssl/options.h>
-#endif
+#ifdef USE_WOLFSSL
+#error #include <wolfssl/options.h>
+#endif
# include <openssl/des.h>
# include <openssl/md5.h>
# include <openssl/ssl.h>
# include <openssl/rand.h>
-# if (defined(OPENSSL_VERSION_NUMBER) && \
- (OPENSSL_VERSION_NUMBER < 0x00907001L)) && !defined(USE_WOLFSSL)
+# if (defined(OPENSSL_VERSION_NUMBER) && \
+ (OPENSSL_VERSION_NUMBER < 0x00907001L)) && !defined(USE_WOLFSSL)
# define DES_key_schedule des_key_schedule
# define DES_cblock des_cblock
# define DES_set_odd_parity des_set_odd_parity
@@ -139,7 +139,7 @@ static void extend_key_56_to_64(const unsigned char *key_56, char *key)
key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF);
}
-#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
/*
* Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The
* key schedule ks is also set.
@@ -343,7 +343,7 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
/* Acquire the crypto provider */
if(!CryptAcquireContext(&hprov, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
return FALSE;
/* Setup the key blob structure */
@@ -388,7 +388,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
const unsigned char *plaintext,
unsigned char *results)
{
-#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
DES_key_schedule ks;
setup_des_key(keys, DESKEY(ks));
@@ -463,7 +463,7 @@ CURLcode Curl_ntlm_core_mk_lm_hash(struct Curl_easy *data,
{
/* Create LanManager hashed password. */
-#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
+#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
DES_key_schedule ks;
setup_des_key(pw, DESKEY(ks));
@@ -580,11 +580,11 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
unsigned char *identity;
CURLcode result = CURLE_OK;
- if((userlen > CURL_MAX_INPUT_LENGTH) || (domlen > CURL_MAX_INPUT_LENGTH))
+ if((userlen > CURL_MAX_INPUT_LENGTH) || (domlen > CURL_MAX_INPUT_LENGTH))
return CURLE_OUT_OF_MEMORY;
identity_len = (userlen + domlen) * 2;
- identity = malloc(identity_len + 1);
+ identity = malloc(identity_len + 1);
if(!identity)
return CURLE_OUT_OF_MEMORY;
@@ -592,8 +592,8 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
ascii_uppercase_to_unicode_le(identity, user, userlen);
ascii_to_unicode_le(identity + (userlen << 1), domain, domlen);
- result = Curl_hmacit(Curl_HMAC_MD5, ntlmhash, 16, identity, identity_len,
- ntlmv2hash);
+ result = Curl_hmacit(Curl_HMAC_MD5, ntlmhash, 16, identity, identity_len,
+ ntlmv2hash);
free(identity);
return result;
@@ -639,7 +639,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
unsigned int len = 0;
unsigned char *ptr = NULL;
- unsigned char hmac_output[HMAC_MD5_LENGTH];
+ unsigned char hmac_output[HMAC_MD5_LENGTH];
curl_off_t tw;
CURLcode result = CURLE_OK;
@@ -658,7 +658,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
tw = ((curl_off_t)time(NULL) + CURL_OFF_T_C(11644473600)) * 10000000;
/* Calculate the response len */
- len = HMAC_MD5_LENGTH + NTLMv2_BLOB_LEN;
+ len = HMAC_MD5_LENGTH + NTLMv2_BLOB_LEN;
/* Allocate the response */
ptr = calloc(1, len);
@@ -666,7 +666,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
return CURLE_OUT_OF_MEMORY;
/* Create the BLOB structure */
- msnprintf((char *)ptr + HMAC_MD5_LENGTH, NTLMv2_BLOB_LEN,
+ msnprintf((char *)ptr + HMAC_MD5_LENGTH, NTLMv2_BLOB_LEN,
"%c%c%c%c" /* NTLMv2_BLOB_SIGNATURE */
"%c%c%c%c", /* Reserved = 0 */
NTLMv2_BLOB_SIGNATURE[0], NTLMv2_BLOB_SIGNATURE[1],
@@ -679,7 +679,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
/* Concatenate the Type 2 challenge with the BLOB and do HMAC MD5 */
memcpy(ptr + 8, &ntlm->nonce[0], 8);
- result = Curl_hmacit(Curl_HMAC_MD5, ntlmv2hash, HMAC_MD5_LENGTH, ptr + 8,
+ result = Curl_hmacit(Curl_HMAC_MD5, ntlmv2hash, HMAC_MD5_LENGTH, ptr + 8,
NTLMv2_BLOB_LEN + 8, hmac_output);
if(result) {
free(ptr);
@@ -687,7 +687,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
}
/* Concatenate the HMAC MD5 output with the BLOB */
- memcpy(ptr, hmac_output, HMAC_MD5_LENGTH);
+ memcpy(ptr, hmac_output, HMAC_MD5_LENGTH);
/* Return the response */
*ntresp = ptr;
@@ -722,8 +722,8 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
memcpy(&data[0], challenge_server, 8);
memcpy(&data[8], challenge_client, 8);
- result = Curl_hmacit(Curl_HMAC_MD5, ntlmv2hash, 16, &data[0], 16,
- hmac_output);
+ result = Curl_hmacit(Curl_HMAC_MD5, ntlmv2hash, 16, &data[0], 16,
+ hmac_output);
if(result)
return result;
@@ -738,4 +738,4 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
#endif /* USE_NTRESPONSES */
-#endif /* USE_CURL_NTLM_CORE */
+#endif /* USE_CURL_NTLM_CORE */
diff --git a/contrib/libs/curl/lib/curl_ntlm_core.h b/contrib/libs/curl/lib/curl_ntlm_core.h
index abd4f5e5c8..0ed1b8d1e9 100644
--- a/contrib/libs/curl/lib/curl_ntlm_core.h
+++ b/contrib/libs/curl/lib/curl_ntlm_core.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -24,22 +24,22 @@
#include "curl_setup.h"
-#if defined(USE_CURL_NTLM_CORE)
+#if defined(USE_CURL_NTLM_CORE)
/* If NSS is the first available SSL backend (see order in curl_ntlm_core.c)
then it must be initialized to be used by NTLM. */
#if !defined(USE_OPENSSL) && \
- !defined(USE_WOLFSSL) && \
+ !defined(USE_WOLFSSL) && \
!defined(USE_GNUTLS_NETTLE) && \
!defined(USE_GNUTLS) && \
defined(USE_NSS)
#define NTLM_NEEDS_NSS_INIT
#endif
-#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
-#ifdef USE_WOLFSSL
-# error #include <wolfssl/options.h>
-#endif
+#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
+#ifdef USE_WOLFSSL
+# error #include <wolfssl/options.h>
+#endif
# include <openssl/ssl.h>
#endif
@@ -48,9 +48,9 @@
#define USE_NTRESPONSES
/* Define USE_NTLM2SESSION in order to make the type-3 message include the
- NTLM2Session response message, requires USE_NTRESPONSES defined to 1 and
- MD5 support */
-#if defined(USE_NTRESPONSES) && !defined(CURL_DISABLE_CRYPTO_AUTH)
+ NTLM2Session response message, requires USE_NTRESPONSES defined to 1 and
+ MD5 support */
+#if defined(USE_NTRESPONSES) && !defined(CURL_DISABLE_CRYPTO_AUTH)
#define USE_NTLM2SESSION
#endif
@@ -100,6 +100,6 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
#endif /* USE_NTRESPONSES */
-#endif /* USE_CURL_NTLM_CORE */
+#endif /* USE_CURL_NTLM_CORE */
#endif /* HEADER_CURL_NTLM_CORE_H */
diff --git a/contrib/libs/curl/lib/curl_ntlm_wb.c b/contrib/libs/curl/lib/curl_ntlm_wb.c
index e401ce99ec..c11757f557 100644
--- a/contrib/libs/curl/lib/curl_ntlm_wb.c
+++ b/contrib/libs/curl/lib/curl_ntlm_wb.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -76,22 +76,22 @@
# define sclose_nolog(x) close((x))
#endif
-static void ntlm_wb_cleanup(struct ntlmdata *ntlm)
+static void ntlm_wb_cleanup(struct ntlmdata *ntlm)
{
- if(ntlm->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) {
- sclose(ntlm->ntlm_auth_hlpr_socket);
- ntlm->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
+ if(ntlm->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) {
+ sclose(ntlm->ntlm_auth_hlpr_socket);
+ ntlm->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
}
- if(ntlm->ntlm_auth_hlpr_pid) {
+ if(ntlm->ntlm_auth_hlpr_pid) {
int i;
for(i = 0; i < 4; i++) {
- pid_t ret = waitpid(ntlm->ntlm_auth_hlpr_pid, NULL, WNOHANG);
- if(ret == ntlm->ntlm_auth_hlpr_pid || errno == ECHILD)
+ pid_t ret = waitpid(ntlm->ntlm_auth_hlpr_pid, NULL, WNOHANG);
+ if(ret == ntlm->ntlm_auth_hlpr_pid || errno == ECHILD)
break;
switch(i) {
case 0:
- kill(ntlm->ntlm_auth_hlpr_pid, SIGTERM);
+ kill(ntlm->ntlm_auth_hlpr_pid, SIGTERM);
break;
case 1:
/* Give the process another moment to shut down cleanly before
@@ -99,21 +99,21 @@ static void ntlm_wb_cleanup(struct ntlmdata *ntlm)
Curl_wait_ms(1);
break;
case 2:
- kill(ntlm->ntlm_auth_hlpr_pid, SIGKILL);
+ kill(ntlm->ntlm_auth_hlpr_pid, SIGKILL);
break;
case 3:
break;
}
}
- ntlm->ntlm_auth_hlpr_pid = 0;
+ ntlm->ntlm_auth_hlpr_pid = 0;
}
- Curl_safefree(ntlm->challenge);
- Curl_safefree(ntlm->response);
+ Curl_safefree(ntlm->challenge);
+ Curl_safefree(ntlm->response);
}
-static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
- const char *userp)
+static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
+ const char *userp)
{
curl_socket_t sockfds[2];
pid_t child_pid;
@@ -127,13 +127,13 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
#endif
char buffer[STRERROR_LEN];
-#if defined(CURL_DISABLE_VERBOSE_STRINGS)
- (void) data;
-#endif
-
+#if defined(CURL_DISABLE_VERBOSE_STRINGS)
+ (void) data;
+#endif
+
/* Return if communication with ntlm_auth already set up */
- if(ntlm->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD ||
- ntlm->ntlm_auth_hlpr_pid)
+ if(ntlm->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD ||
+ ntlm->ntlm_auth_hlpr_pid)
return CURLE_OK;
username = userp;
@@ -184,13 +184,13 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
ntlm_auth = NTLM_WB_FILE;
if(access(ntlm_auth, X_OK) != 0) {
- failf(data, "Could not access ntlm_auth: %s errno %d: %s",
+ failf(data, "Could not access ntlm_auth: %s errno %d: %s",
ntlm_auth, errno, Curl_strerror(errno, buffer, sizeof(buffer)));
goto done;
}
- if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) {
- failf(data, "Could not open socket pair. errno %d: %s",
+ if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) {
+ failf(data, "Could not open socket pair. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
goto done;
}
@@ -199,7 +199,7 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
if(child_pid == -1) {
sclose(sockfds[0]);
sclose(sockfds[1]);
- failf(data, "Could not fork. errno %d: %s",
+ failf(data, "Could not fork. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
goto done;
}
@@ -211,13 +211,13 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
/* Don't use sclose in the child since it fools the socket leak detector */
sclose_nolog(sockfds[0]);
if(dup2(sockfds[1], STDIN_FILENO) == -1) {
- failf(data, "Could not redirect child stdin. errno %d: %s",
+ failf(data, "Could not redirect child stdin. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
exit(1);
}
if(dup2(sockfds[1], STDOUT_FILENO) == -1) {
- failf(data, "Could not redirect child stdout. errno %d: %s",
+ failf(data, "Could not redirect child stdout. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
exit(1);
}
@@ -237,14 +237,14 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
NULL);
sclose_nolog(sockfds[1]);
- failf(data, "Could not execl(). errno %d: %s",
+ failf(data, "Could not execl(). errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
exit(1);
}
sclose(sockfds[1]);
- ntlm->ntlm_auth_hlpr_socket = sockfds[0];
- ntlm->ntlm_auth_hlpr_pid = child_pid;
+ ntlm->ntlm_auth_hlpr_socket = sockfds[0];
+ ntlm->ntlm_auth_hlpr_pid = child_pid;
free(domain);
free(ntlm_auth_alloc);
return CURLE_OK;
@@ -258,17 +258,17 @@ done:
/* if larger than this, something is seriously wrong */
#define MAX_NTLM_WB_RESPONSE 100000
-static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
+static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
const char *input, curlntlm state)
{
size_t len_in = strlen(input), len_out = 0;
- struct dynbuf b;
- char *ptr = NULL;
- unsigned char *buf = (unsigned char *)data->state.buffer;
- Curl_dyn_init(&b, MAX_NTLM_WB_RESPONSE);
+ struct dynbuf b;
+ char *ptr = NULL;
+ unsigned char *buf = (unsigned char *)data->state.buffer;
+ Curl_dyn_init(&b, MAX_NTLM_WB_RESPONSE);
while(len_in > 0) {
- ssize_t written = swrite(ntlm->ntlm_auth_hlpr_socket, input, len_in);
+ ssize_t written = swrite(ntlm->ntlm_auth_hlpr_socket, input, len_in);
if(written == -1) {
/* Interrupted by a signal, retry it */
if(errno == EINTR)
@@ -281,8 +281,8 @@ static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
}
/* Read one line */
while(1) {
- ssize_t size =
- sread(ntlm->ntlm_auth_hlpr_socket, buf, data->set.buffer_size);
+ ssize_t size =
+ sread(ntlm->ntlm_auth_hlpr_socket, buf, data->set.buffer_size);
if(size == -1) {
if(errno == EINTR)
continue;
@@ -291,41 +291,41 @@ static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
else if(size == 0)
goto done;
- if(Curl_dyn_addn(&b, buf, size))
- goto done;
+ if(Curl_dyn_addn(&b, buf, size))
+ goto done;
- len_out = Curl_dyn_len(&b);
- ptr = Curl_dyn_ptr(&b);
- if(len_out && ptr[len_out - 1] == '\n') {
- ptr[len_out - 1] = '\0';
- break; /* done! */
+ len_out = Curl_dyn_len(&b);
+ ptr = Curl_dyn_ptr(&b);
+ if(len_out && ptr[len_out - 1] == '\n') {
+ ptr[len_out - 1] = '\0';
+ break; /* done! */
}
- /* loop */
+ /* loop */
}
/* Samba/winbind installed but not configured */
if(state == NTLMSTATE_TYPE1 &&
len_out == 3 &&
- ptr[0] == 'P' && ptr[1] == 'W')
+ ptr[0] == 'P' && ptr[1] == 'W')
goto done;
/* invalid response */
if(len_out < 4)
goto done;
if(state == NTLMSTATE_TYPE1 &&
- (ptr[0]!='Y' || ptr[1]!='R' || ptr[2]!=' '))
+ (ptr[0]!='Y' || ptr[1]!='R' || ptr[2]!=' '))
goto done;
if(state == NTLMSTATE_TYPE2 &&
- (ptr[0]!='K' || ptr[1]!='K' || ptr[2]!=' ') &&
- (ptr[0]!='A' || ptr[1]!='F' || ptr[2]!=' '))
+ (ptr[0]!='K' || ptr[1]!='K' || ptr[2]!=' ') &&
+ (ptr[0]!='A' || ptr[1]!='F' || ptr[2]!=' '))
goto done;
- ntlm->response = strdup(ptr + 3);
- Curl_dyn_free(&b);
- if(!ntlm->response)
+ ntlm->response = strdup(ptr + 3);
+ Curl_dyn_free(&b);
+ if(!ntlm->response)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
done:
- Curl_dyn_free(&b);
+ Curl_dyn_free(&b);
return CURLE_REMOTE_ACCESS_DENIED;
}
@@ -333,7 +333,7 @@ CURLcode Curl_input_ntlm_wb(struct connectdata *conn,
bool proxy,
const char *header)
{
- struct ntlmdata *ntlm = proxy ? &conn->proxyntlm : &conn->ntlm;
+ struct ntlmdata *ntlm = proxy ? &conn->proxyntlm : &conn->ntlm;
curlntlm *state = proxy ? &conn->proxy_ntlm_state : &conn->http_ntlm_state;
if(!checkprefix("NTLM", header))
@@ -344,8 +344,8 @@ CURLcode Curl_input_ntlm_wb(struct connectdata *conn,
header++;
if(*header) {
- ntlm->challenge = strdup(header);
- if(!ntlm->challenge)
+ ntlm->challenge = strdup(header);
+ if(!ntlm->challenge)
return CURLE_OUT_OF_MEMORY;
*state = NTLMSTATE_TYPE2; /* We got a type-2 message */
@@ -376,17 +376,17 @@ CURLcode Curl_input_ntlm_wb(struct connectdata *conn,
* This is for creating ntlm header output by delegating challenge/response
* to Samba's winbind daemon helper ntlm_auth.
*/
-CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy)
+CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy)
{
/* point to the address of the pointer that holds the string to send to the
server, which is for a plain host or for a HTTP proxy */
char **allocuserpwd;
/* point to the name and password for this */
const char *userp;
- struct ntlmdata *ntlm;
+ struct ntlmdata *ntlm;
curlntlm *state;
struct auth *authp;
- struct Curl_easy *data = conn->data;
+ struct Curl_easy *data = conn->data;
CURLcode res = CURLE_OK;
@@ -394,20 +394,20 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy)
DEBUGASSERT(conn->data);
if(proxy) {
-#ifndef CURL_DISABLE_PROXY
- allocuserpwd = &data->state.aptr.proxyuserpwd;
+#ifndef CURL_DISABLE_PROXY
+ allocuserpwd = &data->state.aptr.proxyuserpwd;
userp = conn->http_proxy.user;
- ntlm = &conn->proxyntlm;
+ ntlm = &conn->proxyntlm;
state = &conn->proxy_ntlm_state;
authp = &conn->data->state.authproxy;
-#else
- return CURLE_NOT_BUILT_IN;
-#endif
+#else
+ return CURLE_NOT_BUILT_IN;
+#endif
}
else {
- allocuserpwd = &data->state.aptr.userpwd;
+ allocuserpwd = &data->state.aptr.userpwd;
userp = conn->user;
- ntlm = &conn->ntlm;
+ ntlm = &conn->ntlm;
state = &conn->http_ntlm_state;
authp = &conn->data->state.authhost;
}
@@ -433,36 +433,36 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy)
* request handling process.
*/
/* Create communication with ntlm_auth */
- res = ntlm_wb_init(conn->data, ntlm, userp);
+ res = ntlm_wb_init(conn->data, ntlm, userp);
if(res)
return res;
- res = ntlm_wb_response(conn->data, ntlm, "YR\n", *state);
+ res = ntlm_wb_response(conn->data, ntlm, "YR\n", *state);
if(res)
return res;
free(*allocuserpwd);
- *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
+ *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
proxy ? "Proxy-" : "",
- ntlm->response);
+ ntlm->response);
DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd));
- Curl_safefree(ntlm->response);
+ Curl_safefree(ntlm->response);
if(!*allocuserpwd)
return CURLE_OUT_OF_MEMORY;
break;
- case NTLMSTATE_TYPE2: {
- char *input = aprintf("TT %s\n", ntlm->challenge);
+ case NTLMSTATE_TYPE2: {
+ char *input = aprintf("TT %s\n", ntlm->challenge);
if(!input)
return CURLE_OUT_OF_MEMORY;
- res = ntlm_wb_response(conn->data, ntlm, input, *state);
+ res = ntlm_wb_response(conn->data, ntlm, input, *state);
free(input);
if(res)
return res;
free(*allocuserpwd);
- *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
+ *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
proxy ? "Proxy-" : "",
- ntlm->response);
+ ntlm->response);
DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd));
*state = NTLMSTATE_TYPE3; /* we sent a type-3 */
authp->done = TRUE;
@@ -470,7 +470,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy)
if(!*allocuserpwd)
return CURLE_OUT_OF_MEMORY;
break;
- }
+ }
case NTLMSTATE_TYPE3:
/* connection is already authenticated,
* don't send a header in future requests */
@@ -485,10 +485,10 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy)
return CURLE_OK;
}
-void Curl_http_auth_cleanup_ntlm_wb(struct connectdata *conn)
-{
- ntlm_wb_cleanup(&conn->ntlm);
- ntlm_wb_cleanup(&conn->proxyntlm);
-}
-
+void Curl_http_auth_cleanup_ntlm_wb(struct connectdata *conn)
+{
+ ntlm_wb_cleanup(&conn->ntlm);
+ ntlm_wb_cleanup(&conn->proxyntlm);
+}
+
#endif /* !CURL_DISABLE_HTTP && USE_NTLM && NTLM_WB_ENABLED */
diff --git a/contrib/libs/curl/lib/curl_ntlm_wb.h b/contrib/libs/curl/lib/curl_ntlm_wb.h
index 1bf99088fd..4f847d22ca 100644
--- a/contrib/libs/curl/lib/curl_ntlm_wb.h
+++ b/contrib/libs/curl/lib/curl_ntlm_wb.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_path.c b/contrib/libs/curl/lib/curl_path.c
index 098b471a33..8c8cbc2468 100644
--- a/contrib/libs/curl/lib/curl_path.c
+++ b/contrib/libs/curl/lib/curl_path.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -42,7 +42,7 @@ CURLcode Curl_getworkingpath(struct connectdata *conn,
size_t working_path_len;
CURLcode result =
Curl_urldecode(data, data->state.up.path, 0, &working_path,
- &working_path_len, REJECT_ZERO);
+ &working_path_len, REJECT_ZERO);
if(result)
return result;
@@ -168,7 +168,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
*cpp = cp + i + strspn(cp + i, WHITESPACE);
}
else {
- /* Read to end of filename - either to whitespace or terminator */
+ /* Read to end of filename - either to whitespace or terminator */
end = strpbrk(cp, WHITESPACE);
if(end == NULL)
end = strchr(cp, '\0');
@@ -184,7 +184,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
(*path)[pathLength] = '\0';
cp += 3;
}
- /* Copy path name up until first "whitespace" */
+ /* Copy path name up until first "whitespace" */
memcpy(&(*path)[pathLength], cp, (int)(end - cp));
pathLength += (int)(end - cp);
(*path)[pathLength] = '\0';
diff --git a/contrib/libs/curl/lib/curl_path.h b/contrib/libs/curl/lib/curl_path.h
index fcb8b6abe6..b601b48dfc 100644
--- a/contrib/libs/curl/lib/curl_path.h
+++ b/contrib/libs/curl/lib/curl_path.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_printf.h b/contrib/libs/curl/lib/curl_printf.h
index a398bd6e3f..9fa625f108 100644
--- a/contrib/libs/curl/lib/curl_printf.h
+++ b/contrib/libs/curl/lib/curl_printf.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_range.c b/contrib/libs/curl/lib/curl_range.c
index 075830bf8f..0a87b1ca52 100644
--- a/contrib/libs/curl/lib/curl_range.c
+++ b/contrib/libs/curl/lib/curl_range.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_range.h b/contrib/libs/curl/lib/curl_range.h
index 8b938a11c3..d1f2c6d55f 100644
--- a/contrib/libs/curl/lib/curl_range.h
+++ b/contrib/libs/curl/lib/curl_range.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_rtmp.c b/contrib/libs/curl/lib/curl_rtmp.c
index f7d9ad0387..ba471a2a19 100644
--- a/contrib/libs/curl/lib/curl_rtmp.c
+++ b/contrib/libs/curl/lib/curl_rtmp.c
@@ -5,12 +5,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2010, Howard Chu, <hyc@highlandsun.com>
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -79,7 +79,7 @@ const struct Curl_handler Curl_handler_rtmp = {
ZERO_NULL, /* connection_check */
PORT_RTMP, /* defport */
CURLPROTO_RTMP, /* protocol */
- CURLPROTO_RTMP, /* family */
+ CURLPROTO_RTMP, /* family */
PROTOPT_NONE /* flags*/
};
@@ -101,7 +101,7 @@ const struct Curl_handler Curl_handler_rtmpt = {
ZERO_NULL, /* connection_check */
PORT_RTMPT, /* defport */
CURLPROTO_RTMPT, /* protocol */
- CURLPROTO_RTMPT, /* family */
+ CURLPROTO_RTMPT, /* family */
PROTOPT_NONE /* flags*/
};
@@ -123,7 +123,7 @@ const struct Curl_handler Curl_handler_rtmpe = {
ZERO_NULL, /* connection_check */
PORT_RTMP, /* defport */
CURLPROTO_RTMPE, /* protocol */
- CURLPROTO_RTMPE, /* family */
+ CURLPROTO_RTMPE, /* family */
PROTOPT_NONE /* flags*/
};
@@ -145,7 +145,7 @@ const struct Curl_handler Curl_handler_rtmpte = {
ZERO_NULL, /* connection_check */
PORT_RTMPT, /* defport */
CURLPROTO_RTMPTE, /* protocol */
- CURLPROTO_RTMPTE, /* family */
+ CURLPROTO_RTMPTE, /* family */
PROTOPT_NONE /* flags*/
};
@@ -167,7 +167,7 @@ const struct Curl_handler Curl_handler_rtmps = {
ZERO_NULL, /* connection_check */
PORT_RTMPS, /* defport */
CURLPROTO_RTMPS, /* protocol */
- CURLPROTO_RTMP, /* family */
+ CURLPROTO_RTMP, /* family */
PROTOPT_NONE /* flags*/
};
@@ -189,7 +189,7 @@ const struct Curl_handler Curl_handler_rtmpts = {
ZERO_NULL, /* connection_check */
PORT_RTMPS, /* defport */
CURLPROTO_RTMPTS, /* protocol */
- CURLPROTO_RTMPT, /* family */
+ CURLPROTO_RTMPT, /* family */
PROTOPT_NONE /* flags*/
};
diff --git a/contrib/libs/curl/lib/curl_rtmp.h b/contrib/libs/curl/lib/curl_rtmp.h
index 4c70fd1872..f45fa71d12 100644
--- a/contrib/libs/curl/lib/curl_rtmp.h
+++ b/contrib/libs/curl/lib/curl_rtmp.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2010 - 2020, Howard Chu, <hyc@highlandsun.com>
+ * Copyright (C) 2010 - 2020, Howard Chu, <hyc@highlandsun.com>
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_sasl.c b/contrib/libs/curl/lib/curl_sasl.c
index 3be2d901bd..94b17a1d86 100644
--- a/contrib/libs/curl/lib/curl_sasl.c
+++ b/contrib/libs/curl/lib/curl_sasl.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -264,20 +264,20 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
size_t len = 0;
saslstate state1 = SASL_STOP;
saslstate state2 = SASL_FINAL;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
-#else
- const char * const hostname = conn->host.name;
- const long int port = conn->remote_port;
-#endif
+#else
+ const char * const hostname = conn->host.name;
+ const long int port = conn->remote_port;
+#endif
#if defined(USE_KERBEROS5) || defined(USE_NTLM)
const char *service = data->set.str[STRING_SERVICE_NAME] ?
data->set.str[STRING_SERVICE_NAME] :
sasl->params->service;
#endif
- const char *oauth_bearer = data->set.str[STRING_BEARER];
+ const char *oauth_bearer = data->set.str[STRING_BEARER];
sasl->force_ir = force_ir; /* Latch for future use */
sasl->authused = 0; /* No mechanism used yet */
@@ -347,7 +347,7 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
}
else
#endif
- if((enabledmechs & SASL_MECH_OAUTHBEARER) && oauth_bearer) {
+ if((enabledmechs & SASL_MECH_OAUTHBEARER) && oauth_bearer) {
mech = SASL_MECH_STRING_OAUTHBEARER;
state1 = SASL_OAUTH2;
state2 = SASL_OAUTH2_RESP;
@@ -357,17 +357,17 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
result = Curl_auth_create_oauth_bearer_message(data, conn->user,
hostname,
port,
- oauth_bearer,
+ oauth_bearer,
&resp, &len);
}
- else if((enabledmechs & SASL_MECH_XOAUTH2) && oauth_bearer) {
+ else if((enabledmechs & SASL_MECH_XOAUTH2) && oauth_bearer) {
mech = SASL_MECH_STRING_XOAUTH2;
state1 = SASL_OAUTH2;
sasl->authused = SASL_MECH_XOAUTH2;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_xoauth_bearer_message(data, conn->user,
- oauth_bearer,
+ oauth_bearer,
&resp, &len);
}
else if(enabledmechs & SASL_MECH_PLAIN) {
@@ -422,27 +422,27 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
struct Curl_easy *data = conn->data;
saslstate newstate = SASL_FINAL;
char *resp = NULL;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
-#else
- const char * const hostname = conn->host.name;
- const long int port = conn->remote_port;
-#endif
+#else
+ const char * const hostname = conn->host.name;
+ const long int port = conn->remote_port;
+#endif
#if !defined(CURL_DISABLE_CRYPTO_AUTH)
char *chlg = NULL;
size_t chlglen = 0;
#endif
-#if !defined(CURL_DISABLE_CRYPTO_AUTH) || defined(USE_KERBEROS5) || \
- defined(USE_NTLM)
+#if !defined(CURL_DISABLE_CRYPTO_AUTH) || defined(USE_KERBEROS5) || \
+ defined(USE_NTLM)
const char *service = data->set.str[STRING_SERVICE_NAME] ?
- data->set.str[STRING_SERVICE_NAME] :
- sasl->params->service;
+ data->set.str[STRING_SERVICE_NAME] :
+ sasl->params->service;
char *serverdata;
#endif
size_t len = 0;
- const char *oauth_bearer = data->set.str[STRING_BEARER];
+ const char *oauth_bearer = data->set.str[STRING_BEARER];
*progress = SASL_INPROGRESS;
@@ -570,7 +570,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
result = Curl_auth_create_oauth_bearer_message(data, conn->user,
hostname,
port,
- oauth_bearer,
+ oauth_bearer,
&resp, &len);
/* Failures maybe sent by the server as continuations for OAUTHBEARER */
@@ -578,7 +578,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
}
else
result = Curl_auth_create_xoauth_bearer_message(data, conn->user,
- oauth_bearer,
+ oauth_bearer,
&resp, &len);
break;
diff --git a/contrib/libs/curl/lib/curl_sasl.h b/contrib/libs/curl/lib/curl_sasl.h
index 4b6bb7ae2c..ba40ec461a 100644
--- a/contrib/libs/curl/lib/curl_sasl.h
+++ b/contrib/libs/curl/lib/curl_sasl.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_setup.h b/contrib/libs/curl/lib/curl_setup.h
index 7cf94f56ac..83fabb0e01 100644
--- a/contrib/libs/curl/lib/curl_setup.h
+++ b/contrib/libs/curl/lib/curl_setup.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -27,18 +27,18 @@
#endif
/*
- * Disable Visual Studio warnings:
- * 4127 "conditional expression is constant"
- */
-#ifdef _MSC_VER
-#pragma warning(disable:4127)
-#endif
-
-/*
+ * Disable Visual Studio warnings:
+ * 4127 "conditional expression is constant"
+ */
+#ifdef _MSC_VER
+#pragma warning(disable:4127)
+#endif
+
+/*
* Define WIN32 when build target is Win32 API
*/
-#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
#define WIN32
#endif
@@ -226,20 +226,20 @@
#endif
/*
- * Windows setup file includes some system headers.
+ * Windows setup file includes some system headers.
*/
#ifdef HAVE_WINDOWS_H
-# include "setup-win32.h"
+# include "setup-win32.h"
#endif
/*
- * Use getaddrinfo to resolve the IPv4 address literal. If the current network
- * interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64,
- * performing this task will result in a synthesized IPv6 address.
+ * Use getaddrinfo to resolve the IPv4 address literal. If the current network
+ * interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64,
+ * performing this task will result in a synthesized IPv6 address.
*/
-#if defined(__APPLE__) && !defined(USE_ARES)
-#define USE_RESOLVE_ON_IPS 1
+#if defined(__APPLE__) && !defined(USE_ARES)
+#define USE_RESOLVE_ON_IPS 1
#endif
#ifdef USE_LWIPSOCK
@@ -277,16 +277,16 @@
# include <exec/execbase.h>
# include <proto/exec.h>
# include <proto/dos.h>
-# include <unistd.h>
+# include <unistd.h>
# ifdef HAVE_PROTO_BSDSOCKET_H
# error #include <proto/bsdsocket.h> /* ensure bsdsocket.library use */
# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
# endif
-/*
- * In clib2 arpa/inet.h warns that some prototypes may clash
- * with bsdsocket.library. This avoids the definition of those.
- */
-# define __NO_NET_API
+/*
+ * In clib2 arpa/inet.h warns that some prototypes may clash
+ * with bsdsocket.library. This avoids the definition of those.
+ */
+# define __NO_NET_API
#endif
#include <stdio.h>
@@ -332,14 +332,14 @@
# undef fstat
# define fstat(fdes,stp) _fstati64(fdes, stp)
# undef stat
-# define stat(fname,stp) curlx_win32_stat(fname, stp)
+# define stat(fname,stp) curlx_win32_stat(fname, stp)
# define struct_stat struct _stati64
# define LSEEK_ERROR (__int64)-1
-# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
-# define access(fname,mode) curlx_win32_access(fname, mode)
- int curlx_win32_stat(const char *path, struct_stat *buffer);
- FILE *curlx_win32_fopen(const char *filename, const char *mode);
- int curlx_win32_access(const char *path, int mode);
+# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
+# define access(fname,mode) curlx_win32_access(fname, mode)
+ int curlx_win32_stat(const char *path, struct_stat *buffer);
+ FILE *curlx_win32_fopen(const char *filename, const char *mode);
+ int curlx_win32_access(const char *path, int mode);
#endif
/*
@@ -354,13 +354,13 @@
# undef lseek
# define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
# define fstat(fdes,stp) _fstat(fdes, stp)
-# define stat(fname,stp) curlx_win32_stat(fname, stp)
+# define stat(fname,stp) curlx_win32_stat(fname, stp)
# define struct_stat struct _stat
-# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
-# define access(fname,mode) curlx_win32_access(fname, mode)
- int curlx_win32_stat(const char *path, struct_stat *buffer);
- FILE *curlx_win32_fopen(const char *filename, const char *mode);
- int curlx_win32_access(const char *path, int mode);
+# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
+# define access(fname,mode) curlx_win32_access(fname, mode)
+ int curlx_win32_stat(const char *path, struct_stat *buffer);
+ FILE *curlx_win32_fopen(const char *filename, const char *mode);
+ int curlx_win32_access(const char *path, int mode);
# endif
# define LSEEK_ERROR (long)-1
#endif
@@ -538,12 +538,12 @@
* Mutually exclusive CURLRES_* definitions.
*/
-#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
-# define CURLRES_IPV6
-#else
-# define CURLRES_IPV4
-#endif
-
+#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
+# define CURLRES_IPV6
+#else
+# define CURLRES_IPV4
+#endif
+
#ifdef USE_ARES
# define CURLRES_ASYNCH
# define CURLRES_ARES
@@ -611,8 +611,8 @@ int netware_init(void);
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_NSS) || \
defined(USE_MBEDTLS) || \
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \
- defined(USE_SECTRANSP) || defined(USE_GSKIT) || defined(USE_MESALINK) || \
- defined(USE_BEARSSL)
+ defined(USE_SECTRANSP) || defined(USE_GSKIT) || defined(USE_MESALINK) || \
+ defined(USE_BEARSSL)
#define USE_SSL /* SSL support has been enabled */
#endif
@@ -630,12 +630,12 @@ int netware_init(void);
/* Single point where USE_NTLM definition might be defined */
#if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
-#if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
- defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_SECTRANSP) || \
- defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
- (defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))
+#if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
+ defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_SECTRANSP) || \
+ defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
+ (defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))
-#define USE_CURL_NTLM_CORE
+#define USE_CURL_NTLM_CORE
# if defined(USE_MBEDTLS)
/* Get definition of MBEDTLS_MD4_C */
@@ -643,11 +643,11 @@ int netware_init(void);
# endif
#endif
-
-#if defined(USE_CURL_NTLM_CORE) || defined(USE_WINDOWS_SSPI)
-#define USE_NTLM
+
+#if defined(USE_CURL_NTLM_CORE) || defined(USE_WINDOWS_SSPI)
+#define USE_NTLM
+#endif
#endif
-#endif
#ifdef CURL_WANTS_CA_BUNDLE_ENV
#error "No longer supported. Set CURLOPT_CAINFO at runtime instead."
@@ -685,7 +685,7 @@ int netware_init(void);
*/
#ifndef Curl_nop_stmt
-# define Curl_nop_stmt do { } while(0)
+# define Curl_nop_stmt do { } while(0)
#endif
/*
@@ -698,7 +698,7 @@ int netware_init(void);
defined(HAVE_WINSOCK_H) || \
defined(HAVE_WINSOCK2_H) || \
defined(HAVE_WS2TCPIP_H)
-# error "WinSock and lwIP TCP/IP stack definitions shall not coexist!"
+# error "WinSock and lwIP TCP/IP stack definitions shall not coexist!"
# endif
#endif
diff --git a/contrib/libs/curl/lib/curl_setup_once.h b/contrib/libs/curl/lib/curl_setup_once.h
index a69d6d8c78..ef60bc7ae7 100644
--- a/contrib/libs/curl/lib/curl_setup_once.h
+++ b/contrib/libs/curl/lib/curl_setup_once.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -366,7 +366,7 @@ typedef int sig_atomic_t;
#ifdef DEBUGBUILD
#define DEBUGF(x) x
#else
-#define DEBUGF(x) do { } while(0)
+#define DEBUGF(x) do { } while(0)
#endif
@@ -374,11 +374,11 @@ typedef int sig_atomic_t;
* Macro used to include assertion code only in debug builds.
*/
-#undef DEBUGASSERT
+#undef DEBUGASSERT
#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H)
#define DEBUGASSERT(x) assert(x)
#else
-#define DEBUGASSERT(x) do { } while(0)
+#define DEBUGASSERT(x) do { } while(0)
#endif
@@ -481,8 +481,8 @@ typedef int sig_atomic_t;
#ifdef __VMS
#define argv_item_t __char_ptr32
-#elif defined(_UNICODE)
-#define argv_item_t wchar_t *
+#elif defined(_UNICODE)
+#define argv_item_t wchar_t *
#else
#define argv_item_t char *
#endif
diff --git a/contrib/libs/curl/lib/curl_sha256.h b/contrib/libs/curl/lib/curl_sha256.h
index 103fae33b8..0fceb6329a 100644
--- a/contrib/libs/curl/lib/curl_sha256.h
+++ b/contrib/libs/curl/lib/curl_sha256.h
@@ -7,12 +7,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -25,11 +25,11 @@
#ifndef CURL_DISABLE_CRYPTO_AUTH
-#define SHA256_DIGEST_LENGTH 32
+#define SHA256_DIGEST_LENGTH 32
+
+void Curl_sha256it(unsigned char *outbuffer, const unsigned char *input,
+ const size_t len);
-void Curl_sha256it(unsigned char *outbuffer, const unsigned char *input,
- const size_t len);
-
#endif
#endif /* HEADER_CURL_SHA256_H */
diff --git a/contrib/libs/curl/lib/curl_sspi.c b/contrib/libs/curl/lib/curl_sspi.c
index 0409c32c11..06841ddec6 100644
--- a/contrib/libs/curl/lib/curl_sspi.c
+++ b/contrib/libs/curl/lib/curl_sspi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -28,7 +28,7 @@
#include "curl_sspi.h"
#include "curl_multibyte.h"
#include "system_win32.h"
-#include "version_win32.h"
+#include "version_win32.h"
#include "warnless.h"
/* The last #include files should be: */
@@ -83,7 +83,7 @@ CURLcode Curl_sspi_global_init(void)
* have both these DLLs (security.dll forwards calls to secur32.dll) */
/* Load SSPI dll into the address space of the calling process */
- if(curlx_verify_windows_version(4, 0, PLATFORM_WINNT, VERSION_EQUAL))
+ if(curlx_verify_windows_version(4, 0, PLATFORM_WINNT, VERSION_EQUAL))
s_hSecDll = Curl_load_library(TEXT("security.dll"));
else
s_hSecDll = Curl_load_library(TEXT("secur32.dll"));
@@ -152,7 +152,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
/* Initialize the identity */
memset(identity, 0, sizeof(*identity));
- useranddomain.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)userp);
+ useranddomain.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)userp);
if(!useranddomain.tchar_ptr)
return CURLE_OUT_OF_MEMORY;
@@ -174,7 +174,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
/* Setup the identity's user and length */
dup_user.tchar_ptr = _tcsdup(user.tchar_ptr);
if(!dup_user.tchar_ptr) {
- curlx_unicodefree(useranddomain.tchar_ptr);
+ curlx_unicodefree(useranddomain.tchar_ptr);
return CURLE_OUT_OF_MEMORY;
}
identity->User = dup_user.tbyte_ptr;
@@ -184,7 +184,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
/* Setup the identity's domain and length */
dup_domain.tchar_ptr = malloc(sizeof(TCHAR) * (domlen + 1));
if(!dup_domain.tchar_ptr) {
- curlx_unicodefree(useranddomain.tchar_ptr);
+ curlx_unicodefree(useranddomain.tchar_ptr);
return CURLE_OUT_OF_MEMORY;
}
_tcsncpy(dup_domain.tchar_ptr, domain.tchar_ptr, domlen);
@@ -193,22 +193,22 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
identity->DomainLength = curlx_uztoul(domlen);
dup_domain.tchar_ptr = NULL;
- curlx_unicodefree(useranddomain.tchar_ptr);
+ curlx_unicodefree(useranddomain.tchar_ptr);
/* Setup the identity's password and length */
- passwd.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)passwdp);
+ passwd.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)passwdp);
if(!passwd.tchar_ptr)
return CURLE_OUT_OF_MEMORY;
dup_passwd.tchar_ptr = _tcsdup(passwd.tchar_ptr);
if(!dup_passwd.tchar_ptr) {
- curlx_unicodefree(passwd.tchar_ptr);
+ curlx_unicodefree(passwd.tchar_ptr);
return CURLE_OUT_OF_MEMORY;
}
identity->Password = dup_passwd.tbyte_ptr;
identity->PasswordLength = curlx_uztoul(_tcslen(dup_passwd.tchar_ptr));
dup_passwd.tchar_ptr = NULL;
- curlx_unicodefree(passwd.tchar_ptr);
+ curlx_unicodefree(passwd.tchar_ptr);
/* Setup the identity's flags */
identity->Flags = SECFLAG_WINNT_AUTH_IDENTITY;
diff --git a/contrib/libs/curl/lib/curl_sspi.h b/contrib/libs/curl/lib/curl_sspi.h
index 9a928c4217..881384d4e4 100644
--- a/contrib/libs/curl/lib/curl_sspi.h
+++ b/contrib/libs/curl/lib/curl_sspi.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curl_threads.c b/contrib/libs/curl/lib/curl_threads.c
index 021d2dda04..414614401d 100644
--- a/contrib/libs/curl/lib/curl_threads.c
+++ b/contrib/libs/curl/lib/curl_threads.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -41,14 +41,14 @@
#if defined(USE_THREADS_POSIX)
-struct Curl_actual_call {
+struct Curl_actual_call {
unsigned int (*func)(void *);
void *arg;
};
static void *curl_thread_create_thunk(void *arg)
{
- struct Curl_actual_call *ac = arg;
+ struct Curl_actual_call *ac = arg;
unsigned int (*func)(void *) = ac->func;
void *real_arg = ac->arg;
@@ -62,7 +62,7 @@ static void *curl_thread_create_thunk(void *arg)
curl_thread_t Curl_thread_create(unsigned int (*func) (void *), void *arg)
{
curl_thread_t t = malloc(sizeof(pthread_t));
- struct Curl_actual_call *ac = malloc(sizeof(struct Curl_actual_call));
+ struct Curl_actual_call *ac = malloc(sizeof(struct Curl_actual_call));
if(!(ac && t))
goto err;
diff --git a/contrib/libs/curl/lib/curl_threads.h b/contrib/libs/curl/lib/curl_threads.h
index bd28b3c650..55fc0ac559 100644
--- a/contrib/libs/curl/lib/curl_threads.h
+++ b/contrib/libs/curl/lib/curl_threads.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/curlx.h b/contrib/libs/curl/lib/curlx.h
index 4ade9f2fb5..9f21f60d5f 100644
--- a/contrib/libs/curl/lib/curlx.h
+++ b/contrib/libs/curl/lib/curlx.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -53,19 +53,19 @@
curlx_uztosi()
*/
-#include "curl_multibyte.h"
-/* "curl_multibyte.h" provides these functions and macros:
-
- curlx_convert_UTF8_to_wchar()
- curlx_convert_wchar_to_UTF8()
- curlx_convert_UTF8_to_tchar()
- curlx_convert_tchar_to_UTF8()
- curlx_unicodefree()
-*/
-
-#include "version_win32.h"
-/* "version_win32.h" provides curlx_verify_windows_version() */
-
+#include "curl_multibyte.h"
+/* "curl_multibyte.h" provides these functions and macros:
+
+ curlx_convert_UTF8_to_wchar()
+ curlx_convert_wchar_to_UTF8()
+ curlx_convert_UTF8_to_tchar()
+ curlx_convert_tchar_to_UTF8()
+ curlx_unicodefree()
+*/
+
+#include "version_win32.h"
+/* "version_win32.h" provides curlx_verify_windows_version() */
+
/* Now setup curlx_ * names for the functions that are to become curlx_ and
be removed from a future libcurl official API:
curlx_getenv
diff --git a/contrib/libs/curl/lib/dict.c b/contrib/libs/curl/lib/dict.c
index cc033be0cf..15d3954aa3 100644
--- a/contrib/libs/curl/lib/dict.c
+++ b/contrib/libs/curl/lib/dict.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -46,8 +46,8 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
-#elif defined(HAVE_UNISTD_H)
-#include <unistd.h>
+#elif defined(HAVE_UNISTD_H)
+#include <unistd.h>
#endif
#include "urldata.h"
@@ -57,7 +57,7 @@
#include "escape.h"
#include "progress.h"
#include "dict.h"
-#include "curl_printf.h"
+#include "curl_printf.h"
#include "strcase.h"
#include "curl_memory.h"
/* The last #include file should be: */
@@ -91,8 +91,8 @@ const struct Curl_handler Curl_handler_dict = {
ZERO_NULL, /* connection_check */
PORT_DICT, /* defport */
CURLPROTO_DICT, /* protocol */
- CURLPROTO_DICT, /* family */
- PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */
+ CURLPROTO_DICT, /* family */
+ PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */
};
static char *unescape_word(struct Curl_easy *data, const char *inputbuff)
@@ -101,8 +101,8 @@ static char *unescape_word(struct Curl_easy *data, const char *inputbuff)
char *dictp;
size_t len;
- CURLcode result = Curl_urldecode(data, inputbuff, 0, &newp, &len,
- REJECT_NADA);
+ CURLcode result = Curl_urldecode(data, inputbuff, 0, &newp, &len,
+ REJECT_NADA);
if(!newp || result)
return NULL;
@@ -128,51 +128,51 @@ static char *unescape_word(struct Curl_easy *data, const char *inputbuff)
return dictp;
}
-/* sendf() sends formatted data to the server */
-static CURLcode sendf(curl_socket_t sockfd, struct connectdata *conn,
- const char *fmt, ...)
-{
- struct Curl_easy *data = conn->data;
- ssize_t bytes_written;
- size_t write_len;
- CURLcode result = CURLE_OK;
- char *s;
- char *sptr;
- va_list ap;
- va_start(ap, fmt);
- s = vaprintf(fmt, ap); /* returns an allocated string */
- va_end(ap);
- if(!s)
- return CURLE_OUT_OF_MEMORY; /* failure */
-
- bytes_written = 0;
- write_len = strlen(s);
- sptr = s;
-
- for(;;) {
- /* Write the buffer to the socket */
- result = Curl_write(conn, sockfd, sptr, write_len, &bytes_written);
-
- if(result)
- break;
-
- Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written);
-
- if((size_t)bytes_written != write_len) {
- /* if not all was written at once, we must advance the pointer, decrease
- the size left and try again! */
- write_len -= bytes_written;
- sptr += bytes_written;
- }
- else
- break;
- }
-
- free(s); /* free the output string */
-
- return result;
-}
-
+/* sendf() sends formatted data to the server */
+static CURLcode sendf(curl_socket_t sockfd, struct connectdata *conn,
+ const char *fmt, ...)
+{
+ struct Curl_easy *data = conn->data;
+ ssize_t bytes_written;
+ size_t write_len;
+ CURLcode result = CURLE_OK;
+ char *s;
+ char *sptr;
+ va_list ap;
+ va_start(ap, fmt);
+ s = vaprintf(fmt, ap); /* returns an allocated string */
+ va_end(ap);
+ if(!s)
+ return CURLE_OUT_OF_MEMORY; /* failure */
+
+ bytes_written = 0;
+ write_len = strlen(s);
+ sptr = s;
+
+ for(;;) {
+ /* Write the buffer to the socket */
+ result = Curl_write(conn, sockfd, sptr, write_len, &bytes_written);
+
+ if(result)
+ break;
+
+ Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written);
+
+ if((size_t)bytes_written != write_len) {
+ /* if not all was written at once, we must advance the pointer, decrease
+ the size left and try again! */
+ write_len -= bytes_written;
+ sptr += bytes_written;
+ }
+ else
+ break;
+ }
+
+ free(s); /* free the output string */
+
+ return result;
+}
+
static CURLcode dict_do(struct connectdata *conn, bool *done)
{
char *word;
@@ -230,16 +230,16 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
if(!eword)
return CURLE_OUT_OF_MEMORY;
- result = sendf(sockfd, conn,
- "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
- "MATCH "
- "%s " /* database */
- "%s " /* strategy */
- "%s\r\n" /* word */
- "QUIT\r\n",
- database,
- strategy,
- eword);
+ result = sendf(sockfd, conn,
+ "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
+ "MATCH "
+ "%s " /* database */
+ "%s " /* strategy */
+ "%s\r\n" /* word */
+ "QUIT\r\n",
+ database,
+ strategy,
+ eword);
free(eword);
@@ -278,14 +278,14 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
if(!eword)
return CURLE_OUT_OF_MEMORY;
- result = sendf(sockfd, conn,
- "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
- "DEFINE "
- "%s " /* database */
- "%s\r\n" /* word */
- "QUIT\r\n",
- database,
- eword);
+ result = sendf(sockfd, conn,
+ "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
+ "DEFINE "
+ "%s " /* database */
+ "%s\r\n" /* word */
+ "QUIT\r\n",
+ database,
+ eword);
free(eword);
@@ -306,10 +306,10 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
if(ppath[i] == ':')
ppath[i] = ' ';
}
- result = sendf(sockfd, conn,
- "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
- "%s\r\n"
- "QUIT\r\n", ppath);
+ result = sendf(sockfd, conn,
+ "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
+ "%s\r\n"
+ "QUIT\r\n", ppath);
if(result) {
failf(data, "Failed sending DICT request");
return result;
diff --git a/contrib/libs/curl/lib/dict.h b/contrib/libs/curl/lib/dict.h
index cef04bdf40..6a6c772d13 100644
--- a/contrib/libs/curl/lib/dict.h
+++ b/contrib/libs/curl/lib/dict.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/doh.c b/contrib/libs/curl/lib/doh.c
index 484c92258f..c2b76de53a 100644
--- a/contrib/libs/curl/lib/doh.c
+++ b/contrib/libs/curl/lib/doh.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -35,7 +35,7 @@
#include "curl_base64.h"
#include "connect.h"
#include "strdup.h"
-#include "dynbuf.h"
+#include "dynbuf.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -57,13 +57,13 @@ static const char * const errors[]={
"Unexpected TYPE",
"Unexpected CLASS",
"No content",
- "Bad ID",
- "Name too long"
+ "Bad ID",
+ "Name too long"
};
static const char *doh_strerror(DOHcode code)
{
- if((code >= DOH_OK) && (code <= DOH_DNS_NAME_TOO_LONG))
+ if((code >= DOH_OK) && (code <= DOH_DNS_NAME_TOO_LONG))
return errors[code];
return "bad error code";
}
@@ -75,50 +75,50 @@ static const char *doh_strerror(DOHcode code)
#define UNITTEST static
#endif
-/* @unittest 1655
- */
+/* @unittest 1655
+ */
UNITTEST DOHcode doh_encode(const char *host,
DNStype dnstype,
unsigned char *dnsp, /* buffer */
size_t len, /* buffer size */
size_t *olen) /* output length */
{
- const size_t hostlen = strlen(host);
+ const size_t hostlen = strlen(host);
unsigned char *orig = dnsp;
const char *hostp = host;
- /* The expected output length is 16 bytes more than the length of
- * the QNAME-encoding of the host name.
- *
- * A valid DNS name may not contain a zero-length label, except at
- * the end. For this reason, a name beginning with a dot, or
- * containing a sequence of two or more consecutive dots, is invalid
- * and cannot be encoded as a QNAME.
- *
- * If the host name ends with a trailing dot, the corresponding
- * QNAME-encoding is one byte longer than the host name. If (as is
- * also valid) the hostname is shortened by the omission of the
- * trailing dot, then its QNAME-encoding will be two bytes longer
- * than the host name.
- *
- * Each [ label, dot ] pair is encoded as [ length, label ],
- * preserving overall length. A final [ label ] without a dot is
- * also encoded as [ length, label ], increasing overall length
- * by one. The encoding is completed by appending a zero byte,
- * representing the zero-length root label, again increasing
- * the overall length by one.
- */
-
- size_t expected_len;
- DEBUGASSERT(hostlen);
- expected_len = 12 + 1 + hostlen + 4;
- if(host[hostlen-1]!='.')
- expected_len++;
-
- if(expected_len > (256 + 16)) /* RFCs 1034, 1035 */
- return DOH_DNS_NAME_TOO_LONG;
-
- if(len < expected_len)
+ /* The expected output length is 16 bytes more than the length of
+ * the QNAME-encoding of the host name.
+ *
+ * A valid DNS name may not contain a zero-length label, except at
+ * the end. For this reason, a name beginning with a dot, or
+ * containing a sequence of two or more consecutive dots, is invalid
+ * and cannot be encoded as a QNAME.
+ *
+ * If the host name ends with a trailing dot, the corresponding
+ * QNAME-encoding is one byte longer than the host name. If (as is
+ * also valid) the hostname is shortened by the omission of the
+ * trailing dot, then its QNAME-encoding will be two bytes longer
+ * than the host name.
+ *
+ * Each [ label, dot ] pair is encoded as [ length, label ],
+ * preserving overall length. A final [ label ] without a dot is
+ * also encoded as [ length, label ], increasing overall length
+ * by one. The encoding is completed by appending a zero byte,
+ * representing the zero-length root label, again increasing
+ * the overall length by one.
+ */
+
+ size_t expected_len;
+ DEBUGASSERT(hostlen);
+ expected_len = 12 + 1 + hostlen + 4;
+ if(host[hostlen-1]!='.')
+ expected_len++;
+
+ if(expected_len > (256 + 16)) /* RFCs 1034, 1035 */
+ return DOH_DNS_NAME_TOO_LONG;
+
+ if(len < expected_len)
return DOH_TOO_SMALL_BUFFER;
*dnsp++ = 0; /* 16 bit id */
@@ -134,53 +134,53 @@ UNITTEST DOHcode doh_encode(const char *host,
*dnsp++ = '\0';
*dnsp++ = '\0'; /* ARCOUNT */
- /* encode each label and store it in the QNAME */
- while(*hostp) {
- size_t labellen;
+ /* encode each label and store it in the QNAME */
+ while(*hostp) {
+ size_t labellen;
char *dot = strchr(hostp, '.');
- if(dot)
+ if(dot)
labellen = dot - hostp;
else
labellen = strlen(hostp);
- if((labellen > 63) || (!labellen)) {
- /* label is too long or too short, error out */
+ if((labellen > 63) || (!labellen)) {
+ /* label is too long or too short, error out */
*olen = 0;
return DOH_DNS_BAD_LABEL;
}
- /* label is non-empty, process it */
+ /* label is non-empty, process it */
*dnsp++ = (unsigned char)labellen;
memcpy(dnsp, hostp, labellen);
dnsp += labellen;
- hostp += labellen;
- /* advance past dot, but only if there is one */
- if(dot)
- hostp++;
- } /* next label */
-
- *dnsp++ = 0; /* append zero-length label for root */
-
- /* There are assigned TYPE codes beyond 255: use range [1..65535] */
- *dnsp++ = (unsigned char)(255 & (dnstype>>8)); /* upper 8 bit TYPE */
- *dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */
-
+ hostp += labellen;
+ /* advance past dot, but only if there is one */
+ if(dot)
+ hostp++;
+ } /* next label */
+
+ *dnsp++ = 0; /* append zero-length label for root */
+
+ /* There are assigned TYPE codes beyond 255: use range [1..65535] */
+ *dnsp++ = (unsigned char)(255 & (dnstype>>8)); /* upper 8 bit TYPE */
+ *dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */
+
*dnsp++ = '\0'; /* upper 8 bit CLASS */
*dnsp++ = DNS_CLASS_IN; /* IN - "the Internet" */
*olen = dnsp - orig;
-
- /* verify that our estimation of length is valid, since
- * this has led to buffer overflows in this function */
- DEBUGASSERT(*olen == expected_len);
+
+ /* verify that our estimation of length is valid, since
+ * this has led to buffer overflows in this function */
+ DEBUGASSERT(*olen == expected_len);
return DOH_OK;
}
static size_t
-doh_write_cb(const void *contents, size_t size, size_t nmemb, void *userp)
+doh_write_cb(const void *contents, size_t size, size_t nmemb, void *userp)
{
size_t realsize = size * nmemb;
- struct dynbuf *mem = (struct dynbuf *)userp;
+ struct dynbuf *mem = (struct dynbuf *)userp;
- if(Curl_dyn_addn(mem, contents, realsize))
+ if(Curl_dyn_addn(mem, contents, realsize))
return 0;
return realsize;
@@ -210,7 +210,7 @@ do { \
result = curl_easy_setopt(doh, x, y); \
if(result) \
goto error; \
-} while(0)
+} while(0)
static CURLcode dohprobe(struct Curl_easy *data,
struct dnsprobe *p, DNStype dnstype,
@@ -230,7 +230,7 @@ static CURLcode dohprobe(struct Curl_easy *data,
}
p->dnstype = dnstype;
- Curl_dyn_init(&p->serverdoh, DYN_DOH_RESPONSE);
+ Curl_dyn_init(&p->serverdoh, DYN_DOH_RESPONSE);
/* Note: this is code for sending the DoH request with GET but there's still
no logic that actually enables this. We should either add that ability or
@@ -252,16 +252,16 @@ static CURLcode dohprobe(struct Curl_easy *data,
}
timeout_ms = Curl_timeleft(data, NULL, TRUE);
- if(timeout_ms <= 0) {
- result = CURLE_OPERATION_TIMEDOUT;
- goto error;
- }
+ if(timeout_ms <= 0) {
+ result = CURLE_OPERATION_TIMEDOUT;
+ goto error;
+ }
/* Curl_open() is the internal version of curl_easy_init() */
result = Curl_open(&doh);
if(!result) {
/* pass in the struct pointer via a local variable to please coverity and
the gcc typecheck helpers */
- struct dynbuf *resp = &p->serverdoh;
+ struct dynbuf *resp = &p->serverdoh;
ERROR_CHECK_SETOPT(CURLOPT_URL, url);
ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_write_cb);
ERROR_CHECK_SETOPT(CURLOPT_WRITEDATA, resp);
@@ -276,9 +276,9 @@ static CURLcode dohprobe(struct Curl_easy *data,
#ifndef CURLDEBUG
/* enforce HTTPS if not debug */
ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
-#else
- /* in debug mode, also allow http */
- ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
+#else
+ /* in debug mode, also allow http */
+ ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
#endif
ERROR_CHECK_SETOPT(CURLOPT_TIMEOUT_MS, (long)timeout_ms);
if(data->set.verbose)
@@ -292,29 +292,29 @@ static CURLcode dohprobe(struct Curl_easy *data,
ERROR_CHECK_SETOPT(CURLOPT_SSL_FALSESTART, 1L);
if(data->set.ssl.primary.verifyhost)
ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYHOST, 2L);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(data->set.proxy_ssl.primary.verifyhost)
ERROR_CHECK_SETOPT(CURLOPT_PROXY_SSL_VERIFYHOST, 2L);
- if(data->set.proxy_ssl.primary.verifypeer)
- ERROR_CHECK_SETOPT(CURLOPT_PROXY_SSL_VERIFYPEER, 1L);
- if(data->set.str[STRING_SSL_CAFILE_PROXY]) {
- ERROR_CHECK_SETOPT(CURLOPT_PROXY_CAINFO,
- data->set.str[STRING_SSL_CAFILE_PROXY]);
- }
- if(data->set.str[STRING_SSL_CRLFILE_PROXY]) {
- ERROR_CHECK_SETOPT(CURLOPT_PROXY_CRLFILE,
- data->set.str[STRING_SSL_CRLFILE_PROXY]);
- }
- if(data->set.proxy_ssl.no_revoke)
- ERROR_CHECK_SETOPT(CURLOPT_PROXY_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
- else if(data->set.proxy_ssl.revoke_best_effort)
- ERROR_CHECK_SETOPT(CURLOPT_PROXY_SSL_OPTIONS,
- CURLSSLOPT_REVOKE_BEST_EFFORT);
- if(data->set.str[STRING_SSL_CAPATH_PROXY]) {
- ERROR_CHECK_SETOPT(CURLOPT_PROXY_CAPATH,
- data->set.str[STRING_SSL_CAPATH_PROXY]);
- }
-#endif
+ if(data->set.proxy_ssl.primary.verifypeer)
+ ERROR_CHECK_SETOPT(CURLOPT_PROXY_SSL_VERIFYPEER, 1L);
+ if(data->set.str[STRING_SSL_CAFILE_PROXY]) {
+ ERROR_CHECK_SETOPT(CURLOPT_PROXY_CAINFO,
+ data->set.str[STRING_SSL_CAFILE_PROXY]);
+ }
+ if(data->set.str[STRING_SSL_CRLFILE_PROXY]) {
+ ERROR_CHECK_SETOPT(CURLOPT_PROXY_CRLFILE,
+ data->set.str[STRING_SSL_CRLFILE_PROXY]);
+ }
+ if(data->set.proxy_ssl.no_revoke)
+ ERROR_CHECK_SETOPT(CURLOPT_PROXY_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
+ else if(data->set.proxy_ssl.revoke_best_effort)
+ ERROR_CHECK_SETOPT(CURLOPT_PROXY_SSL_OPTIONS,
+ CURLSSLOPT_REVOKE_BEST_EFFORT);
+ if(data->set.str[STRING_SSL_CAPATH_PROXY]) {
+ ERROR_CHECK_SETOPT(CURLOPT_PROXY_CAPATH,
+ data->set.str[STRING_SSL_CAPATH_PROXY]);
+ }
+#endif
if(data->set.ssl.primary.verifypeer)
ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYPEER, 1L);
if(data->set.ssl.primary.verifystatus)
@@ -343,16 +343,16 @@ static CURLcode dohprobe(struct Curl_easy *data,
}
if(data->set.ssl.no_revoke)
ERROR_CHECK_SETOPT(CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
- else if(data->set.ssl.revoke_best_effort)
- ERROR_CHECK_SETOPT(CURLOPT_SSL_OPTIONS, CURLSSLOPT_REVOKE_BEST_EFFORT);
+ else if(data->set.ssl.revoke_best_effort)
+ ERROR_CHECK_SETOPT(CURLOPT_SSL_OPTIONS, CURLSSLOPT_REVOKE_BEST_EFFORT);
if(data->set.ssl.fsslctx)
ERROR_CHECK_SETOPT(CURLOPT_SSL_CTX_FUNCTION, data->set.ssl.fsslctx);
if(data->set.ssl.fsslctxp)
ERROR_CHECK_SETOPT(CURLOPT_SSL_CTX_DATA, data->set.ssl.fsslctxp);
- if(data->set.str[STRING_SSL_EC_CURVES]) {
- ERROR_CHECK_SETOPT(CURLOPT_SSL_EC_CURVES,
- data->set.str[STRING_SSL_EC_CURVES]);
- }
+ if(data->set.str[STRING_SSL_EC_CURVES]) {
+ ERROR_CHECK_SETOPT(CURLOPT_SSL_EC_CURVES,
+ data->set.str[STRING_SSL_EC_CURVES]);
+ }
doh->set.fmultidone = Curl_doh_done;
doh->set.dohfor = data; /* identify for which transfer this is done */
@@ -369,7 +369,7 @@ static CURLcode dohprobe(struct Curl_easy *data,
error:
free(nurl);
- Curl_close(&doh);
+ Curl_close(&doh);
return result;
}
@@ -378,14 +378,14 @@ static CURLcode dohprobe(struct Curl_easy *data,
* 'Curl_addrinfo *' with the address information.
*/
-struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp)
+struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
{
struct Curl_easy *data = conn->data;
CURLcode result = CURLE_OK;
- int slot;
+ int slot;
*waitp = TRUE; /* this never returns synchronously */
(void)conn;
(void)hostname;
@@ -394,7 +394,7 @@ struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
/* start clean, consider allocating this struct on demand */
memset(&data->req.doh, 0, sizeof(struct dohdata));
- conn->bits.doh = TRUE;
+ conn->bits.doh = TRUE;
data->req.doh.host = hostname;
data->req.doh.port = port;
data->req.doh.headers =
@@ -405,8 +405,8 @@ struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
if(conn->ip_version != CURL_IPRESOLVE_V6) {
/* create IPv4 DOH request */
- result = dohprobe(data, &data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V4],
- DNS_TYPE_A, hostname, data->set.str[STRING_DOH],
+ result = dohprobe(data, &data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V4],
+ DNS_TYPE_A, hostname, data->set.str[STRING_DOH],
data->multi, data->req.doh.headers);
if(result)
goto error;
@@ -415,8 +415,8 @@ struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
if(conn->ip_version != CURL_IPRESOLVE_V4) {
/* create IPv6 DOH request */
- result = dohprobe(data, &data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V6],
- DNS_TYPE_AAAA, hostname, data->set.str[STRING_DOH],
+ result = dohprobe(data, &data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V6],
+ DNS_TYPE_AAAA, hostname, data->set.str[STRING_DOH],
data->multi, data->req.doh.headers);
if(result)
goto error;
@@ -427,13 +427,13 @@ struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
error:
curl_slist_free_all(data->req.doh.headers);
data->req.doh.headers = NULL;
- for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
- Curl_close(&data->req.doh.probe[slot].easy);
- }
+ for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
+ Curl_close(&data->req.doh.probe[slot].easy);
+ }
return NULL;
}
-static DOHcode skipqname(const unsigned char *doh, size_t dohlen,
+static DOHcode skipqname(const unsigned char *doh, size_t dohlen,
unsigned int *indexp)
{
unsigned char length;
@@ -457,24 +457,24 @@ static DOHcode skipqname(const unsigned char *doh, size_t dohlen,
return DOH_OK;
}
-static unsigned short get16bit(const unsigned char *doh, int index)
+static unsigned short get16bit(const unsigned char *doh, int index)
{
return (unsigned short)((doh[index] << 8) | doh[index + 1]);
}
-static unsigned int get32bit(const unsigned char *doh, int index)
+static unsigned int get32bit(const unsigned char *doh, int index)
{
- /* make clang and gcc optimize this to bswap by incrementing
- the pointer first. */
- doh += index;
-
- /* avoid undefined behaviour by casting to unsigned before shifting
- 24 bits, possibly into the sign bit. codegen is same, but
- ub sanitizer won't be upset */
- return ( (unsigned)doh[0] << 24) | (doh[1] << 16) |(doh[2] << 8) | doh[3];
+ /* make clang and gcc optimize this to bswap by incrementing
+ the pointer first. */
+ doh += index;
+
+ /* avoid undefined behaviour by casting to unsigned before shifting
+ 24 bits, possibly into the sign bit. codegen is same, but
+ ub sanitizer won't be upset */
+ return ( (unsigned)doh[0] << 24) | (doh[1] << 16) |(doh[2] << 8) | doh[3];
}
-static DOHcode store_a(const unsigned char *doh, int index, struct dohentry *d)
+static DOHcode store_a(const unsigned char *doh, int index, struct dohentry *d)
{
/* silently ignore addresses over the limit */
if(d->numaddr < DOH_MAX_ADDR) {
@@ -486,9 +486,9 @@ static DOHcode store_a(const unsigned char *doh, int index, struct dohentry *d)
return DOH_OK;
}
-static DOHcode store_aaaa(const unsigned char *doh,
- int index,
- struct dohentry *d)
+static DOHcode store_aaaa(const unsigned char *doh,
+ int index,
+ struct dohentry *d)
{
/* silently ignore addresses over the limit */
if(d->numaddr < DOH_MAX_ADDR) {
@@ -500,12 +500,12 @@ static DOHcode store_aaaa(const unsigned char *doh,
return DOH_OK;
}
-static DOHcode store_cname(const unsigned char *doh,
+static DOHcode store_cname(const unsigned char *doh,
size_t dohlen,
unsigned int index,
struct dohentry *d)
{
- struct dynbuf *c;
+ struct dynbuf *c;
unsigned int loop = 128; /* a valid DNS name can never loop this much */
unsigned char length;
@@ -523,7 +523,7 @@ static DOHcode store_cname(const unsigned char *doh,
if((index + 1) >= dohlen)
return DOH_DNS_OUT_OF_RANGE;
- /* move to the new index */
+ /* move to the new index */
newpos = (length & 0x3f) << 8 | doh[index + 1];
index = newpos;
continue;
@@ -534,15 +534,15 @@ static DOHcode store_cname(const unsigned char *doh,
index++;
if(length) {
- if(Curl_dyn_len(c)) {
- if(Curl_dyn_add(c, "."))
- return DOH_OUT_OF_MEM;
+ if(Curl_dyn_len(c)) {
+ if(Curl_dyn_add(c, "."))
+ return DOH_OUT_OF_MEM;
}
if((index + length) > dohlen)
return DOH_DNS_BAD_LABEL;
- if(Curl_dyn_addn(c, &doh[index], length))
- return DOH_OUT_OF_MEM;
+ if(Curl_dyn_addn(c, &doh[index], length))
+ return DOH_OUT_OF_MEM;
index += length;
}
} while(length && --loop);
@@ -552,7 +552,7 @@ static DOHcode store_cname(const unsigned char *doh,
return DOH_OK;
}
-static DOHcode rdata(const unsigned char *doh,
+static DOHcode rdata(const unsigned char *doh,
size_t dohlen,
unsigned short rdlength,
unsigned short type,
@@ -585,9 +585,9 @@ static DOHcode rdata(const unsigned char *doh,
if(rc)
return rc;
break;
- case DNS_TYPE_DNAME:
- /* explicit for clarity; just skip; rely on synthesized CNAME */
- break;
+ case DNS_TYPE_DNAME:
+ /* explicit for clarity; just skip; rely on synthesized CNAME */
+ break;
default:
/* unsupported type, just skip it */
break;
@@ -595,17 +595,17 @@ static DOHcode rdata(const unsigned char *doh,
return DOH_OK;
}
-UNITTEST void de_init(struct dohentry *de)
+UNITTEST void de_init(struct dohentry *de)
{
- int i;
+ int i;
memset(de, 0, sizeof(*de));
de->ttl = INT_MAX;
- for(i = 0; i < DOH_MAX_CNAME; i++)
- Curl_dyn_init(&de->cname[i], DYN_DOH_CNAME);
+ for(i = 0; i < DOH_MAX_CNAME; i++)
+ Curl_dyn_init(&de->cname[i], DYN_DOH_CNAME);
}
-UNITTEST DOHcode doh_decode(const unsigned char *doh,
+UNITTEST DOHcode doh_decode(const unsigned char *doh,
size_t dohlen,
DNStype dnstype,
struct dohentry *d)
@@ -652,10 +652,10 @@ UNITTEST DOHcode doh_decode(const unsigned char *doh,
return DOH_DNS_OUT_OF_RANGE;
type = get16bit(doh, index);
- if((type != DNS_TYPE_CNAME) /* may be synthesized from DNAME */
- && (type != DNS_TYPE_DNAME) /* if present, accept and ignore */
- && (type != dnstype))
- /* Not the same type as was asked for nor CNAME nor DNAME */
+ if((type != DNS_TYPE_CNAME) /* may be synthesized from DNAME */
+ && (type != DNS_TYPE_DNAME) /* if present, accept and ignore */
+ && (type != dnstype))
+ /* Not the same type as was asked for nor CNAME nor DNAME */
return DOH_DNS_UNEXPECTED_TYPE;
index += 2;
@@ -745,12 +745,12 @@ UNITTEST DOHcode doh_decode(const unsigned char *doh,
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void showdoh(struct Curl_easy *data,
- const struct dohentry *d)
+ const struct dohentry *d)
{
int i;
infof(data, "TTL: %u seconds\n", d->ttl);
for(i = 0; i < d->numaddr; i++) {
- const struct dohaddr *a = &d->addr[i];
+ const struct dohaddr *a = &d->addr[i];
if(a->type == DNS_TYPE_A) {
infof(data, "DOH A: %u.%u.%u.%u\n",
a->ip.v4[0], a->ip.v4[1],
@@ -776,7 +776,7 @@ static void showdoh(struct Curl_easy *data,
}
}
for(i = 0; i < d->numcname; i++) {
- infof(data, "CNAME: %s\n", Curl_dyn_ptr(&d->cname[i]));
+ infof(data, "CNAME: %s\n", Curl_dyn_ptr(&d->cname[i]));
}
}
#else
@@ -796,19 +796,19 @@ static void showdoh(struct Curl_easy *data,
* must be an associated call later to Curl_freeaddrinfo().
*/
-static struct Curl_addrinfo *
+static struct Curl_addrinfo *
doh2ai(const struct dohentry *de, const char *hostname, int port)
{
- struct Curl_addrinfo *ai;
- struct Curl_addrinfo *prevai = NULL;
- struct Curl_addrinfo *firstai = NULL;
+ struct Curl_addrinfo *ai;
+ struct Curl_addrinfo *prevai = NULL;
+ struct Curl_addrinfo *firstai = NULL;
struct sockaddr_in *addr;
#ifdef ENABLE_IPV6
struct sockaddr_in6 *addr6;
#endif
CURLcode result = CURLE_OK;
int i;
- size_t hostlen = strlen(hostname) + 1; /* include zero terminator */
+ size_t hostlen = strlen(hostname) + 1; /* include zero terminator */
if(!de)
/* no input == no output! */
@@ -831,14 +831,14 @@ doh2ai(const struct dohentry *de, const char *hostname, int port)
addrtype = AF_INET;
}
- ai = calloc(1, sizeof(struct Curl_addrinfo) + ss_size + hostlen);
+ ai = calloc(1, sizeof(struct Curl_addrinfo) + ss_size + hostlen);
if(!ai) {
result = CURLE_OUT_OF_MEMORY;
break;
}
- ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
- ai->ai_canonname = (void *)((char *)ai->ai_addr + ss_size);
- memcpy(ai->ai_canonname, hostname, hostlen);
+ ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
+ ai->ai_canonname = (void *)((char *)ai->ai_addr + ss_size);
+ memcpy(ai->ai_canonname, hostname, hostlen);
if(!firstai)
/* store the pointer we want to return from this function */
@@ -863,7 +863,7 @@ doh2ai(const struct dohentry *de, const char *hostname, int port)
addr = (void *)ai->ai_addr; /* storage area for this info */
DEBUGASSERT(sizeof(struct in_addr) == sizeof(de->addr[i].ip.v4));
memcpy(&addr->sin_addr, &de->addr[i].ip.v4, sizeof(struct in_addr));
- addr->sin_family = addrtype;
+ addr->sin_family = addrtype;
addr->sin_port = htons((unsigned short)port);
break;
@@ -872,7 +872,7 @@ doh2ai(const struct dohentry *de, const char *hostname, int port)
addr6 = (void *)ai->ai_addr; /* storage area for this info */
DEBUGASSERT(sizeof(struct in6_addr) == sizeof(de->addr[i].ip.v6));
memcpy(&addr6->sin6_addr, &de->addr[i].ip.v6, sizeof(struct in6_addr));
- addr6->sin6_family = addrtype;
+ addr6->sin6_family = addrtype;
addr6->sin6_port = htons((unsigned short)port);
break;
#endif
@@ -900,54 +900,54 @@ UNITTEST void de_cleanup(struct dohentry *d)
{
int i = 0;
for(i = 0; i < d->numcname; i++) {
- Curl_dyn_free(&d->cname[i]);
+ Curl_dyn_free(&d->cname[i]);
}
}
CURLcode Curl_doh_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **dnsp)
{
- CURLcode result;
+ CURLcode result;
struct Curl_easy *data = conn->data;
*dnsp = NULL; /* defaults to no response */
- if(!data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V4].easy &&
- !data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V6].easy) {
+ if(!data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V4].easy &&
+ !data->req.doh.probe[DOH_PROBE_SLOT_IPADDR_V6].easy) {
failf(data, "Could not DOH-resolve: %s", conn->async.hostname);
return conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
CURLE_COULDNT_RESOLVE_HOST;
}
else if(!data->req.doh.pending) {
- DOHcode rc[DOH_PROBE_SLOTS] = {
- DOH_OK, DOH_OK
- };
+ DOHcode rc[DOH_PROBE_SLOTS] = {
+ DOH_OK, DOH_OK
+ };
struct dohentry de;
- int slot;
+ int slot;
/* remove DOH handles from multi handle and close them */
- for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
- curl_multi_remove_handle(data->multi, data->req.doh.probe[slot].easy);
- Curl_close(&data->req.doh.probe[slot].easy);
- }
- /* parse the responses, create the struct and return it! */
- de_init(&de);
- for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
- struct dnsprobe *p = &data->req.doh.probe[slot];
- if(!p->dnstype)
- continue;
- rc[slot] = doh_decode(Curl_dyn_uptr(&p->serverdoh),
- Curl_dyn_len(&p->serverdoh),
- p->dnstype,
- &de);
- Curl_dyn_free(&p->serverdoh);
- if(rc[slot]) {
- infof(data, "DOH: %s type %s for %s\n", doh_strerror(rc[slot]),
- type2name(p->dnstype), data->req.doh.host);
- }
- } /* next slot */
-
- result = CURLE_COULDNT_RESOLVE_HOST; /* until we know better */
- if(!rc[DOH_PROBE_SLOT_IPADDR_V4] || !rc[DOH_PROBE_SLOT_IPADDR_V6]) {
- /* we have an address, of one kind or other */
+ for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
+ curl_multi_remove_handle(data->multi, data->req.doh.probe[slot].easy);
+ Curl_close(&data->req.doh.probe[slot].easy);
+ }
+ /* parse the responses, create the struct and return it! */
+ de_init(&de);
+ for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
+ struct dnsprobe *p = &data->req.doh.probe[slot];
+ if(!p->dnstype)
+ continue;
+ rc[slot] = doh_decode(Curl_dyn_uptr(&p->serverdoh),
+ Curl_dyn_len(&p->serverdoh),
+ p->dnstype,
+ &de);
+ Curl_dyn_free(&p->serverdoh);
+ if(rc[slot]) {
+ infof(data, "DOH: %s type %s for %s\n", doh_strerror(rc[slot]),
+ type2name(p->dnstype), data->req.doh.host);
+ }
+ } /* next slot */
+
+ result = CURLE_COULDNT_RESOLVE_HOST; /* until we know better */
+ if(!rc[DOH_PROBE_SLOT_IPADDR_V4] || !rc[DOH_PROBE_SLOT_IPADDR_V6]) {
+ /* we have an address, of one kind or other */
struct Curl_dns_entry *dns;
struct Curl_addrinfo *ai;
@@ -969,26 +969,26 @@ CURLcode Curl_doh_is_resolved(struct connectdata *conn,
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
- if(!dns) {
+ if(!dns) {
/* returned failure, bail out nicely */
Curl_freeaddrinfo(ai);
- }
+ }
else {
conn->async.dns = dns;
*dnsp = dns;
- result = CURLE_OK; /* address resolution OK */
+ result = CURLE_OK; /* address resolution OK */
}
- } /* address processing done */
-
- /* Now process any build-specific attributes retrieved from DNS */
-
- /* All done */
+ } /* address processing done */
+
+ /* Now process any build-specific attributes retrieved from DNS */
+
+ /* All done */
de_cleanup(&de);
- return result;
+ return result;
- } /* !data->req.doh.pending */
+ } /* !data->req.doh.pending */
- /* else wait for pending DOH transactions to complete */
+ /* else wait for pending DOH transactions to complete */
return CURLE_OK;
}
diff --git a/contrib/libs/curl/lib/doh.h b/contrib/libs/curl/lib/doh.h
index 5e14a87f42..0867584ced 100644
--- a/contrib/libs/curl/lib/doh.h
+++ b/contrib/libs/curl/lib/doh.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -32,10 +32,10 @@
* and returns a 'Curl_addrinfo *' with the address information.
*/
-struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp);
+struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp);
CURLcode Curl_doh_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **dns);
@@ -55,16 +55,16 @@ typedef enum {
DOH_DNS_UNEXPECTED_TYPE, /* 9 */
DOH_DNS_UNEXPECTED_CLASS, /* 10 */
DOH_NO_CONTENT, /* 11 */
- DOH_DNS_BAD_ID, /* 12 */
- DOH_DNS_NAME_TOO_LONG /* 13 */
+ DOH_DNS_BAD_ID, /* 12 */
+ DOH_DNS_NAME_TOO_LONG /* 13 */
} DOHcode;
typedef enum {
DNS_TYPE_A = 1,
DNS_TYPE_NS = 2,
DNS_TYPE_CNAME = 5,
- DNS_TYPE_AAAA = 28,
- DNS_TYPE_DNAME = 39 /* RFC6672 */
+ DNS_TYPE_AAAA = 28,
+ DNS_TYPE_DNAME = 39 /* RFC6672 */
} DNStype;
#define DOH_MAX_ADDR 24
@@ -79,9 +79,9 @@ struct dohaddr {
};
struct dohentry {
- struct dynbuf cname[DOH_MAX_CNAME];
- struct dohaddr addr[DOH_MAX_ADDR];
- int numaddr;
+ struct dynbuf cname[DOH_MAX_CNAME];
+ struct dohaddr addr[DOH_MAX_ADDR];
+ int numaddr;
unsigned int ttl;
int numcname;
};
@@ -93,11 +93,11 @@ DOHcode doh_encode(const char *host,
unsigned char *dnsp, /* buffer */
size_t len, /* buffer size */
size_t *olen); /* output length */
-DOHcode doh_decode(const unsigned char *doh,
+DOHcode doh_decode(const unsigned char *doh,
size_t dohlen,
DNStype dnstype,
struct dohentry *d);
-void de_init(struct dohentry *d);
+void de_init(struct dohentry *d);
void de_cleanup(struct dohentry *d);
#endif
diff --git a/contrib/libs/curl/lib/dotdot.c b/contrib/libs/curl/lib/dotdot.c
index 7f0c51bcfd..3a1435f8ec 100644
--- a/contrib/libs/curl/lib/dotdot.c
+++ b/contrib/libs/curl/lib/dotdot.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -39,7 +39,7 @@
* Curl_dedotdotify()
* @unittest: 1395
*
- * This function gets a null-terminated path with dot and dotdot sequences
+ * This function gets a null-terminated path with dot and dotdot sequences
* passed in and strips them off according to the rules in RFC 3986 section
* 5.2.4.
*
@@ -62,7 +62,7 @@ char *Curl_dedotdotify(const char *input)
if(!out)
return NULL; /* out of memory */
- *out = 0; /* null-terminates, for inputs like "./" */
+ *out = 0; /* null-terminates, for inputs like "./" */
/* get a cloned copy of the input */
clone = strdup(input);
@@ -129,7 +129,7 @@ char *Curl_dedotdotify(const char *input)
if(*outptr == '/')
break;
}
- *outptr = 0; /* null-terminate where it stops */
+ *outptr = 0; /* null-terminate where it stops */
}
else if(!strcmp("/..", clone)) {
clone[2]='/';
@@ -141,7 +141,7 @@ char *Curl_dedotdotify(const char *input)
if(*outptr == '/')
break;
}
- *outptr = 0; /* null-terminate where it stops */
+ *outptr = 0; /* null-terminate where it stops */
}
/* D. if the input buffer consists only of "." or "..", then remove
diff --git a/contrib/libs/curl/lib/dotdot.h b/contrib/libs/curl/lib/dotdot.h
index 91121d51c9..ac1ea363e1 100644
--- a/contrib/libs/curl/lib/dotdot.h
+++ b/contrib/libs/curl/lib/dotdot.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/dynbuf.c b/contrib/libs/curl/lib/dynbuf.c
index 7d7c7f9251..ada7e0ccf5 100644
--- a/contrib/libs/curl/lib/dynbuf.c
+++ b/contrib/libs/curl/lib/dynbuf.c
@@ -1,255 +1,255 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "dynbuf.h"
-#include "curl_printf.h"
-#ifdef BUILDING_LIBCURL
-#include "curl_memory.h"
-#endif
-#include "memdebug.h"
-
-#define MIN_FIRST_ALLOC 32
-
-#define DYNINIT 0xbee51da /* random pattern */
-
-/*
- * Init a dynbuf struct.
- */
-void Curl_dyn_init(struct dynbuf *s, size_t toobig)
-{
- DEBUGASSERT(s);
- DEBUGASSERT(toobig);
- s->bufr = NULL;
- s->leng = 0;
- s->allc = 0;
- s->toobig = toobig;
-#ifdef DEBUGBUILD
- s->init = DYNINIT;
-#endif
-}
-
-/*
- * free the buffer and re-init the necessary fields. It doesn't touch the
- * 'init' field and thus this buffer can be reused to add data to again.
- */
-void Curl_dyn_free(struct dynbuf *s)
-{
- DEBUGASSERT(s);
- Curl_safefree(s->bufr);
- s->leng = s->allc = 0;
-}
-
-/*
- * Store/append an chunk of memory to the dynbuf.
- */
-static CURLcode dyn_nappend(struct dynbuf *s,
- const unsigned char *mem, size_t len)
-{
- size_t indx = s->leng;
- size_t a = s->allc;
- size_t fit = len + indx + 1; /* new string + old string + zero byte */
-
- /* try to detect if there's rubbish in the struct */
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(s->toobig);
- DEBUGASSERT(indx < s->toobig);
- DEBUGASSERT(!s->leng || s->bufr);
-
- if(fit > s->toobig) {
- Curl_dyn_free(s);
- return CURLE_OUT_OF_MEMORY;
- }
- else if(!a) {
- DEBUGASSERT(!indx);
- /* first invoke */
- if(fit < MIN_FIRST_ALLOC)
- a = MIN_FIRST_ALLOC;
- else
- a = fit;
- }
- else {
- while(a < fit)
- a *= 2;
- }
-
- if(a != s->allc) {
- /* this logic is not using Curl_saferealloc() to make the tool not have to
- include that as well when it uses this code */
- void *p = realloc(s->bufr, a);
- if(!p) {
- Curl_safefree(s->bufr);
- s->leng = s->allc = 0;
- return CURLE_OUT_OF_MEMORY;
- }
- s->bufr = p;
- s->allc = a;
- }
-
- if(len)
- memcpy(&s->bufr[indx], mem, len);
- s->leng = indx + len;
- s->bufr[s->leng] = 0;
- return CURLE_OK;
-}
-
-/*
- * Clears the string, keeps the allocation. This can also be called on a
- * buffer that already was freed.
- */
-void Curl_dyn_reset(struct dynbuf *s)
-{
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- if(s->leng)
- s->bufr[0] = 0;
- s->leng = 0;
-}
-
-#ifdef USE_NGTCP2
-/*
- * Specify the size of the tail to keep (number of bytes from the end of the
- * buffer). The rest will be dropped.
- */
-CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail)
-{
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- if(trail > s->leng)
- return CURLE_BAD_FUNCTION_ARGUMENT;
- else if(trail == s->leng)
- return CURLE_OK;
- else if(!trail) {
- Curl_dyn_reset(s);
- }
- else {
- memmove(&s->bufr[0], &s->bufr[s->leng - trail], trail);
- s->leng = trail;
- s->bufr[s->leng] = 0;
- }
- return CURLE_OK;
-
-}
-#endif
-
-/*
- * Appends a buffer with length.
- */
-CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
-{
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- return dyn_nappend(s, mem, len);
-}
-
-/*
- * Append a null-terminated string at the end.
- */
-CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
-{
- size_t n = strlen(str);
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- return dyn_nappend(s, (unsigned char *)str, n);
-}
-
-/*
- * Append a string vprintf()-style
- */
-CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
-{
-#ifdef BUILDING_LIBCURL
- int rc;
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- rc = Curl_dyn_vprintf(s, fmt, ap);
-
- if(!rc)
- return CURLE_OK;
-#else
- char *str;
- str = vaprintf(fmt, ap); /* this allocs a new string to append */
-
- if(str) {
- CURLcode result = dyn_nappend(s, (unsigned char *)str, strlen(str));
- free(str);
- return result;
- }
- /* If we failed, we cleanup the whole buffer and return error */
- Curl_dyn_free(s);
-#endif
- return CURLE_OUT_OF_MEMORY;
-}
-
-/*
- * Append a string printf()-style
- */
-CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
-{
- CURLcode result;
- va_list ap;
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- va_start(ap, fmt);
- result = Curl_dyn_vaddf(s, fmt, ap);
- va_end(ap);
- return result;
-}
-
-/*
- * Returns a pointer to the buffer.
- */
-char *Curl_dyn_ptr(const struct dynbuf *s)
-{
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- return s->bufr;
-}
-
-/*
- * Returns an unsigned pointer to the buffer.
- */
-unsigned char *Curl_dyn_uptr(const struct dynbuf *s)
-{
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- return (unsigned char *)s->bufr;
-}
-
-/*
- * Returns the length of the buffer.
- */
-size_t Curl_dyn_len(const struct dynbuf *s)
-{
- DEBUGASSERT(s);
- DEBUGASSERT(s->init == DYNINIT);
- DEBUGASSERT(!s->leng || s->bufr);
- return s->leng;
-}
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "dynbuf.h"
+#include "curl_printf.h"
+#ifdef BUILDING_LIBCURL
+#include "curl_memory.h"
+#endif
+#include "memdebug.h"
+
+#define MIN_FIRST_ALLOC 32
+
+#define DYNINIT 0xbee51da /* random pattern */
+
+/*
+ * Init a dynbuf struct.
+ */
+void Curl_dyn_init(struct dynbuf *s, size_t toobig)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(toobig);
+ s->bufr = NULL;
+ s->leng = 0;
+ s->allc = 0;
+ s->toobig = toobig;
+#ifdef DEBUGBUILD
+ s->init = DYNINIT;
+#endif
+}
+
+/*
+ * free the buffer and re-init the necessary fields. It doesn't touch the
+ * 'init' field and thus this buffer can be reused to add data to again.
+ */
+void Curl_dyn_free(struct dynbuf *s)
+{
+ DEBUGASSERT(s);
+ Curl_safefree(s->bufr);
+ s->leng = s->allc = 0;
+}
+
+/*
+ * Store/append an chunk of memory to the dynbuf.
+ */
+static CURLcode dyn_nappend(struct dynbuf *s,
+ const unsigned char *mem, size_t len)
+{
+ size_t indx = s->leng;
+ size_t a = s->allc;
+ size_t fit = len + indx + 1; /* new string + old string + zero byte */
+
+ /* try to detect if there's rubbish in the struct */
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(s->toobig);
+ DEBUGASSERT(indx < s->toobig);
+ DEBUGASSERT(!s->leng || s->bufr);
+
+ if(fit > s->toobig) {
+ Curl_dyn_free(s);
+ return CURLE_OUT_OF_MEMORY;
+ }
+ else if(!a) {
+ DEBUGASSERT(!indx);
+ /* first invoke */
+ if(fit < MIN_FIRST_ALLOC)
+ a = MIN_FIRST_ALLOC;
+ else
+ a = fit;
+ }
+ else {
+ while(a < fit)
+ a *= 2;
+ }
+
+ if(a != s->allc) {
+ /* this logic is not using Curl_saferealloc() to make the tool not have to
+ include that as well when it uses this code */
+ void *p = realloc(s->bufr, a);
+ if(!p) {
+ Curl_safefree(s->bufr);
+ s->leng = s->allc = 0;
+ return CURLE_OUT_OF_MEMORY;
+ }
+ s->bufr = p;
+ s->allc = a;
+ }
+
+ if(len)
+ memcpy(&s->bufr[indx], mem, len);
+ s->leng = indx + len;
+ s->bufr[s->leng] = 0;
+ return CURLE_OK;
+}
+
+/*
+ * Clears the string, keeps the allocation. This can also be called on a
+ * buffer that already was freed.
+ */
+void Curl_dyn_reset(struct dynbuf *s)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ if(s->leng)
+ s->bufr[0] = 0;
+ s->leng = 0;
+}
+
+#ifdef USE_NGTCP2
+/*
+ * Specify the size of the tail to keep (number of bytes from the end of the
+ * buffer). The rest will be dropped.
+ */
+CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ if(trail > s->leng)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ else if(trail == s->leng)
+ return CURLE_OK;
+ else if(!trail) {
+ Curl_dyn_reset(s);
+ }
+ else {
+ memmove(&s->bufr[0], &s->bufr[s->leng - trail], trail);
+ s->leng = trail;
+ s->bufr[s->leng] = 0;
+ }
+ return CURLE_OK;
+
+}
+#endif
+
+/*
+ * Appends a buffer with length.
+ */
+CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ return dyn_nappend(s, mem, len);
+}
+
+/*
+ * Append a null-terminated string at the end.
+ */
+CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
+{
+ size_t n = strlen(str);
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ return dyn_nappend(s, (unsigned char *)str, n);
+}
+
+/*
+ * Append a string vprintf()-style
+ */
+CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
+{
+#ifdef BUILDING_LIBCURL
+ int rc;
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ rc = Curl_dyn_vprintf(s, fmt, ap);
+
+ if(!rc)
+ return CURLE_OK;
+#else
+ char *str;
+ str = vaprintf(fmt, ap); /* this allocs a new string to append */
+
+ if(str) {
+ CURLcode result = dyn_nappend(s, (unsigned char *)str, strlen(str));
+ free(str);
+ return result;
+ }
+ /* If we failed, we cleanup the whole buffer and return error */
+ Curl_dyn_free(s);
+#endif
+ return CURLE_OUT_OF_MEMORY;
+}
+
+/*
+ * Append a string printf()-style
+ */
+CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
+{
+ CURLcode result;
+ va_list ap;
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ va_start(ap, fmt);
+ result = Curl_dyn_vaddf(s, fmt, ap);
+ va_end(ap);
+ return result;
+}
+
+/*
+ * Returns a pointer to the buffer.
+ */
+char *Curl_dyn_ptr(const struct dynbuf *s)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ return s->bufr;
+}
+
+/*
+ * Returns an unsigned pointer to the buffer.
+ */
+unsigned char *Curl_dyn_uptr(const struct dynbuf *s)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ return (unsigned char *)s->bufr;
+}
+
+/*
+ * Returns the length of the buffer.
+ */
+size_t Curl_dyn_len(const struct dynbuf *s)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ return s->leng;
+}
diff --git a/contrib/libs/curl/lib/dynbuf.h b/contrib/libs/curl/lib/dynbuf.h
index 11b9d8ad8c..484e40c645 100644
--- a/contrib/libs/curl/lib/dynbuf.h
+++ b/contrib/libs/curl/lib/dynbuf.h
@@ -1,88 +1,88 @@
-#ifndef HEADER_CURL_DYNBUF_H
-#define HEADER_CURL_DYNBUF_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
- *
- ***************************************************************************/
-
-#ifndef BUILDING_LIBCURL
-/* this renames the functions so that the tool code can use the same code
- without getting symbol collisions */
-#define Curl_dyn_init(a,b) curlx_dyn_init(a,b)
-#define Curl_dyn_add(a,b) curlx_dyn_add(a,b)
-#define Curl_dyn_addn(a,b,c) curlx_dyn_addn(a,b,c)
-#define Curl_dyn_addf curlx_dyn_addf
-#define Curl_dyn_vaddf curlx_dyn_vaddf
-#define Curl_dyn_free(a) curlx_dyn_free(a)
-#define Curl_dyn_ptr(a) curlx_dyn_ptr(a)
-#define Curl_dyn_uptr(a) curlx_dyn_uptr(a)
-#define Curl_dyn_len(a) curlx_dyn_len(a)
-#define Curl_dyn_reset(a) curlx_dyn_reset(a)
-#define Curl_dyn_tail(a,b) curlx_dyn_tail(a,b)
-#define curlx_dynbuf dynbuf /* for the struct name */
-#endif
-
-struct dynbuf {
- char *bufr; /* point to a null-terminated allocated buffer */
- size_t leng; /* number of bytes *EXCLUDING* the zero terminator */
- size_t allc; /* size of the current allocation */
- size_t toobig; /* size limit for the buffer */
-#ifdef DEBUGBUILD
- int init; /* detect API usage mistakes */
-#endif
-};
-
-void Curl_dyn_init(struct dynbuf *s, size_t toobig);
-void Curl_dyn_free(struct dynbuf *s);
-CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
- WARN_UNUSED_RESULT;
-CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
- WARN_UNUSED_RESULT;
-CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
- WARN_UNUSED_RESULT;
-CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
- WARN_UNUSED_RESULT;
-void Curl_dyn_reset(struct dynbuf *s);
-CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail);
-char *Curl_dyn_ptr(const struct dynbuf *s);
-unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
-size_t Curl_dyn_len(const struct dynbuf *s);
-
-/* returns 0 on success, -1 on error */
-/* The implementation of this function exists in mprintf.c */
-int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
-
-/* Dynamic buffer max sizes */
-#define DYN_DOH_RESPONSE 3000
-#define DYN_DOH_CNAME 256
-#define DYN_PAUSE_BUFFER (64 * 1024 * 1024)
-#define DYN_HAXPROXY 2048
-#define DYN_HTTP_REQUEST (128*1024)
-#define DYN_H2_HEADERS (128*1024)
-#define DYN_H2_TRAILERS (128*1024)
-#define DYN_APRINTF 8000000
-#define DYN_RTSP_REQ_HEADER (64*1024)
-#define DYN_TRAILERS (64*1024)
-#define DYN_PROXY_CONNECT_HEADERS 16384
-#define DYN_QLOG_NAME 1024
-#define DYN_H1_TRAILER 4096
-#define DYN_PINGPPONG_CMD (64*1024)
-#define DYN_IMAP_CMD (64*1024)
-#endif
+#ifndef HEADER_CURL_DYNBUF_H
+#define HEADER_CURL_DYNBUF_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
+ *
+ ***************************************************************************/
+
+#ifndef BUILDING_LIBCURL
+/* this renames the functions so that the tool code can use the same code
+ without getting symbol collisions */
+#define Curl_dyn_init(a,b) curlx_dyn_init(a,b)
+#define Curl_dyn_add(a,b) curlx_dyn_add(a,b)
+#define Curl_dyn_addn(a,b,c) curlx_dyn_addn(a,b,c)
+#define Curl_dyn_addf curlx_dyn_addf
+#define Curl_dyn_vaddf curlx_dyn_vaddf
+#define Curl_dyn_free(a) curlx_dyn_free(a)
+#define Curl_dyn_ptr(a) curlx_dyn_ptr(a)
+#define Curl_dyn_uptr(a) curlx_dyn_uptr(a)
+#define Curl_dyn_len(a) curlx_dyn_len(a)
+#define Curl_dyn_reset(a) curlx_dyn_reset(a)
+#define Curl_dyn_tail(a,b) curlx_dyn_tail(a,b)
+#define curlx_dynbuf dynbuf /* for the struct name */
+#endif
+
+struct dynbuf {
+ char *bufr; /* point to a null-terminated allocated buffer */
+ size_t leng; /* number of bytes *EXCLUDING* the zero terminator */
+ size_t allc; /* size of the current allocation */
+ size_t toobig; /* size limit for the buffer */
+#ifdef DEBUGBUILD
+ int init; /* detect API usage mistakes */
+#endif
+};
+
+void Curl_dyn_init(struct dynbuf *s, size_t toobig);
+void Curl_dyn_free(struct dynbuf *s);
+CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
+ WARN_UNUSED_RESULT;
+CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
+ WARN_UNUSED_RESULT;
+CURLcode Curl_dyn_addf(struct dynbuf *s, const char *fmt, ...)
+ WARN_UNUSED_RESULT;
+CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
+ WARN_UNUSED_RESULT;
+void Curl_dyn_reset(struct dynbuf *s);
+CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail);
+char *Curl_dyn_ptr(const struct dynbuf *s);
+unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
+size_t Curl_dyn_len(const struct dynbuf *s);
+
+/* returns 0 on success, -1 on error */
+/* The implementation of this function exists in mprintf.c */
+int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save);
+
+/* Dynamic buffer max sizes */
+#define DYN_DOH_RESPONSE 3000
+#define DYN_DOH_CNAME 256
+#define DYN_PAUSE_BUFFER (64 * 1024 * 1024)
+#define DYN_HAXPROXY 2048
+#define DYN_HTTP_REQUEST (128*1024)
+#define DYN_H2_HEADERS (128*1024)
+#define DYN_H2_TRAILERS (128*1024)
+#define DYN_APRINTF 8000000
+#define DYN_RTSP_REQ_HEADER (64*1024)
+#define DYN_TRAILERS (64*1024)
+#define DYN_PROXY_CONNECT_HEADERS 16384
+#define DYN_QLOG_NAME 1024
+#define DYN_H1_TRAILER 4096
+#define DYN_PINGPPONG_CMD (64*1024)
+#define DYN_IMAP_CMD (64*1024)
+#endif
diff --git a/contrib/libs/curl/lib/easy.c b/contrib/libs/curl/lib/easy.c
index f500a45d4f..dc790b01df 100644
--- a/contrib/libs/curl/lib/easy.c
+++ b/contrib/libs/curl/lib/easy.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -72,14 +72,14 @@
#include "warnless.h"
#include "multiif.h"
#include "sigpipe.h"
-#include "vssh/ssh.h"
+#include "vssh/ssh.h"
#include "setopt.h"
#include "http_digest.h"
#include "system_win32.h"
-#include "http2.h"
-#include "dynbuf.h"
-#include "altsvc.h"
-#include "hsts.h"
+#include "http2.h"
+#include "dynbuf.h"
+#include "altsvc.h"
+#include "hsts.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -147,20 +147,20 @@ static CURLcode global_init(long flags, bool memoryfuncs)
if(!Curl_ssl_init()) {
DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n"));
- goto fail;
+ goto fail;
}
#ifdef WIN32
if(Curl_win32_init(flags)) {
DEBUGF(fprintf(stderr, "Error: win32_init failed\n"));
- goto fail;
+ goto fail;
}
#endif
#ifdef __AMIGA__
if(!Curl_amiga_init()) {
DEBUGF(fprintf(stderr, "Error: Curl_amiga_init failed\n"));
- goto fail;
+ goto fail;
}
#endif
@@ -172,29 +172,29 @@ static CURLcode global_init(long flags, bool memoryfuncs)
if(Curl_resolver_global_init()) {
DEBUGF(fprintf(stderr, "Error: resolver_global_init failed\n"));
- goto fail;
+ goto fail;
}
#if defined(USE_SSH)
if(Curl_ssh_init()) {
- goto fail;
- }
-#endif
-
-#ifdef USE_WOLFSSH
- if(WS_SUCCESS != wolfSSH_Init()) {
- DEBUGF(fprintf(stderr, "Error: wolfSSH_Init failed\n"));
+ goto fail;
+ }
+#endif
+
+#ifdef USE_WOLFSSH
+ if(WS_SUCCESS != wolfSSH_Init()) {
+ DEBUGF(fprintf(stderr, "Error: wolfSSH_Init failed\n"));
return CURLE_FAILED_INIT;
}
#endif
init_flags = flags;
- return CURLE_OK;
+ return CURLE_OK;
- fail:
- initialized--; /* undo the increase */
- return CURLE_FAILED_INIT;
+ fail:
+ initialized--; /* undo the increase */
+ return CURLE_FAILED_INIT;
}
@@ -262,10 +262,10 @@ void curl_global_cleanup(void)
Curl_ssh_cleanup();
-#ifdef USE_WOLFSSH
- (void)wolfSSH_Cleanup();
-#endif
-
+#ifdef USE_WOLFSSH
+ (void)wolfSSH_Cleanup();
+#endif
+
init_flags = 0;
}
@@ -500,7 +500,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
before = Curl_now();
/* wait for activity or timeout */
- pollrc = Curl_poll(fds, numfds, ev->ms);
+ pollrc = Curl_poll(fds, numfds, ev->ms);
after = Curl_now();
@@ -671,7 +671,7 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
mcode = curl_multi_add_handle(multi, data);
if(mcode) {
curl_multi_cleanup(multi);
- data->multi_easy = NULL;
+ data->multi_easy = NULL;
if(mcode == CURLM_OUT_OF_MEMORY)
return CURLE_OUT_OF_MEMORY;
return CURLE_FAILED_INIT;
@@ -726,7 +726,7 @@ void curl_easy_cleanup(struct Curl_easy *data)
return;
sigpipe_ignore(data, &pipe_st);
- Curl_close(&data);
+ Curl_close(&data);
sigpipe_restore(&pipe_st);
}
@@ -754,7 +754,7 @@ static CURLcode dupset(struct Curl_easy *dst, struct Curl_easy *src)
{
CURLcode result = CURLE_OK;
enum dupstring i;
- enum dupblob j;
+ enum dupblob j;
/* Copy src->set into dst->set first, then deal with the strings
afterwards */
@@ -771,16 +771,16 @@ static CURLcode dupset(struct Curl_easy *dst, struct Curl_easy *src)
return result;
}
- /* clear all blob pointers first */
- memset(dst->set.blobs, 0, BLOB_LAST * sizeof(struct curl_blob *));
- /* duplicate all blobs */
- for(j = (enum dupblob)0; j < BLOB_LAST; j++) {
- result = Curl_setblobopt(&dst->set.blobs[j], src->set.blobs[j]);
- /* Curl_setstropt return CURLE_BAD_FUNCTION_ARGUMENT with blob */
- if(result)
- return result;
- }
-
+ /* clear all blob pointers first */
+ memset(dst->set.blobs, 0, BLOB_LAST * sizeof(struct curl_blob *));
+ /* duplicate all blobs */
+ for(j = (enum dupblob)0; j < BLOB_LAST; j++) {
+ result = Curl_setblobopt(&dst->set.blobs[j], src->set.blobs[j]);
+ /* Curl_setstropt return CURLE_BAD_FUNCTION_ARGUMENT with blob */
+ if(result)
+ return result;
+ }
+
/* duplicate memory areas pointed to */
i = STRING_COPYPOSTFIELDS;
if(src->set.postfieldsize && src->set.str[i]) {
@@ -824,11 +824,11 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
if(dupset(outcurl, data))
goto fail;
- Curl_dyn_init(&outcurl->state.headerb, CURL_MAX_HTTP_HEADER);
-
+ Curl_dyn_init(&outcurl->state.headerb, CURL_MAX_HTTP_HEADER);
+
/* the connection cache is setup on demand */
outcurl->state.conn_cache = NULL;
- outcurl->state.lastconnect_id = -1;
+ outcurl->state.lastconnect_id = -1;
outcurl->progress.flags = data->progress.flags;
outcurl->progress.callback = data->progress.callback;
@@ -873,54 +873,54 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
goto fail;
}
-#ifdef USE_ALTSVC
- if(data->asi) {
- outcurl->asi = Curl_altsvc_init();
- if(!outcurl->asi)
- goto fail;
- if(outcurl->set.str[STRING_ALTSVC])
- (void)Curl_altsvc_load(outcurl->asi, outcurl->set.str[STRING_ALTSVC]);
- }
-#endif
-#ifdef USE_HSTS
- if(data->hsts) {
- outcurl->hsts = Curl_hsts_init();
- if(!outcurl->hsts)
- goto fail;
- if(outcurl->set.str[STRING_HSTS])
- (void)Curl_hsts_loadfile(outcurl,
- outcurl->hsts, outcurl->set.str[STRING_HSTS]);
- (void)Curl_hsts_loadcb(outcurl, outcurl->hsts);
- }
-#endif
+#ifdef USE_ALTSVC
+ if(data->asi) {
+ outcurl->asi = Curl_altsvc_init();
+ if(!outcurl->asi)
+ goto fail;
+ if(outcurl->set.str[STRING_ALTSVC])
+ (void)Curl_altsvc_load(outcurl->asi, outcurl->set.str[STRING_ALTSVC]);
+ }
+#endif
+#ifdef USE_HSTS
+ if(data->hsts) {
+ outcurl->hsts = Curl_hsts_init();
+ if(!outcurl->hsts)
+ goto fail;
+ if(outcurl->set.str[STRING_HSTS])
+ (void)Curl_hsts_loadfile(outcurl,
+ outcurl->hsts, outcurl->set.str[STRING_HSTS]);
+ (void)Curl_hsts_loadcb(outcurl, outcurl->hsts);
+ }
+#endif
/* Clone the resolver handle, if present, for the new handle */
if(Curl_resolver_duphandle(outcurl,
&outcurl->state.resolver,
data->state.resolver))
goto fail;
-#ifdef USE_ARES
- {
- CURLcode rc;
-
- rc = Curl_set_dns_servers(outcurl, data->set.str[STRING_DNS_SERVERS]);
- if(rc && rc != CURLE_NOT_BUILT_IN)
- goto fail;
-
- rc = Curl_set_dns_interface(outcurl, data->set.str[STRING_DNS_INTERFACE]);
- if(rc && rc != CURLE_NOT_BUILT_IN)
- goto fail;
-
- rc = Curl_set_dns_local_ip4(outcurl, data->set.str[STRING_DNS_LOCAL_IP4]);
- if(rc && rc != CURLE_NOT_BUILT_IN)
- goto fail;
-
- rc = Curl_set_dns_local_ip6(outcurl, data->set.str[STRING_DNS_LOCAL_IP6]);
- if(rc && rc != CURLE_NOT_BUILT_IN)
- goto fail;
- }
-#endif /* USE_ARES */
-
+#ifdef USE_ARES
+ {
+ CURLcode rc;
+
+ rc = Curl_set_dns_servers(outcurl, data->set.str[STRING_DNS_SERVERS]);
+ if(rc && rc != CURLE_NOT_BUILT_IN)
+ goto fail;
+
+ rc = Curl_set_dns_interface(outcurl, data->set.str[STRING_DNS_INTERFACE]);
+ if(rc && rc != CURLE_NOT_BUILT_IN)
+ goto fail;
+
+ rc = Curl_set_dns_local_ip4(outcurl, data->set.str[STRING_DNS_LOCAL_IP4]);
+ if(rc && rc != CURLE_NOT_BUILT_IN)
+ goto fail;
+
+ rc = Curl_set_dns_local_ip6(outcurl, data->set.str[STRING_DNS_LOCAL_IP6]);
+ if(rc && rc != CURLE_NOT_BUILT_IN)
+ goto fail;
+ }
+#endif /* USE_ARES */
+
Curl_convert_setup(outcurl);
Curl_initinfo(outcurl);
@@ -937,11 +937,11 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
curl_slist_free_all(outcurl->change.cookielist);
outcurl->change.cookielist = NULL;
Curl_safefree(outcurl->state.buffer);
- Curl_dyn_free(&outcurl->state.headerb);
+ Curl_dyn_free(&outcurl->state.headerb);
Curl_safefree(outcurl->change.url);
Curl_safefree(outcurl->change.referer);
- Curl_altsvc_cleanup(&outcurl->asi);
- Curl_hsts_cleanup(&outcurl->hsts);
+ Curl_altsvc_cleanup(&outcurl->asi);
+ Curl_hsts_cleanup(&outcurl->hsts);
Curl_freeset(outcurl);
free(outcurl);
}
@@ -970,7 +970,7 @@ void curl_easy_reset(struct Curl_easy *data)
data->progress.flags |= PGRS_HIDE;
data->state.current_speed = -1; /* init to negative == impossible */
- data->state.retrycount = 0; /* reset the retry counter */
+ data->state.retrycount = 0; /* reset the retry counter */
/* zero out authentication data: */
memset(&data->state.authhost, 0, sizeof(struct auth));
@@ -996,102 +996,102 @@ void curl_easy_reset(struct Curl_easy *data)
*/
CURLcode curl_easy_pause(struct Curl_easy *data, int action)
{
- struct SingleRequest *k;
+ struct SingleRequest *k;
CURLcode result = CURLE_OK;
- int oldstate;
- int newstate;
-
- if(!GOOD_EASY_HANDLE(data) || !data->conn)
- /* crazy input, don't continue */
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
- k = &data->req;
- oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
-
- /* first switch off both pause bits then set the new pause bits */
- newstate = (k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) |
- ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) |
+ int oldstate;
+ int newstate;
+
+ if(!GOOD_EASY_HANDLE(data) || !data->conn)
+ /* crazy input, don't continue */
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
+ k = &data->req;
+ oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
+
+ /* first switch off both pause bits then set the new pause bits */
+ newstate = (k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) |
+ ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) |
((action & CURLPAUSE_SEND)?KEEP_SEND_PAUSE:0);
- if((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) == oldstate) {
- /* Not changing any pause state, return */
- DEBUGF(infof(data, "pause: no change, early return\n"));
- return CURLE_OK;
- }
-
- /* Unpause parts in active mime tree. */
- if((k->keepon & ~newstate & KEEP_SEND_PAUSE) &&
- (data->mstate == CURLM_STATE_PERFORM ||
- data->mstate == CURLM_STATE_TOOFAST) &&
- data->state.fread_func == (curl_read_callback) Curl_mime_read) {
- Curl_mime_unpause(data->state.in);
- }
-
+ if((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) == oldstate) {
+ /* Not changing any pause state, return */
+ DEBUGF(infof(data, "pause: no change, early return\n"));
+ return CURLE_OK;
+ }
+
+ /* Unpause parts in active mime tree. */
+ if((k->keepon & ~newstate & KEEP_SEND_PAUSE) &&
+ (data->mstate == CURLM_STATE_PERFORM ||
+ data->mstate == CURLM_STATE_TOOFAST) &&
+ data->state.fread_func == (curl_read_callback) Curl_mime_read) {
+ Curl_mime_unpause(data->state.in);
+ }
+
/* put it back in the keepon */
k->keepon = newstate;
- if(!(newstate & KEEP_RECV_PAUSE)) {
- Curl_http2_stream_pause(data, FALSE);
-
- if(data->state.tempcount) {
- /* there are buffers for sending that can be delivered as the receive
- pausing is lifted! */
- unsigned int i;
- unsigned int count = data->state.tempcount;
- struct tempbuf writebuf[3]; /* there can only be three */
- struct connectdata *conn = data->conn;
- struct Curl_easy *saved_data = NULL;
-
- /* copy the structs to allow for immediate re-pausing */
- for(i = 0; i < data->state.tempcount; i++) {
- writebuf[i] = data->state.tempwrite[i];
- Curl_dyn_init(&data->state.tempwrite[i].b, DYN_PAUSE_BUFFER);
- }
- data->state.tempcount = 0;
-
- /* set the connection's current owner */
- if(conn->data != data) {
- saved_data = conn->data;
- conn->data = data;
- }
-
- for(i = 0; i < count; i++) {
- /* even if one function returns error, this loops through and frees
- all buffers */
- if(!result)
- result = Curl_client_write(conn, writebuf[i].type,
- Curl_dyn_ptr(&writebuf[i].b),
- Curl_dyn_len(&writebuf[i].b));
- Curl_dyn_free(&writebuf[i].b);
- }
-
- /* recover previous owner of the connection */
- if(saved_data)
- conn->data = saved_data;
-
- if(result)
- return result;
- }
+ if(!(newstate & KEEP_RECV_PAUSE)) {
+ Curl_http2_stream_pause(data, FALSE);
+
+ if(data->state.tempcount) {
+ /* there are buffers for sending that can be delivered as the receive
+ pausing is lifted! */
+ unsigned int i;
+ unsigned int count = data->state.tempcount;
+ struct tempbuf writebuf[3]; /* there can only be three */
+ struct connectdata *conn = data->conn;
+ struct Curl_easy *saved_data = NULL;
+
+ /* copy the structs to allow for immediate re-pausing */
+ for(i = 0; i < data->state.tempcount; i++) {
+ writebuf[i] = data->state.tempwrite[i];
+ Curl_dyn_init(&data->state.tempwrite[i].b, DYN_PAUSE_BUFFER);
+ }
+ data->state.tempcount = 0;
+
+ /* set the connection's current owner */
+ if(conn->data != data) {
+ saved_data = conn->data;
+ conn->data = data;
+ }
+
+ for(i = 0; i < count; i++) {
+ /* even if one function returns error, this loops through and frees
+ all buffers */
+ if(!result)
+ result = Curl_client_write(conn, writebuf[i].type,
+ Curl_dyn_ptr(&writebuf[i].b),
+ Curl_dyn_len(&writebuf[i].b));
+ Curl_dyn_free(&writebuf[i].b);
+ }
+
+ /* recover previous owner of the connection */
+ if(saved_data)
+ conn->data = saved_data;
+
+ if(result)
+ return result;
+ }
}
/* if there's no error and we're not pausing both directions, we want
to have this handle checked soon */
- if((newstate & (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) !=
- (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) {
+ if((newstate & (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) !=
+ (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) {
Curl_expire(data, 0, EXPIRE_RUN_NOW); /* get this handle going again */
-
- if(!data->state.tempcount)
- /* if not pausing again, force a recv/send check of this connection as
- the data might've been read off the socket already */
- data->conn->cselect_bits = CURL_CSELECT_IN | CURL_CSELECT_OUT;
+
+ if(!data->state.tempcount)
+ /* if not pausing again, force a recv/send check of this connection as
+ the data might've been read off the socket already */
+ data->conn->cselect_bits = CURL_CSELECT_IN | CURL_CSELECT_OUT;
if(data->multi)
Curl_update_timer(data->multi);
}
- if(!data->state.done)
- /* This transfer may have been moved in or out of the bundle, update the
- corresponding socket callback, if used */
- Curl_updatesocket(data);
+ if(!data->state.done)
+ /* This transfer may have been moved in or out of the bundle, update the
+ corresponding socket callback, if used */
+ Curl_updatesocket(data);
return result;
}
diff --git a/contrib/libs/curl/lib/easygetopt.c b/contrib/libs/curl/lib/easygetopt.c
index 0a8b89ef38..7b2213fb24 100644
--- a/contrib/libs/curl/lib/easygetopt.c
+++ b/contrib/libs/curl/lib/easygetopt.c
@@ -1,96 +1,96 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ | |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * ___|___/|_| ______|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel.se>, 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.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 "strcase.h"
-#include "easyoptions.h"
-
-#ifndef CURL_DISABLE_GETOPTIONS
-
-/* Lookups easy options at runtime */
-static struct curl_easyoption *lookup(const char *name, CURLoption id)
-{
- DEBUGASSERT(name || id);
- DEBUGASSERT(!Curl_easyopts_check());
- if(name || id) {
- struct curl_easyoption *o = &Curl_easyopts[0];
- do {
- if(name) {
- if(strcasecompare(o->name, name))
- return o;
- }
- else {
- if((o->id == id) && !(o->flags & CURLOT_FLAG_ALIAS))
- /* don't match alias options */
- return o;
- }
- o++;
- } while(o->name);
- }
- return NULL;
-}
-
-const struct curl_easyoption *curl_easy_option_by_name(const char *name)
-{
- /* when name is used, the id argument is ignored */
- return lookup(name, CURLOPT_LASTENTRY);
-}
-
-const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
-{
- return lookup(NULL, id);
-}
-
-/* Iterates over available options */
-const struct curl_easyoption *
-curl_easy_option_next(const struct curl_easyoption *prev)
-{
- if(prev && prev->name) {
- prev++;
- if(prev->name)
- return prev;
- }
- else if(!prev)
- return &Curl_easyopts[0];
- return NULL;
-}
-
-#else
-const struct curl_easyoption *curl_easy_option_by_name(const char *name)
-{
- (void)name;
- return NULL;
-}
-
-const struct curl_easyoption *curl_easy_option_by_id (CURLoption id)
-{
- (void)id;
- return NULL;
-}
-
-const struct curl_easyoption *
-curl_easy_option_next(const struct curl_easyoption *prev)
-{
- (void)prev;
- return NULL;
-}
-#endif
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ | |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * ___|___/|_| ______|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel.se>, 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.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 "strcase.h"
+#include "easyoptions.h"
+
+#ifndef CURL_DISABLE_GETOPTIONS
+
+/* Lookups easy options at runtime */
+static struct curl_easyoption *lookup(const char *name, CURLoption id)
+{
+ DEBUGASSERT(name || id);
+ DEBUGASSERT(!Curl_easyopts_check());
+ if(name || id) {
+ struct curl_easyoption *o = &Curl_easyopts[0];
+ do {
+ if(name) {
+ if(strcasecompare(o->name, name))
+ return o;
+ }
+ else {
+ if((o->id == id) && !(o->flags & CURLOT_FLAG_ALIAS))
+ /* don't match alias options */
+ return o;
+ }
+ o++;
+ } while(o->name);
+ }
+ return NULL;
+}
+
+const struct curl_easyoption *curl_easy_option_by_name(const char *name)
+{
+ /* when name is used, the id argument is ignored */
+ return lookup(name, CURLOPT_LASTENTRY);
+}
+
+const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
+{
+ return lookup(NULL, id);
+}
+
+/* Iterates over available options */
+const struct curl_easyoption *
+curl_easy_option_next(const struct curl_easyoption *prev)
+{
+ if(prev && prev->name) {
+ prev++;
+ if(prev->name)
+ return prev;
+ }
+ else if(!prev)
+ return &Curl_easyopts[0];
+ return NULL;
+}
+
+#else
+const struct curl_easyoption *curl_easy_option_by_name(const char *name)
+{
+ (void)name;
+ return NULL;
+}
+
+const struct curl_easyoption *curl_easy_option_by_id (CURLoption id)
+{
+ (void)id;
+ return NULL;
+}
+
+const struct curl_easyoption *
+curl_easy_option_next(const struct curl_easyoption *prev)
+{
+ (void)prev;
+ return NULL;
+}
+#endif
diff --git a/contrib/libs/curl/lib/easyif.h b/contrib/libs/curl/lib/easyif.h
index 1ad39b8cf9..3364418285 100644
--- a/contrib/libs/curl/lib/easyif.h
+++ b/contrib/libs/curl/lib/easyif.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/easyoptions.c b/contrib/libs/curl/lib/easyoptions.c
index c615568c7d..f236da23ab 100644
--- a/contrib/libs/curl/lib/easyoptions.c
+++ b/contrib/libs/curl/lib/easyoptions.c
@@ -1,353 +1,353 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ | |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * ___|___/|_| ______|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel.se>, 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.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.
- *
- ***************************************************************************/
-
-/* This source code is generated by optiontable.pl - DO NOT EDIT BY HAND */
-
-#include "curl_setup.h"
-#include "easyoptions.h"
-
-/* all easy setopt options listed in alphabetical order */
-struct curl_easyoption Curl_easyopts[] = {
- {"ABSTRACT_UNIX_SOCKET", CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOT_STRING, 0},
- {"ACCEPTTIMEOUT_MS", CURLOPT_ACCEPTTIMEOUT_MS, CURLOT_LONG, 0},
- {"ACCEPT_ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, 0},
- {"ADDRESS_SCOPE", CURLOPT_ADDRESS_SCOPE, CURLOT_LONG, 0},
- {"ALTSVC", CURLOPT_ALTSVC, CURLOT_STRING, 0},
- {"ALTSVC_CTRL", CURLOPT_ALTSVC_CTRL, CURLOT_LONG, 0},
- {"APPEND", CURLOPT_APPEND, CURLOT_LONG, 0},
- {"AUTOREFERER", CURLOPT_AUTOREFERER, CURLOT_LONG, 0},
- {"BUFFERSIZE", CURLOPT_BUFFERSIZE, CURLOT_LONG, 0},
- {"CAINFO", CURLOPT_CAINFO, CURLOT_STRING, 0},
- {"CAPATH", CURLOPT_CAPATH, CURLOT_STRING, 0},
- {"CERTINFO", CURLOPT_CERTINFO, CURLOT_LONG, 0},
- {"CHUNK_BGN_FUNCTION", CURLOPT_CHUNK_BGN_FUNCTION, CURLOT_FUNCTION, 0},
- {"CHUNK_DATA", CURLOPT_CHUNK_DATA, CURLOT_CBPTR, 0},
- {"CHUNK_END_FUNCTION", CURLOPT_CHUNK_END_FUNCTION, CURLOT_FUNCTION, 0},
- {"CLOSESOCKETDATA", CURLOPT_CLOSESOCKETDATA, CURLOT_CBPTR, 0},
- {"CLOSESOCKETFUNCTION", CURLOPT_CLOSESOCKETFUNCTION, CURLOT_FUNCTION, 0},
- {"CONNECTTIMEOUT", CURLOPT_CONNECTTIMEOUT, CURLOT_LONG, 0},
- {"CONNECTTIMEOUT_MS", CURLOPT_CONNECTTIMEOUT_MS, CURLOT_LONG, 0},
- {"CONNECT_ONLY", CURLOPT_CONNECT_ONLY, CURLOT_LONG, 0},
- {"CONNECT_TO", CURLOPT_CONNECT_TO, CURLOT_SLIST, 0},
- {"CONV_FROM_NETWORK_FUNCTION", CURLOPT_CONV_FROM_NETWORK_FUNCTION,
- CURLOT_FUNCTION, 0},
- {"CONV_FROM_UTF8_FUNCTION", CURLOPT_CONV_FROM_UTF8_FUNCTION,
- CURLOT_FUNCTION, 0},
- {"CONV_TO_NETWORK_FUNCTION", CURLOPT_CONV_TO_NETWORK_FUNCTION,
- CURLOT_FUNCTION, 0},
- {"COOKIE", CURLOPT_COOKIE, CURLOT_STRING, 0},
- {"COOKIEFILE", CURLOPT_COOKIEFILE, CURLOT_STRING, 0},
- {"COOKIEJAR", CURLOPT_COOKIEJAR, CURLOT_STRING, 0},
- {"COOKIELIST", CURLOPT_COOKIELIST, CURLOT_STRING, 0},
- {"COOKIESESSION", CURLOPT_COOKIESESSION, CURLOT_LONG, 0},
- {"COPYPOSTFIELDS", CURLOPT_COPYPOSTFIELDS, CURLOT_OBJECT, 0},
- {"CRLF", CURLOPT_CRLF, CURLOT_LONG, 0},
- {"CRLFILE", CURLOPT_CRLFILE, CURLOT_STRING, 0},
- {"CURLU", CURLOPT_CURLU, CURLOT_OBJECT, 0},
- {"CUSTOMREQUEST", CURLOPT_CUSTOMREQUEST, CURLOT_STRING, 0},
- {"DEBUGDATA", CURLOPT_DEBUGDATA, CURLOT_CBPTR, 0},
- {"DEBUGFUNCTION", CURLOPT_DEBUGFUNCTION, CURLOT_FUNCTION, 0},
- {"DEFAULT_PROTOCOL", CURLOPT_DEFAULT_PROTOCOL, CURLOT_STRING, 0},
- {"DIRLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, 0},
- {"DISALLOW_USERNAME_IN_URL", CURLOPT_DISALLOW_USERNAME_IN_URL,
- CURLOT_LONG, 0},
- {"DNS_CACHE_TIMEOUT", CURLOPT_DNS_CACHE_TIMEOUT, CURLOT_LONG, 0},
- {"DNS_INTERFACE", CURLOPT_DNS_INTERFACE, CURLOT_STRING, 0},
- {"DNS_LOCAL_IP4", CURLOPT_DNS_LOCAL_IP4, CURLOT_STRING, 0},
- {"DNS_LOCAL_IP6", CURLOPT_DNS_LOCAL_IP6, CURLOT_STRING, 0},
- {"DNS_SERVERS", CURLOPT_DNS_SERVERS, CURLOT_STRING, 0},
- {"DNS_SHUFFLE_ADDRESSES", CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOT_LONG, 0},
- {"DNS_USE_GLOBAL_CACHE", CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOT_LONG, 0},
- {"DOH_URL", CURLOPT_DOH_URL, CURLOT_STRING, 0},
- {"EGDSOCKET", CURLOPT_EGDSOCKET, CURLOT_STRING, 0},
- {"ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, CURLOT_FLAG_ALIAS},
- {"ERRORBUFFER", CURLOPT_ERRORBUFFER, CURLOT_OBJECT, 0},
- {"EXPECT_100_TIMEOUT_MS", CURLOPT_EXPECT_100_TIMEOUT_MS, CURLOT_LONG, 0},
- {"FAILONERROR", CURLOPT_FAILONERROR, CURLOT_LONG, 0},
- {"FILE", CURLOPT_WRITEDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
- {"FILETIME", CURLOPT_FILETIME, CURLOT_LONG, 0},
- {"FNMATCH_DATA", CURLOPT_FNMATCH_DATA, CURLOT_CBPTR, 0},
- {"FNMATCH_FUNCTION", CURLOPT_FNMATCH_FUNCTION, CURLOT_FUNCTION, 0},
- {"FOLLOWLOCATION", CURLOPT_FOLLOWLOCATION, CURLOT_LONG, 0},
- {"FORBID_REUSE", CURLOPT_FORBID_REUSE, CURLOT_LONG, 0},
- {"FRESH_CONNECT", CURLOPT_FRESH_CONNECT, CURLOT_LONG, 0},
- {"FTPAPPEND", CURLOPT_APPEND, CURLOT_LONG, CURLOT_FLAG_ALIAS},
- {"FTPLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, CURLOT_FLAG_ALIAS},
- {"FTPPORT", CURLOPT_FTPPORT, CURLOT_STRING, 0},
- {"FTPSSLAUTH", CURLOPT_FTPSSLAUTH, CURLOT_VALUES, 0},
- {"FTP_ACCOUNT", CURLOPT_FTP_ACCOUNT, CURLOT_STRING, 0},
- {"FTP_ALTERNATIVE_TO_USER", CURLOPT_FTP_ALTERNATIVE_TO_USER,
- CURLOT_STRING, 0},
- {"FTP_CREATE_MISSING_DIRS", CURLOPT_FTP_CREATE_MISSING_DIRS,
- CURLOT_LONG, 0},
- {"FTP_FILEMETHOD", CURLOPT_FTP_FILEMETHOD, CURLOT_VALUES, 0},
- {"FTP_RESPONSE_TIMEOUT", CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOT_LONG, 0},
- {"FTP_SKIP_PASV_IP", CURLOPT_FTP_SKIP_PASV_IP, CURLOT_LONG, 0},
- {"FTP_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, CURLOT_FLAG_ALIAS},
- {"FTP_SSL_CCC", CURLOPT_FTP_SSL_CCC, CURLOT_LONG, 0},
- {"FTP_USE_EPRT", CURLOPT_FTP_USE_EPRT, CURLOT_LONG, 0},
- {"FTP_USE_EPSV", CURLOPT_FTP_USE_EPSV, CURLOT_LONG, 0},
- {"FTP_USE_PRET", CURLOPT_FTP_USE_PRET, CURLOT_LONG, 0},
- {"GSSAPI_DELEGATION", CURLOPT_GSSAPI_DELEGATION, CURLOT_VALUES, 0},
- {"HAPPY_EYEBALLS_TIMEOUT_MS", CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
- CURLOT_LONG, 0},
- {"HAPROXYPROTOCOL", CURLOPT_HAPROXYPROTOCOL, CURLOT_LONG, 0},
- {"HEADER", CURLOPT_HEADER, CURLOT_LONG, 0},
- {"HEADERDATA", CURLOPT_HEADERDATA, CURLOT_CBPTR, 0},
- {"HEADERFUNCTION", CURLOPT_HEADERFUNCTION, CURLOT_FUNCTION, 0},
- {"HEADEROPT", CURLOPT_HEADEROPT, CURLOT_VALUES, 0},
- {"HSTS", CURLOPT_HSTS, CURLOT_STRING, 0},
- {"HSTSREADDATA", CURLOPT_HSTSREADDATA, CURLOT_CBPTR, 0},
- {"HSTSREADFUNCTION", CURLOPT_HSTSREADFUNCTION, CURLOT_FUNCTION, 0},
- {"HSTSWRITEDATA", CURLOPT_HSTSWRITEDATA, CURLOT_CBPTR, 0},
- {"HSTSWRITEFUNCTION", CURLOPT_HSTSWRITEFUNCTION, CURLOT_FUNCTION, 0},
- {"HSTS_CTRL", CURLOPT_HSTS_CTRL, CURLOT_LONG, 0},
- {"HTTP09_ALLOWED", CURLOPT_HTTP09_ALLOWED, CURLOT_LONG, 0},
- {"HTTP200ALIASES", CURLOPT_HTTP200ALIASES, CURLOT_SLIST, 0},
- {"HTTPAUTH", CURLOPT_HTTPAUTH, CURLOT_VALUES, 0},
- {"HTTPGET", CURLOPT_HTTPGET, CURLOT_LONG, 0},
- {"HTTPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, 0},
- {"HTTPPOST", CURLOPT_HTTPPOST, CURLOT_OBJECT, 0},
- {"HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL, CURLOT_LONG, 0},
- {"HTTP_CONTENT_DECODING", CURLOPT_HTTP_CONTENT_DECODING, CURLOT_LONG, 0},
- {"HTTP_TRANSFER_DECODING", CURLOPT_HTTP_TRANSFER_DECODING, CURLOT_LONG, 0},
- {"HTTP_VERSION", CURLOPT_HTTP_VERSION, CURLOT_VALUES, 0},
- {"IGNORE_CONTENT_LENGTH", CURLOPT_IGNORE_CONTENT_LENGTH, CURLOT_LONG, 0},
- {"INFILE", CURLOPT_READDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
- {"INFILESIZE", CURLOPT_INFILESIZE, CURLOT_LONG, 0},
- {"INFILESIZE_LARGE", CURLOPT_INFILESIZE_LARGE, CURLOT_OFF_T, 0},
- {"INTERFACE", CURLOPT_INTERFACE, CURLOT_STRING, 0},
- {"INTERLEAVEDATA", CURLOPT_INTERLEAVEDATA, CURLOT_CBPTR, 0},
- {"INTERLEAVEFUNCTION", CURLOPT_INTERLEAVEFUNCTION, CURLOT_FUNCTION, 0},
- {"IOCTLDATA", CURLOPT_IOCTLDATA, CURLOT_CBPTR, 0},
- {"IOCTLFUNCTION", CURLOPT_IOCTLFUNCTION, CURLOT_FUNCTION, 0},
- {"IPRESOLVE", CURLOPT_IPRESOLVE, CURLOT_VALUES, 0},
- {"ISSUERCERT", CURLOPT_ISSUERCERT, CURLOT_STRING, 0},
- {"ISSUERCERT_BLOB", CURLOPT_ISSUERCERT_BLOB, CURLOT_BLOB, 0},
- {"KEEP_SENDING_ON_ERROR", CURLOPT_KEEP_SENDING_ON_ERROR, CURLOT_LONG, 0},
- {"KEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, 0},
- {"KRB4LEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, CURLOT_FLAG_ALIAS},
- {"KRBLEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, 0},
- {"LOCALPORT", CURLOPT_LOCALPORT, CURLOT_LONG, 0},
- {"LOCALPORTRANGE", CURLOPT_LOCALPORTRANGE, CURLOT_LONG, 0},
- {"LOGIN_OPTIONS", CURLOPT_LOGIN_OPTIONS, CURLOT_STRING, 0},
- {"LOW_SPEED_LIMIT", CURLOPT_LOW_SPEED_LIMIT, CURLOT_LONG, 0},
- {"LOW_SPEED_TIME", CURLOPT_LOW_SPEED_TIME, CURLOT_LONG, 0},
- {"MAIL_AUTH", CURLOPT_MAIL_AUTH, CURLOT_STRING, 0},
- {"MAIL_FROM", CURLOPT_MAIL_FROM, CURLOT_STRING, 0},
- {"MAIL_RCPT", CURLOPT_MAIL_RCPT, CURLOT_SLIST, 0},
- {"MAIL_RCPT_ALLLOWFAILS", CURLOPT_MAIL_RCPT_ALLLOWFAILS, CURLOT_LONG, 0},
- {"MAXAGE_CONN", CURLOPT_MAXAGE_CONN, CURLOT_LONG, 0},
- {"MAXCONNECTS", CURLOPT_MAXCONNECTS, CURLOT_LONG, 0},
- {"MAXFILESIZE", CURLOPT_MAXFILESIZE, CURLOT_LONG, 0},
- {"MAXFILESIZE_LARGE", CURLOPT_MAXFILESIZE_LARGE, CURLOT_OFF_T, 0},
- {"MAXREDIRS", CURLOPT_MAXREDIRS, CURLOT_LONG, 0},
- {"MAX_RECV_SPEED_LARGE", CURLOPT_MAX_RECV_SPEED_LARGE, CURLOT_OFF_T, 0},
- {"MAX_SEND_SPEED_LARGE", CURLOPT_MAX_SEND_SPEED_LARGE, CURLOT_OFF_T, 0},
- {"MIMEPOST", CURLOPT_MIMEPOST, CURLOT_OBJECT, 0},
- {"NETRC", CURLOPT_NETRC, CURLOT_VALUES, 0},
- {"NETRC_FILE", CURLOPT_NETRC_FILE, CURLOT_STRING, 0},
- {"NEW_DIRECTORY_PERMS", CURLOPT_NEW_DIRECTORY_PERMS, CURLOT_LONG, 0},
- {"NEW_FILE_PERMS", CURLOPT_NEW_FILE_PERMS, CURLOT_LONG, 0},
- {"NOBODY", CURLOPT_NOBODY, CURLOT_LONG, 0},
- {"NOPROGRESS", CURLOPT_NOPROGRESS, CURLOT_LONG, 0},
- {"NOPROXY", CURLOPT_NOPROXY, CURLOT_STRING, 0},
- {"NOSIGNAL", CURLOPT_NOSIGNAL, CURLOT_LONG, 0},
- {"OPENSOCKETDATA", CURLOPT_OPENSOCKETDATA, CURLOT_CBPTR, 0},
- {"OPENSOCKETFUNCTION", CURLOPT_OPENSOCKETFUNCTION, CURLOT_FUNCTION, 0},
- {"PASSWORD", CURLOPT_PASSWORD, CURLOT_STRING, 0},
- {"PATH_AS_IS", CURLOPT_PATH_AS_IS, CURLOT_LONG, 0},
- {"PINNEDPUBLICKEY", CURLOPT_PINNEDPUBLICKEY, CURLOT_STRING, 0},
- {"PIPEWAIT", CURLOPT_PIPEWAIT, CURLOT_LONG, 0},
- {"PORT", CURLOPT_PORT, CURLOT_LONG, 0},
- {"POST", CURLOPT_POST, CURLOT_LONG, 0},
- {"POST301", CURLOPT_POSTREDIR, CURLOT_VALUES, CURLOT_FLAG_ALIAS},
- {"POSTFIELDS", CURLOPT_POSTFIELDS, CURLOT_OBJECT, 0},
- {"POSTFIELDSIZE", CURLOPT_POSTFIELDSIZE, CURLOT_LONG, 0},
- {"POSTFIELDSIZE_LARGE", CURLOPT_POSTFIELDSIZE_LARGE, CURLOT_OFF_T, 0},
- {"POSTQUOTE", CURLOPT_POSTQUOTE, CURLOT_SLIST, 0},
- {"POSTREDIR", CURLOPT_POSTREDIR, CURLOT_VALUES, 0},
- {"PREQUOTE", CURLOPT_PREQUOTE, CURLOT_SLIST, 0},
- {"PRE_PROXY", CURLOPT_PRE_PROXY, CURLOT_STRING, 0},
- {"PRIVATE", CURLOPT_PRIVATE, CURLOT_OBJECT, 0},
- {"PROGRESSDATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
- {"PROGRESSFUNCTION", CURLOPT_PROGRESSFUNCTION, CURLOT_FUNCTION, 0},
- {"PROTOCOLS", CURLOPT_PROTOCOLS, CURLOT_LONG, 0},
- {"PROXY", CURLOPT_PROXY, CURLOT_STRING, 0},
- {"PROXYAUTH", CURLOPT_PROXYAUTH, CURLOT_VALUES, 0},
- {"PROXYHEADER", CURLOPT_PROXYHEADER, CURLOT_SLIST, 0},
- {"PROXYPASSWORD", CURLOPT_PROXYPASSWORD, CURLOT_STRING, 0},
- {"PROXYPORT", CURLOPT_PROXYPORT, CURLOT_LONG, 0},
- {"PROXYTYPE", CURLOPT_PROXYTYPE, CURLOT_VALUES, 0},
- {"PROXYUSERNAME", CURLOPT_PROXYUSERNAME, CURLOT_STRING, 0},
- {"PROXYUSERPWD", CURLOPT_PROXYUSERPWD, CURLOT_STRING, 0},
- {"PROXY_CAINFO", CURLOPT_PROXY_CAINFO, CURLOT_STRING, 0},
- {"PROXY_CAPATH", CURLOPT_PROXY_CAPATH, CURLOT_STRING, 0},
- {"PROXY_CRLFILE", CURLOPT_PROXY_CRLFILE, CURLOT_STRING, 0},
- {"PROXY_ISSUERCERT", CURLOPT_PROXY_ISSUERCERT, CURLOT_STRING, 0},
- {"PROXY_ISSUERCERT_BLOB", CURLOPT_PROXY_ISSUERCERT_BLOB, CURLOT_BLOB, 0},
- {"PROXY_KEYPASSWD", CURLOPT_PROXY_KEYPASSWD, CURLOT_STRING, 0},
- {"PROXY_PINNEDPUBLICKEY", CURLOPT_PROXY_PINNEDPUBLICKEY, CURLOT_STRING, 0},
- {"PROXY_SERVICE_NAME", CURLOPT_PROXY_SERVICE_NAME, CURLOT_STRING, 0},
- {"PROXY_SSLCERT", CURLOPT_PROXY_SSLCERT, CURLOT_STRING, 0},
- {"PROXY_SSLCERTTYPE", CURLOPT_PROXY_SSLCERTTYPE, CURLOT_STRING, 0},
- {"PROXY_SSLCERT_BLOB", CURLOPT_PROXY_SSLCERT_BLOB, CURLOT_BLOB, 0},
- {"PROXY_SSLKEY", CURLOPT_PROXY_SSLKEY, CURLOT_STRING, 0},
- {"PROXY_SSLKEYTYPE", CURLOPT_PROXY_SSLKEYTYPE, CURLOT_STRING, 0},
- {"PROXY_SSLKEY_BLOB", CURLOPT_PROXY_SSLKEY_BLOB, CURLOT_BLOB, 0},
- {"PROXY_SSLVERSION", CURLOPT_PROXY_SSLVERSION, CURLOT_VALUES, 0},
- {"PROXY_SSL_CIPHER_LIST", CURLOPT_PROXY_SSL_CIPHER_LIST, CURLOT_STRING, 0},
- {"PROXY_SSL_OPTIONS", CURLOPT_PROXY_SSL_OPTIONS, CURLOT_LONG, 0},
- {"PROXY_SSL_VERIFYHOST", CURLOPT_PROXY_SSL_VERIFYHOST, CURLOT_LONG, 0},
- {"PROXY_SSL_VERIFYPEER", CURLOPT_PROXY_SSL_VERIFYPEER, CURLOT_LONG, 0},
- {"PROXY_TLS13_CIPHERS", CURLOPT_PROXY_TLS13_CIPHERS, CURLOT_STRING, 0},
- {"PROXY_TLSAUTH_PASSWORD", CURLOPT_PROXY_TLSAUTH_PASSWORD,
- CURLOT_STRING, 0},
- {"PROXY_TLSAUTH_TYPE", CURLOPT_PROXY_TLSAUTH_TYPE, CURLOT_STRING, 0},
- {"PROXY_TLSAUTH_USERNAME", CURLOPT_PROXY_TLSAUTH_USERNAME,
- CURLOT_STRING, 0},
- {"PROXY_TRANSFER_MODE", CURLOPT_PROXY_TRANSFER_MODE, CURLOT_LONG, 0},
- {"PUT", CURLOPT_PUT, CURLOT_LONG, 0},
- {"QUOTE", CURLOPT_QUOTE, CURLOT_SLIST, 0},
- {"RANDOM_FILE", CURLOPT_RANDOM_FILE, CURLOT_STRING, 0},
- {"RANGE", CURLOPT_RANGE, CURLOT_STRING, 0},
- {"READDATA", CURLOPT_READDATA, CURLOT_CBPTR, 0},
- {"READFUNCTION", CURLOPT_READFUNCTION, CURLOT_FUNCTION, 0},
- {"REDIR_PROTOCOLS", CURLOPT_REDIR_PROTOCOLS, CURLOT_LONG, 0},
- {"REFERER", CURLOPT_REFERER, CURLOT_STRING, 0},
- {"REQUEST_TARGET", CURLOPT_REQUEST_TARGET, CURLOT_STRING, 0},
- {"RESOLVE", CURLOPT_RESOLVE, CURLOT_SLIST, 0},
- {"RESOLVER_START_DATA", CURLOPT_RESOLVER_START_DATA, CURLOT_CBPTR, 0},
- {"RESOLVER_START_FUNCTION", CURLOPT_RESOLVER_START_FUNCTION,
- CURLOT_FUNCTION, 0},
- {"RESUME_FROM", CURLOPT_RESUME_FROM, CURLOT_LONG, 0},
- {"RESUME_FROM_LARGE", CURLOPT_RESUME_FROM_LARGE, CURLOT_OFF_T, 0},
- {"RTSPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, CURLOT_FLAG_ALIAS},
- {"RTSP_CLIENT_CSEQ", CURLOPT_RTSP_CLIENT_CSEQ, CURLOT_LONG, 0},
- {"RTSP_REQUEST", CURLOPT_RTSP_REQUEST, CURLOT_VALUES, 0},
- {"RTSP_SERVER_CSEQ", CURLOPT_RTSP_SERVER_CSEQ, CURLOT_LONG, 0},
- {"RTSP_SESSION_ID", CURLOPT_RTSP_SESSION_ID, CURLOT_STRING, 0},
- {"RTSP_STREAM_URI", CURLOPT_RTSP_STREAM_URI, CURLOT_STRING, 0},
- {"RTSP_TRANSPORT", CURLOPT_RTSP_TRANSPORT, CURLOT_STRING, 0},
- {"SASL_AUTHZID", CURLOPT_SASL_AUTHZID, CURLOT_STRING, 0},
- {"SASL_IR", CURLOPT_SASL_IR, CURLOT_LONG, 0},
- {"SEEKDATA", CURLOPT_SEEKDATA, CURLOT_CBPTR, 0},
- {"SEEKFUNCTION", CURLOPT_SEEKFUNCTION, CURLOT_FUNCTION, 0},
- {"SERVER_RESPONSE_TIMEOUT", CURLOPT_FTP_RESPONSE_TIMEOUT,
- CURLOT_LONG, CURLOT_FLAG_ALIAS},
- {"SERVICE_NAME", CURLOPT_SERVICE_NAME, CURLOT_STRING, 0},
- {"SHARE", CURLOPT_SHARE, CURLOT_OBJECT, 0},
- {"SOCKOPTDATA", CURLOPT_SOCKOPTDATA, CURLOT_CBPTR, 0},
- {"SOCKOPTFUNCTION", CURLOPT_SOCKOPTFUNCTION, CURLOT_FUNCTION, 0},
- {"SOCKS5_AUTH", CURLOPT_SOCKS5_AUTH, CURLOT_LONG, 0},
- {"SOCKS5_GSSAPI_NEC", CURLOPT_SOCKS5_GSSAPI_NEC, CURLOT_LONG, 0},
- {"SOCKS5_GSSAPI_SERVICE", CURLOPT_SOCKS5_GSSAPI_SERVICE, CURLOT_STRING, 0},
- {"SSH_AUTH_TYPES", CURLOPT_SSH_AUTH_TYPES, CURLOT_VALUES, 0},
- {"SSH_COMPRESSION", CURLOPT_SSH_COMPRESSION, CURLOT_LONG, 0},
- {"SSH_HOST_PUBLIC_KEY_MD5", CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
- CURLOT_STRING, 0},
- {"SSH_KEYDATA", CURLOPT_SSH_KEYDATA, CURLOT_CBPTR, 0},
- {"SSH_KEYFUNCTION", CURLOPT_SSH_KEYFUNCTION, CURLOT_FUNCTION, 0},
- {"SSH_KNOWNHOSTS", CURLOPT_SSH_KNOWNHOSTS, CURLOT_STRING, 0},
- {"SSH_PRIVATE_KEYFILE", CURLOPT_SSH_PRIVATE_KEYFILE, CURLOT_STRING, 0},
- {"SSH_PUBLIC_KEYFILE", CURLOPT_SSH_PUBLIC_KEYFILE, CURLOT_STRING, 0},
- {"SSLCERT", CURLOPT_SSLCERT, CURLOT_STRING, 0},
- {"SSLCERTPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS},
- {"SSLCERTTYPE", CURLOPT_SSLCERTTYPE, CURLOT_STRING, 0},
- {"SSLCERT_BLOB", CURLOPT_SSLCERT_BLOB, CURLOT_BLOB, 0},
- {"SSLENGINE", CURLOPT_SSLENGINE, CURLOT_STRING, 0},
- {"SSLENGINE_DEFAULT", CURLOPT_SSLENGINE_DEFAULT, CURLOT_LONG, 0},
- {"SSLKEY", CURLOPT_SSLKEY, CURLOT_STRING, 0},
- {"SSLKEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS},
- {"SSLKEYTYPE", CURLOPT_SSLKEYTYPE, CURLOT_STRING, 0},
- {"SSLKEY_BLOB", CURLOPT_SSLKEY_BLOB, CURLOT_BLOB, 0},
- {"SSLVERSION", CURLOPT_SSLVERSION, CURLOT_VALUES, 0},
- {"SSL_CIPHER_LIST", CURLOPT_SSL_CIPHER_LIST, CURLOT_STRING, 0},
- {"SSL_CTX_DATA", CURLOPT_SSL_CTX_DATA, CURLOT_CBPTR, 0},
- {"SSL_CTX_FUNCTION", CURLOPT_SSL_CTX_FUNCTION, CURLOT_FUNCTION, 0},
- {"SSL_EC_CURVES", CURLOPT_SSL_EC_CURVES, CURLOT_STRING, 0},
- {"SSL_ENABLE_ALPN", CURLOPT_SSL_ENABLE_ALPN, CURLOT_LONG, 0},
- {"SSL_ENABLE_NPN", CURLOPT_SSL_ENABLE_NPN, CURLOT_LONG, 0},
- {"SSL_FALSESTART", CURLOPT_SSL_FALSESTART, CURLOT_LONG, 0},
- {"SSL_OPTIONS", CURLOPT_SSL_OPTIONS, CURLOT_VALUES, 0},
- {"SSL_SESSIONID_CACHE", CURLOPT_SSL_SESSIONID_CACHE, CURLOT_LONG, 0},
- {"SSL_VERIFYHOST", CURLOPT_SSL_VERIFYHOST, CURLOT_LONG, 0},
- {"SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER, CURLOT_LONG, 0},
- {"SSL_VERIFYSTATUS", CURLOPT_SSL_VERIFYSTATUS, CURLOT_LONG, 0},
- {"STDERR", CURLOPT_STDERR, CURLOT_OBJECT, 0},
- {"STREAM_DEPENDS", CURLOPT_STREAM_DEPENDS, CURLOT_OBJECT, 0},
- {"STREAM_DEPENDS_E", CURLOPT_STREAM_DEPENDS_E, CURLOT_OBJECT, 0},
- {"STREAM_WEIGHT", CURLOPT_STREAM_WEIGHT, CURLOT_LONG, 0},
- {"SUPPRESS_CONNECT_HEADERS", CURLOPT_SUPPRESS_CONNECT_HEADERS,
- CURLOT_LONG, 0},
- {"TCP_FASTOPEN", CURLOPT_TCP_FASTOPEN, CURLOT_LONG, 0},
- {"TCP_KEEPALIVE", CURLOPT_TCP_KEEPALIVE, CURLOT_LONG, 0},
- {"TCP_KEEPIDLE", CURLOPT_TCP_KEEPIDLE, CURLOT_LONG, 0},
- {"TCP_KEEPINTVL", CURLOPT_TCP_KEEPINTVL, CURLOT_LONG, 0},
- {"TCP_NODELAY", CURLOPT_TCP_NODELAY, CURLOT_LONG, 0},
- {"TELNETOPTIONS", CURLOPT_TELNETOPTIONS, CURLOT_SLIST, 0},
- {"TFTP_BLKSIZE", CURLOPT_TFTP_BLKSIZE, CURLOT_LONG, 0},
- {"TFTP_NO_OPTIONS", CURLOPT_TFTP_NO_OPTIONS, CURLOT_LONG, 0},
- {"TIMECONDITION", CURLOPT_TIMECONDITION, CURLOT_VALUES, 0},
- {"TIMEOUT", CURLOPT_TIMEOUT, CURLOT_LONG, 0},
- {"TIMEOUT_MS", CURLOPT_TIMEOUT_MS, CURLOT_LONG, 0},
- {"TIMEVALUE", CURLOPT_TIMEVALUE, CURLOT_LONG, 0},
- {"TIMEVALUE_LARGE", CURLOPT_TIMEVALUE_LARGE, CURLOT_OFF_T, 0},
- {"TLS13_CIPHERS", CURLOPT_TLS13_CIPHERS, CURLOT_STRING, 0},
- {"TLSAUTH_PASSWORD", CURLOPT_TLSAUTH_PASSWORD, CURLOT_STRING, 0},
- {"TLSAUTH_TYPE", CURLOPT_TLSAUTH_TYPE, CURLOT_STRING, 0},
- {"TLSAUTH_USERNAME", CURLOPT_TLSAUTH_USERNAME, CURLOT_STRING, 0},
- {"TRAILERDATA", CURLOPT_TRAILERDATA, CURLOT_CBPTR, 0},
- {"TRAILERFUNCTION", CURLOPT_TRAILERFUNCTION, CURLOT_FUNCTION, 0},
- {"TRANSFERTEXT", CURLOPT_TRANSFERTEXT, CURLOT_LONG, 0},
- {"TRANSFER_ENCODING", CURLOPT_TRANSFER_ENCODING, CURLOT_LONG, 0},
- {"UNIX_SOCKET_PATH", CURLOPT_UNIX_SOCKET_PATH, CURLOT_STRING, 0},
- {"UNRESTRICTED_AUTH", CURLOPT_UNRESTRICTED_AUTH, CURLOT_LONG, 0},
- {"UPKEEP_INTERVAL_MS", CURLOPT_UPKEEP_INTERVAL_MS, CURLOT_LONG, 0},
- {"UPLOAD", CURLOPT_UPLOAD, CURLOT_LONG, 0},
- {"UPLOAD_BUFFERSIZE", CURLOPT_UPLOAD_BUFFERSIZE, CURLOT_LONG, 0},
- {"URL", CURLOPT_URL, CURLOT_STRING, 0},
- {"USERAGENT", CURLOPT_USERAGENT, CURLOT_STRING, 0},
- {"USERNAME", CURLOPT_USERNAME, CURLOT_STRING, 0},
- {"USERPWD", CURLOPT_USERPWD, CURLOT_STRING, 0},
- {"USE_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, 0},
- {"VERBOSE", CURLOPT_VERBOSE, CURLOT_LONG, 0},
- {"WILDCARDMATCH", CURLOPT_WILDCARDMATCH, CURLOT_LONG, 0},
- {"WRITEDATA", CURLOPT_WRITEDATA, CURLOT_CBPTR, 0},
- {"WRITEFUNCTION", CURLOPT_WRITEFUNCTION, CURLOT_FUNCTION, 0},
- {"WRITEHEADER", CURLOPT_HEADERDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
- {"XFERINFODATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, 0},
- {"XFERINFOFUNCTION", CURLOPT_XFERINFOFUNCTION, CURLOT_FUNCTION, 0},
- {"XOAUTH2_BEARER", CURLOPT_XOAUTH2_BEARER, CURLOT_STRING, 0},
- {NULL, CURLOPT_LASTENTRY, 0, 0} /* end of table */
-};
-
-#ifdef DEBUGBUILD
-/*
- * Curl_easyopts_check() is a debug-only function that returns non-zero
- * if this source file is not in sync with the options listed in curl/curl.h
- */
-int Curl_easyopts_check(void)
-{
- return (CURLOPT_LASTENTRY != (304 + 1));
-}
-#endif
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ | |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * ___|___/|_| ______|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel.se>, 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.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.
+ *
+ ***************************************************************************/
+
+/* This source code is generated by optiontable.pl - DO NOT EDIT BY HAND */
+
+#include "curl_setup.h"
+#include "easyoptions.h"
+
+/* all easy setopt options listed in alphabetical order */
+struct curl_easyoption Curl_easyopts[] = {
+ {"ABSTRACT_UNIX_SOCKET", CURLOPT_ABSTRACT_UNIX_SOCKET, CURLOT_STRING, 0},
+ {"ACCEPTTIMEOUT_MS", CURLOPT_ACCEPTTIMEOUT_MS, CURLOT_LONG, 0},
+ {"ACCEPT_ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, 0},
+ {"ADDRESS_SCOPE", CURLOPT_ADDRESS_SCOPE, CURLOT_LONG, 0},
+ {"ALTSVC", CURLOPT_ALTSVC, CURLOT_STRING, 0},
+ {"ALTSVC_CTRL", CURLOPT_ALTSVC_CTRL, CURLOT_LONG, 0},
+ {"APPEND", CURLOPT_APPEND, CURLOT_LONG, 0},
+ {"AUTOREFERER", CURLOPT_AUTOREFERER, CURLOT_LONG, 0},
+ {"BUFFERSIZE", CURLOPT_BUFFERSIZE, CURLOT_LONG, 0},
+ {"CAINFO", CURLOPT_CAINFO, CURLOT_STRING, 0},
+ {"CAPATH", CURLOPT_CAPATH, CURLOT_STRING, 0},
+ {"CERTINFO", CURLOPT_CERTINFO, CURLOT_LONG, 0},
+ {"CHUNK_BGN_FUNCTION", CURLOPT_CHUNK_BGN_FUNCTION, CURLOT_FUNCTION, 0},
+ {"CHUNK_DATA", CURLOPT_CHUNK_DATA, CURLOT_CBPTR, 0},
+ {"CHUNK_END_FUNCTION", CURLOPT_CHUNK_END_FUNCTION, CURLOT_FUNCTION, 0},
+ {"CLOSESOCKETDATA", CURLOPT_CLOSESOCKETDATA, CURLOT_CBPTR, 0},
+ {"CLOSESOCKETFUNCTION", CURLOPT_CLOSESOCKETFUNCTION, CURLOT_FUNCTION, 0},
+ {"CONNECTTIMEOUT", CURLOPT_CONNECTTIMEOUT, CURLOT_LONG, 0},
+ {"CONNECTTIMEOUT_MS", CURLOPT_CONNECTTIMEOUT_MS, CURLOT_LONG, 0},
+ {"CONNECT_ONLY", CURLOPT_CONNECT_ONLY, CURLOT_LONG, 0},
+ {"CONNECT_TO", CURLOPT_CONNECT_TO, CURLOT_SLIST, 0},
+ {"CONV_FROM_NETWORK_FUNCTION", CURLOPT_CONV_FROM_NETWORK_FUNCTION,
+ CURLOT_FUNCTION, 0},
+ {"CONV_FROM_UTF8_FUNCTION", CURLOPT_CONV_FROM_UTF8_FUNCTION,
+ CURLOT_FUNCTION, 0},
+ {"CONV_TO_NETWORK_FUNCTION", CURLOPT_CONV_TO_NETWORK_FUNCTION,
+ CURLOT_FUNCTION, 0},
+ {"COOKIE", CURLOPT_COOKIE, CURLOT_STRING, 0},
+ {"COOKIEFILE", CURLOPT_COOKIEFILE, CURLOT_STRING, 0},
+ {"COOKIEJAR", CURLOPT_COOKIEJAR, CURLOT_STRING, 0},
+ {"COOKIELIST", CURLOPT_COOKIELIST, CURLOT_STRING, 0},
+ {"COOKIESESSION", CURLOPT_COOKIESESSION, CURLOT_LONG, 0},
+ {"COPYPOSTFIELDS", CURLOPT_COPYPOSTFIELDS, CURLOT_OBJECT, 0},
+ {"CRLF", CURLOPT_CRLF, CURLOT_LONG, 0},
+ {"CRLFILE", CURLOPT_CRLFILE, CURLOT_STRING, 0},
+ {"CURLU", CURLOPT_CURLU, CURLOT_OBJECT, 0},
+ {"CUSTOMREQUEST", CURLOPT_CUSTOMREQUEST, CURLOT_STRING, 0},
+ {"DEBUGDATA", CURLOPT_DEBUGDATA, CURLOT_CBPTR, 0},
+ {"DEBUGFUNCTION", CURLOPT_DEBUGFUNCTION, CURLOT_FUNCTION, 0},
+ {"DEFAULT_PROTOCOL", CURLOPT_DEFAULT_PROTOCOL, CURLOT_STRING, 0},
+ {"DIRLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, 0},
+ {"DISALLOW_USERNAME_IN_URL", CURLOPT_DISALLOW_USERNAME_IN_URL,
+ CURLOT_LONG, 0},
+ {"DNS_CACHE_TIMEOUT", CURLOPT_DNS_CACHE_TIMEOUT, CURLOT_LONG, 0},
+ {"DNS_INTERFACE", CURLOPT_DNS_INTERFACE, CURLOT_STRING, 0},
+ {"DNS_LOCAL_IP4", CURLOPT_DNS_LOCAL_IP4, CURLOT_STRING, 0},
+ {"DNS_LOCAL_IP6", CURLOPT_DNS_LOCAL_IP6, CURLOT_STRING, 0},
+ {"DNS_SERVERS", CURLOPT_DNS_SERVERS, CURLOT_STRING, 0},
+ {"DNS_SHUFFLE_ADDRESSES", CURLOPT_DNS_SHUFFLE_ADDRESSES, CURLOT_LONG, 0},
+ {"DNS_USE_GLOBAL_CACHE", CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOT_LONG, 0},
+ {"DOH_URL", CURLOPT_DOH_URL, CURLOT_STRING, 0},
+ {"EGDSOCKET", CURLOPT_EGDSOCKET, CURLOT_STRING, 0},
+ {"ENCODING", CURLOPT_ACCEPT_ENCODING, CURLOT_STRING, CURLOT_FLAG_ALIAS},
+ {"ERRORBUFFER", CURLOPT_ERRORBUFFER, CURLOT_OBJECT, 0},
+ {"EXPECT_100_TIMEOUT_MS", CURLOPT_EXPECT_100_TIMEOUT_MS, CURLOT_LONG, 0},
+ {"FAILONERROR", CURLOPT_FAILONERROR, CURLOT_LONG, 0},
+ {"FILE", CURLOPT_WRITEDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
+ {"FILETIME", CURLOPT_FILETIME, CURLOT_LONG, 0},
+ {"FNMATCH_DATA", CURLOPT_FNMATCH_DATA, CURLOT_CBPTR, 0},
+ {"FNMATCH_FUNCTION", CURLOPT_FNMATCH_FUNCTION, CURLOT_FUNCTION, 0},
+ {"FOLLOWLOCATION", CURLOPT_FOLLOWLOCATION, CURLOT_LONG, 0},
+ {"FORBID_REUSE", CURLOPT_FORBID_REUSE, CURLOT_LONG, 0},
+ {"FRESH_CONNECT", CURLOPT_FRESH_CONNECT, CURLOT_LONG, 0},
+ {"FTPAPPEND", CURLOPT_APPEND, CURLOT_LONG, CURLOT_FLAG_ALIAS},
+ {"FTPLISTONLY", CURLOPT_DIRLISTONLY, CURLOT_LONG, CURLOT_FLAG_ALIAS},
+ {"FTPPORT", CURLOPT_FTPPORT, CURLOT_STRING, 0},
+ {"FTPSSLAUTH", CURLOPT_FTPSSLAUTH, CURLOT_VALUES, 0},
+ {"FTP_ACCOUNT", CURLOPT_FTP_ACCOUNT, CURLOT_STRING, 0},
+ {"FTP_ALTERNATIVE_TO_USER", CURLOPT_FTP_ALTERNATIVE_TO_USER,
+ CURLOT_STRING, 0},
+ {"FTP_CREATE_MISSING_DIRS", CURLOPT_FTP_CREATE_MISSING_DIRS,
+ CURLOT_LONG, 0},
+ {"FTP_FILEMETHOD", CURLOPT_FTP_FILEMETHOD, CURLOT_VALUES, 0},
+ {"FTP_RESPONSE_TIMEOUT", CURLOPT_FTP_RESPONSE_TIMEOUT, CURLOT_LONG, 0},
+ {"FTP_SKIP_PASV_IP", CURLOPT_FTP_SKIP_PASV_IP, CURLOT_LONG, 0},
+ {"FTP_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, CURLOT_FLAG_ALIAS},
+ {"FTP_SSL_CCC", CURLOPT_FTP_SSL_CCC, CURLOT_LONG, 0},
+ {"FTP_USE_EPRT", CURLOPT_FTP_USE_EPRT, CURLOT_LONG, 0},
+ {"FTP_USE_EPSV", CURLOPT_FTP_USE_EPSV, CURLOT_LONG, 0},
+ {"FTP_USE_PRET", CURLOPT_FTP_USE_PRET, CURLOT_LONG, 0},
+ {"GSSAPI_DELEGATION", CURLOPT_GSSAPI_DELEGATION, CURLOT_VALUES, 0},
+ {"HAPPY_EYEBALLS_TIMEOUT_MS", CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
+ CURLOT_LONG, 0},
+ {"HAPROXYPROTOCOL", CURLOPT_HAPROXYPROTOCOL, CURLOT_LONG, 0},
+ {"HEADER", CURLOPT_HEADER, CURLOT_LONG, 0},
+ {"HEADERDATA", CURLOPT_HEADERDATA, CURLOT_CBPTR, 0},
+ {"HEADERFUNCTION", CURLOPT_HEADERFUNCTION, CURLOT_FUNCTION, 0},
+ {"HEADEROPT", CURLOPT_HEADEROPT, CURLOT_VALUES, 0},
+ {"HSTS", CURLOPT_HSTS, CURLOT_STRING, 0},
+ {"HSTSREADDATA", CURLOPT_HSTSREADDATA, CURLOT_CBPTR, 0},
+ {"HSTSREADFUNCTION", CURLOPT_HSTSREADFUNCTION, CURLOT_FUNCTION, 0},
+ {"HSTSWRITEDATA", CURLOPT_HSTSWRITEDATA, CURLOT_CBPTR, 0},
+ {"HSTSWRITEFUNCTION", CURLOPT_HSTSWRITEFUNCTION, CURLOT_FUNCTION, 0},
+ {"HSTS_CTRL", CURLOPT_HSTS_CTRL, CURLOT_LONG, 0},
+ {"HTTP09_ALLOWED", CURLOPT_HTTP09_ALLOWED, CURLOT_LONG, 0},
+ {"HTTP200ALIASES", CURLOPT_HTTP200ALIASES, CURLOT_SLIST, 0},
+ {"HTTPAUTH", CURLOPT_HTTPAUTH, CURLOT_VALUES, 0},
+ {"HTTPGET", CURLOPT_HTTPGET, CURLOT_LONG, 0},
+ {"HTTPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, 0},
+ {"HTTPPOST", CURLOPT_HTTPPOST, CURLOT_OBJECT, 0},
+ {"HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL, CURLOT_LONG, 0},
+ {"HTTP_CONTENT_DECODING", CURLOPT_HTTP_CONTENT_DECODING, CURLOT_LONG, 0},
+ {"HTTP_TRANSFER_DECODING", CURLOPT_HTTP_TRANSFER_DECODING, CURLOT_LONG, 0},
+ {"HTTP_VERSION", CURLOPT_HTTP_VERSION, CURLOT_VALUES, 0},
+ {"IGNORE_CONTENT_LENGTH", CURLOPT_IGNORE_CONTENT_LENGTH, CURLOT_LONG, 0},
+ {"INFILE", CURLOPT_READDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
+ {"INFILESIZE", CURLOPT_INFILESIZE, CURLOT_LONG, 0},
+ {"INFILESIZE_LARGE", CURLOPT_INFILESIZE_LARGE, CURLOT_OFF_T, 0},
+ {"INTERFACE", CURLOPT_INTERFACE, CURLOT_STRING, 0},
+ {"INTERLEAVEDATA", CURLOPT_INTERLEAVEDATA, CURLOT_CBPTR, 0},
+ {"INTERLEAVEFUNCTION", CURLOPT_INTERLEAVEFUNCTION, CURLOT_FUNCTION, 0},
+ {"IOCTLDATA", CURLOPT_IOCTLDATA, CURLOT_CBPTR, 0},
+ {"IOCTLFUNCTION", CURLOPT_IOCTLFUNCTION, CURLOT_FUNCTION, 0},
+ {"IPRESOLVE", CURLOPT_IPRESOLVE, CURLOT_VALUES, 0},
+ {"ISSUERCERT", CURLOPT_ISSUERCERT, CURLOT_STRING, 0},
+ {"ISSUERCERT_BLOB", CURLOPT_ISSUERCERT_BLOB, CURLOT_BLOB, 0},
+ {"KEEP_SENDING_ON_ERROR", CURLOPT_KEEP_SENDING_ON_ERROR, CURLOT_LONG, 0},
+ {"KEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, 0},
+ {"KRB4LEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, CURLOT_FLAG_ALIAS},
+ {"KRBLEVEL", CURLOPT_KRBLEVEL, CURLOT_STRING, 0},
+ {"LOCALPORT", CURLOPT_LOCALPORT, CURLOT_LONG, 0},
+ {"LOCALPORTRANGE", CURLOPT_LOCALPORTRANGE, CURLOT_LONG, 0},
+ {"LOGIN_OPTIONS", CURLOPT_LOGIN_OPTIONS, CURLOT_STRING, 0},
+ {"LOW_SPEED_LIMIT", CURLOPT_LOW_SPEED_LIMIT, CURLOT_LONG, 0},
+ {"LOW_SPEED_TIME", CURLOPT_LOW_SPEED_TIME, CURLOT_LONG, 0},
+ {"MAIL_AUTH", CURLOPT_MAIL_AUTH, CURLOT_STRING, 0},
+ {"MAIL_FROM", CURLOPT_MAIL_FROM, CURLOT_STRING, 0},
+ {"MAIL_RCPT", CURLOPT_MAIL_RCPT, CURLOT_SLIST, 0},
+ {"MAIL_RCPT_ALLLOWFAILS", CURLOPT_MAIL_RCPT_ALLLOWFAILS, CURLOT_LONG, 0},
+ {"MAXAGE_CONN", CURLOPT_MAXAGE_CONN, CURLOT_LONG, 0},
+ {"MAXCONNECTS", CURLOPT_MAXCONNECTS, CURLOT_LONG, 0},
+ {"MAXFILESIZE", CURLOPT_MAXFILESIZE, CURLOT_LONG, 0},
+ {"MAXFILESIZE_LARGE", CURLOPT_MAXFILESIZE_LARGE, CURLOT_OFF_T, 0},
+ {"MAXREDIRS", CURLOPT_MAXREDIRS, CURLOT_LONG, 0},
+ {"MAX_RECV_SPEED_LARGE", CURLOPT_MAX_RECV_SPEED_LARGE, CURLOT_OFF_T, 0},
+ {"MAX_SEND_SPEED_LARGE", CURLOPT_MAX_SEND_SPEED_LARGE, CURLOT_OFF_T, 0},
+ {"MIMEPOST", CURLOPT_MIMEPOST, CURLOT_OBJECT, 0},
+ {"NETRC", CURLOPT_NETRC, CURLOT_VALUES, 0},
+ {"NETRC_FILE", CURLOPT_NETRC_FILE, CURLOT_STRING, 0},
+ {"NEW_DIRECTORY_PERMS", CURLOPT_NEW_DIRECTORY_PERMS, CURLOT_LONG, 0},
+ {"NEW_FILE_PERMS", CURLOPT_NEW_FILE_PERMS, CURLOT_LONG, 0},
+ {"NOBODY", CURLOPT_NOBODY, CURLOT_LONG, 0},
+ {"NOPROGRESS", CURLOPT_NOPROGRESS, CURLOT_LONG, 0},
+ {"NOPROXY", CURLOPT_NOPROXY, CURLOT_STRING, 0},
+ {"NOSIGNAL", CURLOPT_NOSIGNAL, CURLOT_LONG, 0},
+ {"OPENSOCKETDATA", CURLOPT_OPENSOCKETDATA, CURLOT_CBPTR, 0},
+ {"OPENSOCKETFUNCTION", CURLOPT_OPENSOCKETFUNCTION, CURLOT_FUNCTION, 0},
+ {"PASSWORD", CURLOPT_PASSWORD, CURLOT_STRING, 0},
+ {"PATH_AS_IS", CURLOPT_PATH_AS_IS, CURLOT_LONG, 0},
+ {"PINNEDPUBLICKEY", CURLOPT_PINNEDPUBLICKEY, CURLOT_STRING, 0},
+ {"PIPEWAIT", CURLOPT_PIPEWAIT, CURLOT_LONG, 0},
+ {"PORT", CURLOPT_PORT, CURLOT_LONG, 0},
+ {"POST", CURLOPT_POST, CURLOT_LONG, 0},
+ {"POST301", CURLOPT_POSTREDIR, CURLOT_VALUES, CURLOT_FLAG_ALIAS},
+ {"POSTFIELDS", CURLOPT_POSTFIELDS, CURLOT_OBJECT, 0},
+ {"POSTFIELDSIZE", CURLOPT_POSTFIELDSIZE, CURLOT_LONG, 0},
+ {"POSTFIELDSIZE_LARGE", CURLOPT_POSTFIELDSIZE_LARGE, CURLOT_OFF_T, 0},
+ {"POSTQUOTE", CURLOPT_POSTQUOTE, CURLOT_SLIST, 0},
+ {"POSTREDIR", CURLOPT_POSTREDIR, CURLOT_VALUES, 0},
+ {"PREQUOTE", CURLOPT_PREQUOTE, CURLOT_SLIST, 0},
+ {"PRE_PROXY", CURLOPT_PRE_PROXY, CURLOT_STRING, 0},
+ {"PRIVATE", CURLOPT_PRIVATE, CURLOT_OBJECT, 0},
+ {"PROGRESSDATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
+ {"PROGRESSFUNCTION", CURLOPT_PROGRESSFUNCTION, CURLOT_FUNCTION, 0},
+ {"PROTOCOLS", CURLOPT_PROTOCOLS, CURLOT_LONG, 0},
+ {"PROXY", CURLOPT_PROXY, CURLOT_STRING, 0},
+ {"PROXYAUTH", CURLOPT_PROXYAUTH, CURLOT_VALUES, 0},
+ {"PROXYHEADER", CURLOPT_PROXYHEADER, CURLOT_SLIST, 0},
+ {"PROXYPASSWORD", CURLOPT_PROXYPASSWORD, CURLOT_STRING, 0},
+ {"PROXYPORT", CURLOPT_PROXYPORT, CURLOT_LONG, 0},
+ {"PROXYTYPE", CURLOPT_PROXYTYPE, CURLOT_VALUES, 0},
+ {"PROXYUSERNAME", CURLOPT_PROXYUSERNAME, CURLOT_STRING, 0},
+ {"PROXYUSERPWD", CURLOPT_PROXYUSERPWD, CURLOT_STRING, 0},
+ {"PROXY_CAINFO", CURLOPT_PROXY_CAINFO, CURLOT_STRING, 0},
+ {"PROXY_CAPATH", CURLOPT_PROXY_CAPATH, CURLOT_STRING, 0},
+ {"PROXY_CRLFILE", CURLOPT_PROXY_CRLFILE, CURLOT_STRING, 0},
+ {"PROXY_ISSUERCERT", CURLOPT_PROXY_ISSUERCERT, CURLOT_STRING, 0},
+ {"PROXY_ISSUERCERT_BLOB", CURLOPT_PROXY_ISSUERCERT_BLOB, CURLOT_BLOB, 0},
+ {"PROXY_KEYPASSWD", CURLOPT_PROXY_KEYPASSWD, CURLOT_STRING, 0},
+ {"PROXY_PINNEDPUBLICKEY", CURLOPT_PROXY_PINNEDPUBLICKEY, CURLOT_STRING, 0},
+ {"PROXY_SERVICE_NAME", CURLOPT_PROXY_SERVICE_NAME, CURLOT_STRING, 0},
+ {"PROXY_SSLCERT", CURLOPT_PROXY_SSLCERT, CURLOT_STRING, 0},
+ {"PROXY_SSLCERTTYPE", CURLOPT_PROXY_SSLCERTTYPE, CURLOT_STRING, 0},
+ {"PROXY_SSLCERT_BLOB", CURLOPT_PROXY_SSLCERT_BLOB, CURLOT_BLOB, 0},
+ {"PROXY_SSLKEY", CURLOPT_PROXY_SSLKEY, CURLOT_STRING, 0},
+ {"PROXY_SSLKEYTYPE", CURLOPT_PROXY_SSLKEYTYPE, CURLOT_STRING, 0},
+ {"PROXY_SSLKEY_BLOB", CURLOPT_PROXY_SSLKEY_BLOB, CURLOT_BLOB, 0},
+ {"PROXY_SSLVERSION", CURLOPT_PROXY_SSLVERSION, CURLOT_VALUES, 0},
+ {"PROXY_SSL_CIPHER_LIST", CURLOPT_PROXY_SSL_CIPHER_LIST, CURLOT_STRING, 0},
+ {"PROXY_SSL_OPTIONS", CURLOPT_PROXY_SSL_OPTIONS, CURLOT_LONG, 0},
+ {"PROXY_SSL_VERIFYHOST", CURLOPT_PROXY_SSL_VERIFYHOST, CURLOT_LONG, 0},
+ {"PROXY_SSL_VERIFYPEER", CURLOPT_PROXY_SSL_VERIFYPEER, CURLOT_LONG, 0},
+ {"PROXY_TLS13_CIPHERS", CURLOPT_PROXY_TLS13_CIPHERS, CURLOT_STRING, 0},
+ {"PROXY_TLSAUTH_PASSWORD", CURLOPT_PROXY_TLSAUTH_PASSWORD,
+ CURLOT_STRING, 0},
+ {"PROXY_TLSAUTH_TYPE", CURLOPT_PROXY_TLSAUTH_TYPE, CURLOT_STRING, 0},
+ {"PROXY_TLSAUTH_USERNAME", CURLOPT_PROXY_TLSAUTH_USERNAME,
+ CURLOT_STRING, 0},
+ {"PROXY_TRANSFER_MODE", CURLOPT_PROXY_TRANSFER_MODE, CURLOT_LONG, 0},
+ {"PUT", CURLOPT_PUT, CURLOT_LONG, 0},
+ {"QUOTE", CURLOPT_QUOTE, CURLOT_SLIST, 0},
+ {"RANDOM_FILE", CURLOPT_RANDOM_FILE, CURLOT_STRING, 0},
+ {"RANGE", CURLOPT_RANGE, CURLOT_STRING, 0},
+ {"READDATA", CURLOPT_READDATA, CURLOT_CBPTR, 0},
+ {"READFUNCTION", CURLOPT_READFUNCTION, CURLOT_FUNCTION, 0},
+ {"REDIR_PROTOCOLS", CURLOPT_REDIR_PROTOCOLS, CURLOT_LONG, 0},
+ {"REFERER", CURLOPT_REFERER, CURLOT_STRING, 0},
+ {"REQUEST_TARGET", CURLOPT_REQUEST_TARGET, CURLOT_STRING, 0},
+ {"RESOLVE", CURLOPT_RESOLVE, CURLOT_SLIST, 0},
+ {"RESOLVER_START_DATA", CURLOPT_RESOLVER_START_DATA, CURLOT_CBPTR, 0},
+ {"RESOLVER_START_FUNCTION", CURLOPT_RESOLVER_START_FUNCTION,
+ CURLOT_FUNCTION, 0},
+ {"RESUME_FROM", CURLOPT_RESUME_FROM, CURLOT_LONG, 0},
+ {"RESUME_FROM_LARGE", CURLOPT_RESUME_FROM_LARGE, CURLOT_OFF_T, 0},
+ {"RTSPHEADER", CURLOPT_HTTPHEADER, CURLOT_SLIST, CURLOT_FLAG_ALIAS},
+ {"RTSP_CLIENT_CSEQ", CURLOPT_RTSP_CLIENT_CSEQ, CURLOT_LONG, 0},
+ {"RTSP_REQUEST", CURLOPT_RTSP_REQUEST, CURLOT_VALUES, 0},
+ {"RTSP_SERVER_CSEQ", CURLOPT_RTSP_SERVER_CSEQ, CURLOT_LONG, 0},
+ {"RTSP_SESSION_ID", CURLOPT_RTSP_SESSION_ID, CURLOT_STRING, 0},
+ {"RTSP_STREAM_URI", CURLOPT_RTSP_STREAM_URI, CURLOT_STRING, 0},
+ {"RTSP_TRANSPORT", CURLOPT_RTSP_TRANSPORT, CURLOT_STRING, 0},
+ {"SASL_AUTHZID", CURLOPT_SASL_AUTHZID, CURLOT_STRING, 0},
+ {"SASL_IR", CURLOPT_SASL_IR, CURLOT_LONG, 0},
+ {"SEEKDATA", CURLOPT_SEEKDATA, CURLOT_CBPTR, 0},
+ {"SEEKFUNCTION", CURLOPT_SEEKFUNCTION, CURLOT_FUNCTION, 0},
+ {"SERVER_RESPONSE_TIMEOUT", CURLOPT_FTP_RESPONSE_TIMEOUT,
+ CURLOT_LONG, CURLOT_FLAG_ALIAS},
+ {"SERVICE_NAME", CURLOPT_SERVICE_NAME, CURLOT_STRING, 0},
+ {"SHARE", CURLOPT_SHARE, CURLOT_OBJECT, 0},
+ {"SOCKOPTDATA", CURLOPT_SOCKOPTDATA, CURLOT_CBPTR, 0},
+ {"SOCKOPTFUNCTION", CURLOPT_SOCKOPTFUNCTION, CURLOT_FUNCTION, 0},
+ {"SOCKS5_AUTH", CURLOPT_SOCKS5_AUTH, CURLOT_LONG, 0},
+ {"SOCKS5_GSSAPI_NEC", CURLOPT_SOCKS5_GSSAPI_NEC, CURLOT_LONG, 0},
+ {"SOCKS5_GSSAPI_SERVICE", CURLOPT_SOCKS5_GSSAPI_SERVICE, CURLOT_STRING, 0},
+ {"SSH_AUTH_TYPES", CURLOPT_SSH_AUTH_TYPES, CURLOT_VALUES, 0},
+ {"SSH_COMPRESSION", CURLOPT_SSH_COMPRESSION, CURLOT_LONG, 0},
+ {"SSH_HOST_PUBLIC_KEY_MD5", CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
+ CURLOT_STRING, 0},
+ {"SSH_KEYDATA", CURLOPT_SSH_KEYDATA, CURLOT_CBPTR, 0},
+ {"SSH_KEYFUNCTION", CURLOPT_SSH_KEYFUNCTION, CURLOT_FUNCTION, 0},
+ {"SSH_KNOWNHOSTS", CURLOPT_SSH_KNOWNHOSTS, CURLOT_STRING, 0},
+ {"SSH_PRIVATE_KEYFILE", CURLOPT_SSH_PRIVATE_KEYFILE, CURLOT_STRING, 0},
+ {"SSH_PUBLIC_KEYFILE", CURLOPT_SSH_PUBLIC_KEYFILE, CURLOT_STRING, 0},
+ {"SSLCERT", CURLOPT_SSLCERT, CURLOT_STRING, 0},
+ {"SSLCERTPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS},
+ {"SSLCERTTYPE", CURLOPT_SSLCERTTYPE, CURLOT_STRING, 0},
+ {"SSLCERT_BLOB", CURLOPT_SSLCERT_BLOB, CURLOT_BLOB, 0},
+ {"SSLENGINE", CURLOPT_SSLENGINE, CURLOT_STRING, 0},
+ {"SSLENGINE_DEFAULT", CURLOPT_SSLENGINE_DEFAULT, CURLOT_LONG, 0},
+ {"SSLKEY", CURLOPT_SSLKEY, CURLOT_STRING, 0},
+ {"SSLKEYPASSWD", CURLOPT_KEYPASSWD, CURLOT_STRING, CURLOT_FLAG_ALIAS},
+ {"SSLKEYTYPE", CURLOPT_SSLKEYTYPE, CURLOT_STRING, 0},
+ {"SSLKEY_BLOB", CURLOPT_SSLKEY_BLOB, CURLOT_BLOB, 0},
+ {"SSLVERSION", CURLOPT_SSLVERSION, CURLOT_VALUES, 0},
+ {"SSL_CIPHER_LIST", CURLOPT_SSL_CIPHER_LIST, CURLOT_STRING, 0},
+ {"SSL_CTX_DATA", CURLOPT_SSL_CTX_DATA, CURLOT_CBPTR, 0},
+ {"SSL_CTX_FUNCTION", CURLOPT_SSL_CTX_FUNCTION, CURLOT_FUNCTION, 0},
+ {"SSL_EC_CURVES", CURLOPT_SSL_EC_CURVES, CURLOT_STRING, 0},
+ {"SSL_ENABLE_ALPN", CURLOPT_SSL_ENABLE_ALPN, CURLOT_LONG, 0},
+ {"SSL_ENABLE_NPN", CURLOPT_SSL_ENABLE_NPN, CURLOT_LONG, 0},
+ {"SSL_FALSESTART", CURLOPT_SSL_FALSESTART, CURLOT_LONG, 0},
+ {"SSL_OPTIONS", CURLOPT_SSL_OPTIONS, CURLOT_VALUES, 0},
+ {"SSL_SESSIONID_CACHE", CURLOPT_SSL_SESSIONID_CACHE, CURLOT_LONG, 0},
+ {"SSL_VERIFYHOST", CURLOPT_SSL_VERIFYHOST, CURLOT_LONG, 0},
+ {"SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER, CURLOT_LONG, 0},
+ {"SSL_VERIFYSTATUS", CURLOPT_SSL_VERIFYSTATUS, CURLOT_LONG, 0},
+ {"STDERR", CURLOPT_STDERR, CURLOT_OBJECT, 0},
+ {"STREAM_DEPENDS", CURLOPT_STREAM_DEPENDS, CURLOT_OBJECT, 0},
+ {"STREAM_DEPENDS_E", CURLOPT_STREAM_DEPENDS_E, CURLOT_OBJECT, 0},
+ {"STREAM_WEIGHT", CURLOPT_STREAM_WEIGHT, CURLOT_LONG, 0},
+ {"SUPPRESS_CONNECT_HEADERS", CURLOPT_SUPPRESS_CONNECT_HEADERS,
+ CURLOT_LONG, 0},
+ {"TCP_FASTOPEN", CURLOPT_TCP_FASTOPEN, CURLOT_LONG, 0},
+ {"TCP_KEEPALIVE", CURLOPT_TCP_KEEPALIVE, CURLOT_LONG, 0},
+ {"TCP_KEEPIDLE", CURLOPT_TCP_KEEPIDLE, CURLOT_LONG, 0},
+ {"TCP_KEEPINTVL", CURLOPT_TCP_KEEPINTVL, CURLOT_LONG, 0},
+ {"TCP_NODELAY", CURLOPT_TCP_NODELAY, CURLOT_LONG, 0},
+ {"TELNETOPTIONS", CURLOPT_TELNETOPTIONS, CURLOT_SLIST, 0},
+ {"TFTP_BLKSIZE", CURLOPT_TFTP_BLKSIZE, CURLOT_LONG, 0},
+ {"TFTP_NO_OPTIONS", CURLOPT_TFTP_NO_OPTIONS, CURLOT_LONG, 0},
+ {"TIMECONDITION", CURLOPT_TIMECONDITION, CURLOT_VALUES, 0},
+ {"TIMEOUT", CURLOPT_TIMEOUT, CURLOT_LONG, 0},
+ {"TIMEOUT_MS", CURLOPT_TIMEOUT_MS, CURLOT_LONG, 0},
+ {"TIMEVALUE", CURLOPT_TIMEVALUE, CURLOT_LONG, 0},
+ {"TIMEVALUE_LARGE", CURLOPT_TIMEVALUE_LARGE, CURLOT_OFF_T, 0},
+ {"TLS13_CIPHERS", CURLOPT_TLS13_CIPHERS, CURLOT_STRING, 0},
+ {"TLSAUTH_PASSWORD", CURLOPT_TLSAUTH_PASSWORD, CURLOT_STRING, 0},
+ {"TLSAUTH_TYPE", CURLOPT_TLSAUTH_TYPE, CURLOT_STRING, 0},
+ {"TLSAUTH_USERNAME", CURLOPT_TLSAUTH_USERNAME, CURLOT_STRING, 0},
+ {"TRAILERDATA", CURLOPT_TRAILERDATA, CURLOT_CBPTR, 0},
+ {"TRAILERFUNCTION", CURLOPT_TRAILERFUNCTION, CURLOT_FUNCTION, 0},
+ {"TRANSFERTEXT", CURLOPT_TRANSFERTEXT, CURLOT_LONG, 0},
+ {"TRANSFER_ENCODING", CURLOPT_TRANSFER_ENCODING, CURLOT_LONG, 0},
+ {"UNIX_SOCKET_PATH", CURLOPT_UNIX_SOCKET_PATH, CURLOT_STRING, 0},
+ {"UNRESTRICTED_AUTH", CURLOPT_UNRESTRICTED_AUTH, CURLOT_LONG, 0},
+ {"UPKEEP_INTERVAL_MS", CURLOPT_UPKEEP_INTERVAL_MS, CURLOT_LONG, 0},
+ {"UPLOAD", CURLOPT_UPLOAD, CURLOT_LONG, 0},
+ {"UPLOAD_BUFFERSIZE", CURLOPT_UPLOAD_BUFFERSIZE, CURLOT_LONG, 0},
+ {"URL", CURLOPT_URL, CURLOT_STRING, 0},
+ {"USERAGENT", CURLOPT_USERAGENT, CURLOT_STRING, 0},
+ {"USERNAME", CURLOPT_USERNAME, CURLOT_STRING, 0},
+ {"USERPWD", CURLOPT_USERPWD, CURLOT_STRING, 0},
+ {"USE_SSL", CURLOPT_USE_SSL, CURLOT_VALUES, 0},
+ {"VERBOSE", CURLOPT_VERBOSE, CURLOT_LONG, 0},
+ {"WILDCARDMATCH", CURLOPT_WILDCARDMATCH, CURLOT_LONG, 0},
+ {"WRITEDATA", CURLOPT_WRITEDATA, CURLOT_CBPTR, 0},
+ {"WRITEFUNCTION", CURLOPT_WRITEFUNCTION, CURLOT_FUNCTION, 0},
+ {"WRITEHEADER", CURLOPT_HEADERDATA, CURLOT_CBPTR, CURLOT_FLAG_ALIAS},
+ {"XFERINFODATA", CURLOPT_XFERINFODATA, CURLOT_CBPTR, 0},
+ {"XFERINFOFUNCTION", CURLOPT_XFERINFOFUNCTION, CURLOT_FUNCTION, 0},
+ {"XOAUTH2_BEARER", CURLOPT_XOAUTH2_BEARER, CURLOT_STRING, 0},
+ {NULL, CURLOPT_LASTENTRY, 0, 0} /* end of table */
+};
+
+#ifdef DEBUGBUILD
+/*
+ * Curl_easyopts_check() is a debug-only function that returns non-zero
+ * if this source file is not in sync with the options listed in curl/curl.h
+ */
+int Curl_easyopts_check(void)
+{
+ return (CURLOPT_LASTENTRY != (304 + 1));
+}
+#endif
diff --git a/contrib/libs/curl/lib/easyoptions.h b/contrib/libs/curl/lib/easyoptions.h
index a67bb0b310..91e11908bd 100644
--- a/contrib/libs/curl/lib/easyoptions.h
+++ b/contrib/libs/curl/lib/easyoptions.h
@@ -1,35 +1,35 @@
-#ifndef HEADER_CURL_EASYOPTIONS_H
-#define HEADER_CURL_EASYOPTIONS_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
- *
- ***************************************************************************/
-
-/* should probably go into the public header */
-
-#include <curl/curl.h>
-
-/* generated table with all easy options */
-extern struct curl_easyoption Curl_easyopts[];
-
-#ifdef DEBUGBUILD
-int Curl_easyopts_check(void);
-#endif
-#endif
+#ifndef HEADER_CURL_EASYOPTIONS_H
+#define HEADER_CURL_EASYOPTIONS_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
+ *
+ ***************************************************************************/
+
+/* should probably go into the public header */
+
+#include <curl/curl.h>
+
+/* generated table with all easy options */
+extern struct curl_easyoption Curl_easyopts[];
+
+#ifdef DEBUGBUILD
+int Curl_easyopts_check(void);
+#endif
+#endif
diff --git a/contrib/libs/curl/lib/escape.c b/contrib/libs/curl/lib/escape.c
index d9cf778dd1..683b6fc4a6 100644
--- a/contrib/libs/curl/lib/escape.c
+++ b/contrib/libs/curl/lib/escape.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -81,43 +81,43 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
{
size_t length;
CURLcode result;
- struct dynbuf d;
+ struct dynbuf d;
if(inlength < 0)
return NULL;
- Curl_dyn_init(&d, CURL_MAX_INPUT_LENGTH * 3);
+ Curl_dyn_init(&d, CURL_MAX_INPUT_LENGTH * 3);
- length = (inlength?(size_t)inlength:strlen(string));
- if(!length)
- return strdup("");
+ length = (inlength?(size_t)inlength:strlen(string));
+ if(!length)
+ return strdup("");
while(length--) {
unsigned char in = *string; /* we need to treat the characters unsigned */
- if(Curl_isunreserved(in)) {
- /* append this */
- if(Curl_dyn_addn(&d, &in, 1))
- return NULL;
- }
+ if(Curl_isunreserved(in)) {
+ /* append this */
+ if(Curl_dyn_addn(&d, &in, 1))
+ return NULL;
+ }
else {
/* encode it */
- char encoded[4];
+ char encoded[4];
result = Curl_convert_to_network(data, (char *)&in, 1);
if(result) {
/* Curl_convert_to_network calls failf if unsuccessful */
- Curl_dyn_free(&d);
+ Curl_dyn_free(&d);
return NULL;
}
- msnprintf(encoded, sizeof(encoded), "%%%02X", in);
- if(Curl_dyn_add(&d, encoded))
- return NULL;
+ msnprintf(encoded, sizeof(encoded), "%%%02X", in);
+ if(Curl_dyn_add(&d, encoded))
+ return NULL;
}
string++;
}
-
- return Curl_dyn_ptr(&d);
+
+ return Curl_dyn_ptr(&d);
}
/*
@@ -128,34 +128,34 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
*
* 'data' can be set to NULL but then this function can't convert network
* data to host for non-ascii.
- *
- * ctrl options:
- * - REJECT_NADA: accept everything
- * - REJECT_CTRL: rejects control characters (byte codes lower than 32) in
- * the data
- * - REJECT_ZERO: rejects decoded zero bytes
- *
- * The values for the enum starts at 2, to make the assert detect legacy
- * invokes that used TRUE/FALSE (0 and 1).
+ *
+ * ctrl options:
+ * - REJECT_NADA: accept everything
+ * - REJECT_CTRL: rejects control characters (byte codes lower than 32) in
+ * the data
+ * - REJECT_ZERO: rejects decoded zero bytes
+ *
+ * The values for the enum starts at 2, to make the assert detect legacy
+ * invokes that used TRUE/FALSE (0 and 1).
*/
-
+
CURLcode Curl_urldecode(struct Curl_easy *data,
const char *string, size_t length,
char **ostring, size_t *olen,
- enum urlreject ctrl)
+ enum urlreject ctrl)
{
- size_t alloc;
- char *ns;
+ size_t alloc;
+ char *ns;
size_t strindex = 0;
unsigned long hex;
CURLcode result = CURLE_OK;
- DEBUGASSERT(string);
- DEBUGASSERT(ctrl >= REJECT_NADA); /* crash on TRUE/FALSE */
-
- alloc = (length?length:strlen(string)) + 1;
- ns = malloc(alloc);
-
+ DEBUGASSERT(string);
+ DEBUGASSERT(ctrl >= REJECT_NADA); /* crash on TRUE/FALSE */
+
+ alloc = (length?length:strlen(string)) + 1;
+ ns = malloc(alloc);
+
if(!ns)
return CURLE_OUT_OF_MEMORY;
@@ -187,8 +187,8 @@ CURLcode Curl_urldecode(struct Curl_easy *data,
alloc -= 2;
}
- if(((ctrl == REJECT_CTRL) && (in < 0x20)) ||
- ((ctrl == REJECT_ZERO) && (in == 0))) {
+ if(((ctrl == REJECT_CTRL) && (in < 0x20)) ||
+ ((ctrl == REJECT_ZERO) && (in == 0))) {
free(ns);
return CURLE_URL_MALFORMAT;
}
@@ -222,7 +222,7 @@ char *curl_easy_unescape(struct Curl_easy *data, const char *string,
size_t inputlen = length;
size_t outputlen;
CURLcode res = Curl_urldecode(data, string, inputlen, &str, &outputlen,
- REJECT_NADA);
+ REJECT_NADA);
if(res)
return NULL;
diff --git a/contrib/libs/curl/lib/escape.h b/contrib/libs/curl/lib/escape.h
index 94f33ce814..46cb59039a 100644
--- a/contrib/libs/curl/lib/escape.h
+++ b/contrib/libs/curl/lib/escape.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -25,16 +25,16 @@
* allocated string or NULL if an error occurred. */
bool Curl_isunreserved(unsigned char in);
-
-enum urlreject {
- REJECT_NADA = 2,
- REJECT_CTRL,
- REJECT_ZERO
-};
-
+
+enum urlreject {
+ REJECT_NADA = 2,
+ REJECT_CTRL,
+ REJECT_ZERO
+};
+
CURLcode Curl_urldecode(struct Curl_easy *data,
const char *string, size_t length,
char **ostring, size_t *olen,
- enum urlreject ctrl);
+ enum urlreject ctrl);
#endif /* HEADER_CURL_ESCAPE_H */
diff --git a/contrib/libs/curl/lib/file.c b/contrib/libs/curl/lib/file.c
index 2ed0cc0fc8..a65eb7798d 100644
--- a/contrib/libs/curl/lib/file.c
+++ b/contrib/libs/curl/lib/file.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -67,7 +67,7 @@
#include "curl_memory.h"
#include "memdebug.h"
-#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
+#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
#define DOS_FILESYSTEM 1
#endif
@@ -111,7 +111,7 @@ const struct Curl_handler Curl_handler_file = {
ZERO_NULL, /* connection_check */
0, /* defport */
CURLPROTO_FILE, /* protocol */
- CURLPROTO_FILE, /* family */
+ CURLPROTO_FILE, /* family */
PROTOPT_NONETWORK | PROTOPT_NOURLQUERY /* flags */
};
@@ -119,8 +119,8 @@ const struct Curl_handler Curl_handler_file = {
static CURLcode file_setup_connection(struct connectdata *conn)
{
/* allocate the FILE specific struct */
- conn->data->req.p.file = calloc(1, sizeof(struct FILEPROTO));
- if(!conn->data->req.p.file)
+ conn->data->req.p.file = calloc(1, sizeof(struct FILEPROTO));
+ if(!conn->data->req.p.file)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
@@ -135,7 +135,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
{
struct Curl_easy *data = conn->data;
char *real_path;
- struct FILEPROTO *file = data->req.p.file;
+ struct FILEPROTO *file = data->req.p.file;
int fd;
#ifdef DOS_FILESYSTEM
size_t i;
@@ -144,7 +144,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
size_t real_path_len;
CURLcode result = Curl_urldecode(data, data->state.up.path, 0, &real_path,
- &real_path_len, REJECT_ZERO);
+ &real_path_len, REJECT_ZERO);
if(result)
return result;
@@ -209,7 +209,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
static CURLcode file_done(struct connectdata *conn,
CURLcode status, bool premature)
{
- struct FILEPROTO *file = conn->data->req.p.file;
+ struct FILEPROTO *file = conn->data->req.p.file;
(void)status; /* not used */
(void)premature; /* not used */
@@ -228,7 +228,7 @@ static CURLcode file_disconnect(struct connectdata *conn,
bool dead_connection)
{
(void)dead_connection; /* not used */
- return file_done(conn, 0, 0);
+ return file_done(conn, 0, 0);
}
#ifdef DOS_FILESYSTEM
@@ -239,7 +239,7 @@ static CURLcode file_disconnect(struct connectdata *conn,
static CURLcode file_upload(struct connectdata *conn)
{
- struct FILEPROTO *file = conn->data->req.p.file;
+ struct FILEPROTO *file = conn->data->req.p.file;
const char *dir = strchr(file->path, DIRSEP);
int fd;
int mode;
@@ -381,7 +381,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
if(data->set.upload)
return file_upload(conn);
- file = conn->data->req.p.file;
+ file = conn->data->req.p.file;
/* get the fd from the connection phase */
fd = file->fd;
diff --git a/contrib/libs/curl/lib/file.h b/contrib/libs/curl/lib/file.h
index 41a72d9502..338f92e46a 100644
--- a/contrib/libs/curl/lib/file.h
+++ b/contrib/libs/curl/lib/file.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/fileinfo.c b/contrib/libs/curl/lib/fileinfo.c
index 8ed11ade5b..b7e9f0f5e8 100644
--- a/contrib/libs/curl/lib/fileinfo.c
+++ b/contrib/libs/curl/lib/fileinfo.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2010 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2010 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/fileinfo.h b/contrib/libs/curl/lib/fileinfo.h
index d79a691ffe..5ae23ad4a3 100644
--- a/contrib/libs/curl/lib/fileinfo.h
+++ b/contrib/libs/curl/lib/fileinfo.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2010 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2010 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -27,7 +27,7 @@
struct fileinfo {
struct curl_fileinfo info;
- struct Curl_llist_element list;
+ struct Curl_llist_element list;
};
struct fileinfo *Curl_fileinfo_alloc(void);
diff --git a/contrib/libs/curl/lib/formdata.c b/contrib/libs/curl/lib/formdata.c
index 05f4b5c443..769f06a705 100644
--- a/contrib/libs/curl/lib/formdata.c
+++ b/contrib/libs/curl/lib/formdata.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -123,11 +123,11 @@ AddHttpPost(char *name, size_t namelength,
* parent_form_info is NULL.
*
***************************************************************************/
-static struct FormInfo *AddFormInfo(char *value,
- char *contenttype,
- struct FormInfo *parent_form_info)
+static struct FormInfo *AddFormInfo(char *value,
+ char *contenttype,
+ struct FormInfo *parent_form_info)
{
- struct FormInfo *form_info;
+ struct FormInfo *form_info;
form_info = calloc(1, sizeof(struct FormInfo));
if(form_info) {
if(value)
@@ -204,7 +204,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
struct curl_httppost **last_post,
va_list params)
{
- struct FormInfo *first_form, *current_form, *form = NULL;
+ struct FormInfo *first_form, *current_form, *form = NULL;
CURLFORMcode return_value = CURL_FORMADD_OK;
const char *prevtype = NULL;
struct curl_httppost *post = NULL;
@@ -521,7 +521,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if(CURL_FORMADD_OK != return_value) {
/* On error, free allocated fields for all nodes of the FormInfo linked
list without deallocating nodes. List nodes are deallocated later on */
- struct FormInfo *ptr;
+ struct FormInfo *ptr;
for(ptr = first_form; ptr != NULL; ptr = ptr->more) {
if(ptr->name_alloc) {
Curl_safefree(ptr->name);
@@ -602,7 +602,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
/* Note that there's small risk that form->name is NULL here if the
app passed in a bad combo, so we better check for that first. */
if(form->name) {
- /* copy name (without strdup; possibly not null-terminated) */
+ /* copy name (without strdup; possibly not null-terminated) */
form->name = Curl_memdup(form->name, form->namelength?
form->namelength:
strlen(form->name) + 1);
@@ -650,7 +650,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
/* On error, free allocated fields for nodes of the FormInfo linked
list which are not already owned by the httppost linked list
without deallocating nodes. List nodes are deallocated later on */
- struct FormInfo *ptr;
+ struct FormInfo *ptr;
for(ptr = form; ptr != NULL; ptr = ptr->more) {
if(ptr->name_alloc) {
Curl_safefree(ptr->name);
@@ -676,7 +676,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
fields given that these have either been deallocated or are owned
now by the httppost linked list */
while(first_form) {
- struct FormInfo *ptr = first_form->more;
+ struct FormInfo *ptr = first_form->more;
free(first_form);
first_form = ptr;
}
@@ -728,10 +728,10 @@ int curl_formget(struct curl_httppost *form, void *arg,
if(!nread)
break;
- if(nread > sizeof(buffer) || append(arg, buffer, nread) != nread) {
- result = CURLE_READ_ERROR;
- if(nread == CURL_READFUNC_ABORT)
- result = CURLE_ABORTED_BY_CALLBACK;
+ if(nread > sizeof(buffer) || append(arg, buffer, nread) != nread) {
+ result = CURLE_READ_ERROR;
+ if(nread == CURL_READFUNC_ABORT)
+ result = CURLE_ABORTED_BY_CALLBACK;
}
}
@@ -771,7 +771,7 @@ void curl_formfree(struct curl_httppost *form)
}
-/* Set mime part name, taking care of non null-terminated name string. */
+/* Set mime part name, taking care of non null-terminated name string. */
static CURLcode setname(curl_mimepart *part, const char *name, size_t len)
{
char *zname;
diff --git a/contrib/libs/curl/lib/formdata.h b/contrib/libs/curl/lib/formdata.h
index 142bbc53ad..5a021ceb92 100644
--- a/contrib/libs/curl/lib/formdata.h
+++ b/contrib/libs/curl/lib/formdata.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -27,7 +27,7 @@
#ifndef CURL_DISABLE_MIME
/* used by FormAdd for temporary storage */
-struct FormInfo {
+struct FormInfo {
char *name;
bool name_alloc;
size_t namelength;
@@ -45,7 +45,7 @@ struct FormInfo {
char *userp; /* pointer for the read callback */
struct curl_slist *contentheader;
struct FormInfo *more;
-};
+};
CURLcode Curl_getformdata(struct Curl_easy *data,
curl_mimepart *,
diff --git a/contrib/libs/curl/lib/ftp.c b/contrib/libs/curl/lib/ftp.c
index 93aa90015c..bc35574217 100644
--- a/contrib/libs/curl/lib/ftp.c
+++ b/contrib/libs/curl/lib/ftp.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -59,7 +59,7 @@
#include "fileinfo.h"
#include "ftplistparser.h"
#include "curl_range.h"
-#include "curl_krb5.h"
+#include "curl_krb5.h"
#include "strtoofft.h"
#include "strcase.h"
#include "vtls/vtls.h"
@@ -77,7 +77,7 @@
#include "warnless.h"
#include "http_proxy.h"
#include "non-ascii.h"
-#include "socks.h"
+#include "socks.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -113,7 +113,7 @@ static CURLcode ftp_parse_url_path(struct connectdata *conn);
static CURLcode ftp_regular_transfer(struct connectdata *conn, bool *done);
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void ftp_pasv_verbose(struct connectdata *conn,
- struct Curl_addrinfo *ai,
+ struct Curl_addrinfo *ai,
char *newhost, /* ascii version */
int port);
#endif
@@ -136,7 +136,7 @@ static int ftp_getsock(struct connectdata *conn, curl_socket_t *socks);
static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks);
static CURLcode ftp_doing(struct connectdata *conn,
bool *dophase_done);
-static CURLcode ftp_setup_connection(struct connectdata *conn);
+static CURLcode ftp_setup_connection(struct connectdata *conn);
static CURLcode init_wc_data(struct connectdata *conn);
static CURLcode wc_statemach(struct connectdata *conn);
static void wc_data_dtor(void *ptr);
@@ -170,7 +170,7 @@ const struct Curl_handler Curl_handler_ftp = {
ZERO_NULL, /* connection_check */
PORT_FTP, /* defport */
CURLPROTO_FTP, /* protocol */
- CURLPROTO_FTP, /* family */
+ CURLPROTO_FTP, /* family */
PROTOPT_DUAL | PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD |
PROTOPT_NOURLQUERY | PROTOPT_PROXY_AS_HTTP |
PROTOPT_WILDCARD /* flags */
@@ -200,7 +200,7 @@ const struct Curl_handler Curl_handler_ftps = {
ZERO_NULL, /* connection_check */
PORT_FTPS, /* defport */
CURLPROTO_FTPS, /* protocol */
- CURLPROTO_FTP, /* family */
+ CURLPROTO_FTP, /* family */
PROTOPT_SSL | PROTOPT_DUAL | PROTOPT_CLOSEACTION |
PROTOPT_NEEDSPWD | PROTOPT_NOURLQUERY | PROTOPT_WILDCARD /* flags */
};
@@ -213,9 +213,9 @@ static void close_secondarysocket(struct connectdata *conn)
conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;
}
conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE;
-#ifndef CURL_DISABLE_PROXY
- conn->bits.proxy_ssl_connected[SECONDARYSOCKET] = FALSE;
-#endif
+#ifndef CURL_DISABLE_PROXY
+ conn->bits.proxy_ssl_connected[SECONDARYSOCKET] = FALSE;
+#endif
}
/*
@@ -286,7 +286,7 @@ static CURLcode AcceptServerConnect(struct connectdata *conn)
conn->sock[SECONDARYSOCKET] = s;
(void)curlx_nonblock(s, TRUE); /* enable non-blocking */
- conn->bits.sock_accepted = TRUE;
+ conn->bits.sock_accepted = TRUE;
if(data->set.fsockopt) {
int error = 0;
@@ -329,7 +329,7 @@ static timediff_t ftp_timeleft_accept(struct Curl_easy *data)
now = Curl_now();
/* check if the generic timeout possibly is set shorter */
- other = Curl_timeleft(data, &now, FALSE);
+ other = Curl_timeleft(data, &now, FALSE);
if(other && (other < timeout_ms))
/* note that this also works fine for when other happens to be negative
due to it already having elapsed */
@@ -381,7 +381,7 @@ static CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received)
if(pp->cache_size && pp->cache && pp->cache[0] > '3') {
/* Data connection could not be established, let's return */
infof(data, "There is negative response in cache while serv connect\n");
- (void)Curl_GetFTPResponse(&nread, conn, &ftpcode);
+ (void)Curl_GetFTPResponse(&nread, conn, &ftpcode);
return CURLE_FTP_ACCEPT_FAILED;
}
@@ -403,7 +403,7 @@ static CURLcode ReceivedServerConnect(struct connectdata *conn, bool *received)
}
else if(result & CURL_CSELECT_IN) {
infof(data, "Ctrl conn has data while waiting for data conn\n");
- (void)Curl_GetFTPResponse(&nread, conn, &ftpcode);
+ (void)Curl_GetFTPResponse(&nread, conn, &ftpcode);
if(ftpcode/100 > 3)
return CURLE_FTP_ACCEPT_FAILED;
@@ -506,7 +506,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn, bool *connected)
}
else {
/* Add timeout to multi handle and break out of the loop */
- if(*connected == FALSE) {
+ if(*connected == FALSE) {
Curl_expire(data, data->set.accepttimeout > 0 ?
data->set.accepttimeout: DEFAULT_ACCEPT_TIMEOUT, 0);
}
@@ -627,8 +627,8 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
while(!*ftpcode && !result) {
/* check and reset timeout value every lap */
- timediff_t timeout = Curl_pp_state_timeout(pp, FALSE);
- timediff_t interval_ms;
+ timediff_t timeout = Curl_pp_state_timeout(pp, FALSE);
+ timediff_t interval_ms;
if(timeout <= 0) {
failf(data, "FTP response timeout");
@@ -767,22 +767,22 @@ static void _state(struct connectdata *conn,
static CURLcode ftp_state_user(struct connectdata *conn)
{
- CURLcode result = Curl_pp_sendf(&conn->proto.ftpc.pp, "USER %s",
- conn->user?conn->user:"");
- if(!result) {
- state(conn, FTP_USER);
- conn->data->state.ftp_trying_alternative = FALSE;
- }
- return result;
+ CURLcode result = Curl_pp_sendf(&conn->proto.ftpc.pp, "USER %s",
+ conn->user?conn->user:"");
+ if(!result) {
+ state(conn, FTP_USER);
+ conn->data->state.ftp_trying_alternative = FALSE;
+ }
+ return result;
}
static CURLcode ftp_state_pwd(struct connectdata *conn)
{
- CURLcode result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", "PWD");
- if(!result)
- state(conn, FTP_PWD);
+ CURLcode result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", "PWD");
+ if(!result)
+ state(conn, FTP_PWD);
- return result;
+ return result;
}
/* For the FTP "protocol connect" and "doing" phases only */
@@ -802,12 +802,12 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks)
* handle ordinary commands.
*/
- if(SOCKS_STATE(conn->cnnct.state))
- return Curl_SOCKS_getsock(conn, socks, SECONDARYSOCKET);
-
+ if(SOCKS_STATE(conn->cnnct.state))
+ return Curl_SOCKS_getsock(conn, socks, SECONDARYSOCKET);
+
if(FTP_STOP == ftpc->state) {
int bits = GETSOCK_READSOCK(0);
- bool any = FALSE;
+ bool any = FALSE;
/* if stopped and still in this state, then we're also waiting for a
connect on the secondary connection */
@@ -822,11 +822,11 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks)
if(conn->tempsock[i] != CURL_SOCKET_BAD) {
socks[s] = conn->tempsock[i];
bits |= GETSOCK_WRITESOCK(s++);
- any = TRUE;
+ any = TRUE;
}
}
}
- if(!any) {
+ if(!any) {
socks[1] = conn->sock[SECONDARYSOCKET];
bits |= GETSOCK_WRITESOCK(1) | GETSOCK_READSOCK(1);
}
@@ -851,10 +851,10 @@ static CURLcode ftp_state_cwd(struct connectdata *conn)
/* already done and fine */
result = ftp_state_mdtm(conn);
else {
- /* FTPFILE_NOCWD with full path: expect ftpc->cwddone! */
- DEBUGASSERT((conn->data->set.ftp_filemethod != FTPFILE_NOCWD) ||
- !(ftpc->dirdepth && ftpc->dirs[0][0] == '/'));
-
+ /* FTPFILE_NOCWD with full path: expect ftpc->cwddone! */
+ DEBUGASSERT((conn->data->set.ftp_filemethod != FTPFILE_NOCWD) ||
+ !(ftpc->dirdepth && ftpc->dirs[0][0] == '/'));
+
ftpc->count2 = 0; /* count2 counts failed CWDs */
/* count3 is set to allow a MKD to fail once. In the case when first CWD
@@ -862,27 +862,27 @@ static CURLcode ftp_state_cwd(struct connectdata *conn)
dir) this then allows for a second try to CWD to it */
ftpc->count3 = (conn->data->set.ftp_create_missing_dirs == 2)?1:0;
- if(conn->bits.reuse && ftpc->entrypath &&
- /* no need to go to entrypath when we have an absolute path */
- !(ftpc->dirdepth && ftpc->dirs[0][0] == '/')) {
+ if(conn->bits.reuse && ftpc->entrypath &&
+ /* no need to go to entrypath when we have an absolute path */
+ !(ftpc->dirdepth && ftpc->dirs[0][0] == '/')) {
/* This is a re-used connection. Since we change directory to where the
transfer is taking place, we must first get back to the original dir
where we ended up after login: */
ftpc->cwdcount = 0; /* we count this as the first path, then we add one
for all upcoming ones in the ftp->dirs[] array */
- result = Curl_pp_sendf(&ftpc->pp, "CWD %s", ftpc->entrypath);
- if(!result)
- state(conn, FTP_CWD);
+ result = Curl_pp_sendf(&ftpc->pp, "CWD %s", ftpc->entrypath);
+ if(!result)
+ state(conn, FTP_CWD);
}
else {
if(ftpc->dirdepth) {
ftpc->cwdcount = 1;
/* issue the first CWD, the rest is sent when the CWD responses are
received... */
- result = Curl_pp_sendf(&ftpc->pp, "CWD %s",
- ftpc->dirs[ftpc->cwdcount -1]);
- if(!result)
- state(conn, FTP_CWD);
+ result = Curl_pp_sendf(&ftpc->pp, "CWD %s",
+ ftpc->dirs[ftpc->cwdcount -1]);
+ if(!result)
+ state(conn, FTP_CWD);
}
else {
/* No CWD necessary */
@@ -906,10 +906,10 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
struct ftp_conn *ftpc = &conn->proto.ftpc;
struct Curl_easy *data = conn->data;
curl_socket_t portsock = CURL_SOCKET_BAD;
- char myhost[MAX_IPADR_LEN + 1] = "";
+ char myhost[MAX_IPADR_LEN + 1] = "";
struct Curl_sockaddr_storage ss;
- struct Curl_addrinfo *res, *ai;
+ struct Curl_addrinfo *res, *ai;
curl_socklen_t sslen;
char hbuf[NI_MAXHOST];
struct sockaddr *sa = (struct sockaddr *)&ss;
@@ -918,7 +918,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
struct sockaddr_in6 * const sa6 = (void *)sa;
#endif
static const char mode[][5] = { "EPRT", "PORT" };
- enum resolve_t rc;
+ enum resolve_t rc;
int error;
char *host = NULL;
char *string_ftpport = data->set.str[STRING_FTPPORT];
@@ -1034,7 +1034,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
} /* data->set.ftpport */
if(!host) {
- const char *r;
+ const char *r;
/* not an interface and not a host name, get default by extracting
the IP from the control connection */
sslen = sizeof(ss);
@@ -1047,15 +1047,15 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
switch(sa->sa_family) {
#ifdef ENABLE_IPV6
case AF_INET6:
- r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf));
+ r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf));
break;
#endif
default:
- r = Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf));
+ r = Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf));
break;
}
- if(!r)
- return CURLE_FTP_PORT_FAILED;
+ if(!r)
+ return CURLE_FTP_PORT_FAILED;
host = hbuf; /* use this host name */
possibly_non_local = FALSE; /* we know it is local now */
}
@@ -1234,10 +1234,10 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
break;
}
if(PORT == fcmd) {
- /* large enough for [IP address],[num],[num] */
- char target[sizeof(myhost) + 20];
+ /* large enough for [IP address],[num],[num] */
+ char target[sizeof(myhost) + 20];
char *source = myhost;
- char *dest = target;
+ char *dest = target;
/* translate x.x.x.x to x,x,x,x */
while(source && *source) {
@@ -1251,7 +1251,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
*dest = 0;
msnprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff));
- result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], target);
+ result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], target);
if(result) {
failf(data, "Failure sending PORT command: %s",
curl_easy_strerror(result));
@@ -1292,7 +1292,7 @@ static CURLcode ftp_state_use_pasv(struct connectdata *conn)
struct ftp_conn *ftpc = &conn->proto.ftpc;
CURLcode result = CURLE_OK;
/*
- Here's the executive summary on what to do:
+ Here's the executive summary on what to do:
PASV is RFC959, expect:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
@@ -1317,12 +1317,12 @@ static CURLcode ftp_state_use_pasv(struct connectdata *conn)
modeoff = conn->bits.ftp_use_epsv?0:1;
- result = Curl_pp_sendf(&ftpc->pp, "%s", mode[modeoff]);
- if(!result) {
- ftpc->count1 = modeoff;
- state(conn, FTP_PASV);
- infof(conn->data, "Connect data stream passively\n");
- }
+ result = Curl_pp_sendf(&ftpc->pp, "%s", mode[modeoff]);
+ if(!result) {
+ ftpc->count1 = modeoff;
+ state(conn, FTP_PASV);
+ infof(conn->data, "Connect data stream passively\n");
+ }
return result;
}
@@ -1336,7 +1336,7 @@ static CURLcode ftp_state_use_pasv(struct connectdata *conn)
static CURLcode ftp_state_prepare_transfer(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct Curl_easy *data = conn->data;
if(ftp->transfer != FTPTRANSFER_BODY) {
@@ -1355,22 +1355,22 @@ static CURLcode ftp_state_prepare_transfer(struct connectdata *conn)
if(data->set.ftp_use_pret) {
/* The user has requested that we send a PRET command
to prepare the server for the upcoming PASV */
- struct ftp_conn *ftpc = &conn->proto.ftpc;
- if(!conn->proto.ftpc.file)
- result = Curl_pp_sendf(&ftpc->pp, "PRET %s",
- data->set.str[STRING_CUSTOMREQUEST]?
- data->set.str[STRING_CUSTOMREQUEST]:
- (data->set.ftp_list_only?"NLST":"LIST"));
- else if(data->set.upload)
- result = Curl_pp_sendf(&ftpc->pp, "PRET STOR %s",
- conn->proto.ftpc.file);
- else
- result = Curl_pp_sendf(&ftpc->pp, "PRET RETR %s",
- conn->proto.ftpc.file);
- if(!result)
- state(conn, FTP_PRET);
+ struct ftp_conn *ftpc = &conn->proto.ftpc;
+ if(!conn->proto.ftpc.file)
+ result = Curl_pp_sendf(&ftpc->pp, "PRET %s",
+ data->set.str[STRING_CUSTOMREQUEST]?
+ data->set.str[STRING_CUSTOMREQUEST]:
+ (data->set.ftp_list_only?"NLST":"LIST"));
+ else if(data->set.upload)
+ result = Curl_pp_sendf(&ftpc->pp, "PRET STOR %s",
+ conn->proto.ftpc.file);
+ else
+ result = Curl_pp_sendf(&ftpc->pp, "PRET RETR %s",
+ conn->proto.ftpc.file);
+ if(!result)
+ state(conn, FTP_PRET);
}
- else
+ else
result = ftp_state_use_pasv(conn);
}
return result;
@@ -1379,7 +1379,7 @@ static CURLcode ftp_state_prepare_transfer(struct connectdata *conn)
static CURLcode ftp_state_rest(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {
@@ -1387,9 +1387,9 @@ static CURLcode ftp_state_rest(struct connectdata *conn)
/* Determine if server can respond to REST command and therefore
whether it supports range */
- result = Curl_pp_sendf(&ftpc->pp, "REST %d", 0);
- if(!result)
- state(conn, FTP_REST);
+ result = Curl_pp_sendf(&ftpc->pp, "REST %d", 0);
+ if(!result)
+ state(conn, FTP_REST);
}
else
result = ftp_state_prepare_transfer(conn);
@@ -1400,16 +1400,16 @@ static CURLcode ftp_state_rest(struct connectdata *conn)
static CURLcode ftp_state_size(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {
/* if a "head"-like request is being made (on a file) */
/* we know ftpc->file is a valid pointer to a file name */
- result = Curl_pp_sendf(&ftpc->pp, "SIZE %s", ftpc->file);
- if(!result)
- state(conn, FTP_SIZE);
+ result = Curl_pp_sendf(&ftpc->pp, "SIZE %s", ftpc->file);
+ if(!result)
+ state(conn, FTP_SIZE);
}
else
result = ftp_state_rest(conn);
@@ -1421,7 +1421,7 @@ static CURLcode ftp_state_list(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
/* If this output is to be machine-parsed, the NLST command might be better
to use, since the LIST command output is not specified or standard in any
@@ -1429,37 +1429,37 @@ static CURLcode ftp_state_list(struct connectdata *conn)
servers either... */
/*
- if FTPFILE_NOCWD was specified, we should add the path
+ if FTPFILE_NOCWD was specified, we should add the path
as argument for the LIST / NLST / or custom command.
Whether the server will support this, is uncertain.
The other ftp_filemethods will CWD into dir/dir/ first and
then just do LIST (in that case: nothing to do here)
*/
- char *lstArg = NULL;
- char *cmd;
-
- if((data->set.ftp_filemethod == FTPFILE_NOCWD) && ftp->path) {
- /* url-decode before evaluation: e.g. paths starting/ending with %2f */
- const char *slashPos = NULL;
- char *rawPath = NULL;
- result = Curl_urldecode(data, ftp->path, 0, &rawPath, NULL, REJECT_CTRL);
- if(result)
- return result;
-
- slashPos = strrchr(rawPath, '/');
- if(slashPos) {
- /* chop off the file part if format is dir/file otherwise remove
- the trailing slash for dir/dir/ except for absolute path / */
- size_t n = slashPos - rawPath;
- if(n == 0)
- ++n;
-
- lstArg = rawPath;
- lstArg[n] = '\0';
+ char *lstArg = NULL;
+ char *cmd;
+
+ if((data->set.ftp_filemethod == FTPFILE_NOCWD) && ftp->path) {
+ /* url-decode before evaluation: e.g. paths starting/ending with %2f */
+ const char *slashPos = NULL;
+ char *rawPath = NULL;
+ result = Curl_urldecode(data, ftp->path, 0, &rawPath, NULL, REJECT_CTRL);
+ if(result)
+ return result;
+
+ slashPos = strrchr(rawPath, '/');
+ if(slashPos) {
+ /* chop off the file part if format is dir/file otherwise remove
+ the trailing slash for dir/dir/ except for absolute path / */
+ size_t n = slashPos - rawPath;
+ if(n == 0)
+ ++n;
+
+ lstArg = rawPath;
+ lstArg[n] = '\0';
}
- else
- free(rawPath);
+ else
+ free(rawPath);
}
cmd = aprintf("%s%s%s",
@@ -1468,16 +1468,16 @@ static CURLcode ftp_state_list(struct connectdata *conn)
(data->set.ftp_list_only?"NLST":"LIST"),
lstArg? " ": "",
lstArg? lstArg: "");
- free(lstArg);
+ free(lstArg);
- if(!cmd)
+ if(!cmd)
return CURLE_OUT_OF_MEMORY;
result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", cmd);
free(cmd);
- if(!result)
- state(conn, FTP_LIST);
+ if(!result)
+ state(conn, FTP_LIST);
return result;
}
@@ -1497,7 +1497,7 @@ static CURLcode ftp_state_stor_prequote(struct connectdata *conn)
static CURLcode ftp_state_type(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct Curl_easy *data = conn->data;
struct ftp_conn *ftpc = &conn->proto.ftpc;
@@ -1538,10 +1538,10 @@ static CURLcode ftp_state_mdtm(struct connectdata *conn)
/* we have requested to get the modified-time of the file, this is a white
spot as the MDTM is not mentioned in RFC959 */
- result = Curl_pp_sendf(&ftpc->pp, "MDTM %s", ftpc->file);
+ result = Curl_pp_sendf(&ftpc->pp, "MDTM %s", ftpc->file);
- if(!result)
- state(conn, FTP_MDTM);
+ if(!result)
+ state(conn, FTP_MDTM);
}
else
result = ftp_state_type(conn);
@@ -1555,7 +1555,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
bool sizechecked)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct Curl_easy *data = conn->data;
struct ftp_conn *ftpc = &conn->proto.ftpc;
@@ -1577,9 +1577,9 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
if(data->state.resume_from < 0) {
/* Got no given size to start from, figure it out */
- result = Curl_pp_sendf(&ftpc->pp, "SIZE %s", ftpc->file);
- if(!result)
- state(conn, FTP_STOR_SIZE);
+ result = Curl_pp_sendf(&ftpc->pp, "SIZE %s", ftpc->file);
+ if(!result)
+ state(conn, FTP_STOR_SIZE);
return result;
}
@@ -1641,10 +1641,10 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
/* we've passed, proceed as normal */
} /* resume_from */
- result = Curl_pp_sendf(&ftpc->pp, data->set.ftp_append?"APPE %s":"STOR %s",
- ftpc->file);
- if(!result)
- state(conn, FTP_STOR);
+ result = Curl_pp_sendf(&ftpc->pp, data->set.ftp_append?"APPE %s":"STOR %s",
+ ftpc->file);
+ if(!result)
+ state(conn, FTP_STOR);
return result;
}
@@ -1655,7 +1655,7 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
bool quote = FALSE;
struct curl_slist *item;
@@ -1702,9 +1702,9 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
else
ftpc->count2 = 0; /* failure means cancel operation */
- result = Curl_pp_sendf(&ftpc->pp, "%s", cmd);
- if(result)
- return result;
+ result = Curl_pp_sendf(&ftpc->pp, "%s", cmd);
+ if(result)
+ return result;
state(conn, instate);
quote = TRUE;
}
@@ -1733,14 +1733,14 @@ static CURLcode ftp_state_quote(struct connectdata *conn,
the server terminates it, otherwise the client stops if the
received byte count exceeds the reported file size. Set option
CURLOPT_IGNORE_CONTENT_LENGTH to 1 to enable this behavior.*/
- result = Curl_pp_sendf(&ftpc->pp, "RETR %s", ftpc->file);
- if(!result)
- state(conn, FTP_RETR);
+ result = Curl_pp_sendf(&ftpc->pp, "RETR %s", ftpc->file);
+ if(!result)
+ state(conn, FTP_RETR);
}
else {
- result = Curl_pp_sendf(&ftpc->pp, "SIZE %s", ftpc->file);
- if(!result)
- state(conn, FTP_RETR_SIZE);
+ result = Curl_pp_sendf(&ftpc->pp, "SIZE %s", ftpc->file);
+ if(!result)
+ state(conn, FTP_RETR_SIZE);
}
}
}
@@ -1762,11 +1762,11 @@ static CURLcode ftp_epsv_disable(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- if(conn->bits.ipv6
-#ifndef CURL_DISABLE_PROXY
- && !(conn->bits.tunnel_proxy || conn->bits.socksproxy)
-#endif
- ) {
+ if(conn->bits.ipv6
+#ifndef CURL_DISABLE_PROXY
+ && !(conn->bits.tunnel_proxy || conn->bits.socksproxy)
+#endif
+ ) {
/* We can't disable EPSV when doing IPv6, so this is instead a fail */
failf(conn->data, "Failed EPSV attempt, exiting\n");
return CURLE_WEIRD_SERVER_REPLY;
@@ -1777,12 +1777,12 @@ static CURLcode ftp_epsv_disable(struct connectdata *conn)
conn->bits.ftp_use_epsv = FALSE;
conn->data->state.errorbuf = FALSE; /* allow error message to get
rewritten */
- result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", "PASV");
- if(!result) {
- conn->proto.ftpc.count1++;
- /* remain in/go to the FTP_PASV state */
- state(conn, FTP_PASV);
- }
+ result = Curl_pp_sendf(&conn->proto.ftpc.pp, "%s", "PASV");
+ if(!result) {
+ conn->proto.ftpc.count1++;
+ /* remain in/go to the FTP_PASV state */
+ state(conn, FTP_PASV);
+ }
return result;
}
@@ -1793,10 +1793,10 @@ static char *control_address(struct connectdata *conn)
If a proxy tunnel is used, returns the original host name instead, because
the effective control connection address is the proxy address,
not the ftp host. */
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.tunnel_proxy || conn->bits.socksproxy)
return conn->host.name;
-#endif
+#endif
return conn->ip_addr_str;
}
@@ -1807,7 +1807,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
CURLcode result;
struct Curl_easy *data = conn->data;
struct Curl_dns_entry *addr = NULL;
- enum resolve_t rc;
+ enum resolve_t rc;
unsigned short connectport; /* the local port connect() should use! */
char *str = &data->state.buffer[4]; /* start on the first letter */
@@ -1861,8 +1861,8 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
else if((ftpc->count1 == 1) &&
(ftpcode == 227)) {
/* positive PASV response */
- unsigned int ip[4] = {0, 0, 0, 0};
- unsigned int port[2] = {0, 0};
+ unsigned int ip[4] = {0, 0, 0, 0};
+ unsigned int port[2] = {0, 0};
/*
* Scan for a sequence of six comma-separated numbers and use them as
@@ -1913,7 +1913,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
return CURLE_FTP_WEIRD_PASV_REPLY;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.proxy) {
/*
* This connection uses a proxy and we need to connect to the proxy again
@@ -1936,21 +1936,21 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
return CURLE_COULDNT_RESOLVE_PROXY;
}
}
- else
-#endif
- {
+ else
+#endif
+ {
/* normal, direct, ftp connection */
- DEBUGASSERT(ftpc->newhost);
-
- /* postponed address resolution in case of tcp fastopen */
- if(conn->bits.tcp_fastopen && !conn->bits.reuse && !ftpc->newhost[0]) {
- Curl_conninfo_remote(conn, conn->sock[FIRSTSOCKET]);
- Curl_safefree(ftpc->newhost);
- ftpc->newhost = strdup(control_address(conn));
- if(!ftpc->newhost)
- return CURLE_OUT_OF_MEMORY;
- }
-
+ DEBUGASSERT(ftpc->newhost);
+
+ /* postponed address resolution in case of tcp fastopen */
+ if(conn->bits.tcp_fastopen && !conn->bits.reuse && !ftpc->newhost[0]) {
+ Curl_conninfo_remote(conn, conn->sock[FIRSTSOCKET]);
+ Curl_safefree(ftpc->newhost);
+ ftpc->newhost = strdup(control_address(conn));
+ if(!ftpc->newhost)
+ return CURLE_OUT_OF_MEMORY;
+ }
+
rc = Curl_resolv(conn, ftpc->newhost, ftpc->newport, FALSE, &addr);
if(rc == CURLRESOLV_PENDING)
/* BLOCKING */
@@ -2041,7 +2041,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
switch(ftpcode) {
@@ -2058,7 +2058,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 = Curl_getdate_capped(timebuf);
+ data->info.filetime = Curl_getdate_capped(timebuf);
}
#ifdef CURL_FTP_HTTPSTYLE_HEAD
@@ -2100,7 +2100,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
break;
case 550: /* "No such file or directory" */
failf(data, "Given file does not exist");
- result = CURLE_REMOTE_FILE_NOT_FOUND;
+ result = CURLE_REMOTE_FILE_NOT_FOUND;
break;
}
@@ -2174,7 +2174,7 @@ static CURLcode ftp_state_retr(struct connectdata *conn,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if(data->set.max_filesize && (filesize > data->set.max_filesize)) {
@@ -2237,16 +2237,16 @@ static CURLcode ftp_state_retr(struct connectdata *conn,
infof(data, "Instructs server to resume from offset %"
CURL_FORMAT_CURL_OFF_T "\n", data->state.resume_from);
- result = Curl_pp_sendf(&ftpc->pp, "REST %" CURL_FORMAT_CURL_OFF_T,
- data->state.resume_from);
- if(!result)
- state(conn, FTP_RETR_REST);
+ result = Curl_pp_sendf(&ftpc->pp, "REST %" CURL_FORMAT_CURL_OFF_T,
+ data->state.resume_from);
+ if(!result)
+ state(conn, FTP_RETR_REST);
}
else {
/* no resume */
- result = Curl_pp_sendf(&ftpc->pp, "RETR %s", ftpc->file);
- if(!result)
- state(conn, FTP_RETR);
+ result = Curl_pp_sendf(&ftpc->pp, "RETR %s", ftpc->file);
+ if(!result)
+ state(conn, FTP_RETR);
}
return result;
@@ -2262,30 +2262,30 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn,
char *buf = data->state.buffer;
/* get the size from the ascii string: */
- if(ftpcode == 213) {
- /* To allow servers to prepend "rubbish" in the response string, we scan
- for all the digits at the end of the response and parse only those as a
- number. */
- char *start = &buf[4];
- char *fdigit = strchr(start, '\r');
- if(fdigit) {
- do
- fdigit--;
- while(ISDIGIT(*fdigit) && (fdigit > start));
- if(!ISDIGIT(*fdigit))
- fdigit++;
- }
- else
- fdigit = start;
+ if(ftpcode == 213) {
+ /* To allow servers to prepend "rubbish" in the response string, we scan
+ for all the digits at the end of the response and parse only those as a
+ number. */
+ char *start = &buf[4];
+ char *fdigit = strchr(start, '\r');
+ if(fdigit) {
+ do
+ fdigit--;
+ while(ISDIGIT(*fdigit) && (fdigit > start));
+ if(!ISDIGIT(*fdigit))
+ fdigit++;
+ }
+ else
+ fdigit = start;
/* ignores parsing errors, which will make the size remain unknown */
- (void)curlx_strtoofft(fdigit, NULL, 0, &filesize);
-
- }
- else if(ftpcode == 550) { /* "No such file or directory" */
- failf(data, "The file does not exist");
- return CURLE_REMOTE_FILE_NOT_FOUND;
- }
-
+ (void)curlx_strtoofft(fdigit, NULL, 0, &filesize);
+
+ }
+ else if(ftpcode == 550) { /* "No such file or directory" */
+ failf(data, "The file does not exist");
+ return CURLE_REMOTE_FILE_NOT_FOUND;
+ }
+
if(instate == FTP_SIZE) {
#ifdef CURL_FTP_HTTPSTYLE_HEAD
if(-1 != filesize) {
@@ -2339,9 +2339,9 @@ static CURLcode ftp_state_rest_resp(struct connectdata *conn,
result = CURLE_FTP_COULDNT_USE_REST;
}
else {
- result = Curl_pp_sendf(&ftpc->pp, "RETR %s", ftpc->file);
- if(!result)
- state(conn, FTP_RETR);
+ result = Curl_pp_sendf(&ftpc->pp, "RETR %s", ftpc->file);
+ if(!result)
+ state(conn, FTP_RETR);
}
break;
}
@@ -2392,7 +2392,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
if((ftpcode == 150) || (ftpcode == 125)) {
@@ -2518,7 +2518,7 @@ static CURLcode ftp_state_loggedin(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- if(conn->bits.ftp_use_control_ssl) {
+ if(conn->bits.ftp_use_control_ssl) {
/* PBSZ = PROTECTION BUFFER SIZE.
The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says:
@@ -2533,9 +2533,9 @@ static CURLcode ftp_state_loggedin(struct connectdata *conn)
parameter of '0' to indicate that no buffering is taking place
and the data connection should not be encapsulated.
*/
- result = Curl_pp_sendf(&conn->proto.ftpc.pp, "PBSZ %d", 0);
- if(!result)
- state(conn, FTP_PBSZ);
+ result = Curl_pp_sendf(&conn->proto.ftpc.pp, "PBSZ %d", 0);
+ if(!result)
+ state(conn, FTP_PBSZ);
}
else {
result = ftp_state_pwd(conn);
@@ -2557,9 +2557,9 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
if((ftpcode == 331) && (ftpc->state == FTP_USER)) {
/* 331 Password required for ...
(the server requires to send the user's password too) */
- result = Curl_pp_sendf(&ftpc->pp, "PASS %s", conn->passwd?conn->passwd:"");
- if(!result)
- state(conn, FTP_PASS);
+ result = Curl_pp_sendf(&ftpc->pp, "PASS %s", conn->passwd?conn->passwd:"");
+ if(!result)
+ state(conn, FTP_PASS);
}
else if(ftpcode/100 == 2) {
/* 230 User ... logged in.
@@ -2568,10 +2568,10 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
}
else if(ftpcode == 332) {
if(data->set.str[STRING_FTP_ACCOUNT]) {
- result = Curl_pp_sendf(&ftpc->pp, "ACCT %s",
- data->set.str[STRING_FTP_ACCOUNT]);
- if(!result)
- state(conn, FTP_ACCT);
+ result = Curl_pp_sendf(&ftpc->pp, "ACCT %s",
+ data->set.str[STRING_FTP_ACCOUNT]);
+ if(!result)
+ state(conn, FTP_ACCT);
}
else {
failf(data, "ACCT requested but none available");
@@ -2587,13 +2587,13 @@ static CURLcode ftp_state_user_resp(struct connectdata *conn,
if(conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER] &&
!conn->data->state.ftp_trying_alternative) {
/* Ok, USER failed. Let's try the supplied command. */
- result =
- Curl_pp_sendf(&ftpc->pp, "%s",
- conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]);
- if(!result) {
- conn->data->state.ftp_trying_alternative = TRUE;
- state(conn, FTP_USER);
- }
+ result =
+ Curl_pp_sendf(&ftpc->pp, "%s",
+ conn->data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]);
+ if(!result) {
+ conn->data->state.ftp_trying_alternative = TRUE;
+ state(conn, FTP_USER);
+ }
}
else {
failf(data, "Access denied: %03d", ftpcode);
@@ -2669,8 +2669,8 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
}
#endif
- if(data->set.use_ssl && !conn->bits.ftp_use_control_ssl) {
- /* We don't have a SSL/TLS control connection yet, but FTPS is
+ if(data->set.use_ssl && !conn->bits.ftp_use_control_ssl) {
+ /* We don't have a SSL/TLS control connection yet, but FTPS is
requested. Try a FTPS connection now */
ftpc->count3 = 0;
@@ -2689,11 +2689,11 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
(int)data->set.ftpsslauth);
return CURLE_UNKNOWN_OPTION; /* we don't know what to do */
}
- result = Curl_pp_sendf(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]);
- if(!result)
- state(conn, FTP_AUTH);
+ result = Curl_pp_sendf(&ftpc->pp, "AUTH %s", ftpauth[ftpc->count1]);
+ if(!result)
+ state(conn, FTP_AUTH);
}
- else
+ else
result = ftp_state_user(conn);
break;
@@ -2712,7 +2712,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
result = Curl_ssl_connect(conn, FIRSTSOCKET);
if(!result) {
conn->bits.ftp_use_data_ssl = FALSE; /* clear-text data */
- conn->bits.ftp_use_control_ssl = TRUE; /* SSL on control */
+ conn->bits.ftp_use_control_ssl = TRUE; /* SSL on control */
result = ftp_state_user(conn);
}
}
@@ -2742,11 +2742,11 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
break;
case FTP_PBSZ:
- result =
- Curl_pp_sendf(&ftpc->pp, "PROT %c",
- data->set.use_ssl == CURLUSESSL_CONTROL ? 'C' : 'P');
- if(!result)
- state(conn, FTP_PROT);
+ result =
+ Curl_pp_sendf(&ftpc->pp, "PROT %c",
+ data->set.use_ssl == CURLUSESSL_CONTROL ? 'C' : 'P');
+ if(!result)
+ state(conn, FTP_PROT);
break;
case FTP_PROT:
@@ -2763,11 +2763,11 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
if(data->set.ftp_ccc) {
/* CCC - Clear Command Channel
*/
- result = Curl_pp_sendf(&ftpc->pp, "%s", "CCC");
- if(!result)
- state(conn, FTP_CCC);
+ result = Curl_pp_sendf(&ftpc->pp, "%s", "CCC");
+ if(!result)
+ state(conn, FTP_CCC);
}
- else
+ else
result = ftp_state_pwd(conn);
break;
@@ -2776,12 +2776,12 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
/* First shut down the SSL layer (note: this call will block) */
result = Curl_ssl_shutdown(conn, FIRSTSOCKET);
- if(result)
+ if(result)
failf(conn->data, "Failed to clear the command channel (CCC)");
}
- if(!result)
- /* Then continue as normal */
- result = ftp_state_pwd(conn);
+ if(!result)
+ /* Then continue as normal */
+ result = ftp_state_pwd(conn);
break;
case FTP_PWD:
@@ -2831,7 +2831,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
store++;
ptr++;
}
- *store = '\0'; /* null-terminate */
+ *store = '\0'; /* null-terminate */
}
if(entry_extracted) {
/* If the path name does not look like an absolute path (i.e.: it
@@ -2894,7 +2894,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
ptr++;
for(store = os; *ptr && *ptr != ' ';)
*store++ = *ptr++;
- *store = '\0'; /* null-terminate */
+ *store = '\0'; /* null-terminate */
/* Check for special servers here. */
@@ -2942,10 +2942,10 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
if((ftpcode >= 400) && !ftpc->count2) {
/* failure response code, and not allowed to fail */
failf(conn->data, "QUOT command failed with %03d", ftpcode);
- result = CURLE_QUOTE_ERROR;
+ result = CURLE_QUOTE_ERROR;
}
- else
- result = ftp_state_quote(conn, FALSE, ftpc->state);
+ else
+ result = ftp_state_quote(conn, FALSE, ftpc->state);
break;
case FTP_CWD:
@@ -2955,27 +2955,27 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
ftpc->cwdcount && !ftpc->count2) {
/* try making it */
ftpc->count2++; /* counter to prevent CWD-MKD loops */
- result = Curl_pp_sendf(&ftpc->pp, "MKD %s",
- ftpc->dirs[ftpc->cwdcount - 1]);
- if(!result)
- state(conn, FTP_MKD);
+ result = Curl_pp_sendf(&ftpc->pp, "MKD %s",
+ ftpc->dirs[ftpc->cwdcount - 1]);
+ if(!result)
+ state(conn, FTP_MKD);
}
else {
/* return failure */
failf(data, "Server denied you to change to the given directory");
ftpc->cwdfail = TRUE; /* don't remember this path as we failed
to enter it */
- result = CURLE_REMOTE_ACCESS_DENIED;
+ result = CURLE_REMOTE_ACCESS_DENIED;
}
}
else {
/* success */
ftpc->count2 = 0;
- if(++ftpc->cwdcount <= ftpc->dirdepth)
+ if(++ftpc->cwdcount <= ftpc->dirdepth)
/* send next CWD */
- result = Curl_pp_sendf(&ftpc->pp, "CWD %s",
- ftpc->dirs[ftpc->cwdcount - 1]);
- else
+ result = Curl_pp_sendf(&ftpc->pp, "CWD %s",
+ ftpc->dirs[ftpc->cwdcount - 1]);
+ else
result = ftp_state_mdtm(conn);
}
break;
@@ -2984,14 +2984,14 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
if((ftpcode/100 != 2) && !ftpc->count3--) {
/* failure to MKD the dir */
failf(data, "Failed to MKD dir: %03d", ftpcode);
- result = CURLE_REMOTE_ACCESS_DENIED;
+ result = CURLE_REMOTE_ACCESS_DENIED;
+ }
+ else {
+ state(conn, FTP_CWD);
+ /* send CWD */
+ result = Curl_pp_sendf(&ftpc->pp, "CWD %s",
+ ftpc->dirs[ftpc->cwdcount - 1]);
}
- else {
- state(conn, FTP_CWD);
- /* send CWD */
- result = Curl_pp_sendf(&ftpc->pp, "CWD %s",
- ftpc->dirs[ftpc->cwdcount - 1]);
- }
break;
case FTP_MDTM:
@@ -3094,7 +3094,7 @@ static CURLcode ftp_block_statemach(struct connectdata *conn)
*
*/
static CURLcode ftp_connect(struct connectdata *conn,
- bool *done) /* see description above */
+ bool *done) /* see description above */
{
CURLcode result;
struct ftp_conn *ftpc = &conn->proto.ftpc;
@@ -3115,10 +3115,10 @@ static CURLcode ftp_connect(struct connectdata *conn,
result = Curl_ssl_connect(conn, FIRSTSOCKET);
if(result)
return result;
- conn->bits.ftp_use_control_ssl = TRUE;
+ conn->bits.ftp_use_control_ssl = TRUE;
}
- Curl_pp_setup(pp); /* once per transfer */
+ Curl_pp_setup(pp); /* once per transfer */
Curl_pp_init(pp); /* init the generic pingpong data */
/* When we connect, we start in the state where we await the 220
@@ -3143,14 +3143,14 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
bool premature)
{
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
struct pingpong *pp = &ftpc->pp;
ssize_t nread;
int ftpcode;
CURLcode result = CURLE_OK;
- char *rawPath = NULL;
- size_t pathLen = 0;
+ char *rawPath = NULL;
+ size_t pathLen = 0;
if(!ftp)
return CURLE_OK;
@@ -3198,42 +3198,42 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
}
if(!result)
- /* get the url-decoded "raw" path */
- result = Curl_urldecode(data, ftp->path, 0, &rawPath, &pathLen,
- REJECT_CTRL);
+ /* get the url-decoded "raw" path */
+ result = Curl_urldecode(data, ftp->path, 0, &rawPath, &pathLen,
+ REJECT_CTRL);
if(result) {
/* We can limp along anyway (and should try to since we may already be in
* the error path) */
ftpc->ctl_valid = FALSE; /* mark control connection as bad */
connclose(conn, "FTP: out of memory!"); /* mark for connection closure */
- free(ftpc->prevpath);
+ free(ftpc->prevpath);
ftpc->prevpath = NULL; /* no path remembering */
}
- else { /* remember working directory for connection reuse */
- if((data->set.ftp_filemethod == FTPFILE_NOCWD) && (rawPath[0] == '/'))
- free(rawPath); /* full path => no CWDs happened => keep ftpc->prevpath */
- else {
- free(ftpc->prevpath);
-
- if(!ftpc->cwdfail) {
- if(data->set.ftp_filemethod == FTPFILE_NOCWD)
- pathLen = 0; /* relative path => working directory is FTP home */
- else
- pathLen -= ftpc->file?strlen(ftpc->file):0; /* file is url-decoded */
-
- rawPath[pathLen] = '\0';
- ftpc->prevpath = rawPath;
+ else { /* remember working directory for connection reuse */
+ if((data->set.ftp_filemethod == FTPFILE_NOCWD) && (rawPath[0] == '/'))
+ free(rawPath); /* full path => no CWDs happened => keep ftpc->prevpath */
+ else {
+ free(ftpc->prevpath);
+
+ if(!ftpc->cwdfail) {
+ if(data->set.ftp_filemethod == FTPFILE_NOCWD)
+ pathLen = 0; /* relative path => working directory is FTP home */
+ else
+ pathLen -= ftpc->file?strlen(ftpc->file):0; /* file is url-decoded */
+
+ rawPath[pathLen] = '\0';
+ ftpc->prevpath = rawPath;
}
else {
- free(rawPath);
- ftpc->prevpath = NULL; /* no path */
+ free(rawPath);
+ ftpc->prevpath = NULL; /* no path */
}
}
-
- if(ftpc->prevpath)
- infof(data, "Remembering we are in dir \"%s\"\n", ftpc->prevpath);
+
+ if(ftpc->prevpath)
+ infof(data, "Remembering we are in dir \"%s\"\n", ftpc->prevpath);
}
-
+
/* free the dir tree and file parts */
freedirs(ftpc);
@@ -3274,7 +3274,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
* data has been transferred. This happens when doing through NATs etc that
* abandon old silent connections.
*/
- timediff_t old_time = pp->response_time;
+ timediff_t old_time = pp->response_time;
pp->response_time = 60*1000; /* give it only a minute for now */
pp->response = Curl_now(); /* timeout relative now */
@@ -3302,18 +3302,18 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
if(!ftpc->dont_check) {
/* 226 Transfer complete, 250 Requested file action okay, completed. */
- switch(ftpcode) {
- case 226:
- case 250:
- break;
- case 552:
- failf(data, "Exceeded storage allocation");
- result = CURLE_REMOTE_DISK_FULL;
- break;
- default:
+ switch(ftpcode) {
+ case 226:
+ case 250:
+ break;
+ case 552:
+ failf(data, "Exceeded storage allocation");
+ result = CURLE_REMOTE_DISK_FULL;
+ break;
+ default:
failf(data, "server did not report OK, got %d", ftpcode);
result = CURLE_PARTIAL_FILE;
- break;
+ break;
}
}
}
@@ -3388,11 +3388,11 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
item = quote;
while(item) {
if(item->data) {
- ssize_t nread;
+ ssize_t nread;
char *cmd = item->data;
bool acceptfail = FALSE;
- CURLcode result;
- int ftpcode = 0;
+ CURLcode result;
+ int ftpcode = 0;
/* if a command starts with an asterisk, which a legal FTP command never
can, the command will be allowed to fail without it causing any
@@ -3404,11 +3404,11 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
acceptfail = TRUE;
}
- result = Curl_pp_sendf(&ftpc->pp, "%s", cmd);
- if(!result) {
- pp->response = Curl_now(); /* timeout relative now */
- result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
- }
+ result = Curl_pp_sendf(&ftpc->pp, "%s", cmd);
+ if(!result) {
+ pp->response = Curl_now(); /* timeout relative now */
+ result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
+ }
if(result)
return result;
@@ -3456,14 +3456,14 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
return ftp_state_type_resp(conn, 200, newstate);
}
- result = Curl_pp_sendf(&ftpc->pp, "TYPE %c", want);
- if(!result) {
- state(conn, newstate);
+ result = Curl_pp_sendf(&ftpc->pp, "TYPE %c", want);
+ if(!result) {
+ state(conn, newstate);
- /* keep track of our current transfer type */
- ftpc->transfertype = want;
- }
- return result;
+ /* keep track of our current transfer type */
+ ftpc->transfertype = want;
+ }
+ return result;
}
/***************************************************************************
@@ -3478,7 +3478,7 @@ static CURLcode ftp_nb_type(struct connectdata *conn,
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void
ftp_pasv_verbose(struct connectdata *conn,
- struct Curl_addrinfo *ai,
+ struct Curl_addrinfo *ai,
char *newhost, /* ascii version */
int port)
{
@@ -3508,7 +3508,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, int *completep)
bool complete = FALSE;
/* the ftp struct is inited in ftp_connect() */
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
/* if the second connection isn't done yet, wait for it */
if(!conn->bits.tcpconnect[SECONDARYSOCKET]) {
@@ -3536,7 +3536,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, int *completep)
}
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
result = Curl_proxy_connect(conn, SECONDARYSOCKET);
if(result)
return result;
@@ -3547,7 +3547,7 @@ static CURLcode ftp_do_more(struct connectdata *conn, int *completep)
if(conn->bits.tunnel_proxy && conn->bits.httpproxy &&
Curl_connect_ongoing(conn))
return result;
-#endif
+#endif
if(ftpc->state) {
/* already in a state so skip the initial commands.
@@ -3558,13 +3558,13 @@ static CURLcode ftp_do_more(struct connectdata *conn, int *completep)
/* if we got an error or if we don't wait for a data connection return
immediately */
- if(result || !ftpc->wait_data_conn)
+ if(result || !ftpc->wait_data_conn)
return result;
- /* if we reach the end of the FTP state machine here, *complete will be
- TRUE but so is ftpc->wait_data_conn, which says we need to wait for the
- data connection and therefore we're not actually complete */
- *completep = 0;
+ /* if we reach the end of the FTP state machine here, *complete will be
+ TRUE but so is ftpc->wait_data_conn, which says we need to wait for the
+ data connection and therefore we're not actually complete */
+ *completep = 0;
}
if(ftp->transfer <= FTPTRANSFER_INFO) {
@@ -3598,8 +3598,8 @@ static CURLcode ftp_do_more(struct connectdata *conn, int *completep)
return result;
result = ftp_multi_statemach(conn, &complete);
- /* ftpc->wait_data_conn is always false here */
- *completep = (int)complete;
+ /* ftpc->wait_data_conn is always false here */
+ *completep = (int)complete;
}
else {
/* download */
@@ -3639,8 +3639,8 @@ static CURLcode ftp_do_more(struct connectdata *conn, int *completep)
return result;
}
- /* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ /* no data to transfer */
+ Curl_setup_transfer(data, -1, -1, FALSE, -1);
if(!ftpc->wait_data_conn) {
/* no waiting for the data connection so this is now complete */
@@ -3673,7 +3673,7 @@ CURLcode ftp_perform(struct connectdata *conn,
if(conn->data->set.opt_no_body) {
/* requested no body means no transfer... */
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
ftp->transfer = FTPTRANSFER_INFO;
}
@@ -3708,7 +3708,7 @@ static void wc_data_dtor(void *ptr)
static CURLcode init_wc_data(struct connectdata *conn)
{
char *last_slash;
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
char *path = ftp->path;
struct WildcardData *wildcard = &(conn->data->wildcard);
CURLcode result = CURLE_OK;
@@ -3805,126 +3805,126 @@ static CURLcode wc_statemach(struct connectdata *conn)
struct WildcardData * const wildcard = &(conn->data->wildcard);
CURLcode result = CURLE_OK;
- for(;;) {
- switch(wildcard->state) {
- case CURLWC_INIT:
- result = init_wc_data(conn);
- if(wildcard->state == CURLWC_CLEAN)
- /* only listing! */
- return result;
- wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
- return result;
-
- case CURLWC_MATCHING: {
- /* In this state is LIST response successfully parsed, so lets restore
- previous WRITEFUNCTION callback and WRITEDATA pointer */
- struct ftp_wc *ftpwc = wildcard->protdata;
- conn->data->set.fwrite_func = ftpwc->backup.write_function;
- conn->data->set.out = ftpwc->backup.file_descriptor;
- ftpwc->backup.write_function = ZERO_NULL;
- ftpwc->backup.file_descriptor = NULL;
- wildcard->state = CURLWC_DOWNLOADING;
-
- if(Curl_ftp_parselist_geterror(ftpwc->parser)) {
- /* error found in LIST parsing */
- wildcard->state = CURLWC_CLEAN;
- continue;
- }
- if(wildcard->filelist.size == 0) {
- /* no corresponding file */
- wildcard->state = CURLWC_CLEAN;
- return CURLE_REMOTE_FILE_NOT_FOUND;
- }
- continue;
+ for(;;) {
+ switch(wildcard->state) {
+ case CURLWC_INIT:
+ result = init_wc_data(conn);
+ if(wildcard->state == CURLWC_CLEAN)
+ /* only listing! */
+ return result;
+ wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
+ return result;
+
+ case CURLWC_MATCHING: {
+ /* In this state is LIST response successfully parsed, so lets restore
+ previous WRITEFUNCTION callback and WRITEDATA pointer */
+ struct ftp_wc *ftpwc = wildcard->protdata;
+ conn->data->set.fwrite_func = ftpwc->backup.write_function;
+ conn->data->set.out = ftpwc->backup.file_descriptor;
+ ftpwc->backup.write_function = ZERO_NULL;
+ ftpwc->backup.file_descriptor = NULL;
+ wildcard->state = CURLWC_DOWNLOADING;
+
+ if(Curl_ftp_parselist_geterror(ftpwc->parser)) {
+ /* error found in LIST parsing */
+ wildcard->state = CURLWC_CLEAN;
+ continue;
+ }
+ if(wildcard->filelist.size == 0) {
+ /* no corresponding file */
+ wildcard->state = CURLWC_CLEAN;
+ return CURLE_REMOTE_FILE_NOT_FOUND;
+ }
+ continue;
}
- case CURLWC_DOWNLOADING: {
- /* filelist has at least one file, lets get first one */
- struct ftp_conn *ftpc = &conn->proto.ftpc;
- struct curl_fileinfo *finfo = wildcard->filelist.head->ptr;
- struct FTP *ftp = conn->data->req.p.ftp;
-
- char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
- if(!tmp_path)
- return CURLE_OUT_OF_MEMORY;
-
- /* switch default ftp->path and tmp_path */
- free(ftp->pathalloc);
- ftp->pathalloc = ftp->path = tmp_path;
-
- infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename);
- if(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",
- finfo->filename);
- wildcard->state = CURLWC_SKIP;
- continue;
- case CURL_CHUNK_BGN_FUNC_FAIL:
- return CURLE_CHUNK_FAILED;
- }
- }
-
- if(finfo->filetype != CURLFILETYPE_FILE) {
+ case CURLWC_DOWNLOADING: {
+ /* filelist has at least one file, lets get first one */
+ struct ftp_conn *ftpc = &conn->proto.ftpc;
+ struct curl_fileinfo *finfo = wildcard->filelist.head->ptr;
+ struct FTP *ftp = conn->data->req.p.ftp;
+
+ char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
+ if(!tmp_path)
+ return CURLE_OUT_OF_MEMORY;
+
+ /* switch default ftp->path and tmp_path */
+ free(ftp->pathalloc);
+ ftp->pathalloc = ftp->path = tmp_path;
+
+ infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename);
+ if(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",
+ finfo->filename);
+ wildcard->state = CURLWC_SKIP;
+ continue;
+ case CURL_CHUNK_BGN_FUNC_FAIL:
+ return CURLE_CHUNK_FAILED;
+ }
+ }
+
+ if(finfo->filetype != CURLFILETYPE_FILE) {
wildcard->state = CURLWC_SKIP;
- continue;
+ continue;
}
- if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE)
- ftpc->known_filesize = finfo->size;
-
- result = ftp_parse_url_path(conn);
- if(result)
- return result;
-
- /* we don't need the Curl_fileinfo of first file anymore */
- Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
-
- if(wildcard->filelist.size == 0) { /* remains only one file to down. */
- wildcard->state = CURLWC_CLEAN;
- /* after that will be ftp_do called once again and no transfer
- will be done because of CURLWC_CLEAN state */
- return CURLE_OK;
- }
+ if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE)
+ ftpc->known_filesize = finfo->size;
+
+ result = ftp_parse_url_path(conn);
+ if(result)
+ return result;
+
+ /* we don't need the Curl_fileinfo of first file anymore */
+ Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
+
+ if(wildcard->filelist.size == 0) { /* remains only one file to down. */
+ wildcard->state = CURLWC_CLEAN;
+ /* after that will be ftp_do called once again and no transfer
+ will be done because of CURLWC_CLEAN state */
+ return CURLE_OK;
+ }
return result;
}
- case CURLWC_SKIP: {
- 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;
- continue;
+ case CURLWC_SKIP: {
+ 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;
+ continue;
+ }
+
+ case CURLWC_CLEAN: {
+ struct ftp_wc *ftpwc = wildcard->protdata;
+ result = CURLE_OK;
+ if(ftpwc)
+ result = Curl_ftp_parselist_geterror(ftpwc->parser);
+
+ wildcard->state = result ? CURLWC_ERROR : CURLWC_DONE;
+ return result;
}
- case CURLWC_CLEAN: {
- struct ftp_wc *ftpwc = wildcard->protdata;
- result = CURLE_OK;
- if(ftpwc)
- result = Curl_ftp_parselist_geterror(ftpwc->parser);
-
- wildcard->state = result ? CURLWC_ERROR : CURLWC_DONE;
- return result;
- }
-
- case CURLWC_DONE:
- case CURLWC_ERROR:
- case CURLWC_CLEAR:
- if(wildcard->dtor)
- wildcard->dtor(wildcard->protdata);
- return result;
- }
+ case CURLWC_DONE:
+ case CURLWC_ERROR:
+ case CURLWC_CLEAR:
+ if(wildcard->dtor)
+ wildcard->dtor(wildcard->protdata);
+ return result;
+ }
}
- /* UNREACHABLE */
+ /* UNREACHABLE */
}
/***********************************************************************
@@ -4028,12 +4028,12 @@ static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection)
if(data->state.most_recent_ftp_entrypath == ftpc->entrypath) {
data->state.most_recent_ftp_entrypath = NULL;
}
- Curl_safefree(ftpc->entrypath);
+ Curl_safefree(ftpc->entrypath);
}
freedirs(ftpc);
- Curl_safefree(ftpc->prevpath);
- Curl_safefree(ftpc->server_os);
+ Curl_safefree(ftpc->prevpath);
+ Curl_safefree(ftpc->server_os);
Curl_pp_disconnect(pp);
Curl_sec_end(conn);
return CURLE_OK;
@@ -4051,144 +4051,144 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
{
struct Curl_easy *data = conn->data;
/* the ftp struct is already inited in ftp_connect() */
- struct FTP *ftp = data->req.p.ftp;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
- const char *slashPos = NULL;
- const char *fileName = NULL;
- CURLcode result = CURLE_OK;
- char *rawPath = NULL; /* url-decoded "raw" path */
- size_t pathLen = 0;
+ const char *slashPos = NULL;
+ const char *fileName = NULL;
+ CURLcode result = CURLE_OK;
+ char *rawPath = NULL; /* url-decoded "raw" path */
+ size_t pathLen = 0;
ftpc->ctl_valid = FALSE;
ftpc->cwdfail = FALSE;
- /* url-decode ftp path before further evaluation */
- result = Curl_urldecode(data, ftp->path, 0, &rawPath, &pathLen, REJECT_CTRL);
- if(result)
- return result;
-
+ /* url-decode ftp path before further evaluation */
+ result = Curl_urldecode(data, ftp->path, 0, &rawPath, &pathLen, REJECT_CTRL);
+ if(result)
+ return result;
+
switch(data->set.ftp_filemethod) {
- case FTPFILE_NOCWD: /* fastest, but less standard-compliant */
-
- if((pathLen > 0) && (rawPath[pathLen - 1] != '/'))
- fileName = rawPath; /* this is a full file path */
- /*
- else: ftpc->file is not used anywhere other than for operations on
- a file. In other words, never for directory operations.
- So we can safely leave filename as NULL here and use it as a
- argument in dir/file decisions.
- */
- break;
-
- case FTPFILE_SINGLECWD:
- slashPos = strrchr(rawPath, '/');
- if(slashPos) {
- /* get path before last slash, except for / */
- size_t dirlen = slashPos - rawPath;
- if(dirlen == 0)
- dirlen++;
-
- ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0]));
- if(!ftpc->dirs) {
- free(rawPath);
- return CURLE_OUT_OF_MEMORY;
- }
-
- ftpc->dirs[0] = calloc(1, dirlen + 1);
- if(!ftpc->dirs[0]) {
- free(rawPath);
- return CURLE_OUT_OF_MEMORY;
- }
-
- strncpy(ftpc->dirs[0], rawPath, dirlen);
- ftpc->dirdepth = 1; /* we consider it to be a single dir */
- fileName = slashPos + 1; /* rest is file name */
- }
- else
- fileName = rawPath; /* file name only (or empty) */
+ case FTPFILE_NOCWD: /* fastest, but less standard-compliant */
+
+ if((pathLen > 0) && (rawPath[pathLen - 1] != '/'))
+ fileName = rawPath; /* this is a full file path */
+ /*
+ else: ftpc->file is not used anywhere other than for operations on
+ a file. In other words, never for directory operations.
+ So we can safely leave filename as NULL here and use it as a
+ argument in dir/file decisions.
+ */
break;
- default: /* allow pretty much anything */
- case FTPFILE_MULTICWD: {
- /* current position: begin of next path component */
- const char *curPos = rawPath;
+ case FTPFILE_SINGLECWD:
+ slashPos = strrchr(rawPath, '/');
+ if(slashPos) {
+ /* get path before last slash, except for / */
+ size_t dirlen = slashPos - rawPath;
+ if(dirlen == 0)
+ dirlen++;
+
+ ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0]));
+ if(!ftpc->dirs) {
+ free(rawPath);
+ return CURLE_OUT_OF_MEMORY;
+ }
- int dirAlloc = 0; /* number of entries allocated for the 'dirs' array */
- const char *str = rawPath;
- for(; *str != 0; ++str)
- if (*str == '/')
- ++dirAlloc;
+ ftpc->dirs[0] = calloc(1, dirlen + 1);
+ if(!ftpc->dirs[0]) {
+ free(rawPath);
+ return CURLE_OUT_OF_MEMORY;
+ }
- if(dirAlloc > 0) {
- ftpc->dirs = calloc(dirAlloc, sizeof(ftpc->dirs[0]));
- if(!ftpc->dirs) {
- free(rawPath);
- return CURLE_OUT_OF_MEMORY;
- }
+ strncpy(ftpc->dirs[0], rawPath, dirlen);
+ ftpc->dirdepth = 1; /* we consider it to be a single dir */
+ fileName = slashPos + 1; /* rest is file name */
+ }
+ else
+ fileName = rawPath; /* file name only (or empty) */
+ break;
+
+ default: /* allow pretty much anything */
+ case FTPFILE_MULTICWD: {
+ /* current position: begin of next path component */
+ const char *curPos = rawPath;
+
+ int dirAlloc = 0; /* number of entries allocated for the 'dirs' array */
+ const char *str = rawPath;
+ for(; *str != 0; ++str)
+ if (*str == '/')
+ ++dirAlloc;
+
+ if(dirAlloc > 0) {
+ ftpc->dirs = calloc(dirAlloc, sizeof(ftpc->dirs[0]));
+ if(!ftpc->dirs) {
+ free(rawPath);
+ return CURLE_OUT_OF_MEMORY;
+ }
- /* parse the URL path into separate path components */
- while((slashPos = strchr(curPos, '/')) != NULL) {
- size_t compLen = slashPos - curPos;
+ /* parse the URL path into separate path components */
+ while((slashPos = strchr(curPos, '/')) != NULL) {
+ size_t compLen = slashPos - curPos;
- /* path starts with a slash: add that as a directory */
- if((compLen == 0) && (ftpc->dirdepth == 0))
- ++compLen;
+ /* path starts with a slash: add that as a directory */
+ if((compLen == 0) && (ftpc->dirdepth == 0))
+ ++compLen;
/* we skip empty path components, like "x//y" since the FTP command
CWD requires a parameter and a non-existent parameter a) doesn't
work on many servers and b) has no effect on the others. */
- if(compLen > 0) {
- char *comp = calloc(1, compLen + 1);
- if(!comp) {
- free(rawPath);
+ if(compLen > 0) {
+ char *comp = calloc(1, compLen + 1);
+ if(!comp) {
+ free(rawPath);
return CURLE_OUT_OF_MEMORY;
}
- strncpy(comp, curPos, compLen);
- ftpc->dirs[ftpc->dirdepth++] = comp;
+ strncpy(comp, curPos, compLen);
+ ftpc->dirs[ftpc->dirdepth++] = comp;
}
- curPos = slashPos + 1;
+ curPos = slashPos + 1;
}
}
- DEBUGASSERT(ftpc->dirdepth <= dirAlloc);
- fileName = curPos; /* the rest is the file name (or empty) */
+ DEBUGASSERT(ftpc->dirdepth <= dirAlloc);
+ fileName = curPos; /* the rest is the file name (or empty) */
}
break;
} /* switch */
- if(fileName && *fileName)
- ftpc->file = strdup(fileName);
+ if(fileName && *fileName)
+ ftpc->file = strdup(fileName);
else
- ftpc->file = NULL; /* instead of point to a zero byte,
- we make it a NULL pointer */
+ ftpc->file = NULL; /* instead of point to a zero byte,
+ we make it a NULL pointer */
if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {
/* We need a file name when uploading. Return error! */
failf(data, "Uploading to a URL without a file name!");
- free(rawPath);
+ free(rawPath);
return CURLE_URL_MALFORMAT;
}
ftpc->cwddone = FALSE; /* default to not done */
- if((data->set.ftp_filemethod == FTPFILE_NOCWD) && (rawPath[0] == '/'))
- ftpc->cwddone = TRUE; /* skip CWD for absolute paths */
- else { /* newly created FTP connections are already in entry path */
- const char *oldPath = conn->bits.reuse ? ftpc->prevpath : "";
- if(oldPath) {
- size_t n = pathLen;
- if(data->set.ftp_filemethod == FTPFILE_NOCWD)
- n = 0; /* CWD to entry for relative paths */
- else
- n -= ftpc->file?strlen(ftpc->file):0;
-
- if((strlen(oldPath) == n) && !strncmp(rawPath, oldPath, n)) {
- infof(data, "Request has same path as previous transfer\n");
- ftpc->cwddone = TRUE;
- }
+ if((data->set.ftp_filemethod == FTPFILE_NOCWD) && (rawPath[0] == '/'))
+ ftpc->cwddone = TRUE; /* skip CWD for absolute paths */
+ else { /* newly created FTP connections are already in entry path */
+ const char *oldPath = conn->bits.reuse ? ftpc->prevpath : "";
+ if(oldPath) {
+ size_t n = pathLen;
+ if(data->set.ftp_filemethod == FTPFILE_NOCWD)
+ n = 0; /* CWD to entry for relative paths */
+ else
+ n -= ftpc->file?strlen(ftpc->file):0;
+
+ if((strlen(oldPath) == n) && !strncmp(rawPath, oldPath, n)) {
+ infof(data, "Request has same path as previous transfer\n");
+ ftpc->cwddone = TRUE;
+ }
}
}
- free(rawPath);
+ free(rawPath);
return CURLE_OK;
}
@@ -4196,7 +4196,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
static CURLcode ftp_dophase_done(struct connectdata *conn,
bool connected)
{
- struct FTP *ftp = conn->data->req.p.ftp;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if(connected) {
@@ -4293,7 +4293,7 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
char *type;
struct FTP *ftp;
- conn->data->req.p.ftp = ftp = calloc(sizeof(struct FTP), 1);
+ conn->data->req.p.ftp = ftp = calloc(sizeof(struct FTP), 1);
if(NULL == ftp)
return CURLE_OUT_OF_MEMORY;
diff --git a/contrib/libs/curl/lib/ftp.h b/contrib/libs/curl/lib/ftp.h
index 4507c6e896..3ca1458ed8 100644
--- a/contrib/libs/curl/lib/ftp.h
+++ b/contrib/libs/curl/lib/ftp.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -118,7 +118,7 @@ struct ftp_conn {
char *entrypath; /* the PWD reply when we logged on */
char **dirs; /* realloc()ed array for path components */
int dirdepth; /* number of entries used in the 'dirs' array */
- char *file; /* url-decoded file name (or path) */
+ char *file; /* url-decoded file name (or path) */
bool dont_check; /* Set to TRUE to prevent the final (post-transfer)
file size and 226/250 status check. It should still
read the line, just ignore the result. */
@@ -131,7 +131,7 @@ struct ftp_conn {
bool cwdfail; /* set TRUE if a CWD command fails, as then we must prevent
caching the current directory */
bool wait_data_conn; /* this is set TRUE if data connection is waited */
- char *prevpath; /* url-decoded conn->path from the previous transfer */
+ char *prevpath; /* url-decoded conn->path from the previous transfer */
char transfertype; /* set by ftp_transfertype for use by Curl_client_write()a
and others (A/I or zero) */
int count1; /* general purpose counter for the state machine */
diff --git a/contrib/libs/curl/lib/ftplistparser.c b/contrib/libs/curl/lib/ftplistparser.c
index a3a135f2ff..85b8a78d4f 100644
--- a/contrib/libs/curl/lib/ftplistparser.c
+++ b/contrib/libs/curl/lib/ftplistparser.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -274,7 +274,7 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata *conn,
curl_fnmatch_callback compare;
struct WildcardData *wc = &conn->data->wildcard;
struct ftp_wc *ftpwc = wc->protdata;
- struct Curl_llist *llist = &wc->filelist;
+ struct Curl_llist *llist = &wc->filelist;
struct ftp_parselist_data *parser = ftpwc->parser;
bool add = TRUE;
struct curl_fileinfo *finfo = &infop->info;
@@ -418,8 +418,8 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
finfo->b_data[parser->item_length - 1] = 0;
if(strncmp("total ", finfo->b_data, 6) == 0) {
char *endptr = finfo->b_data + 6;
- /* here we can deal with directory size, pass the leading
- whitespace and then the digits */
+ /* here we can deal with directory size, pass the leading
+ whitespace and then the digits */
while(ISSPACE(*endptr))
endptr++;
while(ISDIGIT(*endptr))
diff --git a/contrib/libs/curl/lib/ftplistparser.h b/contrib/libs/curl/lib/ftplistparser.h
index 4ff9edfe98..e4cd8201d9 100644
--- a/contrib/libs/curl/lib/ftplistparser.h
+++ b/contrib/libs/curl/lib/ftplistparser.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/getenv.c b/contrib/libs/curl/lib/getenv.c
index 0c84959bc8..92c53505c6 100644
--- a/contrib/libs/curl/lib/getenv.c
+++ b/contrib/libs/curl/lib/getenv.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -27,44 +27,44 @@
#include "memdebug.h"
-static char *GetEnv(const char *variable)
+static char *GetEnv(const char *variable)
{
#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
(void)variable;
return NULL;
-#elif defined(WIN32)
- /* This uses Windows API instead of C runtime getenv() to get the environment
- variable since some changes aren't always visible to the latter. #4774 */
- char *buf = NULL;
- char *tmp;
- DWORD bufsize;
- DWORD rc = 1;
- const DWORD max = 32768; /* max env var size from MSCRT source */
-
- for(;;) {
- tmp = realloc(buf, rc);
- if(!tmp) {
- free(buf);
- return NULL;
- }
-
- buf = tmp;
- bufsize = rc;
-
- /* It's possible for rc to be 0 if the variable was found but empty.
- Since getenv doesn't make that distinction we ignore it as well. */
- rc = GetEnvironmentVariableA(variable, buf, bufsize);
- if(!rc || rc == bufsize || rc > max) {
- free(buf);
- return NULL;
- }
-
- /* if rc < bufsize then rc is bytes written not including null */
- if(rc < bufsize)
- return buf;
-
- /* else rc is bytes needed, try again */
- }
+#elif defined(WIN32)
+ /* This uses Windows API instead of C runtime getenv() to get the environment
+ variable since some changes aren't always visible to the latter. #4774 */
+ char *buf = NULL;
+ char *tmp;
+ DWORD bufsize;
+ DWORD rc = 1;
+ const DWORD max = 32768; /* max env var size from MSCRT source */
+
+ for(;;) {
+ tmp = realloc(buf, rc);
+ if(!tmp) {
+ free(buf);
+ return NULL;
+ }
+
+ buf = tmp;
+ bufsize = rc;
+
+ /* It's possible for rc to be 0 if the variable was found but empty.
+ Since getenv doesn't make that distinction we ignore it as well. */
+ rc = GetEnvironmentVariableA(variable, buf, bufsize);
+ if(!rc || rc == bufsize || rc > max) {
+ free(buf);
+ return NULL;
+ }
+
+ /* if rc < bufsize then rc is bytes written not including null */
+ if(rc < bufsize)
+ return buf;
+
+ /* else rc is bytes needed, try again */
+ }
#else
char *env = getenv(variable);
return (env && env[0])?strdup(env):NULL;
diff --git a/contrib/libs/curl/lib/getinfo.c b/contrib/libs/curl/lib/getinfo.c
index a4bcd99e1d..fd8f4e8430 100644
--- a/contrib/libs/curl/lib/getinfo.c
+++ b/contrib/libs/curl/lib/getinfo.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -78,7 +78,7 @@ CURLcode Curl_initinfo(struct Curl_easy *data)
info->conn_local_ip[0] = '\0';
info->conn_primary_port = 0;
info->conn_local_port = 0;
- info->retry_after = 0;
+ info->retry_after = 0;
info->conn_scheme = 0;
info->conn_protocol = 0;
@@ -96,34 +96,34 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
case CURLINFO_EFFECTIVE_URL:
*param_charp = data->change.url?data->change.url:(char *)"";
break;
- case CURLINFO_EFFECTIVE_METHOD: {
- const char *m = data->set.str[STRING_CUSTOMREQUEST];
- if(!m) {
- if(data->set.opt_no_body)
- m = "HEAD";
- else {
- switch(data->state.httpreq) {
- case HTTPREQ_POST:
- case HTTPREQ_POST_FORM:
- case HTTPREQ_POST_MIME:
- m = "POST";
- break;
- case HTTPREQ_PUT:
- m = "PUT";
- break;
- default: /* this should never happen */
- case HTTPREQ_GET:
- m = "GET";
- break;
- case HTTPREQ_HEAD:
- m = "HEAD";
- break;
- }
- }
- }
- *param_charp = m;
- }
- break;
+ case CURLINFO_EFFECTIVE_METHOD: {
+ const char *m = data->set.str[STRING_CUSTOMREQUEST];
+ if(!m) {
+ if(data->set.opt_no_body)
+ m = "HEAD";
+ else {
+ switch(data->state.httpreq) {
+ case HTTPREQ_POST:
+ case HTTPREQ_POST_FORM:
+ case HTTPREQ_POST_MIME:
+ m = "POST";
+ break;
+ case HTTPREQ_PUT:
+ m = "PUT";
+ break;
+ default: /* this should never happen */
+ case HTTPREQ_GET:
+ m = "GET";
+ break;
+ case HTTPREQ_HEAD:
+ m = "HEAD";
+ break;
+ }
+ }
+ }
+ *param_charp = m;
+ }
+ break;
case CURLINFO_CONTENT_TYPE:
*param_charp = data->info.contenttype;
break;
@@ -176,33 +176,33 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
long *to_long;
} lptr;
-#ifdef DEBUGBUILD
- char *timestr = getenv("CURL_TIME");
- if(timestr) {
- unsigned long val = strtol(timestr, NULL, 10);
- switch(info) {
- case CURLINFO_LOCAL_PORT:
- *param_longp = (long)val;
- return CURLE_OK;
- default:
- break;
- }
- }
- /* use another variable for this to allow different values */
- timestr = getenv("CURL_DEBUG_SIZE");
- if(timestr) {
- unsigned long val = strtol(timestr, NULL, 10);
- switch(info) {
- case CURLINFO_HEADER_SIZE:
- case CURLINFO_REQUEST_SIZE:
- *param_longp = (long)val;
- return CURLE_OK;
- default:
- break;
- }
- }
-#endif
-
+#ifdef DEBUGBUILD
+ char *timestr = getenv("CURL_TIME");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_LOCAL_PORT:
+ *param_longp = (long)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+ /* use another variable for this to allow different values */
+ timestr = getenv("CURL_DEBUG_SIZE");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_HEADER_SIZE:
+ case CURLINFO_REQUEST_SIZE:
+ *param_longp = (long)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+#endif
+
switch(info) {
case CURLINFO_RESPONSE_CODE:
*param_longp = data->info.httpcode;
@@ -227,11 +227,11 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
case CURLINFO_SSL_VERIFYRESULT:
*param_longp = data->set.ssl.certverifyresult;
break;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
case CURLINFO_PROXY_SSL_VERIFYRESULT:
*param_longp = data->set.proxy_ssl.certverifyresult;
break;
-#endif
+#endif
case CURLINFO_REDIRECT_COUNT:
*param_longp = data->set.followlocation;
break;
@@ -269,15 +269,15 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
/* Return the local port of the most recent (primary) connection */
*param_longp = data->info.conn_local_port;
break;
- case CURLINFO_PROXY_ERROR:
- *param_longp = (long)data->info.pxcode;
- break;
+ case CURLINFO_PROXY_ERROR:
+ *param_longp = (long)data->info.pxcode;
+ break;
case CURLINFO_CONDITION_UNMET:
- if(data->info.httpcode == 304)
- *param_longp = 1L;
- else
- /* return if the condition prevented the document to get transferred */
- *param_longp = data->info.timecond ? 1L : 0L;
+ if(data->info.httpcode == 304)
+ *param_longp = 1L;
+ else
+ /* return if the condition prevented the document to get transferred */
+ *param_longp = data->info.timecond ? 1L : 0L;
break;
case CURLINFO_RTSP_CLIENT_CSEQ:
*param_longp = data->state.rtsp_next_client_CSeq;
@@ -322,27 +322,27 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
curl_off_t *param_offt)
{
-#ifdef DEBUGBUILD
- char *timestr = getenv("CURL_TIME");
- if(timestr) {
- unsigned long val = strtol(timestr, NULL, 10);
- switch(info) {
- case CURLINFO_TOTAL_TIME_T:
- case CURLINFO_NAMELOOKUP_TIME_T:
- case CURLINFO_CONNECT_TIME_T:
- case CURLINFO_APPCONNECT_TIME_T:
- case CURLINFO_PRETRANSFER_TIME_T:
- case CURLINFO_STARTTRANSFER_TIME_T:
- case CURLINFO_REDIRECT_TIME_T:
- case CURLINFO_SPEED_DOWNLOAD_T:
- case CURLINFO_SPEED_UPLOAD_T:
- *param_offt = (curl_off_t)val;
- return CURLE_OK;
- default:
- break;
- }
- }
-#endif
+#ifdef DEBUGBUILD
+ char *timestr = getenv("CURL_TIME");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_TOTAL_TIME_T:
+ case CURLINFO_NAMELOOKUP_TIME_T:
+ case CURLINFO_CONNECT_TIME_T:
+ case CURLINFO_APPCONNECT_TIME_T:
+ case CURLINFO_PRETRANSFER_TIME_T:
+ case CURLINFO_STARTTRANSFER_TIME_T:
+ case CURLINFO_REDIRECT_TIME_T:
+ case CURLINFO_SPEED_DOWNLOAD_T:
+ case CURLINFO_SPEED_UPLOAD_T:
+ *param_offt = (curl_off_t)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+#endif
switch(info) {
case CURLINFO_FILETIME_T:
*param_offt = (curl_off_t)data->info.filetime;
@@ -354,7 +354,7 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
*param_offt = data->progress.downloaded;
break;
case CURLINFO_SPEED_DOWNLOAD_T:
- *param_offt = data->progress.dlspeed;
+ *param_offt = data->progress.dlspeed;
break;
case CURLINFO_SPEED_UPLOAD_T:
*param_offt = data->progress.ulspeed;
@@ -367,7 +367,7 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
*param_offt = (data->progress.flags & PGRS_UL_SIZE_KNOWN)?
data->progress.size_ul:-1;
break;
- case CURLINFO_TOTAL_TIME_T:
+ case CURLINFO_TOTAL_TIME_T:
*param_offt = data->progress.timespent;
break;
case CURLINFO_NAMELOOKUP_TIME_T:
@@ -401,27 +401,27 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info,
static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
double *param_doublep)
{
-#ifdef DEBUGBUILD
- char *timestr = getenv("CURL_TIME");
- if(timestr) {
- unsigned long val = strtol(timestr, NULL, 10);
- switch(info) {
- case CURLINFO_TOTAL_TIME:
- case CURLINFO_NAMELOOKUP_TIME:
- case CURLINFO_CONNECT_TIME:
- case CURLINFO_APPCONNECT_TIME:
- case CURLINFO_PRETRANSFER_TIME:
- case CURLINFO_STARTTRANSFER_TIME:
- case CURLINFO_REDIRECT_TIME:
- case CURLINFO_SPEED_DOWNLOAD:
- case CURLINFO_SPEED_UPLOAD:
- *param_doublep = (double)val;
- return CURLE_OK;
- default:
- break;
- }
- }
-#endif
+#ifdef DEBUGBUILD
+ char *timestr = getenv("CURL_TIME");
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10);
+ switch(info) {
+ case CURLINFO_TOTAL_TIME:
+ case CURLINFO_NAMELOOKUP_TIME:
+ case CURLINFO_CONNECT_TIME:
+ case CURLINFO_APPCONNECT_TIME:
+ case CURLINFO_PRETRANSFER_TIME:
+ case CURLINFO_STARTTRANSFER_TIME:
+ case CURLINFO_REDIRECT_TIME:
+ case CURLINFO_SPEED_DOWNLOAD:
+ case CURLINFO_SPEED_UPLOAD:
+ *param_doublep = (double)val;
+ return CURLE_OK;
+ default:
+ break;
+ }
+ }
+#endif
switch(info) {
case CURLINFO_TOTAL_TIME:
*param_doublep = DOUBLE_SECS(data->progress.timespent);
@@ -442,13 +442,13 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info,
*param_doublep = DOUBLE_SECS(data->progress.t_starttransfer);
break;
case CURLINFO_SIZE_UPLOAD:
- *param_doublep = (double)data->progress.uploaded;
+ *param_doublep = (double)data->progress.uploaded;
break;
case CURLINFO_SIZE_DOWNLOAD:
*param_doublep = (double)data->progress.downloaded;
break;
case CURLINFO_SPEED_DOWNLOAD:
- *param_doublep = (double)data->progress.dlspeed;
+ *param_doublep = (double)data->progress.dlspeed;
break;
case CURLINFO_SPEED_UPLOAD:
*param_doublep = (double)data->progress.ulspeed;
diff --git a/contrib/libs/curl/lib/getinfo.h b/contrib/libs/curl/lib/getinfo.h
index 84c002eedf..f35d1b4b34 100644
--- a/contrib/libs/curl/lib/getinfo.h
+++ b/contrib/libs/curl/lib/getinfo.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/gopher.c b/contrib/libs/curl/lib/gopher.c
index 93b34b5645..b101c0ab68 100644
--- a/contrib/libs/curl/lib/gopher.c
+++ b/contrib/libs/curl/lib/gopher.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -28,7 +28,7 @@
#include <curl/curl.h>
#include "transfer.h"
#include "sendf.h"
-#include "connect.h"
+#include "connect.h"
#include "progress.h"
#include "gopher.h"
#include "select.h"
@@ -71,7 +71,7 @@ const struct Curl_handler Curl_handler_gopher = {
ZERO_NULL, /* connection_check */
PORT_GOPHER, /* defport */
CURLPROTO_GOPHER, /* protocol */
- CURLPROTO_GOPHER, /* family */
+ CURLPROTO_GOPHER, /* family */
PROTOPT_NONE /* flags */
};
@@ -85,10 +85,10 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
char *query = data->state.up.query;
char *sel = NULL;
char *sel_org = NULL;
- timediff_t timeout_ms;
+ timediff_t timeout_ms;
ssize_t amount, k;
size_t len;
- int what;
+ int what;
*done = TRUE; /* unconditionally */
@@ -117,7 +117,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
newp += 2;
/* ... and finally unescape */
- result = Curl_urldecode(data, newp, 0, &sel, &len, REJECT_ZERO);
+ result = Curl_urldecode(data, newp, 0, &sel, &len, REJECT_ZERO);
free(gopherpath);
if(result)
return result;
@@ -141,35 +141,35 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
else
break;
- timeout_ms = Curl_timeleft(conn->data, NULL, FALSE);
- if(timeout_ms < 0) {
- result = CURLE_OPERATION_TIMEDOUT;
- break;
- }
- if(!timeout_ms)
- timeout_ms = TIMEDIFF_T_MAX;
-
+ timeout_ms = Curl_timeleft(conn->data, NULL, FALSE);
+ if(timeout_ms < 0) {
+ result = CURLE_OPERATION_TIMEDOUT;
+ break;
+ }
+ if(!timeout_ms)
+ timeout_ms = TIMEDIFF_T_MAX;
+
/* Don't busyloop. The entire loop thing is a work-around as it causes a
BLOCKING behavior which is a NO-NO. This function should rather be
split up in a do and a doing piece where the pieces that aren't
possible to send now will be sent in the doing function repeatedly
until the entire request is sent.
*/
- what = SOCKET_WRITABLE(sockfd, timeout_ms);
- if(what < 0) {
+ what = SOCKET_WRITABLE(sockfd, timeout_ms);
+ if(what < 0) {
result = CURLE_SEND_ERROR;
break;
}
- else if(!what) {
- result = CURLE_OPERATION_TIMEDOUT;
- break;
- }
+ else if(!what) {
+ result = CURLE_OPERATION_TIMEDOUT;
+ break;
+ }
}
free(sel_org);
if(!result)
- result = Curl_write(conn, sockfd, "\r\n", 2, &amount);
+ result = Curl_write(conn, sockfd, "\r\n", 2, &amount);
if(result) {
failf(data, "Failed sending Gopher request");
return result;
diff --git a/contrib/libs/curl/lib/gopher.h b/contrib/libs/curl/lib/gopher.h
index c3dd146168..b35fa45096 100644
--- a/contrib/libs/curl/lib/gopher.h
+++ b/contrib/libs/curl/lib/gopher.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/hash.c b/contrib/libs/curl/lib/hash.c
index 4840b3d81a..051c176269 100644
--- a/contrib/libs/curl/lib/hash.c
+++ b/contrib/libs/curl/lib/hash.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -34,8 +34,8 @@
static void
hash_element_dtor(void *user, void *element)
{
- struct Curl_hash *h = (struct Curl_hash *) user;
- struct Curl_hash_element *e = (struct Curl_hash_element *) element;
+ struct Curl_hash *h = (struct Curl_hash *) user;
+ struct Curl_hash_element *e = (struct Curl_hash_element *) element;
if(e->ptr) {
h->dtor(e->ptr);
@@ -54,11 +54,11 @@ hash_element_dtor(void *user, void *element)
* @unittest: 1603
*/
int
-Curl_hash_init(struct Curl_hash *h,
+Curl_hash_init(struct Curl_hash *h,
int slots,
hash_function hfunc,
comp_function comparator,
- Curl_hash_dtor dtor)
+ Curl_hash_dtor dtor)
{
if(!slots || !hfunc || !comparator ||!dtor) {
return 1; /* failure */
@@ -70,22 +70,22 @@ Curl_hash_init(struct Curl_hash *h,
h->size = 0;
h->slots = slots;
- h->table = malloc(slots * sizeof(struct Curl_llist));
+ h->table = malloc(slots * sizeof(struct Curl_llist));
if(h->table) {
int i;
for(i = 0; i < slots; ++i)
- Curl_llist_init(&h->table[i], (Curl_llist_dtor) hash_element_dtor);
+ Curl_llist_init(&h->table[i], (Curl_llist_dtor) hash_element_dtor);
return 0; /* fine */
}
h->slots = 0;
return 1; /* failure */
}
-static struct Curl_hash_element *
+static struct Curl_hash_element *
mk_hash_element(const void *key, size_t key_len, const void *p)
{
/* allocate the struct plus memory after it to store the key */
- struct Curl_hash_element *he = malloc(sizeof(struct Curl_hash_element) +
+ struct Curl_hash_element *he = malloc(sizeof(struct Curl_hash_element) +
key_len);
if(he) {
/* copy the key */
@@ -106,14 +106,14 @@ mk_hash_element(const void *key, size_t key_len, const void *p)
* @unittest: 1603
*/
void *
-Curl_hash_add(struct Curl_hash *h, void *key, size_t key_len, void *p)
+Curl_hash_add(struct Curl_hash *h, void *key, size_t key_len, void *p)
{
- struct Curl_hash_element *he;
- struct Curl_llist_element *le;
- struct Curl_llist *l = FETCH_LIST(h, key, key_len);
+ struct Curl_hash_element *he;
+ struct Curl_llist_element *le;
+ struct Curl_llist *l = FETCH_LIST(h, key, key_len);
for(le = l->head; le; le = le->next) {
- he = (struct Curl_hash_element *) le->ptr;
+ he = (struct Curl_hash_element *) le->ptr;
if(h->comp_func(he->key, he->key_len, key, key_len)) {
Curl_llist_remove(l, le, (void *)h);
--h->size;
@@ -136,13 +136,13 @@ Curl_hash_add(struct Curl_hash *h, void *key, size_t key_len, void *p)
*
* @unittest: 1603
*/
-int Curl_hash_delete(struct Curl_hash *h, void *key, size_t key_len)
+int Curl_hash_delete(struct Curl_hash *h, void *key, size_t key_len)
{
- struct Curl_llist_element *le;
- struct Curl_llist *l = FETCH_LIST(h, key, key_len);
+ struct Curl_llist_element *le;
+ struct Curl_llist *l = FETCH_LIST(h, key, key_len);
for(le = l->head; le; le = le->next) {
- struct Curl_hash_element *he = le->ptr;
+ struct Curl_hash_element *he = le->ptr;
if(h->comp_func(he->key, he->key_len, key, key_len)) {
Curl_llist_remove(l, le, (void *) h);
--h->size;
@@ -157,15 +157,15 @@ int Curl_hash_delete(struct Curl_hash *h, void *key, size_t key_len)
* @unittest: 1603
*/
void *
-Curl_hash_pick(struct Curl_hash *h, void *key, size_t key_len)
+Curl_hash_pick(struct Curl_hash *h, void *key, size_t key_len)
{
- struct Curl_llist_element *le;
- struct Curl_llist *l;
+ struct Curl_llist_element *le;
+ struct Curl_llist *l;
if(h) {
l = FETCH_LIST(h, key, key_len);
for(le = l->head; le; le = le->next) {
- struct Curl_hash_element *he = le->ptr;
+ struct Curl_hash_element *he = le->ptr;
if(h->comp_func(he->key, he->key_len, key, key_len)) {
return he->ptr;
}
@@ -177,17 +177,17 @@ Curl_hash_pick(struct Curl_hash *h, void *key, size_t key_len)
#if defined(DEBUGBUILD) && defined(AGGRESIVE_TEST)
void
-Curl_hash_apply(Curl_hash *h, void *user,
+Curl_hash_apply(Curl_hash *h, void *user,
void (*cb)(void *user, void *ptr))
{
- struct Curl_llist_element *le;
+ struct Curl_llist_element *le;
int i;
for(i = 0; i < h->slots; ++i) {
for(le = (h->table[i])->head;
le;
le = le->next) {
- Curl_hash_element *el = le->ptr;
+ Curl_hash_element *el = le->ptr;
cb(user, el->ptr);
}
}
@@ -202,7 +202,7 @@ Curl_hash_apply(Curl_hash *h, void *user,
* @unittest: 1603
*/
void
-Curl_hash_destroy(struct Curl_hash *h)
+Curl_hash_destroy(struct Curl_hash *h)
{
int i;
@@ -220,19 +220,19 @@ Curl_hash_destroy(struct Curl_hash *h)
* @unittest: 1602
*/
void
-Curl_hash_clean(struct Curl_hash *h)
+Curl_hash_clean(struct Curl_hash *h)
{
Curl_hash_clean_with_criterium(h, NULL, NULL);
}
/* Cleans all entries that pass the comp function criteria. */
void
-Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user,
+Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user,
int (*comp)(void *, void *))
{
- struct Curl_llist_element *le;
- struct Curl_llist_element *lnext;
- struct Curl_llist *list;
+ struct Curl_llist_element *le;
+ struct Curl_llist_element *lnext;
+ struct Curl_llist *list;
int i;
if(!h)
@@ -242,7 +242,7 @@ Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user,
list = &h->table[i];
le = list->head; /* get first list entry */
while(le) {
- struct Curl_hash_element *he = le->ptr;
+ struct Curl_hash_element *he = le->ptr;
lnext = le->next;
/* ask the callback function if we shall remove this entry or not */
if(comp == NULL || comp(user, he->ptr)) {
@@ -277,18 +277,18 @@ size_t Curl_str_key_compare(void *k1, size_t key1_len,
return 0;
}
-void Curl_hash_start_iterate(struct Curl_hash *hash,
- struct Curl_hash_iterator *iter)
+void Curl_hash_start_iterate(struct Curl_hash *hash,
+ struct Curl_hash_iterator *iter)
{
iter->hash = hash;
iter->slot_index = 0;
iter->current_element = NULL;
}
-struct Curl_hash_element *
-Curl_hash_next_element(struct Curl_hash_iterator *iter)
+struct Curl_hash_element *
+Curl_hash_next_element(struct Curl_hash_iterator *iter)
{
- struct Curl_hash *h = iter->hash;
+ struct Curl_hash *h = iter->hash;
/* Get the next element in the current list, if any */
if(iter->current_element)
@@ -307,7 +307,7 @@ Curl_hash_next_element(struct Curl_hash_iterator *iter)
}
if(iter->current_element) {
- struct Curl_hash_element *he = iter->current_element->ptr;
+ struct Curl_hash_element *he = iter->current_element->ptr;
return he;
}
iter->current_element = NULL;
@@ -315,11 +315,11 @@ Curl_hash_next_element(struct Curl_hash_iterator *iter)
}
#if 0 /* useful function for debugging hashes and their contents */
-void Curl_hash_print(struct Curl_hash *h,
+void Curl_hash_print(struct Curl_hash *h,
void (*func)(void *))
{
- struct Curl_hash_iterator iter;
- struct Curl_hash_element *he;
+ struct Curl_hash_iterator iter;
+ struct Curl_hash_element *he;
int last_index = -1;
if(!h)
diff --git a/contrib/libs/curl/lib/hash.h b/contrib/libs/curl/lib/hash.h
index 1660dd46bb..b7f828e071 100644
--- a/contrib/libs/curl/lib/hash.h
+++ b/contrib/libs/curl/lib/hash.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -41,59 +41,59 @@ typedef size_t (*comp_function) (void *key1,
void *key2,
size_t key2_len);
-typedef void (*Curl_hash_dtor)(void *);
+typedef void (*Curl_hash_dtor)(void *);
-struct Curl_hash {
- struct Curl_llist *table;
+struct Curl_hash {
+ struct Curl_llist *table;
/* Hash function to be used for this hash table */
hash_function hash_func;
/* Comparator function to compare keys */
comp_function comp_func;
- Curl_hash_dtor dtor;
+ Curl_hash_dtor dtor;
int slots;
size_t size;
};
-struct Curl_hash_element {
- struct Curl_llist_element list;
+struct Curl_hash_element {
+ struct Curl_llist_element list;
void *ptr;
size_t key_len;
char key[1]; /* allocated memory following the struct */
};
-struct Curl_hash_iterator {
- struct Curl_hash *hash;
+struct Curl_hash_iterator {
+ struct Curl_hash *hash;
int slot_index;
- struct Curl_llist_element *current_element;
+ struct Curl_llist_element *current_element;
};
-int Curl_hash_init(struct Curl_hash *h,
+int Curl_hash_init(struct Curl_hash *h,
int slots,
hash_function hfunc,
comp_function comparator,
- Curl_hash_dtor dtor);
+ Curl_hash_dtor dtor);
-void *Curl_hash_add(struct Curl_hash *h, void *key, size_t key_len, void *p);
-int Curl_hash_delete(struct Curl_hash *h, void *key, size_t key_len);
-void *Curl_hash_pick(struct Curl_hash *, void *key, size_t key_len);
-void Curl_hash_apply(struct Curl_hash *h, void *user,
+void *Curl_hash_add(struct Curl_hash *h, void *key, size_t key_len, void *p);
+int Curl_hash_delete(struct Curl_hash *h, void *key, size_t key_len);
+void *Curl_hash_pick(struct Curl_hash *, void *key, size_t key_len);
+void Curl_hash_apply(struct Curl_hash *h, void *user,
void (*cb)(void *user, void *ptr));
#define Curl_hash_count(h) ((h)->size)
-void Curl_hash_destroy(struct Curl_hash *h);
-void Curl_hash_clean(struct Curl_hash *h);
-void Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user,
+void Curl_hash_destroy(struct Curl_hash *h);
+void Curl_hash_clean(struct Curl_hash *h);
+void Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user,
int (*comp)(void *, void *));
size_t Curl_hash_str(void *key, size_t key_length, size_t slots_num);
size_t Curl_str_key_compare(void *k1, size_t key1_len, void *k2,
size_t key2_len);
-void Curl_hash_start_iterate(struct Curl_hash *hash,
- struct Curl_hash_iterator *iter);
-struct Curl_hash_element *
-Curl_hash_next_element(struct Curl_hash_iterator *iter);
+void Curl_hash_start_iterate(struct Curl_hash *hash,
+ struct Curl_hash_iterator *iter);
+struct Curl_hash_element *
+Curl_hash_next_element(struct Curl_hash_iterator *iter);
-void Curl_hash_print(struct Curl_hash *h,
+void Curl_hash_print(struct Curl_hash *h,
void (*func)(void *));
diff --git a/contrib/libs/curl/lib/hmac.c b/contrib/libs/curl/lib/hmac.c
index 190b70a878..590abe6d2e 100644
--- a/contrib/libs/curl/lib/hmac.c
+++ b/contrib/libs/curl/lib/hmac.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -30,7 +30,7 @@
#include "curl_hmac.h"
#include "curl_memory.h"
-#include "warnless.h"
+#include "warnless.h"
/* The last #include file should be: */
#include "memdebug.h"
@@ -48,13 +48,13 @@ static const unsigned char hmac_opad = 0x5C;
-struct HMAC_context *
-Curl_HMAC_init(const struct HMAC_params *hashparams,
+struct HMAC_context *
+Curl_HMAC_init(const struct HMAC_params *hashparams,
const unsigned char *key,
unsigned int keylen)
{
size_t i;
- struct HMAC_context *ctxt;
+ struct HMAC_context *ctxt;
unsigned char *hkey;
unsigned char b;
@@ -101,7 +101,7 @@ Curl_HMAC_init(const struct HMAC_params *hashparams,
return ctxt;
}
-int Curl_HMAC_update(struct HMAC_context *ctxt,
+int Curl_HMAC_update(struct HMAC_context *ctxt,
const unsigned char *data,
unsigned int len)
{
@@ -111,9 +111,9 @@ int Curl_HMAC_update(struct HMAC_context *ctxt,
}
-int Curl_HMAC_final(struct HMAC_context *ctxt, unsigned char *result)
+int Curl_HMAC_final(struct HMAC_context *ctxt, unsigned char *result)
{
- const struct HMAC_params *hashparams = ctxt->hmac_hash;
+ const struct HMAC_params *hashparams = ctxt->hmac_hash;
/* Do not get result if called with a null parameter: only release
storage. */
@@ -130,41 +130,41 @@ int Curl_HMAC_final(struct HMAC_context *ctxt, unsigned char *result)
return 0;
}
-/*
- * Curl_hmacit()
- *
- * This is used to generate a HMAC hash, for the specified input data, given
- * the specified hash function and key.
- *
- * Parameters:
- *
- * hashparams [in] - The hash function (Curl_HMAC_MD5).
- * key [in] - The key to use.
- * keylen [in] - The length of the key.
- * data [in] - The data to encrypt.
- * datalen [in] - The length of the data.
- * output [in/out] - The output buffer.
- *
- * Returns CURLE_OK on success.
- */
-CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
- const unsigned char *key, const size_t keylen,
- const unsigned char *data, const size_t datalen,
- unsigned char *output)
-{
- struct HMAC_context *ctxt =
- Curl_HMAC_init(hashparams, key, curlx_uztoui(keylen));
-
- if(!ctxt)
- return CURLE_OUT_OF_MEMORY;
-
- /* Update the digest with the given challenge */
- Curl_HMAC_update(ctxt, data, curlx_uztoui(datalen));
-
- /* Finalise the digest */
- Curl_HMAC_final(ctxt, output);
-
- return CURLE_OK;
-}
-
+/*
+ * Curl_hmacit()
+ *
+ * This is used to generate a HMAC hash, for the specified input data, given
+ * the specified hash function and key.
+ *
+ * Parameters:
+ *
+ * hashparams [in] - The hash function (Curl_HMAC_MD5).
+ * key [in] - The key to use.
+ * keylen [in] - The length of the key.
+ * data [in] - The data to encrypt.
+ * datalen [in] - The length of the data.
+ * output [in/out] - The output buffer.
+ *
+ * Returns CURLE_OK on success.
+ */
+CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
+ const unsigned char *key, const size_t keylen,
+ const unsigned char *data, const size_t datalen,
+ unsigned char *output)
+{
+ struct HMAC_context *ctxt =
+ Curl_HMAC_init(hashparams, key, curlx_uztoui(keylen));
+
+ if(!ctxt)
+ return CURLE_OUT_OF_MEMORY;
+
+ /* Update the digest with the given challenge */
+ Curl_HMAC_update(ctxt, data, curlx_uztoui(datalen));
+
+ /* Finalise the digest */
+ Curl_HMAC_final(ctxt, output);
+
+ return CURLE_OK;
+}
+
#endif /* CURL_DISABLE_CRYPTO_AUTH */
diff --git a/contrib/libs/curl/lib/hostasyn.c b/contrib/libs/curl/lib/hostasyn.c
index eddf696f88..56a6fc2b72 100644
--- a/contrib/libs/curl/lib/hostasyn.c
+++ b/contrib/libs/curl/lib/hostasyn.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -117,10 +117,10 @@ CURLcode Curl_addrinfo_callback(struct connectdata *conn,
* name resolve layers (selected at build-time). They all take this same set
* of arguments
*/
-struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp)
+struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
{
return Curl_resolver_getaddrinfo(conn, hostname, port, waitp);
}
diff --git a/contrib/libs/curl/lib/hostcheck.c b/contrib/libs/curl/lib/hostcheck.c
index 2dc13264e3..4d0614aeab 100644
--- a/contrib/libs/curl/lib/hostcheck.c
+++ b/contrib/libs/curl/lib/hostcheck.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/hostcheck.h b/contrib/libs/curl/lib/hostcheck.h
index d0234a24ea..52155f43b4 100644
--- a/contrib/libs/curl/lib/hostcheck.h
+++ b/contrib/libs/curl/lib/hostcheck.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/hostip.c b/contrib/libs/curl/lib/hostip.c
index aa7c1cf7fd..c6435f1f97 100644
--- a/contrib/libs/curl/lib/hostip.c
+++ b/contrib/libs/curl/lib/hostip.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -59,7 +59,7 @@
#include "strerror.h"
#include "url.h"
#include "inet_ntop.h"
-#include "inet_pton.h"
+#include "inet_pton.h"
#include "multiif.h"
#include "doh.h"
#include "warnless.h"
@@ -120,7 +120,7 @@ static void freednsentry(void *freethis);
/*
* Return # of addresses in a Curl_addrinfo struct
*/
-int Curl_num_addresses(const struct Curl_addrinfo *addr)
+int Curl_num_addresses(const struct Curl_addrinfo *addr)
{
int i = 0;
while(addr) {
@@ -131,35 +131,35 @@ int Curl_num_addresses(const struct Curl_addrinfo *addr)
}
/*
- * Curl_printable_address() stores a printable version of the 1st address
+ * Curl_printable_address() stores a printable version of the 1st address
* given in the 'ai' argument. The result will be stored in the buf that is
* bufsize bytes big.
*
- * If the conversion fails, the target buffer is empty.
+ * If the conversion fails, the target buffer is empty.
*/
-void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf,
- size_t bufsize)
+void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf,
+ size_t bufsize)
{
- DEBUGASSERT(bufsize);
- buf[0] = 0;
+ DEBUGASSERT(bufsize);
+ buf[0] = 0;
switch(ai->ai_family) {
- case AF_INET: {
- const struct sockaddr_in *sa4 = (const void *)ai->ai_addr;
- const struct in_addr *ipaddr4 = &sa4->sin_addr;
- (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize);
- break;
- }
+ case AF_INET: {
+ const struct sockaddr_in *sa4 = (const void *)ai->ai_addr;
+ const struct in_addr *ipaddr4 = &sa4->sin_addr;
+ (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize);
+ break;
+ }
#ifdef ENABLE_IPV6
- case AF_INET6: {
- const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr;
- const struct in6_addr *ipaddr6 = &sa6->sin6_addr;
- (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize);
- break;
- }
+ case AF_INET6: {
+ const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr;
+ const struct in6_addr *ipaddr6 = &sa6->sin6_addr;
+ (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize);
+ break;
+ }
#endif
- default:
- break;
+ default:
+ break;
}
}
@@ -206,7 +206,7 @@ hostcache_timestamp_remove(void *datap, void *hc)
* Prune the DNS cache. This assumes that a lock has already been taken.
*/
static void
-hostcache_prune(struct Curl_hash *hostcache, long cache_timeout, time_t now)
+hostcache_prune(struct Curl_hash *hostcache, long cache_timeout, time_t now)
{
struct hostcache_prune_data user;
@@ -334,7 +334,7 @@ Curl_fetch_addr(struct connectdata *conn,
#ifndef CURL_DISABLE_SHUFFLE_DNS
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
- struct Curl_addrinfo **addr);
+ struct Curl_addrinfo **addr);
/*
* Curl_shuffle_addr() shuffles the order of addresses in a 'Curl_addrinfo'
* struct by re-linking its linked list.
@@ -348,13 +348,13 @@ UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
* @unittest: 1608
*/
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
- struct Curl_addrinfo **addr)
+ struct Curl_addrinfo **addr)
{
CURLcode result = CURLE_OK;
const int num_addrs = Curl_num_addresses(*addr);
if(num_addrs > 1) {
- struct Curl_addrinfo **nodes;
+ struct Curl_addrinfo **nodes;
infof(data, "Shuffling %i addresses", num_addrs);
nodes = malloc(num_addrs*sizeof(*nodes));
@@ -373,7 +373,7 @@ UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
if(rnd) {
/* Fisher-Yates shuffle */
if(Curl_rand(data, (unsigned char *)rnd, rnd_size) == CURLE_OK) {
- struct Curl_addrinfo *swap_tmp;
+ struct Curl_addrinfo *swap_tmp;
for(i = num_addrs - 1; i > 0; i--) {
swap_tmp = nodes[rnd[i] % (i + 1)];
nodes[rnd[i] % (i + 1)] = nodes[i];
@@ -412,7 +412,7 @@ UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
*/
struct Curl_dns_entry *
Curl_cache_addr(struct Curl_easy *data,
- struct Curl_addrinfo *addr,
+ struct Curl_addrinfo *addr,
const char *hostname,
int port)
{
@@ -480,19 +480,19 @@ Curl_cache_addr(struct Curl_easy *data,
* CURLRESOLV_PENDING (1) = waiting for response, no pointer
*/
-enum resolve_t Curl_resolv(struct connectdata *conn,
- const char *hostname,
- int port,
- bool allowDOH,
- struct Curl_dns_entry **entry)
+enum resolve_t Curl_resolv(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ bool allowDOH,
+ struct Curl_dns_entry **entry)
{
struct Curl_dns_entry *dns = NULL;
struct Curl_easy *data = conn->data;
CURLcode result;
- enum resolve_t rc = CURLRESOLV_ERROR; /* default to failure */
+ enum resolve_t rc = CURLRESOLV_ERROR; /* default to failure */
*entry = NULL;
- conn->bits.doh = FALSE; /* default is not */
+ conn->bits.doh = FALSE; /* default is not */
if(data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
@@ -511,13 +511,13 @@ enum resolve_t Curl_resolv(struct connectdata *conn,
if(!dns) {
/* The entry was not in the cache. Resolve it to IP address */
- struct Curl_addrinfo *addr = NULL;
+ struct Curl_addrinfo *addr = NULL;
int respwait = 0;
- struct in_addr in;
-#ifndef USE_RESOLVE_ON_IPS
- const
-#endif
- bool ipnum = FALSE;
+ struct in_addr in;
+#ifndef USE_RESOLVE_ON_IPS
+ const
+#endif
+ bool ipnum = FALSE;
/* notify the resolver start callback */
if(data->set.resolver_start) {
@@ -530,59 +530,59 @@ enum resolve_t Curl_resolv(struct connectdata *conn,
return CURLRESOLV_ERROR;
}
-#ifndef USE_RESOLVE_ON_IPS
- /* First check if this is an IPv4 address string */
- if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
- /* This is a dotted IP address 123.123.123.123-style */
- addr = Curl_ip2addr(AF_INET, &in, hostname, port);
-#ifdef ENABLE_IPV6
- if(!addr) {
- struct in6_addr in6;
- /* check if this is an IPv6 address string */
- if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
- /* This is an IPv6 address literal */
- addr = Curl_ip2addr(AF_INET6, &in6, hostname, port);
+#ifndef USE_RESOLVE_ON_IPS
+ /* First check if this is an IPv4 address string */
+ if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
+ /* This is a dotted IP address 123.123.123.123-style */
+ addr = Curl_ip2addr(AF_INET, &in, hostname, port);
+#ifdef ENABLE_IPV6
+ if(!addr) {
+ struct in6_addr in6;
+ /* check if this is an IPv6 address string */
+ if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
+ /* This is an IPv6 address literal */
+ addr = Curl_ip2addr(AF_INET6, &in6, hostname, port);
}
-#endif /* ENABLE_IPV6 */
-
-#else /* if USE_RESOLVE_ON_IPS */
- /* First check if this is an IPv4 address string */
- if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
- /* This is a dotted IP address 123.123.123.123-style */
- ipnum = TRUE;
-#ifdef ENABLE_IPV6
+#endif /* ENABLE_IPV6 */
+
+#else /* if USE_RESOLVE_ON_IPS */
+ /* First check if this is an IPv4 address string */
+ if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
+ /* This is a dotted IP address 123.123.123.123-style */
+ ipnum = TRUE;
+#ifdef ENABLE_IPV6
else {
- struct in6_addr in6;
- /* check if this is an IPv6 address string */
- if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
- /* This is an IPv6 address literal */
- ipnum = TRUE;
- }
-#endif /* ENABLE_IPV6 */
-
-#endif /* !USE_RESOLVE_ON_IPS */
-
- if(!addr) {
- /* Check what IP specifics the app has requested and if we can provide
- * it. If not, bail out. */
- if(!Curl_ipvalid(conn))
- return CURLRESOLV_ERROR;
-
- if(allowDOH && data->set.doh && !ipnum) {
- addr = Curl_doh(conn, hostname, port, &respwait);
- }
- else {
- /* 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 */
- addr = Curl_getaddrinfo(conn,
+ struct in6_addr in6;
+ /* check if this is an IPv6 address string */
+ if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
+ /* This is an IPv6 address literal */
+ ipnum = TRUE;
+ }
+#endif /* ENABLE_IPV6 */
+
+#endif /* !USE_RESOLVE_ON_IPS */
+
+ if(!addr) {
+ /* Check what IP specifics the app has requested and if we can provide
+ * it. If not, bail out. */
+ if(!Curl_ipvalid(conn))
+ return CURLRESOLV_ERROR;
+
+ if(allowDOH && data->set.doh && !ipnum) {
+ addr = Curl_doh(conn, hostname, port, &respwait);
+ }
+ else {
+ /* 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 */
+ addr = Curl_getaddrinfo(conn,
#ifdef DEBUGBUILD
- (data->set.str[STRING_DEVICE]
- && !strcmp(data->set.str[STRING_DEVICE],
- "LocalHost"))?"localhost":
+ (data->set.str[STRING_DEVICE]
+ && !strcmp(data->set.str[STRING_DEVICE],
+ "LocalHost"))?"localhost":
#endif
- hostname, port, &respwait);
- }
+ hostname, port, &respwait);
+ }
}
if(!addr) {
if(respwait) {
@@ -658,11 +658,11 @@ RETSIGTYPE alarmfunc(int sig)
* CURLRESOLV_PENDING (1) = waiting for response, no pointer
*/
-enum resolve_t Curl_resolv_timeout(struct connectdata *conn,
- const char *hostname,
- int port,
- struct Curl_dns_entry **entry,
- timediff_t timeoutms)
+enum resolve_t Curl_resolv_timeout(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ struct Curl_dns_entry **entry,
+ timediff_t timeoutms)
{
#ifdef USE_ALARM_TIMEOUT
#ifdef HAVE_SIGACTION
@@ -678,7 +678,7 @@ enum resolve_t Curl_resolv_timeout(struct connectdata *conn,
volatile unsigned int prev_alarm = 0;
struct Curl_easy *data = conn->data;
#endif /* USE_ALARM_TIMEOUT */
- enum resolve_t rc;
+ enum resolve_t rc;
*entry = NULL;
@@ -787,7 +787,7 @@ clean_up:
conn->created) / 1000;
/* the alarm period is counted in even number of seconds */
- unsigned long alarm_set = (unsigned long)(prev_alarm - elapsed_secs);
+ unsigned long alarm_set = (unsigned long)(prev_alarm - elapsed_secs);
if(!alarm_set ||
((alarm_set >= 0x80000000) && (prev_alarm < 0x80000000)) ) {
@@ -843,7 +843,7 @@ static void freednsentry(void *freethis)
/*
* Curl_mk_dnscache() inits a new DNS cache and returns success/failure.
*/
-int Curl_mk_dnscache(struct Curl_hash *hash)
+int Curl_mk_dnscache(struct Curl_hash *hash)
{
return Curl_hash_init(hash, 7, Curl_hash_str, Curl_str_key_compare,
freednsentry);
@@ -857,7 +857,7 @@ int Curl_mk_dnscache(struct Curl_hash *hash)
*/
void Curl_hostcache_clean(struct Curl_easy *data,
- struct Curl_hash *hash)
+ struct Curl_hash *hash)
{
if(data && data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
@@ -906,7 +906,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
}
else {
struct Curl_dns_entry *dns;
- struct Curl_addrinfo *head = NULL, *tail = NULL;
+ struct Curl_addrinfo *head = NULL, *tail = NULL;
size_t entry_len;
char address[64];
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
@@ -940,7 +940,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
while(*end_ptr) {
size_t alen;
- struct Curl_addrinfo *ai;
+ struct Curl_addrinfo *ai;
addr_begin = end_ptr + 1;
addr_end = strchr(addr_begin, ',');
@@ -1059,11 +1059,11 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
CURLcode Curl_resolv_check(struct connectdata *conn,
struct Curl_dns_entry **dns)
{
-#if defined(CURL_DISABLE_DOH) && !defined(CURLRES_ASYNCH)
- (void)dns;
-#endif
-
- if(conn->bits.doh)
+#if defined(CURL_DISABLE_DOH) && !defined(CURLRES_ASYNCH)
+ (void)dns;
+#endif
+
+ if(conn->bits.doh)
return Curl_doh_is_resolved(conn, dns);
return Curl_resolver_is_resolved(conn, dns);
}
@@ -1072,7 +1072,7 @@ int Curl_resolv_getsock(struct connectdata *conn,
curl_socket_t *socks)
{
#ifdef CURLRES_ASYNCH
- if(conn->bits.doh)
+ if(conn->bits.doh)
/* nothing to wait for during DOH resolve, those handles have their own
sockets */
return GETSOCK_BLANK;
@@ -1101,12 +1101,12 @@ CURLcode Curl_once_resolved(struct connectdata *conn,
result = Curl_setup_conn(conn, protocol_done);
- if(result) {
- struct Curl_easy *data = conn->data;
- DEBUGASSERT(data);
- Curl_detach_connnection(data);
- Curl_conncache_remove_conn(data, conn, TRUE);
- Curl_disconnect(data, conn, TRUE);
- }
+ if(result) {
+ struct Curl_easy *data = conn->data;
+ DEBUGASSERT(data);
+ Curl_detach_connnection(data);
+ Curl_conncache_remove_conn(data, conn, TRUE);
+ Curl_disconnect(data, conn, TRUE);
+ }
return result;
}
diff --git a/contrib/libs/curl/lib/hostip.h b/contrib/libs/curl/lib/hostip.h
index 424db2b167..724a03d7fb 100644
--- a/contrib/libs/curl/lib/hostip.h
+++ b/contrib/libs/curl/lib/hostip.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -59,12 +59,12 @@ struct connectdata;
* Global DNS cache is general badness. Do not use. This will be removed in
* a future version. Use the share interface instead!
*
- * Returns a struct Curl_hash pointer on success, NULL on failure.
+ * Returns a struct Curl_hash pointer on success, NULL on failure.
*/
-struct Curl_hash *Curl_global_host_cache_init(void);
+struct Curl_hash *Curl_global_host_cache_init(void);
struct Curl_dns_entry {
- struct Curl_addrinfo *addr;
+ struct Curl_addrinfo *addr;
/* timestamp == 0 -- CURLOPT_RESOLVE entry, doesn't timeout */
time_t timestamp;
/* use-counter, use Curl_resolv_unlock to release reference */
@@ -79,29 +79,29 @@ struct Curl_dns_entry {
* use, or we'll leak memory!
*/
/* return codes */
-enum resolve_t {
- CURLRESOLV_TIMEDOUT = -2,
- CURLRESOLV_ERROR = -1,
- CURLRESOLV_RESOLVED = 0,
- CURLRESOLV_PENDING = 1
-};
-enum resolve_t Curl_resolv(struct connectdata *conn,
- const char *hostname,
- int port,
- bool allowDOH,
- struct Curl_dns_entry **dnsentry);
-enum resolve_t Curl_resolv_timeout(struct connectdata *conn,
- const char *hostname, int port,
- struct Curl_dns_entry **dnsentry,
- timediff_t timeoutms);
+enum resolve_t {
+ CURLRESOLV_TIMEDOUT = -2,
+ CURLRESOLV_ERROR = -1,
+ CURLRESOLV_RESOLVED = 0,
+ CURLRESOLV_PENDING = 1
+};
+enum resolve_t Curl_resolv(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ bool allowDOH,
+ struct Curl_dns_entry **dnsentry);
+enum resolve_t Curl_resolv_timeout(struct connectdata *conn,
+ const char *hostname, int port,
+ struct Curl_dns_entry **dnsentry,
+ timediff_t timeoutms);
#ifdef CURLRES_IPV6
/*
* Curl_ipv6works() returns TRUE if IPv6 seems to work.
*/
-bool Curl_ipv6works(struct connectdata *conn);
+bool Curl_ipv6works(struct connectdata *conn);
#else
-#define Curl_ipv6works(x) FALSE
+#define Curl_ipv6works(x) FALSE
#endif
/*
@@ -117,10 +117,10 @@ bool Curl_ipvalid(struct connectdata *conn);
* name resolve layers (selected at build-time). They all take this same set
* of arguments
*/
-struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp);
+struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp);
/* unlock a previously resolved dns entry */
@@ -128,13 +128,13 @@ void Curl_resolv_unlock(struct Curl_easy *data,
struct Curl_dns_entry *dns);
/* init a new dns cache and return success */
-int Curl_mk_dnscache(struct Curl_hash *hash);
+int Curl_mk_dnscache(struct Curl_hash *hash);
/* prune old entries from the DNS cache */
void Curl_hostcache_prune(struct Curl_easy *data);
/* Return # of addresses in a Curl_addrinfo struct */
-int Curl_num_addresses(const struct Curl_addrinfo *addr);
+int Curl_num_addresses(const struct Curl_addrinfo *addr);
#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
@@ -146,7 +146,7 @@ int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
#endif
/* IPv4 threadsafe resolve function used for synch and asynch builds */
-struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, int port);
+struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, int port);
CURLcode Curl_once_resolved(struct connectdata *conn, bool *protocol_connect);
@@ -158,15 +158,15 @@ CURLcode Curl_once_resolved(struct connectdata *conn, bool *protocol_connect);
*/
CURLcode Curl_addrinfo_callback(struct connectdata *conn,
int status,
- struct Curl_addrinfo *ai);
+ struct Curl_addrinfo *ai);
/*
* Curl_printable_address() returns a printable version of the 1st address
* given in the 'ip' argument. The result will be stored in the buf that is
* bufsize bytes big.
*/
-void Curl_printable_address(const struct Curl_addrinfo *ip,
- char *buf, size_t bufsize);
+void Curl_printable_address(const struct Curl_addrinfo *ip,
+ char *buf, size_t bufsize);
/*
* Curl_fetch_addr() fetches a 'Curl_dns_entry' already in the DNS cache.
@@ -187,7 +187,7 @@ Curl_fetch_addr(struct connectdata *conn,
* Returns the Curl_dns_entry entry pointer or NULL if the storage failed.
*/
struct Curl_dns_entry *
-Curl_cache_addr(struct Curl_easy *data, struct Curl_addrinfo *addr,
+Curl_cache_addr(struct Curl_easy *data, struct Curl_addrinfo *addr,
const char *hostname, int port);
#ifndef INADDR_NONE
@@ -234,7 +234,7 @@ CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data,
/*
* Clean off entries from the cache
*/
-void Curl_hostcache_clean(struct Curl_easy *data, struct Curl_hash *hash);
+void Curl_hostcache_clean(struct Curl_easy *data, struct Curl_hash *hash);
/*
* Populate the cache with specified entries from CURLOPT_RESOLVE.
diff --git a/contrib/libs/curl/lib/hostip4.c b/contrib/libs/curl/lib/hostip4.c
index 1402e29a69..df83a2f12b 100644
--- a/contrib/libs/curl/lib/hostip4.c
+++ b/contrib/libs/curl/lib/hostip4.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -88,12 +88,12 @@ bool Curl_ipvalid(struct connectdata *conn)
* flavours have thread-safe versions of the plain gethostbyname() etc.
*
*/
-struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp)
+struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
{
- struct Curl_addrinfo *ai = NULL;
+ struct Curl_addrinfo *ai = NULL;
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)conn;
@@ -119,30 +119,30 @@ struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
* implying that only threadsafe code and function calls may be used.
*
*/
-struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
- int port)
+struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
+ int port)
{
#if !defined(HAVE_GETADDRINFO_THREADSAFE) && defined(HAVE_GETHOSTBYNAME_R_3)
int res;
#endif
- struct Curl_addrinfo *ai = NULL;
+ struct Curl_addrinfo *ai = NULL;
struct hostent *h = NULL;
struct hostent *buf = NULL;
#if defined(HAVE_GETADDRINFO_THREADSAFE)
- struct addrinfo hints;
- char sbuf[12];
- char *sbufptr = NULL;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = PF_INET;
- hints.ai_socktype = SOCK_STREAM;
- if(port) {
- msnprintf(sbuf, sizeof(sbuf), "%d", port);
- sbufptr = sbuf;
- }
+ struct addrinfo hints;
+ char sbuf[12];
+ char *sbufptr = NULL;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = PF_INET;
+ hints.ai_socktype = SOCK_STREAM;
+ if(port) {
+ msnprintf(sbuf, sizeof(sbuf), "%d", port);
+ sbufptr = sbuf;
+ }
- (void)Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &ai);
+ (void)Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &ai);
#elif defined(HAVE_GETHOSTBYNAME_R)
/*
@@ -150,140 +150,140 @@ struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
* Since there are three different versions of it, the following code is
* somewhat #ifdef-ridden.
*/
- int h_errnop;
+ int h_errnop;
- buf = calloc(1, CURL_HOSTENT_SIZE);
- if(!buf)
- return NULL; /* major failure */
- /*
- * The clearing of the buffer is a workaround for a gethostbyname_r bug in
- * qnx nto and it is also _required_ for some of these functions on some
- * platforms.
- */
+ buf = calloc(1, CURL_HOSTENT_SIZE);
+ if(!buf)
+ return NULL; /* major failure */
+ /*
+ * The clearing of the buffer is a workaround for a gethostbyname_r bug in
+ * qnx nto and it is also _required_ for some of these functions on some
+ * platforms.
+ */
#if defined(HAVE_GETHOSTBYNAME_R_5)
- /* Solaris, IRIX and more */
- h = gethostbyname_r(hostname,
- (struct hostent *)buf,
- (char *)buf + sizeof(struct hostent),
- CURL_HOSTENT_SIZE - sizeof(struct hostent),
- &h_errnop);
-
- /* If the buffer is too small, it returns NULL and sets errno to
- * ERANGE. The errno is thread safe if this is compiled with
- * -D_REENTRANT as then the 'errno' variable is a macro defined to get
- * used properly for threads.
- */
-
- if(h) {
- ;
- }
- else
+ /* Solaris, IRIX and more */
+ h = gethostbyname_r(hostname,
+ (struct hostent *)buf,
+ (char *)buf + sizeof(struct hostent),
+ CURL_HOSTENT_SIZE - sizeof(struct hostent),
+ &h_errnop);
+
+ /* If the buffer is too small, it returns NULL and sets errno to
+ * ERANGE. The errno is thread safe if this is compiled with
+ * -D_REENTRANT as then the 'errno' variable is a macro defined to get
+ * used properly for threads.
+ */
+
+ if(h) {
+ ;
+ }
+ else
#elif defined(HAVE_GETHOSTBYNAME_R_6)
- /* Linux */
-
- (void)gethostbyname_r(hostname,
- (struct hostent *)buf,
- (char *)buf + sizeof(struct hostent),
- CURL_HOSTENT_SIZE - sizeof(struct hostent),
- &h, /* DIFFERENCE */
- &h_errnop);
- /* Redhat 8, using glibc 2.2.93 changed the behavior. Now all of a
- * sudden this function returns EAGAIN if the given buffer size is too
- * small. Previous versions are known to return ERANGE for the same
- * problem.
- *
- * This wouldn't be such a big problem if older versions wouldn't
- * sometimes return EAGAIN on a common failure case. Alas, we can't
- * assume that EAGAIN *or* ERANGE means ERANGE for any given version of
- * glibc.
- *
- * For now, we do that and thus we may call the function repeatedly and
- * fail for older glibc versions that return EAGAIN, until we run out of
- * buffer size (step_size grows beyond CURL_HOSTENT_SIZE).
- *
- * If anyone has a better fix, please tell us!
- *
- * -------------------------------------------------------------------
- *
- * On October 23rd 2003, Dan C dug up more details on the mysteries of
- * gethostbyname_r() in glibc:
- *
- * In glibc 2.2.5 the interface is different (this has also been
- * discovered in glibc 2.1.1-6 as shipped by Redhat 6). What I can't
- * explain, is that tests performed on glibc 2.2.4-34 and 2.2.4-32
- * (shipped/upgraded by Redhat 7.2) don't show this behavior!
- *
- * In this "buggy" version, the return code is -1 on error and 'errno'
- * is set to the ERANGE or EAGAIN code. Note that 'errno' is not a
- * thread-safe variable.
- */
-
- if(!h) /* failure */
+ /* Linux */
+
+ (void)gethostbyname_r(hostname,
+ (struct hostent *)buf,
+ (char *)buf + sizeof(struct hostent),
+ CURL_HOSTENT_SIZE - sizeof(struct hostent),
+ &h, /* DIFFERENCE */
+ &h_errnop);
+ /* Redhat 8, using glibc 2.2.93 changed the behavior. Now all of a
+ * sudden this function returns EAGAIN if the given buffer size is too
+ * small. Previous versions are known to return ERANGE for the same
+ * problem.
+ *
+ * This wouldn't be such a big problem if older versions wouldn't
+ * sometimes return EAGAIN on a common failure case. Alas, we can't
+ * assume that EAGAIN *or* ERANGE means ERANGE for any given version of
+ * glibc.
+ *
+ * For now, we do that and thus we may call the function repeatedly and
+ * fail for older glibc versions that return EAGAIN, until we run out of
+ * buffer size (step_size grows beyond CURL_HOSTENT_SIZE).
+ *
+ * If anyone has a better fix, please tell us!
+ *
+ * -------------------------------------------------------------------
+ *
+ * On October 23rd 2003, Dan C dug up more details on the mysteries of
+ * gethostbyname_r() in glibc:
+ *
+ * In glibc 2.2.5 the interface is different (this has also been
+ * discovered in glibc 2.1.1-6 as shipped by Redhat 6). What I can't
+ * explain, is that tests performed on glibc 2.2.4-34 and 2.2.4-32
+ * (shipped/upgraded by Redhat 7.2) don't show this behavior!
+ *
+ * In this "buggy" version, the return code is -1 on error and 'errno'
+ * is set to the ERANGE or EAGAIN code. Note that 'errno' is not a
+ * thread-safe variable.
+ */
+
+ if(!h) /* failure */
#elif defined(HAVE_GETHOSTBYNAME_R_3)
- /* AIX, Digital Unix/Tru64, HPUX 10, more? */
-
- /* For AIX 4.3 or later, we don't use gethostbyname_r() at all, because of
- * the plain fact that it does not return unique full buffers on each
- * call, but instead several of the pointers in the hostent structs will
- * point to the same actual data! This have the unfortunate down-side that
- * our caching system breaks down horribly. Luckily for us though, AIX 4.3
- * and more recent versions have a "completely thread-safe"[*] libc where
- * all the data is stored in thread-specific memory areas making calls to
- * the plain old gethostbyname() work fine even for multi-threaded
- * programs.
- *
- * This AIX 4.3 or later detection is all made in the configure script.
- *
- * Troels Walsted Hansen helped us work this out on March 3rd, 2003.
- *
- * [*] = much later we've found out that it isn't at all "completely
- * thread-safe", but at least the gethostbyname() function is.
- */
-
- if(CURL_HOSTENT_SIZE >=
- (sizeof(struct hostent) + sizeof(struct hostent_data))) {
-
- /* August 22nd, 2000: Albert Chin-A-Young brought an updated version
- * that should work! September 20: Richard Prescott worked on the buffer
- * size dilemma.
- */
-
- res = gethostbyname_r(hostname,
- (struct hostent *)buf,
- (struct hostent_data *)((char *)buf +
- sizeof(struct hostent)));
- h_errnop = SOCKERRNO; /* we don't deal with this, but set it anyway */
- }
- else
- res = -1; /* failure, too smallish buffer size */
-
- if(!res) { /* success */
-
- h = buf; /* result expected in h */
-
- /* This is the worst kind of the different gethostbyname_r() interfaces.
- * Since we don't know how big buffer this particular lookup required,
- * we can't realloc down the huge alloc without doing closer analysis of
- * the returned data. Thus, we always use CURL_HOSTENT_SIZE for every
- * name lookup. Fixing this would require an extra malloc() and then
- * calling Curl_addrinfo_copy() that subsequent realloc()s down the new
- * memory area to the actually used amount.
- */
- }
- else
+ /* AIX, Digital Unix/Tru64, HPUX 10, more? */
+
+ /* For AIX 4.3 or later, we don't use gethostbyname_r() at all, because of
+ * the plain fact that it does not return unique full buffers on each
+ * call, but instead several of the pointers in the hostent structs will
+ * point to the same actual data! This have the unfortunate down-side that
+ * our caching system breaks down horribly. Luckily for us though, AIX 4.3
+ * and more recent versions have a "completely thread-safe"[*] libc where
+ * all the data is stored in thread-specific memory areas making calls to
+ * the plain old gethostbyname() work fine even for multi-threaded
+ * programs.
+ *
+ * This AIX 4.3 or later detection is all made in the configure script.
+ *
+ * Troels Walsted Hansen helped us work this out on March 3rd, 2003.
+ *
+ * [*] = much later we've found out that it isn't at all "completely
+ * thread-safe", but at least the gethostbyname() function is.
+ */
+
+ if(CURL_HOSTENT_SIZE >=
+ (sizeof(struct hostent) + sizeof(struct hostent_data))) {
+
+ /* August 22nd, 2000: Albert Chin-A-Young brought an updated version
+ * that should work! September 20: Richard Prescott worked on the buffer
+ * size dilemma.
+ */
+
+ res = gethostbyname_r(hostname,
+ (struct hostent *)buf,
+ (struct hostent_data *)((char *)buf +
+ sizeof(struct hostent)));
+ h_errnop = SOCKERRNO; /* we don't deal with this, but set it anyway */
+ }
+ else
+ res = -1; /* failure, too smallish buffer size */
+
+ if(!res) { /* success */
+
+ h = buf; /* result expected in h */
+
+ /* This is the worst kind of the different gethostbyname_r() interfaces.
+ * Since we don't know how big buffer this particular lookup required,
+ * we can't realloc down the huge alloc without doing closer analysis of
+ * the returned data. Thus, we always use CURL_HOSTENT_SIZE for every
+ * name lookup. Fixing this would require an extra malloc() and then
+ * calling Curl_addrinfo_copy() that subsequent realloc()s down the new
+ * memory area to the actually used amount.
+ */
+ }
+ else
#endif /* HAVE_...BYNAME_R_5 || HAVE_...BYNAME_R_6 || HAVE_...BYNAME_R_3 */
- {
- h = NULL; /* set return code to NULL */
- free(buf);
- }
+ {
+ h = NULL; /* set return code to NULL */
+ free(buf);
+ }
#else /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */
- /*
- * Here is code for platforms that don't have a thread safe
- * getaddrinfo() nor gethostbyname_r() function or for which
- * gethostbyname() is the preferred one.
- */
- h = gethostbyname((void *)hostname);
+ /*
+ * Here is code for platforms that don't have a thread safe
+ * getaddrinfo() nor gethostbyname_r() function or for which
+ * gethostbyname() is the preferred one.
+ */
+ h = gethostbyname((void *)hostname);
#endif /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */
if(h) {
diff --git a/contrib/libs/curl/lib/hostip6.c b/contrib/libs/curl/lib/hostip6.c
index 1a7ea66832..02b0ca298b 100644
--- a/contrib/libs/curl/lib/hostip6.c
+++ b/contrib/libs/curl/lib/hostip6.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -62,19 +62,19 @@
/*
* Curl_ipv6works() returns TRUE if IPv6 seems to work.
*/
-bool Curl_ipv6works(struct connectdata *conn)
+bool Curl_ipv6works(struct connectdata *conn)
{
- if(conn) {
- /* the nature of most system is that IPv6 status doesn't come and go
- during a program's lifetime so we only probe the first time and then we
- have the info kept for fast re-use */
- DEBUGASSERT(conn);
- DEBUGASSERT(conn->data);
- DEBUGASSERT(conn->data->multi);
- return conn->data->multi->ipv6_works;
- }
- else {
- int ipv6_works = -1;
+ if(conn) {
+ /* the nature of most system is that IPv6 status doesn't come and go
+ during a program's lifetime so we only probe the first time and then we
+ have the info kept for fast re-use */
+ DEBUGASSERT(conn);
+ DEBUGASSERT(conn->data);
+ DEBUGASSERT(conn->data->multi);
+ return conn->data->multi->ipv6_works;
+ }
+ else {
+ int ipv6_works = -1;
/* probe to see if we have a working IPv6 stack */
curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);
if(s == CURL_SOCKET_BAD)
@@ -84,7 +84,7 @@ bool Curl_ipv6works(struct connectdata *conn)
ipv6_works = 1;
Curl_closesocket(NULL, s);
}
- return (ipv6_works>0)?TRUE:FALSE;
+ return (ipv6_works>0)?TRUE:FALSE;
}
}
@@ -95,7 +95,7 @@ bool Curl_ipv6works(struct connectdata *conn)
bool Curl_ipvalid(struct connectdata *conn)
{
if(conn->ip_version == CURL_IPRESOLVE_V6)
- return Curl_ipv6works(conn);
+ return Curl_ipv6works(conn);
return TRUE;
}
@@ -103,16 +103,16 @@ bool Curl_ipvalid(struct connectdata *conn)
#if defined(CURLRES_SYNCH)
#ifdef DEBUG_ADDRINFO
-static void dump_addrinfo(struct connectdata *conn,
- const struct Curl_addrinfo *ai)
+static void dump_addrinfo(struct connectdata *conn,
+ const struct Curl_addrinfo *ai)
{
printf("dump_addrinfo:\n");
for(; ai; ai = ai->ai_next) {
char buf[INET6_ADDRSTRLEN];
printf(" fam %2d, CNAME %s, ",
ai->ai_family, ai->ai_canonname ? ai->ai_canonname : "<none>");
- Curl_printable_address(ai, buf, sizeof(buf));
- printf("%s\n", buf);
+ Curl_printable_address(ai, buf, sizeof(buf));
+ printf("%s\n", buf);
}
}
#else
@@ -128,13 +128,13 @@ static void dump_addrinfo(struct connectdata *conn,
* memory we need to free after use. That memory *MUST* be freed with
* Curl_freeaddrinfo(), nothing else.
*/
-struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
- const char *hostname,
- int port,
- int *waitp)
+struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
+ const char *hostname,
+ int port,
+ int *waitp)
{
struct addrinfo hints;
- struct Curl_addrinfo *res;
+ struct Curl_addrinfo *res;
int error;
char sbuf[12];
char *sbufptr = NULL;
@@ -161,7 +161,7 @@ struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
break;
}
- if((pf != PF_INET) && !Curl_ipv6works(conn))
+ if((pf != PF_INET) && !Curl_ipv6works(conn))
/* The stack seems to be a non-IPv6 one */
pf = PF_INET;
diff --git a/contrib/libs/curl/lib/hostsyn.c b/contrib/libs/curl/lib/hostsyn.c
index a0d44095dc..550b43a085 100644
--- a/contrib/libs/curl/lib/hostsyn.c
+++ b/contrib/libs/curl/lib/hostsyn.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/hsts.c b/contrib/libs/curl/lib/hsts.c
index cc2650f7cb..6f771284ff 100644
--- a/contrib/libs/curl/lib/hsts.c
+++ b/contrib/libs/curl/lib/hsts.c
@@ -1,522 +1,522 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
- *
- ***************************************************************************/
-/*
- * The Strict-Transport-Security header is defined in RFC 6797:
- * https://tools.ietf.org/html/rfc6797
- */
-#include "curl_setup.h"
-
-#if !defined(CURL_DISABLE_HTTP) && defined(USE_HSTS)
-#include <curl/curl.h>
-#include "urldata.h"
-#include "llist.h"
-#include "hsts.h"
-#include "curl_get_line.h"
-#include "strcase.h"
-#include "sendf.h"
-#include "strtoofft.h"
-#include "parsedate.h"
-#include "rand.h"
-#include "rename.h"
-
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
-#include "curl_memory.h"
-#include "memdebug.h"
-
-#define MAX_HSTS_LINE 4095
-#define MAX_HSTS_HOSTLEN 256
-#define MAX_HSTS_HOSTLENSTR "256"
-#define MAX_HSTS_SUBLEN 4
-#define MAX_HSTS_SUBLENSTR "4"
-#define MAX_HSTS_DATELEN 64
-#define MAX_HSTS_DATELENSTR "64"
-
-#ifdef DEBUGBUILD
-/* to play well with debug builds, we can *set* a fixed time this will
- return */
-time_t deltatime; /* allow for "adjustments" for unit test purposes */
-static time_t debugtime(void *unused)
-{
- char *timestr = getenv("CURL_TIME");
- (void)unused;
- if(timestr) {
- unsigned long val = strtol(timestr, NULL, 10) + deltatime;
- return (time_t)val;
- }
- return time(NULL);
-}
-#define time(x) debugtime(x)
-#endif
-
-struct hsts *Curl_hsts_init(void)
-{
- struct hsts *h = calloc(sizeof(struct hsts), 1);
- if(h) {
- Curl_llist_init(&h->list, NULL);
- }
- return h;
-}
-
-static void hsts_free(struct stsentry *e)
-{
- free((char *)e->host);
- free(e);
-}
-
-void Curl_hsts_cleanup(struct hsts **hp)
-{
- struct hsts *h = *hp;
- if(h) {
- struct Curl_llist_element *e;
- struct Curl_llist_element *n;
- for(e = h->list.head; e; e = n) {
- struct stsentry *sts = e->ptr;
- n = e->next;
- hsts_free(sts);
- }
- free(h->filename);
- free(h);
- *hp = NULL;
- }
-}
-
-static struct stsentry *hsts_entry(void)
-{
- return calloc(sizeof(struct stsentry), 1);
-}
-
-static CURLcode hsts_create(struct hsts *h,
- const char *hostname,
- bool subdomains,
- curl_off_t expires)
-{
- struct stsentry *sts = hsts_entry();
- if(!sts)
- return CURLE_OUT_OF_MEMORY;
-
- sts->expires = expires;
- sts->includeSubDomains = subdomains;
- sts->host = strdup(hostname);
- if(!sts->host) {
- free(sts);
- return CURLE_OUT_OF_MEMORY;
- }
- Curl_llist_insert_next(&h->list, h->list.tail, sts, &sts->node);
- return CURLE_OK;
-}
-
-CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
- const char *header)
-{
- const char *p = header;
- curl_off_t expires = 0;
- bool gotma = FALSE;
- bool gotinc = FALSE;
- bool subdomains = FALSE;
- struct stsentry *sts;
- time_t now = time(NULL);
-
- do {
- while(*p && ISSPACE(*p))
- p++;
- if(Curl_strncasecompare("max-age=", p, 8)) {
- bool quoted = FALSE;
- CURLofft offt;
- char *endp;
-
- if(gotma)
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
- p += 8;
- while(*p && ISSPACE(*p))
- p++;
- if(*p == '\"') {
- p++;
- quoted = TRUE;
- }
- offt = curlx_strtoofft(p, &endp, 10, &expires);
- if(offt == CURL_OFFT_FLOW)
- expires = CURL_OFF_T_MAX;
- else if(offt)
- /* invalid max-age */
- return CURLE_BAD_FUNCTION_ARGUMENT;
- p = endp;
- if(quoted) {
- if(*p != '\"')
- return CURLE_BAD_FUNCTION_ARGUMENT;
- p++;
- }
- gotma = TRUE;
- }
- else if(Curl_strncasecompare("includesubdomains", p, 17)) {
- if(gotinc)
- return CURLE_BAD_FUNCTION_ARGUMENT;
- subdomains = TRUE;
- p += 17;
- gotinc = TRUE;
- }
- else {
- /* unknown directive, do a lame attempt to skip */
- while(*p && (*p != ';'))
- p++;
- }
-
- while(*p && ISSPACE(*p))
- p++;
- if(*p == ';')
- p++;
- } while (*p);
-
- if(!gotma)
- /* max-age is mandatory */
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
- if(!expires) {
- /* remove the entry if present verbatim (without subdomain match) */
- sts = Curl_hsts(h, hostname, FALSE);
- if(sts) {
- Curl_llist_remove(&h->list, &sts->node, NULL);
- hsts_free(sts);
- }
- return CURLE_OK;
- }
-
- if(CURL_OFF_T_MAX - now < expires)
- /* would overflow, use maximum value */
- expires = CURL_OFF_T_MAX;
- else
- expires += now;
-
- /* check if it already exists */
- sts = Curl_hsts(h, hostname, FALSE);
- if(sts) {
- /* just update these fields */
- sts->expires = expires;
- sts->includeSubDomains = subdomains;
- }
- else
- return hsts_create(h, hostname, subdomains, expires);
-
- return CURLE_OK;
-}
-
-/*
- * Return TRUE if the given host name is currently an HSTS one.
- *
- * The 'subdomain' argument tells the function if subdomain matching should be
- * attempted.
- */
-struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
- bool subdomain)
-{
- if(h) {
- time_t now = time(NULL);
- size_t hlen = strlen(hostname);
- struct Curl_llist_element *e;
- struct Curl_llist_element *n;
- for(e = h->list.head; e; e = n) {
- struct stsentry *sts = e->ptr;
- n = e->next;
- if(sts->expires <= now) {
- /* remove expired entries */
- Curl_llist_remove(&h->list, &sts->node, NULL);
- hsts_free(sts);
- continue;
- }
- if(subdomain && sts->includeSubDomains) {
- size_t ntail = strlen(sts->host);
- if(ntail < hlen) {
- size_t offs = hlen - ntail;
- if((hostname[offs-1] == '.') &&
- Curl_strncasecompare(&hostname[offs], sts->host, ntail))
- return sts;
- }
- }
- if(Curl_strcasecompare(hostname, sts->host))
- return sts;
- }
- }
- return NULL; /* no match */
-}
-
-/*
- * Send this HSTS entry to the write callback.
- */
-static CURLcode hsts_push(struct Curl_easy *data,
- struct curl_index *i,
- struct stsentry *sts,
- bool *stop)
-{
- struct curl_hstsentry e;
- CURLSTScode sc;
- struct tm stamp;
- CURLcode result;
-
- e.name = (char *)sts->host;
- e.namelen = strlen(sts->host);
- e.includeSubDomains = sts->includeSubDomains;
-
- result = Curl_gmtime(sts->expires, &stamp);
- if(result)
- return result;
-
- msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
- stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
- stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
-
- sc = data->set.hsts_write(data, &e, i,
- data->set.hsts_write_userp);
- *stop = (sc != CURLSTS_OK);
- return sc == CURLSTS_FAIL ? CURLE_BAD_FUNCTION_ARGUMENT : CURLE_OK;
-}
-
-/*
- * Write this single hsts entry to a single output line
- */
-static CURLcode hsts_out(struct stsentry *sts, FILE *fp)
-{
- struct tm stamp;
- CURLcode result = Curl_gmtime(sts->expires, &stamp);
- if(result)
- return result;
-
- fprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
- sts->includeSubDomains ? ".": "", sts->host,
- stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
- stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
- return CURLE_OK;
-}
-
-
-/*
- * Curl_https_save() writes the HSTS cache to file and callback.
- */
-CURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h,
- const char *file)
-{
- struct Curl_llist_element *e;
- struct Curl_llist_element *n;
- CURLcode result = CURLE_OK;
- FILE *out;
- char *tempstore;
- unsigned char randsuffix[9];
-
- if(!h)
- /* no cache activated */
- return CURLE_OK;
-
- /* if not new name is given, use the one we stored from the load */
- if(!file && h->filename)
- file = h->filename;
-
- if((h->flags & CURLHSTS_READONLYFILE) || !file || !file[0])
- /* marked as read-only, no file or zero length file name */
- goto skipsave;
-
- if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
- return CURLE_FAILED_INIT;
-
- tempstore = aprintf("%s.%s.tmp", file, randsuffix);
- if(!tempstore)
- return CURLE_OUT_OF_MEMORY;
-
- out = fopen(tempstore, FOPEN_WRITETEXT);
- if(!out)
- result = CURLE_WRITE_ERROR;
- else {
- fputs("# Your HSTS cache. https://curl.se/docs/hsts.html\n"
- "# This file was generated by libcurl! Edit at your own risk.\n",
- out);
- for(e = h->list.head; e; e = n) {
- struct stsentry *sts = e->ptr;
- n = e->next;
- result = hsts_out(sts, out);
- if(result)
- break;
- }
- fclose(out);
- if(!result && Curl_rename(tempstore, file))
- result = CURLE_WRITE_ERROR;
-
- if(result)
- unlink(tempstore);
- }
- free(tempstore);
- skipsave:
- if(data->set.hsts_write) {
- /* if there's a write callback */
- struct curl_index i; /* count */
- i.total = h->list.size;
- i.index = 0;
- for(e = h->list.head; e; e = n) {
- struct stsentry *sts = e->ptr;
- bool stop;
- n = e->next;
- result = hsts_push(data, &i, sts, &stop);
- if(result || stop)
- break;
- i.index++;
- }
- }
- return result;
-}
-
-/* only returns SERIOUS errors */
-static CURLcode hsts_add(struct hsts *h, char *line)
-{
- /* Example lines:
- example.com "20191231 10:00:00"
- .example.net "20191231 10:00:00"
- */
- char host[MAX_HSTS_HOSTLEN + 1];
- char date[MAX_HSTS_DATELEN + 1];
- int rc;
-
- rc = sscanf(line,
- "%" MAX_HSTS_HOSTLENSTR "s \"%" MAX_HSTS_DATELENSTR "[^\"]\"",
- host, date);
- if(2 == rc) {
- time_t expires = Curl_getdate_capped(date);
- CURLcode result;
- char *p = host;
- bool subdomain = FALSE;
- if(p[0] == '.') {
- p++;
- subdomain = TRUE;
- }
- result = hsts_create(h, p, subdomain, expires);
- if(result)
- return result;
- }
-
- return CURLE_OK;
-}
-
-/*
- * Load HSTS data from callback.
- *
- */
-static CURLcode hsts_pull(struct Curl_easy *data, struct hsts *h)
-{
- /* if the HSTS read callback is set, use it */
- if(data->set.hsts_read) {
- CURLSTScode sc;
- DEBUGASSERT(h);
- do {
- char buffer[257];
- struct curl_hstsentry e;
- e.name = buffer;
- e.namelen = sizeof(buffer)-1;
- e.includeSubDomains = FALSE; /* default */
- e.expire[0] = 0;
- e.name[0] = 0; /* just to make it clean */
- sc = data->set.hsts_read(data, &e, data->set.hsts_read_userp);
- if(sc == CURLSTS_OK) {
- time_t expires;
- CURLcode result;
- if(!e.name[0])
- /* bail out if no name was stored */
- return CURLE_BAD_FUNCTION_ARGUMENT;
- if(e.expire[0])
- expires = Curl_getdate_capped(e.expire);
- else
- expires = TIME_T_MAX; /* the end of time */
- result = hsts_create(h, e.name, e.includeSubDomains, expires);
- if(result)
- return result;
- }
- else if(sc == CURLSTS_FAIL)
- return CURLE_BAD_FUNCTION_ARGUMENT;
- } while(sc == CURLSTS_OK);
- }
- return CURLE_OK;
-}
-
-/*
- * Load the HSTS cache from the given file. The text based line-oriented file
- * format is documented here:
- * https://github.com/curl/curl/wiki/HSTS
- *
- * This function only returns error on major problems that prevents hsts
- * handling to work completely. It will ignore individual syntactical errors
- * etc.
- */
-static CURLcode hsts_load(struct hsts *h, const char *file)
-{
- CURLcode result = CURLE_OK;
- char *line = NULL;
- FILE *fp;
-
- /* we need a private copy of the file name so that the hsts cache file
- name survives an easy handle reset */
- free(h->filename);
- h->filename = strdup(file);
- if(!h->filename)
- return CURLE_OUT_OF_MEMORY;
-
- fp = fopen(file, FOPEN_READTEXT);
- if(fp) {
- line = malloc(MAX_HSTS_LINE);
- if(!line)
- goto fail;
- while(Curl_get_line(line, MAX_HSTS_LINE, fp)) {
- char *lineptr = line;
- while(*lineptr && ISBLANK(*lineptr))
- lineptr++;
- if(*lineptr == '#')
- /* skip commented lines */
- continue;
-
- hsts_add(h, lineptr);
- }
- free(line); /* free the line buffer */
- fclose(fp);
- }
- return result;
-
- fail:
- Curl_safefree(h->filename);
- fclose(fp);
- return CURLE_OUT_OF_MEMORY;
-}
-
-/*
- * Curl_hsts_loadfile() loads HSTS from file
- */
-CURLcode Curl_hsts_loadfile(struct Curl_easy *data,
- struct hsts *h, const char *file)
-{
- DEBUGASSERT(h);
- (void)data;
- return hsts_load(h, file);
-}
-
-/*
- * Curl_hsts_loadcb() loads HSTS from callback
- */
-CURLcode Curl_hsts_loadcb(struct Curl_easy *data, struct hsts *h)
-{
- return hsts_pull(data, h);
-}
-
-#endif /* CURL_DISABLE_HTTP || USE_HSTS */
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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.
+ *
+ ***************************************************************************/
+/*
+ * The Strict-Transport-Security header is defined in RFC 6797:
+ * https://tools.ietf.org/html/rfc6797
+ */
+#include "curl_setup.h"
+
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HSTS)
+#include <curl/curl.h>
+#include "urldata.h"
+#include "llist.h"
+#include "hsts.h"
+#include "curl_get_line.h"
+#include "strcase.h"
+#include "sendf.h"
+#include "strtoofft.h"
+#include "parsedate.h"
+#include "rand.h"
+#include "rename.h"
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "memdebug.h"
+
+#define MAX_HSTS_LINE 4095
+#define MAX_HSTS_HOSTLEN 256
+#define MAX_HSTS_HOSTLENSTR "256"
+#define MAX_HSTS_SUBLEN 4
+#define MAX_HSTS_SUBLENSTR "4"
+#define MAX_HSTS_DATELEN 64
+#define MAX_HSTS_DATELENSTR "64"
+
+#ifdef DEBUGBUILD
+/* to play well with debug builds, we can *set* a fixed time this will
+ return */
+time_t deltatime; /* allow for "adjustments" for unit test purposes */
+static time_t debugtime(void *unused)
+{
+ char *timestr = getenv("CURL_TIME");
+ (void)unused;
+ if(timestr) {
+ unsigned long val = strtol(timestr, NULL, 10) + deltatime;
+ return (time_t)val;
+ }
+ return time(NULL);
+}
+#define time(x) debugtime(x)
+#endif
+
+struct hsts *Curl_hsts_init(void)
+{
+ struct hsts *h = calloc(sizeof(struct hsts), 1);
+ if(h) {
+ Curl_llist_init(&h->list, NULL);
+ }
+ return h;
+}
+
+static void hsts_free(struct stsentry *e)
+{
+ free((char *)e->host);
+ free(e);
+}
+
+void Curl_hsts_cleanup(struct hsts **hp)
+{
+ struct hsts *h = *hp;
+ if(h) {
+ struct Curl_llist_element *e;
+ struct Curl_llist_element *n;
+ for(e = h->list.head; e; e = n) {
+ struct stsentry *sts = e->ptr;
+ n = e->next;
+ hsts_free(sts);
+ }
+ free(h->filename);
+ free(h);
+ *hp = NULL;
+ }
+}
+
+static struct stsentry *hsts_entry(void)
+{
+ return calloc(sizeof(struct stsentry), 1);
+}
+
+static CURLcode hsts_create(struct hsts *h,
+ const char *hostname,
+ bool subdomains,
+ curl_off_t expires)
+{
+ struct stsentry *sts = hsts_entry();
+ if(!sts)
+ return CURLE_OUT_OF_MEMORY;
+
+ sts->expires = expires;
+ sts->includeSubDomains = subdomains;
+ sts->host = strdup(hostname);
+ if(!sts->host) {
+ free(sts);
+ return CURLE_OUT_OF_MEMORY;
+ }
+ Curl_llist_insert_next(&h->list, h->list.tail, sts, &sts->node);
+ return CURLE_OK;
+}
+
+CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
+ const char *header)
+{
+ const char *p = header;
+ curl_off_t expires = 0;
+ bool gotma = FALSE;
+ bool gotinc = FALSE;
+ bool subdomains = FALSE;
+ struct stsentry *sts;
+ time_t now = time(NULL);
+
+ do {
+ while(*p && ISSPACE(*p))
+ p++;
+ if(Curl_strncasecompare("max-age=", p, 8)) {
+ bool quoted = FALSE;
+ CURLofft offt;
+ char *endp;
+
+ if(gotma)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
+ p += 8;
+ while(*p && ISSPACE(*p))
+ p++;
+ if(*p == '\"') {
+ p++;
+ quoted = TRUE;
+ }
+ offt = curlx_strtoofft(p, &endp, 10, &expires);
+ if(offt == CURL_OFFT_FLOW)
+ expires = CURL_OFF_T_MAX;
+ else if(offt)
+ /* invalid max-age */
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ p = endp;
+ if(quoted) {
+ if(*p != '\"')
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ p++;
+ }
+ gotma = TRUE;
+ }
+ else if(Curl_strncasecompare("includesubdomains", p, 17)) {
+ if(gotinc)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ subdomains = TRUE;
+ p += 17;
+ gotinc = TRUE;
+ }
+ else {
+ /* unknown directive, do a lame attempt to skip */
+ while(*p && (*p != ';'))
+ p++;
+ }
+
+ while(*p && ISSPACE(*p))
+ p++;
+ if(*p == ';')
+ p++;
+ } while (*p);
+
+ if(!gotma)
+ /* max-age is mandatory */
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
+ if(!expires) {
+ /* remove the entry if present verbatim (without subdomain match) */
+ sts = Curl_hsts(h, hostname, FALSE);
+ if(sts) {
+ Curl_llist_remove(&h->list, &sts->node, NULL);
+ hsts_free(sts);
+ }
+ return CURLE_OK;
+ }
+
+ if(CURL_OFF_T_MAX - now < expires)
+ /* would overflow, use maximum value */
+ expires = CURL_OFF_T_MAX;
+ else
+ expires += now;
+
+ /* check if it already exists */
+ sts = Curl_hsts(h, hostname, FALSE);
+ if(sts) {
+ /* just update these fields */
+ sts->expires = expires;
+ sts->includeSubDomains = subdomains;
+ }
+ else
+ return hsts_create(h, hostname, subdomains, expires);
+
+ return CURLE_OK;
+}
+
+/*
+ * Return TRUE if the given host name is currently an HSTS one.
+ *
+ * The 'subdomain' argument tells the function if subdomain matching should be
+ * attempted.
+ */
+struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
+ bool subdomain)
+{
+ if(h) {
+ time_t now = time(NULL);
+ size_t hlen = strlen(hostname);
+ struct Curl_llist_element *e;
+ struct Curl_llist_element *n;
+ for(e = h->list.head; e; e = n) {
+ struct stsentry *sts = e->ptr;
+ n = e->next;
+ if(sts->expires <= now) {
+ /* remove expired entries */
+ Curl_llist_remove(&h->list, &sts->node, NULL);
+ hsts_free(sts);
+ continue;
+ }
+ if(subdomain && sts->includeSubDomains) {
+ size_t ntail = strlen(sts->host);
+ if(ntail < hlen) {
+ size_t offs = hlen - ntail;
+ if((hostname[offs-1] == '.') &&
+ Curl_strncasecompare(&hostname[offs], sts->host, ntail))
+ return sts;
+ }
+ }
+ if(Curl_strcasecompare(hostname, sts->host))
+ return sts;
+ }
+ }
+ return NULL; /* no match */
+}
+
+/*
+ * Send this HSTS entry to the write callback.
+ */
+static CURLcode hsts_push(struct Curl_easy *data,
+ struct curl_index *i,
+ struct stsentry *sts,
+ bool *stop)
+{
+ struct curl_hstsentry e;
+ CURLSTScode sc;
+ struct tm stamp;
+ CURLcode result;
+
+ e.name = (char *)sts->host;
+ e.namelen = strlen(sts->host);
+ e.includeSubDomains = sts->includeSubDomains;
+
+ result = Curl_gmtime(sts->expires, &stamp);
+ if(result)
+ return result;
+
+ msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
+ stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+ stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
+
+ sc = data->set.hsts_write(data, &e, i,
+ data->set.hsts_write_userp);
+ *stop = (sc != CURLSTS_OK);
+ return sc == CURLSTS_FAIL ? CURLE_BAD_FUNCTION_ARGUMENT : CURLE_OK;
+}
+
+/*
+ * Write this single hsts entry to a single output line
+ */
+static CURLcode hsts_out(struct stsentry *sts, FILE *fp)
+{
+ struct tm stamp;
+ CURLcode result = Curl_gmtime(sts->expires, &stamp);
+ if(result)
+ return result;
+
+ fprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
+ sts->includeSubDomains ? ".": "", sts->host,
+ stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+ stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
+ return CURLE_OK;
+}
+
+
+/*
+ * Curl_https_save() writes the HSTS cache to file and callback.
+ */
+CURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h,
+ const char *file)
+{
+ struct Curl_llist_element *e;
+ struct Curl_llist_element *n;
+ CURLcode result = CURLE_OK;
+ FILE *out;
+ char *tempstore;
+ unsigned char randsuffix[9];
+
+ if(!h)
+ /* no cache activated */
+ return CURLE_OK;
+
+ /* if not new name is given, use the one we stored from the load */
+ if(!file && h->filename)
+ file = h->filename;
+
+ if((h->flags & CURLHSTS_READONLYFILE) || !file || !file[0])
+ /* marked as read-only, no file or zero length file name */
+ goto skipsave;
+
+ if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
+ return CURLE_FAILED_INIT;
+
+ tempstore = aprintf("%s.%s.tmp", file, randsuffix);
+ if(!tempstore)
+ return CURLE_OUT_OF_MEMORY;
+
+ out = fopen(tempstore, FOPEN_WRITETEXT);
+ if(!out)
+ result = CURLE_WRITE_ERROR;
+ else {
+ fputs("# Your HSTS cache. https://curl.se/docs/hsts.html\n"
+ "# This file was generated by libcurl! Edit at your own risk.\n",
+ out);
+ for(e = h->list.head; e; e = n) {
+ struct stsentry *sts = e->ptr;
+ n = e->next;
+ result = hsts_out(sts, out);
+ if(result)
+ break;
+ }
+ fclose(out);
+ if(!result && Curl_rename(tempstore, file))
+ result = CURLE_WRITE_ERROR;
+
+ if(result)
+ unlink(tempstore);
+ }
+ free(tempstore);
+ skipsave:
+ if(data->set.hsts_write) {
+ /* if there's a write callback */
+ struct curl_index i; /* count */
+ i.total = h->list.size;
+ i.index = 0;
+ for(e = h->list.head; e; e = n) {
+ struct stsentry *sts = e->ptr;
+ bool stop;
+ n = e->next;
+ result = hsts_push(data, &i, sts, &stop);
+ if(result || stop)
+ break;
+ i.index++;
+ }
+ }
+ return result;
+}
+
+/* only returns SERIOUS errors */
+static CURLcode hsts_add(struct hsts *h, char *line)
+{
+ /* Example lines:
+ example.com "20191231 10:00:00"
+ .example.net "20191231 10:00:00"
+ */
+ char host[MAX_HSTS_HOSTLEN + 1];
+ char date[MAX_HSTS_DATELEN + 1];
+ int rc;
+
+ rc = sscanf(line,
+ "%" MAX_HSTS_HOSTLENSTR "s \"%" MAX_HSTS_DATELENSTR "[^\"]\"",
+ host, date);
+ if(2 == rc) {
+ time_t expires = Curl_getdate_capped(date);
+ CURLcode result;
+ char *p = host;
+ bool subdomain = FALSE;
+ if(p[0] == '.') {
+ p++;
+ subdomain = TRUE;
+ }
+ result = hsts_create(h, p, subdomain, expires);
+ if(result)
+ return result;
+ }
+
+ return CURLE_OK;
+}
+
+/*
+ * Load HSTS data from callback.
+ *
+ */
+static CURLcode hsts_pull(struct Curl_easy *data, struct hsts *h)
+{
+ /* if the HSTS read callback is set, use it */
+ if(data->set.hsts_read) {
+ CURLSTScode sc;
+ DEBUGASSERT(h);
+ do {
+ char buffer[257];
+ struct curl_hstsentry e;
+ e.name = buffer;
+ e.namelen = sizeof(buffer)-1;
+ e.includeSubDomains = FALSE; /* default */
+ e.expire[0] = 0;
+ e.name[0] = 0; /* just to make it clean */
+ sc = data->set.hsts_read(data, &e, data->set.hsts_read_userp);
+ if(sc == CURLSTS_OK) {
+ time_t expires;
+ CURLcode result;
+ if(!e.name[0])
+ /* bail out if no name was stored */
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ if(e.expire[0])
+ expires = Curl_getdate_capped(e.expire);
+ else
+ expires = TIME_T_MAX; /* the end of time */
+ result = hsts_create(h, e.name, e.includeSubDomains, expires);
+ if(result)
+ return result;
+ }
+ else if(sc == CURLSTS_FAIL)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ } while(sc == CURLSTS_OK);
+ }
+ return CURLE_OK;
+}
+
+/*
+ * Load the HSTS cache from the given file. The text based line-oriented file
+ * format is documented here:
+ * https://github.com/curl/curl/wiki/HSTS
+ *
+ * This function only returns error on major problems that prevents hsts
+ * handling to work completely. It will ignore individual syntactical errors
+ * etc.
+ */
+static CURLcode hsts_load(struct hsts *h, const char *file)
+{
+ CURLcode result = CURLE_OK;
+ char *line = NULL;
+ FILE *fp;
+
+ /* we need a private copy of the file name so that the hsts cache file
+ name survives an easy handle reset */
+ free(h->filename);
+ h->filename = strdup(file);
+ if(!h->filename)
+ return CURLE_OUT_OF_MEMORY;
+
+ fp = fopen(file, FOPEN_READTEXT);
+ if(fp) {
+ line = malloc(MAX_HSTS_LINE);
+ if(!line)
+ goto fail;
+ while(Curl_get_line(line, MAX_HSTS_LINE, fp)) {
+ char *lineptr = line;
+ while(*lineptr && ISBLANK(*lineptr))
+ lineptr++;
+ if(*lineptr == '#')
+ /* skip commented lines */
+ continue;
+
+ hsts_add(h, lineptr);
+ }
+ free(line); /* free the line buffer */
+ fclose(fp);
+ }
+ return result;
+
+ fail:
+ Curl_safefree(h->filename);
+ fclose(fp);
+ return CURLE_OUT_OF_MEMORY;
+}
+
+/*
+ * Curl_hsts_loadfile() loads HSTS from file
+ */
+CURLcode Curl_hsts_loadfile(struct Curl_easy *data,
+ struct hsts *h, const char *file)
+{
+ DEBUGASSERT(h);
+ (void)data;
+ return hsts_load(h, file);
+}
+
+/*
+ * Curl_hsts_loadcb() loads HSTS from callback
+ */
+CURLcode Curl_hsts_loadcb(struct Curl_easy *data, struct hsts *h)
+{
+ return hsts_pull(data, h);
+}
+
+#endif /* CURL_DISABLE_HTTP || USE_HSTS */
diff --git a/contrib/libs/curl/lib/hsts.h b/contrib/libs/curl/lib/hsts.h
index 4d3b3ca9cc..ae5db74a24 100644
--- a/contrib/libs/curl/lib/hsts.h
+++ b/contrib/libs/curl/lib/hsts.h
@@ -1,65 +1,65 @@
-#ifndef HEADER_CURL_HSTS_H
-#define HEADER_CURL_HSTS_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
-
-#if !defined(CURL_DISABLE_HTTP) && defined(USE_HSTS)
-#include <curl/curl.h>
-#include "llist.h"
-
-#ifdef DEBUGBUILD
-extern time_t deltatime;
-#endif
-
-struct stsentry {
- struct Curl_llist_element node;
- const char *host;
- bool includeSubDomains;
- time_t expires; /* the timestamp of this entry's expiry */
-};
-
-/* The HSTS cache. Needs to be able to tailmatch host names. */
-struct hsts {
- struct Curl_llist list;
- char *filename;
- unsigned int flags;
-};
-
-struct hsts *Curl_hsts_init(void);
-void Curl_hsts_cleanup(struct hsts **hp);
-CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
- const char *sts);
-struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
- bool subdomain);
-CURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h,
- const char *file);
-CURLcode Curl_hsts_loadfile(struct Curl_easy *data,
- struct hsts *h, const char *file);
-CURLcode Curl_hsts_loadcb(struct Curl_easy *data,
- struct hsts *h);
-#else
-#define Curl_hsts_cleanup(x)
-#define Curl_hsts_loadcb(x,y)
-#define Curl_hsts_save(x,y,z)
-#endif /* CURL_DISABLE_HTTP || USE_HSTS */
-#endif /* HEADER_CURL_HSTS_H */
+#ifndef HEADER_CURL_HSTS_H
+#define HEADER_CURL_HSTS_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
+
+#if !defined(CURL_DISABLE_HTTP) && defined(USE_HSTS)
+#include <curl/curl.h>
+#include "llist.h"
+
+#ifdef DEBUGBUILD
+extern time_t deltatime;
+#endif
+
+struct stsentry {
+ struct Curl_llist_element node;
+ const char *host;
+ bool includeSubDomains;
+ time_t expires; /* the timestamp of this entry's expiry */
+};
+
+/* The HSTS cache. Needs to be able to tailmatch host names. */
+struct hsts {
+ struct Curl_llist list;
+ char *filename;
+ unsigned int flags;
+};
+
+struct hsts *Curl_hsts_init(void);
+void Curl_hsts_cleanup(struct hsts **hp);
+CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
+ const char *sts);
+struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
+ bool subdomain);
+CURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h,
+ const char *file);
+CURLcode Curl_hsts_loadfile(struct Curl_easy *data,
+ struct hsts *h, const char *file);
+CURLcode Curl_hsts_loadcb(struct Curl_easy *data,
+ struct hsts *h);
+#else
+#define Curl_hsts_cleanup(x)
+#define Curl_hsts_loadcb(x,y)
+#define Curl_hsts_save(x,y,z)
+#endif /* CURL_DISABLE_HTTP || USE_HSTS */
+#endif /* HEADER_CURL_HSTS_H */
diff --git a/contrib/libs/curl/lib/http.c b/contrib/libs/curl/lib/http.c
index 9db4499040..c232ed4134 100644
--- a/contrib/libs/curl/lib/http.c
+++ b/contrib/libs/curl/lib/http.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -77,7 +77,7 @@
#include "connect.h"
#include "strdup.h"
#include "altsvc.h"
-#include "hsts.h"
+#include "hsts.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -126,9 +126,9 @@ const struct Curl_handler Curl_handler_http = {
ZERO_NULL, /* connection_check */
PORT_HTTP, /* defport */
CURLPROTO_HTTP, /* protocol */
- CURLPROTO_HTTP, /* family */
- PROTOPT_CREDSPERREQUEST | /* flags */
- PROTOPT_USERPWDCTRL
+ CURLPROTO_HTTP, /* family */
+ PROTOPT_CREDSPERREQUEST | /* flags */
+ PROTOPT_USERPWDCTRL
};
#ifdef USE_SSL
@@ -153,9 +153,9 @@ const struct Curl_handler Curl_handler_https = {
ZERO_NULL, /* connection_check */
PORT_HTTPS, /* defport */
CURLPROTO_HTTPS, /* protocol */
- CURLPROTO_HTTP, /* family */
- PROTOPT_SSL | PROTOPT_CREDSPERREQUEST | PROTOPT_ALPN_NPN | /* flags */
- PROTOPT_USERPWDCTRL
+ CURLPROTO_HTTP, /* family */
+ PROTOPT_SSL | PROTOPT_CREDSPERREQUEST | PROTOPT_ALPN_NPN | /* flags */
+ PROTOPT_USERPWDCTRL
};
#endif
@@ -165,14 +165,14 @@ static CURLcode http_setup_conn(struct connectdata *conn)
during this request */
struct HTTP *http;
struct Curl_easy *data = conn->data;
- DEBUGASSERT(data->req.p.http == NULL);
+ DEBUGASSERT(data->req.p.http == NULL);
http = calloc(1, sizeof(struct HTTP));
if(!http)
return CURLE_OUT_OF_MEMORY;
Curl_mime_initpart(&http->form, conn->data);
- data->req.p.http = http;
+ data->req.p.http = http;
if(data->set.httpversion == CURL_HTTP_VERSION_3) {
if(conn->handler->flags & PROTOPT_SSL)
@@ -273,7 +273,7 @@ char *Curl_copy_header_value(const char *header)
return NULL;
memcpy(value, start, len);
- value[len] = 0; /* null-terminate */
+ value[len] = 0; /* null-terminate */
return value;
}
@@ -297,21 +297,21 @@ static CURLcode http_output_basic(struct connectdata *conn, bool proxy)
char *out;
if(proxy) {
-#ifndef CURL_DISABLE_PROXY
- userp = &data->state.aptr.proxyuserpwd;
+#ifndef CURL_DISABLE_PROXY
+ userp = &data->state.aptr.proxyuserpwd;
user = conn->http_proxy.user;
pwd = conn->http_proxy.passwd;
-#else
- return CURLE_NOT_BUILT_IN;
-#endif
+#else
+ return CURLE_NOT_BUILT_IN;
+#endif
}
else {
- userp = &data->state.aptr.userpwd;
+ userp = &data->state.aptr.userpwd;
user = conn->user;
pwd = conn->passwd;
}
- out = aprintf("%s:%s", user, pwd ? pwd : "");
+ out = aprintf("%s:%s", user, pwd ? pwd : "");
if(!out)
return CURLE_OUT_OF_MEMORY;
@@ -349,12 +349,12 @@ static CURLcode http_output_bearer(struct connectdata *conn)
{
char **userp;
CURLcode result = CURLE_OK;
- struct Curl_easy *data = conn->data;
+ struct Curl_easy *data = conn->data;
- userp = &data->state.aptr.userpwd;
+ userp = &data->state.aptr.userpwd;
free(*userp);
*userp = aprintf("Authorization: Bearer %s\r\n",
- conn->data->set.str[STRING_BEARER]);
+ conn->data->set.str[STRING_BEARER]);
if(!*userp) {
result = CURLE_OUT_OF_MEMORY;
@@ -428,7 +428,7 @@ static bool pickoneauth(struct auth *pick, unsigned long mask)
static CURLcode http_perhapsrewind(struct connectdata *conn)
{
struct Curl_easy *data = conn->data;
- struct HTTP *http = data->req.p.http;
+ struct HTTP *http = data->req.p.http;
curl_off_t bytessent;
curl_off_t expectsend = -1; /* default is unknown */
@@ -437,7 +437,7 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
skip this rewinding stuff */
return CURLE_OK;
- switch(data->state.httpreq) {
+ switch(data->state.httpreq) {
case HTTPREQ_GET:
case HTTPREQ_HEAD:
return CURLE_OK;
@@ -458,7 +458,7 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
}
else {
/* figure out how much data we are expected to send */
- switch(data->state.httpreq) {
+ switch(data->state.httpreq) {
case HTTPREQ_POST:
case HTTPREQ_PUT:
if(data->state.infilesize != -1)
@@ -565,7 +565,7 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
CURLcode result = CURLE_OK;
unsigned long authmask = ~0ul;
- if(!data->set.str[STRING_BEARER])
+ if(!data->set.str[STRING_BEARER])
authmask &= (unsigned long)~CURLAUTH_BEARER;
if(100 <= data->req.httpcode && 199 >= data->req.httpcode)
@@ -575,7 +575,7 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
if(data->state.authproblem)
return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK;
- if((conn->bits.user_passwd || data->set.str[STRING_BEARER]) &&
+ if((conn->bits.user_passwd || data->set.str[STRING_BEARER]) &&
((data->req.httpcode == 401) ||
(conn->bits.authneg && data->req.httpcode < 300))) {
pickhost = pickoneauth(&data->state.authhost, authmask);
@@ -588,7 +588,7 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
conn->data->set.httpversion = CURL_HTTP_VERSION_1_1;
}
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.proxy_user_passwd &&
((data->req.httpcode == 407) ||
(conn->bits.authneg && data->req.httpcode < 300))) {
@@ -597,11 +597,11 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
if(!pickproxy)
data->state.authproblem = TRUE;
}
-#endif
+#endif
if(pickhost || pickproxy) {
- if((data->state.httpreq != HTTPREQ_GET) &&
- (data->state.httpreq != HTTPREQ_HEAD) &&
+ if((data->state.httpreq != HTTPREQ_GET) &&
+ (data->state.httpreq != HTTPREQ_HEAD) &&
!conn->bits.rewindaftersend) {
result = http_perhapsrewind(conn);
if(result)
@@ -622,8 +622,8 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
authentication is not "done" yet and
no authentication seems to be required and
we didn't try HEAD or GET */
- if((data->state.httpreq != HTTPREQ_GET) &&
- (data->state.httpreq != HTTPREQ_HEAD)) {
+ if((data->state.httpreq != HTTPREQ_GET) &&
+ (data->state.httpreq != HTTPREQ_HEAD)) {
data->req.newurl = strdup(data->change.url); /* clone URL */
if(!data->req.newurl)
return CURLE_OUT_OF_MEMORY;
@@ -701,13 +701,13 @@ output_auth_headers(struct connectdata *conn,
#endif
if(authstatus->picked == CURLAUTH_BASIC) {
/* Basic */
- if(
-#ifndef CURL_DISABLE_PROXY
- (proxy && conn->bits.proxy_user_passwd &&
- !Curl_checkProxyheaders(conn, "Proxy-authorization")) ||
-#endif
- (!proxy && conn->bits.user_passwd &&
- !Curl_checkheaders(conn, "Authorization"))) {
+ if(
+#ifndef CURL_DISABLE_PROXY
+ (proxy && conn->bits.proxy_user_passwd &&
+ !Curl_checkProxyheaders(conn, "Proxy-authorization")) ||
+#endif
+ (!proxy && conn->bits.user_passwd &&
+ !Curl_checkheaders(conn, "Authorization"))) {
auth = "Basic";
result = http_output_basic(conn, proxy);
if(result)
@@ -720,7 +720,7 @@ output_auth_headers(struct connectdata *conn,
}
if(authstatus->picked == CURLAUTH_BEARER) {
/* Bearer */
- if((!proxy && data->set.str[STRING_BEARER] &&
+ if((!proxy && data->set.str[STRING_BEARER] &&
!Curl_checkheaders(conn, "Authorization:"))) {
auth = "Bearer";
result = http_output_bearer(conn);
@@ -734,15 +734,15 @@ output_auth_headers(struct connectdata *conn,
}
if(auth) {
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
infof(data, "%s auth using %s with user '%s'\n",
proxy ? "Proxy" : "Server", auth,
proxy ? (conn->http_proxy.user ? conn->http_proxy.user : "") :
- (conn->user ? conn->user : ""));
-#else
- infof(data, "Server auth using %s with user '%s'\n",
- auth, conn->user ? conn->user : "");
-#endif
+ (conn->user ? conn->user : ""));
+#else
+ infof(data, "Server auth using %s with user '%s'\n",
+ auth, conn->user ? conn->user : "");
+#endif
authstatus->multipass = (!authstatus->done) ? TRUE : FALSE;
}
else
@@ -782,11 +782,11 @@ Curl_http_output_auth(struct connectdata *conn,
authhost = &data->state.authhost;
authproxy = &data->state.authproxy;
- if(
-#ifndef CURL_DISABLE_PROXY
- (conn->bits.httpproxy && conn->bits.proxy_user_passwd) ||
-#endif
- conn->bits.user_passwd || data->set.str[STRING_BEARER])
+ if(
+#ifndef CURL_DISABLE_PROXY
+ (conn->bits.httpproxy && conn->bits.proxy_user_passwd) ||
+#endif
+ conn->bits.user_passwd || data->set.str[STRING_BEARER])
/* continue please */;
else {
authhost->done = TRUE;
@@ -1090,10 +1090,10 @@ static int http_should_fail(struct connectdata *conn)
*/
if((httpcode == 401) && !conn->bits.user_passwd)
return TRUE;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if((httpcode == 407) && !conn->bits.proxy_user_passwd)
return TRUE;
-#endif
+#endif
return data->state.authproblem;
}
@@ -1112,7 +1112,7 @@ static size_t readmoredata(char *buffer,
void *userp)
{
struct connectdata *conn = (struct connectdata *)userp;
- struct HTTP *http = conn->data->req.p.http;
+ struct HTTP *http = conn->data->req.p.http;
size_t fullsize = size * nitems;
if(!http->postsize)
@@ -1151,26 +1151,26 @@ static size_t readmoredata(char *buffer,
}
/*
- * Curl_buffer_send() sends a header buffer and frees all associated
+ * Curl_buffer_send() sends a header buffer and frees all associated
* memory. Body data may be appended to the header data if desired.
*
* Returns CURLcode
*/
-CURLcode Curl_buffer_send(struct dynbuf *in,
- struct connectdata *conn,
- /* add the number of sent bytes to this
- counter */
- curl_off_t *bytes_written,
- /* how much of the buffer contains body data */
- size_t included_body_bytes,
- int socketindex)
+CURLcode Curl_buffer_send(struct dynbuf *in,
+ struct connectdata *conn,
+ /* add the number of sent bytes to this
+ counter */
+ curl_off_t *bytes_written,
+ /* how much of the buffer contains body data */
+ size_t included_body_bytes,
+ int socketindex)
{
ssize_t amount;
CURLcode result;
char *ptr;
size_t size;
struct Curl_easy *data = conn->data;
- struct HTTP *http = data->req.p.http;
+ struct HTTP *http = data->req.p.http;
size_t sendsize;
curl_socket_t sockfd;
size_t headersize;
@@ -1182,8 +1182,8 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
/* The looping below is required since we use non-blocking sockets, but due
to the circumstances we will just loop and try again and again etc */
- ptr = Curl_dyn_ptr(in);
- size = Curl_dyn_len(in);
+ ptr = Curl_dyn_ptr(in);
+ size = Curl_dyn_len(in);
headersize = size - included_body_bytes; /* the initial part that isn't body
is header */
@@ -1194,15 +1194,15 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
/* Curl_convert_to_network calls failf if unsuccessful */
if(result) {
/* conversion failed, free memory and return to the caller */
- Curl_dyn_free(in);
+ Curl_dyn_free(in);
return result;
}
- if((conn->handler->flags & PROTOPT_SSL
-#ifndef CURL_DISABLE_PROXY
- || conn->http_proxy.proxytype == CURLPROXY_HTTPS
-#endif
- )
+ if((conn->handler->flags & PROTOPT_SSL
+#ifndef CURL_DISABLE_PROXY
+ || conn->http_proxy.proxytype == CURLPROXY_HTTPS
+#endif
+ )
&& conn->httpversion != 20) {
/* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk
when we speak HTTPS, as if only a fraction of it is sent now, this data
@@ -1221,27 +1221,27 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
result = Curl_get_upload_buffer(data);
if(result) {
/* malloc failed, free memory and return to the caller */
- Curl_dyn_free(in);
+ Curl_dyn_free(in);
return result;
}
memcpy(data->state.ulbuf, ptr, sendsize);
ptr = data->state.ulbuf;
}
- else {
-#ifdef CURLDEBUG
- /* Allow debug builds override this logic to force short initial sends */
- char *p = getenv("CURL_SMALLREQSEND");
- if(p) {
- size_t altsize = (size_t)strtoul(p, NULL, 10);
- if(altsize)
- sendsize = CURLMIN(size, altsize);
- else
- sendsize = size;
- }
- else
-#endif
+ else {
+#ifdef CURLDEBUG
+ /* Allow debug builds override this logic to force short initial sends */
+ char *p = getenv("CURL_SMALLREQSEND");
+ if(p) {
+ size_t altsize = (size_t)strtoul(p, NULL, 10);
+ if(altsize)
+ sendsize = CURLMIN(size, altsize);
+ else
+ sendsize = size;
+ }
+ else
+#endif
sendsize = size;
- }
+ }
result = Curl_write(conn, sockfd, ptr, sendsize, &amount);
@@ -1255,12 +1255,12 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
size_t headlen = (size_t)amount>headersize ? headersize : (size_t)amount;
size_t bodylen = amount - headlen;
- /* this data _may_ contain binary stuff */
- Curl_debug(data, CURLINFO_HEADER_OUT, ptr, headlen);
- if(bodylen)
- /* there was body data sent beyond the initial header part, pass that on
- to the debug callback too */
- Curl_debug(data, CURLINFO_DATA_OUT, ptr + headlen, bodylen);
+ /* this data _may_ contain binary stuff */
+ Curl_debug(data, CURLINFO_HEADER_OUT, ptr, headlen);
+ if(bodylen)
+ /* there was body data sent beyond the initial header part, pass that on
+ to the debug callback too */
+ Curl_debug(data, CURLINFO_DATA_OUT, ptr + headlen, bodylen);
/* 'amount' can never be a very large value here so typecasting it so a
signed 31 bit value should not cause problems even if ssize_t is
@@ -1280,7 +1280,7 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
size -= amount;
- ptr = Curl_dyn_ptr(in) + amount;
+ ptr = Curl_dyn_ptr(in) + amount;
/* backup the currently set pointers */
http->backup.fread_func = data->state.fread_func;
@@ -1294,7 +1294,7 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
http->postdata = ptr;
http->postsize = (curl_off_t)size;
- http->send_buffer = *in; /* copy the whole struct */
+ http->send_buffer = *in; /* copy the whole struct */
http->sending = HTTPSEND_REQUEST;
return CURLE_OK;
@@ -1314,7 +1314,7 @@ CURLcode Curl_buffer_send(struct dynbuf *in,
return CURLE_SEND_ERROR;
}
}
- Curl_dyn_free(in);
+ Curl_dyn_free(in);
return result;
}
@@ -1352,7 +1352,7 @@ Curl_compareheader(const char *headerline, /* line to check */
/* pass the header */
start = &headerline[hlen];
- /* pass all whitespace */
+ /* pass all whitespace */
while(*start && ISSPACE(*start))
start++;
@@ -1391,7 +1391,7 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
function to make the re-use checks properly be able to check this bit. */
connkeep(conn, "HTTP default");
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
/* the CONNECT procedure might not have been completed */
result = Curl_proxy_connect(conn, FIRSTSOCKET);
if(result)
@@ -1443,7 +1443,7 @@ static int http_getsock_do(struct connectdata *conn,
static CURLcode add_haproxy_protocol_header(struct connectdata *conn)
{
char proxy_header[128];
- struct dynbuf req;
+ struct dynbuf req;
CURLcode result;
char tcp_version[5];
@@ -1464,14 +1464,14 @@ static CURLcode add_haproxy_protocol_header(struct connectdata *conn)
conn->data->info.conn_local_port,
conn->data->info.conn_primary_port);
- Curl_dyn_init(&req, DYN_HAXPROXY);
+ Curl_dyn_init(&req, DYN_HAXPROXY);
- result = Curl_dyn_add(&req, proxy_header);
+ result = Curl_dyn_add(&req, proxy_header);
if(result)
return result;
- result = Curl_buffer_send(&req, conn, &conn->data->info.request_size,
- 0, FIRSTSOCKET);
+ result = Curl_buffer_send(&req, conn, &conn->data->info.request_size,
+ 0, FIRSTSOCKET);
return result;
}
@@ -1516,7 +1516,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
CURLcode status, bool premature)
{
struct Curl_easy *data = conn->data;
- struct HTTP *http = data->req.p.http;
+ struct HTTP *http = data->req.p.http;
/* Clear multipass flag. If authentication isn't done yet, then it will get
* a chance to be set back to true when we output the next auth header */
@@ -1532,11 +1532,11 @@ CURLcode Curl_http_done(struct connectdata *conn,
if(!http)
return CURLE_OK;
- Curl_dyn_free(&http->send_buffer);
- Curl_http2_done(data, premature);
- Curl_quic_done(data, premature);
+ Curl_dyn_free(&http->send_buffer);
+ Curl_http2_done(data, premature);
+ Curl_quic_done(data, premature);
Curl_mime_cleanpart(&http->form);
- Curl_dyn_reset(&data->state.headerb);
+ Curl_dyn_reset(&data->state.headerb);
if(status)
return status;
@@ -1602,12 +1602,12 @@ static const char *get_http_string(const struct Curl_easy *data,
/* check and possibly add an Expect: header */
static CURLcode expect100(struct Curl_easy *data,
struct connectdata *conn,
- struct dynbuf *req)
+ struct dynbuf *req)
{
CURLcode result = CURLE_OK;
data->state.expect100header = FALSE; /* default to false unless it is set
to TRUE below */
- if(!data->state.disableexpect && use_http_1_1plus(data, conn) &&
+ if(!data->state.disableexpect && use_http_1_1plus(data, conn) &&
(conn->httpversion < 20)) {
/* 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
@@ -1618,7 +1618,7 @@ static CURLcode expect100(struct Curl_easy *data,
Curl_compareheader(ptr, "Expect:", "100-continue");
}
else {
- result = Curl_dyn_add(req, "Expect: 100-continue\r\n");
+ result = Curl_dyn_add(req, "Expect: 100-continue\r\n");
if(!result)
data->state.expect100header = TRUE;
}
@@ -1637,7 +1637,7 @@ enum proxy_use {
will return an error code if one of the headers is
not formatted correctly */
CURLcode Curl_http_compile_trailers(struct curl_slist *trailers,
- struct dynbuf *b,
+ struct dynbuf *b,
struct Curl_easy *handle)
{
char *ptr = NULL;
@@ -1663,24 +1663,24 @@ CURLcode Curl_http_compile_trailers(struct curl_slist *trailers,
/* only add correctly formatted trailers */
ptr = strchr(trailers->data, ':');
if(ptr && *(ptr + 1) == ' ') {
- result = Curl_dyn_add(b, trailers->data);
+ result = Curl_dyn_add(b, trailers->data);
+ if(result)
+ return result;
+ result = Curl_dyn_add(b, endofline_native);
if(result)
return result;
- result = Curl_dyn_add(b, endofline_native);
- if(result)
- return result;
}
else
infof(handle, "Malformatted trailing header ! Skipping trailer.");
trailers = trailers->next;
}
- result = Curl_dyn_add(b, endofline_network);
+ result = Curl_dyn_add(b, endofline_network);
return result;
}
CURLcode Curl_add_custom_headers(struct connectdata *conn,
bool is_connect,
- struct dynbuf *req)
+ struct dynbuf *req)
{
char *ptr;
struct curl_slist *h[2];
@@ -1689,7 +1689,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
struct Curl_easy *data = conn->data;
int i;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
enum proxy_use proxy;
if(is_connect)
@@ -1716,10 +1716,10 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
h[0] = data->set.headers;
break;
}
-#else
- (void)is_connect;
- h[0] = data->set.headers;
-#endif
+#else
+ (void)is_connect;
+ h[0] = data->set.headers;
+#endif
/* loop through one or two lists */
for(i = 0; i < numlists; i++) {
@@ -1747,7 +1747,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
/* copy the source */
semicolonp = strdup(headers->data);
if(!semicolonp) {
- Curl_dyn_free(req);
+ Curl_dyn_free(req);
return CURLE_OUT_OF_MEMORY;
}
/* put a colon where the semicolon is */
@@ -1771,16 +1771,16 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
CURLcode result = CURLE_OK;
char *compare = semicolonp ? semicolonp : headers->data;
- if(data->state.aptr.host &&
+ if(data->state.aptr.host &&
/* a Host: header was sent already, don't pass on any custom Host:
header as that will produce *two* in the same request! */
checkprefix("Host:", compare))
;
- else if(data->state.httpreq == HTTPREQ_POST_FORM &&
+ else if(data->state.httpreq == HTTPREQ_POST_FORM &&
/* this header (extended by formdata.c) is sent later */
checkprefix("Content-Type:", compare))
;
- else if(data->state.httpreq == HTTPREQ_POST_MIME &&
+ else if(data->state.httpreq == HTTPREQ_POST_MIME &&
/* this header is sent later */
checkprefix("Content-Type:", compare))
;
@@ -1789,7 +1789,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
we will force length zero then */
checkprefix("Content-Length:", compare))
;
- else if(data->state.aptr.te &&
+ else if(data->state.aptr.te &&
/* when asking for Transfer-Encoding, don't pass on a custom
Connection: */
checkprefix("Connection:", compare))
@@ -1808,7 +1808,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
!strcasecompare(data->state.first_host, conn->host.name)))
;
else {
- result = Curl_dyn_addf(req, "%s\r\n", compare);
+ result = Curl_dyn_addf(req, "%s\r\n", compare);
}
if(semicolonp)
free(semicolonp);
@@ -1825,7 +1825,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
#ifndef CURL_DISABLE_PARSEDATE
CURLcode Curl_add_timecondition(const struct connectdata *conn,
- struct dynbuf *req)
+ struct dynbuf *req)
{
struct Curl_easy *data = conn->data;
const struct tm *tm;
@@ -1884,17 +1884,17 @@ CURLcode Curl_add_timecondition(const struct connectdata *conn,
tm->tm_min,
tm->tm_sec);
- result = Curl_dyn_add(req, datestr);
+ result = Curl_dyn_add(req, datestr);
return result;
}
#else
/* disabled */
CURLcode Curl_add_timecondition(const struct connectdata *conn,
- struct dynbuf *req)
+ struct dynbuf *req)
{
(void)conn;
- (void)req;
+ (void)req;
return CURLE_OK;
}
#endif
@@ -1917,13 +1917,13 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
const char *te = ""; /* transfer-encoding */
const char *ptr;
const char *request;
- Curl_HttpReq httpreq = data->state.httpreq;
+ Curl_HttpReq httpreq = data->state.httpreq;
#if !defined(CURL_DISABLE_COOKIES)
char *addcookies = NULL;
#endif
curl_off_t included_body = 0;
const char *httpstring;
- struct dynbuf req;
+ struct dynbuf req;
curl_off_t postsize = 0; /* curl_off_t to handle large file sizes */
char *altused = NULL;
@@ -1951,14 +1951,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
#ifdef USE_NGHTTP2
if(conn->data->set.httpversion ==
CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) {
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
/* We don't support HTTP/2 proxies yet. Also it's debatable
whether or not this setting should apply to HTTP/2 proxies. */
infof(data, "Ignoring HTTP/2 prior knowledge due to proxy\n");
break;
}
-#endif
+#endif
DEBUGF(infof(data, "HTTP/2 over clean TCP\n"));
conn->httpversion = 20;
@@ -1977,7 +1977,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
return result;
}
}
- http = data->req.p.http;
+ http = data->req.p.http;
DEBUGASSERT(http);
if(!data->state.this_is_a_follow) {
@@ -2029,8 +2029,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
with the user-agent string specified, we erase the previously made string
here. */
if(Curl_checkheaders(conn, "User-Agent")) {
- free(data->state.aptr.uagent);
- data->state.aptr.uagent = NULL;
+ free(data->state.aptr.uagent);
+ data->state.aptr.uagent = NULL;
}
/* setup the authentication headers */
@@ -2058,14 +2058,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
else
conn->bits.authneg = FALSE;
- Curl_safefree(data->state.aptr.ref);
+ Curl_safefree(data->state.aptr.ref);
if(data->change.referer && !Curl_checkheaders(conn, "Referer")) {
- data->state.aptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
- if(!data->state.aptr.ref)
+ data->state.aptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
+ if(!data->state.aptr.ref)
return CURLE_OUT_OF_MEMORY;
}
else
- data->state.aptr.ref = NULL;
+ data->state.aptr.ref = NULL;
#if !defined(CURL_DISABLE_COOKIES)
if(data->set.str[STRING_COOKIE] && !Curl_checkheaders(conn, "Cookie"))
@@ -2074,15 +2074,15 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(!Curl_checkheaders(conn, "Accept-Encoding") &&
data->set.str[STRING_ENCODING]) {
- Curl_safefree(data->state.aptr.accept_encoding);
- data->state.aptr.accept_encoding =
+ Curl_safefree(data->state.aptr.accept_encoding);
+ data->state.aptr.accept_encoding =
aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]);
- if(!data->state.aptr.accept_encoding)
+ if(!data->state.aptr.accept_encoding)
return CURLE_OUT_OF_MEMORY;
}
else {
- Curl_safefree(data->state.aptr.accept_encoding);
- data->state.aptr.accept_encoding = NULL;
+ Curl_safefree(data->state.aptr.accept_encoding);
+ data->state.aptr.accept_encoding = NULL;
}
#ifdef HAVE_LIBZ
@@ -2098,7 +2098,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
char *cptr = Curl_checkheaders(conn, "Connection");
#define TE_HEADER "TE: gzip\r\n"
- Curl_safefree(data->state.aptr.te);
+ Curl_safefree(data->state.aptr.te);
if(cptr) {
cptr = Curl_copy_header_value(cptr);
@@ -2107,11 +2107,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
/* Create the (updated) Connection: header */
- data->state.aptr.te = aprintf("Connection: %s%sTE\r\n" TE_HEADER,
+ data->state.aptr.te = aprintf("Connection: %s%sTE\r\n" TE_HEADER,
cptr ? cptr : "", (cptr && *cptr) ? ", ":"");
free(cptr);
- if(!data->state.aptr.te)
+ if(!data->state.aptr.te)
return CURLE_OUT_OF_MEMORY;
}
#endif
@@ -2194,7 +2194,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
te = "Transfer-Encoding: chunked\r\n";
}
- Curl_safefree(data->state.aptr.host);
+ Curl_safefree(data->state.aptr.host);
ptr = Curl_checkheaders(conn, "Host");
if(ptr && (!data->state.this_is_a_follow ||
@@ -2229,19 +2229,19 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(colon)
*colon = 0; /* The host must not include an embedded port number */
}
- Curl_safefree(data->state.aptr.cookiehost);
- data->state.aptr.cookiehost = cookiehost;
+ Curl_safefree(data->state.aptr.cookiehost);
+ data->state.aptr.cookiehost = cookiehost;
}
#endif
if(strcmp("Host:", ptr)) {
- data->state.aptr.host = aprintf("Host:%s\r\n", &ptr[5]);
- if(!data->state.aptr.host)
+ data->state.aptr.host = aprintf("Host:%s\r\n", &ptr[5]);
+ if(!data->state.aptr.host)
return CURLE_OUT_OF_MEMORY;
}
else
/* when clearing the header */
- data->state.aptr.host = NULL;
+ data->state.aptr.host = NULL;
}
else {
/* When building Host: headers, we must put the host name within
@@ -2253,18 +2253,18 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
(conn->remote_port == PORT_HTTP)) )
/* if(HTTPS on port 443) OR (HTTP on port 80) then don't include
the port number in the host string */
- data->state.aptr.host = aprintf("Host: %s%s%s\r\n",
+ data->state.aptr.host = aprintf("Host: %s%s%s\r\n",
conn->bits.ipv6_ip?"[":"",
host,
conn->bits.ipv6_ip?"]":"");
else
- data->state.aptr.host = aprintf("Host: %s%s%s:%d\r\n",
+ data->state.aptr.host = aprintf("Host: %s%s%s:%d\r\n",
conn->bits.ipv6_ip?"[":"",
host,
conn->bits.ipv6_ip?"]":"",
conn->remote_port);
- if(!data->state.aptr.host)
+ if(!data->state.aptr.host)
/* without Host: we can't make a nice request */
return CURLE_OUT_OF_MEMORY;
}
@@ -2309,7 +2309,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
return CURLE_OUT_OF_MEMORY;
}
}
- /* Extract the URL to use in the request. Store in STRING_TEMP_URL for
+ /* Extract the URL to use in the request. Store in STRING_TEMP_URL for
clean-up reasons if the function returns before the free() further
down. */
uc = curl_url_get(h, CURLUPART_URL, &data->set.str[STRING_TEMP_URL], 0);
@@ -2345,7 +2345,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
data->set.prefer_ascii ? 'a' : 'i');
}
}
- if(conn->bits.user_passwd)
+ if(conn->bits.user_passwd)
paste_ftp_userpwd = TRUE;
}
}
@@ -2435,21 +2435,21 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) &&
!Curl_checkheaders(conn, "Range")) {
/* if a line like this was already allocated, free the previous one */
- free(data->state.aptr.rangeline);
- data->state.aptr.rangeline = aprintf("Range: bytes=%s\r\n",
+ free(data->state.aptr.rangeline);
+ data->state.aptr.rangeline = aprintf("Range: bytes=%s\r\n",
data->state.range);
}
else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) &&
!Curl_checkheaders(conn, "Content-Range")) {
/* if a line like this was already allocated, free the previous one */
- free(data->state.aptr.rangeline);
+ free(data->state.aptr.rangeline);
if(data->set.set_resume_from < 0) {
/* Upload resume was asked for, but we don't know the size of the
remote part so we tell the server (and act accordingly) that we
upload the whole file (again) */
- data->state.aptr.rangeline =
+ data->state.aptr.rangeline =
aprintf("Content-Range: bytes 0-%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
data->state.infilesize - 1, data->state.infilesize);
@@ -2459,7 +2459,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* This is because "resume" was selected */
curl_off_t total_expected_size =
data->state.resume_from + data->state.infilesize;
- data->state.aptr.rangeline =
+ data->state.aptr.rangeline =
aprintf("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
data->state.range, total_expected_size-1,
@@ -2468,11 +2468,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
else {
/* Range was selected and then we just pass the incoming range and
append total size */
- data->state.aptr.rangeline =
+ data->state.aptr.rangeline =
aprintf("Content-Range: bytes %s/%" CURL_FORMAT_CURL_OFF_T "\r\n",
data->state.range, data->state.infilesize);
}
- if(!data->state.aptr.rangeline)
+ if(!data->state.aptr.rangeline)
return CURLE_OUT_OF_MEMORY;
}
}
@@ -2480,11 +2480,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
httpstring = get_http_string(data, conn);
/* initialize a dynamic send-buffer */
- Curl_dyn_init(&req, DYN_HTTP_REQUEST);
+ Curl_dyn_init(&req, DYN_HTTP_REQUEST);
/* add the main request stuff */
/* GET/HEAD/POST/PUT */
- result = Curl_dyn_addf(&req, "%s ", request);
+ result = Curl_dyn_addf(&req, "%s ", request);
if(result)
return result;
@@ -2497,87 +2497,87 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* url */
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
char *url = data->set.str[STRING_TEMP_URL];
- result = Curl_dyn_add(&req, url);
+ result = Curl_dyn_add(&req, url);
Curl_safefree(data->set.str[STRING_TEMP_URL]);
}
else
#endif
if(paste_ftp_userpwd)
- result = Curl_dyn_addf(&req, "ftp://%s:%s@%s", conn->user, conn->passwd,
- path + sizeof("ftp://") - 1);
+ result = Curl_dyn_addf(&req, "ftp://%s:%s@%s", conn->user, conn->passwd,
+ path + sizeof("ftp://") - 1);
else {
- result = Curl_dyn_add(&req, path);
+ result = Curl_dyn_add(&req, path);
if(result)
return result;
if(query)
- result = Curl_dyn_addf(&req, "?%s", query);
+ result = Curl_dyn_addf(&req, "?%s", query);
}
if(result)
return result;
-#ifndef CURL_DISABLE_ALTSVC
+#ifndef CURL_DISABLE_ALTSVC
if(conn->bits.altused && !Curl_checkheaders(conn, "Alt-Used")) {
altused = aprintf("Alt-Used: %s:%d\r\n",
conn->conn_to_host.name, conn->conn_to_port);
- if(!altused) {
- Curl_dyn_free(&req);
+ if(!altused) {
+ Curl_dyn_free(&req);
return CURLE_OUT_OF_MEMORY;
- }
+ }
}
#endif
result =
- Curl_dyn_addf(&req,
- "%s" /* ftp typecode (;type=x) */
- " HTTP/%s\r\n" /* HTTP version */
- "%s" /* host */
- "%s" /* proxyuserpwd */
- "%s" /* userpwd */
- "%s" /* range */
- "%s" /* user agent */
- "%s" /* accept */
- "%s" /* TE: */
- "%s" /* accept-encoding */
- "%s" /* referer */
- "%s" /* Proxy-Connection */
- "%s" /* transfer-encoding */
- "%s",/* Alt-Used */
-
- ftp_typecode,
- httpstring,
- (data->state.aptr.host?data->state.aptr.host:""),
- data->state.aptr.proxyuserpwd?
- data->state.aptr.proxyuserpwd:"",
- data->state.aptr.userpwd?data->state.aptr.userpwd:"",
- (data->state.use_range && data->state.aptr.rangeline)?
- data->state.aptr.rangeline:"",
- (data->set.str[STRING_USERAGENT] &&
- *data->set.str[STRING_USERAGENT] &&
- data->state.aptr.uagent)?
- data->state.aptr.uagent:"",
- http->p_accept?http->p_accept:"",
- data->state.aptr.te?data->state.aptr.te:"",
- (data->set.str[STRING_ENCODING] &&
- *data->set.str[STRING_ENCODING] &&
- data->state.aptr.accept_encoding)?
- data->state.aptr.accept_encoding:"",
- (data->change.referer && data->state.aptr.ref)?
- data->state.aptr.ref:"" /* Referer: <data> */,
-#ifndef CURL_DISABLE_PROXY
- (conn->bits.httpproxy &&
- !conn->bits.tunnel_proxy &&
- !Curl_checkProxyheaders(conn, "Proxy-Connection"))?
- "Proxy-Connection: Keep-Alive\r\n":"",
-#else
- "",
-#endif
- te,
- altused ? altused : ""
+ Curl_dyn_addf(&req,
+ "%s" /* ftp typecode (;type=x) */
+ " HTTP/%s\r\n" /* HTTP version */
+ "%s" /* host */
+ "%s" /* proxyuserpwd */
+ "%s" /* userpwd */
+ "%s" /* range */
+ "%s" /* user agent */
+ "%s" /* accept */
+ "%s" /* TE: */
+ "%s" /* accept-encoding */
+ "%s" /* referer */
+ "%s" /* Proxy-Connection */
+ "%s" /* transfer-encoding */
+ "%s",/* Alt-Used */
+
+ ftp_typecode,
+ httpstring,
+ (data->state.aptr.host?data->state.aptr.host:""),
+ data->state.aptr.proxyuserpwd?
+ data->state.aptr.proxyuserpwd:"",
+ data->state.aptr.userpwd?data->state.aptr.userpwd:"",
+ (data->state.use_range && data->state.aptr.rangeline)?
+ data->state.aptr.rangeline:"",
+ (data->set.str[STRING_USERAGENT] &&
+ *data->set.str[STRING_USERAGENT] &&
+ data->state.aptr.uagent)?
+ data->state.aptr.uagent:"",
+ http->p_accept?http->p_accept:"",
+ data->state.aptr.te?data->state.aptr.te:"",
+ (data->set.str[STRING_ENCODING] &&
+ *data->set.str[STRING_ENCODING] &&
+ data->state.aptr.accept_encoding)?
+ data->state.aptr.accept_encoding:"",
+ (data->change.referer && data->state.aptr.ref)?
+ data->state.aptr.ref:"" /* Referer: <data> */,
+#ifndef CURL_DISABLE_PROXY
+ (conn->bits.httpproxy &&
+ !conn->bits.tunnel_proxy &&
+ !Curl_checkProxyheaders(conn, "Proxy-Connection"))?
+ "Proxy-Connection: Keep-Alive\r\n":"",
+#else
+ "",
+#endif
+ te,
+ altused ? altused : ""
);
/* clear userpwd and proxyuserpwd to avoid re-using old credentials
* from re-used connections */
- Curl_safefree(data->state.aptr.userpwd);
- Curl_safefree(data->state.aptr.proxyuserpwd);
+ Curl_safefree(data->state.aptr.userpwd);
+ Curl_safefree(data->state.aptr.proxyuserpwd);
free(altused);
if(result)
@@ -2588,7 +2588,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
(data->set.httpversion == CURL_HTTP_VERSION_2)) {
/* append HTTP2 upgrade magic stuff to the HTTP request if it isn't done
over SSL */
- result = Curl_http2_request_upgrade(&req, conn);
+ result = Curl_http2_request_upgrade(&req, conn);
if(result)
return result;
}
@@ -2598,11 +2598,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
struct Cookie *co = NULL; /* no cookies from start */
int count = 0;
- if(data->cookies && data->state.cookie_engine) {
+ if(data->cookies && data->state.cookie_engine) {
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
co = Curl_cookie_getlist(data->cookies,
- data->state.aptr.cookiehost?
- data->state.aptr.cookiehost:host,
+ data->state.aptr.cookiehost?
+ data->state.aptr.cookiehost:host,
data->state.up.path,
(conn->handler->protocol&CURLPROTO_HTTPS)?
TRUE:FALSE);
@@ -2614,12 +2614,12 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
while(co) {
if(co->value) {
if(0 == count) {
- result = Curl_dyn_add(&req, "Cookie: ");
+ result = Curl_dyn_add(&req, "Cookie: ");
if(result)
break;
}
- result = Curl_dyn_addf(&req, "%s%s=%s", count?"; ":"",
- co->name, co->value);
+ result = Curl_dyn_addf(&req, "%s%s=%s", count?"; ":"",
+ co->name, co->value);
if(result)
break;
count++;
@@ -2630,25 +2630,25 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
if(addcookies && !result) {
if(!count)
- result = Curl_dyn_add(&req, "Cookie: ");
+ result = Curl_dyn_add(&req, "Cookie: ");
if(!result) {
- result = Curl_dyn_addf(&req, "%s%s", count?"; ":"", addcookies);
+ result = Curl_dyn_addf(&req, "%s%s", count?"; ":"", addcookies);
count++;
}
}
if(count && !result)
- result = Curl_dyn_add(&req, "\r\n");
+ result = Curl_dyn_add(&req, "\r\n");
if(result)
return result;
}
#endif
- result = Curl_add_timecondition(conn, &req);
+ result = Curl_add_timecondition(conn, &req);
if(result)
return result;
- result = Curl_add_custom_headers(conn, FALSE, &req);
+ result = Curl_add_custom_headers(conn, FALSE, &req);
if(result)
return result;
@@ -2671,20 +2671,20 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if((postsize != -1) && !data->req.upload_chunky &&
(conn->bits.authneg || !Curl_checkheaders(conn, "Content-Length"))) {
/* only add Content-Length if not uploading chunked */
- result = Curl_dyn_addf(&req, "Content-Length: %" CURL_FORMAT_CURL_OFF_T
- "\r\n", postsize);
+ result = Curl_dyn_addf(&req, "Content-Length: %" CURL_FORMAT_CURL_OFF_T
+ "\r\n", postsize);
if(result)
return result;
}
if(postsize != 0) {
- result = expect100(data, conn, &req);
+ result = expect100(data, conn, &req);
if(result)
return result;
}
- /* end of headers */
- result = Curl_dyn_add(&req, "\r\n");
+ /* end of headers */
+ result = Curl_dyn_add(&req, "\r\n");
if(result)
return result;
@@ -2692,8 +2692,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
Curl_pgrsSetUploadSize(data, postsize);
/* this sends the buffer and frees all the buffer resources */
- result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
- FIRSTSOCKET);
+ result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
+ FIRSTSOCKET);
if(result)
failf(data, "Failed sending PUT request");
else
@@ -2709,12 +2709,12 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* This is form posting using mime data. */
if(conn->bits.authneg) {
/* nothing to post! */
- result = Curl_dyn_add(&req, "Content-Length: 0\r\n\r\n");
+ result = Curl_dyn_add(&req, "Content-Length: 0\r\n\r\n");
if(result)
return result;
- result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
- FIRSTSOCKET);
+ result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
+ FIRSTSOCKET);
if(result)
failf(data, "Failed sending POST request");
else
@@ -2732,9 +2732,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
(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_dyn_addf(&req,
- "Content-Length: %" CURL_FORMAT_CURL_OFF_T
- "\r\n", postsize);
+ result = Curl_dyn_addf(&req,
+ "Content-Length: %" CURL_FORMAT_CURL_OFF_T
+ "\r\n", postsize);
if(result)
return result;
}
@@ -2745,7 +2745,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
struct curl_slist *hdr;
for(hdr = http->sendit->curlheaders; hdr; hdr = hdr->next) {
- result = Curl_dyn_addf(&req, "%s\r\n", hdr->data);
+ result = Curl_dyn_addf(&req, "%s\r\n", hdr->data);
if(result)
return result;
}
@@ -2762,7 +2762,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
Curl_compareheader(ptr, "Expect:", "100-continue");
}
else if(postsize > EXPECT_100_THRESHOLD || postsize < 0) {
- result = expect100(data, conn, &req);
+ result = expect100(data, conn, &req);
if(result)
return result;
}
@@ -2770,7 +2770,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
data->state.expect100header = FALSE;
/* make the request end in a true CRLF */
- result = Curl_dyn_add(&req, "\r\n");
+ result = Curl_dyn_add(&req, "\r\n");
if(result)
return result;
@@ -2783,8 +2783,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
http->sending = HTTPSEND_BODY;
/* this sends the buffer and frees all the buffer resources */
- result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
- FIRSTSOCKET);
+ result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
+ FIRSTSOCKET);
if(result)
failf(data, "Failed sending POST request");
else
@@ -2812,15 +2812,15 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
(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_dyn_addf(&req, "Content-Length: %" CURL_FORMAT_CURL_OFF_T
- "\r\n", postsize);
+ result = Curl_dyn_addf(&req, "Content-Length: %" CURL_FORMAT_CURL_OFF_T
+ "\r\n", postsize);
if(result)
return result;
}
if(!Curl_checkheaders(conn, "Content-Type")) {
- result = Curl_dyn_add(&req, "Content-Type: application/"
- "x-www-form-urlencoded\r\n");
+ result = Curl_dyn_add(&req, "Content-Type: application/"
+ "x-www-form-urlencoded\r\n");
if(result)
return result;
}
@@ -2835,7 +2835,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
Curl_compareheader(ptr, "Expect:", "100-continue");
}
else if(postsize > EXPECT_100_THRESHOLD || postsize < 0) {
- result = expect100(data, conn, &req);
+ result = expect100(data, conn, &req);
if(result)
return result;
}
@@ -2856,38 +2856,38 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
is no magic limit but only set to prevent really huge POSTs to
get the data duplicated with malloc() and family. */
- /* end of headers! */
- result = Curl_dyn_add(&req, "\r\n");
+ /* end of headers! */
+ result = Curl_dyn_add(&req, "\r\n");
if(result)
return result;
if(!data->req.upload_chunky) {
/* We're not sending it 'chunked', append it to the request
already now to reduce the number if send() calls */
- result = Curl_dyn_addn(&req, data->set.postfields,
- (size_t)postsize);
+ result = Curl_dyn_addn(&req, data->set.postfields,
+ (size_t)postsize);
included_body = postsize;
}
else {
if(postsize) {
- char chunk[16];
+ char chunk[16];
/* Append the POST data chunky-style */
- msnprintf(chunk, sizeof(chunk), "%x\r\n", (int)postsize);
- result = Curl_dyn_add(&req, chunk);
+ msnprintf(chunk, sizeof(chunk), "%x\r\n", (int)postsize);
+ result = Curl_dyn_add(&req, chunk);
if(!result) {
- included_body = postsize + strlen(chunk);
- result = Curl_dyn_addn(&req, data->set.postfields,
- (size_t)postsize);
+ included_body = postsize + strlen(chunk);
+ result = Curl_dyn_addn(&req, data->set.postfields,
+ (size_t)postsize);
if(!result)
- result = Curl_dyn_add(&req, "\r\n");
- included_body += 2;
+ result = Curl_dyn_add(&req, "\r\n");
+ included_body += 2;
}
}
- if(!result) {
- result = Curl_dyn_add(&req, "\x30\x0d\x0a\x0d\x0a");
- /* 0 CR LF CR LF */
- included_body += 5;
- }
+ if(!result) {
+ result = Curl_dyn_add(&req, "\x30\x0d\x0a\x0d\x0a");
+ /* 0 CR LF CR LF */
+ included_body += 5;
+ }
}
if(result)
return result;
@@ -2907,22 +2907,22 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* set the upload size to the progress meter */
Curl_pgrsSetUploadSize(data, http->postsize);
- /* end of headers! */
- result = Curl_dyn_add(&req, "\r\n");
+ /* end of headers! */
+ result = Curl_dyn_add(&req, "\r\n");
if(result)
return result;
}
}
else {
- /* end of headers! */
- result = Curl_dyn_add(&req, "\r\n");
+ /* end of headers! */
+ result = Curl_dyn_add(&req, "\r\n");
if(result)
return result;
if(data->req.upload_chunky && conn->bits.authneg) {
/* Chunky upload is selected and we're negotiating auth still, send
end-of-data only */
- result = Curl_dyn_add(&req, (char *)"\x30\x0d\x0a\x0d\x0a");
+ result = Curl_dyn_add(&req, (char *)"\x30\x0d\x0a\x0d\x0a");
/* 0 CR LF CR LF */
if(result)
return result;
@@ -2942,8 +2942,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
}
/* issue the request */
- result = Curl_buffer_send(&req, conn, &data->info.request_size,
- (size_t)included_body, FIRSTSOCKET);
+ result = Curl_buffer_send(&req, conn, &data->info.request_size,
+ (size_t)included_body, FIRSTSOCKET);
if(result)
failf(data, "Failed sending HTTP POST request");
@@ -2953,24 +2953,24 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
break;
default:
- result = Curl_dyn_add(&req, "\r\n");
+ result = Curl_dyn_add(&req, "\r\n");
if(result)
return result;
/* issue the request */
- result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
- FIRSTSOCKET);
+ result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
+ FIRSTSOCKET);
if(result)
failf(data, "Failed sending HTTP request");
else
/* HTTP GET/HEAD download: */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1);
+ Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1);
}
if(result)
return result;
- if(!postsize && (http->sending != HTTPSEND_REQUEST))
- data->req.upload_done = TRUE;
+ if(!postsize && (http->sending != HTTPSEND_REQUEST))
+ data->req.upload_done = TRUE;
if(data->req.writebytecount) {
/* if a request-body has been sent off, we make sure this progress is noted
@@ -3107,7 +3107,7 @@ checkprotoprefix(struct Curl_easy *data, struct connectdata *conn,
static void print_http_error(struct Curl_easy *data)
{
struct SingleRequest *k = &data->req;
- char *beg = Curl_dyn_ptr(&data->state.headerb);
+ char *beg = Curl_dyn_ptr(&data->state.headerb);
/* make sure that data->req.p points to the HTTP status line */
if(!strncmp(beg, "HTTP", 4)) {
@@ -3145,17 +3145,17 @@ static void print_http_error(struct Curl_easy *data)
* Read any HTTP header lines from the server and pass them to the client app.
*/
CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
- struct connectdata *conn,
- ssize_t *nread,
- bool *stop_reading)
+ struct connectdata *conn,
+ ssize_t *nread,
+ bool *stop_reading)
{
CURLcode result;
struct SingleRequest *k = &data->req;
ssize_t onread = *nread;
char *ostr = k->str;
- char *headp;
- char *str_start;
- char *end_ptr;
+ char *headp;
+ char *str_start;
+ char *end_ptr;
/* header line within buffer loop */
do {
@@ -3164,25 +3164,25 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
int writetype;
/* str_start is start of line within buf */
- str_start = k->str;
+ str_start = k->str;
/* data is in network encoding so use 0x0a instead of '\n' */
- end_ptr = memchr(str_start, 0x0a, *nread);
+ end_ptr = memchr(str_start, 0x0a, *nread);
- if(!end_ptr) {
+ if(!end_ptr) {
/* Not a complete header line within buffer, append the data to
the end of the headerbuff. */
- result = Curl_dyn_addn(&data->state.headerb, str_start, *nread);
+ result = Curl_dyn_addn(&data->state.headerb, str_start, *nread);
if(result)
return result;
if(!k->headerline) {
/* check if this looks like a protocol header */
- statusline st =
- checkprotoprefix(data, conn,
- Curl_dyn_ptr(&data->state.headerb),
- Curl_dyn_len(&data->state.headerb));
-
+ statusline st =
+ checkprotoprefix(data, conn,
+ Curl_dyn_ptr(&data->state.headerb),
+ Curl_dyn_len(&data->state.headerb));
+
if(st == STATUS_BAD) {
/* this is not the beginning of a protocol first header line */
k->header = FALSE;
@@ -3200,26 +3200,26 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
/* decrease the size of the remaining (supposed) header line */
- rest_length = (end_ptr - k->str) + 1;
+ rest_length = (end_ptr - k->str) + 1;
*nread -= (ssize_t)rest_length;
- k->str = end_ptr + 1; /* move past new line */
+ k->str = end_ptr + 1; /* move past new line */
- full_length = k->str - str_start;
+ full_length = k->str - str_start;
- result = Curl_dyn_addn(&data->state.headerb, str_start, full_length);
+ result = Curl_dyn_addn(&data->state.headerb, str_start, full_length);
if(result)
return result;
/****
- * We now have a FULL header line in 'headerb'.
+ * We now have a FULL header line in 'headerb'.
*****/
if(!k->headerline) {
/* the first read header */
- statusline st = checkprotoprefix(data, conn,
- Curl_dyn_ptr(&data->state.headerb),
- Curl_dyn_len(&data->state.headerb));
+ statusline st = checkprotoprefix(data, conn,
+ Curl_dyn_ptr(&data->state.headerb),
+ Curl_dyn_len(&data->state.headerb));
if(st == STATUS_BAD) {
streamclose(conn, "bad HTTP: No end-of-message indicator");
/* this is not the beginning of a protocol first header line */
@@ -3242,27 +3242,27 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
}
- /* headers are in network encoding so use 0x0a and 0x0d instead of '\n'
- and '\r' */
- headp = Curl_dyn_ptr(&data->state.headerb);
- if((0x0a == *headp) || (0x0d == *headp)) {
+ /* headers are in network encoding so use 0x0a and 0x0d instead of '\n'
+ and '\r' */
+ headp = Curl_dyn_ptr(&data->state.headerb);
+ if((0x0a == *headp) || (0x0d == *headp)) {
size_t headerlen;
/* Zero-length header line means end of headers! */
#ifdef CURL_DOES_CONVERSIONS
- if(0x0d == *headp) {
- *headp = '\r'; /* replace with CR in host encoding */
- headp++; /* pass the CR byte */
+ if(0x0d == *headp) {
+ *headp = '\r'; /* replace with CR in host encoding */
+ headp++; /* pass the CR byte */
}
- if(0x0a == *headp) {
- *headp = '\n'; /* replace with LF in host encoding */
- headp++; /* pass the LF byte */
+ if(0x0a == *headp) {
+ *headp = '\n'; /* replace with LF in host encoding */
+ headp++; /* pass the LF byte */
}
#else
- if('\r' == *headp)
- headp++; /* pass the \r byte */
- if('\n' == *headp)
- headp++; /* pass the \n byte */
+ if('\r' == *headp)
+ headp++; /* pass the \r byte */
+ if('\n' == *headp)
+ headp++; /* pass the \n byte */
#endif /* CURL_DOES_CONVERSIONS */
if(100 <= k->httpcode && 199 >= k->httpcode) {
@@ -3323,7 +3323,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
if((k->size == -1) && !k->chunk && !conn->bits.close &&
(conn->httpversion == 11) &&
!(conn->handler->protocol & CURLPROTO_RTSP) &&
- data->state.httpreq != HTTPREQ_HEAD) {
+ data->state.httpreq != HTTPREQ_HEAD) {
/* On HTTP 1.1, when connection is not to get closed, but no
Content-Length nor Transfer-Encoding chunked have been
received, according to RFC2616 section 4.4 point 5, we
@@ -3381,9 +3381,9 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
if(data->set.include_header)
writetype |= CLIENTWRITE_BODY;
- headerlen = Curl_dyn_len(&data->state.headerb);
+ headerlen = Curl_dyn_len(&data->state.headerb);
result = Curl_client_write(conn, writetype,
- Curl_dyn_ptr(&data->state.headerb),
+ Curl_dyn_ptr(&data->state.headerb),
headerlen);
if(result)
return result;
@@ -3418,7 +3418,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* continue sending even if it gets discarded
*/
- switch(data->state.httpreq) {
+ switch(data->state.httpreq) {
case HTTPREQ_PUT:
case HTTPREQ_POST:
case HTTPREQ_POST_FORM:
@@ -3429,16 +3429,16 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
*/
Curl_expire_done(data, EXPIRE_100_TIMEOUT);
if(!k->upload_done) {
- if((k->httpcode == 417) && data->state.expect100header) {
- /* 417 Expectation Failed - try again without the Expect
- header */
- infof(data, "Got 417 while waiting for a 100\n");
- data->state.disableexpect = TRUE;
- DEBUGASSERT(!data->req.newurl);
- data->req.newurl = strdup(conn->data->change.url);
- Curl_done_sending(conn, k);
- }
- else if(data->set.http_keep_sending_on_error) {
+ if((k->httpcode == 417) && data->state.expect100header) {
+ /* 417 Expectation Failed - try again without the Expect
+ header */
+ infof(data, "Got 417 while waiting for a 100\n");
+ data->state.disableexpect = TRUE;
+ DEBUGASSERT(!data->req.newurl);
+ data->req.newurl = strdup(conn->data->change.url);
+ Curl_done_sending(conn, k);
+ }
+ else if(data->set.http_keep_sending_on_error) {
infof(data, "HTTP error before end of send, keep sending\n");
if(k->exp100 > EXP100_SEND_DATA) {
k->exp100 = EXP100_SEND_DATA;
@@ -3534,12 +3534,12 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
k->keepon &= ~KEEP_RECV;
}
- Curl_debug(data, CURLINFO_HEADER_IN, str_start, headerlen);
- break; /* exit header line loop */
+ Curl_debug(data, CURLINFO_HEADER_IN, str_start, headerlen);
+ break; /* exit header line loop */
}
- /* We continue reading headers, reset the line-based header */
- Curl_dyn_reset(&data->state.headerb);
+ /* We continue reading headers, reset the line-based header */
+ Curl_dyn_reset(&data->state.headerb);
continue;
}
@@ -3558,11 +3558,11 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
#define SCRATCHSIZE 21
CURLcode res;
char scratch[SCRATCHSIZE + 1]; /* "HTTP/major.minor 123" */
- /* We can't really convert this yet because we don't know if it's the
- 1st header line or the body. So we do a partial conversion into a
- scratch area, leaving the data at 'headp' as-is.
+ /* We can't really convert this yet because we don't know if it's the
+ 1st header line or the body. So we do a partial conversion into a
+ scratch area, leaving the data at 'headp' as-is.
*/
- strncpy(&scratch[0], headp, SCRATCHSIZE);
+ strncpy(&scratch[0], headp, SCRATCHSIZE);
scratch[SCRATCHSIZE] = 0; /* null terminate */
res = Curl_convert_from_network(data,
&scratch[0],
@@ -3571,7 +3571,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
/* Curl_convert_from_network calls failf if unsuccessful */
return res;
#else
-#define HEADER1 headp /* no conversion needed, just use headp */
+#define HEADER1 headp /* no conversion needed, just use headp */
#endif /* CURL_DOES_CONVERSIONS */
if(conn->handler->protocol & PROTO_FAMILY_HTTP) {
@@ -3622,11 +3622,11 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
compare header line against list of aliases
*/
if(!nc) {
- statusline check =
- checkhttpprefix(data,
- Curl_dyn_ptr(&data->state.headerb),
- Curl_dyn_len(&data->state.headerb));
- if(check == STATUS_DONE) {
+ statusline check =
+ checkhttpprefix(data,
+ Curl_dyn_ptr(&data->state.headerb),
+ Curl_dyn_len(&data->state.headerb));
+ if(check == STATUS_DONE) {
nc = 1;
k->httpcode = 200;
conn->httpversion = 10;
@@ -3672,18 +3672,18 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* depending on how authentication is working. Other codes
* are definitely errors, so give up here.
*/
- if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET &&
+ if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET &&
k->httpcode == 416) {
/* "Requested Range Not Satisfiable", just proceed and
pretend this is no error */
k->ignorebody = TRUE; /* Avoid appending error msg to good data. */
}
else if(data->set.http_fail_on_error && (k->httpcode >= 400) &&
- ((k->httpcode != 401) || !conn->bits.user_passwd)
-#ifndef CURL_DISABLE_PROXY
- && ((k->httpcode != 407) || !conn->bits.proxy_user_passwd)
-#endif
- ) {
+ ((k->httpcode != 401) || !conn->bits.user_passwd)
+#ifndef CURL_DISABLE_PROXY
+ && ((k->httpcode != 407) || !conn->bits.proxy_user_passwd)
+#endif
+ ) {
/* serious error, go home! */
print_http_error(data);
return CURLE_HTTP_RETURNED_ERROR;
@@ -3699,8 +3699,8 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
else if(conn->httpversion == 20 ||
(k->upgr101 == UPGR101_REQUESTED && k->httpcode == 101)) {
DEBUGF(infof(data, "HTTP/2 found, allow multiplexing\n"));
- /* HTTP/2 cannot avoid multiplexing since it is a core functionality
- of the protocol */
+ /* HTTP/2 cannot avoid multiplexing since it is a core functionality
+ of the protocol */
conn->bundle->multiuse = BUNDLE_MULTIPLEX;
}
else if(conn->httpversion >= 11 &&
@@ -3740,16 +3740,16 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
}
- result = Curl_convert_from_network(data, headp, strlen(headp));
+ result = Curl_convert_from_network(data, headp, strlen(headp));
/* Curl_convert_from_network calls failf if unsuccessful */
if(result)
return result;
/* Check for Content-Length: header lines to get size */
if(!k->http_bodyless &&
- !data->set.ignorecl && checkprefix("Content-Length:", headp)) {
+ !data->set.ignorecl && checkprefix("Content-Length:", headp)) {
curl_off_t contentlength;
- CURLofft offt = curlx_strtoofft(headp + 15, NULL, 10, &contentlength);
+ CURLofft offt = curlx_strtoofft(headp + 15, NULL, 10, &contentlength);
if(offt == CURL_OFFT_OK) {
if(data->set.max_filesize &&
@@ -3780,8 +3780,8 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
}
/* check for Content-Type: header lines to get the MIME-type */
- else if(checkprefix("Content-Type:", headp)) {
- char *contenttype = Curl_copy_header_value(headp);
+ else if(checkprefix("Content-Type:", headp)) {
+ char *contenttype = Curl_copy_header_value(headp);
if(!contenttype)
return CURLE_OUT_OF_MEMORY;
if(!*contenttype)
@@ -3792,10 +3792,10 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
data->info.contenttype = contenttype;
}
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
else if((conn->httpversion == 10) &&
conn->bits.httpproxy &&
- Curl_compareheader(headp, "Proxy-Connection:", "keep-alive")) {
+ Curl_compareheader(headp, "Proxy-Connection:", "keep-alive")) {
/*
* When a HTTP/1.0 reply comes when using a proxy, the
* 'Proxy-Connection: keep-alive' line tells us the
@@ -3807,7 +3807,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
else if((conn->httpversion == 11) &&
conn->bits.httpproxy &&
- Curl_compareheader(headp, "Proxy-Connection:", "close")) {
+ Curl_compareheader(headp, "Proxy-Connection:", "close")) {
/*
* We get a HTTP/1.1 response from a proxy and it says it'll
* close down after this transfer.
@@ -3815,9 +3815,9 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
connclose(conn, "Proxy-Connection: asked to close after done");
infof(data, "HTTP/1.1 proxy connection set close!\n");
}
-#endif
+#endif
else if((conn->httpversion == 10) &&
- Curl_compareheader(headp, "Connection:", "keep-alive")) {
+ Curl_compareheader(headp, "Connection:", "keep-alive")) {
/*
* A HTTP/1.0 reply with the 'Connection: keep-alive' line
* tells us the connection will be kept alive for our
@@ -3827,7 +3827,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
connkeep(conn, "Connection keep-alive");
infof(data, "HTTP/1.0 connection set to keep alive!\n");
}
- else if(Curl_compareheader(headp, "Connection:", "close")) {
+ else if(Curl_compareheader(headp, "Connection:", "close")) {
/*
* [RFC 2616, section 8.1.2.1]
* "Connection: close" is HTTP/1.1 language and means that
@@ -3836,7 +3836,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
*/
streamclose(conn, "Connection: close used");
}
- else if(!k->http_bodyless && checkprefix("Transfer-Encoding:", headp)) {
+ else if(!k->http_bodyless && checkprefix("Transfer-Encoding:", headp)) {
/* One or more encodings. We check for chunked and/or a compression
algorithm. */
/*
@@ -3848,11 +3848,11 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* of chunks, and a chunk-data set to zero signals the
* end-of-chunks. */
- result = Curl_build_unencoding_stack(conn, headp + 18, TRUE);
+ result = Curl_build_unencoding_stack(conn, headp + 18, TRUE);
if(result)
return result;
}
- else if(!k->http_bodyless && checkprefix("Content-Encoding:", headp) &&
+ else if(!k->http_bodyless && checkprefix("Content-Encoding:", headp) &&
data->set.str[STRING_ENCODING]) {
/*
* Process Content-Encoding. Look for the values: identity,
@@ -3861,24 +3861,24 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* 2616). zlib cannot handle compress. However, errors are
* handled further down when the response body is processed
*/
- result = Curl_build_unencoding_stack(conn, headp + 17, FALSE);
+ result = Curl_build_unencoding_stack(conn, headp + 17, FALSE);
if(result)
return result;
}
- else if(checkprefix("Retry-After:", headp)) {
+ else if(checkprefix("Retry-After:", headp)) {
/* Retry-After = HTTP-date / delay-seconds */
curl_off_t retry_after = 0; /* zero for unknown or "now" */
- time_t date = Curl_getdate_capped(&headp[12]);
+ time_t date = Curl_getdate_capped(&headp[12]);
if(-1 == date) {
/* not a date, try it as a decimal number */
- (void)curlx_strtoofft(&headp[12], NULL, 10, &retry_after);
+ (void)curlx_strtoofft(&headp[12], NULL, 10, &retry_after);
}
else
/* convert date to number of seconds into the future */
retry_after = date - time(NULL);
data->info.retry_after = retry_after; /* store it */
}
- else if(!k->http_bodyless && checkprefix("Content-Range:", headp)) {
+ else if(!k->http_bodyless && checkprefix("Content-Range:", headp)) {
/* Content-Range: bytes [num]-
Content-Range: bytes: [num]-
Content-Range: [num]-
@@ -3890,7 +3890,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
The forth means the requested range was unsatisfied.
*/
- char *ptr = headp + 14;
+ char *ptr = headp + 14;
/* Move forward until first digit or asterisk */
while(*ptr && !ISDIGIT(*ptr) && *ptr != '*')
@@ -3908,35 +3908,35 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
data->state.resume_from = 0; /* get everything */
}
#if !defined(CURL_DISABLE_COOKIES)
- else if(data->cookies && data->state.cookie_engine &&
- checkprefix("Set-Cookie:", headp)) {
+ else if(data->cookies && data->state.cookie_engine &&
+ checkprefix("Set-Cookie:", headp)) {
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
CURL_LOCK_ACCESS_SINGLE);
Curl_cookie_add(data,
- data->cookies, TRUE, FALSE, headp + 11,
+ data->cookies, TRUE, FALSE, headp + 11,
/* If there is a custom-set Host: name, use it
here, or else use real peer host name. */
- data->state.aptr.cookiehost?
- data->state.aptr.cookiehost:conn->host.name,
+ data->state.aptr.cookiehost?
+ data->state.aptr.cookiehost:conn->host.name,
data->state.up.path,
(conn->handler->protocol&CURLPROTO_HTTPS)?
TRUE:FALSE);
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
}
#endif
- else if(!k->http_bodyless && checkprefix("Last-Modified:", headp) &&
+ else if(!k->http_bodyless && checkprefix("Last-Modified:", headp) &&
(data->set.timecondition || data->set.get_filetime) ) {
- k->timeofdoc = Curl_getdate_capped(headp + strlen("Last-Modified:"));
+ k->timeofdoc = Curl_getdate_capped(headp + strlen("Last-Modified:"));
if(data->set.get_filetime)
data->info.filetime = k->timeofdoc;
}
- else if((checkprefix("WWW-Authenticate:", headp) &&
+ else if((checkprefix("WWW-Authenticate:", headp) &&
(401 == k->httpcode)) ||
- (checkprefix("Proxy-authenticate:", headp) &&
+ (checkprefix("Proxy-authenticate:", headp) &&
(407 == k->httpcode))) {
bool proxy = (k->httpcode == 407) ? TRUE : FALSE;
- char *auth = Curl_copy_header_value(headp);
+ char *auth = Curl_copy_header_value(headp);
if(!auth)
return CURLE_OUT_OF_MEMORY;
@@ -3947,28 +3947,28 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
if(result)
return result;
}
-#ifdef USE_SPNEGO
- else if(checkprefix("Persistent-Auth", headp)) {
+#ifdef USE_SPNEGO
+ else if(checkprefix("Persistent-Auth", headp)) {
struct negotiatedata *negdata = &conn->negotiate;
struct auth *authp = &data->state.authhost;
if(authp->picked == CURLAUTH_NEGOTIATE) {
- char *persistentauth = Curl_copy_header_value(headp);
+ char *persistentauth = Curl_copy_header_value(headp);
if(!persistentauth)
return CURLE_OUT_OF_MEMORY;
- negdata->noauthpersist = checkprefix("false", persistentauth)?
- TRUE:FALSE;
+ negdata->noauthpersist = checkprefix("false", persistentauth)?
+ TRUE:FALSE;
negdata->havenoauthpersist = TRUE;
infof(data, "Negotiate: noauthpersist -> %d, header part: %s",
negdata->noauthpersist, persistentauth);
free(persistentauth);
}
}
-#endif
+#endif
else if((k->httpcode >= 300 && k->httpcode < 400) &&
- checkprefix("Location:", headp) &&
+ checkprefix("Location:", headp) &&
!data->req.location) {
/* this is the URL that the server advises us to use instead */
- char *location = Curl_copy_header_value(headp);
+ char *location = Curl_copy_header_value(headp);
if(!location)
return CURLE_OUT_OF_MEMORY;
if(!*location)
@@ -3991,26 +3991,26 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
}
}
-
-#ifdef USE_HSTS
+
+#ifdef USE_HSTS
+ /* If enabled, the header is incoming and this is over HTTPS */
+ else if(data->hsts && checkprefix("Strict-Transport-Security:", headp) &&
+ (conn->handler->flags & PROTOPT_SSL)) {
+ CURLcode check =
+ Curl_hsts_parse(data->hsts, data->state.up.hostname,
+ &headp[ sizeof("Strict-Transport-Security:") -1 ]);
+ if(check)
+ infof(data, "Illegal STS header skipped\n");
+#ifdef DEBUGBUILD
+ else
+ infof(data, "Parsed STS header fine (%zu entries)\n",
+ data->hsts->list.size);
+#endif
+ }
+#endif
+#ifndef CURL_DISABLE_ALTSVC
/* If enabled, the header is incoming and this is over HTTPS */
- else if(data->hsts && checkprefix("Strict-Transport-Security:", headp) &&
- (conn->handler->flags & PROTOPT_SSL)) {
- CURLcode check =
- Curl_hsts_parse(data->hsts, data->state.up.hostname,
- &headp[ sizeof("Strict-Transport-Security:") -1 ]);
- if(check)
- infof(data, "Illegal STS header skipped\n");
-#ifdef DEBUGBUILD
- else
- infof(data, "Parsed STS header fine (%zu entries)\n",
- data->hsts->list.size);
-#endif
- }
-#endif
-#ifndef CURL_DISABLE_ALTSVC
- /* If enabled, the header is incoming and this is over HTTPS */
- else if(data->asi && checkprefix("Alt-Svc:", headp) &&
+ else if(data->asi && checkprefix("Alt-Svc:", headp) &&
((conn->handler->flags & PROTOPT_SSL) ||
#ifdef CURLDEBUG
/* allow debug builds to circumvent the HTTPS restriction */
@@ -4022,7 +4022,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
/* the ALPN of the current request */
enum alpnid id = (conn->httpversion == 20) ? ALPN_h2 : ALPN_h1;
result = Curl_altsvc_parse(data, data->asi,
- &headp[ strlen("Alt-Svc:") ],
+ &headp[ strlen("Alt-Svc:") ],
id, conn->host.name,
curlx_uitous(conn->remote_port));
if(result)
@@ -4030,7 +4030,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
#endif
else if(conn->handler->protocol & CURLPROTO_RTSP) {
- result = Curl_rtsp_parseheader(conn, headp);
+ result = Curl_rtsp_parseheader(conn, headp);
if(result)
return result;
}
@@ -4043,18 +4043,18 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
if(data->set.include_header)
writetype |= CLIENTWRITE_BODY;
- Curl_debug(data, CURLINFO_HEADER_IN, headp,
- Curl_dyn_len(&data->state.headerb));
+ Curl_debug(data, CURLINFO_HEADER_IN, headp,
+ Curl_dyn_len(&data->state.headerb));
- result = Curl_client_write(conn, writetype, headp,
- Curl_dyn_len(&data->state.headerb));
+ result = Curl_client_write(conn, writetype, headp,
+ Curl_dyn_len(&data->state.headerb));
if(result)
return result;
- data->info.header_size += Curl_dyn_len(&data->state.headerb);
- data->req.headerbytecount += Curl_dyn_len(&data->state.headerb);
+ data->info.header_size += Curl_dyn_len(&data->state.headerb);
+ data->req.headerbytecount += Curl_dyn_len(&data->state.headerb);
- Curl_dyn_reset(&data->state.headerb);
+ Curl_dyn_reset(&data->state.headerb);
}
while(*k->str); /* header line within buffer */
diff --git a/contrib/libs/curl/lib/http.h b/contrib/libs/curl/lib/http.h
index 0cef417065..1aaec225e2 100644
--- a/contrib/libs/curl/lib/http.h
+++ b/contrib/libs/curl/lib/http.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -44,19 +44,19 @@ char *Curl_copy_header_value(const char *header);
char *Curl_checkProxyheaders(const struct connectdata *conn,
const char *thisheader);
-CURLcode Curl_buffer_send(struct dynbuf *in,
- struct connectdata *conn,
- curl_off_t *bytes_written,
- size_t included_body_bytes,
- int socketindex);
+CURLcode Curl_buffer_send(struct dynbuf *in,
+ struct connectdata *conn,
+ curl_off_t *bytes_written,
+ size_t included_body_bytes,
+ int socketindex);
CURLcode Curl_add_timecondition(const struct connectdata *conn,
- struct dynbuf *buf);
+ struct dynbuf *buf);
CURLcode Curl_add_custom_headers(struct connectdata *conn,
bool is_connect,
- struct dynbuf *req_buffer);
+ struct dynbuf *req_buffer);
CURLcode Curl_http_compile_trailers(struct curl_slist *trailers,
- struct dynbuf *buf,
+ struct dynbuf *buf,
struct Curl_easy *handle);
/* protocol-specific functions set up to be called by the main engine */
@@ -97,7 +97,7 @@ CURLcode Curl_http_auth_act(struct connectdata *conn);
*
*/
#ifndef EXPECT_100_THRESHOLD
-#define EXPECT_100_THRESHOLD (1024*1024)
+#define EXPECT_100_THRESHOLD (1024*1024)
#endif
#endif /* CURL_DISABLE_HTTP */
@@ -135,9 +135,9 @@ struct HTTP {
} sending;
#ifndef CURL_DISABLE_HTTP
- struct dynbuf send_buffer; /* used if the request couldn't be sent in one
- chunk, points to an allocated send_buffer
- struct */
+ struct dynbuf send_buffer; /* used if the request couldn't be sent in one
+ chunk, points to an allocated send_buffer
+ struct */
#endif
#ifdef USE_NGHTTP2
/*********** for HTTP/2 we store stream-local data here *************/
@@ -145,10 +145,10 @@ struct HTTP {
bool bodystarted;
/* We store non-final and final response headers here, per-stream */
- struct dynbuf header_recvbuf;
+ struct dynbuf header_recvbuf;
size_t nread_header_recvbuf; /* number of bytes in header_recvbuf fed into
upper layer */
- struct dynbuf trailer_recvbuf;
+ struct dynbuf trailer_recvbuf;
int status_code; /* HTTP status code */
const uint8_t *pausedata; /* pointer to data received in on_data_chunk */
size_t pauselen; /* the number of bytes left in data */
@@ -174,15 +174,15 @@ struct HTTP {
#ifdef ENABLE_QUIC
/*********** for HTTP/3 we store stream-local data here *************/
int64_t stream3_id; /* stream we are interested in */
- bool firstheader; /* FALSE until headers arrive */
+ bool firstheader; /* FALSE until headers arrive */
bool firstbody; /* FALSE until body arrives */
bool h3req; /* FALSE until request is issued */
bool upload_done;
#endif
#ifdef USE_NGHTTP3
- size_t unacked_window;
+ size_t unacked_window;
struct h3out *h3out; /* per-stream buffers for upload */
- struct dynbuf overflow; /* excess data received during a single Curl_read */
+ struct dynbuf overflow; /* excess data received during a single Curl_read */
#endif
};
diff --git a/contrib/libs/curl/lib/http2.c b/contrib/libs/curl/lib/http2.c
index 41c2c8e4d6..b138fb4b0f 100644
--- a/contrib/libs/curl/lib/http2.c
+++ b/contrib/libs/curl/lib/http2.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -36,7 +36,7 @@
#include "connect.h"
#include "strtoofft.h"
#include "strdup.h"
-#include "dynbuf.h"
+#include "dynbuf.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -44,11 +44,11 @@
#define H2_BUFSIZE 32768
-#if (NGHTTP2_VERSION_NUM < 0x010c00)
+#if (NGHTTP2_VERSION_NUM < 0x010c00)
#error too old nghttp2 version, upgrade!
#endif
-#ifdef CURL_DISABLE_VERBOSE_STRINGS
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
#define nghttp2_session_callbacks_set_error_callback(x,y)
#endif
@@ -56,12 +56,12 @@
#define NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE 1
#endif
-#define HTTP2_HUGE_WINDOW_SIZE (32 * 1024 * 1024) /* 32 MB */
+#define HTTP2_HUGE_WINDOW_SIZE (32 * 1024 * 1024) /* 32 MB */
#ifdef DEBUG_HTTP2
#define H2BUGF(x) x
#else
-#define H2BUGF(x) do { } while(0)
+#define H2BUGF(x) do { } while(0)
#endif
@@ -125,7 +125,7 @@ static int http2_getsock(struct connectdata *conn,
static void http2_stream_free(struct HTTP *http)
{
if(http) {
- Curl_dyn_free(&http->header_recvbuf);
+ Curl_dyn_free(&http->header_recvbuf);
for(; http->push_headers_used > 0; --http->push_headers_used) {
free(http->push_headers[http->push_headers_used - 1]);
}
@@ -257,15 +257,15 @@ static unsigned int http2_conncheck(struct connectdata *check,
/* called from http_setup_conn */
void Curl_http2_setup_req(struct Curl_easy *data)
{
- struct HTTP *http = data->req.p.http;
+ struct HTTP *http = data->req.p.http;
http->bodystarted = FALSE;
http->status_code = -1;
http->pausedata = NULL;
http->pauselen = 0;
http->closed = FALSE;
http->close_handled = FALSE;
- http->mem = NULL;
- http->len = 0;
+ http->mem = NULL;
+ http->len = 0;
http->memlen = 0;
}
@@ -300,7 +300,7 @@ static const struct Curl_handler Curl_handler_http2 = {
http2_conncheck, /* connection_check */
PORT_HTTP, /* defport */
CURLPROTO_HTTP, /* protocol */
- CURLPROTO_HTTP, /* family */
+ CURLPROTO_HTTP, /* family */
PROTOPT_STREAM /* flags */
};
@@ -322,7 +322,7 @@ static const struct Curl_handler Curl_handler_http2_ssl = {
http2_conncheck, /* connection_check */
PORT_HTTP, /* defport */
CURLPROTO_HTTPS, /* protocol */
- CURLPROTO_HTTP, /* family */
+ CURLPROTO_HTTP, /* family */
PROTOPT_SSL | PROTOPT_STREAM /* flags */
};
@@ -333,7 +333,7 @@ static const struct Curl_handler Curl_handler_http2_ssl = {
int Curl_http2_ver(char *p, size_t len)
{
nghttp2_info *h2 = nghttp2_version(0);
- return msnprintf(p, len, "nghttp2/%s", h2->version_str);
+ return msnprintf(p, len, "nghttp2/%s", h2->version_str);
}
/*
@@ -393,7 +393,7 @@ char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num)
if(!h || !GOOD_EASY_HANDLE(h->data))
return NULL;
else {
- struct HTTP *stream = h->data->req.p.http;
+ struct HTTP *stream = h->data->req.p.http;
if(num < stream->push_headers_used)
return stream->push_headers[num];
}
@@ -415,7 +415,7 @@ char *curl_pushheader_byname(struct curl_pushheaders *h, const char *header)
!strcmp(header, ":") || strchr(header + 1, ':'))
return NULL;
else {
- struct HTTP *stream = h->data->req.p.http;
+ struct HTTP *stream = h->data->req.p.http;
size_t len = strlen(header);
size_t i;
for(i = 0; i<stream->push_headers_used; i++) {
@@ -459,64 +459,64 @@ static struct Curl_easy *duphandle(struct Curl_easy *data)
/* setup the request struct */
struct HTTP *http = calloc(1, sizeof(struct HTTP));
if(!http) {
- (void)Curl_close(&second);
+ (void)Curl_close(&second);
}
else {
- second->req.p.http = http;
- Curl_dyn_init(&http->header_recvbuf, DYN_H2_HEADERS);
- Curl_http2_setup_req(second);
- second->state.stream_weight = data->state.stream_weight;
+ second->req.p.http = http;
+ Curl_dyn_init(&http->header_recvbuf, DYN_H2_HEADERS);
+ Curl_http2_setup_req(second);
+ second->state.stream_weight = data->state.stream_weight;
}
}
return second;
}
-static int set_transfer_url(struct Curl_easy *data,
- struct curl_pushheaders *hp)
-{
- const char *v;
- CURLU *u = curl_url();
- CURLUcode uc;
- char *url;
-
- v = curl_pushheader_byname(hp, ":scheme");
- if(v) {
- uc = curl_url_set(u, CURLUPART_SCHEME, v, 0);
- if(uc)
- return 1;
- }
-
- v = curl_pushheader_byname(hp, ":authority");
- if(v) {
- uc = curl_url_set(u, CURLUPART_HOST, v, 0);
- if(uc)
- return 2;
- }
-
- v = curl_pushheader_byname(hp, ":path");
- if(v) {
- uc = curl_url_set(u, CURLUPART_PATH, v, 0);
- if(uc)
- return 3;
- }
-
- uc = curl_url_get(u, CURLUPART_URL, &url, 0);
- if(uc)
- return 4;
- curl_url_cleanup(u);
-
- if(data->change.url_alloc)
- free(data->change.url);
- data->change.url_alloc = TRUE;
- data->change.url = url;
- return 0;
-}
-
+static int set_transfer_url(struct Curl_easy *data,
+ struct curl_pushheaders *hp)
+{
+ const char *v;
+ CURLU *u = curl_url();
+ CURLUcode uc;
+ char *url;
+
+ v = curl_pushheader_byname(hp, ":scheme");
+ if(v) {
+ uc = curl_url_set(u, CURLUPART_SCHEME, v, 0);
+ if(uc)
+ return 1;
+ }
+
+ v = curl_pushheader_byname(hp, ":authority");
+ if(v) {
+ uc = curl_url_set(u, CURLUPART_HOST, v, 0);
+ if(uc)
+ return 2;
+ }
+
+ v = curl_pushheader_byname(hp, ":path");
+ if(v) {
+ uc = curl_url_set(u, CURLUPART_PATH, v, 0);
+ if(uc)
+ return 3;
+ }
+
+ uc = curl_url_get(u, CURLUPART_URL, &url, 0);
+ if(uc)
+ return 4;
+ curl_url_cleanup(u);
+
+ if(data->change.url_alloc)
+ free(data->change.url);
+ data->change.url_alloc = TRUE;
+ data->change.url = url;
+ return 0;
+}
+
static int push_promise(struct Curl_easy *data,
struct connectdata *conn,
const nghttp2_push_promise *frame)
{
- int rv; /* one of the CURL_PUSH_* defines */
+ int rv; /* one of the CURL_PUSH_* defines */
H2BUGF(infof(data, "PUSH_PROMISE received, stream %u!\n",
frame->promised_stream_id));
if(data->multi->push_cb) {
@@ -530,7 +530,7 @@ static int push_promise(struct Curl_easy *data,
struct Curl_easy *newhandle = duphandle(data);
if(!newhandle) {
infof(data, "failed to duplicate handle\n");
- rv = CURL_PUSH_DENY; /* FAIL HARD */
+ rv = CURL_PUSH_DENY; /* FAIL HARD */
goto fail;
}
@@ -539,20 +539,20 @@ static int push_promise(struct Curl_easy *data,
/* ask the application */
H2BUGF(infof(data, "Got PUSH_PROMISE, ask application!\n"));
- stream = data->req.p.http;
+ stream = data->req.p.http;
if(!stream) {
failf(data, "Internal NULL stream!\n");
- (void)Curl_close(&newhandle);
- rv = CURL_PUSH_DENY;
+ (void)Curl_close(&newhandle);
+ rv = CURL_PUSH_DENY;
+ goto fail;
+ }
+
+ rv = set_transfer_url(newhandle, &heads);
+ if(rv) {
+ rv = CURL_PUSH_DENY;
goto fail;
}
- rv = set_transfer_url(newhandle, &heads);
- if(rv) {
- rv = CURL_PUSH_DENY;
- goto fail;
- }
-
Curl_set_in_callback(data, true);
rv = data->multi->push_cb(data, newhandle,
stream->push_headers_used, &heads,
@@ -567,15 +567,15 @@ static int push_promise(struct Curl_easy *data,
stream->push_headers_used = 0;
if(rv) {
- DEBUGASSERT((rv > CURL_PUSH_OK) && (rv <= CURL_PUSH_ERROROUT));
+ DEBUGASSERT((rv > CURL_PUSH_OK) && (rv <= CURL_PUSH_ERROROUT));
/* denied, kill off the new handle again */
- http2_stream_free(newhandle->req.p.http);
- newhandle->req.p.http = NULL;
- (void)Curl_close(&newhandle);
+ http2_stream_free(newhandle->req.p.http);
+ newhandle->req.p.http = NULL;
+ (void)Curl_close(&newhandle);
goto fail;
}
- newstream = newhandle->req.p.http;
+ newstream = newhandle->req.p.http;
newstream->stream_id = frame->promised_stream_id;
newhandle->req.maxdownload = -1;
newhandle->req.size = -1;
@@ -585,10 +585,10 @@ static int push_promise(struct Curl_easy *data,
rc = Curl_multi_add_perform(data->multi, newhandle, conn);
if(rc) {
infof(data, "failed to add handle to multi\n");
- http2_stream_free(newhandle->req.p.http);
- newhandle->req.p.http = NULL;
- Curl_close(&newhandle);
- rv = CURL_PUSH_DENY;
+ http2_stream_free(newhandle->req.p.http);
+ newhandle->req.p.http = NULL;
+ Curl_close(&newhandle);
+ rv = CURL_PUSH_DENY;
goto fail;
}
@@ -600,13 +600,13 @@ static int push_promise(struct Curl_easy *data,
infof(data, "failed to set user_data for stream %d\n",
frame->promised_stream_id);
DEBUGASSERT(0);
- rv = CURL_PUSH_DENY;
+ rv = CURL_PUSH_DENY;
goto fail;
}
}
else {
H2BUGF(infof(data, "Got PUSH_PROMISE, ignore it!\n"));
- rv = CURL_PUSH_DENY;
+ rv = CURL_PUSH_DENY;
}
fail:
return rv;
@@ -669,7 +669,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
return 0;
}
- stream = data_s->req.p.http;
+ stream = data_s->req.p.http;
if(!stream) {
H2BUGF(infof(data_s, "No proto pointer for stream: %x\n",
stream_id));
@@ -710,17 +710,17 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
stream->status_code = -1;
}
- result = Curl_dyn_add(&stream->header_recvbuf, "\r\n");
+ result = Curl_dyn_add(&stream->header_recvbuf, "\r\n");
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
- left = Curl_dyn_len(&stream->header_recvbuf) -
- stream->nread_header_recvbuf;
+ left = Curl_dyn_len(&stream->header_recvbuf) -
+ stream->nread_header_recvbuf;
ncopy = CURLMIN(stream->len, left);
memcpy(&stream->mem[stream->memlen],
- Curl_dyn_ptr(&stream->header_recvbuf) +
- stream->nread_header_recvbuf,
+ Curl_dyn_ptr(&stream->header_recvbuf) +
+ stream->nread_header_recvbuf,
ncopy);
stream->nread_header_recvbuf += ncopy;
@@ -743,16 +743,16 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
case NGHTTP2_PUSH_PROMISE:
rv = push_promise(data_s, conn, &frame->push_promise);
if(rv) { /* deny! */
- int h2;
- DEBUGASSERT((rv > CURL_PUSH_OK) && (rv <= CURL_PUSH_ERROROUT));
- h2 = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE,
+ int h2;
+ DEBUGASSERT((rv > CURL_PUSH_OK) && (rv <= CURL_PUSH_ERROROUT));
+ h2 = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE,
frame->push_promise.promised_stream_id,
NGHTTP2_CANCEL);
- if(nghttp2_is_fatal(h2))
- return NGHTTP2_ERR_CALLBACK_FAILURE;
- else if(rv == CURL_PUSH_ERROROUT) {
- DEBUGF(infof(data_s, "Fail the parent stream (too)\n"));
- return NGHTTP2_ERR_CALLBACK_FAILURE;
+ if(nghttp2_is_fatal(h2))
+ return NGHTTP2_ERR_CALLBACK_FAILURE;
+ else if(rv == CURL_PUSH_ERROROUT) {
+ DEBUGF(infof(data_s, "Fail the parent stream (too)\n"));
+ return NGHTTP2_ERR_CALLBACK_FAILURE;
}
}
break;
@@ -785,7 +785,7 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
internal error more than anything else! */
return NGHTTP2_ERR_CALLBACK_FAILURE;
- stream = data_s->req.p.http;
+ stream = data_s->req.p.http;
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
@@ -850,15 +850,15 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id,
return 0;
}
H2BUGF(infof(data_s, "on_stream_close(), %s (err %d), stream %u\n",
- nghttp2_http2_strerror(error_code), error_code, stream_id));
- stream = data_s->req.p.http;
+ nghttp2_http2_strerror(error_code), error_code, stream_id));
+ stream = data_s->req.p.http;
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
stream->closed = TRUE;
httpc = &conn->proto.httpc;
drain_this(data_s, httpc);
- Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
+ Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
httpc->error_code = error_code;
/* remove the entry from the hash as the stream is now gone */
@@ -896,7 +896,7 @@ static int on_begin_headers(nghttp2_session *session,
return 0;
}
- stream = data_s->req.p.http;
+ stream = data_s->req.p.http;
if(!stream || !stream->bodystarted) {
return 0;
}
@@ -954,7 +954,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
internal error more than anything else! */
return NGHTTP2_ERR_CALLBACK_FAILURE;
- stream = data_s->req.p.http;
+ stream = data_s->req.p.http;
if(!stream) {
failf(data_s, "Internal NULL stream! 5\n");
return NGHTTP2_ERR_CALLBACK_FAILURE;
@@ -972,9 +972,9 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
if(!check)
/* no memory */
return NGHTTP2_ERR_CALLBACK_FAILURE;
- if(!Curl_strcasecompare(check, (const char *)value) &&
- ((conn->remote_port != conn->given->defport) ||
- !Curl_strcasecompare(conn->host.name, (const char *)value))) {
+ if(!Curl_strcasecompare(check, (const char *)value) &&
+ ((conn->remote_port != conn->given->defport) ||
+ !Curl_strcasecompare(conn->host.name, (const char *)value))) {
/* This is push is not for the same authority that was asked for in
* the URL. RFC 7540 section 8.2 says: "A client MUST treat a
* PUSH_PROMISE for which the server is not authoritative as a stream
@@ -1016,12 +1016,12 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
}
if(stream->bodystarted) {
- /* This is a trailer */
+ /* This is a trailer */
H2BUGF(infof(data_s, "h2 trailer: %.*s: %.*s\n", namelen, name, valuelen,
value));
- result = Curl_dyn_addf(&stream->trailer_recvbuf,
- "%.*s: %.*s\r\n", namelen, name,
- valuelen, value);
+ result = Curl_dyn_addf(&stream->trailer_recvbuf,
+ "%.*s: %.*s\r\n", namelen, name,
+ valuelen, value);
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
@@ -1036,14 +1036,14 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
stream->status_code = decode_status_code(value, valuelen);
DEBUGASSERT(stream->status_code != -1);
- result = Curl_dyn_add(&stream->header_recvbuf, "HTTP/2 ");
+ result = Curl_dyn_add(&stream->header_recvbuf, "HTTP/2 ");
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
- result = Curl_dyn_addn(&stream->header_recvbuf, value, valuelen);
+ result = Curl_dyn_addn(&stream->header_recvbuf, value, valuelen);
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
/* the space character after the status code is mandatory */
- result = Curl_dyn_add(&stream->header_recvbuf, " \r\n");
+ result = Curl_dyn_add(&stream->header_recvbuf, " \r\n");
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
/* if we receive data for another handle, wake that up */
@@ -1058,16 +1058,16 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
/* nghttp2 guarantees that namelen > 0, and :status was already
received, and this is not pseudo-header field . */
/* convert to a HTTP1-style header */
- result = Curl_dyn_addn(&stream->header_recvbuf, name, namelen);
+ result = Curl_dyn_addn(&stream->header_recvbuf, name, namelen);
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
- result = Curl_dyn_add(&stream->header_recvbuf, ": ");
+ result = Curl_dyn_add(&stream->header_recvbuf, ": ");
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
- result = Curl_dyn_addn(&stream->header_recvbuf, value, valuelen);
+ result = Curl_dyn_addn(&stream->header_recvbuf, value, valuelen);
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
- result = Curl_dyn_add(&stream->header_recvbuf, "\r\n");
+ result = Curl_dyn_add(&stream->header_recvbuf, "\r\n");
if(result)
return NGHTTP2_ERR_CALLBACK_FAILURE;
/* if we receive data for another handle, wake that up */
@@ -1102,7 +1102,7 @@ static ssize_t data_source_read_callback(nghttp2_session *session,
internal error more than anything else! */
return NGHTTP2_ERR_CALLBACK_FAILURE;
- stream = data_s->req.p.http;
+ stream = data_s->req.p.http;
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
@@ -1130,7 +1130,7 @@ static ssize_t data_source_read_callback(nghttp2_session *session,
return nread;
}
-#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
+#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
static int error_callback(nghttp2_session *session,
const char *msg,
size_t len,
@@ -1147,10 +1147,10 @@ static void populate_settings(struct connectdata *conn,
struct http_conn *httpc)
{
nghttp2_settings_entry *iv = httpc->local_settings;
- DEBUGASSERT(conn->data);
+ DEBUGASSERT(conn->data);
iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
- iv[0].value = Curl_multi_max_concurrent_streams(conn->data->multi);
+ iv[0].value = Curl_multi_max_concurrent_streams(conn->data->multi);
iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
iv[1].value = HTTP2_HUGE_WINDOW_SIZE;
@@ -1161,26 +1161,26 @@ static void populate_settings(struct connectdata *conn,
httpc->local_settings_num = 3;
}
-void Curl_http2_done(struct Curl_easy *data, bool premature)
+void Curl_http2_done(struct Curl_easy *data, bool premature)
{
- struct HTTP *http = data->req.p.http;
- struct http_conn *httpc = &data->conn->proto.httpc;
+ struct HTTP *http = data->req.p.http;
+ struct http_conn *httpc = &data->conn->proto.httpc;
/* there might be allocated resources done before this got the 'h2' pointer
setup */
- Curl_dyn_free(&http->header_recvbuf);
- Curl_dyn_free(&http->trailer_recvbuf);
- if(http->push_headers) {
- /* if they weren't used and then freed before */
- for(; http->push_headers_used > 0; --http->push_headers_used) {
- free(http->push_headers[http->push_headers_used - 1]);
+ Curl_dyn_free(&http->header_recvbuf);
+ Curl_dyn_free(&http->trailer_recvbuf);
+ if(http->push_headers) {
+ /* if they weren't used and then freed before */
+ for(; http->push_headers_used > 0; --http->push_headers_used) {
+ free(http->push_headers[http->push_headers_used - 1]);
}
- free(http->push_headers);
- http->push_headers = NULL;
+ free(http->push_headers);
+ http->push_headers = NULL;
}
- if(!(data->conn->handler->protocol&PROTO_FAMILY_HTTP) ||
- !httpc->h2) /* not HTTP/2 ? */
+ if(!(data->conn->handler->protocol&PROTO_FAMILY_HTTP) ||
+ !httpc->h2) /* not HTTP/2 ? */
return;
if(premature) {
@@ -1266,7 +1266,7 @@ static CURLcode http2_init(struct connectdata *conn)
/*
* Append headers to ask for a HTTP1.1 to HTTP2 upgrade.
*/
-CURLcode Curl_http2_request_upgrade(struct dynbuf *req,
+CURLcode Curl_http2_request_upgrade(struct dynbuf *req,
struct connectdata *conn)
{
CURLcode result;
@@ -1283,9 +1283,9 @@ CURLcode Curl_http2_request_upgrade(struct dynbuf *req,
binlen = nghttp2_pack_settings_payload(binsettings, H2_BINSETTINGS_LEN,
httpc->local_settings,
httpc->local_settings_num);
- if(binlen <= 0) {
+ if(binlen <= 0) {
failf(conn->data, "nghttp2 unexpectedly failed on pack_settings_payload");
- Curl_dyn_free(req);
+ Curl_dyn_free(req);
return CURLE_FAILED_INIT;
}
conn->proto.httpc.binlen = binlen;
@@ -1293,15 +1293,15 @@ CURLcode Curl_http2_request_upgrade(struct dynbuf *req,
result = Curl_base64url_encode(conn->data, (const char *)binsettings, binlen,
&base64, &blen);
if(result) {
- Curl_dyn_free(req);
+ Curl_dyn_free(req);
return result;
}
- result = Curl_dyn_addf(req,
- "Connection: Upgrade, HTTP2-Settings\r\n"
- "Upgrade: %s\r\n"
- "HTTP2-Settings: %s\r\n",
- NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, base64);
+ result = Curl_dyn_addf(req,
+ "Connection: Upgrade, HTTP2-Settings\r\n"
+ "Upgrade: %s\r\n"
+ "HTTP2-Settings: %s\r\n",
+ NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, base64);
free(base64);
k->upgr101 = UPGR101_REQUESTED;
@@ -1366,14 +1366,14 @@ static int h2_process_pending_input(struct connectdata *conn,
return -1;
}
- if(nghttp2_session_check_request_allowed(httpc->h2) == 0) {
- /* No more requests are allowed in the current session, so
- the connection may not be reused. This is set when a
- GOAWAY frame has been received or when the limit of stream
- identifiers has been reached. */
- connclose(conn, "http/2: No new requests allowed");
- }
-
+ if(nghttp2_session_check_request_allowed(httpc->h2) == 0) {
+ /* No more requests are allowed in the current session, so
+ the connection may not be reused. This is set when a
+ GOAWAY frame has been received or when the limit of stream
+ identifiers has been reached. */
+ connclose(conn, "http/2: No new requests allowed");
+ }
+
if(should_close_session(httpc)) {
H2BUGF(infof(data,
"h2_process_pending_input: nothing to do in this session\n"));
@@ -1400,11 +1400,11 @@ CURLcode Curl_http2_done_sending(struct connectdata *conn)
(conn->handler == &Curl_handler_http2)) {
/* make sure this is only attempted for HTTP/2 transfers */
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
+
+ struct http_conn *httpc = &conn->proto.httpc;
+ nghttp2_session *h2 = httpc->h2;
- struct http_conn *httpc = &conn->proto.httpc;
- nghttp2_session *h2 = httpc->h2;
-
if(stream->upload_left) {
/* If the stream still thinks there's data left to upload. */
@@ -1416,23 +1416,23 @@ CURLcode Curl_http2_done_sending(struct connectdata *conn)
(void)h2_process_pending_input(conn, httpc, &result);
}
-
- /* If nghttp2 still has pending frames unsent */
- if(nghttp2_session_want_write(h2)) {
- struct Curl_easy *data = conn->data;
- struct SingleRequest *k = &data->req;
- int rv;
-
- H2BUGF(infof(data, "HTTP/2 still wants to send data (easy %p)\n", data));
-
- /* re-set KEEP_SEND to make sure we are called again */
- k->keepon |= KEEP_SEND;
-
- /* and attempt to send the pending frames */
- rv = h2_session_send(data, h2);
- if(rv != 0)
- result = CURLE_SEND_ERROR;
- }
+
+ /* If nghttp2 still has pending frames unsent */
+ if(nghttp2_session_want_write(h2)) {
+ struct Curl_easy *data = conn->data;
+ struct SingleRequest *k = &data->req;
+ int rv;
+
+ H2BUGF(infof(data, "HTTP/2 still wants to send data (easy %p)\n", data));
+
+ /* re-set KEEP_SEND to make sure we are called again */
+ k->keepon |= KEEP_SEND;
+
+ /* and attempt to send the pending frames */
+ rv = h2_session_send(data, h2);
+ if(rv != 0)
+ result = CURLE_SEND_ERROR;
+ }
}
return result;
}
@@ -1469,7 +1469,7 @@ static ssize_t http2_handle_stream_close(struct connectdata *conn,
}
else if(httpc->error_code != NGHTTP2_NO_ERROR) {
failf(data, "HTTP/2 stream %d was not closed cleanly: %s (err %u)",
- stream->stream_id, nghttp2_http2_strerror(httpc->error_code),
+ stream->stream_id, nghttp2_http2_strerror(httpc->error_code),
httpc->error_code);
*err = CURLE_HTTP2_STREAM;
return -1;
@@ -1483,28 +1483,28 @@ static ssize_t http2_handle_stream_close(struct connectdata *conn,
return -1;
}
- if(Curl_dyn_len(&stream->trailer_recvbuf)) {
- char *trailp = Curl_dyn_ptr(&stream->trailer_recvbuf);
- char *lf;
-
- do {
- size_t len = 0;
- CURLcode result;
- /* each trailer line ends with a newline */
- lf = strchr(trailp, '\n');
- if(!lf)
- break;
- len = lf + 1 - trailp;
+ if(Curl_dyn_len(&stream->trailer_recvbuf)) {
+ char *trailp = Curl_dyn_ptr(&stream->trailer_recvbuf);
+ char *lf;
- Curl_debug(data, CURLINFO_HEADER_IN, trailp, len);
- /* pass the trailers one by one to the callback */
- result = Curl_client_write(conn, CLIENTWRITE_HEADER, trailp, len);
+ do {
+ size_t len = 0;
+ CURLcode result;
+ /* each trailer line ends with a newline */
+ lf = strchr(trailp, '\n');
+ if(!lf)
+ break;
+ len = lf + 1 - trailp;
+
+ Curl_debug(data, CURLINFO_HEADER_IN, trailp, len);
+ /* pass the trailers one by one to the callback */
+ result = Curl_client_write(conn, CLIENTWRITE_HEADER, trailp, len);
if(result) {
*err = result;
return -1;
}
- trailp = ++lf;
- } while(lf);
+ trailp = ++lf;
+ } while(lf);
}
stream->close_handled = TRUE;
@@ -1523,7 +1523,7 @@ static void h2_pri_spec(struct Curl_easy *data,
nghttp2_priority_spec *pri_spec)
{
struct HTTP *depstream = (data->set.stream_depends_on?
- data->set.stream_depends_on->req.p.http:NULL);
+ data->set.stream_depends_on->req.p.http:NULL);
int32_t depstream_id = depstream? depstream->stream_id:0;
nghttp2_priority_spec_init(pri_spec, depstream_id, data->set.stream_weight,
data->set.stream_depends_e);
@@ -1540,7 +1540,7 @@ static void h2_pri_spec(struct Curl_easy *data,
static int h2_session_send(struct Curl_easy *data,
nghttp2_session *h2)
{
- struct HTTP *stream = data->req.p.http;
+ struct HTTP *stream = data->req.p.http;
if((data->set.stream_weight != data->state.stream_weight) ||
(data->set.stream_depends_e != data->state.stream_depends_e) ||
(data->set.stream_depends_on != data->state.stream_depends_on) ) {
@@ -1552,7 +1552,7 @@ static int h2_session_send(struct Curl_easy *data,
H2BUGF(infof(data, "Queuing PRIORITY on stream %u (easy %p)\n",
stream->stream_id, data));
- DEBUGASSERT(stream->stream_id != -1);
+ DEBUGASSERT(stream->stream_id != -1);
rv = nghttp2_submit_priority(h2, NGHTTP2_FLAG_NONE, stream->stream_id,
&pri_spec);
if(rv)
@@ -1568,7 +1568,7 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
ssize_t nread;
struct http_conn *httpc = &conn->proto.httpc;
struct Curl_easy *data = conn->data;
- struct HTTP *stream = data->req.p.http;
+ struct HTTP *stream = data->req.p.http;
(void)sockindex; /* we always do HTTP2 on sockindex 0 */
@@ -1595,13 +1595,13 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
*/
if(stream->bodystarted &&
- stream->nread_header_recvbuf < Curl_dyn_len(&stream->header_recvbuf)) {
- /* If there is header data pending for this stream to return, do that */
+ stream->nread_header_recvbuf < Curl_dyn_len(&stream->header_recvbuf)) {
+ /* If there is header data pending for this stream to return, do that */
size_t left =
- Curl_dyn_len(&stream->header_recvbuf) - stream->nread_header_recvbuf;
+ Curl_dyn_len(&stream->header_recvbuf) - stream->nread_header_recvbuf;
size_t ncopy = CURLMIN(len, left);
- memcpy(mem, Curl_dyn_ptr(&stream->header_recvbuf) +
- stream->nread_header_recvbuf, ncopy);
+ memcpy(mem, Curl_dyn_ptr(&stream->header_recvbuf) +
+ stream->nread_header_recvbuf, ncopy);
stream->nread_header_recvbuf += ncopy;
H2BUGF(infof(data, "http2_recv: Got %d bytes from header_recvbuf\n",
@@ -1609,12 +1609,12 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
return ncopy;
}
- H2BUGF(infof(data, "http2_recv: easy %p (stream %u) win %u/%u\n",
- data, stream->stream_id,
- nghttp2_session_get_local_window_size(httpc->h2),
- nghttp2_session_get_stream_local_window_size(httpc->h2,
- stream->stream_id)
- ));
+ H2BUGF(infof(data, "http2_recv: easy %p (stream %u) win %u/%u\n",
+ data, stream->stream_id,
+ nghttp2_session_get_local_window_size(httpc->h2),
+ nghttp2_session_get_stream_local_window_size(httpc->h2,
+ stream->stream_id)
+ ));
if((data->state.drain) && stream->memlen) {
H2BUGF(infof(data, "http2_recv: DRAIN %zu bytes stream %u!! (%p => %p)\n",
@@ -1631,7 +1631,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(conn, httpc, err) != 0) {
+ if(h2_process_pending_input(conn, httpc, err) != 0) {
return -1;
}
}
@@ -1659,7 +1659,7 @@ 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(conn, httpc, err) != 0) {
+ if(h2_process_pending_input(conn, httpc, err) != 0) {
return -1;
}
}
@@ -1676,9 +1676,9 @@ 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. */
- if(stream->closed)
- /* closed overrides paused */
- return 0;
+ if(stream->closed)
+ /* closed overrides paused */
+ return 0;
H2BUGF(infof(data, "stream %x is paused, pause id: %x\n",
stream->stream_id, httpc->pause_stream_id));
*err = CURLE_AGAIN;
@@ -1693,10 +1693,10 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
if(httpc->inbuflen == 0) {
nread = ((Curl_recv *)httpc->recv_underlying)(
- conn, FIRSTSOCKET, httpc->inbuf, H2_BUFSIZE, err);
+ conn, FIRSTSOCKET, httpc->inbuf, H2_BUFSIZE, err);
if(nread == -1) {
- if(*err != CURLE_AGAIN)
+ if(*err != CURLE_AGAIN)
failf(data, "Failed receiving HTTP2 data");
else if(stream->closed)
/* received when the stream was already closed! */
@@ -1714,17 +1714,17 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
H2BUGF(infof(data, "nread=%zd\n", nread));
httpc->inbuflen = nread;
-
- DEBUGASSERT(httpc->nread_inbuf == 0);
+
+ DEBUGASSERT(httpc->nread_inbuf == 0);
}
else {
nread = httpc->inbuflen - httpc->nread_inbuf;
- (void)nread; /* silence warning, used in debug */
+ (void)nread; /* silence warning, used in debug */
H2BUGF(infof(data, "Use data left in connection buffer, nread=%zd\n",
nread));
}
- if(h2_process_pending_input(conn, httpc, err) != 0)
+ if(h2_process_pending_input(conn, httpc, err) != 0)
return -1;
}
if(stream->memlen) {
@@ -1760,9 +1760,9 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
field list. */
#define AUTHORITY_DST_IDX 3
-/* USHRT_MAX is 65535 == 0xffff */
+/* USHRT_MAX is 65535 == 0xffff */
#define HEADER_OVERFLOW(x) \
- (x.namelen > 0xffff || x.valuelen > 0xffff - x.namelen)
+ (x.namelen > 0xffff || x.valuelen > 0xffff - x.namelen)
/*
* Check header memory for the token "trailers".
@@ -1840,7 +1840,7 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
*/
int rv;
struct http_conn *httpc = &conn->proto.httpc;
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
nghttp2_nv *nva = NULL;
size_t nheader;
size_t i;
@@ -2012,9 +2012,9 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
nva[i].namelen = strlen((char *)nva[i].name);
}
else {
- nva[i].namelen = (size_t)(end - hdbuf);
- /* Lower case the header name for HTTP/2 */
- Curl_strntolower((char *)hdbuf, hdbuf, nva[i].namelen);
+ nva[i].namelen = (size_t)(end - hdbuf);
+ /* Lower case the header name for HTTP/2 */
+ Curl_strntolower((char *)hdbuf, hdbuf, nva[i].namelen);
nva[i].name = (unsigned char *)hdbuf;
}
hdbuf = end + 1;
@@ -2070,17 +2070,17 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
if(acc > MAX_ACC) {
infof(conn->data, "http2_send: Warning: The cumulative length of all "
- "headers exceeds %d bytes and that could cause the "
+ "headers exceeds %d bytes and that could cause the "
"stream to be rejected.\n", MAX_ACC);
}
}
h2_pri_spec(conn->data, &pri_spec);
- H2BUGF(infof(conn->data, "http2_send request allowed %d (easy handle %p)\n",
- nghttp2_session_check_request_allowed(h2), (void *)conn->data));
-
- switch(conn->data->state.httpreq) {
+ H2BUGF(infof(conn->data, "http2_send request allowed %d (easy handle %p)\n",
+ nghttp2_session_check_request_allowed(h2), (void *)conn->data));
+
+ switch(conn->data->state.httpreq) {
case HTTPREQ_POST:
case HTTPREQ_POST_FORM:
case HTTPREQ_POST_MIME:
@@ -2104,9 +2104,9 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
Curl_safefree(nva);
if(stream_id < 0) {
- H2BUGF(infof(conn->data,
- "http2_send() nghttp2_submit_request error (%s)%d\n",
- nghttp2_strerror(stream_id), stream_id));
+ H2BUGF(infof(conn->data,
+ "http2_send() nghttp2_submit_request error (%s)%d\n",
+ nghttp2_strerror(stream_id), stream_id));
*err = CURLE_SEND_ERROR;
return -1;
}
@@ -2116,12 +2116,12 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
stream->stream_id = stream_id;
/* this does not call h2_session_send() since there can not have been any
- * priority update since the nghttp2_submit_request() call above */
+ * priority update since the nghttp2_submit_request() call above */
rv = nghttp2_session_send(h2);
- if(rv != 0) {
- H2BUGF(infof(conn->data,
- "http2_send() nghttp2_session_send error (%s)%d\n",
- nghttp2_strerror(rv), rv));
+ if(rv != 0) {
+ H2BUGF(infof(conn->data,
+ "http2_send() nghttp2_session_send error (%s)%d\n",
+ nghttp2_strerror(rv), rv));
*err = CURLE_SEND_ERROR;
return -1;
@@ -2133,14 +2133,14 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
return -1;
}
- /* If whole HEADERS frame was sent off to the underlying socket, the nghttp2
- library calls data_source_read_callback. But only it found that no data
- available, so it deferred the DATA transmission. Which means that
- nghttp2_session_want_write() returns 0 on http2_perform_getsock(), which
- results that no writable socket check is performed. To workaround this,
- we issue nghttp2_session_resume_data() here to bring back DATA
- transmission from deferred state. */
- nghttp2_session_resume_data(h2, stream->stream_id);
+ /* If whole HEADERS frame was sent off to the underlying socket, the nghttp2
+ library calls data_source_read_callback. But only it found that no data
+ available, so it deferred the DATA transmission. Which means that
+ nghttp2_session_want_write() returns 0 on http2_perform_getsock(), which
+ results that no writable socket check is performed. To workaround this,
+ we issue nghttp2_session_resume_data() here to bring back DATA
+ transmission from deferred state. */
+ nghttp2_session_resume_data(h2, stream->stream_id);
return len;
@@ -2154,14 +2154,14 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
{
CURLcode result;
struct http_conn *httpc = &conn->proto.httpc;
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
+
+ DEBUGASSERT(conn->data->state.buffer);
- DEBUGASSERT(conn->data->state.buffer);
-
stream->stream_id = -1;
- Curl_dyn_init(&stream->header_recvbuf, DYN_H2_HEADERS);
- Curl_dyn_init(&stream->trailer_recvbuf, DYN_H2_TRAILERS);
+ Curl_dyn_init(&stream->header_recvbuf, DYN_H2_HEADERS);
+ Curl_dyn_init(&stream->trailer_recvbuf, DYN_H2_TRAILERS);
if((conn->handler == &Curl_handler_http2_ssl) ||
(conn->handler == &Curl_handler_http2))
@@ -2174,7 +2174,7 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
result = http2_init(conn);
if(result) {
- Curl_dyn_free(&stream->header_recvbuf);
+ Curl_dyn_free(&stream->header_recvbuf);
return result;
}
@@ -2182,8 +2182,8 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
stream->upload_left = 0;
stream->upload_mem = NULL;
stream->upload_len = 0;
- stream->mem = conn->data->state.buffer;
- stream->len = conn->data->set.buffer_size;
+ stream->mem = conn->data->state.buffer;
+ stream->len = conn->data->set.buffer_size;
httpc->inbuflen = 0;
httpc->nread_inbuf = 0;
@@ -2208,7 +2208,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
struct http_conn *httpc = &conn->proto.httpc;
int rv;
struct Curl_easy *data = conn->data;
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
result = Curl_http2_setup(conn);
if(result)
@@ -2269,7 +2269,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
data into stream->mem, overwriting data already there. */
if(H2_BUFSIZE < nread) {
failf(data, "connection buffer size is too small to store data following "
- "HTTP Upgrade response header: buflen=%d, datalen=%zu",
+ "HTTP Upgrade response header: buflen=%d, datalen=%zu",
H2_BUFSIZE, nread);
return CURLE_HTTP2;
}
@@ -2280,59 +2280,59 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
if(nread)
memcpy(httpc->inbuf, mem, nread);
-
+
httpc->inbuflen = nread;
- DEBUGASSERT(httpc->nread_inbuf == 0);
+ DEBUGASSERT(httpc->nread_inbuf == 0);
- if(-1 == h2_process_pending_input(conn, httpc, &result))
+ if(-1 == h2_process_pending_input(conn, httpc, &result))
return CURLE_HTTP2;
- return CURLE_OK;
-}
-
-CURLcode Curl_http2_stream_pause(struct Curl_easy *data, bool pause)
-{
- DEBUGASSERT(data);
- DEBUGASSERT(data->conn);
- /* if it isn't HTTP/2, we're done */
- if(!data->conn->proto.httpc.h2)
- return CURLE_OK;
-#ifdef NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE
+ return CURLE_OK;
+}
+
+CURLcode Curl_http2_stream_pause(struct Curl_easy *data, bool pause)
+{
+ DEBUGASSERT(data);
+ DEBUGASSERT(data->conn);
+ /* if it isn't HTTP/2, we're done */
+ if(!data->conn->proto.httpc.h2)
+ return CURLE_OK;
+#ifdef NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE
else {
- struct HTTP *stream = data->req.p.http;
- struct http_conn *httpc = &data->conn->proto.httpc;
- uint32_t window = !pause * HTTP2_HUGE_WINDOW_SIZE;
- int rv = nghttp2_session_set_local_window_size(httpc->h2,
- NGHTTP2_FLAG_NONE,
- stream->stream_id,
- window);
- if(rv) {
- failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
- nghttp2_strerror(rv), rv);
- return CURLE_HTTP2;
- }
-
- /* make sure the window update gets sent */
- rv = h2_session_send(data, httpc->h2);
- if(rv)
- return CURLE_SEND_ERROR;
-
- DEBUGF(infof(data, "Set HTTP/2 window size to %u for stream %u\n",
- window, stream->stream_id));
-
-#ifdef DEBUGBUILD
- {
- /* read out the stream local window again */
- uint32_t window2 =
- nghttp2_session_get_stream_local_window_size(httpc->h2,
- stream->stream_id);
- DEBUGF(infof(data, "HTTP/2 window size is now %u for stream %u\n",
- window2, stream->stream_id));
- }
-#endif
- }
-#endif
+ struct HTTP *stream = data->req.p.http;
+ struct http_conn *httpc = &data->conn->proto.httpc;
+ uint32_t window = !pause * HTTP2_HUGE_WINDOW_SIZE;
+ int rv = nghttp2_session_set_local_window_size(httpc->h2,
+ NGHTTP2_FLAG_NONE,
+ stream->stream_id,
+ window);
+ if(rv) {
+ failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
+ nghttp2_strerror(rv), rv);
+ return CURLE_HTTP2;
+ }
+
+ /* make sure the window update gets sent */
+ rv = h2_session_send(data, httpc->h2);
+ if(rv)
+ return CURLE_SEND_ERROR;
+
+ DEBUGF(infof(data, "Set HTTP/2 window size to %u for stream %u\n",
+ window, stream->stream_id));
+
+#ifdef DEBUGBUILD
+ {
+ /* read out the stream local window again */
+ uint32_t window2 =
+ nghttp2_session_get_stream_local_window_size(httpc->h2,
+ stream->stream_id);
+ DEBUGF(infof(data, "HTTP/2 window size is now %u for stream %u\n",
+ window2, stream->stream_id));
+ }
+#endif
+ }
+#endif
return CURLE_OK;
}
diff --git a/contrib/libs/curl/lib/http2.h b/contrib/libs/curl/lib/http2.h
index 4ae5347f61..43a6863abe 100644
--- a/contrib/libs/curl/lib/http2.h
+++ b/contrib/libs/curl/lib/http2.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -42,7 +42,7 @@ const char *Curl_http2_strerror(uint32_t err);
CURLcode Curl_http2_init(struct connectdata *conn);
void Curl_http2_init_state(struct UrlState *state);
void Curl_http2_init_userset(struct UserDefined *set);
-CURLcode Curl_http2_request_upgrade(struct dynbuf *req,
+CURLcode Curl_http2_request_upgrade(struct dynbuf *req,
struct connectdata *conn);
CURLcode Curl_http2_setup(struct connectdata *conn);
CURLcode Curl_http2_switched(struct connectdata *conn,
@@ -50,7 +50,7 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
/* called from http_setup_conn */
void Curl_http2_setup_conn(struct connectdata *conn);
void Curl_http2_setup_req(struct Curl_easy *data);
-void Curl_http2_done(struct Curl_easy *data, bool premature);
+void Curl_http2_done(struct Curl_easy *data, bool premature);
CURLcode Curl_http2_done_sending(struct connectdata *conn);
CURLcode Curl_http2_add_child(struct Curl_easy *parent,
struct Curl_easy *child,
@@ -58,7 +58,7 @@ CURLcode Curl_http2_add_child(struct Curl_easy *parent,
void Curl_http2_remove_child(struct Curl_easy *parent,
struct Curl_easy *child);
void Curl_http2_cleanup_dependencies(struct Curl_easy *data);
-CURLcode Curl_http2_stream_pause(struct Curl_easy *data, bool pause);
+CURLcode Curl_http2_stream_pause(struct Curl_easy *data, bool pause);
/* returns true if the HTTP/2 stream error was HTTP_1_1_REQUIRED */
bool Curl_h2_http_1_1_error(struct connectdata *conn);
@@ -75,7 +75,7 @@ bool Curl_h2_http_1_1_error(struct connectdata *conn);
#define Curl_http2_add_child(x, y, z)
#define Curl_http2_remove_child(x, y)
#define Curl_http2_cleanup_dependencies(x)
-#define Curl_http2_stream_pause(x, y)
+#define Curl_http2_stream_pause(x, y)
#define Curl_h2_http_1_1_error(x) 0
#endif
diff --git a/contrib/libs/curl/lib/http_chunks.c b/contrib/libs/curl/lib/http_chunks.c
index fc586a7531..498481475c 100644
--- a/contrib/libs/curl/lib/http_chunks.c
+++ b/contrib/libs/curl/lib/http_chunks.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,7 +26,7 @@
#include "urldata.h" /* it includes http_chunks.h */
#include "sendf.h" /* for the client write stuff */
-#include "dynbuf.h"
+#include "dynbuf.h"
#include "content_encoding.h"
#include "http.h"
#include "non-ascii.h" /* for Curl_convert_to_network prototype */
@@ -93,7 +93,7 @@ void Curl_httpchunk_init(struct connectdata *conn)
chunk->hexindex = 0; /* start at 0 */
chunk->dataleft = 0; /* no data left yet! */
chunk->state = CHUNK_HEX; /* we get hex first! */
- Curl_dyn_init(&conn->trailer, DYN_H1_TRAILER);
+ Curl_dyn_init(&conn->trailer, DYN_H1_TRAILER);
}
/*
@@ -110,8 +110,8 @@ void Curl_httpchunk_init(struct connectdata *conn)
CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
char *datap,
ssize_t datalen,
- ssize_t *wrotep,
- CURLcode *extrap)
+ ssize_t *wrotep,
+ CURLcode *extrap)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
@@ -127,10 +127,10 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
chunk read process, to properly calculate the content length*/
if(data->set.http_te_skip && !k->ignorebody) {
result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, datalen);
- if(result) {
- *extrap = result;
- return CHUNKE_PASSTHRU_ERROR;
- }
+ if(result) {
+ *extrap = result;
+ return CHUNKE_PASSTHRU_ERROR;
+ }
}
while(length) {
@@ -200,10 +200,10 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
else
result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, piece);
- if(result) {
- *extrap = result;
- return CHUNKE_PASSTHRU_ERROR;
- }
+ if(result) {
+ *extrap = result;
+ return CHUNKE_PASSTHRU_ERROR;
+ }
}
*wrote += piece;
@@ -229,33 +229,33 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
case CHUNK_TRAILER:
if((*datap == 0x0d) || (*datap == 0x0a)) {
- char *tr = Curl_dyn_ptr(&conn->trailer);
+ char *tr = Curl_dyn_ptr(&conn->trailer);
/* this is the end of a trailer, but if the trailer was zero bytes
there was no trailer and we move on */
- if(tr) {
- size_t trlen;
- result = Curl_dyn_add(&conn->trailer, (char *)"\x0d\x0a");
- if(result)
- return CHUNKE_OUT_OF_MEMORY;
+ if(tr) {
+ size_t trlen;
+ result = Curl_dyn_add(&conn->trailer, (char *)"\x0d\x0a");
+ if(result)
+ return CHUNKE_OUT_OF_MEMORY;
- tr = Curl_dyn_ptr(&conn->trailer);
- trlen = Curl_dyn_len(&conn->trailer);
+ tr = Curl_dyn_ptr(&conn->trailer);
+ trlen = Curl_dyn_len(&conn->trailer);
/* Convert to host encoding before calling Curl_client_write */
- result = Curl_convert_from_network(conn->data, tr, trlen);
+ result = Curl_convert_from_network(conn->data, tr, trlen);
if(result)
/* Curl_convert_from_network calls failf if unsuccessful */
/* Treat it as a bad chunk */
return CHUNKE_BAD_CHUNK;
if(!data->set.http_te_skip) {
- result = Curl_client_write(conn, CLIENTWRITE_HEADER, tr, trlen);
- if(result) {
- *extrap = result;
- return CHUNKE_PASSTHRU_ERROR;
- }
+ result = Curl_client_write(conn, CLIENTWRITE_HEADER, tr, trlen);
+ if(result) {
+ *extrap = result;
+ return CHUNKE_PASSTHRU_ERROR;
+ }
}
- Curl_dyn_reset(&conn->trailer);
+ Curl_dyn_reset(&conn->trailer);
ch->state = CHUNK_TRAILER_CR;
if(*datap == 0x0a)
/* already on the LF */
@@ -268,9 +268,9 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
}
}
else {
- result = Curl_dyn_addn(&conn->trailer, datap, 1);
- if(result)
- return CHUNKE_OUT_OF_MEMORY;
+ result = Curl_dyn_addn(&conn->trailer, datap, 1);
+ if(result)
+ return CHUNKE_OUT_OF_MEMORY;
}
datap++;
length--;
@@ -331,9 +331,9 @@ const char *Curl_chunked_strerror(CHUNKcode code)
return "Illegal or missing hexadecimal sequence";
case CHUNKE_BAD_CHUNK:
return "Malformed encoding found";
- case CHUNKE_PASSTHRU_ERROR:
- DEBUGASSERT(0); /* never used */
- return "";
+ case CHUNKE_PASSTHRU_ERROR:
+ DEBUGASSERT(0); /* never used */
+ return "";
case CHUNKE_BAD_ENCODING:
return "Bad content-encoding found";
case CHUNKE_OUT_OF_MEMORY:
diff --git a/contrib/libs/curl/lib/http_chunks.h b/contrib/libs/curl/lib/http_chunks.h
index 92f399881e..c8f072a2de 100644
--- a/contrib/libs/curl/lib/http_chunks.h
+++ b/contrib/libs/curl/lib/http_chunks.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -21,9 +21,9 @@
* KIND, either express or implied.
*
***************************************************************************/
-
-struct connectdata;
-
+
+struct connectdata;
+
/*
* The longest possible hexadecimal number we support in a chunked transfer.
* Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul()
@@ -76,7 +76,7 @@ typedef enum {
CHUNKE_BAD_CHUNK,
CHUNKE_BAD_ENCODING,
CHUNKE_OUT_OF_MEMORY,
- CHUNKE_PASSTHRU_ERROR, /* Curl_httpchunk_read() returns a CURLcode to use */
+ CHUNKE_PASSTHRU_ERROR, /* Curl_httpchunk_read() returns a CURLcode to use */
CHUNKE_LAST
} CHUNKcode;
@@ -90,10 +90,10 @@ struct Curl_chunker {
size_t dataleft; /* untouched data amount at the end of the last buffer */
};
-/* The following functions are defined in http_chunks.c */
-void Curl_httpchunk_init(struct connectdata *conn);
-CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
- ssize_t length, ssize_t *wrote,
- CURLcode *passthru);
-
+/* The following functions are defined in http_chunks.c */
+void Curl_httpchunk_init(struct connectdata *conn);
+CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
+ ssize_t length, ssize_t *wrote,
+ CURLcode *passthru);
+
#endif /* HEADER_CURL_HTTP_CHUNKS_H */
diff --git a/contrib/libs/curl/lib/http_digest.c b/contrib/libs/curl/lib/http_digest.c
index f771415065..dfa40dcb61 100644
--- a/contrib/libs/curl/lib/http_digest.c
+++ b/contrib/libs/curl/lib/http_digest.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -94,19 +94,19 @@ CURLcode Curl_output_digest(struct connectdata *conn,
struct auth *authp;
if(proxy) {
-#ifdef CURL_DISABLE_PROXY
- return CURLE_NOT_BUILT_IN;
-#else
+#ifdef CURL_DISABLE_PROXY
+ return CURLE_NOT_BUILT_IN;
+#else
digest = &data->state.proxydigest;
- allocuserpwd = &data->state.aptr.proxyuserpwd;
+ allocuserpwd = &data->state.aptr.proxyuserpwd;
userp = conn->http_proxy.user;
passwdp = conn->http_proxy.passwd;
authp = &data->state.authproxy;
-#endif
+#endif
}
else {
digest = &data->state.digest;
- allocuserpwd = &data->state.aptr.userpwd;
+ allocuserpwd = &data->state.aptr.userpwd;
userp = conn->user;
passwdp = conn->passwd;
authp = &data->state.authhost;
diff --git a/contrib/libs/curl/lib/http_digest.h b/contrib/libs/curl/lib/http_digest.h
index 2589386899..f7001edec1 100644
--- a/contrib/libs/curl/lib/http_digest.h
+++ b/contrib/libs/curl/lib/http_digest.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/http_negotiate.c b/contrib/libs/curl/lib/http_negotiate.c
index 4238987cb1..872d172fc6 100644
--- a/contrib/libs/curl/lib/http_negotiate.c
+++ b/contrib/libs/curl/lib/http_negotiate.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -52,7 +52,7 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
curlnegotiate state;
if(proxy) {
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
userp = conn->http_proxy.user;
passwdp = conn->http_proxy.passwd;
service = data->set.str[STRING_PROXY_SERVICE_NAME] ?
@@ -60,9 +60,9 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
host = conn->http_proxy.host.name;
neg_ctx = &conn->proxyneg;
state = conn->proxy_negotiate_state;
-#else
- return CURLE_NOT_BUILT_IN;
-#endif
+#else
+ return CURLE_NOT_BUILT_IN;
+#endif
}
else {
userp = conn->user;
@@ -123,8 +123,8 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
struct auth *authp = proxy ? &conn->data->state.authproxy :
&conn->data->state.authhost;
curlnegotiate *state = proxy ? &conn->proxy_negotiate_state :
- &conn->http_negotiate_state;
- struct Curl_easy *data = conn->data;
+ &conn->http_negotiate_state;
+ struct Curl_easy *data = conn->data;
char *base64 = NULL;
size_t len = 0;
char *userp;
@@ -169,15 +169,15 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
return result;
userp = aprintf("%sAuthorization: Negotiate %s\r\n", proxy ? "Proxy-" : "",
- base64);
+ base64);
if(proxy) {
- Curl_safefree(data->state.aptr.proxyuserpwd);
- data->state.aptr.proxyuserpwd = userp;
+ Curl_safefree(data->state.aptr.proxyuserpwd);
+ data->state.aptr.proxyuserpwd = userp;
}
else {
- Curl_safefree(data->state.aptr.userpwd);
- data->state.aptr.userpwd = userp;
+ Curl_safefree(data->state.aptr.userpwd);
+ data->state.aptr.userpwd = userp;
}
free(base64);
diff --git a/contrib/libs/curl/lib/http_negotiate.h b/contrib/libs/curl/lib/http_negotiate.h
index 87bf394ae0..cf1d007dce 100644
--- a/contrib/libs/curl/lib/http_negotiate.h
+++ b/contrib/libs/curl/lib/http_negotiate.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -33,8 +33,8 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy);
void Curl_http_auth_cleanup_negotiate(struct connectdata *conn);
-#else /* !CURL_DISABLE_HTTP && USE_SPNEGO */
-#define Curl_http_auth_cleanup_negotiate(x)
-#endif
+#else /* !CURL_DISABLE_HTTP && USE_SPNEGO */
+#define Curl_http_auth_cleanup_negotiate(x)
+#endif
#endif /* HEADER_CURL_HTTP_NEGOTIATE_H */
diff --git a/contrib/libs/curl/lib/http_ntlm.c b/contrib/libs/curl/lib/http_ntlm.c
index 684f01bc14..91e1d1f714 100644
--- a/contrib/libs/curl/lib/http_ntlm.c
+++ b/contrib/libs/curl/lib/http_ntlm.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -44,7 +44,7 @@
/* SSL backend-specific #if branches in this file must be kept in the order
documented in curl_ntlm_core. */
-#if defined(USE_WINDOWS_SSPI)
+#if defined(USE_WINDOWS_SSPI)
#include "curl_sspi.h"
#endif
@@ -131,15 +131,15 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy)
struct ntlmdata *ntlm;
curlntlm *state;
struct auth *authp;
- struct Curl_easy *data = conn->data;
+ struct Curl_easy *data = conn->data;
+
-
DEBUGASSERT(conn);
- DEBUGASSERT(data);
+ DEBUGASSERT(data);
if(proxy) {
-#ifndef CURL_DISABLE_PROXY
- allocuserpwd = &data->state.aptr.proxyuserpwd;
+#ifndef CURL_DISABLE_PROXY
+ allocuserpwd = &data->state.aptr.proxyuserpwd;
userp = conn->http_proxy.user;
passwdp = conn->http_proxy.passwd;
service = conn->data->set.str[STRING_PROXY_SERVICE_NAME] ?
@@ -148,12 +148,12 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy)
ntlm = &conn->proxyntlm;
state = &conn->proxy_ntlm_state;
authp = &conn->data->state.authproxy;
-#else
- return CURLE_NOT_BUILT_IN;
-#endif
+#else
+ return CURLE_NOT_BUILT_IN;
+#endif
}
else {
- allocuserpwd = &data->state.aptr.userpwd;
+ allocuserpwd = &data->state.aptr.userpwd;
userp = conn->user;
passwdp = conn->passwd;
service = conn->data->set.str[STRING_SERVICE_NAME] ?
diff --git a/contrib/libs/curl/lib/http_ntlm.h b/contrib/libs/curl/lib/http_ntlm.h
index 791cc6dfc1..5ddf538727 100644
--- a/contrib/libs/curl/lib/http_ntlm.h
+++ b/contrib/libs/curl/lib/http_ntlm.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -35,8 +35,8 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
void Curl_http_auth_cleanup_ntlm(struct connectdata *conn);
-#else /* !CURL_DISABLE_HTTP && USE_NTLM */
-#define Curl_http_auth_cleanup_ntlm(x)
-#endif
+#else /* !CURL_DISABLE_HTTP && USE_NTLM */
+#define Curl_http_auth_cleanup_ntlm(x)
+#endif
#endif /* HEADER_CURL_HTTP_NTLM_H */
diff --git a/contrib/libs/curl/lib/http_proxy.c b/contrib/libs/curl/lib/http_proxy.c
index efc40813cb..4242251219 100644
--- a/contrib/libs/curl/lib/http_proxy.c
+++ b/contrib/libs/curl/lib/http_proxy.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -58,9 +58,9 @@ static CURLcode https_proxy_connect(struct connectdata *conn, int sockindex)
Curl_ssl_connect_nonblocking(conn, sockindex,
&conn->bits.proxy_ssl_connected[sockindex]);
if(result)
- /* a failed connection is marked for closure to prevent (bad) re-use or
- similar */
- connclose(conn, "TLS handshake failed");
+ /* a failed connection is marked for closure to prevent (bad) re-use or
+ similar */
+ connclose(conn, "TLS handshake failed");
}
return result;
#else
@@ -72,7 +72,7 @@ static CURLcode https_proxy_connect(struct connectdata *conn, int sockindex)
CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex)
{
- struct Curl_easy *data = conn->data;
+ struct Curl_easy *data = conn->data;
if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) {
const CURLcode result = https_proxy_connect(conn, sockindex);
if(result)
@@ -102,9 +102,9 @@ CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex)
* This function might be called several times in the multi interface case
* if the proxy's CONNECT response is not instant.
*/
- prot_save = conn->data->req.p.http;
+ prot_save = conn->data->req.p.http;
memset(&http_proxy, 0, sizeof(http_proxy));
- conn->data->req.p.http = &http_proxy;
+ conn->data->req.p.http = &http_proxy;
connkeep(conn, "HTTP proxy CONNECT");
/* for the secondary socket (FTP), use the "connect to host"
@@ -125,10 +125,10 @@ CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex)
else
remote_port = conn->remote_port;
result = Curl_proxyCONNECT(conn, sockindex, hostname, remote_port);
- conn->data->req.p.http = prot_save;
+ conn->data->req.p.http = prot_save;
if(CURLE_OK != result)
return result;
- Curl_safefree(data->state.aptr.proxyuserpwd);
+ Curl_safefree(data->state.aptr.proxyuserpwd);
#else
return CURLE_NOT_BUILT_IN;
#endif
@@ -159,15 +159,15 @@ static CURLcode connect_init(struct connectdata *conn, bool reinit)
return CURLE_OUT_OF_MEMORY;
infof(conn->data, "allocate connect buffer!\n");
conn->connect_state = s;
- Curl_dyn_init(&s->rcvbuf, DYN_PROXY_CONNECT_HEADERS);
+ Curl_dyn_init(&s->rcvbuf, DYN_PROXY_CONNECT_HEADERS);
}
else {
DEBUGASSERT(conn->connect_state);
s = conn->connect_state;
- Curl_dyn_reset(&s->rcvbuf);
+ Curl_dyn_reset(&s->rcvbuf);
}
s->tunnel_state = TUNNEL_INIT;
- s->keepon = KEEPON_CONNECT;
+ s->keepon = KEEPON_CONNECT;
s->cl = 0;
s->close_connection = FALSE;
return CURLE_OK;
@@ -177,7 +177,7 @@ static void connect_done(struct connectdata *conn)
{
struct http_connect_state *s = conn->connect_state;
s->tunnel_state = TUNNEL_COMPLETE;
- Curl_dyn_free(&s->rcvbuf);
+ Curl_dyn_free(&s->rcvbuf);
infof(conn->data, "CONNECT phase completed!\n");
}
@@ -192,8 +192,8 @@ static CURLcode CONNECT(struct connectdata *conn,
CURLcode result;
curl_socket_t tunnelsocket = conn->sock[sockindex];
struct http_connect_state *s = conn->connect_state;
- char *linep;
- size_t perline;
+ char *linep;
+ size_t perline;
#define SELECT_OK 0
#define SELECT_ERROR 1
@@ -208,7 +208,7 @@ static CURLcode CONNECT(struct connectdata *conn,
if(TUNNEL_INIT == s->tunnel_state) {
/* BEGIN CONNECT PHASE */
char *host_port;
- struct dynbuf req;
+ struct dynbuf req;
infof(data, "Establish HTTP proxy tunnel to %s:%d\n",
hostname, remote_port);
@@ -220,12 +220,12 @@ static CURLcode CONNECT(struct connectdata *conn,
data->req.newurl = NULL;
host_port = aprintf("%s:%d", hostname, remote_port);
- if(!host_port)
+ if(!host_port)
return CURLE_OUT_OF_MEMORY;
- /* initialize a dynamic send-buffer */
- Curl_dyn_init(&req, DYN_HTTP_REQUEST);
-
+ /* initialize a dynamic send-buffer */
+ Curl_dyn_init(&req, DYN_HTTP_REQUEST);
+
/* Setup the proxy-authorization header, if any */
result = Curl_http_output_auth(conn, "CONNECT", host_port, TRUE);
@@ -235,8 +235,8 @@ static CURLcode CONNECT(struct connectdata *conn,
char *host = NULL;
const char *proxyconn = "";
const char *useragent = "";
- const char *httpv =
- (conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? "1.0" : "1.1";
+ const char *httpv =
+ (conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? "1.0" : "1.1";
bool ipv6_ip = conn->bits.ipv6_ip;
char *hostheader;
@@ -247,7 +247,7 @@ static CURLcode CONNECT(struct connectdata *conn,
aprintf("%s%s%s:%d", ipv6_ip?"[":"", hostname, ipv6_ip?"]":"",
remote_port);
if(!hostheader) {
- Curl_dyn_free(&req);
+ Curl_dyn_free(&req);
return CURLE_OUT_OF_MEMORY;
}
@@ -255,7 +255,7 @@ static CURLcode CONNECT(struct connectdata *conn,
host = aprintf("Host: %s\r\n", hostheader);
if(!host) {
free(hostheader);
- Curl_dyn_free(&req);
+ Curl_dyn_free(&req);
return CURLE_OUT_OF_MEMORY;
}
}
@@ -264,45 +264,45 @@ static CURLcode CONNECT(struct connectdata *conn,
if(!Curl_checkProxyheaders(conn, "User-Agent") &&
data->set.str[STRING_USERAGENT])
- useragent = data->state.aptr.uagent;
+ useragent = data->state.aptr.uagent;
result =
- Curl_dyn_addf(&req,
- "CONNECT %s HTTP/%s\r\n"
- "%s" /* Host: */
- "%s" /* Proxy-Authorization */
- "%s" /* User-Agent */
- "%s", /* Proxy-Connection */
- hostheader,
- httpv,
- host?host:"",
- data->state.aptr.proxyuserpwd?
- data->state.aptr.proxyuserpwd:"",
- useragent,
- proxyconn);
+ Curl_dyn_addf(&req,
+ "CONNECT %s HTTP/%s\r\n"
+ "%s" /* Host: */
+ "%s" /* Proxy-Authorization */
+ "%s" /* User-Agent */
+ "%s", /* Proxy-Connection */
+ hostheader,
+ httpv,
+ host?host:"",
+ data->state.aptr.proxyuserpwd?
+ data->state.aptr.proxyuserpwd:"",
+ useragent,
+ proxyconn);
if(host)
free(host);
free(hostheader);
if(!result)
- result = Curl_add_custom_headers(conn, TRUE, &req);
+ result = Curl_add_custom_headers(conn, TRUE, &req);
if(!result)
/* CRLF terminate the request */
- result = Curl_dyn_add(&req, "\r\n");
+ result = Curl_dyn_add(&req, "\r\n");
if(!result) {
/* Send the connect request to the proxy */
/* BLOCKING */
- result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
- sockindex);
+ result = Curl_buffer_send(&req, conn, &data->info.request_size, 0,
+ sockindex);
}
if(result)
failf(data, "Failed sending CONNECT to proxy");
}
- Curl_dyn_free(&req);
+ Curl_dyn_free(&req);
if(result)
return result;
@@ -324,13 +324,13 @@ static CURLcode CONNECT(struct connectdata *conn,
{ /* READING RESPONSE PHASE */
int error = SELECT_OK;
- while(s->keepon) {
+ while(s->keepon) {
ssize_t gotbytes;
- char byte;
+ char byte;
/* Read one byte at a time to avoid a race condition. Wait at most one
second before looping to ensure continuous pgrsUpdates. */
- result = Curl_read(conn, tunnelsocket, &byte, 1, &gotbytes);
+ result = Curl_read(conn, tunnelsocket, &byte, 1, &gotbytes);
if(result == CURLE_AGAIN)
/* socket buffer drained, return */
return CURLE_OK;
@@ -339,7 +339,7 @@ static CURLcode CONNECT(struct connectdata *conn,
return CURLE_ABORTED_BY_CALLBACK;
if(result) {
- s->keepon = KEEPON_DONE;
+ s->keepon = KEEPON_DONE;
break;
}
else if(gotbytes <= 0) {
@@ -353,11 +353,11 @@ static CURLcode CONNECT(struct connectdata *conn,
error = SELECT_ERROR;
failf(data, "Proxy CONNECT aborted");
}
- s->keepon = KEEPON_DONE;
+ s->keepon = KEEPON_DONE;
break;
}
- if(s->keepon == KEEPON_IGNORE) {
+ if(s->keepon == KEEPON_IGNORE) {
/* This means we are currently ignoring a response-body */
if(s->cl) {
@@ -365,7 +365,7 @@ static CURLcode CONNECT(struct connectdata *conn,
and make sure to break out of the loop when we're done! */
s->cl--;
if(s->cl <= 0) {
- s->keepon = KEEPON_DONE;
+ s->keepon = KEEPON_DONE;
s->tunnel_state = TUNNEL_COMPLETE;
break;
}
@@ -374,16 +374,16 @@ static CURLcode CONNECT(struct connectdata *conn,
/* chunked-encoded body, so we need to do the chunked dance
properly to know when the end of the body is reached */
CHUNKcode r;
- CURLcode extra;
+ CURLcode extra;
ssize_t tookcareof = 0;
/* now parse the chunked piece of data so that we can
properly tell when the stream ends */
- r = Curl_httpchunk_read(conn, &byte, 1, &tookcareof, &extra);
+ r = Curl_httpchunk_read(conn, &byte, 1, &tookcareof, &extra);
if(r == CHUNKE_STOP) {
/* we're done reading chunks! */
infof(data, "chunk reading DONE\n");
- s->keepon = KEEPON_DONE;
+ s->keepon = KEEPON_DONE;
/* we did the full CONNECT treatment, go COMPLETE */
s->tunnel_state = TUNNEL_COMPLETE;
}
@@ -391,26 +391,26 @@ static CURLcode CONNECT(struct connectdata *conn,
continue;
}
- if(Curl_dyn_addn(&s->rcvbuf, &byte, 1)) {
- failf(data, "CONNECT response too large!");
- return CURLE_RECV_ERROR;
- }
+ if(Curl_dyn_addn(&s->rcvbuf, &byte, 1)) {
+ failf(data, "CONNECT response too large!");
+ return CURLE_RECV_ERROR;
+ }
/* if this is not the end of a header line then continue */
- if(byte != 0x0a)
+ if(byte != 0x0a)
continue;
- linep = Curl_dyn_ptr(&s->rcvbuf);
- perline = Curl_dyn_len(&s->rcvbuf); /* amount of bytes in this line */
-
+ linep = Curl_dyn_ptr(&s->rcvbuf);
+ perline = Curl_dyn_len(&s->rcvbuf); /* amount of bytes in this line */
+
/* convert from the network encoding */
- result = Curl_convert_from_network(data, linep, perline);
+ result = Curl_convert_from_network(data, linep, perline);
/* Curl_convert_from_network calls failf if unsuccessful */
if(result)
return result;
/* output debug if that is requested */
- Curl_debug(data, CURLINFO_HEADER_IN, linep, perline);
+ Curl_debug(data, CURLINFO_HEADER_IN, linep, perline);
if(!data->set.suppress_connect_headers) {
/* send the header to the callback */
@@ -418,26 +418,26 @@ static CURLcode CONNECT(struct connectdata *conn,
if(data->set.include_header)
writetype |= CLIENTWRITE_BODY;
- result = Curl_client_write(conn, writetype, linep, perline);
+ result = Curl_client_write(conn, writetype, linep, perline);
if(result)
return result;
}
- data->info.header_size += (long)perline;
+ data->info.header_size += (long)perline;
/* Newlines are CRLF, so the CR is ignored as the line isn't
really terminated until the LF comes. Treat a following CR
as end-of-headers as well.*/
- if(('\r' == linep[0]) ||
- ('\n' == linep[0])) {
+ if(('\r' == linep[0]) ||
+ ('\n' == linep[0])) {
/* end of response-headers from the proxy */
-
+
if((407 == k->httpcode) && !data->state.authproblem) {
/* If we get a 407 response code with content length
when we have no auth problem, we must ignore the
whole response-body */
- s->keepon = KEEPON_IGNORE;
+ s->keepon = KEEPON_IGNORE;
if(s->cl) {
infof(data, "Ignore %" CURL_FORMAT_CURL_OFF_T
@@ -445,27 +445,27 @@ static CURLcode CONNECT(struct connectdata *conn,
}
else if(s->chunked_encoding) {
CHUNKcode r;
- CURLcode extra;
+ CURLcode extra;
infof(data, "Ignore chunked response-body\n");
- /* We set ignorebody true here since the chunked decoder
- function will acknowledge that. Pay attention so that this is
- cleared again when this function returns! */
+ /* We set ignorebody true here since the chunked decoder
+ function will acknowledge that. Pay attention so that this is
+ cleared again when this function returns! */
k->ignorebody = TRUE;
- if(linep[1] == '\n')
- /* this can only be a LF if the letter at index 0 was a CR */
- linep++;
+ if(linep[1] == '\n')
+ /* this can only be a LF if the letter at index 0 was a CR */
+ linep++;
- /* now parse the chunked piece of data so that we can properly
- tell when the stream ends */
- r = Curl_httpchunk_read(conn, linep + 1, 1, &gotbytes,
- &extra);
+ /* now parse the chunked piece of data so that we can properly
+ tell when the stream ends */
+ r = Curl_httpchunk_read(conn, linep + 1, 1, &gotbytes,
+ &extra);
if(r == CHUNKE_STOP) {
/* we're done reading chunks! */
infof(data, "chunk reading DONE\n");
- s->keepon = KEEPON_DONE;
+ s->keepon = KEEPON_DONE;
/* we did the full CONNECT treatment, go to COMPLETE */
s->tunnel_state = TUNNEL_COMPLETE;
}
@@ -474,24 +474,24 @@ static CURLcode CONNECT(struct connectdata *conn,
/* without content-length or chunked encoding, we
can't keep the connection alive since the close is
the end signal so we bail out at once instead */
- s->keepon = KEEPON_DONE;
+ s->keepon = KEEPON_DONE;
}
}
else
- s->keepon = KEEPON_DONE;
+ s->keepon = KEEPON_DONE;
if(!s->cl)
/* we did the full CONNECT treatment, go to COMPLETE */
s->tunnel_state = TUNNEL_COMPLETE;
continue;
}
- if((checkprefix("WWW-Authenticate:", linep) &&
+ if((checkprefix("WWW-Authenticate:", linep) &&
(401 == k->httpcode)) ||
- (checkprefix("Proxy-authenticate:", linep) &&
+ (checkprefix("Proxy-authenticate:", linep) &&
(407 == k->httpcode))) {
bool proxy = (k->httpcode == 407) ? TRUE : FALSE;
- char *auth = Curl_copy_header_value(linep);
+ char *auth = Curl_copy_header_value(linep);
if(!auth)
return CURLE_OUT_OF_MEMORY;
@@ -502,7 +502,7 @@ static CURLcode CONNECT(struct connectdata *conn,
if(result)
return result;
}
- else if(checkprefix("Content-Length:", linep)) {
+ else if(checkprefix("Content-Length:", linep)) {
if(k->httpcode/100 == 2) {
/* A client MUST ignore any Content-Length or Transfer-Encoding
header fields received in a successful response to CONNECT.
@@ -511,13 +511,13 @@ static CURLcode CONNECT(struct connectdata *conn,
k->httpcode);
}
else {
- (void)curlx_strtoofft(linep +
+ (void)curlx_strtoofft(linep +
strlen("Content-Length:"), NULL, 10, &s->cl);
}
}
- else if(Curl_compareheader(linep, "Connection:", "close"))
+ else if(Curl_compareheader(linep, "Connection:", "close"))
s->close_connection = TRUE;
- else if(checkprefix("Transfer-Encoding:", linep)) {
+ else if(checkprefix("Transfer-Encoding:", linep)) {
if(k->httpcode/100 == 2) {
/* A client MUST ignore any Content-Length or Transfer-Encoding
header fields received in a successful response to CONNECT.
@@ -525,7 +525,7 @@ static CURLcode CONNECT(struct connectdata *conn,
infof(data, "Ignoring Transfer-Encoding in "
"CONNECT %03d response\n", k->httpcode);
}
- else if(Curl_compareheader(linep,
+ else if(Curl_compareheader(linep,
"Transfer-Encoding:", "chunked")) {
infof(data, "CONNECT responded chunked\n");
s->chunked_encoding = TRUE;
@@ -533,16 +533,16 @@ static CURLcode CONNECT(struct connectdata *conn,
Curl_httpchunk_init(conn);
}
}
- else if(Curl_compareheader(linep, "Proxy-Connection:", "close"))
+ else if(Curl_compareheader(linep, "Proxy-Connection:", "close"))
s->close_connection = TRUE;
- else if(2 == sscanf(linep, "HTTP/1.%d %d",
+ else if(2 == sscanf(linep, "HTTP/1.%d %d",
&subversion,
&k->httpcode)) {
/* store the HTTP code from the proxy */
data->info.httpproxycode = k->httpcode;
}
- Curl_dyn_reset(&s->rcvbuf);
+ Curl_dyn_reset(&s->rcvbuf);
} /* while there's buffer left and loop is requested */
if(Curl_pgrsUpdate(conn))
@@ -603,7 +603,7 @@ static CURLcode CONNECT(struct connectdata *conn,
if(conn->bits.proxy_connect_closed)
/* this is not an error, just part of the connection negotiation */
return CURLE_OK;
- Curl_dyn_free(&s->rcvbuf);
+ Curl_dyn_free(&s->rcvbuf);
failf(data, "Received HTTP code %d from proxy after CONNECT",
data->req.httpcode);
return CURLE_RECV_ERROR;
@@ -614,8 +614,8 @@ static CURLcode CONNECT(struct connectdata *conn,
/* If a proxy-authorization header was used for the proxy, then we should
make sure that it isn't accidentally used for the document request
after we've connected. So let's free and clear it here. */
- Curl_safefree(data->state.aptr.proxyuserpwd);
- data->state.aptr.proxyuserpwd = NULL;
+ Curl_safefree(data->state.aptr.proxyuserpwd);
+ data->state.aptr.proxyuserpwd = NULL;
data->state.authproxy.done = TRUE;
data->state.authproxy.multipass = FALSE;
@@ -625,7 +625,7 @@ static CURLcode CONNECT(struct connectdata *conn,
data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */
conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the
document request */
- Curl_dyn_free(&s->rcvbuf);
+ Curl_dyn_free(&s->rcvbuf);
return CURLE_OK;
}
diff --git a/contrib/libs/curl/lib/http_proxy.h b/contrib/libs/curl/lib/http_proxy.h
index f835cfc1ed..a595e8b553 100644
--- a/contrib/libs/curl/lib/http_proxy.h
+++ b/contrib/libs/curl/lib/http_proxy.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -47,6 +47,6 @@ bool Curl_connect_ongoing(struct connectdata *conn);
#endif
void Curl_connect_free(struct Curl_easy *data);
-void Curl_connect_done(struct Curl_easy *data);
+void Curl_connect_done(struct Curl_easy *data);
#endif /* HEADER_CURL_HTTP_PROXY_H */
diff --git a/contrib/libs/curl/lib/idn_win32.c b/contrib/libs/curl/lib/idn_win32.c
index 1474faefc7..1d475a4eff 100644
--- a/contrib/libs/curl/lib/idn_win32.c
+++ b/contrib/libs/curl/lib/idn_win32.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -72,13 +72,13 @@ bool curl_win32_idn_to_ascii(const char *in, char **out)
{
bool success = FALSE;
- wchar_t *in_w = curlx_convert_UTF8_to_wchar(in);
+ wchar_t *in_w = curlx_convert_UTF8_to_wchar(in);
if(in_w) {
wchar_t punycode[IDN_MAX_LENGTH];
int chars = IdnToAscii(0, in_w, -1, punycode, IDN_MAX_LENGTH);
free(in_w);
if(chars) {
- *out = curlx_convert_wchar_to_UTF8(punycode);
+ *out = curlx_convert_wchar_to_UTF8(punycode);
if(*out)
success = TRUE;
}
@@ -91,7 +91,7 @@ bool curl_win32_ascii_to_idn(const char *in, char **out)
{
bool success = FALSE;
- wchar_t *in_w = curlx_convert_UTF8_to_wchar(in);
+ wchar_t *in_w = curlx_convert_UTF8_to_wchar(in);
if(in_w) {
size_t in_len = wcslen(in_w) + 1;
wchar_t unicode[IDN_MAX_LENGTH];
@@ -99,7 +99,7 @@ bool curl_win32_ascii_to_idn(const char *in, char **out)
unicode, IDN_MAX_LENGTH);
free(in_w);
if(chars) {
- *out = curlx_convert_wchar_to_UTF8(unicode);
+ *out = curlx_convert_wchar_to_UTF8(unicode);
if(*out)
success = TRUE;
}
diff --git a/contrib/libs/curl/lib/if2ip.c b/contrib/libs/curl/lib/if2ip.c
index f6311c58c1..bf397aad45 100644
--- a/contrib/libs/curl/lib/if2ip.c
+++ b/contrib/libs/curl/lib/if2ip.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -115,7 +115,7 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
if(iface->ifa_addr->sa_family == af) {
if(strcasecompare(iface->ifa_name, interf)) {
void *addr;
- const char *ip;
+ const char *ip;
char scope[12] = "";
char ipstr[64];
#ifdef ENABLE_IPV6
@@ -126,11 +126,11 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
unsigned int ifscope = Curl_ipv6_scope(iface->ifa_addr);
if(ifscope != remote_scope) {
- /* We are interested only in interface addresses whose scope
- matches the remote address we want to connect to: global
- for global, link-local for link-local, etc... */
- if(res == IF2IP_NOT_FOUND)
- res = IF2IP_AF_NOT_SUPPORTED;
+ /* We are interested only in interface addresses whose scope
+ matches the remote address we want to connect to: global
+ for global, link-local for link-local, etc... */
+ if(res == IF2IP_NOT_FOUND)
+ res = IF2IP_AF_NOT_SUPPORTED;
continue;
}
@@ -150,15 +150,15 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
}
if(scopeid)
- msnprintf(scope, sizeof(scope), "%%%u", scopeid);
+ msnprintf(scope, sizeof(scope), "%%%u", scopeid);
#endif
}
else
#endif
addr =
- &((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr;
+ &((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr;
res = IF2IP_FOUND;
- ip = Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr));
+ ip = Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr));
msnprintf(buf, buf_size, "%s%s", ip, scope);
break;
}
@@ -187,7 +187,7 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
struct sockaddr_in *s;
curl_socket_t dummy;
size_t len;
- const char *r;
+ const char *r;
(void)remote_scope;
(void)local_scope_id;
@@ -217,11 +217,11 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
s = (struct sockaddr_in *)(void *)&req.ifr_addr;
memcpy(&in, &s->sin_addr, sizeof(in));
- r = Curl_inet_ntop(s->sin_family, &in, buf, buf_size);
+ r = Curl_inet_ntop(s->sin_family, &in, buf, buf_size);
sclose(dummy);
- if(!r)
- return IF2IP_NOT_FOUND;
+ if(!r)
+ return IF2IP_NOT_FOUND;
return IF2IP_FOUND;
}
diff --git a/contrib/libs/curl/lib/if2ip.h b/contrib/libs/curl/lib/if2ip.h
index 9070f72915..e074e476dc 100644
--- a/contrib/libs/curl/lib/if2ip.h
+++ b/contrib/libs/curl/lib/if2ip.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/imap.c b/contrib/libs/curl/lib/imap.c
index 815da5f5de..c6dd7a2323 100644
--- a/contrib/libs/curl/lib/imap.c
+++ b/contrib/libs/curl/lib/imap.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -132,7 +132,7 @@ const struct Curl_handler Curl_handler_imap = {
ZERO_NULL, /* connection_check */
PORT_IMAP, /* defport */
CURLPROTO_IMAP, /* protocol */
- CURLPROTO_IMAP, /* family */
+ CURLPROTO_IMAP, /* family */
PROTOPT_CLOSEACTION| /* flags */
PROTOPT_URLOPTIONS
};
@@ -160,7 +160,7 @@ const struct Curl_handler Curl_handler_imaps = {
ZERO_NULL, /* connection_check */
PORT_IMAPS, /* defport */
CURLPROTO_IMAPS, /* protocol */
- CURLPROTO_IMAP, /* family */
+ CURLPROTO_IMAP, /* family */
PROTOPT_CLOSEACTION | PROTOPT_SSL | /* flags */
PROTOPT_URLOPTIONS
};
@@ -189,7 +189,7 @@ static void imap_to_imaps(struct connectdata *conn)
conn->handler = &Curl_handler_imaps;
/* Set the connection's upgraded to TLS flag */
- conn->bits.tls_upgraded = TRUE;
+ conn->bits.tls_upgraded = TRUE;
}
#else
#define imap_to_imaps(x) Curl_nop_stmt
@@ -246,7 +246,7 @@ static bool imap_matchresp(const char *line, size_t len, const char *cmd)
static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
int *resp)
{
- struct IMAP *imap = conn->data->req.p.imap;
+ struct IMAP *imap = conn->data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
const char *id = imapc->resptag;
size_t id_len = strlen(id);
@@ -607,7 +607,7 @@ static CURLcode imap_perform_list(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.p.imap;
+ struct IMAP *imap = data->req.p.imap;
if(imap->custom)
/* Send the custom request */
@@ -642,7 +642,7 @@ static CURLcode imap_perform_select(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.p.imap;
+ struct IMAP *imap = data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
char *mailbox;
@@ -681,7 +681,7 @@ static CURLcode imap_perform_select(struct connectdata *conn)
static CURLcode imap_perform_fetch(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct IMAP *imap = conn->data->req.p.imap;
+ struct IMAP *imap = conn->data->req.p.imap;
/* Check we have a UID */
if(imap->uid) {
@@ -729,7 +729,7 @@ static CURLcode imap_perform_append(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.p.imap;
+ struct IMAP *imap = data->req.p.imap;
char *mailbox;
/* Check we have a mailbox */
@@ -799,7 +799,7 @@ static CURLcode imap_perform_append(struct connectdata *conn)
static CURLcode imap_perform_search(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct IMAP *imap = conn->data->req.p.imap;
+ struct IMAP *imap = conn->data->req.p.imap;
/* Check we have a query string */
if(!imap->query) {
@@ -1053,7 +1053,7 @@ static CURLcode imap_state_select_resp(struct connectdata *conn, int imapcode,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = conn->data->req.p.imap;
+ struct IMAP *imap = conn->data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
const char *line = data->state.buffer;
@@ -1178,9 +1178,9 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,
else {
/* IMAP download */
data->req.maxdownload = size;
- /* force a recv/send check of this connection, as the data might've been
- read off the socket already */
- data->conn->cselect_bits = CURL_CSELECT_IN;
+ /* force a recv/send check of this connection, as the data might've been
+ read off the socket already */
+ data->conn->cselect_bits = CURL_CSELECT_IN;
Curl_setup_transfer(data, FIRSTSOCKET, size, FALSE, -1);
}
}
@@ -1311,7 +1311,7 @@ static CURLcode imap_statemach_act(struct connectdata *conn)
break;
case IMAP_LIST:
- case IMAP_SEARCH:
+ case IMAP_SEARCH:
result = imap_state_listsearch_resp(conn, imapcode, imapc->state);
break;
@@ -1385,7 +1385,7 @@ static CURLcode imap_init(struct connectdata *conn)
struct Curl_easy *data = conn->data;
struct IMAP *imap;
- imap = data->req.p.imap = calloc(sizeof(struct IMAP), 1);
+ imap = data->req.p.imap = calloc(sizeof(struct IMAP), 1);
if(!imap)
result = CURLE_OUT_OF_MEMORY;
@@ -1429,9 +1429,9 @@ static CURLcode imap_connect(struct connectdata *conn, bool *done)
imapc->preftype = IMAP_TYPE_ANY;
Curl_sasl_init(&imapc->sasl, &saslimap);
- Curl_dyn_init(&imapc->dyn, DYN_IMAP_CMD);
+ Curl_dyn_init(&imapc->dyn, DYN_IMAP_CMD);
/* Initialise the pingpong layer */
- Curl_pp_setup(pp);
+ Curl_pp_setup(pp);
Curl_pp_init(pp);
/* Parse the URL options */
@@ -1464,7 +1464,7 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.p.imap;
+ struct IMAP *imap = data->req.p.imap;
(void)premature;
@@ -1524,7 +1524,7 @@ static CURLcode imap_perform(struct connectdata *conn, bool *connected,
/* This is IMAP and no proxy */
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.p.imap;
+ struct IMAP *imap = data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
bool selected = FALSE;
@@ -1633,7 +1633,7 @@ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection)
/* Disconnect from the server */
Curl_pp_disconnect(&imapc->pp);
- Curl_dyn_free(&imapc->dyn);
+ Curl_dyn_free(&imapc->dyn);
/* Cleanup the SASL module */
Curl_sasl_cleanup(conn, imapc->sasl.authused);
@@ -1648,7 +1648,7 @@ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection)
/* Call this when the DO phase has completed */
static CURLcode imap_dophase_done(struct connectdata *conn, bool connected)
{
- struct IMAP *imap = conn->data->req.p.imap;
+ struct IMAP *imap = conn->data->req.p.imap;
(void)connected;
@@ -1718,7 +1718,7 @@ static CURLcode imap_setup_connection(struct connectdata *conn)
return result;
/* Clear the TLS upgraded flag */
- conn->bits.tls_upgraded = FALSE;
+ conn->bits.tls_upgraded = FALSE;
return CURLE_OK;
}
@@ -1740,20 +1740,20 @@ static CURLcode imap_sendf(struct connectdata *conn, const char *fmt, ...)
/* Calculate the tag based on the connection ID and command ID */
msnprintf(imapc->resptag, sizeof(imapc->resptag), "%c%03d",
- 'A' + curlx_sltosi(conn->connection_id % 26),
- (++imapc->cmdid)%1000);
-
- /* start with a blank buffer */
- Curl_dyn_reset(&imapc->dyn);
-
- /* append tag + space + fmt */
- result = Curl_dyn_addf(&imapc->dyn, "%s %s", imapc->resptag, fmt);
- if(!result) {
- va_list ap;
- va_start(ap, fmt);
- result = Curl_pp_vsendf(&imapc->pp, Curl_dyn_ptr(&imapc->dyn), ap);
- va_end(ap);
- }
+ 'A' + curlx_sltosi(conn->connection_id % 26),
+ (++imapc->cmdid)%1000);
+
+ /* start with a blank buffer */
+ Curl_dyn_reset(&imapc->dyn);
+
+ /* append tag + space + fmt */
+ result = Curl_dyn_addf(&imapc->dyn, "%s %s", imapc->resptag, fmt);
+ if(!result) {
+ va_list ap;
+ va_start(ap, fmt);
+ result = Curl_pp_vsendf(&imapc->pp, Curl_dyn_ptr(&imapc->dyn), ap);
+ va_end(ap);
+ }
return result;
}
@@ -1945,7 +1945,7 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
/* The imap struct is already initialised in imap_connect() */
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.p.imap;
+ struct IMAP *imap = data->req.p.imap;
const char *begin = &data->state.up.path[1]; /* skip leading slash */
const char *ptr = begin;
@@ -1960,7 +1960,7 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
end--;
result = Curl_urldecode(data, begin, end - begin, &imap->mailbox, NULL,
- REJECT_CTRL);
+ REJECT_CTRL);
if(result)
return result;
}
@@ -1982,8 +1982,8 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
return CURLE_URL_MALFORMAT;
/* Decode the name parameter */
- result = Curl_urldecode(data, begin, ptr - begin, &name, NULL,
- REJECT_CTRL);
+ result = Curl_urldecode(data, begin, ptr - begin, &name, NULL,
+ REJECT_CTRL);
if(result)
return result;
@@ -1993,8 +1993,8 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
ptr++;
/* Decode the value parameter */
- result = Curl_urldecode(data, begin, ptr - begin, &value, &valuelen,
- REJECT_CTRL);
+ result = Curl_urldecode(data, begin, ptr - begin, &value, &valuelen,
+ REJECT_CTRL);
if(result) {
free(name);
return result;
@@ -2077,12 +2077,12 @@ static CURLcode imap_parse_custom_request(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.p.imap;
+ struct IMAP *imap = data->req.p.imap;
const char *custom = data->set.str[STRING_CUSTOMREQUEST];
if(custom) {
/* URL decode the custom request */
- result = Curl_urldecode(data, custom, 0, &imap->custom, NULL, REJECT_CTRL);
+ result = Curl_urldecode(data, custom, 0, &imap->custom, NULL, REJECT_CTRL);
/* Extract the parameters if specified */
if(!result) {
diff --git a/contrib/libs/curl/lib/imap.h b/contrib/libs/curl/lib/imap.h
index 3817de4437..ef6515d8c2 100644
--- a/contrib/libs/curl/lib/imap.h
+++ b/contrib/libs/curl/lib/imap.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2009 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2009 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -75,14 +75,14 @@ struct imap_conn {
bool preauth; /* Is this connection PREAUTH? */
struct SASL sasl; /* SASL-related parameters */
unsigned int preftype; /* Preferred authentication type */
- unsigned int cmdid; /* Last used command ID */
+ unsigned int cmdid; /* Last used command ID */
char resptag[5]; /* Response tag to wait for */
bool tls_supported; /* StartTLS capability supported by server */
bool login_disabled; /* LOGIN command disabled by server */
bool ir_supported; /* Initial response supported by server */
char *mailbox; /* The last selected mailbox */
char *mailbox_uidvalidity; /* UIDVALIDITY parsed from select response */
- struct dynbuf dyn; /* for the IMAP commands */
+ struct dynbuf dyn; /* for the IMAP commands */
};
extern const struct Curl_handler Curl_handler_imap;
diff --git a/contrib/libs/curl/lib/inet_ntop.c b/contrib/libs/curl/lib/inet_ntop.c
index 6ad88d7334..9a5af7f421 100644
--- a/contrib/libs/curl/lib/inet_ntop.c
+++ b/contrib/libs/curl/lib/inet_ntop.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1996-2019 Internet Software Consortium.
+ * Copyright (C) 1996-2019 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
diff --git a/contrib/libs/curl/lib/inet_ntop.h b/contrib/libs/curl/lib/inet_ntop.h
index dece4e1ed5..067632aaee 100644
--- a/contrib/libs/curl/lib/inet_ntop.h
+++ b/contrib/libs/curl/lib/inet_ntop.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/inet_pton.c b/contrib/libs/curl/lib/inet_pton.c
index 47826633aa..4923cae245 100644
--- a/contrib/libs/curl/lib/inet_pton.c
+++ b/contrib/libs/curl/lib/inet_pton.c
@@ -1,6 +1,6 @@
/* This is from the BIND 4.9.4 release, modified to compile by itself */
-/* Copyright (c) 1996 - 2020 by Internet Software Consortium.
+/* Copyright (c) 1996 - 2020 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -112,7 +112,7 @@ inet_pton4(const char *src, unsigned char *dst)
if(val > 255)
return (0);
*tp = (unsigned char)val;
- if(!saw_digit) {
+ if(!saw_digit) {
if(++octets > 4)
return (0);
saw_digit = 1;
diff --git a/contrib/libs/curl/lib/inet_pton.h b/contrib/libs/curl/lib/inet_pton.h
index 7a4baa560e..ec1237309f 100644
--- a/contrib/libs/curl/lib/inet_pton.h
+++ b/contrib/libs/curl/lib/inet_pton.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/krb5.c b/contrib/libs/curl/lib/krb5.c
index b8bf42311f..66394f4f30 100644
--- a/contrib/libs/curl/lib/krb5.c
+++ b/contrib/libs/curl/lib/krb5.c
@@ -2,7 +2,7 @@
*
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
- * Copyright (c) 2004 - 2020 Daniel Stenberg
+ * Copyright (c) 2004 - 2020 Daniel Stenberg
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,73 +45,73 @@
#include "ftp.h"
#include "curl_gssapi.h"
#include "sendf.h"
-#include "curl_krb5.h"
+#include "curl_krb5.h"
#include "warnless.h"
-#include "non-ascii.h"
-#include "strcase.h"
-#include "strdup.h"
+#include "non-ascii.h"
+#include "strcase.h"
+#include "strdup.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
-static CURLcode ftpsend(struct connectdata *conn, const char *cmd)
-{
- ssize_t bytes_written;
-#define SBUF_SIZE 1024
- char s[SBUF_SIZE];
- size_t write_len;
- char *sptr = s;
- CURLcode result = CURLE_OK;
-#ifdef HAVE_GSSAPI
- enum protection_level data_sec = conn->data_prot;
-#endif
-
- if(!cmd)
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
- write_len = strlen(cmd);
- if(!write_len || write_len > (sizeof(s) -3))
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
- memcpy(&s, cmd, write_len);
- strcpy(&s[write_len], "\r\n"); /* append a trailing CRLF */
- write_len += 2;
- bytes_written = 0;
-
- result = Curl_convert_to_network(conn->data, s, write_len);
- /* Curl_convert_to_network calls failf if unsuccessful */
- if(result)
- return result;
-
- for(;;) {
-#ifdef HAVE_GSSAPI
- conn->data_prot = PROT_CMD;
-#endif
- result = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
- &bytes_written);
-#ifdef HAVE_GSSAPI
- DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);
- conn->data_prot = data_sec;
-#endif
-
- if(result)
- break;
-
- Curl_debug(conn->data, CURLINFO_HEADER_OUT, sptr, (size_t)bytes_written);
-
- if(bytes_written != (ssize_t)write_len) {
- write_len -= bytes_written;
- sptr += bytes_written;
- }
- else
- break;
- }
-
- return result;
-}
-
+static CURLcode ftpsend(struct connectdata *conn, const char *cmd)
+{
+ ssize_t bytes_written;
+#define SBUF_SIZE 1024
+ char s[SBUF_SIZE];
+ size_t write_len;
+ char *sptr = s;
+ CURLcode result = CURLE_OK;
+#ifdef HAVE_GSSAPI
+ enum protection_level data_sec = conn->data_prot;
+#endif
+
+ if(!cmd)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
+ write_len = strlen(cmd);
+ if(!write_len || write_len > (sizeof(s) -3))
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
+ memcpy(&s, cmd, write_len);
+ strcpy(&s[write_len], "\r\n"); /* append a trailing CRLF */
+ write_len += 2;
+ bytes_written = 0;
+
+ result = Curl_convert_to_network(conn->data, s, write_len);
+ /* Curl_convert_to_network calls failf if unsuccessful */
+ if(result)
+ return result;
+
+ for(;;) {
+#ifdef HAVE_GSSAPI
+ conn->data_prot = PROT_CMD;
+#endif
+ result = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
+ &bytes_written);
+#ifdef HAVE_GSSAPI
+ DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);
+ conn->data_prot = data_sec;
+#endif
+
+ if(result)
+ break;
+
+ Curl_debug(conn->data, CURLINFO_HEADER_OUT, sptr, (size_t)bytes_written);
+
+ if(bytes_written != (ssize_t)write_len) {
+ write_len -= bytes_written;
+ sptr += bytes_written;
+ }
+ else
+ break;
+ }
+
+ return result;
+}
+
static int
krb5_init(void *app_data)
{
@@ -242,7 +242,7 @@ krb5_auth(void *app_data, struct connectdata *conn)
for(;;) {
/* this really shouldn't be repeated here, but can't help it */
if(service == srv_host) {
- result = ftpsend(conn, "AUTH GSSAPI");
+ result = ftpsend(conn, "AUTH GSSAPI");
if(result)
return -2;
@@ -319,7 +319,7 @@ krb5_auth(void *app_data, struct connectdata *conn)
cmd = aprintf("ADAT %s", p);
if(cmd)
- result = ftpsend(conn, cmd);
+ result = ftpsend(conn, cmd);
else
result = CURLE_OUT_OF_MEMORY;
@@ -385,524 +385,524 @@ static void krb5_end(void *app_data)
}
}
-static struct Curl_sec_client_mech Curl_krb5_client_mech = {
- "GSSAPI",
- sizeof(gss_ctx_id_t),
- krb5_init,
- krb5_auth,
- krb5_end,
- krb5_check_prot,
- krb5_overhead,
- krb5_encode,
- krb5_decode
+static struct Curl_sec_client_mech Curl_krb5_client_mech = {
+ "GSSAPI",
+ sizeof(gss_ctx_id_t),
+ krb5_init,
+ krb5_auth,
+ krb5_end,
+ krb5_check_prot,
+ krb5_overhead,
+ krb5_encode,
+ krb5_decode
+};
+
+static const struct {
+ enum protection_level level;
+ const char *name;
+} level_names[] = {
+ { PROT_CLEAR, "clear" },
+ { PROT_SAFE, "safe" },
+ { PROT_CONFIDENTIAL, "confidential" },
+ { PROT_PRIVATE, "private" }
};
-static const struct {
- enum protection_level level;
- const char *name;
-} level_names[] = {
- { PROT_CLEAR, "clear" },
- { PROT_SAFE, "safe" },
- { PROT_CONFIDENTIAL, "confidential" },
- { PROT_PRIVATE, "private" }
-};
-
-static enum protection_level
-name_to_level(const char *name)
-{
- int i;
- for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)
- if(checkprefix(name, level_names[i].name))
- return level_names[i].level;
- return PROT_NONE;
-}
-
-/* Convert a protocol |level| to its char representation.
- We take an int to catch programming mistakes. */
-static char level_to_char(int level)
-{
- switch(level) {
- case PROT_CLEAR:
- return 'C';
- case PROT_SAFE:
- return 'S';
- case PROT_CONFIDENTIAL:
- return 'E';
- case PROT_PRIVATE:
- return 'P';
- case PROT_CMD:
- /* Fall through */
- default:
- /* Those 2 cases should not be reached! */
- break;
- }
- DEBUGASSERT(0);
- /* Default to the most secure alternative. */
- return 'P';
-}
-
-/* Send an FTP command defined by |message| and the optional arguments. The
- function returns the ftp_code. If an error occurs, -1 is returned. */
-static int ftp_send_command(struct connectdata *conn, const char *message, ...)
-{
- int ftp_code;
- ssize_t nread = 0;
- va_list args;
- char print_buffer[50];
-
- va_start(args, message);
- mvsnprintf(print_buffer, sizeof(print_buffer), message, args);
- va_end(args);
-
- if(ftpsend(conn, print_buffer)) {
- ftp_code = -1;
- }
- else {
- if(Curl_GetFTPResponse(&nread, conn, &ftp_code))
- ftp_code = -1;
- }
-
- (void)nread; /* Unused */
- return ftp_code;
-}
-
-/* Read |len| from the socket |fd| and store it in |to|. Return a CURLcode
- saying whether an error occurred or CURLE_OK if |len| was read. */
-static CURLcode
-socket_read(curl_socket_t fd, void *to, size_t len)
-{
- char *to_p = to;
- CURLcode result;
- ssize_t nread = 0;
-
- while(len > 0) {
- result = Curl_read_plain(fd, to_p, len, &nread);
- if(!result) {
- len -= nread;
- to_p += nread;
- }
- else {
- if(result == CURLE_AGAIN)
- continue;
- return result;
- }
- }
- return CURLE_OK;
-}
-
-
-/* Write |len| bytes from the buffer |to| to the socket |fd|. Return a
- CURLcode saying whether an error occurred or CURLE_OK if |len| was
- written. */
-static CURLcode
-socket_write(struct connectdata *conn, curl_socket_t fd, const void *to,
- size_t len)
-{
- const char *to_p = to;
- CURLcode result;
- ssize_t written;
-
- while(len > 0) {
- result = Curl_write_plain(conn, fd, to_p, len, &written);
- if(!result) {
- len -= written;
- to_p += written;
- }
- else {
- if(result == CURLE_AGAIN)
- continue;
- return result;
- }
- }
- return CURLE_OK;
-}
-
-static CURLcode read_data(struct connectdata *conn,
- curl_socket_t fd,
- struct krb5buffer *buf)
-{
- int len;
- CURLcode result;
-
- result = socket_read(fd, &len, sizeof(len));
- if(result)
- return result;
-
- if(len) {
- /* only realloc if there was a length */
- len = ntohl(len);
- buf->data = Curl_saferealloc(buf->data, len);
- }
- if(!len || !buf->data)
- return CURLE_OUT_OF_MEMORY;
-
- result = socket_read(fd, buf->data, len);
- if(result)
- return result;
- buf->size = conn->mech->decode(conn->app_data, buf->data, len,
- conn->data_prot, conn);
- buf->index = 0;
- return CURLE_OK;
-}
-
-static size_t
-buffer_read(struct krb5buffer *buf, void *data, size_t len)
-{
- if(buf->size - buf->index < len)
- len = buf->size - buf->index;
- memcpy(data, (char *)buf->data + buf->index, len);
- buf->index += len;
- return len;
-}
-
-/* Matches Curl_recv signature */
-static ssize_t sec_recv(struct connectdata *conn, int sockindex,
- char *buffer, size_t len, CURLcode *err)
-{
- size_t bytes_read;
- size_t total_read = 0;
- curl_socket_t fd = conn->sock[sockindex];
-
- *err = CURLE_OK;
-
- /* Handle clear text response. */
- if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR)
- return sread(fd, buffer, len);
-
- if(conn->in_buffer.eof_flag) {
- conn->in_buffer.eof_flag = 0;
- return 0;
- }
-
- bytes_read = buffer_read(&conn->in_buffer, buffer, len);
- len -= bytes_read;
- total_read += bytes_read;
- buffer += bytes_read;
-
- while(len > 0) {
- if(read_data(conn, fd, &conn->in_buffer))
- return -1;
- if(conn->in_buffer.size == 0) {
- if(bytes_read > 0)
- conn->in_buffer.eof_flag = 1;
- return bytes_read;
- }
- bytes_read = buffer_read(&conn->in_buffer, buffer, len);
- len -= bytes_read;
- total_read += bytes_read;
- buffer += bytes_read;
- }
- return total_read;
-}
-
-/* Send |length| bytes from |from| to the |fd| socket taking care of encoding
- and negotiating with the server. |from| can be NULL. */
-static void do_sec_send(struct connectdata *conn, curl_socket_t fd,
- const char *from, int length)
-{
- int bytes, htonl_bytes; /* 32-bit integers for htonl */
- char *buffer = NULL;
- char *cmd_buffer;
- size_t cmd_size = 0;
- CURLcode error;
- enum protection_level prot_level = conn->data_prot;
- bool iscmd = (prot_level == PROT_CMD)?TRUE:FALSE;
-
- DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);
-
- if(iscmd) {
- if(!strncmp(from, "PASS ", 5) || !strncmp(from, "ACCT ", 5))
- prot_level = PROT_PRIVATE;
- else
- prot_level = conn->command_prot;
- }
- bytes = conn->mech->encode(conn->app_data, from, length, prot_level,
- (void **)&buffer);
- if(!buffer || bytes <= 0)
- return; /* error */
-
- if(iscmd) {
- error = Curl_base64_encode(conn->data, buffer, curlx_sitouz(bytes),
- &cmd_buffer, &cmd_size);
- if(error) {
- free(buffer);
- return; /* error */
- }
- if(cmd_size > 0) {
- static const char *enc = "ENC ";
- static const char *mic = "MIC ";
- if(prot_level == PROT_PRIVATE)
- socket_write(conn, fd, enc, 4);
- else
- socket_write(conn, fd, mic, 4);
-
- socket_write(conn, fd, cmd_buffer, cmd_size);
- socket_write(conn, fd, "\r\n", 2);
- infof(conn->data, "Send: %s%s\n", prot_level == PROT_PRIVATE?enc:mic,
- cmd_buffer);
- free(cmd_buffer);
- }
- }
- else {
- htonl_bytes = htonl(bytes);
- socket_write(conn, fd, &htonl_bytes, sizeof(htonl_bytes));
- socket_write(conn, fd, buffer, curlx_sitouz(bytes));
- }
- free(buffer);
-}
-
-static ssize_t sec_write(struct connectdata *conn, curl_socket_t fd,
- const char *buffer, size_t length)
-{
- ssize_t tx = 0, len = conn->buffer_size;
-
- len -= conn->mech->overhead(conn->app_data, conn->data_prot,
- curlx_sztosi(len));
- if(len <= 0)
- len = length;
- while(length) {
- if(length < (size_t)len)
- len = length;
-
- do_sec_send(conn, fd, buffer, curlx_sztosi(len));
- length -= len;
- buffer += len;
- tx += len;
- }
- return tx;
-}
-
-/* Matches Curl_send signature */
-static ssize_t sec_send(struct connectdata *conn, int sockindex,
- const void *buffer, size_t len, CURLcode *err)
-{
- curl_socket_t fd = conn->sock[sockindex];
- *err = CURLE_OK;
- return sec_write(conn, fd, buffer, len);
-}
-
-int Curl_sec_read_msg(struct connectdata *conn, char *buffer,
- enum protection_level level)
-{
- /* decoded_len should be size_t or ssize_t but conn->mech->decode returns an
- int */
- int decoded_len;
- char *buf;
- int ret_code = 0;
- size_t decoded_sz = 0;
- CURLcode error;
-
- if(!conn->mech)
- /* not inititalized, return error */
- return -1;
-
- DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
-
- error = Curl_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz);
- if(error || decoded_sz == 0)
- return -1;
-
- if(decoded_sz > (size_t)INT_MAX) {
- free(buf);
- return -1;
- }
- decoded_len = curlx_uztosi(decoded_sz);
-
- decoded_len = conn->mech->decode(conn->app_data, buf, decoded_len,
- level, conn);
- if(decoded_len <= 0) {
- free(buf);
- return -1;
- }
-
- {
- buf[decoded_len] = '\n';
- Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1);
- }
-
- buf[decoded_len] = '\0';
- if(decoded_len <= 3)
- /* suspiciously short */
- return 0;
-
- if(buf[3] != '-')
- /* safe to ignore return code */
- (void)sscanf(buf, "%d", &ret_code);
-
- if(buf[decoded_len - 1] == '\n')
- buf[decoded_len - 1] = '\0';
- strcpy(buffer, buf);
- free(buf);
- return ret_code;
-}
-
-static int sec_set_protection_level(struct connectdata *conn)
-{
- int code;
- enum protection_level level = conn->request_data_prot;
-
- DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
-
- if(!conn->sec_complete) {
- infof(conn->data, "Trying to change the protection level after the"
- " completion of the data exchange.\n");
- return -1;
- }
-
- /* Bail out if we try to set up the same level */
- if(conn->data_prot == level)
- return 0;
-
- if(level) {
- char *pbsz;
- static unsigned int buffer_size = 1 << 20; /* 1048576 */
-
- code = ftp_send_command(conn, "PBSZ %u", buffer_size);
- if(code < 0)
- return -1;
-
- if(code/100 != 2) {
- failf(conn->data, "Failed to set the protection's buffer size.");
- return -1;
- }
- conn->buffer_size = buffer_size;
-
- pbsz = strstr(conn->data->state.buffer, "PBSZ=");
- if(pbsz) {
- /* ignore return code, use default value if it fails */
- (void)sscanf(pbsz, "PBSZ=%u", &buffer_size);
- if(buffer_size < conn->buffer_size)
- conn->buffer_size = buffer_size;
- }
- }
-
- /* Now try to negiociate the protection level. */
- code = ftp_send_command(conn, "PROT %c", level_to_char(level));
-
- if(code < 0)
- return -1;
-
- if(code/100 != 2) {
- failf(conn->data, "Failed to set the protection level.");
- return -1;
- }
-
- conn->data_prot = level;
- if(level == PROT_PRIVATE)
- conn->command_prot = level;
-
- return 0;
-}
-
-int
-Curl_sec_request_prot(struct connectdata *conn, const char *level)
-{
- enum protection_level l = name_to_level(level);
- if(l == PROT_NONE)
- return -1;
- DEBUGASSERT(l > PROT_NONE && l < PROT_LAST);
- conn->request_data_prot = l;
- return 0;
-}
-
-static CURLcode choose_mech(struct connectdata *conn)
-{
- int ret;
- struct Curl_easy *data = conn->data;
- void *tmp_allocation;
- const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;
-
- tmp_allocation = realloc(conn->app_data, mech->size);
- if(tmp_allocation == NULL) {
- failf(data, "Failed realloc of size %zu", mech->size);
- mech = NULL;
- return CURLE_OUT_OF_MEMORY;
- }
- conn->app_data = tmp_allocation;
-
- if(mech->init) {
- ret = mech->init(conn->app_data);
- if(ret) {
- infof(data, "Failed initialization for %s. Skipping it.\n",
- mech->name);
- return CURLE_FAILED_INIT;
- }
- }
-
- infof(data, "Trying mechanism %s...\n", mech->name);
- ret = ftp_send_command(conn, "AUTH %s", mech->name);
- if(ret < 0)
- return CURLE_COULDNT_CONNECT;
-
- if(ret/100 != 3) {
- switch(ret) {
- case 504:
- infof(data, "Mechanism %s is not supported by the server (server "
- "returned ftp code: 504).\n", mech->name);
- break;
- case 534:
- infof(data, "Mechanism %s was rejected by the server (server returned "
- "ftp code: 534).\n", mech->name);
- break;
- default:
- if(ret/100 == 5) {
- infof(data, "server does not support the security extensions\n");
- return CURLE_USE_SSL_FAILED;
- }
- break;
- }
- return CURLE_LOGIN_DENIED;
- }
-
- /* Authenticate */
- ret = mech->auth(conn->app_data, conn);
-
- if(ret != AUTH_CONTINUE) {
- if(ret != AUTH_OK) {
- /* Mechanism has dumped the error to stderr, don't error here. */
- return CURLE_USE_SSL_FAILED;
- }
- DEBUGASSERT(ret == AUTH_OK);
-
- conn->mech = mech;
- conn->sec_complete = 1;
- conn->recv[FIRSTSOCKET] = sec_recv;
- conn->send[FIRSTSOCKET] = sec_send;
- conn->recv[SECONDARYSOCKET] = sec_recv;
- conn->send[SECONDARYSOCKET] = sec_send;
- conn->command_prot = PROT_SAFE;
- /* Set the requested protection level */
- /* BLOCKING */
- (void)sec_set_protection_level(conn);
- }
-
- return CURLE_OK;
-}
-
-CURLcode
-Curl_sec_login(struct connectdata *conn)
-{
- return choose_mech(conn);
-}
-
-
-void
-Curl_sec_end(struct connectdata *conn)
-{
- if(conn->mech != NULL && conn->mech->end)
- conn->mech->end(conn->app_data);
- free(conn->app_data);
- conn->app_data = NULL;
- if(conn->in_buffer.data) {
- free(conn->in_buffer.data);
- conn->in_buffer.data = NULL;
- conn->in_buffer.size = 0;
- conn->in_buffer.index = 0;
- conn->in_buffer.eof_flag = 0;
- }
- conn->sec_complete = 0;
- conn->data_prot = PROT_CLEAR;
- conn->mech = NULL;
-}
-
+static enum protection_level
+name_to_level(const char *name)
+{
+ int i;
+ for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)
+ if(checkprefix(name, level_names[i].name))
+ return level_names[i].level;
+ return PROT_NONE;
+}
+
+/* Convert a protocol |level| to its char representation.
+ We take an int to catch programming mistakes. */
+static char level_to_char(int level)
+{
+ switch(level) {
+ case PROT_CLEAR:
+ return 'C';
+ case PROT_SAFE:
+ return 'S';
+ case PROT_CONFIDENTIAL:
+ return 'E';
+ case PROT_PRIVATE:
+ return 'P';
+ case PROT_CMD:
+ /* Fall through */
+ default:
+ /* Those 2 cases should not be reached! */
+ break;
+ }
+ DEBUGASSERT(0);
+ /* Default to the most secure alternative. */
+ return 'P';
+}
+
+/* Send an FTP command defined by |message| and the optional arguments. The
+ function returns the ftp_code. If an error occurs, -1 is returned. */
+static int ftp_send_command(struct connectdata *conn, const char *message, ...)
+{
+ int ftp_code;
+ ssize_t nread = 0;
+ va_list args;
+ char print_buffer[50];
+
+ va_start(args, message);
+ mvsnprintf(print_buffer, sizeof(print_buffer), message, args);
+ va_end(args);
+
+ if(ftpsend(conn, print_buffer)) {
+ ftp_code = -1;
+ }
+ else {
+ if(Curl_GetFTPResponse(&nread, conn, &ftp_code))
+ ftp_code = -1;
+ }
+
+ (void)nread; /* Unused */
+ return ftp_code;
+}
+
+/* Read |len| from the socket |fd| and store it in |to|. Return a CURLcode
+ saying whether an error occurred or CURLE_OK if |len| was read. */
+static CURLcode
+socket_read(curl_socket_t fd, void *to, size_t len)
+{
+ char *to_p = to;
+ CURLcode result;
+ ssize_t nread = 0;
+
+ while(len > 0) {
+ result = Curl_read_plain(fd, to_p, len, &nread);
+ if(!result) {
+ len -= nread;
+ to_p += nread;
+ }
+ else {
+ if(result == CURLE_AGAIN)
+ continue;
+ return result;
+ }
+ }
+ return CURLE_OK;
+}
+
+
+/* Write |len| bytes from the buffer |to| to the socket |fd|. Return a
+ CURLcode saying whether an error occurred or CURLE_OK if |len| was
+ written. */
+static CURLcode
+socket_write(struct connectdata *conn, curl_socket_t fd, const void *to,
+ size_t len)
+{
+ const char *to_p = to;
+ CURLcode result;
+ ssize_t written;
+
+ while(len > 0) {
+ result = Curl_write_plain(conn, fd, to_p, len, &written);
+ if(!result) {
+ len -= written;
+ to_p += written;
+ }
+ else {
+ if(result == CURLE_AGAIN)
+ continue;
+ return result;
+ }
+ }
+ return CURLE_OK;
+}
+
+static CURLcode read_data(struct connectdata *conn,
+ curl_socket_t fd,
+ struct krb5buffer *buf)
+{
+ int len;
+ CURLcode result;
+
+ result = socket_read(fd, &len, sizeof(len));
+ if(result)
+ return result;
+
+ if(len) {
+ /* only realloc if there was a length */
+ len = ntohl(len);
+ buf->data = Curl_saferealloc(buf->data, len);
+ }
+ if(!len || !buf->data)
+ return CURLE_OUT_OF_MEMORY;
+
+ result = socket_read(fd, buf->data, len);
+ if(result)
+ return result;
+ buf->size = conn->mech->decode(conn->app_data, buf->data, len,
+ conn->data_prot, conn);
+ buf->index = 0;
+ return CURLE_OK;
+}
+
+static size_t
+buffer_read(struct krb5buffer *buf, void *data, size_t len)
+{
+ if(buf->size - buf->index < len)
+ len = buf->size - buf->index;
+ memcpy(data, (char *)buf->data + buf->index, len);
+ buf->index += len;
+ return len;
+}
+
+/* Matches Curl_recv signature */
+static ssize_t sec_recv(struct connectdata *conn, int sockindex,
+ char *buffer, size_t len, CURLcode *err)
+{
+ size_t bytes_read;
+ size_t total_read = 0;
+ curl_socket_t fd = conn->sock[sockindex];
+
+ *err = CURLE_OK;
+
+ /* Handle clear text response. */
+ if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR)
+ return sread(fd, buffer, len);
+
+ if(conn->in_buffer.eof_flag) {
+ conn->in_buffer.eof_flag = 0;
+ return 0;
+ }
+
+ bytes_read = buffer_read(&conn->in_buffer, buffer, len);
+ len -= bytes_read;
+ total_read += bytes_read;
+ buffer += bytes_read;
+
+ while(len > 0) {
+ if(read_data(conn, fd, &conn->in_buffer))
+ return -1;
+ if(conn->in_buffer.size == 0) {
+ if(bytes_read > 0)
+ conn->in_buffer.eof_flag = 1;
+ return bytes_read;
+ }
+ bytes_read = buffer_read(&conn->in_buffer, buffer, len);
+ len -= bytes_read;
+ total_read += bytes_read;
+ buffer += bytes_read;
+ }
+ return total_read;
+}
+
+/* Send |length| bytes from |from| to the |fd| socket taking care of encoding
+ and negotiating with the server. |from| can be NULL. */
+static void do_sec_send(struct connectdata *conn, curl_socket_t fd,
+ const char *from, int length)
+{
+ int bytes, htonl_bytes; /* 32-bit integers for htonl */
+ char *buffer = NULL;
+ char *cmd_buffer;
+ size_t cmd_size = 0;
+ CURLcode error;
+ enum protection_level prot_level = conn->data_prot;
+ bool iscmd = (prot_level == PROT_CMD)?TRUE:FALSE;
+
+ DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);
+
+ if(iscmd) {
+ if(!strncmp(from, "PASS ", 5) || !strncmp(from, "ACCT ", 5))
+ prot_level = PROT_PRIVATE;
+ else
+ prot_level = conn->command_prot;
+ }
+ bytes = conn->mech->encode(conn->app_data, from, length, prot_level,
+ (void **)&buffer);
+ if(!buffer || bytes <= 0)
+ return; /* error */
+
+ if(iscmd) {
+ error = Curl_base64_encode(conn->data, buffer, curlx_sitouz(bytes),
+ &cmd_buffer, &cmd_size);
+ if(error) {
+ free(buffer);
+ return; /* error */
+ }
+ if(cmd_size > 0) {
+ static const char *enc = "ENC ";
+ static const char *mic = "MIC ";
+ if(prot_level == PROT_PRIVATE)
+ socket_write(conn, fd, enc, 4);
+ else
+ socket_write(conn, fd, mic, 4);
+
+ socket_write(conn, fd, cmd_buffer, cmd_size);
+ socket_write(conn, fd, "\r\n", 2);
+ infof(conn->data, "Send: %s%s\n", prot_level == PROT_PRIVATE?enc:mic,
+ cmd_buffer);
+ free(cmd_buffer);
+ }
+ }
+ else {
+ htonl_bytes = htonl(bytes);
+ socket_write(conn, fd, &htonl_bytes, sizeof(htonl_bytes));
+ socket_write(conn, fd, buffer, curlx_sitouz(bytes));
+ }
+ free(buffer);
+}
+
+static ssize_t sec_write(struct connectdata *conn, curl_socket_t fd,
+ const char *buffer, size_t length)
+{
+ ssize_t tx = 0, len = conn->buffer_size;
+
+ len -= conn->mech->overhead(conn->app_data, conn->data_prot,
+ curlx_sztosi(len));
+ if(len <= 0)
+ len = length;
+ while(length) {
+ if(length < (size_t)len)
+ len = length;
+
+ do_sec_send(conn, fd, buffer, curlx_sztosi(len));
+ length -= len;
+ buffer += len;
+ tx += len;
+ }
+ return tx;
+}
+
+/* Matches Curl_send signature */
+static ssize_t sec_send(struct connectdata *conn, int sockindex,
+ const void *buffer, size_t len, CURLcode *err)
+{
+ curl_socket_t fd = conn->sock[sockindex];
+ *err = CURLE_OK;
+ return sec_write(conn, fd, buffer, len);
+}
+
+int Curl_sec_read_msg(struct connectdata *conn, char *buffer,
+ enum protection_level level)
+{
+ /* decoded_len should be size_t or ssize_t but conn->mech->decode returns an
+ int */
+ int decoded_len;
+ char *buf;
+ int ret_code = 0;
+ size_t decoded_sz = 0;
+ CURLcode error;
+
+ if(!conn->mech)
+ /* not inititalized, return error */
+ return -1;
+
+ DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
+
+ error = Curl_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz);
+ if(error || decoded_sz == 0)
+ return -1;
+
+ if(decoded_sz > (size_t)INT_MAX) {
+ free(buf);
+ return -1;
+ }
+ decoded_len = curlx_uztosi(decoded_sz);
+
+ decoded_len = conn->mech->decode(conn->app_data, buf, decoded_len,
+ level, conn);
+ if(decoded_len <= 0) {
+ free(buf);
+ return -1;
+ }
+
+ {
+ buf[decoded_len] = '\n';
+ Curl_debug(conn->data, CURLINFO_HEADER_IN, buf, decoded_len + 1);
+ }
+
+ buf[decoded_len] = '\0';
+ if(decoded_len <= 3)
+ /* suspiciously short */
+ return 0;
+
+ if(buf[3] != '-')
+ /* safe to ignore return code */
+ (void)sscanf(buf, "%d", &ret_code);
+
+ if(buf[decoded_len - 1] == '\n')
+ buf[decoded_len - 1] = '\0';
+ strcpy(buffer, buf);
+ free(buf);
+ return ret_code;
+}
+
+static int sec_set_protection_level(struct connectdata *conn)
+{
+ int code;
+ enum protection_level level = conn->request_data_prot;
+
+ DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
+
+ if(!conn->sec_complete) {
+ infof(conn->data, "Trying to change the protection level after the"
+ " completion of the data exchange.\n");
+ return -1;
+ }
+
+ /* Bail out if we try to set up the same level */
+ if(conn->data_prot == level)
+ return 0;
+
+ if(level) {
+ char *pbsz;
+ static unsigned int buffer_size = 1 << 20; /* 1048576 */
+
+ code = ftp_send_command(conn, "PBSZ %u", buffer_size);
+ if(code < 0)
+ return -1;
+
+ if(code/100 != 2) {
+ failf(conn->data, "Failed to set the protection's buffer size.");
+ return -1;
+ }
+ conn->buffer_size = buffer_size;
+
+ pbsz = strstr(conn->data->state.buffer, "PBSZ=");
+ if(pbsz) {
+ /* ignore return code, use default value if it fails */
+ (void)sscanf(pbsz, "PBSZ=%u", &buffer_size);
+ if(buffer_size < conn->buffer_size)
+ conn->buffer_size = buffer_size;
+ }
+ }
+
+ /* Now try to negiociate the protection level. */
+ code = ftp_send_command(conn, "PROT %c", level_to_char(level));
+
+ if(code < 0)
+ return -1;
+
+ if(code/100 != 2) {
+ failf(conn->data, "Failed to set the protection level.");
+ return -1;
+ }
+
+ conn->data_prot = level;
+ if(level == PROT_PRIVATE)
+ conn->command_prot = level;
+
+ return 0;
+}
+
+int
+Curl_sec_request_prot(struct connectdata *conn, const char *level)
+{
+ enum protection_level l = name_to_level(level);
+ if(l == PROT_NONE)
+ return -1;
+ DEBUGASSERT(l > PROT_NONE && l < PROT_LAST);
+ conn->request_data_prot = l;
+ return 0;
+}
+
+static CURLcode choose_mech(struct connectdata *conn)
+{
+ int ret;
+ struct Curl_easy *data = conn->data;
+ void *tmp_allocation;
+ const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;
+
+ tmp_allocation = realloc(conn->app_data, mech->size);
+ if(tmp_allocation == NULL) {
+ failf(data, "Failed realloc of size %zu", mech->size);
+ mech = NULL;
+ return CURLE_OUT_OF_MEMORY;
+ }
+ conn->app_data = tmp_allocation;
+
+ if(mech->init) {
+ ret = mech->init(conn->app_data);
+ if(ret) {
+ infof(data, "Failed initialization for %s. Skipping it.\n",
+ mech->name);
+ return CURLE_FAILED_INIT;
+ }
+ }
+
+ infof(data, "Trying mechanism %s...\n", mech->name);
+ ret = ftp_send_command(conn, "AUTH %s", mech->name);
+ if(ret < 0)
+ return CURLE_COULDNT_CONNECT;
+
+ if(ret/100 != 3) {
+ switch(ret) {
+ case 504:
+ infof(data, "Mechanism %s is not supported by the server (server "
+ "returned ftp code: 504).\n", mech->name);
+ break;
+ case 534:
+ infof(data, "Mechanism %s was rejected by the server (server returned "
+ "ftp code: 534).\n", mech->name);
+ break;
+ default:
+ if(ret/100 == 5) {
+ infof(data, "server does not support the security extensions\n");
+ return CURLE_USE_SSL_FAILED;
+ }
+ break;
+ }
+ return CURLE_LOGIN_DENIED;
+ }
+
+ /* Authenticate */
+ ret = mech->auth(conn->app_data, conn);
+
+ if(ret != AUTH_CONTINUE) {
+ if(ret != AUTH_OK) {
+ /* Mechanism has dumped the error to stderr, don't error here. */
+ return CURLE_USE_SSL_FAILED;
+ }
+ DEBUGASSERT(ret == AUTH_OK);
+
+ conn->mech = mech;
+ conn->sec_complete = 1;
+ conn->recv[FIRSTSOCKET] = sec_recv;
+ conn->send[FIRSTSOCKET] = sec_send;
+ conn->recv[SECONDARYSOCKET] = sec_recv;
+ conn->send[SECONDARYSOCKET] = sec_send;
+ conn->command_prot = PROT_SAFE;
+ /* Set the requested protection level */
+ /* BLOCKING */
+ (void)sec_set_protection_level(conn);
+ }
+
+ return CURLE_OK;
+}
+
+CURLcode
+Curl_sec_login(struct connectdata *conn)
+{
+ return choose_mech(conn);
+}
+
+
+void
+Curl_sec_end(struct connectdata *conn)
+{
+ if(conn->mech != NULL && conn->mech->end)
+ conn->mech->end(conn->app_data);
+ free(conn->app_data);
+ conn->app_data = NULL;
+ if(conn->in_buffer.data) {
+ free(conn->in_buffer.data);
+ conn->in_buffer.data = NULL;
+ conn->in_buffer.size = 0;
+ conn->in_buffer.index = 0;
+ conn->in_buffer.eof_flag = 0;
+ }
+ conn->sec_complete = 0;
+ conn->data_prot = PROT_CLEAR;
+ conn->mech = NULL;
+}
+
#endif /* HAVE_GSSAPI && !CURL_DISABLE_FTP */
diff --git a/contrib/libs/curl/lib/ldap.c b/contrib/libs/curl/lib/ldap.c
index 332025a745..ab60704225 100644
--- a/contrib/libs/curl/lib/ldap.c
+++ b/contrib/libs/curl/lib/ldap.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -75,7 +75,7 @@
/* Use our own implementation. */
-struct ldap_urldesc {
+struct ldap_urldesc {
char *lud_host;
int lud_port;
#if defined(USE_WIN32_LDAP)
@@ -95,10 +95,10 @@ struct ldap_urldesc {
size_t lud_attrs_dups; /* how many were dup'ed, this field is not in the
"real" struct so can only be used in code
without HAVE_LDAP_URL_PARSE defined */
-};
+};
#undef LDAPURLDesc
-#define LDAPURLDesc struct ldap_urldesc
+#define LDAPURLDesc struct ldap_urldesc
static int _ldap_url_parse(const struct connectdata *conn,
LDAPURLDesc **ludp);
@@ -112,20 +112,20 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp);
#define LDAP_TRACE(x) do { \
_ldap_trace("%u: ", __LINE__); \
_ldap_trace x; \
- } while(0)
+ } while(0)
static void _ldap_trace(const char *fmt, ...);
#else
#define LDAP_TRACE(x) Curl_nop_stmt
#endif
-#if defined(USE_WIN32_LDAP) && defined(ldap_err2string)
-/* Use ansi error strings in UNICODE builds */
-#undef ldap_err2string
-#define ldap_err2string ldap_err2stringA
-#endif
+#if defined(USE_WIN32_LDAP) && defined(ldap_err2string)
+/* Use ansi error strings in UNICODE builds */
+#undef ldap_err2string
+#define ldap_err2string ldap_err2stringA
+#endif
+
-
static CURLcode Curl_ldap(struct connectdata *conn, bool *done);
/*
@@ -150,7 +150,7 @@ const struct Curl_handler Curl_handler_ldap = {
ZERO_NULL, /* connection_check */
PORT_LDAP, /* defport */
CURLPROTO_LDAP, /* protocol */
- CURLPROTO_LDAP, /* family */
+ CURLPROTO_LDAP, /* family */
PROTOPT_NONE /* flags */
};
@@ -177,7 +177,7 @@ const struct Curl_handler Curl_handler_ldaps = {
ZERO_NULL, /* connection_check */
PORT_LDAPS, /* defport */
CURLPROTO_LDAPS, /* protocol */
- CURLPROTO_LDAP, /* family */
+ CURLPROTO_LDAP, /* family */
PROTOPT_SSL /* flags */
};
#endif
@@ -241,13 +241,13 @@ static int ldap_win_bind(struct connectdata *conn, LDAP *server,
PTCHAR inpass = NULL;
if(user && passwd && (conn->data->set.httpauth & CURLAUTH_BASIC)) {
- inuser = curlx_convert_UTF8_to_tchar((char *) user);
- inpass = curlx_convert_UTF8_to_tchar((char *) passwd);
+ inuser = curlx_convert_UTF8_to_tchar((char *) user);
+ inpass = curlx_convert_UTF8_to_tchar((char *) passwd);
rc = ldap_simple_bind_s(server, inuser, inpass);
- curlx_unicodefree(inuser);
- curlx_unicodefree(inpass);
+ curlx_unicodefree(inuser);
+ curlx_unicodefree(inpass);
}
#if defined(USE_WINDOWS_SSPI)
else {
@@ -259,13 +259,13 @@ static int ldap_win_bind(struct connectdata *conn, LDAP *server,
}
#endif /* #if defined(USE_WIN32_LDAP) */
-#if defined(USE_WIN32_LDAP)
-#define FREE_ON_WINLDAP(x) curlx_unicodefree(x)
-#else
-#define FREE_ON_WINLDAP(x)
-#endif
-
-
+#if defined(USE_WIN32_LDAP)
+#define FREE_ON_WINLDAP(x) curlx_unicodefree(x)
+#else
+#define FREE_ON_WINLDAP(x)
+#endif
+
+
static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
{
CURLcode result = CURLE_OK;
@@ -315,7 +315,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
ldap_ssl ? "encrypted" : "cleartext");
#if defined(USE_WIN32_LDAP)
- host = curlx_convert_UTF8_to_tchar(conn->host.name);
+ host = curlx_convert_UTF8_to_tchar(conn->host.name);
if(!host) {
result = CURLE_OUT_OF_MEMORY;
@@ -513,7 +513,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
#if defined(USE_WIN32_LDAP)
TCHAR *attribute;
#else
- char *attribute;
+ char *attribute;
#endif
int i;
@@ -523,7 +523,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
size_t name_len;
#if defined(USE_WIN32_LDAP)
TCHAR *dn = ldap_get_dn(server, entryIterator);
- name = curlx_convert_tchar_to_UTF8(dn);
+ name = curlx_convert_tchar_to_UTF8(dn);
if(!name) {
ldap_memfree(dn);
@@ -538,7 +538,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"DN: ", 4);
if(result) {
- FREE_ON_WINLDAP(name);
+ FREE_ON_WINLDAP(name);
ldap_memfree(dn);
goto quit;
}
@@ -546,14 +546,14 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *) name,
name_len);
if(result) {
- FREE_ON_WINLDAP(name);
+ FREE_ON_WINLDAP(name);
ldap_memfree(dn);
goto quit;
}
result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
if(result) {
- FREE_ON_WINLDAP(name);
+ FREE_ON_WINLDAP(name);
ldap_memfree(dn);
goto quit;
@@ -561,7 +561,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
dlsize += name_len + 5;
- FREE_ON_WINLDAP(name);
+ FREE_ON_WINLDAP(name);
ldap_memfree(dn);
}
@@ -572,7 +572,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
BerValue **vals;
size_t attr_len;
#if defined(USE_WIN32_LDAP)
- char *attr = curlx_convert_tchar_to_UTF8(attribute);
+ char *attr = curlx_convert_tchar_to_UTF8(attribute);
if(!attr) {
if(ber)
ber_free(ber, 0);
@@ -592,7 +592,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1);
if(result) {
ldap_value_free_len(vals);
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
if(ber)
ber_free(ber, 0);
@@ -604,7 +604,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
(char *) attr, attr_len);
if(result) {
ldap_value_free_len(vals);
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
if(ber)
ber_free(ber, 0);
@@ -615,7 +615,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)": ", 2);
if(result) {
ldap_value_free_len(vals);
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
if(ber)
ber_free(ber, 0);
@@ -635,7 +635,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
&val_b64_sz);
if(result) {
ldap_value_free_len(vals);
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
if(ber)
ber_free(ber, 0);
@@ -649,7 +649,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
free(val_b64);
if(result) {
ldap_value_free_len(vals);
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
if(ber)
ber_free(ber, 0);
@@ -665,7 +665,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
vals[i]->bv_len);
if(result) {
ldap_value_free_len(vals);
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
if(ber)
ber_free(ber, 0);
@@ -679,7 +679,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
if(result) {
ldap_value_free_len(vals);
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
if(ber)
ber_free(ber, 0);
@@ -695,7 +695,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
}
/* Free the attribute as we are done with it */
- FREE_ON_WINLDAP(attr);
+ FREE_ON_WINLDAP(attr);
ldap_memfree(attribute);
result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
@@ -725,7 +725,7 @@ quit:
ldapssl_client_deinit();
#endif /* HAVE_LDAP_SSL && CURL_HAS_NOVELL_LDAPSDK */
- FREE_ON_WINLDAP(host);
+ FREE_ON_WINLDAP(host);
/* no data to transfer */
Curl_setup_transfer(data, -1, -1, FALSE, -1);
@@ -822,10 +822,10 @@ static bool split_str(char *str, char ***out, size_t *count)
static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
{
int rc = LDAP_SUCCESS;
- char *p;
+ char *p;
char *path;
- char *q = NULL;
- char *query = NULL;
+ char *q = NULL;
+ char *query = NULL;
size_t i;
if(!conn->data ||
@@ -843,13 +843,13 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
if(!path)
return LDAP_NO_MEMORY;
- /* Duplicate the query if present */
- if(conn->data->state.up.query) {
- q = query = strdup(conn->data->state.up.query);
- if(!query) {
- free(path);
- return LDAP_NO_MEMORY;
- }
+ /* Duplicate the query if present */
+ if(conn->data->state.up.query) {
+ q = query = strdup(conn->data->state.up.query);
+ if(!query) {
+ free(path);
+ return LDAP_NO_MEMORY;
+ }
}
/* Parse the DN (Distinguished Name) */
@@ -861,7 +861,7 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
LDAP_TRACE(("DN '%s'\n", dn));
/* Unescape the DN */
- result = Curl_urldecode(conn->data, dn, 0, &unescaped, NULL, REJECT_ZERO);
+ result = Curl_urldecode(conn->data, dn, 0, &unescaped, NULL, REJECT_ZERO);
if(result) {
rc = LDAP_NO_MEMORY;
@@ -870,10 +870,10 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
#if defined(USE_WIN32_LDAP)
/* Convert the unescaped string to a tchar */
- ludp->lud_dn = curlx_convert_UTF8_to_tchar(unescaped);
+ ludp->lud_dn = curlx_convert_UTF8_to_tchar(unescaped);
/* Free the unescaped string as we are done with it */
- curlx_unicodefree(unescaped);
+ curlx_unicodefree(unescaped);
if(!ludp->lud_dn) {
rc = LDAP_NO_MEMORY;
@@ -923,11 +923,11 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
char *unescaped;
CURLcode result;
- LDAP_TRACE(("attr[%zu] '%s'\n", i, attributes[i]));
+ LDAP_TRACE(("attr[%zu] '%s'\n", i, attributes[i]));
/* Unescape the attribute */
result = Curl_urldecode(conn->data, attributes[i], 0, &unescaped, NULL,
- REJECT_ZERO);
+ REJECT_ZERO);
if(result) {
free(attributes);
@@ -938,10 +938,10 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
#if defined(USE_WIN32_LDAP)
/* Convert the unescaped string to a tchar */
- ludp->lud_attrs[i] = curlx_convert_UTF8_to_tchar(unescaped);
+ ludp->lud_attrs[i] = curlx_convert_UTF8_to_tchar(unescaped);
/* Free the unescaped string as we are done with it */
- curlx_unicodefree(unescaped);
+ curlx_unicodefree(unescaped);
if(!ludp->lud_attrs[i]) {
free(attributes);
@@ -996,8 +996,8 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
LDAP_TRACE(("filter '%s'\n", filter));
/* Unescape the filter */
- result = Curl_urldecode(conn->data, filter, 0, &unescaped, NULL,
- REJECT_ZERO);
+ result = Curl_urldecode(conn->data, filter, 0, &unescaped, NULL,
+ REJECT_ZERO);
if(result) {
rc = LDAP_NO_MEMORY;
@@ -1006,10 +1006,10 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
#if defined(USE_WIN32_LDAP)
/* Convert the unescaped string to a tchar */
- ludp->lud_filter = curlx_convert_UTF8_to_tchar(unescaped);
+ ludp->lud_filter = curlx_convert_UTF8_to_tchar(unescaped);
/* Free the unescaped string as we are done with it */
- curlx_unicodefree(unescaped);
+ curlx_unicodefree(unescaped);
if(!ludp->lud_filter) {
rc = LDAP_NO_MEMORY;
diff --git a/contrib/libs/curl/lib/llist.c b/contrib/libs/curl/lib/llist.c
index b2c91918d1..17a7be1667 100644
--- a/contrib/libs/curl/lib/llist.c
+++ b/contrib/libs/curl/lib/llist.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -34,7 +34,7 @@
* @unittest: 1300
*/
void
-Curl_llist_init(struct Curl_llist *l, Curl_llist_dtor dtor)
+Curl_llist_init(struct Curl_llist *l, Curl_llist_dtor dtor)
{
l->size = 0;
l->dtor = dtor;
@@ -54,9 +54,9 @@ Curl_llist_init(struct Curl_llist *l, Curl_llist_dtor dtor)
* @unittest: 1300
*/
void
-Curl_llist_insert_next(struct Curl_llist *list, struct Curl_llist_element *e,
+Curl_llist_insert_next(struct Curl_llist *list, struct Curl_llist_element *e,
const void *p,
- struct Curl_llist_element *ne)
+ struct Curl_llist_element *ne)
{
ne->ptr = (void *) p;
if(list->size == 0) {
@@ -90,7 +90,7 @@ Curl_llist_insert_next(struct Curl_llist *list, struct Curl_llist_element *e,
* @unittest: 1300
*/
void
-Curl_llist_remove(struct Curl_llist *list, struct Curl_llist_element *e,
+Curl_llist_remove(struct Curl_llist *list, struct Curl_llist_element *e,
void *user)
{
void *ptr;
@@ -131,7 +131,7 @@ Curl_llist_remove(struct Curl_llist *list, struct Curl_llist_element *e,
}
void
-Curl_llist_destroy(struct Curl_llist *list, void *user)
+Curl_llist_destroy(struct Curl_llist *list, void *user)
{
if(list) {
while(list->size > 0)
@@ -140,7 +140,7 @@ Curl_llist_destroy(struct Curl_llist *list, void *user)
}
size_t
-Curl_llist_count(struct Curl_llist *list)
+Curl_llist_count(struct Curl_llist *list)
{
return list->size;
}
diff --git a/contrib/libs/curl/lib/llist.h b/contrib/libs/curl/lib/llist.h
index 7d10938a20..ceae2dd1b7 100644
--- a/contrib/libs/curl/lib/llist.h
+++ b/contrib/libs/curl/lib/llist.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -25,26 +25,26 @@
#include "curl_setup.h"
#include <stddef.h>
-typedef void (*Curl_llist_dtor)(void *, void *);
+typedef void (*Curl_llist_dtor)(void *, void *);
-struct Curl_llist_element {
+struct Curl_llist_element {
void *ptr;
- struct Curl_llist_element *prev;
- struct Curl_llist_element *next;
+ struct Curl_llist_element *prev;
+ struct Curl_llist_element *next;
};
-struct Curl_llist {
- struct Curl_llist_element *head;
- struct Curl_llist_element *tail;
- Curl_llist_dtor dtor;
+struct Curl_llist {
+ struct Curl_llist_element *head;
+ struct Curl_llist_element *tail;
+ Curl_llist_dtor dtor;
size_t size;
};
-void Curl_llist_init(struct Curl_llist *, Curl_llist_dtor);
-void Curl_llist_insert_next(struct Curl_llist *, struct Curl_llist_element *,
- const void *, struct Curl_llist_element *node);
-void Curl_llist_remove(struct Curl_llist *, struct Curl_llist_element *,
+void Curl_llist_init(struct Curl_llist *, Curl_llist_dtor);
+void Curl_llist_insert_next(struct Curl_llist *, struct Curl_llist_element *,
+ const void *, struct Curl_llist_element *node);
+void Curl_llist_remove(struct Curl_llist *, struct Curl_llist_element *,
void *);
-size_t Curl_llist_count(struct Curl_llist *);
-void Curl_llist_destroy(struct Curl_llist *, void *);
+size_t Curl_llist_count(struct Curl_llist *);
+void Curl_llist_destroy(struct Curl_llist *, void *);
#endif /* HEADER_CURL_LLIST_H */
diff --git a/contrib/libs/curl/lib/md4.c b/contrib/libs/curl/lib/md4.c
index 05057e2397..d3355ad929 100644
--- a/contrib/libs/curl/lib/md4.c
+++ b/contrib/libs/curl/lib/md4.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -29,20 +29,20 @@
#ifdef USE_OPENSSL
#include <openssl/opensslconf.h>
-#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
-/* OpenSSL 3.0.0 marks the MD4 functions as deprecated */
-#define OPENSSL_NO_MD4
+#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
+/* OpenSSL 3.0.0 marks the MD4 functions as deprecated */
+#define OPENSSL_NO_MD4
#endif
-#endif /* USE_OPENSSL */
-
+#endif /* USE_OPENSSL */
+
#ifdef USE_MBEDTLS
#error #include <mbedtls/config.h>
-#error #include <mbedtls/version.h>
-
-#if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
- #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
+#error #include <mbedtls/version.h>
+
+#if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
+ #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
#endif
-#endif /* USE_MBEDTLS */
+#endif /* USE_MBEDTLS */
#if defined(USE_GNUTLS_NETTLE)
@@ -75,11 +75,11 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#include <gcrypt.h>
#include "curl_memory.h"
-
+
/* The last #include file should be: */
#include "memdebug.h"
-typedef gcry_md_hd_t MD4_CTX;
+typedef gcry_md_hd_t MD4_CTX;
static void MD4_Init(MD4_CTX *ctx)
{
@@ -93,43 +93,43 @@ static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
{
- memcpy(result, gcry_md_read(*ctx, 0), MD4_DIGEST_LENGTH);
- gcry_md_close(*ctx);
+ memcpy(result, gcry_md_read(*ctx, 0), MD4_DIGEST_LENGTH);
+ gcry_md_close(*ctx);
}
#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
/* When OpenSSL is available we use the MD4-functions from OpenSSL */
#include <openssl/md4.h>
-#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
- (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
- defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
- (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
- (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
- (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
+#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
+ (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
+ defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
+ (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
+ (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
+ (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
#include <CommonCrypto/CommonDigest.h>
#include "curl_memory.h"
-
+
/* The last #include file should be: */
#include "memdebug.h"
-typedef CC_MD4_CTX MD4_CTX;
+typedef CC_MD4_CTX MD4_CTX;
static void MD4_Init(MD4_CTX *ctx)
{
- (void)CC_MD4_Init(ctx);
+ (void)CC_MD4_Init(ctx);
}
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
{
- (void)CC_MD4_Update(ctx, data, (CC_LONG)size);
+ (void)CC_MD4_Update(ctx, data, (CC_LONG)size);
}
static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
{
- (void)CC_MD4_Final(result, ctx);
+ (void)CC_MD4_Final(result, ctx);
}
#elif defined(USE_WIN32_CRYPTO)
@@ -137,15 +137,15 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#include <wincrypt.h>
#include "curl_memory.h"
-
-/* The last #include file should be: */
+
+/* The last #include file should be: */
#include "memdebug.h"
-struct md4_ctx {
+struct md4_ctx {
HCRYPTPROV hCryptProv;
HCRYPTHASH hHash;
-};
-typedef struct md4_ctx MD4_CTX;
+};
+typedef struct md4_ctx MD4_CTX;
static void MD4_Init(MD4_CTX *ctx)
{
@@ -153,14 +153,14 @@ static void MD4_Init(MD4_CTX *ctx)
ctx->hHash = 0;
if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
CryptCreateHash(ctx->hCryptProv, CALG_MD4, 0, 0, &ctx->hHash);
}
}
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
{
- CryptHashData(ctx->hHash, (BYTE *)data, (unsigned int) size, 0);
+ CryptHashData(ctx->hHash, (BYTE *)data, (unsigned int) size, 0);
}
static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
@@ -183,15 +183,15 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#error #include <mbedtls/md4.h>
#include "curl_memory.h"
-
+
/* The last #include file should be: */
#include "memdebug.h"
-struct md4_ctx {
+struct md4_ctx {
void *data;
unsigned long size;
-};
-typedef struct md4_ctx MD4_CTX;
+};
+typedef struct md4_ctx MD4_CTX;
static void MD4_Init(MD4_CTX *ctx)
{
@@ -213,11 +213,11 @@ static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
{
if(ctx->data != NULL) {
-#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
mbedtls_md4(ctx->data, ctx->size, result);
-#else
- (void) mbedtls_md4_ret(ctx->data, ctx->size, result);
-#endif
+#else
+ (void) mbedtls_md4_ret(ctx->data, ctx->size, result);
+#endif
Curl_safefree(ctx->data);
ctx->size = 0;
@@ -270,13 +270,13 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
/* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD4_u32plus;
-struct md4_ctx {
+struct md4_ctx {
MD4_u32plus lo, hi;
MD4_u32plus a, b, c, d;
unsigned char buffer[64];
MD4_u32plus block[16];
-};
-typedef struct md4_ctx MD4_CTX;
+};
+typedef struct md4_ctx MD4_CTX;
static void MD4_Init(MD4_CTX *ctx);
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size);
@@ -516,11 +516,11 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
#endif /* CRYPTO LIBS */
-void Curl_md4it(unsigned char *output, const unsigned char *input,
- const size_t len)
+void Curl_md4it(unsigned char *output, const unsigned char *input,
+ const size_t len)
{
MD4_CTX ctx;
-
+
MD4_Init(&ctx);
MD4_Update(&ctx, input, curlx_uztoui(len));
MD4_Final(output, &ctx);
diff --git a/contrib/libs/curl/lib/md5.c b/contrib/libs/curl/lib/md5.c
index d21287d317..ff0b369f02 100644
--- a/contrib/libs/curl/lib/md5.c
+++ b/contrib/libs/curl/lib/md5.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -30,14 +30,14 @@
#include "curl_hmac.h"
#include "warnless.h"
-#ifdef USE_MBEDTLS
-#error #include <mbedtls/version.h>
-
-#if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
- #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
-#endif
-#endif /* USE_MBEDTLS */
-
+#ifdef USE_MBEDTLS
+#error #include <mbedtls/version.h>
+
+#if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
+ #define HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS
+#endif
+#endif /* USE_MBEDTLS */
+
#if defined(USE_GNUTLS_NETTLE)
#include <nettle/md5.h>
@@ -59,7 +59,7 @@ static void MD5_Update(MD5_CTX *ctx,
md5_update(ctx, inputLen, input);
}
-static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
+static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
{
md5_digest(ctx, 16, digest);
}
@@ -85,7 +85,7 @@ static void MD5_Update(MD5_CTX *ctx,
gcry_md_write(*ctx, input, inputLen);
}
-static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
+static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
{
memcpy(digest, gcry_md_read(*ctx, 0), 16);
gcry_md_close(*ctx);
@@ -98,50 +98,50 @@ static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
/* The last #include file should be: */
#include "memdebug.h"
-#elif defined(USE_MBEDTLS)
-
-#error #include <mbedtls/md5.h>
-
-#include "curl_memory.h"
-
-/* The last #include file should be: */
-#include "memdebug.h"
-
-typedef mbedtls_md5_context MD5_CTX;
-
-static void MD5_Init(MD5_CTX *ctx)
-{
-#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
- mbedtls_md5_starts(ctx);
-#else
- (void) mbedtls_md5_starts_ret(ctx);
-#endif
-}
-
-static void MD5_Update(MD5_CTX *ctx,
- const unsigned char *data,
- unsigned int length)
-{
-#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
- mbedtls_md5_update(ctx, data, length);
-#else
- (void) mbedtls_md5_update_ret(ctx, data, length);
-#endif
-}
-
-static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
-{
-#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
- mbedtls_md5_finish(ctx, digest);
-#else
- (void) mbedtls_md5_finish_ret(ctx, digest);
-#endif
-}
-
+#elif defined(USE_MBEDTLS)
+
+#error #include <mbedtls/md5.h>
+
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef mbedtls_md5_context MD5_CTX;
+
+static void MD5_Init(MD5_CTX *ctx)
+{
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_md5_starts(ctx);
+#else
+ (void) mbedtls_md5_starts_ret(ctx);
+#endif
+}
+
+static void MD5_Update(MD5_CTX *ctx,
+ const unsigned char *data,
+ unsigned int length)
+{
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_md5_update(ctx, data, length);
+#else
+ (void) mbedtls_md5_update_ret(ctx, data, length);
+#endif
+}
+
+static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
+{
+#if !defined(HAS_MBEDTLS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_md5_finish(ctx, digest);
+#else
+ (void) mbedtls_md5_finish_ret(ctx, digest);
+#endif
+}
+
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
- (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
- defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
- (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
+ (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040) && \
+ defined(__MAC_OS_X_VERSION_MIN_ALLOWED) && \
+ (__MAC_OS_X_VERSION_MIN_ALLOWED < 101500)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
@@ -169,28 +169,28 @@ static void MD5_Update(MD5_CTX *ctx,
CC_MD5_Update(ctx, input, inputLen);
}
-static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
+static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
{
CC_MD5_Final(digest, ctx);
}
-#elif defined(USE_WIN32_CRYPTO)
+#elif defined(USE_WIN32_CRYPTO)
#include <wincrypt.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
-struct md5_ctx {
+struct md5_ctx {
HCRYPTPROV hCryptProv;
HCRYPTHASH hHash;
-};
-typedef struct md5_ctx MD5_CTX;
+};
+typedef struct md5_ctx MD5_CTX;
static void MD5_Init(MD5_CTX *ctx)
{
- if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
CryptCreateHash(ctx->hCryptProv, CALG_MD5, 0, 0, &ctx->hHash);
}
}
@@ -202,7 +202,7 @@ static void MD5_Update(MD5_CTX *ctx,
CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);
}
-static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
+static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
{
unsigned long length = 0;
CryptGetHashParam(ctx->hHash, HP_HASHVAL, NULL, &length, 0);
@@ -215,9 +215,9 @@ static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
}
#else
-
+
/* When no other crypto library is available we use this code segment */
-
+
/*
* This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
* MD5 Message-Digest Algorithm (RFC 1321).
@@ -264,13 +264,13 @@ static void MD5_Final(unsigned char *digest, MD5_CTX *ctx)
/* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD5_u32plus;
-struct md5_ctx {
+struct md5_ctx {
MD5_u32plus lo, hi;
MD5_u32plus a, b, c, d;
unsigned char buffer[64];
MD5_u32plus block[16];
-};
-typedef struct md5_ctx MD5_CTX;
+};
+typedef struct md5_ctx MD5_CTX;
static void MD5_Init(MD5_CTX *ctx);
static void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
@@ -532,7 +532,7 @@ static void MD5_Final(unsigned char *result, MD5_CTX *ctx)
#endif /* CRYPTO LIBS */
-const struct HMAC_params Curl_HMAC_MD5[] = {
+const struct HMAC_params Curl_HMAC_MD5[] = {
{
/* Hash initialization function. */
CURLX_FUNCTION_CAST(HMAC_hinit_func, MD5_Init),
@@ -549,7 +549,7 @@ const struct HMAC_params Curl_HMAC_MD5[] = {
}
};
-const struct MD5_params Curl_DIGEST_MD5[] = {
+const struct MD5_params Curl_DIGEST_MD5[] = {
{
/* Digest initialization function */
CURLX_FUNCTION_CAST(Curl_MD5_init_func, MD5_Init),
@@ -567,19 +567,19 @@ const struct MD5_params Curl_DIGEST_MD5[] = {
/*
* @unittest: 1601
*/
-void Curl_md5it(unsigned char *outbuffer, const unsigned char *input,
- const size_t len)
+void Curl_md5it(unsigned char *outbuffer, const unsigned char *input,
+ const size_t len)
{
MD5_CTX ctx;
-
+
MD5_Init(&ctx);
- MD5_Update(&ctx, input, curlx_uztoui(len));
+ MD5_Update(&ctx, input, curlx_uztoui(len));
MD5_Final(outbuffer, &ctx);
}
-struct MD5_context *Curl_MD5_init(const struct MD5_params *md5params)
+struct MD5_context *Curl_MD5_init(const struct MD5_params *md5params)
{
- struct MD5_context *ctxt;
+ struct MD5_context *ctxt;
/* Create MD5 context */
ctxt = malloc(sizeof(*ctxt));
@@ -601,7 +601,7 @@ struct MD5_context *Curl_MD5_init(const struct MD5_params *md5params)
return ctxt;
}
-CURLcode Curl_MD5_update(struct MD5_context *context,
+CURLcode Curl_MD5_update(struct MD5_context *context,
const unsigned char *data,
unsigned int len)
{
@@ -610,7 +610,7 @@ CURLcode Curl_MD5_update(struct MD5_context *context,
return CURLE_OK;
}
-CURLcode Curl_MD5_final(struct MD5_context *context, unsigned char *result)
+CURLcode Curl_MD5_final(struct MD5_context *context, unsigned char *result)
{
(*context->md5_hash->md5_final_func)(result, context->md5_hashctx);
diff --git a/contrib/libs/curl/lib/memdebug.c b/contrib/libs/curl/lib/memdebug.c
index d6879f2265..881ee85c32 100644
--- a/contrib/libs/curl/lib/memdebug.c
+++ b/contrib/libs/curl/lib/memdebug.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -277,7 +277,7 @@ void curl_dbg_free(void *ptr, int line, const char *source)
(Curl_cfree)(mem);
}
- if(source && ptr)
+ if(source && ptr)
curl_dbg_log("MEM %s:%d free(%p)\n", source, line, (void *)ptr);
}
@@ -405,16 +405,16 @@ FILE *curl_dbg_fopen(const char *file, const char *mode,
return res;
}
-FILE *curl_dbg_fdopen(int filedes, const char *mode,
- int line, const char *source)
-{
- FILE *res = fdopen(filedes, mode);
- if(source)
- curl_dbg_log("FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n",
- source, line, filedes, mode, (void *)res);
- return res;
-}
-
+FILE *curl_dbg_fdopen(int filedes, const char *mode,
+ int line, const char *source)
+{
+ FILE *res = fdopen(filedes, mode);
+ if(source)
+ curl_dbg_log("FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n",
+ source, line, filedes, mode, (void *)res);
+ return res;
+}
+
int curl_dbg_fclose(FILE *file, int line, const char *source)
{
int res;
diff --git a/contrib/libs/curl/lib/memdebug.h b/contrib/libs/curl/lib/memdebug.h
index 1ecf9c8290..8e88cea580 100644
--- a/contrib/libs/curl/lib/memdebug.h
+++ b/contrib/libs/curl/lib/memdebug.h
@@ -8,11 +8,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -79,9 +79,9 @@ CURL_EXTERN RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd,
/* FILE functions */
CURL_EXTERN FILE *curl_dbg_fopen(const char *file, const char *mode, int line,
const char *source);
-CURL_EXTERN FILE *curl_dbg_fdopen(int filedes, const char *mode,
- int line, const char *source);
-
+CURL_EXTERN FILE *curl_dbg_fdopen(int filedes, const char *mode,
+ int line, const char *source);
+
CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
#ifndef MEMDEBUG_NODEFINES
@@ -172,6 +172,6 @@ CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
*/
#define Curl_safefree(ptr) \
- do { free((ptr)); (ptr) = NULL;} while(0)
+ do { free((ptr)); (ptr) = NULL;} while(0)
#endif /* HEADER_CURL_MEMDEBUG_H */
diff --git a/contrib/libs/curl/lib/mime.c b/contrib/libs/curl/lib/mime.c
index 1d0867ef41..2ddd9b8b98 100644
--- a/contrib/libs/curl/lib/mime.c
+++ b/contrib/libs/curl/lib/mime.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,7 +26,7 @@
#include "mime.h"
#include "non-ascii.h"
-#include "warnless.h"
+#include "warnless.h"
#include "urldata.h"
#include "sendf.h"
@@ -53,11 +53,11 @@
#define READ_ERROR ((size_t) -1)
-#define STOP_FILLING ((size_t) -2)
+#define STOP_FILLING ((size_t) -2)
+
+static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems,
+ void *instream, bool *hasread);
-static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems,
- void *instream, bool *hasread);
-
/* Encoders. */
static size_t encoder_nop_read(char *buffer, size_t size, bool ateof,
curl_mimepart *part);
@@ -71,7 +71,7 @@ static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
curl_mimepart *part);
static curl_off_t encoder_qp_size(curl_mimepart *part);
-static const struct mime_encoder encoders[] = {
+static const struct mime_encoder encoders[] = {
{"binary", encoder_nop_read, encoder_nop_size},
{"8bit", encoder_nop_read, encoder_nop_size},
{"7bit", encoder_7bit_read, encoder_nop_size},
@@ -269,8 +269,8 @@ static char *Curl_basename(char *path)
/* Set readback state. */
-static void mimesetstate(struct mime_state *state,
- enum mimestate tok, void *ptr)
+static void mimesetstate(struct mime_state *state,
+ enum mimestate tok, void *ptr)
{
state->state = tok;
state->ptr = ptr;
@@ -343,7 +343,7 @@ static char *strippath(const char *fullfile)
}
/* Initialize data encoder state. */
-static void cleanup_encoder_state(struct mime_encoder_state *p)
+static void cleanup_encoder_state(struct mime_encoder_state *p)
{
p->pos = 0;
p->bufbeg = 0;
@@ -353,22 +353,22 @@ static void cleanup_encoder_state(struct mime_encoder_state *p)
/* Dummy encoder. This is used for 8bit and binary content encodings. */
static size_t encoder_nop_read(char *buffer, size_t size, bool ateof,
- struct curl_mimepart *part)
+ struct curl_mimepart *part)
{
- struct mime_encoder_state *st = &part->encstate;
+ struct mime_encoder_state *st = &part->encstate;
size_t insize = st->bufend - st->bufbeg;
(void) ateof;
- if(!size)
- return STOP_FILLING;
-
+ if(!size)
+ return STOP_FILLING;
+
if(size > insize)
size = insize;
-
+
if(size)
- memcpy(buffer, st->buf + st->bufbeg, size);
-
+ memcpy(buffer, st->buf + st->bufbeg, size);
+
st->bufbeg += size;
return size;
}
@@ -383,14 +383,14 @@ static curl_off_t encoder_nop_size(curl_mimepart *part)
static size_t encoder_7bit_read(char *buffer, size_t size, bool ateof,
curl_mimepart *part)
{
- struct mime_encoder_state *st = &part->encstate;
+ struct mime_encoder_state *st = &part->encstate;
size_t cursize = st->bufend - st->bufbeg;
(void) ateof;
- if(!size)
- return STOP_FILLING;
-
+ if(!size)
+ return STOP_FILLING;
+
if(size > cursize)
size = cursize;
@@ -409,7 +409,7 @@ static size_t encoder_7bit_read(char *buffer, size_t size, bool ateof,
static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
curl_mimepart *part)
{
- struct mime_encoder_state *st = &part->encstate;
+ struct mime_encoder_state *st = &part->encstate;
size_t cursize = 0;
int i;
char *ptr = buffer;
@@ -418,11 +418,11 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
/* Line full ? */
if(st->pos > MAX_ENCODED_LINE_LENGTH - 4) {
/* Yes, we need 2 characters for CRLF. */
- if(size < 2) {
- if(!cursize)
- return STOP_FILLING;
+ if(size < 2) {
+ if(!cursize)
+ return STOP_FILLING;
break;
- }
+ }
*ptr++ = '\r';
*ptr++ = '\n';
st->pos = 0;
@@ -431,13 +431,13 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
}
/* Be sure there is enough space and input data for a base64 group. */
- if(size < 4) {
- if(!cursize)
- return STOP_FILLING;
+ if(size < 4) {
+ if(!cursize)
+ return STOP_FILLING;
+ break;
+ }
+ if(st->bufend - st->bufbeg < 3)
break;
- }
- if(st->bufend - st->bufbeg < 3)
- break;
/* Encode three bytes as four characters. */
i = st->buf[st->bufbeg++] & 0xFF;
@@ -453,30 +453,30 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
}
/* If at eof, we have to flush the buffered data. */
- if(ateof) {
- if(size < 4) {
- if(!cursize)
- return STOP_FILLING;
- }
- else {
- /* Buffered data size can only be 0, 1 or 2. */
- ptr[2] = ptr[3] = '=';
- i = 0;
- switch(st->bufend - st->bufbeg) {
- case 2:
- i = (st->buf[st->bufbeg + 1] & 0xFF) << 8;
- /* FALLTHROUGH */
- case 1:
- i |= (st->buf[st->bufbeg] & 0xFF) << 16;
- ptr[0] = base64[(i >> 18) & 0x3F];
- ptr[1] = base64[(i >> 12) & 0x3F];
- if(++st->bufbeg != st->bufend) {
- ptr[2] = base64[(i >> 6) & 0x3F];
- st->bufbeg++;
- }
- cursize += 4;
- st->pos += 4;
- break;
+ if(ateof) {
+ if(size < 4) {
+ if(!cursize)
+ return STOP_FILLING;
+ }
+ else {
+ /* Buffered data size can only be 0, 1 or 2. */
+ ptr[2] = ptr[3] = '=';
+ i = 0;
+ switch(st->bufend - st->bufbeg) {
+ case 2:
+ i = (st->buf[st->bufbeg + 1] & 0xFF) << 8;
+ /* FALLTHROUGH */
+ case 1:
+ i |= (st->buf[st->bufbeg] & 0xFF) << 16;
+ ptr[0] = base64[(i >> 18) & 0x3F];
+ ptr[1] = base64[(i >> 12) & 0x3F];
+ if(++st->bufbeg != st->bufend) {
+ ptr[2] = base64[(i >> 6) & 0x3F];
+ st->bufbeg++;
+ }
+ cursize += 4;
+ st->pos += 4;
+ break;
}
}
}
@@ -513,7 +513,7 @@ static curl_off_t encoder_base64_size(curl_mimepart *part)
* Check if a CRLF or end of data is in input buffer at current position + n.
* Return -1 if more data needed, 1 if CRLF or end of data, else 0.
*/
-static int qp_lookahead_eol(struct mime_encoder_state *st, int ateof, size_t n)
+static int qp_lookahead_eol(struct mime_encoder_state *st, int ateof, size_t n)
{
n += st->bufbeg;
if(n >= st->bufend && ateof)
@@ -530,7 +530,7 @@ static int qp_lookahead_eol(struct mime_encoder_state *st, int ateof, size_t n)
static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
curl_mimepart *part)
{
- struct mime_encoder_state *st = &part->encstate;
+ struct mime_encoder_state *st = &part->encstate;
char *ptr = buffer;
size_t cursize = 0;
int softlinebreak;
@@ -608,11 +608,11 @@ static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
}
/* If the output buffer would overflow, do not store. */
- if(len > size) {
- if(!cursize)
- return STOP_FILLING;
+ if(len > size) {
+ if(!cursize)
+ return STOP_FILLING;
break;
- }
+ }
/* Append to output buffer. */
memcpy(ptr, buf, len);
@@ -642,17 +642,17 @@ static size_t mime_mem_read(char *buffer, size_t size, size_t nitems,
void *instream)
{
curl_mimepart *part = (curl_mimepart *) instream;
- size_t sz = curlx_sotouz(part->datasize - part->state.offset);
+ size_t sz = curlx_sotouz(part->datasize - part->state.offset);
(void) size; /* Always 1.*/
- if(!nitems)
- return STOP_FILLING;
-
+ if(!nitems)
+ return STOP_FILLING;
+
if(sz > nitems)
sz = nitems;
if(sz)
- memcpy(buffer, part->data + curlx_sotouz(part->state.offset), sz);
+ memcpy(buffer, part->data + curlx_sotouz(part->state.offset), sz);
return sz;
}
@@ -673,7 +673,7 @@ static int mime_mem_seek(void *instream, curl_off_t offset, int whence)
if(offset < 0 || offset > part->datasize)
return CURL_SEEKFUNC_FAIL;
- part->state.offset = offset;
+ part->state.offset = offset;
return CURL_SEEKFUNC_OK;
}
@@ -685,7 +685,7 @@ static void mime_mem_free(void *ptr)
/* Named file callbacks. */
/* Argument is a pointer to the mime part. */
-static int mime_open_file(curl_mimepart *part)
+static int mime_open_file(curl_mimepart *part)
{
/* Open a MIMEKIND_FILE part. */
@@ -700,9 +700,9 @@ static size_t mime_file_read(char *buffer, size_t size, size_t nitems,
{
curl_mimepart *part = (curl_mimepart *) instream;
- if(!nitems)
- return STOP_FILLING;
-
+ if(!nitems)
+ return STOP_FILLING;
+
if(mime_open_file(part))
return READ_ERROR;
@@ -740,22 +740,22 @@ static void mime_file_free(void *ptr)
/* Argument is a pointer to the mime structure. */
/* Readback a byte string segment. */
-static size_t readback_bytes(struct mime_state *state,
+static size_t readback_bytes(struct mime_state *state,
char *buffer, size_t bufsize,
const char *bytes, size_t numbytes,
const char *trail)
{
size_t sz;
- size_t offset = curlx_sotouz(state->offset);
+ size_t offset = curlx_sotouz(state->offset);
- if(numbytes > offset) {
- sz = numbytes - offset;
- bytes += offset;
+ if(numbytes > offset) {
+ sz = numbytes - offset;
+ bytes += offset;
}
else {
size_t tsz = strlen(trail);
- sz = offset - numbytes;
+ sz = offset - numbytes;
if(sz >= tsz)
return 0;
bytes = trail + sz;
@@ -772,79 +772,79 @@ static size_t readback_bytes(struct mime_state *state,
/* Read a non-encoded part content. */
static size_t read_part_content(curl_mimepart *part,
- char *buffer, size_t bufsize, bool *hasread)
+ char *buffer, size_t bufsize, bool *hasread)
{
size_t sz = 0;
- switch(part->lastreadstatus) {
- case 0:
- case CURL_READFUNC_ABORT:
- case CURL_READFUNC_PAUSE:
- case READ_ERROR:
- return part->lastreadstatus;
- default:
- break;
- }
-
- /* If we can determine we are at end of part data, spare a read. */
- if(part->datasize != (curl_off_t) -1 &&
- part->state.offset >= part->datasize) {
- /* sz is already zero. */
- }
- else {
- switch(part->kind) {
- case MIMEKIND_MULTIPART:
- /*
- * Cannot be processed as other kinds since read function requires
- * an additional parameter and is highly recursive.
- */
- sz = mime_subparts_read(buffer, 1, bufsize, part->arg, hasread);
- break;
- case MIMEKIND_FILE:
- if(part->fp && feof(part->fp))
- break; /* At EOF. */
- /* FALLTHROUGH */
- default:
- if(part->readfunc) {
- if(!(part->flags & MIME_FAST_READ)) {
- if(*hasread)
- return STOP_FILLING;
- *hasread = TRUE;
- }
- sz = part->readfunc(buffer, 1, bufsize, part->arg);
- }
- break;
- }
- }
-
- switch(sz) {
- case STOP_FILLING:
- break;
- case 0:
- case CURL_READFUNC_ABORT:
- case CURL_READFUNC_PAUSE:
- case READ_ERROR:
- part->lastreadstatus = sz;
- break;
- default:
- part->state.offset += sz;
- part->lastreadstatus = sz;
- break;
- }
-
+ switch(part->lastreadstatus) {
+ case 0:
+ case CURL_READFUNC_ABORT:
+ case CURL_READFUNC_PAUSE:
+ case READ_ERROR:
+ return part->lastreadstatus;
+ default:
+ break;
+ }
+
+ /* If we can determine we are at end of part data, spare a read. */
+ if(part->datasize != (curl_off_t) -1 &&
+ part->state.offset >= part->datasize) {
+ /* sz is already zero. */
+ }
+ else {
+ switch(part->kind) {
+ case MIMEKIND_MULTIPART:
+ /*
+ * Cannot be processed as other kinds since read function requires
+ * an additional parameter and is highly recursive.
+ */
+ sz = mime_subparts_read(buffer, 1, bufsize, part->arg, hasread);
+ break;
+ case MIMEKIND_FILE:
+ if(part->fp && feof(part->fp))
+ break; /* At EOF. */
+ /* FALLTHROUGH */
+ default:
+ if(part->readfunc) {
+ if(!(part->flags & MIME_FAST_READ)) {
+ if(*hasread)
+ return STOP_FILLING;
+ *hasread = TRUE;
+ }
+ sz = part->readfunc(buffer, 1, bufsize, part->arg);
+ }
+ break;
+ }
+ }
+
+ switch(sz) {
+ case STOP_FILLING:
+ break;
+ case 0:
+ case CURL_READFUNC_ABORT:
+ case CURL_READFUNC_PAUSE:
+ case READ_ERROR:
+ part->lastreadstatus = sz;
+ break;
+ default:
+ part->state.offset += sz;
+ part->lastreadstatus = sz;
+ break;
+ }
+
return sz;
}
/* Read and encode part content. */
-static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
- size_t bufsize, bool *hasread)
+static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
+ size_t bufsize, bool *hasread)
{
- struct mime_encoder_state *st = &part->encstate;
+ struct mime_encoder_state *st = &part->encstate;
size_t cursize = 0;
size_t sz;
bool ateof = FALSE;
- for(;;) {
+ for(;;) {
if(st->bufbeg < st->bufend || ateof) {
/* Encode buffered data. */
sz = part->encoder->encodefunc(buffer, bufsize, ateof, part);
@@ -854,7 +854,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
return cursize;
break;
case READ_ERROR:
- case STOP_FILLING:
+ case STOP_FILLING:
return cursize? cursize: sz;
default:
cursize += sz;
@@ -876,7 +876,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
if(st->bufend >= sizeof(st->buf))
return cursize? cursize: READ_ERROR; /* Buffer full. */
sz = read_part_content(part, st->buf + st->bufend,
- sizeof(st->buf) - st->bufend, hasread);
+ sizeof(st->buf) - st->bufend, hasread);
switch(sz) {
case 0:
ateof = TRUE;
@@ -884,7 +884,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
case CURL_READFUNC_ABORT:
case CURL_READFUNC_PAUSE:
case READ_ERROR:
- case STOP_FILLING:
+ case STOP_FILLING:
return cursize? cursize: sz;
default:
st->bufend += sz;
@@ -892,12 +892,12 @@ static size_t read_encoded_part_content(curl_mimepart *part, char *buffer,
}
}
- /* NOTREACHED */
+ /* NOTREACHED */
}
/* Readback a mime part. */
static size_t readback_part(curl_mimepart *part,
- char *buffer, size_t bufsize, bool *hasread)
+ char *buffer, size_t bufsize, bool *hasread)
{
size_t cursize = 0;
#ifdef CURL_DOES_CONVERSIONS
@@ -956,9 +956,9 @@ static size_t readback_part(curl_mimepart *part,
break;
case MIMESTATE_CONTENT:
if(part->encoder)
- sz = read_encoded_part_content(part, buffer, bufsize, hasread);
+ sz = read_encoded_part_content(part, buffer, bufsize, hasread);
else
- sz = read_part_content(part, buffer, bufsize, hasread);
+ sz = read_part_content(part, buffer, bufsize, hasread);
switch(sz) {
case 0:
mimesetstate(&part->state, MIMESTATE_END, NULL);
@@ -971,7 +971,7 @@ static size_t readback_part(curl_mimepart *part,
case CURL_READFUNC_ABORT:
case CURL_READFUNC_PAUSE:
case READ_ERROR:
- case STOP_FILLING:
+ case STOP_FILLING:
return cursize? cursize: sz;
}
break;
@@ -1000,9 +1000,9 @@ static size_t readback_part(curl_mimepart *part,
return cursize;
}
-/* Readback from mime. Warning: not a read callback function. */
+/* Readback from mime. Warning: not a read callback function. */
static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems,
- void *instream, bool *hasread)
+ void *instream, bool *hasread)
{
curl_mime *mime = (curl_mime *) instream;
size_t cursize = 0;
@@ -1023,7 +1023,7 @@ static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems,
#endif
mimesetstate(&mime->state, MIMESTATE_BOUNDARY1, mime->firstpart);
/* The first boundary always follows the header termination empty line,
- so is always preceded by a CRLF. We can then spare 2 characters
+ so is always preceded by a CRLF. We can then spare 2 characters
by skipping the leading CRLF in boundary. */
mime->state.offset += 2;
break;
@@ -1053,12 +1053,12 @@ static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems,
mimesetstate(&mime->state, MIMESTATE_END, NULL);
break;
}
- sz = readback_part(part, buffer, nitems, hasread);
+ sz = readback_part(part, buffer, nitems, hasread);
switch(sz) {
case CURL_READFUNC_ABORT:
case CURL_READFUNC_PAUSE:
case READ_ERROR:
- case STOP_FILLING:
+ case STOP_FILLING:
return cursize? cursize: sz;
case 0:
#ifdef CURL_DOES_CONVERSIONS
@@ -1123,7 +1123,7 @@ static int mime_part_rewind(curl_mimepart *part)
if(res == CURL_SEEKFUNC_OK)
mimesetstate(&part->state, targetstate, NULL);
- part->lastreadstatus = 1; /* Successful read status. */
+ part->lastreadstatus = 1; /* Successful read status. */
return res;
}
@@ -1166,8 +1166,8 @@ static void cleanup_part_content(curl_mimepart *part)
part->datasize = (curl_off_t) 0; /* No size yet. */
cleanup_encoder_state(&part->encstate);
part->kind = MIMEKIND_NONE;
- part->flags &= ~MIME_FAST_READ;
- part->lastreadstatus = 1; /* Successful read status. */
+ part->flags &= ~MIME_FAST_READ;
+ part->lastreadstatus = 1; /* Successful read status. */
}
static void mime_subparts_free(void *ptr)
@@ -1230,8 +1230,8 @@ CURLcode Curl_mime_duppart(curl_mimepart *dst, const curl_mimepart *src)
const curl_mimepart *s;
CURLcode res = CURLE_OK;
- DEBUGASSERT(dst);
-
+ DEBUGASSERT(dst);
+
/* Duplicate content. */
switch(src->kind) {
case MIMEKIND_NONE:
@@ -1281,18 +1281,18 @@ CURLcode Curl_mime_duppart(curl_mimepart *dst, const curl_mimepart *src)
}
}
- if(!res) {
- /* Duplicate other fields. */
+ if(!res) {
+ /* Duplicate other fields. */
dst->encoder = src->encoder;
res = curl_mime_type(dst, src->mimetype);
- }
+ }
if(!res)
res = curl_mime_name(dst, src->name);
if(!res)
res = curl_mime_filename(dst, src->filename);
/* If an error occurred, rollback. */
- if(res)
+ if(res)
Curl_mime_cleanpart(dst);
return res;
@@ -1333,7 +1333,7 @@ void Curl_mime_initpart(curl_mimepart *part, struct Curl_easy *easy)
{
memset((char *) part, 0, sizeof(*part));
part->easy = easy;
- part->lastreadstatus = 1; /* Successful read status. */
+ part->lastreadstatus = 1; /* Successful read status. */
mimesetstate(&part->state, MIMESTATE_BEGIN, NULL);
}
@@ -1419,12 +1419,12 @@ CURLcode curl_mime_data(curl_mimepart *part,
if(datasize)
memcpy(part->data, data, datasize);
- part->data[datasize] = '\0'; /* Set a null terminator as sentinel. */
+ part->data[datasize] = '\0'; /* Set a null terminator as sentinel. */
part->readfunc = mime_mem_read;
part->seekfunc = mime_mem_seek;
part->freefunc = mime_mem_free;
- part->flags |= MIME_FAST_READ;
+ part->flags |= MIME_FAST_READ;
part->kind = MIMEKIND_DATA;
}
@@ -1502,7 +1502,7 @@ CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype)
CURLcode curl_mime_encoder(curl_mimepart *part, const char *encoding)
{
CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT;
- const struct mime_encoder *mep;
+ const struct mime_encoder *mep;
if(!part)
return result;
@@ -1599,7 +1599,7 @@ CURLcode Curl_mime_set_subparts(curl_mimepart *part,
}
subparts->parent = part;
- /* Subparts are processed internally: no read callback. */
+ /* Subparts are processed internally: no read callback. */
part->seekfunc = mime_subparts_seek;
part->freefunc = take_ownership? mime_subparts_free: mime_subparts_unbind;
part->arg = subparts;
@@ -1621,23 +1621,23 @@ CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts)
size_t Curl_mime_read(char *buffer, size_t size, size_t nitems, void *instream)
{
curl_mimepart *part = (curl_mimepart *) instream;
- size_t ret;
- bool hasread;
+ size_t ret;
+ bool hasread;
(void) size; /* Always 1. */
-
- do {
- hasread = FALSE;
- ret = readback_part(part, buffer, nitems, &hasread);
- /*
- * If this is not possible to get some data without calling more than
- * one read callback (probably because a content encoder is not able to
- * deliver a new bunch for the few data accumulated so far), force another
- * read until we get enough data or a special exit code.
- */
- } while(ret == STOP_FILLING);
-
- return ret;
+
+ do {
+ hasread = FALSE;
+ ret = readback_part(part, buffer, nitems, &hasread);
+ /*
+ * If this is not possible to get some data without calling more than
+ * one read callback (probably because a content encoder is not able to
+ * deliver a new bunch for the few data accumulated so far), force another
+ * read until we get enough data or a special exit code.
+ */
+ } while(ret == STOP_FILLING);
+
+ return ret;
}
/* Rewind mime stream. */
@@ -1778,23 +1778,23 @@ const char *Curl_mime_contenttype(const char *filename)
return NULL;
}
-static bool content_type_match(const char *contenttype, const char *target)
-{
- size_t len = strlen(target);
-
- if(contenttype && strncasecompare(contenttype, target, len))
- switch(contenttype[len]) {
- case '\0':
- case '\t':
- case '\r':
- case '\n':
- case ' ':
- case ';':
- return TRUE;
- }
- return FALSE;
-}
-
+static bool content_type_match(const char *contenttype, const char *target)
+{
+ size_t len = strlen(target);
+
+ if(contenttype && strncasecompare(contenttype, target, len))
+ switch(contenttype[len]) {
+ case '\0':
+ case '\t':
+ case '\r':
+ case '\n':
+ case ' ':
+ case ';':
+ return TRUE;
+ }
+ return FALSE;
+}
+
CURLcode Curl_mime_prepare_headers(curl_mimepart *part,
const char *contenttype,
const char *disposition,
@@ -1846,7 +1846,7 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part,
boundary = mime->boundary;
}
else if(contenttype && !customct &&
- content_type_match(contenttype, "text/plain"))
+ content_type_match(contenttype, "text/plain"))
if(strategy == MIMESTRATEGY_MAIL || !part->filename)
contenttype = NULL;
@@ -1922,7 +1922,7 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part,
curl_mimepart *subpart;
disposition = NULL;
- if(content_type_match(contenttype, "multipart/form-data"))
+ if(content_type_match(contenttype, "multipart/form-data"))
disposition = "form-data";
for(subpart = mime->firstpart; subpart; subpart = subpart->nextpart) {
ret = Curl_mime_prepare_headers(subpart, NULL, disposition, strategy);
@@ -1933,26 +1933,26 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part,
return ret;
}
-/* Recursively reset paused status in the given part. */
-void Curl_mime_unpause(curl_mimepart *part)
-{
- if(part) {
- if(part->lastreadstatus == CURL_READFUNC_PAUSE)
- part->lastreadstatus = 1; /* Successful read status. */
- if(part->kind == MIMEKIND_MULTIPART) {
- curl_mime *mime = (curl_mime *) part->arg;
-
- if(mime) {
- curl_mimepart *subpart;
-
- for(subpart = mime->firstpart; subpart; subpart = subpart->nextpart)
- Curl_mime_unpause(subpart);
- }
- }
- }
-}
-
-
+/* Recursively reset paused status in the given part. */
+void Curl_mime_unpause(curl_mimepart *part)
+{
+ if(part) {
+ if(part->lastreadstatus == CURL_READFUNC_PAUSE)
+ part->lastreadstatus = 1; /* Successful read status. */
+ if(part->kind == MIMEKIND_MULTIPART) {
+ curl_mime *mime = (curl_mime *) part->arg;
+
+ if(mime) {
+ curl_mimepart *subpart;
+
+ for(subpart = mime->firstpart; subpart; subpart = subpart->nextpart)
+ Curl_mime_unpause(subpart);
+ }
+ }
+ }
+}
+
+
#else /* !CURL_DISABLE_HTTP || !CURL_DISABLE_SMTP || !CURL_DISABLE_IMAP */
/* Mime not compiled in: define stubs for externally-referenced functions. */
@@ -2049,11 +2049,11 @@ CURLcode curl_mime_headers(curl_mimepart *part,
return CURLE_NOT_BUILT_IN;
}
-CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...)
-{
- (void)slp;
- (void)fmt;
- return CURLE_NOT_BUILT_IN;
-}
-
+CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...)
+{
+ (void)slp;
+ (void)fmt;
+ return CURLE_NOT_BUILT_IN;
+}
+
#endif /* if disabled */
diff --git a/contrib/libs/curl/lib/mime.h b/contrib/libs/curl/lib/mime.h
index f89a268ab5..ab89d52517 100644
--- a/contrib/libs/curl/lib/mime.h
+++ b/contrib/libs/curl/lib/mime.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -31,7 +31,7 @@
/* Part flags. */
#define MIME_USERHEADERS_OWNER (1 << 0)
#define MIME_BODY_ONLY (1 << 1)
-#define MIME_FAST_READ (1 << 2)
+#define MIME_FAST_READ (1 << 2)
#define FILE_CONTENTTYPE_DEFAULT "application/octet-stream"
#define MULTIPART_CONTENTTYPE_DEFAULT "multipart/mixed"
@@ -69,43 +69,43 @@ enum mimestrategy {
};
/* Content transfer encoder. */
-struct mime_encoder {
+struct mime_encoder {
const char * name; /* Encoding name. */
size_t (*encodefunc)(char *buffer, size_t size, bool ateof,
curl_mimepart *part); /* Encoded read. */
curl_off_t (*sizefunc)(curl_mimepart *part); /* Encoded size. */
-};
+};
/* Content transfer encoder state. */
-struct mime_encoder_state {
+struct mime_encoder_state {
size_t pos; /* Position on output line. */
size_t bufbeg; /* Next data index in input buffer. */
size_t bufend; /* First unused byte index in input buffer. */
char buf[ENCODING_BUFFER_SIZE]; /* Input buffer. */
-};
+};
/* Mime readback state. */
-struct mime_state {
+struct mime_state {
enum mimestate state; /* Current state token. */
void *ptr; /* State-dependent pointer. */
- curl_off_t offset; /* State-dependent offset. */
-};
+ curl_off_t offset; /* State-dependent offset. */
+};
/* minimum buffer size for the boundary string */
#define MIME_BOUNDARY_LEN (24 + MIME_RAND_BOUNDARY_CHARS + 1)
/* A mime multipart. */
-struct curl_mime {
+struct curl_mime {
struct Curl_easy *easy; /* The associated easy handle. */
curl_mimepart *parent; /* Parent part. */
curl_mimepart *firstpart; /* First part. */
curl_mimepart *lastpart; /* Last part. */
char boundary[MIME_BOUNDARY_LEN]; /* The part boundary. */
- struct mime_state state; /* Current readback state. */
+ struct mime_state state; /* Current readback state. */
};
/* A mime part. */
-struct curl_mimepart {
+struct curl_mimepart {
struct Curl_easy *easy; /* The associated easy handle. */
curl_mime *parent; /* Parent mime structure. */
curl_mimepart *nextpart; /* Forward linked list. */
@@ -123,35 +123,35 @@ struct curl_mimepart {
char *name; /* Data name. */
curl_off_t datasize; /* Expected data size. */
unsigned int flags; /* Flags. */
- struct mime_state state; /* Current readback state. */
- const struct mime_encoder *encoder; /* Content data encoder. */
- struct mime_encoder_state encstate; /* Data encoder state. */
- size_t lastreadstatus; /* Last read callback returned status. */
+ struct mime_state state; /* Current readback state. */
+ const struct mime_encoder *encoder; /* Content data encoder. */
+ struct mime_encoder_state encstate; /* Data encoder state. */
+ size_t lastreadstatus; /* Last read callback returned status. */
};
-CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...);
-
-#if (!defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_MIME)) || \
+CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...);
+
+#if (!defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_MIME)) || \
!defined(CURL_DISABLE_SMTP) || !defined(CURL_DISABLE_IMAP)
/* Prototypes. */
-void Curl_mime_initpart(struct curl_mimepart *part, struct Curl_easy *easy);
-void Curl_mime_cleanpart(struct curl_mimepart *part);
-CURLcode Curl_mime_duppart(struct curl_mimepart *dst,
- const curl_mimepart *src);
-CURLcode Curl_mime_set_subparts(struct curl_mimepart *part,
- struct curl_mime *subparts,
- int take_ownership);
-CURLcode Curl_mime_prepare_headers(struct curl_mimepart *part,
+void Curl_mime_initpart(struct curl_mimepart *part, struct Curl_easy *easy);
+void Curl_mime_cleanpart(struct curl_mimepart *part);
+CURLcode Curl_mime_duppart(struct curl_mimepart *dst,
+ const curl_mimepart *src);
+CURLcode Curl_mime_set_subparts(struct curl_mimepart *part,
+ struct curl_mime *subparts,
+ int take_ownership);
+CURLcode Curl_mime_prepare_headers(struct curl_mimepart *part,
const char *contenttype,
const char *disposition,
enum mimestrategy strategy);
-curl_off_t Curl_mime_size(struct curl_mimepart *part);
+curl_off_t Curl_mime_size(struct curl_mimepart *part);
size_t Curl_mime_read(char *buffer, size_t size, size_t nitems,
void *instream);
-CURLcode Curl_mime_rewind(struct curl_mimepart *part);
+CURLcode Curl_mime_rewind(struct curl_mimepart *part);
const char *Curl_mime_contenttype(const char *filename);
-void Curl_mime_unpause(struct curl_mimepart *part);
+void Curl_mime_unpause(struct curl_mimepart *part);
#else
/* if disabled */
@@ -163,7 +163,7 @@ void Curl_mime_unpause(struct curl_mimepart *part);
#define Curl_mime_size(x) (curl_off_t) -1
#define Curl_mime_read NULL
#define Curl_mime_rewind(x) ((void)x, CURLE_NOT_BUILT_IN)
-#define Curl_mime_unpause(x)
+#define Curl_mime_unpause(x)
#endif
diff --git a/contrib/libs/curl/lib/mprintf.c b/contrib/libs/curl/lib/mprintf.c
index 4a32ad4609..c681248dee 100644
--- a/contrib/libs/curl/lib/mprintf.c
+++ b/contrib/libs/curl/lib/mprintf.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1999 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1999 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -36,7 +36,7 @@
*/
#include "curl_setup.h"
-#include "dynbuf.h"
+#include "dynbuf.h"
#include <curl/mprintf.h>
#include "curl_memory.h"
@@ -99,13 +99,13 @@ static const char lower_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
/* Upper-case digits. */
static const char upper_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-#define OUTCHAR(x) \
- do { \
+#define OUTCHAR(x) \
+ do { \
if(stream((unsigned char)(x), (FILE *)data) != -1) \
- done++; \
- else \
- return done; /* return immediately on failure */ \
- } while(0)
+ done++; \
+ else \
+ return done; /* return immediately on failure */ \
+ } while(0)
/* Data type to read from the arglist */
typedef enum {
@@ -146,7 +146,7 @@ enum {
FLAGS_FLOATG = 1<<19 /* %g or %G */
};
-struct va_stack {
+struct va_stack {
FormatType type;
int flags;
long width; /* width OR width parameter number */
@@ -160,7 +160,7 @@ struct va_stack {
} num;
double dnum;
} data;
-};
+};
struct nsprintf {
char *buffer;
@@ -169,23 +169,23 @@ struct nsprintf {
};
struct asprintf {
- struct dynbuf *b;
- bool fail; /* if an alloc has failed and thus the output is not the complete
- data */
+ struct dynbuf *b;
+ bool fail; /* if an alloc has failed and thus the output is not the complete
+ data */
};
static long dprintf_DollarString(char *input, char **end)
{
int number = 0;
while(ISDIGIT(*input)) {
- if(number < MAX_PARAMETERS) {
- number *= 10;
- number += *input - '0';
- }
+ if(number < MAX_PARAMETERS) {
+ number *= 10;
+ number += *input - '0';
+ }
input++;
}
- if(number <= MAX_PARAMETERS && ('$' == *input)) {
- *end = ++input;
+ if(number <= MAX_PARAMETERS && ('$' == *input)) {
+ *end = ++input;
return number;
}
return 0;
@@ -225,8 +225,8 @@ static bool dprintf_IsQualifierNoDollar(const char *fmt)
*
******************************************************************/
-static int dprintf_Pass1(const char *format, struct va_stack *vto,
- char **endpos, va_list arglist)
+static int dprintf_Pass1(const char *format, struct va_stack *vto,
+ char **endpos, va_list arglist)
{
char *fmt = (char *)format;
int param_num = 0;
@@ -379,8 +379,8 @@ static int dprintf_Pass1(const char *format, struct va_stack *vto,
if(width > max_param)
max_param = width;
break;
- case '\0':
- fmt--;
+ case '\0':
+ fmt--;
default:
break;
}
@@ -462,9 +462,9 @@ static int dprintf_Pass1(const char *format, struct va_stack *vto,
/* we have the width specified from a parameter, so we make that
parameter's info setup properly */
long k = width - 1;
- if((k < 0) || (k >= MAX_PARAMETERS))
- /* out of allowed range */
- return 1;
+ if((k < 0) || (k >= MAX_PARAMETERS))
+ /* out of allowed range */
+ return 1;
vto[i].width = k;
vto[k].type = FORMAT_WIDTH;
vto[k].flags = FLAGS_NEW;
@@ -476,9 +476,9 @@ static int dprintf_Pass1(const char *format, struct va_stack *vto,
/* we have the precision specified from a parameter, so we make that
parameter's info setup properly */
long k = precision - 1;
- if((k < 0) || (k >= MAX_PARAMETERS))
- /* out of allowed range */
- return 1;
+ if((k < 0) || (k >= MAX_PARAMETERS))
+ /* out of allowed range */
+ return 1;
vto[i].precision = k;
vto[k].type = FORMAT_WIDTH;
vto[k].flags = FLAGS_NEW;
@@ -486,7 +486,7 @@ static int dprintf_Pass1(const char *format, struct va_stack *vto,
vto[k].width = 0;
vto[k].precision = 0;
}
- *endpos++ = fmt + ((*fmt == '\0') ? 0 : 1); /* end of this sequence */
+ *endpos++ = fmt + ((*fmt == '\0') ? 0 : 1); /* end of this sequence */
}
}
@@ -580,11 +580,11 @@ static int dprintf_formatf(
long param; /* current parameter to read */
long param_num = 0; /* parameter counter */
- struct va_stack vto[MAX_PARAMETERS];
+ struct va_stack vto[MAX_PARAMETERS];
char *endpos[MAX_PARAMETERS];
char **end;
char work[BUFFSIZE];
- struct va_stack *p;
+ struct va_stack *p;
/* 'workend' points to the final buffer byte position, but with an extra
byte as margin to avoid the (false?) warning Coverity gives us
@@ -764,7 +764,7 @@ static int dprintf_formatf(
if(prec > 0) {
width -= prec;
- while(prec-- > 0 && w >= work)
+ while(prec-- > 0 && w >= work)
*w-- = '0';
}
@@ -878,7 +878,7 @@ static int dprintf_formatf(
OUTCHAR(' ');
for(point = strnil; *point != '\0'; ++point)
OUTCHAR(*point);
- if(!(p->flags & FLAGS_LEFT))
+ if(!(p->flags & FLAGS_LEFT))
while(width-- > 0)
OUTCHAR(' ');
}
@@ -928,8 +928,8 @@ static int dprintf_formatf(
precision */
size_t maxprec = sizeof(work) - 2;
double val = p->data.dnum;
- if(width > 0 && prec <= width)
- maxprec -= width;
+ if(width > 0 && prec <= width)
+ maxprec -= width;
while(val >= 10.0) {
val /= 10;
maxprec--;
@@ -937,8 +937,8 @@ static int dprintf_formatf(
if(prec > (long)maxprec)
prec = (long)maxprec-1;
- if(prec < 0)
- prec = 0;
+ if(prec < 0)
+ prec = 0;
/* RECURSIVE USAGE */
len = curl_msnprintf(fptr, left, ".%ld", prec);
fptr += len;
@@ -1042,61 +1042,61 @@ static int alloc_addbyter(int output, FILE *data)
struct asprintf *infop = (struct asprintf *)data;
unsigned char outc = (unsigned char)output;
- if(Curl_dyn_addn(infop->b, &outc, 1)) {
- infop->fail = 1;
- return -1; /* fail */
+ if(Curl_dyn_addn(infop->b, &outc, 1)) {
+ infop->fail = 1;
+ return -1; /* fail */
}
return outc; /* fputc() returns like this on success */
}
-extern int Curl_dyn_vprintf(struct dynbuf *dyn,
- const char *format, va_list ap_save);
-
-/* appends the formatted string, returns 0 on success, 1 on error */
-int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save)
+extern int Curl_dyn_vprintf(struct dynbuf *dyn,
+ const char *format, va_list ap_save);
+
+/* appends the formatted string, returns 0 on success, 1 on error */
+int Curl_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save)
{
int retcode;
struct asprintf info;
- info.b = dyn;
+ info.b = dyn;
info.fail = 0;
retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
if((-1 == retcode) || info.fail) {
- Curl_dyn_free(info.b);
- return 1;
+ Curl_dyn_free(info.b);
+ return 1;
}
- return 0;
+ return 0;
}
char *curl_mvaprintf(const char *format, va_list ap_save)
{
int retcode;
struct asprintf info;
- struct dynbuf dyn;
- info.b = &dyn;
- Curl_dyn_init(info.b, DYN_APRINTF);
+ struct dynbuf dyn;
+ info.b = &dyn;
+ Curl_dyn_init(info.b, DYN_APRINTF);
info.fail = 0;
retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
if((-1 == retcode) || info.fail) {
- Curl_dyn_free(info.b);
+ Curl_dyn_free(info.b);
return NULL;
}
- if(Curl_dyn_len(info.b))
- return Curl_dyn_ptr(info.b);
+ if(Curl_dyn_len(info.b))
+ return Curl_dyn_ptr(info.b);
return strdup("");
}
-char *curl_maprintf(const char *format, ...)
-{
- va_list ap_save;
- char *s;
- va_start(ap_save, format);
- s = curl_mvaprintf(format, ap_save);
- va_end(ap_save);
- return s;
-}
-
+char *curl_maprintf(const char *format, ...)
+{
+ va_list ap_save;
+ char *s;
+ va_start(ap_save, format);
+ s = curl_mvaprintf(format, ap_save);
+ va_end(ap_save);
+ return s;
+}
+
static int storebuffer(int output, FILE *data)
{
char **buffer = (char **)data;
diff --git a/contrib/libs/curl/lib/mqtt.c b/contrib/libs/curl/lib/mqtt.c
index 9981a57367..e324ec3dd7 100644
--- a/contrib/libs/curl/lib/mqtt.c
+++ b/contrib/libs/curl/lib/mqtt.c
@@ -1,624 +1,624 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
- * Copyright (C) 2019, Björn Stenberg, <bjorn@haxx.se>
- *
- * 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.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"
-
-#ifndef CURL_DISABLE_MQTT
-
-#include "urldata.h"
-#include <curl/curl.h>
-#include "transfer.h"
-#include "sendf.h"
-#include "progress.h"
-#include "mqtt.h"
-#include "select.h"
-#include "strdup.h"
-#include "url.h"
-#include "escape.h"
-#include "warnless.h"
-#include "curl_printf.h"
-#include "curl_memory.h"
-#include "multiif.h"
-#include "rand.h"
-
-/* The last #include file should be: */
-#include "memdebug.h"
-
-#define MQTT_MSG_CONNECT 0x10
-#define MQTT_MSG_CONNACK 0x20
-#define MQTT_MSG_PUBLISH 0x30
-#define MQTT_MSG_SUBSCRIBE 0x82
-#define MQTT_MSG_SUBACK 0x90
-#define MQTT_MSG_DISCONNECT 0xe0
-
-#define MQTT_CONNACK_LEN 2
-#define MQTT_SUBACK_LEN 3
-#define MQTT_CLIENTID_LEN 12 /* "curl0123abcd" */
-
-/*
- * Forward declarations.
- */
-
-static CURLcode mqtt_do(struct connectdata *conn, bool *done);
-static CURLcode mqtt_doing(struct connectdata *conn, bool *done);
-static int mqtt_getsock(struct connectdata *conn, curl_socket_t *sock);
-static CURLcode mqtt_setup_conn(struct connectdata *conn);
-
-/*
- * MQTT protocol handler.
- */
-
-const struct Curl_handler Curl_handler_mqtt = {
- "MQTT", /* scheme */
- mqtt_setup_conn, /* setup_connection */
- mqtt_do, /* do_it */
- ZERO_NULL, /* done */
- ZERO_NULL, /* do_more */
- ZERO_NULL, /* connect_it */
- ZERO_NULL, /* connecting */
- mqtt_doing, /* doing */
- ZERO_NULL, /* proto_getsock */
- mqtt_getsock, /* doing_getsock */
- ZERO_NULL, /* domore_getsock */
- ZERO_NULL, /* perform_getsock */
- ZERO_NULL, /* disconnect */
- ZERO_NULL, /* readwrite */
- ZERO_NULL, /* connection_check */
- PORT_MQTT, /* defport */
- CURLPROTO_MQTT, /* protocol */
- CURLPROTO_MQTT, /* family */
- PROTOPT_NONE /* flags */
-};
-
-static CURLcode mqtt_setup_conn(struct connectdata *conn)
-{
- /* allocate the HTTP-specific struct for the Curl_easy, only to survive
- during this request */
- struct MQTT *mq;
- struct Curl_easy *data = conn->data;
- DEBUGASSERT(data->req.p.mqtt == NULL);
-
- mq = calloc(1, sizeof(struct MQTT));
- if(!mq)
- return CURLE_OUT_OF_MEMORY;
- data->req.p.mqtt = mq;
- return CURLE_OK;
-}
-
-static CURLcode mqtt_send(struct connectdata *conn,
- char *buf, size_t len)
-{
- CURLcode result = CURLE_OK;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
- struct Curl_easy *data = conn->data;
- struct MQTT *mq = data->req.p.mqtt;
- ssize_t n;
- result = Curl_write(conn, sockfd, buf, len, &n);
- if(!result)
- Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
- if(len != (size_t)n) {
- size_t nsend = len - n;
- char *sendleftovers = Curl_memdup(&buf[n], nsend);
- if(!sendleftovers)
- return CURLE_OUT_OF_MEMORY;
- mq->sendleftovers = sendleftovers;
- mq->nsend = nsend;
- }
- return result;
-}
-
-/* Generic function called by the multi interface to figure out what socket(s)
- to wait for and for what actions during the DOING and PROTOCONNECT
- states */
-static int mqtt_getsock(struct connectdata *conn,
- curl_socket_t *sock)
-{
- sock[0] = conn->sock[FIRSTSOCKET];
- return GETSOCK_READSOCK(FIRSTSOCKET);
-}
-
-static CURLcode mqtt_connect(struct connectdata *conn)
-{
- CURLcode result = CURLE_OK;
- const size_t client_id_offset = 14;
- const size_t packetlen = client_id_offset + MQTT_CLIENTID_LEN;
- char client_id[MQTT_CLIENTID_LEN + 1] = "curl";
- const size_t clen = strlen("curl");
- char packet[32] = {
- MQTT_MSG_CONNECT, /* packet type */
- 0x00, /* remaining length */
- 0x00, 0x04, /* protocol length */
- 'M','Q','T','T', /* protocol name */
- 0x04, /* protocol level */
- 0x02, /* CONNECT flag: CleanSession */
- 0x00, 0x3c, /* keep-alive 0 = disabled */
- 0x00, 0x00 /* payload1 length */
- };
- packet[1] = (packetlen - 2) & 0x7f;
- packet[client_id_offset - 1] = MQTT_CLIENTID_LEN;
-
- result = Curl_rand_hex(conn->data, (unsigned char *)&client_id[clen],
- MQTT_CLIENTID_LEN - clen + 1);
- memcpy(&packet[client_id_offset], client_id, MQTT_CLIENTID_LEN);
- infof(conn->data, "Using client id '%s'\n", client_id);
- if(!result)
- result = mqtt_send(conn, packet, packetlen);
- return result;
-}
-
-static CURLcode mqtt_disconnect(struct connectdata *conn)
-{
- CURLcode result = CURLE_OK;
- result = mqtt_send(conn, (char *)"\xe0\x00", 2);
- return result;
-}
-
-static CURLcode mqtt_verify_connack(struct connectdata *conn)
-{
- CURLcode result;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
- unsigned char readbuf[MQTT_CONNACK_LEN];
- ssize_t nread;
- struct Curl_easy *data = conn->data;
-
- result = Curl_read(conn, sockfd, (char *)readbuf, MQTT_CONNACK_LEN, &nread);
- if(result)
- goto fail;
-
- Curl_debug(data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
-
- /* fixme */
- if(nread < MQTT_CONNACK_LEN) {
- result = CURLE_WEIRD_SERVER_REPLY;
- goto fail;
- }
-
- /* verify CONNACK */
- if(readbuf[0] != 0x00 || readbuf[1] != 0x00) {
- failf(data, "Expected %02x%02x but got %02x%02x",
- 0x00, 0x00, readbuf[0], readbuf[1]);
- result = CURLE_WEIRD_SERVER_REPLY;
- }
-
-fail:
- return result;
-}
-
-static CURLcode mqtt_get_topic(struct connectdata *conn,
- char **topic, size_t *topiclen)
-{
- CURLcode result = CURLE_OK;
- char *path = conn->data->state.up.path;
-
- if(strlen(path) > 1) {
- result = Curl_urldecode(conn->data, path + 1, 0, topic, topiclen,
- REJECT_NADA);
- }
- else {
- failf(conn->data, "Error: No topic specified.");
- result = CURLE_URL_MALFORMAT;
- }
- return result;
-}
-
-
-static int mqtt_encode_len(char *buf, size_t len)
-{
- unsigned char encoded;
- int i;
-
- for(i = 0; (len > 0) && (i<4); i++) {
- encoded = len % 0x80;
- len /= 0x80;
- if(len)
- encoded |= 0x80;
- buf[i] = encoded;
- }
-
- return i;
-}
-
-static CURLcode mqtt_subscribe(struct connectdata *conn)
-{
- CURLcode result = CURLE_OK;
- char *topic = NULL;
- size_t topiclen;
- unsigned char *packet = NULL;
- size_t packetlen;
- char encodedsize[4];
- size_t n;
-
- result = mqtt_get_topic(conn, &topic, &topiclen);
- if(result)
- goto fail;
-
- conn->proto.mqtt.packetid++;
-
- packetlen = topiclen + 5; /* packetid + topic (has a two byte length field)
- + 2 bytes topic length + QoS byte */
- n = mqtt_encode_len((char *)encodedsize, packetlen);
- packetlen += n + 1; /* add one for the control packet type byte */
-
- packet = malloc(packetlen);
- if(!packet) {
- result = CURLE_OUT_OF_MEMORY;
- goto fail;
- }
-
- packet[0] = MQTT_MSG_SUBSCRIBE;
- memcpy(&packet[1], encodedsize, n);
- packet[1 + n] = (conn->proto.mqtt.packetid >> 8) & 0xff;
- packet[2 + n] = conn->proto.mqtt.packetid & 0xff;
- packet[3 + n] = (topiclen >> 8) & 0xff;
- packet[4 + n ] = topiclen & 0xff;
- memcpy(&packet[5 + n], topic, topiclen);
- packet[5 + n + topiclen] = 0; /* QoS zero */
-
- result = mqtt_send(conn, (char *)packet, packetlen);
-
-fail:
- free(topic);
- free(packet);
- return result;
-}
-
-/*
- * Called when the first byte was already read.
- */
-static CURLcode mqtt_verify_suback(struct connectdata *conn)
-{
- CURLcode result;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
- unsigned char readbuf[MQTT_SUBACK_LEN];
- ssize_t nread;
- struct mqtt_conn *mqtt = &conn->proto.mqtt;
-
- result = Curl_read(conn, sockfd, (char *)readbuf, MQTT_SUBACK_LEN, &nread);
- if(result)
- goto fail;
-
- Curl_debug(conn->data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
-
- /* fixme */
- if(nread < MQTT_SUBACK_LEN) {
- result = CURLE_WEIRD_SERVER_REPLY;
- goto fail;
- }
-
- /* verify SUBACK */
- if(readbuf[0] != ((mqtt->packetid >> 8) & 0xff) ||
- readbuf[1] != (mqtt->packetid & 0xff) ||
- readbuf[2] != 0x00)
- result = CURLE_WEIRD_SERVER_REPLY;
-
-fail:
- return result;
-}
-
-static CURLcode mqtt_publish(struct connectdata *conn)
-{
- CURLcode result;
- char *payload = conn->data->set.postfields;
- size_t payloadlen = (size_t)conn->data->set.postfieldsize;
- char *topic = NULL;
- size_t topiclen;
- unsigned char *pkt = NULL;
- size_t i = 0;
- size_t remaininglength;
- size_t encodelen;
- char encodedbytes[4];
-
- result = mqtt_get_topic(conn, &topic, &topiclen);
- if(result)
- goto fail;
-
- remaininglength = payloadlen + 2 + topiclen;
- encodelen = mqtt_encode_len(encodedbytes, remaininglength);
-
- /* add the control byte and the encoded remaining length */
- pkt = malloc(remaininglength + 1 + encodelen);
- if(!pkt) {
- result = CURLE_OUT_OF_MEMORY;
- goto fail;
- }
-
- /* assemble packet */
- pkt[i++] = MQTT_MSG_PUBLISH;
- memcpy(&pkt[i], encodedbytes, encodelen);
- i += encodelen;
- pkt[i++] = (topiclen >> 8) & 0xff;
- pkt[i++] = (topiclen & 0xff);
- memcpy(&pkt[i], topic, topiclen);
- i += topiclen;
- memcpy(&pkt[i], payload, payloadlen);
- i += payloadlen;
- result = mqtt_send(conn, (char *)pkt, i);
-
-fail:
- free(pkt);
- free(topic);
- return result;
-}
-
-static size_t mqtt_decode_len(unsigned char *buf,
- size_t buflen, size_t *lenbytes)
-{
- size_t len = 0;
- size_t mult = 1;
- size_t i;
- unsigned char encoded = 128;
-
- for(i = 0; (i < buflen) && (encoded & 128); i++) {
- encoded = buf[i];
- len += (encoded & 127) * mult;
- mult *= 128;
- }
-
- if(lenbytes)
- *lenbytes = i;
-
- return len;
-}
-
-#ifdef CURLDEBUG
-static const char *statenames[]={
- "MQTT_FIRST",
- "MQTT_REMAINING_LENGTH",
- "MQTT_CONNACK",
- "MQTT_SUBACK",
- "MQTT_SUBACK_COMING",
- "MQTT_PUBWAIT",
- "MQTT_PUB_REMAIN",
-
- "NOT A STATE"
-};
-#endif
-
-/* The only way to change state */
-static void mqstate(struct connectdata *conn,
- enum mqttstate state,
- enum mqttstate nextstate) /* used if state == FIRST */
-{
- struct mqtt_conn *mqtt = &conn->proto.mqtt;
-#ifdef CURLDEBUG
- infof(conn->data, "%s (from %s) (next is %s)\n",
- statenames[state],
- statenames[mqtt->state],
- (state == MQTT_FIRST)? statenames[nextstate] : "");
-#endif
- mqtt->state = state;
- if(state == MQTT_FIRST)
- mqtt->nextstate = nextstate;
-}
-
-
-/* for the publish packet */
-#define MQTT_HEADER_LEN 5 /* max 5 bytes */
-
-static CURLcode mqtt_read_publish(struct connectdata *conn,
- bool *done)
-{
- CURLcode result = CURLE_OK;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
- ssize_t nread;
- struct Curl_easy *data = conn->data;
- unsigned char *pkt = (unsigned char *)data->state.buffer;
- size_t remlen;
- struct mqtt_conn *mqtt = &conn->proto.mqtt;
- struct MQTT *mq = data->req.p.mqtt;
- unsigned char packet;
-
- switch(mqtt->state) {
- MQTT_SUBACK_COMING:
- case MQTT_SUBACK_COMING:
- result = mqtt_verify_suback(conn);
- if(result)
- break;
-
- mqstate(conn, MQTT_FIRST, MQTT_PUBWAIT);
- break;
-
- case MQTT_SUBACK:
- case MQTT_PUBWAIT:
- /* we are expecting PUBLISH or SUBACK */
- packet = mq->firstbyte & 0xf0;
- if(packet == MQTT_MSG_PUBLISH)
- mqstate(conn, MQTT_PUB_REMAIN, MQTT_NOSTATE);
- else if(packet == MQTT_MSG_SUBACK) {
- mqstate(conn, MQTT_SUBACK_COMING, MQTT_NOSTATE);
- goto MQTT_SUBACK_COMING;
- }
- else if(packet == MQTT_MSG_DISCONNECT) {
- infof(data, "Got DISCONNECT\n");
- *done = TRUE;
- goto end;
- }
- else {
- result = CURLE_WEIRD_SERVER_REPLY;
- goto end;
- }
-
- /* -- switched state -- */
- remlen = mq->remaining_length;
- infof(data, "Remaining length: %zd bytes\n", remlen);
- Curl_pgrsSetDownloadSize(data, remlen);
- data->req.bytecount = 0;
- data->req.size = remlen;
- mq->npacket = remlen; /* get this many bytes */
- /* FALLTHROUGH */
- case MQTT_PUB_REMAIN: {
- /* read rest of packet, but no more. Cap to buffer size */
- struct SingleRequest *k = &data->req;
- size_t rest = mq->npacket;
- if(rest > (size_t)data->set.buffer_size)
- rest = (size_t)data->set.buffer_size;
- result = Curl_read(conn, sockfd, (char *)pkt, rest, &nread);
- if(result) {
- if(CURLE_AGAIN == result) {
- infof(data, "EEEE AAAAGAIN\n");
- }
- goto end;
- }
- if(!nread) {
- infof(data, "server disconnected\n");
- result = CURLE_PARTIAL_FILE;
- goto end;
- }
- Curl_debug(data, CURLINFO_DATA_IN, (char *)pkt, (size_t)nread);
-
- mq->npacket -= nread;
- k->bytecount += nread;
- Curl_pgrsSetDownloadCounter(data, k->bytecount);
-
- /* if QoS is set, message contains packet id */
-
- result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)pkt, nread);
- if(result)
- goto end;
-
- if(!mq->npacket)
- /* no more PUBLISH payload, back to subscribe wait state */
- mqstate(conn, MQTT_FIRST, MQTT_PUBWAIT);
- break;
- }
- default:
- DEBUGASSERT(NULL); /* illegal state */
- result = CURLE_WEIRD_SERVER_REPLY;
- goto end;
- }
- end:
- return result;
-}
-
-static CURLcode mqtt_do(struct connectdata *conn, bool *done)
-{
- CURLcode result = CURLE_OK;
- struct Curl_easy *data = conn->data;
-
- *done = FALSE; /* unconditionally */
-
- result = mqtt_connect(conn);
- if(result) {
- failf(data, "Error %d sending MQTT CONN request", result);
- return result;
- }
- mqstate(conn, MQTT_FIRST, MQTT_CONNACK);
- return CURLE_OK;
-}
-
-static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
-{
- CURLcode result = CURLE_OK;
- struct mqtt_conn *mqtt = &conn->proto.mqtt;
- struct Curl_easy *data = conn->data;
- struct MQTT *mq = data->req.p.mqtt;
- ssize_t nread;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
- unsigned char *pkt = (unsigned char *)data->state.buffer;
- unsigned char byte;
-
- *done = FALSE;
-
- if(mq->nsend) {
- /* send the remainder of an outgoing packet */
- char *ptr = mq->sendleftovers;
- result = mqtt_send(conn, mq->sendleftovers, mq->nsend);
- free(ptr);
- if(result)
- return result;
- }
-
- infof(data, "mqtt_doing: state [%d]\n", (int) mqtt->state);
- switch(mqtt->state) {
- case MQTT_FIRST:
- /* Read the initial byte only */
- result = Curl_read(conn, sockfd, (char *)&mq->firstbyte, 1, &nread);
- if(result)
- break;
- Curl_debug(data, CURLINFO_HEADER_IN, (char *)&mq->firstbyte, 1);
- /* remember the first byte */
- mq->npacket = 0;
- mqstate(conn, MQTT_REMAINING_LENGTH, MQTT_NOSTATE);
- /* FALLTHROUGH */
- case MQTT_REMAINING_LENGTH:
- do {
- result = Curl_read(conn, sockfd, (char *)&byte, 1, &nread);
- if(result)
- break;
- Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
- pkt[mq->npacket++] = byte;
- } while((byte & 0x80) && (mq->npacket < 4));
- if(result)
- break;
- mq->remaining_length = mqtt_decode_len(&pkt[0], mq->npacket, NULL);
- mq->npacket = 0;
- if(mq->remaining_length) {
- mqstate(conn, mqtt->nextstate, MQTT_NOSTATE);
- break;
- }
- mqstate(conn, MQTT_FIRST, MQTT_FIRST);
-
- if(mq->firstbyte == MQTT_MSG_DISCONNECT) {
- infof(data, "Got DISCONNECT\n");
- *done = TRUE;
- }
- break;
- case MQTT_CONNACK:
- result = mqtt_verify_connack(conn);
- if(result)
- break;
-
- if(conn->data->state.httpreq == HTTPREQ_POST) {
- result = mqtt_publish(conn);
- if(!result) {
- result = mqtt_disconnect(conn);
- *done = TRUE;
- }
- mqtt->nextstate = MQTT_FIRST;
- }
- else {
- result = mqtt_subscribe(conn);
- if(!result) {
- mqstate(conn, MQTT_FIRST, MQTT_SUBACK);
- }
- }
- break;
-
- case MQTT_SUBACK:
- case MQTT_PUBWAIT:
- case MQTT_PUB_REMAIN:
- result = mqtt_read_publish(conn, done);
- break;
-
- default:
- failf(conn->data, "State not handled yet");
- *done = TRUE;
- break;
- }
-
- if(result == CURLE_AGAIN)
- result = CURLE_OK;
- return result;
-}
-
-#endif /* CURL_DISABLE_MQTT */
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2019, Björn Stenberg, <bjorn@haxx.se>
+ *
+ * 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.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"
+
+#ifndef CURL_DISABLE_MQTT
+
+#include "urldata.h"
+#include <curl/curl.h>
+#include "transfer.h"
+#include "sendf.h"
+#include "progress.h"
+#include "mqtt.h"
+#include "select.h"
+#include "strdup.h"
+#include "url.h"
+#include "escape.h"
+#include "warnless.h"
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "multiif.h"
+#include "rand.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+#define MQTT_MSG_CONNECT 0x10
+#define MQTT_MSG_CONNACK 0x20
+#define MQTT_MSG_PUBLISH 0x30
+#define MQTT_MSG_SUBSCRIBE 0x82
+#define MQTT_MSG_SUBACK 0x90
+#define MQTT_MSG_DISCONNECT 0xe0
+
+#define MQTT_CONNACK_LEN 2
+#define MQTT_SUBACK_LEN 3
+#define MQTT_CLIENTID_LEN 12 /* "curl0123abcd" */
+
+/*
+ * Forward declarations.
+ */
+
+static CURLcode mqtt_do(struct connectdata *conn, bool *done);
+static CURLcode mqtt_doing(struct connectdata *conn, bool *done);
+static int mqtt_getsock(struct connectdata *conn, curl_socket_t *sock);
+static CURLcode mqtt_setup_conn(struct connectdata *conn);
+
+/*
+ * MQTT protocol handler.
+ */
+
+const struct Curl_handler Curl_handler_mqtt = {
+ "MQTT", /* scheme */
+ mqtt_setup_conn, /* setup_connection */
+ mqtt_do, /* do_it */
+ ZERO_NULL, /* done */
+ ZERO_NULL, /* do_more */
+ ZERO_NULL, /* connect_it */
+ ZERO_NULL, /* connecting */
+ mqtt_doing, /* doing */
+ ZERO_NULL, /* proto_getsock */
+ mqtt_getsock, /* doing_getsock */
+ ZERO_NULL, /* domore_getsock */
+ ZERO_NULL, /* perform_getsock */
+ ZERO_NULL, /* disconnect */
+ ZERO_NULL, /* readwrite */
+ ZERO_NULL, /* connection_check */
+ PORT_MQTT, /* defport */
+ CURLPROTO_MQTT, /* protocol */
+ CURLPROTO_MQTT, /* family */
+ PROTOPT_NONE /* flags */
+};
+
+static CURLcode mqtt_setup_conn(struct connectdata *conn)
+{
+ /* allocate the HTTP-specific struct for the Curl_easy, only to survive
+ during this request */
+ struct MQTT *mq;
+ struct Curl_easy *data = conn->data;
+ DEBUGASSERT(data->req.p.mqtt == NULL);
+
+ mq = calloc(1, sizeof(struct MQTT));
+ if(!mq)
+ return CURLE_OUT_OF_MEMORY;
+ data->req.p.mqtt = mq;
+ return CURLE_OK;
+}
+
+static CURLcode mqtt_send(struct connectdata *conn,
+ char *buf, size_t len)
+{
+ CURLcode result = CURLE_OK;
+ curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
+ struct Curl_easy *data = conn->data;
+ struct MQTT *mq = data->req.p.mqtt;
+ ssize_t n;
+ result = Curl_write(conn, sockfd, buf, len, &n);
+ if(!result)
+ Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
+ if(len != (size_t)n) {
+ size_t nsend = len - n;
+ char *sendleftovers = Curl_memdup(&buf[n], nsend);
+ if(!sendleftovers)
+ return CURLE_OUT_OF_MEMORY;
+ mq->sendleftovers = sendleftovers;
+ mq->nsend = nsend;
+ }
+ return result;
+}
+
+/* Generic function called by the multi interface to figure out what socket(s)
+ to wait for and for what actions during the DOING and PROTOCONNECT
+ states */
+static int mqtt_getsock(struct connectdata *conn,
+ curl_socket_t *sock)
+{
+ sock[0] = conn->sock[FIRSTSOCKET];
+ return GETSOCK_READSOCK(FIRSTSOCKET);
+}
+
+static CURLcode mqtt_connect(struct connectdata *conn)
+{
+ CURLcode result = CURLE_OK;
+ const size_t client_id_offset = 14;
+ const size_t packetlen = client_id_offset + MQTT_CLIENTID_LEN;
+ char client_id[MQTT_CLIENTID_LEN + 1] = "curl";
+ const size_t clen = strlen("curl");
+ char packet[32] = {
+ MQTT_MSG_CONNECT, /* packet type */
+ 0x00, /* remaining length */
+ 0x00, 0x04, /* protocol length */
+ 'M','Q','T','T', /* protocol name */
+ 0x04, /* protocol level */
+ 0x02, /* CONNECT flag: CleanSession */
+ 0x00, 0x3c, /* keep-alive 0 = disabled */
+ 0x00, 0x00 /* payload1 length */
+ };
+ packet[1] = (packetlen - 2) & 0x7f;
+ packet[client_id_offset - 1] = MQTT_CLIENTID_LEN;
+
+ result = Curl_rand_hex(conn->data, (unsigned char *)&client_id[clen],
+ MQTT_CLIENTID_LEN - clen + 1);
+ memcpy(&packet[client_id_offset], client_id, MQTT_CLIENTID_LEN);
+ infof(conn->data, "Using client id '%s'\n", client_id);
+ if(!result)
+ result = mqtt_send(conn, packet, packetlen);
+ return result;
+}
+
+static CURLcode mqtt_disconnect(struct connectdata *conn)
+{
+ CURLcode result = CURLE_OK;
+ result = mqtt_send(conn, (char *)"\xe0\x00", 2);
+ return result;
+}
+
+static CURLcode mqtt_verify_connack(struct connectdata *conn)
+{
+ CURLcode result;
+ curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
+ unsigned char readbuf[MQTT_CONNACK_LEN];
+ ssize_t nread;
+ struct Curl_easy *data = conn->data;
+
+ result = Curl_read(conn, sockfd, (char *)readbuf, MQTT_CONNACK_LEN, &nread);
+ if(result)
+ goto fail;
+
+ Curl_debug(data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
+
+ /* fixme */
+ if(nread < MQTT_CONNACK_LEN) {
+ result = CURLE_WEIRD_SERVER_REPLY;
+ goto fail;
+ }
+
+ /* verify CONNACK */
+ if(readbuf[0] != 0x00 || readbuf[1] != 0x00) {
+ failf(data, "Expected %02x%02x but got %02x%02x",
+ 0x00, 0x00, readbuf[0], readbuf[1]);
+ result = CURLE_WEIRD_SERVER_REPLY;
+ }
+
+fail:
+ return result;
+}
+
+static CURLcode mqtt_get_topic(struct connectdata *conn,
+ char **topic, size_t *topiclen)
+{
+ CURLcode result = CURLE_OK;
+ char *path = conn->data->state.up.path;
+
+ if(strlen(path) > 1) {
+ result = Curl_urldecode(conn->data, path + 1, 0, topic, topiclen,
+ REJECT_NADA);
+ }
+ else {
+ failf(conn->data, "Error: No topic specified.");
+ result = CURLE_URL_MALFORMAT;
+ }
+ return result;
+}
+
+
+static int mqtt_encode_len(char *buf, size_t len)
+{
+ unsigned char encoded;
+ int i;
+
+ for(i = 0; (len > 0) && (i<4); i++) {
+ encoded = len % 0x80;
+ len /= 0x80;
+ if(len)
+ encoded |= 0x80;
+ buf[i] = encoded;
+ }
+
+ return i;
+}
+
+static CURLcode mqtt_subscribe(struct connectdata *conn)
+{
+ CURLcode result = CURLE_OK;
+ char *topic = NULL;
+ size_t topiclen;
+ unsigned char *packet = NULL;
+ size_t packetlen;
+ char encodedsize[4];
+ size_t n;
+
+ result = mqtt_get_topic(conn, &topic, &topiclen);
+ if(result)
+ goto fail;
+
+ conn->proto.mqtt.packetid++;
+
+ packetlen = topiclen + 5; /* packetid + topic (has a two byte length field)
+ + 2 bytes topic length + QoS byte */
+ n = mqtt_encode_len((char *)encodedsize, packetlen);
+ packetlen += n + 1; /* add one for the control packet type byte */
+
+ packet = malloc(packetlen);
+ if(!packet) {
+ result = CURLE_OUT_OF_MEMORY;
+ goto fail;
+ }
+
+ packet[0] = MQTT_MSG_SUBSCRIBE;
+ memcpy(&packet[1], encodedsize, n);
+ packet[1 + n] = (conn->proto.mqtt.packetid >> 8) & 0xff;
+ packet[2 + n] = conn->proto.mqtt.packetid & 0xff;
+ packet[3 + n] = (topiclen >> 8) & 0xff;
+ packet[4 + n ] = topiclen & 0xff;
+ memcpy(&packet[5 + n], topic, topiclen);
+ packet[5 + n + topiclen] = 0; /* QoS zero */
+
+ result = mqtt_send(conn, (char *)packet, packetlen);
+
+fail:
+ free(topic);
+ free(packet);
+ return result;
+}
+
+/*
+ * Called when the first byte was already read.
+ */
+static CURLcode mqtt_verify_suback(struct connectdata *conn)
+{
+ CURLcode result;
+ curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
+ unsigned char readbuf[MQTT_SUBACK_LEN];
+ ssize_t nread;
+ struct mqtt_conn *mqtt = &conn->proto.mqtt;
+
+ result = Curl_read(conn, sockfd, (char *)readbuf, MQTT_SUBACK_LEN, &nread);
+ if(result)
+ goto fail;
+
+ Curl_debug(conn->data, CURLINFO_HEADER_IN, (char *)readbuf, (size_t)nread);
+
+ /* fixme */
+ if(nread < MQTT_SUBACK_LEN) {
+ result = CURLE_WEIRD_SERVER_REPLY;
+ goto fail;
+ }
+
+ /* verify SUBACK */
+ if(readbuf[0] != ((mqtt->packetid >> 8) & 0xff) ||
+ readbuf[1] != (mqtt->packetid & 0xff) ||
+ readbuf[2] != 0x00)
+ result = CURLE_WEIRD_SERVER_REPLY;
+
+fail:
+ return result;
+}
+
+static CURLcode mqtt_publish(struct connectdata *conn)
+{
+ CURLcode result;
+ char *payload = conn->data->set.postfields;
+ size_t payloadlen = (size_t)conn->data->set.postfieldsize;
+ char *topic = NULL;
+ size_t topiclen;
+ unsigned char *pkt = NULL;
+ size_t i = 0;
+ size_t remaininglength;
+ size_t encodelen;
+ char encodedbytes[4];
+
+ result = mqtt_get_topic(conn, &topic, &topiclen);
+ if(result)
+ goto fail;
+
+ remaininglength = payloadlen + 2 + topiclen;
+ encodelen = mqtt_encode_len(encodedbytes, remaininglength);
+
+ /* add the control byte and the encoded remaining length */
+ pkt = malloc(remaininglength + 1 + encodelen);
+ if(!pkt) {
+ result = CURLE_OUT_OF_MEMORY;
+ goto fail;
+ }
+
+ /* assemble packet */
+ pkt[i++] = MQTT_MSG_PUBLISH;
+ memcpy(&pkt[i], encodedbytes, encodelen);
+ i += encodelen;
+ pkt[i++] = (topiclen >> 8) & 0xff;
+ pkt[i++] = (topiclen & 0xff);
+ memcpy(&pkt[i], topic, topiclen);
+ i += topiclen;
+ memcpy(&pkt[i], payload, payloadlen);
+ i += payloadlen;
+ result = mqtt_send(conn, (char *)pkt, i);
+
+fail:
+ free(pkt);
+ free(topic);
+ return result;
+}
+
+static size_t mqtt_decode_len(unsigned char *buf,
+ size_t buflen, size_t *lenbytes)
+{
+ size_t len = 0;
+ size_t mult = 1;
+ size_t i;
+ unsigned char encoded = 128;
+
+ for(i = 0; (i < buflen) && (encoded & 128); i++) {
+ encoded = buf[i];
+ len += (encoded & 127) * mult;
+ mult *= 128;
+ }
+
+ if(lenbytes)
+ *lenbytes = i;
+
+ return len;
+}
+
+#ifdef CURLDEBUG
+static const char *statenames[]={
+ "MQTT_FIRST",
+ "MQTT_REMAINING_LENGTH",
+ "MQTT_CONNACK",
+ "MQTT_SUBACK",
+ "MQTT_SUBACK_COMING",
+ "MQTT_PUBWAIT",
+ "MQTT_PUB_REMAIN",
+
+ "NOT A STATE"
+};
+#endif
+
+/* The only way to change state */
+static void mqstate(struct connectdata *conn,
+ enum mqttstate state,
+ enum mqttstate nextstate) /* used if state == FIRST */
+{
+ struct mqtt_conn *mqtt = &conn->proto.mqtt;
+#ifdef CURLDEBUG
+ infof(conn->data, "%s (from %s) (next is %s)\n",
+ statenames[state],
+ statenames[mqtt->state],
+ (state == MQTT_FIRST)? statenames[nextstate] : "");
+#endif
+ mqtt->state = state;
+ if(state == MQTT_FIRST)
+ mqtt->nextstate = nextstate;
+}
+
+
+/* for the publish packet */
+#define MQTT_HEADER_LEN 5 /* max 5 bytes */
+
+static CURLcode mqtt_read_publish(struct connectdata *conn,
+ bool *done)
+{
+ CURLcode result = CURLE_OK;
+ curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
+ ssize_t nread;
+ struct Curl_easy *data = conn->data;
+ unsigned char *pkt = (unsigned char *)data->state.buffer;
+ size_t remlen;
+ struct mqtt_conn *mqtt = &conn->proto.mqtt;
+ struct MQTT *mq = data->req.p.mqtt;
+ unsigned char packet;
+
+ switch(mqtt->state) {
+ MQTT_SUBACK_COMING:
+ case MQTT_SUBACK_COMING:
+ result = mqtt_verify_suback(conn);
+ if(result)
+ break;
+
+ mqstate(conn, MQTT_FIRST, MQTT_PUBWAIT);
+ break;
+
+ case MQTT_SUBACK:
+ case MQTT_PUBWAIT:
+ /* we are expecting PUBLISH or SUBACK */
+ packet = mq->firstbyte & 0xf0;
+ if(packet == MQTT_MSG_PUBLISH)
+ mqstate(conn, MQTT_PUB_REMAIN, MQTT_NOSTATE);
+ else if(packet == MQTT_MSG_SUBACK) {
+ mqstate(conn, MQTT_SUBACK_COMING, MQTT_NOSTATE);
+ goto MQTT_SUBACK_COMING;
+ }
+ else if(packet == MQTT_MSG_DISCONNECT) {
+ infof(data, "Got DISCONNECT\n");
+ *done = TRUE;
+ goto end;
+ }
+ else {
+ result = CURLE_WEIRD_SERVER_REPLY;
+ goto end;
+ }
+
+ /* -- switched state -- */
+ remlen = mq->remaining_length;
+ infof(data, "Remaining length: %zd bytes\n", remlen);
+ Curl_pgrsSetDownloadSize(data, remlen);
+ data->req.bytecount = 0;
+ data->req.size = remlen;
+ mq->npacket = remlen; /* get this many bytes */
+ /* FALLTHROUGH */
+ case MQTT_PUB_REMAIN: {
+ /* read rest of packet, but no more. Cap to buffer size */
+ struct SingleRequest *k = &data->req;
+ size_t rest = mq->npacket;
+ if(rest > (size_t)data->set.buffer_size)
+ rest = (size_t)data->set.buffer_size;
+ result = Curl_read(conn, sockfd, (char *)pkt, rest, &nread);
+ if(result) {
+ if(CURLE_AGAIN == result) {
+ infof(data, "EEEE AAAAGAIN\n");
+ }
+ goto end;
+ }
+ if(!nread) {
+ infof(data, "server disconnected\n");
+ result = CURLE_PARTIAL_FILE;
+ goto end;
+ }
+ Curl_debug(data, CURLINFO_DATA_IN, (char *)pkt, (size_t)nread);
+
+ mq->npacket -= nread;
+ k->bytecount += nread;
+ Curl_pgrsSetDownloadCounter(data, k->bytecount);
+
+ /* if QoS is set, message contains packet id */
+
+ result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)pkt, nread);
+ if(result)
+ goto end;
+
+ if(!mq->npacket)
+ /* no more PUBLISH payload, back to subscribe wait state */
+ mqstate(conn, MQTT_FIRST, MQTT_PUBWAIT);
+ break;
+ }
+ default:
+ DEBUGASSERT(NULL); /* illegal state */
+ result = CURLE_WEIRD_SERVER_REPLY;
+ goto end;
+ }
+ end:
+ return result;
+}
+
+static CURLcode mqtt_do(struct connectdata *conn, bool *done)
+{
+ CURLcode result = CURLE_OK;
+ struct Curl_easy *data = conn->data;
+
+ *done = FALSE; /* unconditionally */
+
+ result = mqtt_connect(conn);
+ if(result) {
+ failf(data, "Error %d sending MQTT CONN request", result);
+ return result;
+ }
+ mqstate(conn, MQTT_FIRST, MQTT_CONNACK);
+ return CURLE_OK;
+}
+
+static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
+{
+ CURLcode result = CURLE_OK;
+ struct mqtt_conn *mqtt = &conn->proto.mqtt;
+ struct Curl_easy *data = conn->data;
+ struct MQTT *mq = data->req.p.mqtt;
+ ssize_t nread;
+ curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
+ unsigned char *pkt = (unsigned char *)data->state.buffer;
+ unsigned char byte;
+
+ *done = FALSE;
+
+ if(mq->nsend) {
+ /* send the remainder of an outgoing packet */
+ char *ptr = mq->sendleftovers;
+ result = mqtt_send(conn, mq->sendleftovers, mq->nsend);
+ free(ptr);
+ if(result)
+ return result;
+ }
+
+ infof(data, "mqtt_doing: state [%d]\n", (int) mqtt->state);
+ switch(mqtt->state) {
+ case MQTT_FIRST:
+ /* Read the initial byte only */
+ result = Curl_read(conn, sockfd, (char *)&mq->firstbyte, 1, &nread);
+ if(result)
+ break;
+ Curl_debug(data, CURLINFO_HEADER_IN, (char *)&mq->firstbyte, 1);
+ /* remember the first byte */
+ mq->npacket = 0;
+ mqstate(conn, MQTT_REMAINING_LENGTH, MQTT_NOSTATE);
+ /* FALLTHROUGH */
+ case MQTT_REMAINING_LENGTH:
+ do {
+ result = Curl_read(conn, sockfd, (char *)&byte, 1, &nread);
+ if(result)
+ break;
+ Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
+ pkt[mq->npacket++] = byte;
+ } while((byte & 0x80) && (mq->npacket < 4));
+ if(result)
+ break;
+ mq->remaining_length = mqtt_decode_len(&pkt[0], mq->npacket, NULL);
+ mq->npacket = 0;
+ if(mq->remaining_length) {
+ mqstate(conn, mqtt->nextstate, MQTT_NOSTATE);
+ break;
+ }
+ mqstate(conn, MQTT_FIRST, MQTT_FIRST);
+
+ if(mq->firstbyte == MQTT_MSG_DISCONNECT) {
+ infof(data, "Got DISCONNECT\n");
+ *done = TRUE;
+ }
+ break;
+ case MQTT_CONNACK:
+ result = mqtt_verify_connack(conn);
+ if(result)
+ break;
+
+ if(conn->data->state.httpreq == HTTPREQ_POST) {
+ result = mqtt_publish(conn);
+ if(!result) {
+ result = mqtt_disconnect(conn);
+ *done = TRUE;
+ }
+ mqtt->nextstate = MQTT_FIRST;
+ }
+ else {
+ result = mqtt_subscribe(conn);
+ if(!result) {
+ mqstate(conn, MQTT_FIRST, MQTT_SUBACK);
+ }
+ }
+ break;
+
+ case MQTT_SUBACK:
+ case MQTT_PUBWAIT:
+ case MQTT_PUB_REMAIN:
+ result = mqtt_read_publish(conn, done);
+ break;
+
+ default:
+ failf(conn->data, "State not handled yet");
+ *done = TRUE;
+ break;
+ }
+
+ if(result == CURLE_AGAIN)
+ result = CURLE_OK;
+ return result;
+}
+
+#endif /* CURL_DISABLE_MQTT */
diff --git a/contrib/libs/curl/lib/mqtt.h b/contrib/libs/curl/lib/mqtt.h
index b16da802b3..fb52c72326 100644
--- a/contrib/libs/curl/lib/mqtt.h
+++ b/contrib/libs/curl/lib/mqtt.h
@@ -1,59 +1,59 @@
-#ifndef HEADER_CURL_MQTT_H
-#define HEADER_CURL_MQTT_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2019 - 2020, Björn Stenberg, <bjorn@haxx.se>
- *
- * 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.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.
- *
- ***************************************************************************/
-
-#ifndef CURL_DISABLE_MQTT
-extern const struct Curl_handler Curl_handler_mqtt;
-#endif
-
-enum mqttstate {
- MQTT_FIRST, /* 0 */
- MQTT_REMAINING_LENGTH, /* 1 */
- MQTT_CONNACK, /* 2 */
- MQTT_SUBACK, /* 3 */
- MQTT_SUBACK_COMING, /* 4 - the SUBACK remainder */
- MQTT_PUBWAIT, /* 5 - wait for publish */
- MQTT_PUB_REMAIN, /* 6 - wait for the remainder of the publish */
-
- MQTT_NOSTATE /* 7 - never used an actual state */
-};
-
-struct mqtt_conn {
- enum mqttstate state;
- enum mqttstate nextstate; /* switch to this after remaining length is
- done */
- unsigned int packetid;
-};
-
-/* protocol-specific transfer-related data */
-struct MQTT {
- char *sendleftovers;
- size_t nsend; /* size of sendleftovers */
-
- /* when receiving */
- size_t npacket; /* byte counter */
- unsigned char firstbyte;
- size_t remaining_length;
-};
-
-#endif /* HEADER_CURL_MQTT_H */
+#ifndef HEADER_CURL_MQTT_H
+#define HEADER_CURL_MQTT_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2019 - 2020, Björn Stenberg, <bjorn@haxx.se>
+ *
+ * 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.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.
+ *
+ ***************************************************************************/
+
+#ifndef CURL_DISABLE_MQTT
+extern const struct Curl_handler Curl_handler_mqtt;
+#endif
+
+enum mqttstate {
+ MQTT_FIRST, /* 0 */
+ MQTT_REMAINING_LENGTH, /* 1 */
+ MQTT_CONNACK, /* 2 */
+ MQTT_SUBACK, /* 3 */
+ MQTT_SUBACK_COMING, /* 4 - the SUBACK remainder */
+ MQTT_PUBWAIT, /* 5 - wait for publish */
+ MQTT_PUB_REMAIN, /* 6 - wait for the remainder of the publish */
+
+ MQTT_NOSTATE /* 7 - never used an actual state */
+};
+
+struct mqtt_conn {
+ enum mqttstate state;
+ enum mqttstate nextstate; /* switch to this after remaining length is
+ done */
+ unsigned int packetid;
+};
+
+/* protocol-specific transfer-related data */
+struct MQTT {
+ char *sendleftovers;
+ size_t nsend; /* size of sendleftovers */
+
+ /* when receiving */
+ size_t npacket; /* byte counter */
+ unsigned char firstbyte;
+ size_t remaining_length;
+};
+
+#endif /* HEADER_CURL_MQTT_H */
diff --git a/contrib/libs/curl/lib/multi.c b/contrib/libs/curl/lib/multi.c
index 08c6686157..f1c9e4dbfb 100644
--- a/contrib/libs/curl/lib/multi.c
+++ b/contrib/libs/curl/lib/multi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -46,8 +46,8 @@
#include "connect.h"
#include "http_proxy.h"
#include "http2.h"
-#include "socketpair.h"
-#include "socks.h"
+#include "socketpair.h"
+#include "socks.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -111,7 +111,7 @@ static void Curl_init_completed(struct Curl_easy *data)
/* Important: reset the conn pointer so that we don't point to memory
that could be freed anytime */
- Curl_detach_connnection(data);
+ Curl_detach_connnection(data);
Curl_expire_clear(data); /* stop all timers */
}
@@ -168,11 +168,11 @@ static void mstate(struct Curl_easy *data, CURLMstate state
}
#endif
- if(state == CURLM_STATE_COMPLETED) {
+ if(state == CURLM_STATE_COMPLETED) {
/* changing to COMPLETED means there's one less easy handle 'alive' */
- DEBUGASSERT(data->multi->num_alive > 0);
+ DEBUGASSERT(data->multi->num_alive > 0);
data->multi->num_alive--;
- }
+ }
/* if this state has an init-function, run it */
if(finit[state])
@@ -190,7 +190,7 @@ static void mstate(struct Curl_easy *data, CURLMstate state
*/
struct Curl_sh_entry {
- struct Curl_hash transfers; /* hash of transfers using this socket */
+ struct Curl_hash transfers; /* hash of transfers using this socket */
unsigned int action; /* what combined action READ/WRITE this socket waits
for */
void *socketp; /* settable by users with curl_multi_assign() */
@@ -204,7 +204,7 @@ struct Curl_sh_entry {
#define SH_WRITE 2
/* look up a given socket in the socket hash, skip invalid sockets */
-static struct Curl_sh_entry *sh_getentry(struct Curl_hash *sh,
+static struct Curl_sh_entry *sh_getentry(struct Curl_hash *sh,
curl_socket_t s)
{
if(s != CURL_SOCKET_BAD) {
@@ -238,7 +238,7 @@ static void trhash_dtor(void *nada)
/* make sure this socket is present in the hash for this handle */
-static struct Curl_sh_entry *sh_addentry(struct Curl_hash *sh,
+static struct Curl_sh_entry *sh_addentry(struct Curl_hash *sh,
curl_socket_t s)
{
struct Curl_sh_entry *there = sh_getentry(sh, s);
@@ -262,7 +262,7 @@ static struct Curl_sh_entry *sh_addentry(struct Curl_hash *sh,
/* make/add new hash entry */
if(!Curl_hash_add(sh, (char *)&s, sizeof(curl_socket_t), check)) {
- Curl_hash_destroy(&check->transfers);
+ Curl_hash_destroy(&check->transfers);
free(check);
return NULL; /* major failure */
}
@@ -273,7 +273,7 @@ static struct Curl_sh_entry *sh_addentry(struct Curl_hash *sh,
/* delete the given socket + handle from the hash */
static void sh_delentry(struct Curl_sh_entry *entry,
- struct Curl_hash *sh, curl_socket_t s)
+ struct Curl_hash *sh, curl_socket_t s)
{
Curl_hash_destroy(&entry->transfers);
@@ -325,7 +325,7 @@ static size_t hash_fd(void *key, size_t key_length, size_t slots_num)
* per call."
*
*/
-static int sh_init(struct Curl_hash *hash, int hashsize)
+static int sh_init(struct Curl_hash *hash, int hashsize)
{
return Curl_hash_init(hash, hashsize, hash_fd, fd_key_compare,
sh_freeentry);
@@ -367,27 +367,27 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
Curl_llist_init(&multi->msglist, NULL);
Curl_llist_init(&multi->pending, NULL);
- multi->multiplexing = TRUE;
+ multi->multiplexing = TRUE;
/* -1 means it not set by user, use the default value */
multi->maxconnects = -1;
- multi->max_concurrent_streams = 100;
- multi->ipv6_works = Curl_ipv6works(NULL);
-
-#ifdef ENABLE_WAKEUP
- if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, multi->wakeup_pair) < 0) {
- multi->wakeup_pair[0] = CURL_SOCKET_BAD;
- multi->wakeup_pair[1] = CURL_SOCKET_BAD;
- }
- else if(curlx_nonblock(multi->wakeup_pair[0], TRUE) < 0 ||
- curlx_nonblock(multi->wakeup_pair[1], TRUE) < 0) {
- sclose(multi->wakeup_pair[0]);
- sclose(multi->wakeup_pair[1]);
- multi->wakeup_pair[0] = CURL_SOCKET_BAD;
- multi->wakeup_pair[1] = CURL_SOCKET_BAD;
- }
-#endif
-
+ multi->max_concurrent_streams = 100;
+ multi->ipv6_works = Curl_ipv6works(NULL);
+
+#ifdef ENABLE_WAKEUP
+ if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, multi->wakeup_pair) < 0) {
+ multi->wakeup_pair[0] = CURL_SOCKET_BAD;
+ multi->wakeup_pair[1] = CURL_SOCKET_BAD;
+ }
+ else if(curlx_nonblock(multi->wakeup_pair[0], TRUE) < 0 ||
+ curlx_nonblock(multi->wakeup_pair[1], TRUE) < 0) {
+ sclose(multi->wakeup_pair[0]);
+ sclose(multi->wakeup_pair[1]);
+ multi->wakeup_pair[0] = CURL_SOCKET_BAD;
+ multi->wakeup_pair[1] = CURL_SOCKET_BAD;
+ }
+#endif
+
return multi;
error:
@@ -455,7 +455,7 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
data->state.conn_cache = &data->share->conn_cache;
else
data->state.conn_cache = &multi->conn_cache;
- data->state.lastconnect_id = -1;
+ data->state.lastconnect_id = -1;
#ifdef USE_LIBPSL
/* Do the same for PSL. */
@@ -508,7 +508,7 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
easy handle is added */
memset(&multi->timer_lastcall, 0, sizeof(multi->timer_lastcall));
- CONNCACHE_LOCK(data);
+ CONNCACHE_LOCK(data);
/* The closure handle only ever has default timeouts set. To improve the
state somewhat we clone the timeouts from each added handle so that the
closure handle always has the same timeouts as the most recently added
@@ -518,7 +518,7 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
data->set.server_response_timeout;
data->state.conn_cache->closure_handle->set.no_signal =
data->set.no_signal;
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
Curl_update_timer(multi);
return CURLM_OK;
@@ -555,8 +555,8 @@ static CURLcode multi_done(struct Curl_easy *data,
/* Stop if multi_done() has already been called */
return CURLE_OK;
- conn->data = data; /* ensure the connection uses this transfer now */
-
+ conn->data = data; /* ensure the connection uses this transfer now */
+
/* Cancel the resolver (but not dns_entry yet). We used to call
Curl_resolver_kill here but that blocks waiting for incomplete resolve
threads (eg getaddrinfo has not returned), which may take a while. */
@@ -595,20 +595,20 @@ static CURLcode multi_done(struct Curl_easy *data,
process_pending_handles(data->multi); /* connection / multiplex */
- CONNCACHE_LOCK(data);
- Curl_detach_connnection(data);
+ CONNCACHE_LOCK(data);
+ Curl_detach_connnection(data);
if(CONN_INUSE(conn)) {
- /* Stop if still used. */
+ /* Stop if still used. */
/* conn->data must not remain pointing to this transfer since it is going
away! Find another to own it! */
conn->data = conn->easyq.head->ptr;
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
DEBUGF(infof(data, "Connection still in use %zu, "
"no more multi_done now!\n",
conn->easyq.size));
return CURLE_OK;
}
- conn->data = NULL; /* the connection now has no owner */
+ conn->data = NULL; /* the connection now has no owner */
data->state.done = TRUE; /* called just now! */
if(conn->dns_entry) {
@@ -621,7 +621,7 @@ static CURLcode multi_done(struct Curl_easy *data,
/* if the transfer was completed in a paused state there can be buffered
data left to free */
for(i = 0; i < data->state.tempcount; i++) {
- Curl_dyn_free(&data->state.tempwrite[i].b);
+ Curl_dyn_free(&data->state.tempwrite[i].b);
}
data->state.tempcount = 0;
@@ -651,11 +651,11 @@ static CURLcode multi_done(struct Curl_easy *data,
#endif
) || conn->bits.close
|| (premature && !(conn->handler->flags & PROTOPT_STREAM))) {
- CURLcode res2;
- connclose(conn, "disconnecting");
- Curl_conncache_remove_conn(data, conn, FALSE);
- CONNCACHE_UNLOCK(data);
- res2 = Curl_disconnect(data, conn, premature);
+ CURLcode res2;
+ connclose(conn, "disconnecting");
+ Curl_conncache_remove_conn(data, conn, FALSE);
+ CONNCACHE_UNLOCK(data);
+ res2 = Curl_disconnect(data, conn, premature);
/* If we had an error already, make sure we return that one. But
if we got a new error, return that. */
@@ -664,61 +664,61 @@ static CURLcode multi_done(struct Curl_easy *data,
}
else {
char buffer[256];
- const char *host =
-#ifndef CURL_DISABLE_PROXY
- conn->bits.socksproxy ?
- conn->socks_proxy.host.dispname :
- conn->bits.httpproxy ? conn->http_proxy.host.dispname :
-#endif
- conn->bits.conn_to_host ? conn->conn_to_host.dispname :
- conn->host.dispname;
+ const char *host =
+#ifndef CURL_DISABLE_PROXY
+ conn->bits.socksproxy ?
+ conn->socks_proxy.host.dispname :
+ conn->bits.httpproxy ? conn->http_proxy.host.dispname :
+#endif
+ conn->bits.conn_to_host ? conn->conn_to_host.dispname :
+ conn->host.dispname;
/* create string before returning the connection */
msnprintf(buffer, sizeof(buffer),
"Connection #%ld to host %s left intact",
- conn->connection_id, host);
+ conn->connection_id, host);
/* the connection is no longer in use by this transfer */
- CONNCACHE_UNLOCK(data);
- if(Curl_conncache_return_conn(data, conn)) {
+ CONNCACHE_UNLOCK(data);
+ if(Curl_conncache_return_conn(data, conn)) {
/* remember the most recently used connection */
- data->state.lastconnect_id = conn->connection_id;
+ data->state.lastconnect_id = conn->connection_id;
infof(data, "%s\n", buffer);
}
else
- data->state.lastconnect_id = -1;
+ data->state.lastconnect_id = -1;
}
- Curl_safefree(data->state.buffer);
+ Curl_safefree(data->state.buffer);
Curl_free_request_state(data);
return result;
}
-static int close_connect_only(struct connectdata *conn, void *param)
-{
- struct Curl_easy *data = param;
-
- if(data->state.lastconnect_id != conn->connection_id)
- return 0;
-
- if(conn->data != data)
- return 1;
- conn->data = NULL;
-
- if(!conn->bits.connect_only)
- return 1;
-
- connclose(conn, "Removing connect-only easy handle");
- conn->bits.connect_only = FALSE;
-
- return 1;
-}
-
+static int close_connect_only(struct connectdata *conn, void *param)
+{
+ struct Curl_easy *data = param;
+
+ if(data->state.lastconnect_id != conn->connection_id)
+ return 0;
+
+ if(conn->data != data)
+ return 1;
+ conn->data = NULL;
+
+ if(!conn->bits.connect_only)
+ return 1;
+
+ connclose(conn, "Removing connect-only easy handle");
+ conn->bits.connect_only = FALSE;
+
+ return 1;
+}
+
CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
struct Curl_easy *data)
{
struct Curl_easy *easy = data;
bool premature;
bool easy_owns_conn;
- struct Curl_llist_element *e;
+ struct Curl_llist_element *e;
/* First, make some basic checks that the CURLM handle is a good handle */
if(!GOOD_MULTI_HANDLE(multi))
@@ -732,10 +732,10 @@ 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! */
- /* Prevent users from trying to remove an easy handle from the wrong multi */
- if(data->multi != multi)
- return CURLM_BAD_EASY_HANDLE;
-
+ /* Prevent users from trying to remove an easy handle from the wrong multi */
+ if(data->multi != multi)
+ return CURLM_BAD_EASY_HANDLE;
+
if(multi->in_callback)
return CURLM_RECURSIVE_API_CALL;
@@ -767,8 +767,8 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
we don't leave a half-baked one around */
if(easy_owns_conn) {
- /* multi_done() clears the association between the easy handle and the
- connection.
+ /* multi_done() clears the association between the easy handle and the
+ connection.
Note that this ignores the return code simply because there's
nothing really useful to do with it anyway! */
@@ -776,11 +776,11 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
}
}
- /* The timer must be shut down before data->multi is set to NULL, else the
- timenode will remain in the splay tree after curl_easy_cleanup is
- called. Do it after multi_done() in case that sets another time! */
- Curl_expire_clear(data);
-
+ /* The timer must be shut down before data->multi is set to NULL, else the
+ timenode will remain in the splay tree after curl_easy_cleanup is
+ called. Do it after multi_done() in case that sets another time! */
+ Curl_expire_clear(data);
+
if(data->connect_queue.ptr)
/* the handle was in the pending list waiting for an available connection,
so go ahead and remove it */
@@ -806,12 +806,12 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
vanish with this handle */
/* Remove the association between the connection and the handle */
- Curl_detach_connnection(data);
-
- if(data->state.lastconnect_id != -1) {
- /* Mark any connect-only connection for closure */
- Curl_conncache_foreach(data, data->state.conn_cache,
- data, &close_connect_only);
+ Curl_detach_connnection(data);
+
+ if(data->state.lastconnect_id != -1) {
+ /* Mark any connect-only connection for closure */
+ Curl_conncache_foreach(data, data->state.conn_cache,
+ data, &close_connect_only);
}
#ifdef USE_LIBPSL
@@ -820,10 +820,10 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
data->psl = NULL;
#endif
- /* as this was using a shared connection cache we clear the pointer to that
- since we're not part of that multi handle anymore */
- data->state.conn_cache = NULL;
-
+ /* as this was using a shared connection cache we clear the pointer to that
+ since we're not part of that multi handle anymore */
+ data->state.conn_cache = NULL;
+
data->multi = NULL; /* clear the association to this multi handle */
/* make sure there's no pending message in the queue sent from this easy
@@ -865,13 +865,13 @@ bool Curl_multiplex_wanted(const struct Curl_multi *multi)
return (multi && (multi->multiplexing));
}
-/*
- * Curl_detach_connnection() removes the given transfer from the connection.
- *
- * This is the only function that should clear data->conn. This will
- * occasionally be called with the data->conn pointer already cleared.
- */
-void Curl_detach_connnection(struct Curl_easy *data)
+/*
+ * Curl_detach_connnection() removes the given transfer from the connection.
+ *
+ * This is the only function that should clear data->conn. This will
+ * occasionally be called with the data->conn pointer already cleared.
+ */
+void Curl_detach_connnection(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
if(conn)
@@ -879,11 +879,11 @@ void Curl_detach_connnection(struct Curl_easy *data)
data->conn = NULL;
}
-/*
- * Curl_attach_connnection() attaches this transfer to this connection.
- *
- * This is the only function that should assign data->conn
- */
+/*
+ * Curl_attach_connnection() attaches this transfer to this connection.
+ *
+ * This is the only function that should assign data->conn
+ */
void Curl_attach_connnection(struct Curl_easy *data,
struct connectdata *conn)
{
@@ -902,15 +902,15 @@ static int waitconnect_getsock(struct connectdata *conn,
int rc = 0;
#ifdef USE_SSL
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(CONNECT_FIRSTSOCKET_PROXY_SSL())
return Curl_ssl_getsock(conn, sock);
#endif
-#endif
+#endif
+
+ if(SOCKS_STATE(conn->cnnct.state))
+ return Curl_SOCKS_getsock(conn, sock, FIRSTSOCKET);
- if(SOCKS_STATE(conn->cnnct.state))
- return Curl_SOCKS_getsock(conn, sock, FIRSTSOCKET);
-
for(i = 0; i<2; i++) {
if(conn->tempsock[i] != CURL_SOCKET_BAD) {
sock[s] = conn->tempsock[i];
@@ -1074,8 +1074,8 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
unsigned int extra_nfds,
int timeout_ms,
int *ret,
- bool extrawait, /* when no socket, wait */
- bool use_wakeup)
+ bool extrawait, /* when no socket, wait */
+ bool use_wakeup)
{
struct Curl_easy *data;
curl_socket_t sockbunch[MAX_SOCKSPEREASYHANDLE];
@@ -1087,7 +1087,7 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
int retcode = 0;
struct pollfd a_few_on_stack[NUM_POLLS_ON_STACK];
struct pollfd *ufds = &a_few_on_stack[0];
- bool ufds_malloc = FALSE;
+ bool ufds_malloc = FALSE;
if(!GOOD_MULTI_HANDLE(multi))
return CURLM_BAD_HANDLE;
@@ -1095,9 +1095,9 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
if(multi->in_callback)
return CURLM_RECURSIVE_API_CALL;
- if(timeout_ms < 0)
- return CURLM_BAD_FUNCTION_ARGUMENT;
-
+ if(timeout_ms < 0)
+ return CURLM_BAD_FUNCTION_ARGUMENT;
+
/* Count up how many fds we have from the multi handle */
data = multi->easyp;
while(data) {
@@ -1132,12 +1132,12 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
curlfds = nfds; /* number of internal file descriptors */
nfds += extra_nfds; /* add the externally provided ones */
-#ifdef ENABLE_WAKEUP
- if(use_wakeup && multi->wakeup_pair[0] != CURL_SOCKET_BAD) {
- ++nfds;
- }
-#endif
-
+#ifdef ENABLE_WAKEUP
+ if(use_wakeup && multi->wakeup_pair[0] != CURL_SOCKET_BAD) {
+ ++nfds;
+ }
+#endif
+
if(nfds > NUM_POLLS_ON_STACK) {
/* 'nfds' is a 32 bit value and 'struct pollfd' is typically 8 bytes
big, so at 2^29 sockets this value might wrap. When a process gets
@@ -1159,7 +1159,7 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
while(data) {
bitmap = multi_getsock(data, sockbunch);
- for(i = 0; i < MAX_SOCKSPEREASYHANDLE; i++) {
+ for(i = 0; i < MAX_SOCKSPEREASYHANDLE; i++) {
curl_socket_t s = CURL_SOCKET_BAD;
if(bitmap & GETSOCK_READSOCK(i)) {
@@ -1196,17 +1196,17 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
++nfds;
}
-#ifdef ENABLE_WAKEUP
- if(use_wakeup && multi->wakeup_pair[0] != CURL_SOCKET_BAD) {
- ufds[nfds].fd = multi->wakeup_pair[0];
- ufds[nfds].events = POLLIN;
- ++nfds;
- }
-#endif
-
+#ifdef ENABLE_WAKEUP
+ if(use_wakeup && multi->wakeup_pair[0] != CURL_SOCKET_BAD) {
+ ufds[nfds].fd = multi->wakeup_pair[0];
+ ufds[nfds].events = POLLIN;
+ ++nfds;
+ }
+#endif
+
if(nfds) {
/* wait... */
- int pollrc = Curl_poll(ufds, nfds, timeout_ms);
+ int pollrc = Curl_poll(ufds, nfds, timeout_ms);
if(pollrc > 0) {
retcode = pollrc;
/* copy revents results from the poll to the curl_multi_wait poll
@@ -1224,31 +1224,31 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
mask |= CURL_WAIT_POLLPRI;
extra_fds[i].revents = mask;
}
-
-#ifdef ENABLE_WAKEUP
- if(use_wakeup && multi->wakeup_pair[0] != CURL_SOCKET_BAD) {
- if(ufds[curlfds + extra_nfds].revents & POLLIN) {
- char buf[64];
- ssize_t nread;
- while(1) {
- /* the reading socket is non-blocking, try to read
- data from it until it receives an error (except EINTR).
- In normal cases it will get EAGAIN or EWOULDBLOCK
- when there is no more data, breaking the loop. */
- nread = sread(multi->wakeup_pair[0], buf, sizeof(buf));
- if(nread <= 0) {
-#ifndef USE_WINSOCK
- if(nread < 0 && EINTR == SOCKERRNO)
- continue;
-#endif
- break;
- }
- }
- /* do not count the wakeup socket into the returned value */
- retcode--;
- }
- }
-#endif
+
+#ifdef ENABLE_WAKEUP
+ if(use_wakeup && multi->wakeup_pair[0] != CURL_SOCKET_BAD) {
+ if(ufds[curlfds + extra_nfds].revents & POLLIN) {
+ char buf[64];
+ ssize_t nread;
+ while(1) {
+ /* the reading socket is non-blocking, try to read
+ data from it until it receives an error (except EINTR).
+ In normal cases it will get EAGAIN or EWOULDBLOCK
+ when there is no more data, breaking the loop. */
+ nread = sread(multi->wakeup_pair[0], buf, sizeof(buf));
+ if(nread <= 0) {
+#ifndef USE_WINSOCK
+ if(nread < 0 && EINTR == SOCKERRNO)
+ continue;
+#endif
+ break;
+ }
+ }
+ /* do not count the wakeup socket into the returned value */
+ retcode--;
+ }
+ }
+#endif
}
}
@@ -1256,7 +1256,7 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
free(ufds);
if(ret)
*ret = retcode;
- if(!extrawait || nfds)
+ if(!extrawait || nfds)
/* if any socket was checked */
;
else {
@@ -1266,11 +1266,11 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
if(!curl_multi_timeout(multi, &sleep_ms) && sleep_ms) {
if(sleep_ms > timeout_ms)
sleep_ms = timeout_ms;
- /* when there are no easy handles in the multi, this holds a -1
- timeout */
- else if(sleep_ms < 0)
- sleep_ms = timeout_ms;
- Curl_wait_ms(sleep_ms);
+ /* when there are no easy handles in the multi, this holds a -1
+ timeout */
+ else if(sleep_ms < 0)
+ sleep_ms = timeout_ms;
+ Curl_wait_ms(sleep_ms);
}
}
@@ -1283,8 +1283,8 @@ CURLMcode curl_multi_wait(struct Curl_multi *multi,
int timeout_ms,
int *ret)
{
- return Curl_multi_wait(multi, extra_fds, extra_nfds, timeout_ms, ret, FALSE,
- FALSE);
+ return Curl_multi_wait(multi, extra_fds, extra_nfds, timeout_ms, ret, FALSE,
+ FALSE);
}
CURLMcode curl_multi_poll(struct Curl_multi *multi,
@@ -1293,57 +1293,57 @@ CURLMcode curl_multi_poll(struct Curl_multi *multi,
int timeout_ms,
int *ret)
{
- return Curl_multi_wait(multi, extra_fds, extra_nfds, timeout_ms, ret, TRUE,
- TRUE);
-}
-
-CURLMcode curl_multi_wakeup(struct Curl_multi *multi)
-{
- /* this function is usually called from another thread,
- it has to be careful only to access parts of the
- Curl_multi struct that are constant */
-
- /* GOOD_MULTI_HANDLE can be safely called */
- if(!GOOD_MULTI_HANDLE(multi))
- return CURLM_BAD_HANDLE;
-
-#ifdef ENABLE_WAKEUP
- /* the wakeup_pair variable is only written during init and cleanup,
- making it safe to access from another thread after the init part
- and before cleanup */
- if(multi->wakeup_pair[1] != CURL_SOCKET_BAD) {
- char buf[1];
- buf[0] = 1;
- while(1) {
- /* swrite() is not thread-safe in general, because concurrent calls
- can have their messages interleaved, but in this case the content
- of the messages does not matter, which makes it ok to call.
-
- The write socket is set to non-blocking, this way this function
- cannot block, making it safe to call even from the same thread
- that will call Curl_multi_wait(). If swrite() returns that it
- would block, it's considered successful because it means that
- previous calls to this function will wake up the poll(). */
- if(swrite(multi->wakeup_pair[1], buf, sizeof(buf)) < 0) {
- int err = SOCKERRNO;
- int return_success;
-#ifdef USE_WINSOCK
- return_success = WSAEWOULDBLOCK == err;
-#else
- if(EINTR == err)
- continue;
- return_success = EWOULDBLOCK == err || EAGAIN == err;
-#endif
- if(!return_success)
- return CURLM_WAKEUP_FAILURE;
- }
- return CURLM_OK;
- }
- }
-#endif
- return CURLM_WAKEUP_FAILURE;
-}
-
+ return Curl_multi_wait(multi, extra_fds, extra_nfds, timeout_ms, ret, TRUE,
+ TRUE);
+}
+
+CURLMcode curl_multi_wakeup(struct Curl_multi *multi)
+{
+ /* this function is usually called from another thread,
+ it has to be careful only to access parts of the
+ Curl_multi struct that are constant */
+
+ /* GOOD_MULTI_HANDLE can be safely called */
+ if(!GOOD_MULTI_HANDLE(multi))
+ return CURLM_BAD_HANDLE;
+
+#ifdef ENABLE_WAKEUP
+ /* the wakeup_pair variable is only written during init and cleanup,
+ making it safe to access from another thread after the init part
+ and before cleanup */
+ if(multi->wakeup_pair[1] != CURL_SOCKET_BAD) {
+ char buf[1];
+ buf[0] = 1;
+ while(1) {
+ /* swrite() is not thread-safe in general, because concurrent calls
+ can have their messages interleaved, but in this case the content
+ of the messages does not matter, which makes it ok to call.
+
+ The write socket is set to non-blocking, this way this function
+ cannot block, making it safe to call even from the same thread
+ that will call Curl_multi_wait(). If swrite() returns that it
+ would block, it's considered successful because it means that
+ previous calls to this function will wake up the poll(). */
+ if(swrite(multi->wakeup_pair[1], buf, sizeof(buf)) < 0) {
+ int err = SOCKERRNO;
+ int return_success;
+#ifdef USE_WINSOCK
+ return_success = WSAEWOULDBLOCK == err;
+#else
+ if(EINTR == err)
+ continue;
+ return_success = EWOULDBLOCK == err || EAGAIN == err;
+#endif
+ if(!return_success)
+ return CURLM_WAKEUP_FAILURE;
+ }
+ return CURLM_OK;
+ }
+ }
+#endif
+ return CURLM_WAKEUP_FAILURE;
+}
+
/*
* multi_ischanged() is called
*
@@ -1404,7 +1404,7 @@ static CURLcode multi_do(struct Curl_easy *data, bool *done)
DEBUGASSERT(conn);
DEBUGASSERT(conn->handler);
- DEBUGASSERT(conn->data == data);
+ DEBUGASSERT(conn->data == data);
if(conn->handler->do_it) {
/* generic protocol-specific function pointer set in curl_connect() */
@@ -1511,7 +1511,7 @@ static CURLcode protocol_connect(struct connectdata *conn,
}
if(!conn->bits.protoconnstart) {
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
result = Curl_proxy_connect(conn, FIRSTSOCKET);
if(result)
return result;
@@ -1525,7 +1525,7 @@ static CURLcode protocol_connect(struct connectdata *conn,
/* when using an HTTP tunnel proxy, await complete tunnel establishment
before proceeding further. Return CURLE_OK so we'll be called again */
return CURLE_OK;
-#endif
+#endif
if(conn->handler->connect_it) {
/* is there a protocol-specific connect() procedure? */
@@ -1544,24 +1544,24 @@ static CURLcode protocol_connect(struct connectdata *conn,
return result; /* pass back status */
}
-/*
- * Curl_preconnect() is called immediately before a connect starts. When a
- * redirect is followed, this is then called multiple times during a single
- * transfer.
- */
-CURLcode Curl_preconnect(struct Curl_easy *data)
-{
- if(!data->state.buffer) {
- data->state.buffer = malloc(data->set.buffer_size + 1);
- if(!data->state.buffer)
- return CURLE_OUT_OF_MEMORY;
- }
- return CURLE_OK;
-}
-
-
+/*
+ * Curl_preconnect() is called immediately before a connect starts. When a
+ * redirect is followed, this is then called multiple times during a single
+ * transfer.
+ */
+CURLcode Curl_preconnect(struct Curl_easy *data)
+{
+ if(!data->state.buffer) {
+ data->state.buffer = malloc(data->set.buffer_size + 1);
+ if(!data->state.buffer)
+ return CURLE_OUT_OF_MEMORY;
+ }
+ return CURLE_OK;
+}
+
+
static CURLMcode multi_runsingle(struct Curl_multi *multi,
- struct curltime *nowp,
+ struct curltime *nowp,
struct Curl_easy *data)
{
struct Curl_message *msg = NULL;
@@ -1602,7 +1602,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
(data->mstate < CURLM_STATE_COMPLETED)) {
/* we need to wait for the connect state as only then is the start time
stored, but we must not check already completed handles */
- timeout_ms = Curl_timeleft(data, nowp,
+ timeout_ms = Curl_timeleft(data, nowp,
(data->mstate <= CURLM_STATE_DO)?
TRUE:FALSE);
@@ -1611,25 +1611,25 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(data->mstate == CURLM_STATE_WAITRESOLVE)
failf(data, "Resolving timed out after %" CURL_FORMAT_TIMEDIFF_T
" milliseconds",
- Curl_timediff(*nowp, data->progress.t_startsingle));
+ Curl_timediff(*nowp, data->progress.t_startsingle));
else if(data->mstate == CURLM_STATE_WAITCONNECT)
failf(data, "Connection timed out after %" CURL_FORMAT_TIMEDIFF_T
" milliseconds",
- Curl_timediff(*nowp, data->progress.t_startsingle));
+ Curl_timediff(*nowp, data->progress.t_startsingle));
else {
struct SingleRequest *k = &data->req;
if(k->size != -1) {
failf(data, "Operation timed out after %" CURL_FORMAT_TIMEDIFF_T
" milliseconds with %" CURL_FORMAT_CURL_OFF_T " out of %"
CURL_FORMAT_CURL_OFF_T " bytes received",
- Curl_timediff(*nowp, data->progress.t_startsingle),
+ Curl_timediff(*nowp, data->progress.t_startsingle),
k->bytecount, k->size);
}
else {
failf(data, "Operation timed out after %" CURL_FORMAT_TIMEDIFF_T
" milliseconds with %" CURL_FORMAT_CURL_OFF_T
" bytes received",
- Curl_timediff(*nowp, data->progress.t_startsingle),
+ Curl_timediff(*nowp, data->progress.t_startsingle),
k->bytecount);
}
}
@@ -1654,7 +1654,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(!result) {
/* after init, go CONNECT */
multistate(data, CURLM_STATE_CONNECT);
- *nowp = Curl_pgrsTime(data, TIMER_STARTOP);
+ *nowp = Curl_pgrsTime(data, TIMER_STARTOP);
rc = CURLM_CALL_MULTI_PERFORM;
}
break;
@@ -1666,12 +1666,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
case CURLM_STATE_CONNECT:
/* Connect. We want to get a connection identifier filled in. */
- /* init this transfer. */
- result = Curl_preconnect(data);
- if(result)
- break;
-
- *nowp = Curl_pgrsTime(data, TIMER_STARTSINGLE);
+ /* init this transfer. */
+ result = Curl_preconnect(data);
+ if(result)
+ break;
+
+ *nowp = Curl_pgrsTime(data, TIMER_STARTSINGLE);
if(data->set.timeout)
Curl_expire(data, data->set.timeout, EXPIRE_TIMEOUT);
@@ -1728,12 +1728,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
const char *hostname;
DEBUGASSERT(conn);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy)
hostname = conn->http_proxy.host.name;
- else
-#endif
- if(conn->bits.conn_to_host)
+ else
+#endif
+ if(conn->bits.conn_to_host)
hostname = conn->conn_to_host.name;
else
hostname = conn->host.name;
@@ -1799,7 +1799,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* this is HTTP-specific, but sending CONNECT to a proxy is HTTP... */
DEBUGASSERT(data->conn);
result = Curl_http_connect(data->conn, &protocol_connected);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(data->conn->bits.proxy_connect_closed) {
rc = CURLM_CALL_MULTI_PERFORM;
/* connect back to proxy again */
@@ -1807,21 +1807,21 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
multi_done(data, CURLE_OK, FALSE);
multistate(data, CURLM_STATE_CONNECT);
}
- else
-#endif
- if(!result) {
- if(
-#ifndef CURL_DISABLE_PROXY
- (data->conn->http_proxy.proxytype != CURLPROXY_HTTPS ||
- data->conn->bits.proxy_ssl_connected[FIRSTSOCKET]) &&
-#endif
- Curl_connect_complete(data->conn)) {
- rc = CURLM_CALL_MULTI_PERFORM;
- /* initiate protocol connect phase */
- multistate(data, CURLM_STATE_SENDPROTOCONNECT);
- }
+ else
+#endif
+ if(!result) {
+ if(
+#ifndef CURL_DISABLE_PROXY
+ (data->conn->http_proxy.proxytype != CURLPROXY_HTTPS ||
+ data->conn->bits.proxy_ssl_connected[FIRSTSOCKET]) &&
+#endif
+ Curl_connect_complete(data->conn)) {
+ rc = CURLM_CALL_MULTI_PERFORM;
+ /* initiate protocol connect phase */
+ multistate(data, CURLM_STATE_SENDPROTOCONNECT);
+ }
}
- else
+ else
stream_error = TRUE;
break;
#endif
@@ -1832,25 +1832,25 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
result = Curl_is_connected(data->conn, FIRSTSOCKET, &connected);
if(connected && !result) {
#ifndef CURL_DISABLE_HTTP
- if(
-#ifndef CURL_DISABLE_PROXY
- (data->conn->http_proxy.proxytype == CURLPROXY_HTTPS &&
- !data->conn->bits.proxy_ssl_connected[FIRSTSOCKET]) ||
-#endif
- Curl_connect_ongoing(data->conn)) {
+ if(
+#ifndef CURL_DISABLE_PROXY
+ (data->conn->http_proxy.proxytype == CURLPROXY_HTTPS &&
+ !data->conn->bits.proxy_ssl_connected[FIRSTSOCKET]) ||
+#endif
+ Curl_connect_ongoing(data->conn)) {
multistate(data, CURLM_STATE_WAITPROXYCONNECT);
break;
}
#endif
rc = CURLM_CALL_MULTI_PERFORM;
-#ifndef CURL_DISABLE_PROXY
- multistate(data,
- data->conn->bits.tunnel_proxy?
+#ifndef CURL_DISABLE_PROXY
+ multistate(data,
+ data->conn->bits.tunnel_proxy?
CURLM_STATE_WAITPROXYCONNECT:
CURLM_STATE_SENDPROTOCONNECT);
-#else
- multistate(data, CURLM_STATE_SENDPROTOCONNECT);
-#endif
+#else
+ multistate(data, CURLM_STATE_SENDPROTOCONNECT);
+#endif
}
else if(result) {
/* failure detected */
@@ -1871,7 +1871,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
multistate(data, CURLM_STATE_DO);
rc = CURLM_CALL_MULTI_PERFORM;
}
- else {
+ else {
/* failure detected */
Curl_posttransfer(data);
multi_done(data, result, TRUE);
@@ -2079,7 +2079,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(Curl_pgrsUpdate(data->conn))
result = CURLE_ABORTED_BY_CALLBACK;
else
- result = Curl_speedcheck(data, *nowp);
+ result = Curl_speedcheck(data, *nowp);
if(!result) {
send_timeout_ms = 0;
@@ -2089,7 +2089,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
data->progress.ul_limit_size,
data->set.max_send_speed,
data->progress.ul_limit_start,
- *nowp);
+ *nowp);
recv_timeout_ms = 0;
if(data->set.max_recv_speed > 0)
@@ -2098,11 +2098,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
data->progress.dl_limit_size,
data->set.max_recv_speed,
data->progress.dl_limit_start,
- *nowp);
+ *nowp);
if(!send_timeout_ms && !recv_timeout_ms) {
multistate(data, CURLM_STATE_PERFORM);
- Curl_ratelimit(data, *nowp);
+ Curl_ratelimit(data, *nowp);
}
else if(send_timeout_ms >= recv_timeout_ms)
Curl_expire(data, send_timeout_ms, EXPIRE_TOOFAST);
@@ -2116,7 +2116,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
char *newurl = NULL;
bool retry = FALSE;
bool comeback = FALSE;
- DEBUGASSERT(data->state.buffer);
+ DEBUGASSERT(data->state.buffer);
/* check if over send speed */
send_timeout_ms = 0;
if(data->set.max_send_speed > 0)
@@ -2124,7 +2124,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
data->progress.ul_limit_size,
data->set.max_send_speed,
data->progress.ul_limit_start,
- *nowp);
+ *nowp);
/* check if over recv speed */
recv_timeout_ms = 0;
@@ -2133,10 +2133,10 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
data->progress.dl_limit_size,
data->set.max_recv_speed,
data->progress.dl_limit_start,
- *nowp);
+ *nowp);
if(send_timeout_ms || recv_timeout_ms) {
- Curl_ratelimit(data, *nowp);
+ Curl_ratelimit(data, *nowp);
multistate(data, CURLM_STATE_TOOFAST);
if(send_timeout_ms >= recv_timeout_ms)
Curl_expire(data, send_timeout_ms, EXPIRE_TOOFAST);
@@ -2255,13 +2255,13 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
}
}
}
- else if(comeback) {
- /* This avoids CURLM_CALL_MULTI_PERFORM so that a very fast transfer
- won't get stuck on this transfer at the expense of other concurrent
- transfers */
- Curl_expire(data, 0, EXPIRE_RUN_NOW);
- rc = CURLM_OK;
- }
+ else if(comeback) {
+ /* This avoids CURLM_CALL_MULTI_PERFORM so that a very fast transfer
+ won't get stuck on this transfer at the expense of other concurrent
+ transfers */
+ Curl_expire(data, 0, EXPIRE_RUN_NOW);
+ rc = CURLM_OK;
+ }
break;
}
@@ -2289,7 +2289,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
* access free'd data, if the connection is free'd and the handle
* removed before we perform the processing in CURLM_STATE_COMPLETED
*/
- Curl_detach_connnection(data);
+ Curl_detach_connnection(data);
}
#ifndef CURL_DISABLE_FTP
@@ -2341,11 +2341,11 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* This is where we make sure that the conn pointer is reset.
We don't have to do this in every case block above where a
failure is detected */
- Curl_detach_connnection(data);
+ Curl_detach_connnection(data);
+
+ /* remove connection from cache */
+ Curl_conncache_remove_conn(data, conn, TRUE);
- /* remove connection from cache */
- Curl_conncache_remove_conn(data, conn, TRUE);
-
/* disconnect properly */
Curl_disconnect(data, conn, dead_connection);
}
@@ -2416,7 +2416,7 @@ CURLMcode curl_multi_perform(struct Curl_multi *multi, int *running_handles)
SIGPIPE_VARIABLE(pipe_st);
sigpipe_ignore(data, &pipe_st);
- result = multi_runsingle(multi, &now, data);
+ result = multi_runsingle(multi, &now, data);
sigpipe_restore(&pipe_st);
if(result)
@@ -2498,11 +2498,11 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
Curl_hash_destroy(&multi->hostcache);
Curl_psl_destroy(&multi->psl);
-
-#ifdef ENABLE_WAKEUP
- sclose(multi->wakeup_pair[0]);
- sclose(multi->wakeup_pair[1]);
-#endif
+
+#ifdef ENABLE_WAKEUP
+ sclose(multi->wakeup_pair[0]);
+ sclose(multi->wakeup_pair[1]);
+#endif
free(multi);
return CURLM_OK;
@@ -2530,7 +2530,7 @@ CURLMsg *curl_multi_info_read(struct Curl_multi *multi, int *msgs_in_queue)
!multi->in_callback &&
Curl_llist_count(&multi->msglist)) {
/* there is one or more messages in the list */
- struct Curl_llist_element *e;
+ struct Curl_llist_element *e;
/* extract the head of the list to return */
e = multi->msglist.head;
@@ -2760,15 +2760,15 @@ static CURLMcode add_next_timeout(struct curltime now,
struct Curl_easy *d)
{
struct curltime *tv = &d->state.expiretime;
- struct Curl_llist *list = &d->state.timeoutlist;
- struct Curl_llist_element *e;
+ struct Curl_llist *list = &d->state.timeoutlist;
+ struct Curl_llist_element *e;
struct time_node *node = NULL;
/* move over the timeout list for this specific handle and remove all
timeouts that are now passed tense and store the next pending
timeout in *tv */
for(e = list->head; e;) {
- struct Curl_llist_element *n = e->next;
+ struct Curl_llist_element *n = e->next;
timediff_t diff;
node = (struct time_node *)e->ptr;
diff = Curl_timediff(node->time, now);
@@ -2838,8 +2838,8 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
and just move on. */
;
else {
- struct Curl_hash_iterator iter;
- struct Curl_hash_element *he;
+ struct Curl_hash_iterator iter;
+ struct Curl_hash_element *he;
/* the socket can be shared by many transfers, iterate */
Curl_hash_start_iterate(&entry->transfers, &iter);
@@ -2886,7 +2886,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
SIGPIPE_VARIABLE(pipe_st);
sigpipe_ignore(data, &pipe_st);
- result = multi_runsingle(multi, &now, data);
+ result = multi_runsingle(multi, &now, data);
sigpipe_restore(&pipe_st);
if(CURLM_OK >= result) {
@@ -2970,14 +2970,14 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi,
break;
case CURLMOPT_PIPELINING_SERVER_BL:
break;
- case CURLMOPT_MAX_CONCURRENT_STREAMS:
- {
- long streams = va_arg(param, long);
- if(streams < 1)
- streams = 100;
- multi->max_concurrent_streams = curlx_sltoui(streams);
- }
- break;
+ case CURLMOPT_MAX_CONCURRENT_STREAMS:
+ {
+ long streams = va_arg(param, long);
+ if(streams < 1)
+ streams = 100;
+ multi->max_concurrent_streams = curlx_sltoui(streams);
+ }
+ break;
default:
res = CURLM_UNKNOWN_OPTION;
break;
@@ -3121,8 +3121,8 @@ void Curl_update_timer(struct Curl_multi *multi)
static void
multi_deltimeout(struct Curl_easy *data, expire_id eid)
{
- struct Curl_llist_element *e;
- struct Curl_llist *timeoutlist = &data->state.timeoutlist;
+ struct Curl_llist_element *e;
+ struct Curl_llist *timeoutlist = &data->state.timeoutlist;
/* find and remove the specific node from the list */
for(e = timeoutlist->head; e; e = e->next) {
struct time_node *n = (struct time_node *)e->ptr;
@@ -3145,11 +3145,11 @@ multi_addtimeout(struct Curl_easy *data,
struct curltime *stamp,
expire_id eid)
{
- struct Curl_llist_element *e;
+ struct Curl_llist_element *e;
struct time_node *node;
- struct Curl_llist_element *prev = NULL;
+ struct Curl_llist_element *prev = NULL;
size_t n;
- struct Curl_llist *timeoutlist = &data->state.timeoutlist;
+ struct Curl_llist *timeoutlist = &data->state.timeoutlist;
node = &data->state.expires[eid];
@@ -3231,8 +3231,8 @@ void Curl_expire(struct Curl_easy *data, timediff_t milli, expire_id id)
/* Since this is an updated time, we must remove the previous entry from
the splay tree first and then re-add the new value */
- rc = Curl_splayremove(multi->timetree, &data->state.timenode,
- &multi->timetree);
+ rc = Curl_splayremove(multi->timetree, &data->state.timenode,
+ &multi->timetree);
if(rc)
infof(data, "Internal error removing splay node = %d\n", rc);
}
@@ -3275,11 +3275,11 @@ void Curl_expire_clear(struct Curl_easy *data)
if(nowp->tv_sec || nowp->tv_usec) {
/* Since this is an cleared time, we must remove the previous entry from
the splay tree */
- struct Curl_llist *list = &data->state.timeoutlist;
+ struct Curl_llist *list = &data->state.timeoutlist;
int rc;
- rc = Curl_splayremove(multi->timetree, &data->state.timenode,
- &multi->timetree);
+ rc = Curl_splayremove(multi->timetree, &data->state.timenode,
+ &multi->timetree);
if(rc)
infof(data, "Internal error clearing splay node = %d\n", rc);
@@ -3345,7 +3345,7 @@ void Curl_multiuse_state(struct connectdata *conn,
static void process_pending_handles(struct Curl_multi *multi)
{
- struct Curl_llist_element *e = multi->pending.head;
+ struct Curl_llist_element *e = multi->pending.head;
if(e) {
struct Curl_easy *data = e->ptr;
@@ -3413,9 +3413,9 @@ void Curl_multi_dump(struct Curl_multi *multi)
}
}
#endif
-
-unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi)
-{
- DEBUGASSERT(multi);
- return multi->max_concurrent_streams;
-}
+
+unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi)
+{
+ DEBUGASSERT(multi);
+ return multi->max_concurrent_streams;
+}
diff --git a/contrib/libs/curl/lib/multihandle.h b/contrib/libs/curl/lib/multihandle.h
index 9c8a7d5ac9..de4f74069e 100644
--- a/contrib/libs/curl/lib/multihandle.h
+++ b/contrib/libs/curl/lib/multihandle.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -24,10 +24,10 @@
#include "conncache.h"
#include "psl.h"
-#include "socketpair.h"
+#include "socketpair.h"
struct Curl_message {
- struct Curl_llist_element list;
+ struct Curl_llist_element list;
/* the 'CURLMsg' is the part that is visible to the external user */
struct CURLMsg extmsg;
};
@@ -67,21 +67,21 @@ typedef enum {
#define CURLPIPE_ANY (CURLPIPE_MULTIPLEX)
-#if defined(USE_SOCKETPAIR) && !defined(USE_BLOCKING_SOCKETS) && \
- !defined(CURL_DISABLE_SOCKETPAIR)
-#define ENABLE_WAKEUP
-#endif
-
-/* value for MAXIMUM CONCURRENT STREAMS upper limit */
-#define INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1)
-
+#if defined(USE_SOCKETPAIR) && !defined(USE_BLOCKING_SOCKETS) && \
+ !defined(CURL_DISABLE_SOCKETPAIR)
+#define ENABLE_WAKEUP
+#endif
+
+/* value for MAXIMUM CONCURRENT STREAMS upper limit */
+#define INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1)
+
/* This is the struct known as CURLM on the outside */
struct Curl_multi {
/* First a simple identifier to easier detect if a user mix up
this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */
long type;
- /* We have a doubly-linked list with easy handles */
+ /* We have a doubly-linked list with easy handles */
struct Curl_easy *easyp;
struct Curl_easy *easylp; /* last node */
@@ -89,9 +89,9 @@ struct Curl_multi {
int num_alive; /* amount of easy handles that are added but have not yet
reached COMPLETE state */
- struct Curl_llist msglist; /* a list of messages from completed transfers */
+ struct Curl_llist msglist; /* a list of messages from completed transfers */
- struct Curl_llist pending; /* Curl_easys that are in the
+ struct Curl_llist pending; /* Curl_easys that are in the
CURLM_STATE_CONNECT_PEND state */
/* callback function and user data pointer for the *socket() API */
@@ -103,7 +103,7 @@ struct Curl_multi {
void *push_userp;
/* Hostname cache */
- struct Curl_hash hostcache;
+ struct Curl_hash hostcache;
#ifdef USE_LIBPSL
/* PSL cache. */
@@ -117,7 +117,7 @@ struct Curl_multi {
/* 'sockhash' is the lookup hash for socket descriptor => easy handles (note
the pluralis form, there can be more than one easy handle waiting on the
same actual socket) */
- struct Curl_hash sockhash;
+ struct Curl_hash sockhash;
/* Shared connection cache (bundles)*/
struct conncache conn_cache;
@@ -136,17 +136,17 @@ struct Curl_multi {
void *timer_userp;
struct curltime timer_lastcall; /* the fixed time for the timeout for the
previous callback */
- unsigned int max_concurrent_streams;
-
-#ifdef ENABLE_WAKEUP
- curl_socket_t wakeup_pair[2]; /* socketpair() used for wakeup
- 0 is used for read, 1 is used for write */
-#endif
- /* multiplexing wanted */
- bool multiplexing;
- bool recheckstate; /* see Curl_multi_connchanged */
+ unsigned int max_concurrent_streams;
+
+#ifdef ENABLE_WAKEUP
+ curl_socket_t wakeup_pair[2]; /* socketpair() used for wakeup
+ 0 is used for read, 1 is used for write */
+#endif
+ /* multiplexing wanted */
+ bool multiplexing;
+ bool recheckstate; /* see Curl_multi_connchanged */
bool in_callback; /* true while executing a callback */
- bool ipv6_works;
+ bool ipv6_works;
};
#endif /* HEADER_CURL_MULTIHANDLE_H */
diff --git a/contrib/libs/curl/lib/multiif.h b/contrib/libs/curl/lib/multiif.h
index 76fdaf057b..f0a57d9a6c 100644
--- a/contrib/libs/curl/lib/multiif.h
+++ b/contrib/libs/curl/lib/multiif.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -33,11 +33,11 @@ void Curl_expire_done(struct Curl_easy *data, expire_id id);
void Curl_update_timer(struct Curl_multi *multi);
void Curl_attach_connnection(struct Curl_easy *data,
struct connectdata *conn);
-void Curl_detach_connnection(struct Curl_easy *data);
+void Curl_detach_connnection(struct Curl_easy *data);
bool Curl_multiplex_wanted(const struct Curl_multi *multi);
void Curl_set_in_callback(struct Curl_easy *data, bool value);
bool Curl_is_in_callback(struct Curl_easy *easy);
-CURLcode Curl_preconnect(struct Curl_easy *data);
+CURLcode Curl_preconnect(struct Curl_easy *data);
/* Internal version of curl_multi_init() accepts size parameters for the
socket and connection hashes */
@@ -91,8 +91,8 @@ CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
struct Curl_easy *data,
struct connectdata *conn);
-
-/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */
-unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi);
-
+
+/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */
+unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi);
+
#endif /* HEADER_CURL_MULTIIF_H */
diff --git a/contrib/libs/curl/lib/netrc.c b/contrib/libs/curl/lib/netrc.c
index f8218c02c4..13610bb070 100644
--- a/contrib/libs/curl/lib/netrc.c
+++ b/contrib/libs/curl/lib/netrc.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -88,7 +88,7 @@ static int parsenetrc(const char *host,
if(tok && *tok == '#')
/* treat an initial hash as a comment line */
continue;
- while(tok) {
+ while(tok) {
if((login && *login) && (password && *password)) {
done = TRUE;
diff --git a/contrib/libs/curl/lib/netrc.h b/contrib/libs/curl/lib/netrc.h
index 8218dc3415..4938a5916a 100644
--- a/contrib/libs/curl/lib/netrc.h
+++ b/contrib/libs/curl/lib/netrc.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/non-ascii.c b/contrib/libs/curl/lib/non-ascii.c
index b291556b3e..30c240b637 100644
--- a/contrib/libs/curl/lib/non-ascii.c
+++ b/contrib/libs/curl/lib/non-ascii.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/non-ascii.h b/contrib/libs/curl/lib/non-ascii.h
index 968173fbf2..458e8ef091 100644
--- a/contrib/libs/curl/lib/non-ascii.h
+++ b/contrib/libs/curl/lib/non-ascii.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/nonblock.c b/contrib/libs/curl/lib/nonblock.c
index 3d46d5fdbf..4a7bde504f 100644
--- a/contrib/libs/curl/lib/nonblock.c
+++ b/contrib/libs/curl/lib/nonblock.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/nonblock.h b/contrib/libs/curl/lib/nonblock.h
index 68817e5462..761dab4f6d 100644
--- a/contrib/libs/curl/lib/nonblock.h
+++ b/contrib/libs/curl/lib/nonblock.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/openldap.c b/contrib/libs/curl/lib/openldap.c
index 8a4219566d..f8e3150308 100644
--- a/contrib/libs/curl/lib/openldap.c
+++ b/contrib/libs/curl/lib/openldap.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010, Howard Chu, <hyc@openldap.org>
- * Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -107,7 +107,7 @@ const struct Curl_handler Curl_handler_ldap = {
ZERO_NULL, /* connection_check */
PORT_LDAP, /* defport */
CURLPROTO_LDAP, /* protocol */
- CURLPROTO_LDAP, /* family */
+ CURLPROTO_LDAP, /* family */
PROTOPT_NONE /* flags */
};
@@ -133,8 +133,8 @@ const struct Curl_handler Curl_handler_ldaps = {
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
PORT_LDAPS, /* defport */
- CURLPROTO_LDAPS, /* protocol */
- CURLPROTO_LDAP, /* family */
+ CURLPROTO_LDAPS, /* protocol */
+ CURLPROTO_LDAP, /* family */
PROTOPT_SSL /* flags */
};
#endif
@@ -164,10 +164,10 @@ struct ldapconninfo {
bool didbind;
};
-struct ldapreqinfo {
+struct ldapreqinfo {
int msgid;
int nument;
-};
+};
static CURLcode ldap_setup_connection(struct connectdata *conn)
{
@@ -376,7 +376,7 @@ static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection)
static CURLcode ldap_do(struct connectdata *conn, bool *done)
{
struct ldapconninfo *li = conn->proto.ldapc;
- struct ldapreqinfo *lr;
+ struct ldapreqinfo *lr;
CURLcode status = CURLE_OK;
int rc = 0;
LDAPURLDesc *ludp = NULL;
@@ -408,11 +408,11 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)
failf(data, "LDAP local: ldap_search_ext %s", ldap_err2string(rc));
return CURLE_LDAP_SEARCH_FAILED;
}
- lr = calloc(1, sizeof(struct ldapreqinfo));
+ lr = calloc(1, sizeof(struct ldapreqinfo));
if(!lr)
return CURLE_OUT_OF_MEMORY;
lr->msgid = msgid;
- data->req.p.ldap = lr;
+ data->req.p.ldap = lr;
Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
*done = TRUE;
return CURLE_OK;
@@ -421,7 +421,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)
static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
bool premature)
{
- struct ldapreqinfo *lr = conn->data->req.p.ldap;
+ struct ldapreqinfo *lr = conn->data->req.p.ldap;
(void)res;
(void)premature;
@@ -433,7 +433,7 @@ static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL);
lr->msgid = 0;
}
- conn->data->req.p.ldap = NULL;
+ conn->data->req.p.ldap = NULL;
free(lr);
}
@@ -445,7 +445,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
{
struct ldapconninfo *li = conn->proto.ldapc;
struct Curl_easy *data = conn->data;
- struct ldapreqinfo *lr = data->req.p.ldap;
+ struct ldapreqinfo *lr = data->req.p.ldap;
int rc, ret;
LDAPMessage *msg = NULL;
LDAPMessage *ent;
diff --git a/contrib/libs/curl/lib/parsedate.c b/contrib/libs/curl/lib/parsedate.c
index c9ce424a6e..3c38f2c4c2 100644
--- a/contrib/libs/curl/lib/parsedate.c
+++ b/contrib/libs/curl/lib/parsedate.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -100,21 +100,21 @@ static int parsedate(const char *date, time_t *output);
#define PARSEDATE_LATER 1
#define PARSEDATE_SOONER 2
-#if !defined(CURL_DISABLE_PARSEDATE) || !defined(CURL_DISABLE_FTP) || \
- !defined(CURL_DISABLE_FILE)
-/* These names are also used by FTP and FILE code */
+#if !defined(CURL_DISABLE_PARSEDATE) || !defined(CURL_DISABLE_FTP) || \
+ !defined(CURL_DISABLE_FILE)
+/* These names are also used by FTP and FILE code */
const char * const Curl_wkday[] =
{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
const char * const Curl_month[]=
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-#endif
+#endif
+
+#ifndef CURL_DISABLE_PARSEDATE
+static const char * const weekday[] =
+{ "Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday", "Sunday" };
-#ifndef CURL_DISABLE_PARSEDATE
-static const char * const weekday[] =
-{ "Monday", "Tuesday", "Wednesday", "Thursday",
- "Friday", "Saturday", "Sunday" };
-
struct tzinfo {
char name[5];
int offset; /* +/- in minutes */
@@ -275,21 +275,21 @@ enum assume {
DATE_TIME
};
-/*
- * time2epoch: time stamp to seconds since epoch in GMT time zone. Similar to
- * mktime but for GMT only.
+/*
+ * time2epoch: time stamp to seconds since epoch in GMT time zone. Similar to
+ * mktime but for GMT only.
*/
-static time_t time2epoch(int sec, int min, int hour,
- int mday, int mon, int year)
+static time_t time2epoch(int sec, int min, int hour,
+ int mday, int mon, int year)
{
static const int month_days_cumulative [12] =
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
- int leap_days = year - (mon <= 1);
+ int leap_days = year - (mon <= 1);
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[mon] + mday - 1) * 24
- + hour) * 60 + min) * 60 + sec;
+ return ((((time_t) (year - 1970) * 365
+ + leap_days + month_days_cumulative[mon] + mday - 1) * 24
+ + hour) * 60 + min) * 60 + sec;
}
/*
@@ -505,11 +505,11 @@ static int parsedate(const char *date, time_t *output)
(hournum > 23) || (minnum > 59) || (secnum > 60))
return PARSEDATE_FAIL; /* clearly an illegal date */
- /* time2epoch() returns a time_t. time_t is often 32 bits, sometimes even on
+ /* time2epoch() 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 = time2epoch(secnum, minnum, hournum, mdaynum, monnum, yearnum);
+ t = time2epoch(secnum, minnum, hournum, mdaynum, monnum, yearnum);
/* Add the time zone diff between local time zone and GMT. */
if(tzoff == -1)
@@ -552,30 +552,30 @@ time_t curl_getdate(const char *p, const time_t *now)
return -1;
}
-/* Curl_getdate_capped() differs from curl_getdate() in that this will return
- TIME_T_MAX in case the parsed time value was too big, instead of an
- error. */
-
-time_t Curl_getdate_capped(const char *p)
-{
- time_t parsed = -1;
- int rc = parsedate(p, &parsed);
-
- switch(rc) {
- case PARSEDATE_OK:
- if(parsed == -1)
- /* avoid returning -1 for a working scenario */
- parsed++;
- return parsed;
- case PARSEDATE_LATER:
- /* this returns the maximum time value */
- return parsed;
- default:
- return -1; /* everything else is fail */
- }
- /* UNREACHABLE */
-}
-
+/* Curl_getdate_capped() differs from curl_getdate() in that this will return
+ TIME_T_MAX in case the parsed time value was too big, instead of an
+ error. */
+
+time_t Curl_getdate_capped(const char *p)
+{
+ time_t parsed = -1;
+ int rc = parsedate(p, &parsed);
+
+ switch(rc) {
+ case PARSEDATE_OK:
+ if(parsed == -1)
+ /* avoid returning -1 for a working scenario */
+ parsed++;
+ return parsed;
+ case PARSEDATE_LATER:
+ /* this returns the maximum time value */
+ return parsed;
+ default:
+ return -1; /* everything else is fail */
+ }
+ /* UNREACHABLE */
+}
+
/*
* Curl_gmtime() is a gmtime() replacement for portability. Do not use the
* gmtime_r() or gmtime() functions anywhere else but here.
@@ -589,7 +589,7 @@ CURLcode Curl_gmtime(time_t intime, struct tm *store)
/* thread-safe version */
tm = (struct tm *)gmtime_r(&intime, store);
#else
- /* !checksrc! disable BANNEDFUNC 1 */
+ /* !checksrc! disable BANNEDFUNC 1 */
tm = gmtime(&intime);
if(tm)
*store = *tm; /* copy the pointed struct to the local copy */
diff --git a/contrib/libs/curl/lib/parsedate.h b/contrib/libs/curl/lib/parsedate.h
index 3e10aa2b36..a99faf9e36 100644
--- a/contrib/libs/curl/lib/parsedate.h
+++ b/contrib/libs/curl/lib/parsedate.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -27,10 +27,10 @@ extern const char * const Curl_month[12];
CURLcode Curl_gmtime(time_t intime, struct tm *store);
-/* Curl_getdate_capped() differs from curl_getdate() in that this will return
- TIME_T_MAX in case the parsed time value was too big, instead of an
- error. */
-
-time_t Curl_getdate_capped(const char *p);
-
+/* Curl_getdate_capped() differs from curl_getdate() in that this will return
+ TIME_T_MAX in case the parsed time value was too big, instead of an
+ error. */
+
+time_t Curl_getdate_capped(const char *p);
+
#endif /* HEADER_CURL_PARSEDATE_H */
diff --git a/contrib/libs/curl/lib/pingpong.c b/contrib/libs/curl/lib/pingpong.c
index 4572a380b6..5d6109a7df 100644
--- a/contrib/libs/curl/lib/pingpong.c
+++ b/contrib/libs/curl/lib/pingpong.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -44,12 +44,12 @@
/* Returns timeout in ms. 0 or negative number means the timeout has already
triggered */
-timediff_t Curl_pp_state_timeout(struct pingpong *pp, bool disconnecting)
+timediff_t Curl_pp_state_timeout(struct pingpong *pp, bool disconnecting)
{
struct connectdata *conn = pp->conn;
struct Curl_easy *data = conn->data;
- timediff_t timeout_ms; /* in milliseconds */
- timediff_t response_time = (data->set.server_response_timeout)?
+ timediff_t timeout_ms; /* in milliseconds */
+ timediff_t response_time = (data->set.server_response_timeout)?
data->set.server_response_timeout: pp->response_time;
/* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine
@@ -60,12 +60,12 @@ timediff_t Curl_pp_state_timeout(struct pingpong *pp, bool disconnecting)
/* Without a requested timeout, we only wait 'response_time' seconds for the
full response to arrive before we bail out */
timeout_ms = response_time -
- Curl_timediff(Curl_now(), pp->response); /* spent time */
+ Curl_timediff(Curl_now(), pp->response); /* spent time */
if(data->set.timeout && !disconnecting) {
/* if timeout is requested, find out how much remaining time we have */
- timediff_t timeout2_ms = data->set.timeout - /* timeout time */
- Curl_timediff(Curl_now(), conn->now); /* spent time */
+ timediff_t timeout2_ms = data->set.timeout - /* timeout time */
+ Curl_timediff(Curl_now(), conn->now); /* spent time */
/* pick the lowest number */
timeout_ms = CURLMIN(timeout_ms, timeout2_ms);
@@ -83,8 +83,8 @@ CURLcode Curl_pp_statemach(struct pingpong *pp, bool block,
struct connectdata *conn = pp->conn;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
int rc;
- timediff_t interval_ms;
- timediff_t timeout_ms = Curl_pp_state_timeout(pp, disconnecting);
+ timediff_t interval_ms;
+ timediff_t timeout_ms = Curl_pp_state_timeout(pp, disconnecting);
struct Curl_easy *data = conn->data;
CURLcode result = CURLE_OK;
@@ -146,11 +146,11 @@ void Curl_pp_init(struct pingpong *pp)
pp->response = Curl_now(); /* start response time-out now! */
}
-/* setup for the coming transfer */
-void Curl_pp_setup(struct pingpong *pp)
-{
- Curl_dyn_init(&pp->sendbuf, DYN_PINGPPONG_CMD);
-}
+/* setup for the coming transfer */
+void Curl_pp_setup(struct pingpong *pp)
+{
+ Curl_dyn_init(&pp->sendbuf, DYN_PINGPPONG_CMD);
+}
/***********************************************************************
*
@@ -166,7 +166,7 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp,
const char *fmt,
va_list args)
{
- ssize_t bytes_written = 0;
+ ssize_t bytes_written = 0;
size_t write_len;
char *s;
CURLcode result;
@@ -186,39 +186,39 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp,
return CURLE_SEND_ERROR;
data = conn->data;
- Curl_dyn_reset(&pp->sendbuf);
- result = Curl_dyn_vaddf(&pp->sendbuf, fmt, args);
- if(result)
- return result;
+ Curl_dyn_reset(&pp->sendbuf);
+ result = Curl_dyn_vaddf(&pp->sendbuf, fmt, args);
+ if(result)
+ return result;
- /* append CRLF */
- result = Curl_dyn_addn(&pp->sendbuf, "\r\n", 2);
- if(result)
- return result;
+ /* append CRLF */
+ result = Curl_dyn_addn(&pp->sendbuf, "\r\n", 2);
+ if(result)
+ return result;
- write_len = Curl_dyn_len(&pp->sendbuf);
- s = Curl_dyn_ptr(&pp->sendbuf);
+ write_len = Curl_dyn_len(&pp->sendbuf);
+ s = Curl_dyn_ptr(&pp->sendbuf);
Curl_pp_init(pp);
result = Curl_convert_to_network(data, s, write_len);
/* Curl_convert_to_network calls failf if unsuccessful */
- if(result)
+ if(result)
return result;
#ifdef HAVE_GSSAPI
conn->data_prot = PROT_CMD;
#endif
result = Curl_write(conn, conn->sock[FIRSTSOCKET], s, write_len,
- &bytes_written);
- if(result)
- return result;
+ &bytes_written);
+ if(result)
+ return result;
#ifdef HAVE_GSSAPI
data_sec = conn->data_prot;
DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);
conn->data_prot = data_sec;
#endif
- Curl_debug(data, CURLINFO_HEADER_OUT, s, (size_t)bytes_written);
+ Curl_debug(data, CURLINFO_HEADER_OUT, s, (size_t)bytes_written);
if(bytes_written != (ssize_t)write_len) {
/* the whole chunk was not sent, keep it around and adjust sizes */
@@ -363,8 +363,8 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
#ifdef HAVE_GSSAPI
if(!conn->sec_complete)
#endif
- Curl_debug(data, CURLINFO_HEADER_IN,
- pp->linestart_resp, (size_t)perline);
+ Curl_debug(data, CURLINFO_HEADER_IN,
+ pp->linestart_resp, (size_t)perline);
/*
* We pass all response-lines to the callback function registered
@@ -378,10 +378,10 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
if(pp->endofresp(conn, pp->linestart_resp, perline, code)) {
/* This is the end of the last line, copy the last line to the
- start of the buffer and null-terminate, for old times sake */
+ start of the buffer and null-terminate, for old times sake */
size_t n = ptr - pp->linestart_resp;
memmove(buf, pp->linestart_resp, n);
- buf[n] = 0; /* null-terminate */
+ buf[n] = 0; /* null-terminate */
keepon = FALSE;
pp->linestart_resp = ptr + 1; /* advance pointer */
i++; /* skip this before getting out */
@@ -496,15 +496,15 @@ CURLcode Curl_pp_flushsend(struct pingpong *pp)
CURLcode Curl_pp_disconnect(struct pingpong *pp)
{
- Curl_dyn_free(&pp->sendbuf);
- Curl_safefree(pp->cache);
+ Curl_dyn_free(&pp->sendbuf);
+ Curl_safefree(pp->cache);
return CURLE_OK;
}
bool Curl_pp_moredata(struct pingpong *pp)
{
return (!pp->sendleft && pp->cache && pp->nread_resp < pp->cache_size) ?
- TRUE : FALSE;
+ TRUE : FALSE;
}
#endif
diff --git a/contrib/libs/curl/lib/pingpong.h b/contrib/libs/curl/lib/pingpong.h
index 72d69e7fc7..0d0c74afa0 100644
--- a/contrib/libs/curl/lib/pingpong.h
+++ b/contrib/libs/curl/lib/pingpong.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -60,11 +60,11 @@ struct pingpong {
size_t sendsize; /* total size of the sendthis buffer */
struct curltime response; /* set to Curl_now() when a command has been sent
off, used to time-out response reading */
- timediff_t response_time; /* When no timeout is given, this is the amount of
- milliseconds we await for a server response. */
+ timediff_t response_time; /* When no timeout is given, this is the amount of
+ milliseconds we await for a server response. */
struct connectdata *conn; /* points to the connectdata struct that this
belongs to */
- struct dynbuf sendbuf;
+ struct dynbuf sendbuf;
/* Function pointers the protocols MUST implement and provide for the
pingpong layer to function */
@@ -87,12 +87,12 @@ CURLcode Curl_pp_statemach(struct pingpong *pp, bool block,
/* initialize stuff to prepare for reading a fresh new response */
void Curl_pp_init(struct pingpong *pp);
-/* setup for the transfer */
-void Curl_pp_setup(struct pingpong *pp);
-
+/* setup for the transfer */
+void Curl_pp_setup(struct pingpong *pp);
+
/* Returns timeout in ms. 0 or negative number means the timeout has already
triggered */
-timediff_t Curl_pp_state_timeout(struct pingpong *pp, bool disconnecting);
+timediff_t Curl_pp_state_timeout(struct pingpong *pp, bool disconnecting);
/***********************************************************************
diff --git a/contrib/libs/curl/lib/pop3.c b/contrib/libs/curl/lib/pop3.c
index 4b0c5c15bc..e71860e48a 100644
--- a/contrib/libs/curl/lib/pop3.c
+++ b/contrib/libs/curl/lib/pop3.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -128,7 +128,7 @@ const struct Curl_handler Curl_handler_pop3 = {
ZERO_NULL, /* connection_check */
PORT_POP3, /* defport */
CURLPROTO_POP3, /* protocol */
- CURLPROTO_POP3, /* family */
+ CURLPROTO_POP3, /* family */
PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY | /* flags */
PROTOPT_URLOPTIONS
};
@@ -156,7 +156,7 @@ const struct Curl_handler Curl_handler_pop3s = {
ZERO_NULL, /* connection_check */
PORT_POP3S, /* defport */
CURLPROTO_POP3S, /* protocol */
- CURLPROTO_POP3, /* family */
+ CURLPROTO_POP3, /* family */
PROTOPT_CLOSEACTION | PROTOPT_SSL
| PROTOPT_NOURLQUERY | PROTOPT_URLOPTIONS /* flags */
};
@@ -180,7 +180,7 @@ static void pop3_to_pop3s(struct connectdata *conn)
conn->handler = &Curl_handler_pop3s;
/* Set the connection's upgraded to TLS flag */
- conn->bits.tls_upgraded = TRUE;
+ conn->bits.tls_upgraded = TRUE;
}
#else
#define pop3_to_pop3s(x) Curl_nop_stmt
@@ -414,7 +414,7 @@ static CURLcode pop3_perform_apop(struct connectdata *conn)
CURLcode result = CURLE_OK;
struct pop3_conn *pop3c = &conn->proto.pop3c;
size_t i;
- struct MD5_context *ctxt;
+ struct MD5_context *ctxt;
unsigned char digest[MD5_DIGEST_LEN];
char secret[2 * MD5_DIGEST_LEN + 1];
@@ -553,7 +553,7 @@ static CURLcode pop3_perform_command(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.p.pop3;
+ struct POP3 *pop3 = data->req.p.pop3;
const char *command = NULL;
/* Calculate the default command */
@@ -886,7 +886,7 @@ static CURLcode pop3_state_command_resp(struct connectdata *conn,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.p.pop3;
+ struct POP3 *pop3 = data->req.p.pop3;
struct pop3_conn *pop3c = &conn->proto.pop3c;
struct pingpong *pp = &pop3c->pp;
@@ -1048,7 +1048,7 @@ static CURLcode pop3_init(struct connectdata *conn)
struct Curl_easy *data = conn->data;
struct POP3 *pop3;
- pop3 = data->req.p.pop3 = calloc(sizeof(struct POP3), 1);
+ pop3 = data->req.p.pop3 = calloc(sizeof(struct POP3), 1);
if(!pop3)
result = CURLE_OUT_OF_MEMORY;
@@ -1093,7 +1093,7 @@ static CURLcode pop3_connect(struct connectdata *conn, bool *done)
Curl_sasl_init(&pop3c->sasl, &saslpop3);
/* Initialise the pingpong layer */
- Curl_pp_setup(pp);
+ Curl_pp_setup(pp);
Curl_pp_init(pp);
/* Parse the URL options */
@@ -1123,7 +1123,7 @@ static CURLcode pop3_done(struct connectdata *conn, CURLcode status,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.p.pop3;
+ struct POP3 *pop3 = data->req.p.pop3;
(void)premature;
@@ -1157,7 +1157,7 @@ static CURLcode pop3_perform(struct connectdata *conn, bool *connected,
{
/* This is POP3 and no proxy */
CURLcode result = CURLE_OK;
- struct POP3 *pop3 = conn->data->req.p.pop3;
+ struct POP3 *pop3 = conn->data->req.p.pop3;
DEBUGF(infof(conn->data, "DO phase starts\n"));
@@ -1315,7 +1315,7 @@ static CURLcode pop3_setup_connection(struct connectdata *conn)
return result;
/* Clear the TLS upgraded flag */
- conn->bits.tls_upgraded = FALSE;
+ conn->bits.tls_upgraded = FALSE;
return CURLE_OK;
}
@@ -1389,11 +1389,11 @@ static CURLcode pop3_parse_url_path(struct connectdata *conn)
{
/* The POP3 struct is already initialised in pop3_connect() */
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.p.pop3;
+ struct POP3 *pop3 = data->req.p.pop3;
const char *path = &data->state.up.path[1]; /* skip leading path */
/* URL decode the path for the message ID */
- return Curl_urldecode(data, path, 0, &pop3->id, NULL, REJECT_CTRL);
+ return Curl_urldecode(data, path, 0, &pop3->id, NULL, REJECT_CTRL);
}
/***********************************************************************
@@ -1406,12 +1406,12 @@ static CURLcode pop3_parse_custom_request(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.p.pop3;
+ struct POP3 *pop3 = data->req.p.pop3;
const char *custom = data->set.str[STRING_CUSTOMREQUEST];
/* URL decode the custom request */
if(custom)
- result = Curl_urldecode(data, custom, 0, &pop3->custom, NULL, REJECT_CTRL);
+ result = Curl_urldecode(data, custom, 0, &pop3->custom, NULL, REJECT_CTRL);
return result;
}
diff --git a/contrib/libs/curl/lib/pop3.h b/contrib/libs/curl/lib/pop3.h
index 95a757eceb..6ca3fd511f 100644
--- a/contrib/libs/curl/lib/pop3.h
+++ b/contrib/libs/curl/lib/pop3.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2009 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2009 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/progress.c b/contrib/libs/curl/lib/progress.c
index f9bb8fadd5..658d05ab8e 100644
--- a/contrib/libs/curl/lib/progress.c
+++ b/contrib/libs/curl/lib/progress.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -164,13 +164,13 @@ void Curl_pgrsResetTransferSizes(struct Curl_easy *data)
}
/*
- *
- * Curl_pgrsTime(). Store the current time at the given label. This fetches a
- * fresh "now" and returns it.
- *
+ *
+ * Curl_pgrsTime(). Store the current time at the given label. This fetches a
+ * fresh "now" and returns it.
+ *
* @unittest: 1399
*/
-struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer)
+struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer)
{
struct curltime now = Curl_now();
timediff_t *delta = NULL;
@@ -213,7 +213,7 @@ struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer)
* changing the t_starttransfer time.
*/
if(data->progress.is_t_startransfer_set) {
- return now;
+ return now;
}
else {
data->progress.is_t_startransfer_set = true;
@@ -232,7 +232,7 @@ struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer)
us = 1; /* make sure at least one microsecond passed */
*delta += us;
}
- return now;
+ return now;
}
void Curl_pgrsStartNow(struct Curl_easy *data)
@@ -240,8 +240,8 @@ void Curl_pgrsStartNow(struct Curl_easy *data)
data->progress.speeder_c = 0; /* reset the progress meter display */
data->progress.start = Curl_now();
data->progress.is_t_startransfer_set = false;
- data->progress.ul_limit_start = data->progress.start;
- data->progress.dl_limit_start = data->progress.start;
+ data->progress.ul_limit_start = data->progress.start;
+ data->progress.dl_limit_start = data->progress.start;
data->progress.downloaded = 0;
data->progress.uploaded = 0;
/* clear all bits except HIDE and HEADERS_OUT */
@@ -285,9 +285,9 @@ timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize,
* stay below 'limit'.
*/
if(size < CURL_OFF_T_MAX/1000)
- minimum = (timediff_t) (CURL_OFF_T_C(1000) * size / limit);
+ minimum = (timediff_t) (CURL_OFF_T_C(1000) * size / limit);
else {
- minimum = (timediff_t) (size / limit);
+ minimum = (timediff_t) (size / limit);
if(minimum < TIMEDIFF_T_MAX/1000)
minimum *= 1000;
else
@@ -597,13 +597,13 @@ int Curl_pgrsUpdate(struct connectdata *conn)
data->progress.size_ul,
data->progress.uploaded);
Curl_set_in_callback(data, false);
- if(result != CURL_PROGRESSFUNC_CONTINUE) {
- if(result)
- failf(data, "Callback aborted");
- return result;
- }
+ if(result != CURL_PROGRESSFUNC_CONTINUE) {
+ if(result)
+ failf(data, "Callback aborted");
+ return result;
+ }
}
- else if(data->set.fprogress) {
+ else if(data->set.fprogress) {
int result;
/* The older deprecated callback is set, call that */
Curl_set_in_callback(data, true);
@@ -613,11 +613,11 @@ int Curl_pgrsUpdate(struct connectdata *conn)
(double)data->progress.size_ul,
(double)data->progress.uploaded);
Curl_set_in_callback(data, false);
- if(result != CURL_PROGRESSFUNC_CONTINUE) {
- if(result)
- failf(data, "Callback aborted");
- return result;
- }
+ if(result != CURL_PROGRESSFUNC_CONTINUE) {
+ if(result)
+ failf(data, "Callback aborted");
+ return result;
+ }
}
if(showprogress)
diff --git a/contrib/libs/curl/lib/progress.h b/contrib/libs/curl/lib/progress.h
index 8a42dafded..74680099f0 100644
--- a/contrib/libs/curl/lib/progress.h
+++ b/contrib/libs/curl/lib/progress.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -49,7 +49,7 @@ void Curl_pgrsSetUploadCounter(struct Curl_easy *data, curl_off_t size);
void Curl_ratelimit(struct Curl_easy *data, struct curltime now);
int Curl_pgrsUpdate(struct connectdata *);
void Curl_pgrsResetTransferSizes(struct Curl_easy *data);
-struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer);
+struct curltime Curl_pgrsTime(struct Curl_easy *data, timerid timer);
timediff_t Curl_pgrsLimitWaitTime(curl_off_t cursize,
curl_off_t startsize,
curl_off_t limit,
diff --git a/contrib/libs/curl/lib/psl.c b/contrib/libs/curl/lib/psl.c
index 7c9efc3b75..e46091863f 100644
--- a/contrib/libs/curl/lib/psl.c
+++ b/contrib/libs/curl/lib/psl.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/psl.h b/contrib/libs/curl/lib/psl.h
index 5d35b6aaf0..2d9c99144c 100644
--- a/contrib/libs/curl/lib/psl.h
+++ b/contrib/libs/curl/lib/psl.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/quic.h b/contrib/libs/curl/lib/quic.h
index 196a0866e9..83e10cb44f 100644
--- a/contrib/libs/curl/lib/quic.h
+++ b/contrib/libs/curl/lib/quic.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -41,19 +41,19 @@ CURLcode Curl_quic_connect(struct connectdata *conn,
const struct sockaddr *addr,
socklen_t addrlen);
CURLcode Curl_quic_is_connected(struct connectdata *conn,
- int sockindex,
+ int sockindex,
bool *connected);
int Curl_quic_ver(char *p, size_t len);
CURLcode Curl_quic_done_sending(struct connectdata *conn);
-void Curl_quic_done(struct Curl_easy *data, bool premature);
-bool Curl_quic_data_pending(const struct Curl_easy *data);
-void Curl_quic_disconnect(struct connectdata *conn, int tempindex);
+void Curl_quic_done(struct Curl_easy *data, bool premature);
+bool Curl_quic_data_pending(const struct Curl_easy *data);
+void Curl_quic_disconnect(struct connectdata *conn, int tempindex);
#else /* ENABLE_QUIC */
#define Curl_quic_done_sending(x)
-#define Curl_quic_done(x,y)
-#define Curl_quic_data_pending(x)
-#define Curl_quic_disconnect(x,y)
+#define Curl_quic_done(x,y)
+#define Curl_quic_data_pending(x)
+#define Curl_quic_disconnect(x,y)
#endif /* !ENABLE_QUIC */
#endif /* HEADER_CURL_QUIC_H */
diff --git a/contrib/libs/curl/lib/rand.c b/contrib/libs/curl/lib/rand.c
index 075d0b9ceb..951fedb0a9 100644
--- a/contrib/libs/curl/lib/rand.c
+++ b/contrib/libs/curl/lib/rand.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/rand.h b/contrib/libs/curl/lib/rand.h
index 6193f7b216..02d95d8e64 100644
--- a/contrib/libs/curl/lib/rand.h
+++ b/contrib/libs/curl/lib/rand.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/rename.c b/contrib/libs/curl/lib/rename.c
index d910767c54..f858d43695 100644
--- a/contrib/libs/curl/lib/rename.c
+++ b/contrib/libs/curl/lib/rename.c
@@ -1,71 +1,71 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "rename.h"
-
-#include "curl_setup.h"
-
-#if (!defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_COOKIES)) || \
- !defined(CURL_DISABLE_ALTSVC)
-
-#include "curl_multibyte.h"
-#include "timeval.h"
-
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
-#include "curl_memory.h"
-#include "memdebug.h"
-
-/* return 0 on success, 1 on error */
-int Curl_rename(const char *oldpath, const char *newpath)
-{
-#ifdef WIN32
- /* rename() on Windows doesn't overwrite, so we can't use it here.
- MoveFileEx() will overwrite and is usually atomic, however it fails
- when there are open handles to the file. */
- const int max_wait_ms = 1000;
- struct curltime start = Curl_now();
- TCHAR *tchar_oldpath = curlx_convert_UTF8_to_tchar((char *)oldpath);
- TCHAR *tchar_newpath = curlx_convert_UTF8_to_tchar((char *)newpath);
- for(;;) {
- timediff_t diff;
- if(MoveFileEx(tchar_oldpath, tchar_newpath, MOVEFILE_REPLACE_EXISTING)) {
- curlx_unicodefree(tchar_oldpath);
- curlx_unicodefree(tchar_newpath);
- break;
- }
- diff = Curl_timediff(Curl_now(), start);
- if(diff < 0 || diff > max_wait_ms) {
- curlx_unicodefree(tchar_oldpath);
- curlx_unicodefree(tchar_newpath);
- return 1;
- }
- Sleep(1);
- }
-#else
- if(rename(oldpath, newpath))
- return 1;
-#endif
- return 0;
-}
-
-#endif
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "rename.h"
+
+#include "curl_setup.h"
+
+#if (!defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_COOKIES)) || \
+ !defined(CURL_DISABLE_ALTSVC)
+
+#include "curl_multibyte.h"
+#include "timeval.h"
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "memdebug.h"
+
+/* return 0 on success, 1 on error */
+int Curl_rename(const char *oldpath, const char *newpath)
+{
+#ifdef WIN32
+ /* rename() on Windows doesn't overwrite, so we can't use it here.
+ MoveFileEx() will overwrite and is usually atomic, however it fails
+ when there are open handles to the file. */
+ const int max_wait_ms = 1000;
+ struct curltime start = Curl_now();
+ TCHAR *tchar_oldpath = curlx_convert_UTF8_to_tchar((char *)oldpath);
+ TCHAR *tchar_newpath = curlx_convert_UTF8_to_tchar((char *)newpath);
+ for(;;) {
+ timediff_t diff;
+ if(MoveFileEx(tchar_oldpath, tchar_newpath, MOVEFILE_REPLACE_EXISTING)) {
+ curlx_unicodefree(tchar_oldpath);
+ curlx_unicodefree(tchar_newpath);
+ break;
+ }
+ diff = Curl_timediff(Curl_now(), start);
+ if(diff < 0 || diff > max_wait_ms) {
+ curlx_unicodefree(tchar_oldpath);
+ curlx_unicodefree(tchar_newpath);
+ return 1;
+ }
+ Sleep(1);
+ }
+#else
+ if(rename(oldpath, newpath))
+ return 1;
+#endif
+ return 0;
+}
+
+#endif
diff --git a/contrib/libs/curl/lib/rename.h b/contrib/libs/curl/lib/rename.h
index a5a1dc857c..534f7471c8 100644
--- a/contrib/libs/curl/lib/rename.h
+++ b/contrib/libs/curl/lib/rename.h
@@ -1,27 +1,27 @@
-#ifndef HEADER_CURL_RENAME_H
-#define HEADER_CURL_RENAME_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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_rename(const char *oldpath, const char *newpath);
-
-#endif /* HEADER_CURL_RENAME_H */
+#ifndef HEADER_CURL_RENAME_H
+#define HEADER_CURL_RENAME_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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_rename(const char *oldpath, const char *newpath);
+
+#endif /* HEADER_CURL_RENAME_H */
diff --git a/contrib/libs/curl/lib/rtsp.c b/contrib/libs/curl/lib/rtsp.c
index 1b6daaf35f..151ff4af27 100644
--- a/contrib/libs/curl/lib/rtsp.c
+++ b/contrib/libs/curl/lib/rtsp.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -106,7 +106,7 @@ const struct Curl_handler Curl_handler_rtsp = {
rtsp_conncheck, /* connection_check */
PORT_RTSP, /* defport */
CURLPROTO_RTSP, /* protocol */
- CURLPROTO_RTSP, /* family */
+ CURLPROTO_RTSP, /* family */
PROTOPT_NONE /* flags */
};
@@ -115,7 +115,7 @@ static CURLcode rtsp_setup_connection(struct connectdata *conn)
{
struct RTSP *rtsp;
- conn->data->req.p.rtsp = rtsp = calloc(1, sizeof(struct RTSP));
+ conn->data->req.p.rtsp = rtsp = calloc(1, sizeof(struct RTSP));
if(!rtsp)
return CURLE_OUT_OF_MEMORY;
@@ -200,7 +200,7 @@ static CURLcode rtsp_done(struct connectdata *conn,
CURLcode status, bool premature)
{
struct Curl_easy *data = conn->data;
- struct RTSP *rtsp = data->req.p.rtsp;
+ struct RTSP *rtsp = data->req.p.rtsp;
CURLcode httpStatus;
/* Bypass HTTP empty-reply checks on receive */
@@ -233,8 +233,8 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
struct Curl_easy *data = conn->data;
CURLcode result = CURLE_OK;
Curl_RtspReq rtspreq = data->set.rtspreq;
- struct RTSP *rtsp = data->req.p.rtsp;
- struct dynbuf req_buffer;
+ struct RTSP *rtsp = data->req.p.rtsp;
+ struct dynbuf req_buffer;
curl_off_t postsize = 0; /* for ANNOUNCE and SET_PARAMETER */
curl_off_t putsize = 0; /* for ANNOUNCE and SET_PARAMETER */
@@ -334,12 +334,12 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
if(rtspreq == RTSPREQ_SETUP && !p_transport) {
/* New Transport: setting? */
if(data->set.str[STRING_RTSP_TRANSPORT]) {
- Curl_safefree(data->state.aptr.rtsp_transport);
+ Curl_safefree(data->state.aptr.rtsp_transport);
- data->state.aptr.rtsp_transport =
+ data->state.aptr.rtsp_transport =
aprintf("Transport: %s\r\n",
data->set.str[STRING_RTSP_TRANSPORT]);
- if(!data->state.aptr.rtsp_transport)
+ if(!data->state.aptr.rtsp_transport)
return CURLE_OUT_OF_MEMORY;
}
else {
@@ -348,7 +348,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
return CURLE_BAD_FUNCTION_ARGUMENT;
}
- p_transport = data->state.aptr.rtsp_transport;
+ p_transport = data->state.aptr.rtsp_transport;
}
/* Accept Headers for DESCRIBE requests */
@@ -360,14 +360,14 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
/* Accept-Encoding header */
if(!Curl_checkheaders(conn, "Accept-Encoding") &&
data->set.str[STRING_ENCODING]) {
- Curl_safefree(data->state.aptr.accept_encoding);
- data->state.aptr.accept_encoding =
+ Curl_safefree(data->state.aptr.accept_encoding);
+ data->state.aptr.accept_encoding =
aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]);
- if(!data->state.aptr.accept_encoding)
+ if(!data->state.aptr.accept_encoding)
return CURLE_OUT_OF_MEMORY;
- p_accept_encoding = data->state.aptr.accept_encoding;
+ p_accept_encoding = data->state.aptr.accept_encoding;
}
}
@@ -375,13 +375,13 @@ 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") && data->state.aptr.uagent) {
- Curl_safefree(data->state.aptr.uagent);
- data->state.aptr.uagent = NULL;
+ if(Curl_checkheaders(conn, "User-Agent") && data->state.aptr.uagent) {
+ Curl_safefree(data->state.aptr.uagent);
+ data->state.aptr.uagent = NULL;
}
else if(!Curl_checkheaders(conn, "User-Agent") &&
data->set.str[STRING_USERAGENT]) {
- p_uagent = data->state.aptr.uagent;
+ p_uagent = data->state.aptr.uagent;
}
/* setup the authentication headers */
@@ -389,17 +389,17 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
if(result)
return result;
- p_proxyuserpwd = data->state.aptr.proxyuserpwd;
- p_userpwd = data->state.aptr.userpwd;
+ p_proxyuserpwd = data->state.aptr.proxyuserpwd;
+ p_userpwd = data->state.aptr.userpwd;
/* Referrer */
- Curl_safefree(data->state.aptr.ref);
+ Curl_safefree(data->state.aptr.ref);
if(data->change.referer && !Curl_checkheaders(conn, "Referer"))
- data->state.aptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
+ data->state.aptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
else
- data->state.aptr.ref = NULL;
+ data->state.aptr.ref = NULL;
- p_referrer = data->state.aptr.ref;
+ p_referrer = data->state.aptr.ref;
/*
* Range Header
@@ -412,9 +412,9 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
/* Check to see if there is a range set in the custom headers */
if(!Curl_checkheaders(conn, "Range") && data->state.range) {
- Curl_safefree(data->state.aptr.rangeline);
- data->state.aptr.rangeline = aprintf("Range: %s\r\n", data->state.range);
- p_range = data->state.aptr.rangeline;
+ Curl_safefree(data->state.aptr.rangeline);
+ data->state.aptr.rangeline = aprintf("Range: %s\r\n", data->state.range);
+ p_range = data->state.aptr.rangeline;
}
}
@@ -431,13 +431,13 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
}
/* Initialize a dynamic send buffer */
- Curl_dyn_init(&req_buffer, DYN_RTSP_REQ_HEADER);
+ Curl_dyn_init(&req_buffer, DYN_RTSP_REQ_HEADER);
result =
- Curl_dyn_addf(&req_buffer,
- "%s %s RTSP/1.0\r\n" /* Request Stream-URI RTSP/1.0 */
- "CSeq: %ld\r\n", /* CSeq */
- p_request, p_stream_uri, rtsp->CSeq_sent);
+ Curl_dyn_addf(&req_buffer,
+ "%s %s RTSP/1.0\r\n" /* Request Stream-URI RTSP/1.0 */
+ "CSeq: %ld\r\n", /* CSeq */
+ p_request, p_stream_uri, rtsp->CSeq_sent);
if(result)
return result;
@@ -446,7 +446,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
* to make comparison easier
*/
if(p_session_id) {
- result = Curl_dyn_addf(&req_buffer, "Session: %s\r\n", p_session_id);
+ result = Curl_dyn_addf(&req_buffer, "Session: %s\r\n", p_session_id);
if(result)
return result;
}
@@ -454,42 +454,42 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
/*
* Shared HTTP-like options
*/
- result = Curl_dyn_addf(&req_buffer,
- "%s" /* transport */
- "%s" /* accept */
- "%s" /* accept-encoding */
- "%s" /* range */
- "%s" /* referrer */
- "%s" /* user-agent */
- "%s" /* proxyuserpwd */
- "%s" /* userpwd */
- ,
- p_transport ? p_transport : "",
- p_accept ? p_accept : "",
- p_accept_encoding ? p_accept_encoding : "",
- p_range ? p_range : "",
- p_referrer ? p_referrer : "",
- p_uagent ? p_uagent : "",
- p_proxyuserpwd ? p_proxyuserpwd : "",
- p_userpwd ? p_userpwd : "");
+ result = Curl_dyn_addf(&req_buffer,
+ "%s" /* transport */
+ "%s" /* accept */
+ "%s" /* accept-encoding */
+ "%s" /* range */
+ "%s" /* referrer */
+ "%s" /* user-agent */
+ "%s" /* proxyuserpwd */
+ "%s" /* userpwd */
+ ,
+ p_transport ? p_transport : "",
+ p_accept ? p_accept : "",
+ p_accept_encoding ? p_accept_encoding : "",
+ p_range ? p_range : "",
+ p_referrer ? p_referrer : "",
+ p_uagent ? p_uagent : "",
+ p_proxyuserpwd ? p_proxyuserpwd : "",
+ p_userpwd ? p_userpwd : "");
/*
* Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM
* with basic and digest, it will be freed anyway by the next request
*/
- Curl_safefree(data->state.aptr.userpwd);
- data->state.aptr.userpwd = NULL;
+ Curl_safefree(data->state.aptr.userpwd);
+ data->state.aptr.userpwd = NULL;
if(result)
return result;
if((rtspreq == RTSPREQ_SETUP) || (rtspreq == RTSPREQ_DESCRIBE)) {
- result = Curl_add_timecondition(conn, &req_buffer);
+ result = Curl_add_timecondition(conn, &req_buffer);
if(result)
return result;
}
- result = Curl_add_custom_headers(conn, FALSE, &req_buffer);
+ result = Curl_add_custom_headers(conn, FALSE, &req_buffer);
if(result)
return result;
@@ -499,14 +499,14 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
if(data->set.upload) {
putsize = data->state.infilesize;
- data->state.httpreq = HTTPREQ_PUT;
+ data->state.httpreq = HTTPREQ_PUT;
}
else {
postsize = (data->state.infilesize != -1)?
data->state.infilesize:
(data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);
- data->state.httpreq = HTTPREQ_POST;
+ data->state.httpreq = HTTPREQ_POST;
}
if(putsize > 0 || postsize > 0) {
@@ -514,9 +514,9 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
* actually set a custom Content-Length in the headers */
if(!Curl_checkheaders(conn, "Content-Length")) {
result =
- Curl_dyn_addf(&req_buffer,
- "Content-Length: %" CURL_FORMAT_CURL_OFF_T"\r\n",
- (data->set.upload ? putsize : postsize));
+ Curl_dyn_addf(&req_buffer,
+ "Content-Length: %" CURL_FORMAT_CURL_OFF_T"\r\n",
+ (data->set.upload ? putsize : postsize));
if(result)
return result;
}
@@ -524,8 +524,8 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
if(rtspreq == RTSPREQ_SET_PARAMETER ||
rtspreq == RTSPREQ_GET_PARAMETER) {
if(!Curl_checkheaders(conn, "Content-Type")) {
- result = Curl_dyn_addf(&req_buffer,
- "Content-Type: text/parameters\r\n");
+ result = Curl_dyn_addf(&req_buffer,
+ "Content-Type: text/parameters\r\n");
if(result)
return result;
}
@@ -533,8 +533,8 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
if(rtspreq == RTSPREQ_ANNOUNCE) {
if(!Curl_checkheaders(conn, "Content-Type")) {
- result = Curl_dyn_addf(&req_buffer,
- "Content-Type: application/sdp\r\n");
+ result = Curl_dyn_addf(&req_buffer,
+ "Content-Type: application/sdp\r\n");
if(result)
return result;
}
@@ -544,7 +544,7 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
}
else if(rtspreq == RTSPREQ_GET_PARAMETER) {
/* Check for an empty GET_PARAMETER (heartbeat) request */
- data->state.httpreq = HTTPREQ_HEAD;
+ data->state.httpreq = HTTPREQ_HEAD;
data->set.opt_no_body = TRUE;
}
}
@@ -552,20 +552,20 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
/* RTSP never allows chunked transfer */
data->req.forbidchunk = TRUE;
/* Finish the request buffer */
- result = Curl_dyn_add(&req_buffer, "\r\n");
+ result = Curl_dyn_add(&req_buffer, "\r\n");
if(result)
return result;
if(postsize > 0) {
- result = Curl_dyn_addn(&req_buffer, data->set.postfields,
- (size_t)postsize);
+ result = Curl_dyn_addn(&req_buffer, data->set.postfields,
+ (size_t)postsize);
if(result)
return result;
}
/* issue the request */
- result = Curl_buffer_send(&req_buffer, conn,
- &data->info.request_size, 0, FIRSTSOCKET);
+ result = Curl_buffer_send(&req_buffer, conn,
+ &data->info.request_size, 0, FIRSTSOCKET);
if(result) {
failf(data, "Failed sending RTSP request");
return result;
@@ -765,7 +765,7 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn,
/* Store the received CSeq. Match is verified in rtsp_done */
int nc = sscanf(&header[4], ": %ld", &CSeq);
if(nc == 1) {
- struct RTSP *rtsp = data->req.p.rtsp;
+ struct RTSP *rtsp = data->req.p.rtsp;
rtsp->CSeq_recv = CSeq; /* mark the request */
data->state.rtsp_CSeq_recv = CSeq; /* update the handle */
}
@@ -776,8 +776,8 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn,
}
else if(checkprefix("Session:", header)) {
char *start;
- char *end;
- size_t idlen;
+ char *end;
+ size_t idlen;
/* Find the first non-space letter */
start = header + 8;
@@ -786,25 +786,25 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn,
if(!*start) {
failf(data, "Got a blank Session ID");
- return CURLE_RTSP_SESSION_ERROR;
+ return CURLE_RTSP_SESSION_ERROR;
}
-
- /* Find the end of Session ID
- *
- * Allow any non whitespace content, up to the field separator or end of
- * line. RFC 2326 isn't 100% clear on the session ID and for example
- * gstreamer does url-encoded session ID's not covered by the standard.
- */
- end = start;
- while(*end && *end != ';' && !ISSPACE(*end))
- end++;
- idlen = end - start;
-
- if(data->set.str[STRING_RTSP_SESSION_ID]) {
-
+
+ /* Find the end of Session ID
+ *
+ * Allow any non whitespace content, up to the field separator or end of
+ * line. RFC 2326 isn't 100% clear on the session ID and for example
+ * gstreamer does url-encoded session ID's not covered by the standard.
+ */
+ end = start;
+ while(*end && *end != ';' && !ISSPACE(*end))
+ end++;
+ idlen = end - start;
+
+ if(data->set.str[STRING_RTSP_SESSION_ID]) {
+
/* If the Session ID is set, then compare */
- if(strlen(data->set.str[STRING_RTSP_SESSION_ID]) != idlen ||
- strncmp(start, data->set.str[STRING_RTSP_SESSION_ID], idlen) != 0) {
+ if(strlen(data->set.str[STRING_RTSP_SESSION_ID]) != idlen ||
+ strncmp(start, data->set.str[STRING_RTSP_SESSION_ID], idlen) != 0) {
failf(data, "Got RTSP Session ID Line [%s], but wanted ID [%s]",
start, data->set.str[STRING_RTSP_SESSION_ID]);
return CURLE_RTSP_SESSION_ERROR;
@@ -816,11 +816,11 @@ CURLcode Curl_rtsp_parseheader(struct connectdata *conn,
*/
/* Copy the id substring into a new buffer */
- data->set.str[STRING_RTSP_SESSION_ID] = malloc(idlen + 1);
+ data->set.str[STRING_RTSP_SESSION_ID] = malloc(idlen + 1);
if(data->set.str[STRING_RTSP_SESSION_ID] == NULL)
return CURLE_OUT_OF_MEMORY;
- memcpy(data->set.str[STRING_RTSP_SESSION_ID], start, idlen);
- (data->set.str[STRING_RTSP_SESSION_ID])[idlen] = '\0';
+ memcpy(data->set.str[STRING_RTSP_SESSION_ID], start, idlen);
+ (data->set.str[STRING_RTSP_SESSION_ID])[idlen] = '\0';
}
}
return CURLE_OK;
diff --git a/contrib/libs/curl/lib/rtsp.h b/contrib/libs/curl/lib/rtsp.h
index 9847321f1d..bf7f0bc8ef 100644
--- a/contrib/libs/curl/lib/rtsp.h
+++ b/contrib/libs/curl/lib/rtsp.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/select.c b/contrib/libs/curl/lib/select.c
index 67276b1052..7d1f944cdb 100644
--- a/contrib/libs/curl/lib/select.c
+++ b/contrib/libs/curl/lib/select.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -22,12 +22,12 @@
#include "curl_setup.h"
-#include <limits.h>
-
+#include <limits.h>
+
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
-#elif defined(HAVE_UNISTD_H)
-#include <unistd.h>
+#elif defined(HAVE_UNISTD_H)
+#include <unistd.h>
#endif
#if !defined(HAVE_SELECT) && !defined(HAVE_POLL_FINE)
@@ -52,7 +52,7 @@
#include "urldata.h"
#include "connect.h"
#include "select.h"
-#include "timeval.h"
+#include "timeval.h"
#include "warnless.h"
/*
@@ -71,7 +71,7 @@
* -1 = system call error, invalid timeout value, or interrupted
* 0 = specified timeout has elapsed
*/
-int Curl_wait_ms(timediff_t timeout_ms)
+int Curl_wait_ms(timediff_t timeout_ms)
{
int r = 0;
@@ -83,46 +83,46 @@ int Curl_wait_ms(timediff_t timeout_ms)
}
#if defined(MSDOS)
delay(timeout_ms);
-#elif defined(WIN32)
- /* prevent overflow, timeout_ms is typecast to ULONG/DWORD. */
-#if TIMEDIFF_T_MAX >= ULONG_MAX
- if(timeout_ms >= ULONG_MAX)
- timeout_ms = ULONG_MAX-1;
- /* don't use ULONG_MAX, because that is equal to INFINITE */
-#endif
- Sleep((ULONG)timeout_ms);
+#elif defined(WIN32)
+ /* prevent overflow, timeout_ms is typecast to ULONG/DWORD. */
+#if TIMEDIFF_T_MAX >= ULONG_MAX
+ if(timeout_ms >= ULONG_MAX)
+ timeout_ms = ULONG_MAX-1;
+ /* don't use ULONG_MAX, because that is equal to INFINITE */
+#endif
+ Sleep((ULONG)timeout_ms);
#else
#if defined(HAVE_POLL_FINE)
- /* prevent overflow, timeout_ms is typecast to int. */
-#if TIMEDIFF_T_MAX > INT_MAX
- if(timeout_ms > INT_MAX)
- timeout_ms = INT_MAX;
-#endif
- r = poll(NULL, 0, (int)timeout_ms);
+ /* prevent overflow, timeout_ms is typecast to int. */
+#if TIMEDIFF_T_MAX > INT_MAX
+ if(timeout_ms > INT_MAX)
+ timeout_ms = INT_MAX;
+#endif
+ r = poll(NULL, 0, (int)timeout_ms);
#else
- {
- struct timeval pending_tv;
- timediff_t tv_sec = timeout_ms / 1000;
- timediff_t tv_usec = (timeout_ms % 1000) * 1000; /* max=999999 */
-#ifdef HAVE_SUSECONDS_T
-#if TIMEDIFF_T_MAX > TIME_T_MAX
- /* tv_sec overflow check in case time_t is signed */
- if(tv_sec > TIME_T_MAX)
- tv_sec = TIME_T_MAX;
-#endif
- pending_tv.tv_sec = (time_t)tv_sec;
- pending_tv.tv_usec = (suseconds_t)tv_usec;
-#else
-#if TIMEDIFF_T_MAX > INT_MAX
- /* tv_sec overflow check in case time_t is signed */
- if(tv_sec > INT_MAX)
- tv_sec = INT_MAX;
-#endif
- pending_tv.tv_sec = (int)tv_sec;
- pending_tv.tv_usec = (int)tv_usec;
-#endif
+ {
+ struct timeval pending_tv;
+ timediff_t tv_sec = timeout_ms / 1000;
+ timediff_t tv_usec = (timeout_ms % 1000) * 1000; /* max=999999 */
+#ifdef HAVE_SUSECONDS_T
+#if TIMEDIFF_T_MAX > TIME_T_MAX
+ /* tv_sec overflow check in case time_t is signed */
+ if(tv_sec > TIME_T_MAX)
+ tv_sec = TIME_T_MAX;
+#endif
+ pending_tv.tv_sec = (time_t)tv_sec;
+ pending_tv.tv_usec = (suseconds_t)tv_usec;
+#else
+#if TIMEDIFF_T_MAX > INT_MAX
+ /* tv_sec overflow check in case time_t is signed */
+ if(tv_sec > INT_MAX)
+ tv_sec = INT_MAX;
+#endif
+ pending_tv.tv_sec = (int)tv_sec;
+ pending_tv.tv_usec = (int)tv_usec;
+#endif
r = select(0, NULL, NULL, NULL, &pending_tv);
- }
+ }
#endif /* HAVE_POLL_FINE */
#endif /* USE_WINSOCK */
if(r)
@@ -131,96 +131,96 @@ int Curl_wait_ms(timediff_t timeout_ms)
}
/*
- * This is a wrapper around select() to aid in Windows compatibility.
- * A negative timeout value makes this function wait indefinitely,
- * unless no valid file descriptor is given, when this happens the
- * negative timeout is ignored and the function times out immediately.
- *
- * Return values:
- * -1 = system call error or fd >= FD_SETSIZE
- * 0 = timeout
- * N = number of signalled file descriptors
- */
-int Curl_select(curl_socket_t maxfd, /* highest socket number */
- fd_set *fds_read, /* sockets ready for reading */
- fd_set *fds_write, /* sockets ready for writing */
- fd_set *fds_err, /* sockets with errors */
- timediff_t timeout_ms) /* milliseconds to wait */
-{
- struct timeval pending_tv;
- struct timeval *ptimeout;
-
-#ifdef USE_WINSOCK
- /* WinSock select() can't handle zero events. See the comment below. */
- if((!fds_read || fds_read->fd_count == 0) &&
- (!fds_write || fds_write->fd_count == 0) &&
- (!fds_err || fds_err->fd_count == 0)) {
- /* no sockets, just wait */
- return Curl_wait_ms(timeout_ms);
- }
-#endif
-
- ptimeout = &pending_tv;
- if(timeout_ms < 0) {
- ptimeout = NULL;
- }
- else if(timeout_ms > 0) {
- timediff_t tv_sec = timeout_ms / 1000;
- timediff_t tv_usec = (timeout_ms % 1000) * 1000; /* max=999999 */
-#ifdef HAVE_SUSECONDS_T
-#if TIMEDIFF_T_MAX > TIME_T_MAX
- /* tv_sec overflow check in case time_t is signed */
- if(tv_sec > TIME_T_MAX)
- tv_sec = TIME_T_MAX;
-#endif
- pending_tv.tv_sec = (time_t)tv_sec;
- pending_tv.tv_usec = (suseconds_t)tv_usec;
-#elif defined(WIN32) /* maybe also others in the future */
-#if TIMEDIFF_T_MAX > LONG_MAX
- /* tv_sec overflow check on Windows there we know it is long */
- if(tv_sec > LONG_MAX)
- tv_sec = LONG_MAX;
-#endif
- pending_tv.tv_sec = (long)tv_sec;
- pending_tv.tv_usec = (long)tv_usec;
-#else
-#if TIMEDIFF_T_MAX > INT_MAX
- /* tv_sec overflow check in case time_t is signed */
- if(tv_sec > INT_MAX)
- tv_sec = INT_MAX;
-#endif
- pending_tv.tv_sec = (int)tv_sec;
- pending_tv.tv_usec = (int)tv_usec;
-#endif
- }
- else {
- pending_tv.tv_sec = 0;
- pending_tv.tv_usec = 0;
- }
-
-#ifdef USE_WINSOCK
- /* WinSock select() must not be called with an fd_set that contains zero
- fd flags, or it will return WSAEINVAL. But, it also can't be called
- with no fd_sets at all! From the documentation:
-
- Any two of the parameters, readfds, writefds, or exceptfds, can be
- given as null. At least one must be non-null, and any non-null
- descriptor set must contain at least one handle to a socket.
-
- It is unclear why WinSock doesn't just handle this for us instead of
- calling this an error. Luckily, with WinSock, we can _also_ ask how
- many bits are set on an fd_set. So, let's just check it beforehand.
- */
- return select((int)maxfd + 1,
- fds_read && fds_read->fd_count ? fds_read : NULL,
- fds_write && fds_write->fd_count ? fds_write : NULL,
- fds_err && fds_err->fd_count ? fds_err : NULL, ptimeout);
-#else
- return select((int)maxfd + 1, fds_read, fds_write, fds_err, ptimeout);
-#endif
-}
-
-/*
+ * This is a wrapper around select() to aid in Windows compatibility.
+ * A negative timeout value makes this function wait indefinitely,
+ * unless no valid file descriptor is given, when this happens the
+ * negative timeout is ignored and the function times out immediately.
+ *
+ * Return values:
+ * -1 = system call error or fd >= FD_SETSIZE
+ * 0 = timeout
+ * N = number of signalled file descriptors
+ */
+int Curl_select(curl_socket_t maxfd, /* highest socket number */
+ fd_set *fds_read, /* sockets ready for reading */
+ fd_set *fds_write, /* sockets ready for writing */
+ fd_set *fds_err, /* sockets with errors */
+ timediff_t timeout_ms) /* milliseconds to wait */
+{
+ struct timeval pending_tv;
+ struct timeval *ptimeout;
+
+#ifdef USE_WINSOCK
+ /* WinSock select() can't handle zero events. See the comment below. */
+ if((!fds_read || fds_read->fd_count == 0) &&
+ (!fds_write || fds_write->fd_count == 0) &&
+ (!fds_err || fds_err->fd_count == 0)) {
+ /* no sockets, just wait */
+ return Curl_wait_ms(timeout_ms);
+ }
+#endif
+
+ ptimeout = &pending_tv;
+ if(timeout_ms < 0) {
+ ptimeout = NULL;
+ }
+ else if(timeout_ms > 0) {
+ timediff_t tv_sec = timeout_ms / 1000;
+ timediff_t tv_usec = (timeout_ms % 1000) * 1000; /* max=999999 */
+#ifdef HAVE_SUSECONDS_T
+#if TIMEDIFF_T_MAX > TIME_T_MAX
+ /* tv_sec overflow check in case time_t is signed */
+ if(tv_sec > TIME_T_MAX)
+ tv_sec = TIME_T_MAX;
+#endif
+ pending_tv.tv_sec = (time_t)tv_sec;
+ pending_tv.tv_usec = (suseconds_t)tv_usec;
+#elif defined(WIN32) /* maybe also others in the future */
+#if TIMEDIFF_T_MAX > LONG_MAX
+ /* tv_sec overflow check on Windows there we know it is long */
+ if(tv_sec > LONG_MAX)
+ tv_sec = LONG_MAX;
+#endif
+ pending_tv.tv_sec = (long)tv_sec;
+ pending_tv.tv_usec = (long)tv_usec;
+#else
+#if TIMEDIFF_T_MAX > INT_MAX
+ /* tv_sec overflow check in case time_t is signed */
+ if(tv_sec > INT_MAX)
+ tv_sec = INT_MAX;
+#endif
+ pending_tv.tv_sec = (int)tv_sec;
+ pending_tv.tv_usec = (int)tv_usec;
+#endif
+ }
+ else {
+ pending_tv.tv_sec = 0;
+ pending_tv.tv_usec = 0;
+ }
+
+#ifdef USE_WINSOCK
+ /* WinSock select() must not be called with an fd_set that contains zero
+ fd flags, or it will return WSAEINVAL. But, it also can't be called
+ with no fd_sets at all! From the documentation:
+
+ Any two of the parameters, readfds, writefds, or exceptfds, can be
+ given as null. At least one must be non-null, and any non-null
+ descriptor set must contain at least one handle to a socket.
+
+ It is unclear why WinSock doesn't just handle this for us instead of
+ calling this an error. Luckily, with WinSock, we can _also_ ask how
+ many bits are set on an fd_set. So, let's just check it beforehand.
+ */
+ return select((int)maxfd + 1,
+ fds_read && fds_read->fd_count ? fds_read : NULL,
+ fds_write && fds_write->fd_count ? fds_write : NULL,
+ fds_err && fds_err->fd_count ? fds_err : NULL, ptimeout);
+#else
+ return select((int)maxfd + 1, fds_read, fds_write, fds_err, ptimeout);
+#endif
+}
+
+/*
* Wait for read or write events on a set of file descriptors. It uses poll()
* when a fine poll() is available, in order to avoid limits with FD_SETSIZE,
* otherwise select() is used. An error is returned if select() is being used
@@ -243,7 +243,7 @@ int Curl_select(curl_socket_t maxfd, /* highest socket number */
int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
curl_socket_t readfd1,
curl_socket_t writefd, /* socket to write to */
- timediff_t timeout_ms) /* milliseconds to wait */
+ timediff_t timeout_ms) /* milliseconds to wait */
{
struct pollfd pfd[3];
int num;
@@ -252,7 +252,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
if((readfd0 == CURL_SOCKET_BAD) && (readfd1 == CURL_SOCKET_BAD) &&
(writefd == CURL_SOCKET_BAD)) {
/* no sockets, just wait */
- return Curl_wait_ms(timeout_ms);
+ return Curl_wait_ms(timeout_ms);
}
/* Avoid initial timestamp, avoid Curl_now() call, when elapsed
@@ -275,39 +275,39 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
}
if(writefd != CURL_SOCKET_BAD) {
pfd[num].fd = writefd;
- pfd[num].events = POLLWRNORM|POLLOUT|POLLPRI;
+ pfd[num].events = POLLWRNORM|POLLOUT|POLLPRI;
pfd[num].revents = 0;
num++;
}
- r = Curl_poll(pfd, num, timeout_ms);
- if(r <= 0)
- return r;
+ r = Curl_poll(pfd, num, timeout_ms);
+ if(r <= 0)
+ return r;
- r = 0;
+ r = 0;
num = 0;
if(readfd0 != CURL_SOCKET_BAD) {
if(pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP))
- r |= CURL_CSELECT_IN;
+ r |= CURL_CSELECT_IN;
if(pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL))
- r |= CURL_CSELECT_ERR;
+ r |= CURL_CSELECT_ERR;
num++;
}
if(readfd1 != CURL_SOCKET_BAD) {
if(pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP))
- r |= CURL_CSELECT_IN2;
+ r |= CURL_CSELECT_IN2;
if(pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL))
- r |= CURL_CSELECT_ERR;
+ r |= CURL_CSELECT_ERR;
num++;
}
if(writefd != CURL_SOCKET_BAD) {
if(pfd[num].revents & (POLLWRNORM|POLLOUT))
- r |= CURL_CSELECT_OUT;
- if(pfd[num].revents & (POLLERR|POLLHUP|POLLPRI|POLLNVAL))
- r |= CURL_CSELECT_ERR;
+ r |= CURL_CSELECT_OUT;
+ if(pfd[num].revents & (POLLERR|POLLHUP|POLLPRI|POLLNVAL))
+ r |= CURL_CSELECT_ERR;
}
- return r;
+ return r;
}
/*
@@ -323,11 +323,11 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
* 0 = timeout
* N = number of structures with non zero revent fields
*/
-int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
+int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
{
-#ifdef HAVE_POLL_FINE
- int pending_ms;
-#else
+#ifdef HAVE_POLL_FINE
+ int pending_ms;
+#else
fd_set fds_read;
fd_set fds_write;
fd_set fds_err;
@@ -346,8 +346,8 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
}
}
if(fds_none) {
- /* no sockets, just wait */
- return Curl_wait_ms(timeout_ms);
+ /* no sockets, just wait */
+ return Curl_wait_ms(timeout_ms);
}
/* Avoid initial timestamp, avoid Curl_now() call, when elapsed
@@ -357,20 +357,20 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
#ifdef HAVE_POLL_FINE
- /* prevent overflow, timeout_ms is typecast to int. */
-#if TIMEDIFF_T_MAX > INT_MAX
- if(timeout_ms > INT_MAX)
- timeout_ms = INT_MAX;
-#endif
- if(timeout_ms > 0)
- pending_ms = (int)timeout_ms;
- else if(timeout_ms < 0)
- pending_ms = -1;
- else
- pending_ms = 0;
- r = poll(ufds, nfds, pending_ms);
- if(r <= 0)
- return r;
+ /* prevent overflow, timeout_ms is typecast to int. */
+#if TIMEDIFF_T_MAX > INT_MAX
+ if(timeout_ms > INT_MAX)
+ timeout_ms = INT_MAX;
+#endif
+ if(timeout_ms > 0)
+ pending_ms = (int)timeout_ms;
+ else if(timeout_ms < 0)
+ pending_ms = -1;
+ else
+ pending_ms = 0;
+ r = poll(ufds, nfds, pending_ms);
+ if(r <= 0)
+ return r;
for(i = 0; i < nfds; i++) {
if(ufds[i].fd == CURL_SOCKET_BAD)
@@ -378,7 +378,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
if(ufds[i].revents & POLLHUP)
ufds[i].revents |= POLLIN;
if(ufds[i].revents & POLLERR)
- ufds[i].revents |= POLLIN|POLLOUT;
+ ufds[i].revents |= POLLIN|POLLOUT;
}
#else /* HAVE_POLL_FINE */
@@ -394,7 +394,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
continue;
VERIFY_SOCK(ufds[i].fd);
if(ufds[i].events & (POLLIN|POLLOUT|POLLPRI|
- POLLRDNORM|POLLWRNORM|POLLRDBAND)) {
+ POLLRDNORM|POLLWRNORM|POLLRDBAND)) {
if(ufds[i].fd > maxfd)
maxfd = ufds[i].fd;
if(ufds[i].events & (POLLRDNORM|POLLIN))
@@ -406,14 +406,14 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
}
}
- /*
- Note also that WinSock ignores the first argument, so we don't worry
- about the fact that maxfd is computed incorrectly with WinSock (since
- curl_socket_t is unsigned in such cases and thus -1 is the largest
- value).
- */
- r = Curl_select(maxfd, &fds_read, &fds_write, &fds_err, timeout_ms);
- if(r <= 0)
+ /*
+ Note also that WinSock ignores the first argument, so we don't worry
+ about the fact that maxfd is computed incorrectly with WinSock (since
+ curl_socket_t is unsigned in such cases and thus -1 is the largest
+ value).
+ */
+ r = Curl_select(maxfd, &fds_read, &fds_write, &fds_err, timeout_ms);
+ if(r <= 0)
return r;
r = 0;
@@ -421,24 +421,24 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
ufds[i].revents = 0;
if(ufds[i].fd == CURL_SOCKET_BAD)
continue;
- if(FD_ISSET(ufds[i].fd, &fds_read)) {
- if(ufds[i].events & POLLRDNORM)
- ufds[i].revents |= POLLRDNORM;
- if(ufds[i].events & POLLIN)
- ufds[i].revents |= POLLIN;
- }
- if(FD_ISSET(ufds[i].fd, &fds_write)) {
- if(ufds[i].events & POLLWRNORM)
- ufds[i].revents |= POLLWRNORM;
- if(ufds[i].events & POLLOUT)
- ufds[i].revents |= POLLOUT;
- }
- if(FD_ISSET(ufds[i].fd, &fds_err)) {
- if(ufds[i].events & POLLRDBAND)
- ufds[i].revents |= POLLRDBAND;
- if(ufds[i].events & POLLPRI)
- ufds[i].revents |= POLLPRI;
- }
+ if(FD_ISSET(ufds[i].fd, &fds_read)) {
+ if(ufds[i].events & POLLRDNORM)
+ ufds[i].revents |= POLLRDNORM;
+ if(ufds[i].events & POLLIN)
+ ufds[i].revents |= POLLIN;
+ }
+ if(FD_ISSET(ufds[i].fd, &fds_write)) {
+ if(ufds[i].events & POLLWRNORM)
+ ufds[i].revents |= POLLWRNORM;
+ if(ufds[i].events & POLLOUT)
+ ufds[i].revents |= POLLOUT;
+ }
+ if(FD_ISSET(ufds[i].fd, &fds_err)) {
+ if(ufds[i].events & POLLRDBAND)
+ ufds[i].revents |= POLLRDBAND;
+ if(ufds[i].events & POLLPRI)
+ ufds[i].revents |= POLLPRI;
+ }
if(ufds[i].revents != 0)
r++;
}
diff --git a/contrib/libs/curl/lib/select.h b/contrib/libs/curl/lib/select.h
index 961d122e54..1350950439 100644
--- a/contrib/libs/curl/lib/select.h
+++ b/contrib/libs/curl/lib/select.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -72,45 +72,45 @@ struct pollfd
therefore defined here */
#define CURL_CSELECT_IN2 (CURL_CSELECT_ERR << 1)
-int Curl_select(curl_socket_t maxfd,
- fd_set *fds_read,
- fd_set *fds_write,
- fd_set *fds_err,
- timediff_t timeout_ms);
-
+int Curl_select(curl_socket_t maxfd,
+ fd_set *fds_read,
+ fd_set *fds_write,
+ fd_set *fds_err,
+ timediff_t timeout_ms);
+
int Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2,
curl_socket_t writefd,
- timediff_t timeout_ms);
+ timediff_t timeout_ms);
#define SOCKET_READABLE(x,z) \
- Curl_socket_check(x, CURL_SOCKET_BAD, CURL_SOCKET_BAD, z)
+ Curl_socket_check(x, CURL_SOCKET_BAD, CURL_SOCKET_BAD, z)
#define SOCKET_WRITABLE(x,z) \
- Curl_socket_check(CURL_SOCKET_BAD, CURL_SOCKET_BAD, x, z)
+ Curl_socket_check(CURL_SOCKET_BAD, CURL_SOCKET_BAD, x, z)
-int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms);
-int Curl_wait_ms(timediff_t timeout_ms);
+int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms);
+int Curl_wait_ms(timediff_t timeout_ms);
#ifdef TPF
int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
- fd_set* excepts, struct timeval *tv);
+ fd_set* excepts, struct timeval *tv);
#endif
-/* TPF sockets are not in range [0..FD_SETSIZE-1], which
+/* TPF sockets are not in range [0..FD_SETSIZE-1], which
unfortunately makes it impossible for us to easily check if they're valid
-
- With Winsock the valid range is [0..INVALID_SOCKET-1] according to
- https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2
+
+ With Winsock the valid range is [0..INVALID_SOCKET-1] according to
+ https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2
*/
-#if defined(TPF)
+#if defined(TPF)
#define VALID_SOCK(x) 1
#define VERIFY_SOCK(x) Curl_nop_stmt
-#elif defined(USE_WINSOCK)
-#define VALID_SOCK(s) ((s) < INVALID_SOCKET)
-#define VERIFY_SOCK(x) do { \
- if(!VALID_SOCK(x)) { \
- SET_SOCKERRNO(WSAEINVAL); \
- return -1; \
- } \
-} while(0)
+#elif defined(USE_WINSOCK)
+#define VALID_SOCK(s) ((s) < INVALID_SOCKET)
+#define VERIFY_SOCK(x) do { \
+ if(!VALID_SOCK(x)) { \
+ SET_SOCKERRNO(WSAEINVAL); \
+ return -1; \
+ } \
+} while(0)
#else
#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
#define VERIFY_SOCK(x) do { \
@@ -118,7 +118,7 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
SET_SOCKERRNO(EINVAL); \
return -1; \
} \
-} while(0)
+} while(0)
#endif
#endif /* HEADER_CURL_SELECT_H */
diff --git a/contrib/libs/curl/lib/sendf.c b/contrib/libs/curl/lib/sendf.c
index 10980ef755..04cc725f5a 100644
--- a/contrib/libs/curl/lib/sendf.c
+++ b/contrib/libs/curl/lib/sendf.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -28,8 +28,8 @@
#ifdef HAVE_LINUX_TCP_H
#include <linux/tcp.h>
-#elif defined(HAVE_NETINET_TCP_H)
-#include <netinet/tcp.h>
+#elif defined(HAVE_NETINET_TCP_H)
+#include <netinet/tcp.h>
#endif
#include <curl/curl.h>
@@ -38,14 +38,14 @@
#include "sendf.h"
#include "connect.h"
#include "vtls/vtls.h"
-#include "vssh/ssh.h"
+#include "vssh/ssh.h"
#include "easyif.h"
#include "multiif.h"
#include "non-ascii.h"
#include "strerror.h"
#include "select.h"
#include "strdup.h"
-#include "http2.h"
+#include "http2.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -142,7 +142,7 @@ bool Curl_recv_has_postponed_data(struct connectdata *conn, int sockindex)
psnd->recv_size > psnd->recv_processed;
}
-static CURLcode pre_receive_plain(struct connectdata *conn, int num)
+static CURLcode pre_receive_plain(struct connectdata *conn, int num)
{
const curl_socket_t sockfd = conn->sock[num];
struct postponed_data * const psnd = &(conn->postponed[num]);
@@ -163,8 +163,8 @@ static CURLcode pre_receive_plain(struct connectdata *conn, int num)
/* Use buffer double default size for intermediate buffer */
psnd->allocated_size = 2 * conn->data->set.buffer_size;
psnd->buffer = malloc(psnd->allocated_size);
- if(!psnd->buffer)
- return CURLE_OUT_OF_MEMORY;
+ if(!psnd->buffer)
+ return CURLE_OUT_OF_MEMORY;
psnd->recv_size = 0;
psnd->recv_processed = 0;
#ifdef DEBUGBUILD
@@ -184,7 +184,7 @@ static CURLcode pre_receive_plain(struct connectdata *conn, int num)
psnd->allocated_size = 0;
}
}
- return CURLE_OK;
+ return CURLE_OK;
}
static ssize_t get_pre_recved(struct connectdata *conn, int num, char *buf,
@@ -230,7 +230,7 @@ bool Curl_recv_has_postponed_data(struct connectdata *conn, int sockindex)
(void)sockindex;
return false;
}
-#define pre_receive_plain(c,n) CURLE_OK
+#define pre_receive_plain(c,n) CURLE_OK
#define get_pre_recved(c,n,b,l) 0
#endif /* ! USE_RECV_BEFORE_SEND_WORKAROUND */
@@ -272,15 +272,15 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
size_t len;
char error[CURL_ERROR_SIZE + 2];
va_start(ap, fmt);
- (void)mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
+ (void)mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
len = strlen(error);
if(data->set.errorbuffer && !data->state.errorbuf) {
strcpy(data->set.errorbuffer, error);
data->state.errorbuf = TRUE; /* wrote error string */
}
- error[len++] = '\n';
- Curl_debug(data, CURLINFO_TEXT, error, len);
+ error[len++] = '\n';
+ Curl_debug(data, CURLINFO_TEXT, error, len);
va_end(ap);
}
}
@@ -335,10 +335,10 @@ ssize_t Curl_send_plain(struct connectdata *conn, int num,
To avoid lossage of received data, recv() must be
performed before every send() if any incoming data is
available. */
- if(pre_receive_plain(conn, num)) {
- *code = CURLE_OUT_OF_MEMORY;
- return -1;
- }
+ if(pre_receive_plain(conn, num)) {
+ *code = CURLE_OUT_OF_MEMORY;
+ return -1;
+ }
#if defined(MSG_FASTOPEN) && !defined(TCP_FASTOPEN_CONNECT) /* Linux */
if(conn->bits.tcp_fastopen) {
@@ -460,9 +460,9 @@ static CURLcode pausewrite(struct Curl_easy *data,
unsigned int i;
bool newtype = TRUE;
- /* If this transfers over HTTP/2, pause the stream! */
- Curl_http2_stream_pause(data, TRUE);
-
+ /* If this transfers over HTTP/2, pause the stream! */
+ Curl_http2_stream_pause(data, TRUE);
+
if(s->tempcount) {
for(i = 0; i< s->tempcount; i++) {
if(s->tempwrite[i].type == type) {
@@ -476,18 +476,18 @@ static CURLcode pausewrite(struct Curl_easy *data,
else
i = 0;
- if(newtype) {
+ if(newtype) {
/* store this information in the state struct for later use */
- Curl_dyn_init(&s->tempwrite[i].b, DYN_PAUSE_BUFFER);
+ Curl_dyn_init(&s->tempwrite[i].b, DYN_PAUSE_BUFFER);
s->tempwrite[i].type = type;
if(newtype)
s->tempcount++;
}
- if(Curl_dyn_addn(&s->tempwrite[i].b, (unsigned char *)ptr, len))
- return CURLE_OUT_OF_MEMORY;
-
+ if(Curl_dyn_addn(&s->tempwrite[i].b, (unsigned char *)ptr, len))
+ return CURLE_OUT_OF_MEMORY;
+
/* mark the connection as RECV paused */
k->keepon |= KEEP_RECV_PAUSE;
@@ -552,7 +552,7 @@ static CURLcode chop_write(struct connectdata *conn,
return pausewrite(data, type, ptr, len);
}
if(wrote != chunklen) {
- failf(data, "Failure writing output to destination");
+ failf(data, "Failure writing output to destination");
return CURLE_WRITE_ERROR;
}
}
@@ -633,15 +633,15 @@ CURLcode Curl_read_plain(curl_socket_t sockfd,
ssize_t nread = sread(sockfd, buf, bytesfromsocket);
if(-1 == nread) {
- const int err = SOCKERRNO;
- const bool return_error =
+ const int err = SOCKERRNO;
+ const bool return_error =
#ifdef USE_WINSOCK
- WSAEWOULDBLOCK == err
+ WSAEWOULDBLOCK == err
#else
- EWOULDBLOCK == err || EAGAIN == err || EINTR == err
+ EWOULDBLOCK == err || EAGAIN == err || EINTR == err
#endif
- ;
- *n = 0; /* no data returned */
+ ;
+ *n = 0; /* no data returned */
if(return_error)
return CURLE_AGAIN;
return CURLE_RECV_ERROR;
@@ -693,73 +693,73 @@ int Curl_debug(struct Curl_easy *data, curl_infotype type,
char *ptr, size_t size)
{
int rc = 0;
- if(data->set.verbose) {
- static const char s_infotype[CURLINFO_END][3] = {
- "* ", "< ", "> ", "{ ", "} ", "{ ", "} " };
+ if(data->set.verbose) {
+ static const char s_infotype[CURLINFO_END][3] = {
+ "* ", "< ", "> ", "{ ", "} ", "{ ", "} " };
#ifdef CURL_DOES_CONVERSIONS
- char *buf = NULL;
- size_t conv_size = 0;
-
- switch(type) {
- case CURLINFO_HEADER_OUT:
- buf = Curl_memdup(ptr, size);
- if(!buf)
- return 1;
- conv_size = size;
-
- /* Special processing is needed for this block if it
- * contains both headers and data (separated by CRLFCRLF).
- * We want to convert just the headers, leaving the data as-is.
- */
- if(size > 4) {
- size_t i;
- for(i = 0; i < size-4; i++) {
- if(memcmp(&buf[i], "\x0d\x0a\x0d\x0a", 4) == 0) {
- /* convert everything through this CRLFCRLF but no further */
- conv_size = i + 4;
- break;
- }
+ char *buf = NULL;
+ size_t conv_size = 0;
+
+ switch(type) {
+ case CURLINFO_HEADER_OUT:
+ buf = Curl_memdup(ptr, size);
+ if(!buf)
+ return 1;
+ conv_size = size;
+
+ /* Special processing is needed for this block if it
+ * contains both headers and data (separated by CRLFCRLF).
+ * We want to convert just the headers, leaving the data as-is.
+ */
+ if(size > 4) {
+ size_t i;
+ for(i = 0; i < size-4; i++) {
+ if(memcmp(&buf[i], "\x0d\x0a\x0d\x0a", 4) == 0) {
+ /* convert everything through this CRLFCRLF but no further */
+ conv_size = i + 4;
+ break;
+ }
}
}
-
- Curl_convert_from_network(data, buf, conv_size);
- /* Curl_convert_from_network calls failf if unsuccessful */
- /* we might as well continue even if it fails... */
- ptr = buf; /* switch pointer to use my buffer instead */
- break;
- default:
- /* leave everything else as-is */
- break;
+
+ Curl_convert_from_network(data, buf, conv_size);
+ /* Curl_convert_from_network calls failf if unsuccessful */
+ /* we might as well continue even if it fails... */
+ ptr = buf; /* switch pointer to use my buffer instead */
+ break;
+ default:
+ /* leave everything else as-is */
+ break;
}
#endif /* CURL_DOES_CONVERSIONS */
- 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:
- case CURLINFO_HEADER_OUT:
- case CURLINFO_HEADER_IN:
- fwrite(s_infotype[type], 2, 1, data->set.err);
- fwrite(ptr, size, 1, data->set.err);
+ 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:
+ case CURLINFO_HEADER_OUT:
+ case CURLINFO_HEADER_IN:
+ fwrite(s_infotype[type], 2, 1, data->set.err);
+ fwrite(ptr, size, 1, data->set.err);
#ifdef CURL_DOES_CONVERSIONS
- if(size != conv_size) {
- /* we had untranslated data so we need an explicit newline */
- fwrite("\n", 1, 1, data->set.err);
- }
-#endif
- break;
- default: /* nada */
- break;
+ if(size != conv_size) {
+ /* we had untranslated data so we need an explicit newline */
+ fwrite("\n", 1, 1, data->set.err);
+ }
+#endif
+ break;
+ default: /* nada */
+ break;
}
}
#ifdef CURL_DOES_CONVERSIONS
- free(buf);
+ free(buf);
#endif
- }
+ }
return rc;
}
diff --git a/contrib/libs/curl/lib/sendf.h b/contrib/libs/curl/lib/sendf.h
index 8e72d9fb1b..c7e67c7451 100644
--- a/contrib/libs/curl/lib/sendf.h
+++ b/contrib/libs/curl/lib/sendf.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/setopt.c b/contrib/libs/curl/lib/setopt.c
index 6ad394a716..58956c1e95 100644
--- a/contrib/libs/curl/lib/setopt.c
+++ b/contrib/libs/curl/lib/setopt.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -30,8 +30,8 @@
#ifdef HAVE_LINUX_TCP_H
#include <linux/tcp.h>
-#elif defined(HAVE_NETINET_TCP_H)
-#include <netinet/tcp.h>
+#elif defined(HAVE_NETINET_TCP_H)
+#include <netinet/tcp.h>
#endif
#include "urldata.h"
@@ -47,7 +47,7 @@
#include "setopt.h"
#include "multiif.h"
#include "altsvc.h"
-#include "hsts.h"
+#include "hsts.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -80,37 +80,37 @@ CURLcode Curl_setstropt(char **charp, const char *s)
return CURLE_OK;
}
-CURLcode Curl_setblobopt(struct curl_blob **blobp,
- const struct curl_blob *blob)
-{
- /* free the previous storage at `blobp' and replace by a dynamic storage
- copy of blob. If CURL_BLOB_COPY is set, the data is copied. */
-
- Curl_safefree(*blobp);
-
- if(blob) {
- struct curl_blob *nblob;
- if(blob->len > CURL_MAX_INPUT_LENGTH)
- return CURLE_BAD_FUNCTION_ARGUMENT;
- nblob = (struct curl_blob *)
- malloc(sizeof(struct curl_blob) +
- ((blob->flags & CURL_BLOB_COPY) ? blob->len : 0));
- if(!nblob)
- return CURLE_OUT_OF_MEMORY;
- *nblob = *blob;
- if(blob->flags & CURL_BLOB_COPY) {
- /* put the data after the blob struct in memory */
- nblob->data = (char *)nblob + sizeof(struct curl_blob);
- memcpy(nblob->data, blob->data, blob->len);
- }
-
- *blobp = nblob;
- return CURLE_OK;
- }
-
- return CURLE_OK;
-}
-
+CURLcode Curl_setblobopt(struct curl_blob **blobp,
+ const struct curl_blob *blob)
+{
+ /* free the previous storage at `blobp' and replace by a dynamic storage
+ copy of blob. If CURL_BLOB_COPY is set, the data is copied. */
+
+ Curl_safefree(*blobp);
+
+ if(blob) {
+ struct curl_blob *nblob;
+ if(blob->len > CURL_MAX_INPUT_LENGTH)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ nblob = (struct curl_blob *)
+ malloc(sizeof(struct curl_blob) +
+ ((blob->flags & CURL_BLOB_COPY) ? blob->len : 0));
+ if(!nblob)
+ return CURLE_OUT_OF_MEMORY;
+ *nblob = *blob;
+ if(blob->flags & CURL_BLOB_COPY) {
+ /* put the data after the blob struct in memory */
+ nblob->data = (char *)nblob + sizeof(struct curl_blob);
+ memcpy(nblob->data, blob->data, blob->len);
+ }
+
+ *blobp = nblob;
+ return CURLE_OK;
+ }
+
+ return CURLE_OK;
+}
+
static CURLcode setstropt_userpwd(char *option, char **userp, char **passwdp)
{
CURLcode result = CURLE_OK;
@@ -274,11 +274,11 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* Do not include the body part in the output data stream.
*/
data->set.opt_no_body = (0 != va_arg(param, long)) ? TRUE : FALSE;
- if(data->set.opt_no_body)
- /* in HTTP lingo, no body means using the HEAD request... */
- data->set.method = HTTPREQ_HEAD;
- else if(data->set.method == HTTPREQ_HEAD)
- data->set.method = HTTPREQ_GET;
+ if(data->set.opt_no_body)
+ /* in HTTP lingo, no body means using the HEAD request... */
+ data->set.method = HTTPREQ_HEAD;
+ else if(data->set.method == HTTPREQ_HEAD)
+ data->set.method = HTTPREQ_GET;
break;
case CURLOPT_FAILONERROR:
/*
@@ -300,13 +300,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.upload = (0 != va_arg(param, long)) ? TRUE : FALSE;
if(data->set.upload) {
/* If this is HTTP, PUT is what's needed to "upload" */
- data->set.method = HTTPREQ_PUT;
+ data->set.method = HTTPREQ_PUT;
data->set.opt_no_body = FALSE; /* this is implied */
}
else
/* In HTTP, the opposite of upload is GET (unless NOBODY is true as
then this can be changed to HEAD later on) */
- data->set.method = HTTPREQ_GET;
+ data->set.method = HTTPREQ_GET;
break;
case CURLOPT_REQUEST_TARGET:
result = Curl_setstropt(&data->set.str[STRING_TARGET],
@@ -354,7 +354,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* Parse the $HOME/.netrc file
*/
arg = va_arg(param, long);
- if((arg < CURL_NETRC_IGNORED) || (arg >= CURL_NETRC_LAST))
+ if((arg < CURL_NETRC_IGNORED) || (arg >= CURL_NETRC_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.use_netrc = (enum CURL_NETRC_OPTION)arg;
break;
@@ -381,7 +381,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* curl/curl.h header file.
*/
arg = va_arg(param, long);
- if((arg < CURL_TIMECOND_NONE) || (arg >= CURL_TIMECOND_LAST))
+ if((arg < CURL_TIMECOND_NONE) || (arg >= CURL_TIMECOND_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.timecondition = (curl_TimeCond)arg;
break;
@@ -402,9 +402,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
break;
case CURLOPT_SSLVERSION:
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_SSLVERSION:
-#endif
+#endif
/*
* Set explicit SSL version to try to connect with, as some SSL
* implementations are lame.
@@ -412,11 +412,11 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
#ifdef USE_SSL
{
long version, version_max;
- struct ssl_primary_config *primary = &data->set.ssl.primary;
-#ifndef CURL_DISABLE_PROXY
- if(option != CURLOPT_SSLVERSION)
- primary = &data->set.proxy_ssl.primary;
-#endif
+ struct ssl_primary_config *primary = &data->set.ssl.primary;
+#ifndef CURL_DISABLE_PROXY
+ if(option != CURLOPT_SSLVERSION)
+ primary = &data->set.proxy_ssl.primary;
+#endif
arg = va_arg(param, long);
@@ -433,12 +433,12 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
primary->version_max = version_max;
}
#else
- result = CURLE_NOT_BUILT_IN;
+ result = CURLE_NOT_BUILT_IN;
#endif
break;
- /* MQTT "borrows" some of the HTTP options */
-#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_MQTT)
+ /* MQTT "borrows" some of the HTTP options */
+#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_MQTT)
case CURLOPT_COPYPOSTFIELDS:
/*
* A string with POST data. Makes curl HTTP POST. Even if it is NULL.
@@ -483,7 +483,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
}
data->set.postfields = data->set.str[STRING_COPYPOSTFIELDS];
- data->set.method = HTTPREQ_POST;
+ data->set.method = HTTPREQ_POST;
break;
case CURLOPT_POSTFIELDS:
@@ -493,7 +493,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.postfields = va_arg(param, void *);
/* Release old copied data. */
(void) Curl_setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);
- data->set.method = HTTPREQ_POST;
+ data->set.method = HTTPREQ_POST;
break;
case CURLOPT_POSTFIELDSIZE:
@@ -533,107 +533,107 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.postfieldsize = bigsize;
break;
-#endif
-#ifndef CURL_DISABLE_HTTP
- case CURLOPT_AUTOREFERER:
- /*
- * Switch on automatic referer that gets set if curl follows locations.
- */
- data->set.http_auto_referer = (0 != va_arg(param, long)) ? TRUE : FALSE;
- break;
-
- case CURLOPT_ACCEPT_ENCODING:
- /*
- * String to use at the value of Accept-Encoding header.
- *
- * If the encoding is set to "" we use an Accept-Encoding header that
- * encompasses all the encodings we support.
- * If the encoding is set to NULL we don't send an Accept-Encoding header
- * and ignore an received Content-Encoding header.
- *
- */
- argptr = va_arg(param, char *);
- if(argptr && !*argptr) {
- argptr = Curl_all_content_encodings();
- if(!argptr)
- result = CURLE_OUT_OF_MEMORY;
- else {
- result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
- free(argptr);
- }
- }
- else
- result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
- break;
-
- case CURLOPT_TRANSFER_ENCODING:
- data->set.http_transfer_encoding = (0 != va_arg(param, long)) ?
- TRUE : FALSE;
- break;
-
- case CURLOPT_FOLLOWLOCATION:
- /*
- * Follow Location: header hints on a HTTP-server.
- */
- data->set.http_follow_location = (0 != va_arg(param, long)) ? TRUE : FALSE;
- break;
-
- case CURLOPT_UNRESTRICTED_AUTH:
- /*
- * Send authentication (user+password) when following locations, even when
- * hostname changed.
- */
- data->set.allow_auth_to_other_hosts =
- (0 != va_arg(param, long)) ? TRUE : FALSE;
- break;
-
- case CURLOPT_MAXREDIRS:
- /*
- * The maximum amount of hops you allow curl to follow Location:
- * headers. This should mostly be used to detect never-ending loops.
- */
- arg = va_arg(param, long);
- if(arg < -1)
- return CURLE_BAD_FUNCTION_ARGUMENT;
- data->set.maxredirs = arg;
- break;
-
- case CURLOPT_POSTREDIR:
- /*
- * Set the behaviour of POST when redirecting
- * CURL_REDIR_GET_ALL - POST is changed to GET after 301 and 302
- * CURL_REDIR_POST_301 - POST is kept as POST after 301
- * CURL_REDIR_POST_302 - POST is kept as POST after 302
- * CURL_REDIR_POST_303 - POST is kept as POST after 303
- * CURL_REDIR_POST_ALL - POST is kept as POST after 301, 302 and 303
- * other - POST is kept as POST after 301 and 302
- */
- arg = va_arg(param, long);
- if(arg < CURL_REDIR_GET_ALL)
- /* no return error on too high numbers since the bitmask could be
- extended in a future */
- return CURLE_BAD_FUNCTION_ARGUMENT;
- data->set.keep_post = arg & CURL_REDIR_POST_ALL;
- break;
-
- case CURLOPT_POST:
- /* Does this option serve a purpose anymore? Yes it does, when
- CURLOPT_POSTFIELDS isn't used and the POST data is read off the
- callback! */
- if(va_arg(param, long)) {
- data->set.method = HTTPREQ_POST;
- data->set.opt_no_body = FALSE; /* this is implied */
- }
- else
- data->set.method = HTTPREQ_GET;
- break;
-
+#endif
+#ifndef CURL_DISABLE_HTTP
+ case CURLOPT_AUTOREFERER:
+ /*
+ * Switch on automatic referer that gets set if curl follows locations.
+ */
+ data->set.http_auto_referer = (0 != va_arg(param, long)) ? TRUE : FALSE;
+ break;
+
+ case CURLOPT_ACCEPT_ENCODING:
+ /*
+ * String to use at the value of Accept-Encoding header.
+ *
+ * If the encoding is set to "" we use an Accept-Encoding header that
+ * encompasses all the encodings we support.
+ * If the encoding is set to NULL we don't send an Accept-Encoding header
+ * and ignore an received Content-Encoding header.
+ *
+ */
+ argptr = va_arg(param, char *);
+ if(argptr && !*argptr) {
+ argptr = Curl_all_content_encodings();
+ if(!argptr)
+ result = CURLE_OUT_OF_MEMORY;
+ else {
+ result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
+ free(argptr);
+ }
+ }
+ else
+ result = Curl_setstropt(&data->set.str[STRING_ENCODING], argptr);
+ break;
+
+ case CURLOPT_TRANSFER_ENCODING:
+ data->set.http_transfer_encoding = (0 != va_arg(param, long)) ?
+ TRUE : FALSE;
+ break;
+
+ case CURLOPT_FOLLOWLOCATION:
+ /*
+ * Follow Location: header hints on a HTTP-server.
+ */
+ data->set.http_follow_location = (0 != va_arg(param, long)) ? TRUE : FALSE;
+ break;
+
+ case CURLOPT_UNRESTRICTED_AUTH:
+ /*
+ * Send authentication (user+password) when following locations, even when
+ * hostname changed.
+ */
+ data->set.allow_auth_to_other_hosts =
+ (0 != va_arg(param, long)) ? TRUE : FALSE;
+ break;
+
+ case CURLOPT_MAXREDIRS:
+ /*
+ * The maximum amount of hops you allow curl to follow Location:
+ * headers. This should mostly be used to detect never-ending loops.
+ */
+ arg = va_arg(param, long);
+ if(arg < -1)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ data->set.maxredirs = arg;
+ break;
+
+ case CURLOPT_POSTREDIR:
+ /*
+ * Set the behaviour of POST when redirecting
+ * CURL_REDIR_GET_ALL - POST is changed to GET after 301 and 302
+ * CURL_REDIR_POST_301 - POST is kept as POST after 301
+ * CURL_REDIR_POST_302 - POST is kept as POST after 302
+ * CURL_REDIR_POST_303 - POST is kept as POST after 303
+ * CURL_REDIR_POST_ALL - POST is kept as POST after 301, 302 and 303
+ * other - POST is kept as POST after 301 and 302
+ */
+ arg = va_arg(param, long);
+ if(arg < CURL_REDIR_GET_ALL)
+ /* no return error on too high numbers since the bitmask could be
+ extended in a future */
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ data->set.keep_post = arg & CURL_REDIR_POST_ALL;
+ break;
+
+ case CURLOPT_POST:
+ /* Does this option serve a purpose anymore? Yes it does, when
+ CURLOPT_POSTFIELDS isn't used and the POST data is read off the
+ callback! */
+ if(va_arg(param, long)) {
+ data->set.method = HTTPREQ_POST;
+ data->set.opt_no_body = FALSE; /* this is implied */
+ }
+ else
+ data->set.method = HTTPREQ_GET;
+ break;
+
case CURLOPT_HTTPPOST:
/*
* Set to make us do HTTP POST
*/
data->set.httppost = va_arg(param, struct curl_httppost *);
- data->set.method = HTTPREQ_POST_FORM;
+ data->set.method = HTTPREQ_POST_FORM;
data->set.opt_no_body = FALSE; /* this is implied */
break;
#endif /* CURL_DISABLE_HTTP */
@@ -645,7 +645,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
result = Curl_mime_set_subparts(&data->set.mimepost,
va_arg(param, curl_mime *), FALSE);
if(!result) {
- data->set.method = HTTPREQ_POST_MIME;
+ data->set.method = HTTPREQ_POST_MIME;
data->set.opt_no_body = FALSE; /* this is implied */
}
break;
@@ -725,9 +725,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
argptr = (char *)va_arg(param, void *);
if(argptr) {
struct curl_slist *cl;
- /* general protection against mistakes and abuse */
- if(strlen(argptr) > CURL_MAX_INPUT_LENGTH)
- return CURLE_BAD_FUNCTION_ARGUMENT;
+ /* general protection against mistakes and abuse */
+ if(strlen(argptr) > CURL_MAX_INPUT_LENGTH)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
/* append the cookie file name to the list of file names, and deal with
them later */
cl = curl_slist_append(data->change.cookielist, argptr);
@@ -800,7 +800,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
}
else if(strcasecompare(argptr, "FLUSH")) {
/* flush cookies to file, takes care of the locking */
- Curl_flush_cookies(data, FALSE);
+ Curl_flush_cookies(data, FALSE);
}
else if(strcasecompare(argptr, "RELOAD")) {
/* reload cookies from file */
@@ -812,9 +812,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
/* if cookie engine was not running, activate it */
data->cookies = Curl_cookie_init(data, NULL, NULL, TRUE);
- /* general protection against mistakes and abuse */
- if(strlen(argptr) > CURL_MAX_INPUT_LENGTH)
- return CURLE_BAD_FUNCTION_ARGUMENT;
+ /* general protection against mistakes and abuse */
+ if(strlen(argptr) > CURL_MAX_INPUT_LENGTH)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
argptr = strdup(argptr);
if(!argptr || !data->cookies) {
result = CURLE_OUT_OF_MEMORY;
@@ -846,7 +846,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* Set to force us do HTTP GET
*/
if(va_arg(param, long)) {
- data->set.method = HTTPREQ_GET;
+ data->set.method = HTTPREQ_GET;
data->set.upload = FALSE; /* switch off upload */
data->set.opt_no_body = FALSE; /* this is implied */
}
@@ -869,7 +869,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
if(arg >= CURL_HTTP_VERSION_2)
return CURLE_UNSUPPORTED_PROTOCOL;
#else
- if(arg >= CURL_HTTP_VERSION_LAST)
+ if(arg >= CURL_HTTP_VERSION_LAST)
return CURLE_UNSUPPORTED_PROTOCOL;
if(arg == CURL_HTTP_VERSION_NONE)
arg = CURL_HTTP_VERSION_2TLS;
@@ -956,7 +956,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
va_arg(param, char *));
/* we don't set
- data->set.method = HTTPREQ_CUSTOM;
+ data->set.method = HTTPREQ_CUSTOM;
here, we continue as if we were using the already set type
and this just changes the actual request keyword */
break;
@@ -1080,7 +1080,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
break;
default:
/* reserve other values for future use */
- result = CURLE_BAD_FUNCTION_ARGUMENT;
+ result = CURLE_BAD_FUNCTION_ARGUMENT;
break;
}
break;
@@ -1160,7 +1160,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* How do access files over FTP.
*/
arg = va_arg(param, long);
- if((arg < CURLFTPMETHOD_DEFAULT) || (arg >= CURLFTPMETHOD_LAST))
+ if((arg < CURLFTPMETHOD_DEFAULT) || (arg >= CURLFTPMETHOD_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.ftp_filemethod = (curl_ftpfile)arg;
break;
@@ -1187,7 +1187,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_FTP_SSL_CCC:
arg = va_arg(param, long);
- if((arg < CURLFTPSSL_CCC_NONE) || (arg >= CURLFTPSSL_CCC_LAST))
+ if((arg < CURLFTPSSL_CCC_NONE) || (arg >= CURLFTPSSL_CCC_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.ftp_ccc = (curl_ftpccc)arg;
break;
@@ -1215,7 +1215,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* Set a specific auth for FTP-SSL transfers.
*/
arg = va_arg(param, long);
- if((arg < CURLFTPAUTH_DEFAULT) || (arg >= CURLFTPAUTH_LAST))
+ if((arg < CURLFTPAUTH_DEFAULT) || (arg >= CURLFTPAUTH_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.ftpsslauth = (curl_ftpauth)arg;
break;
@@ -1233,13 +1233,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* An FTP/SFTP option that modifies an upload to create missing
* directories on the server.
*/
- arg = va_arg(param, long);
- /* reserve other values for future use */
- if((arg < CURLFTP_CREATE_DIR_NONE) ||
- (arg > CURLFTP_CREATE_DIR_RETRY))
- result = CURLE_BAD_FUNCTION_ARGUMENT;
- else
- data->set.ftp_create_missing_dirs = (int)arg;
+ arg = va_arg(param, long);
+ /* reserve other values for future use */
+ if((arg < CURLFTP_CREATE_DIR_NONE) ||
+ (arg > CURLFTP_CREATE_DIR_RETRY))
+ result = CURLE_BAD_FUNCTION_ARGUMENT;
+ else
+ data->set.ftp_create_missing_dirs = (int)arg;
break;
case CURLOPT_READDATA:
/*
@@ -1649,13 +1649,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
result = Curl_setstropt(&data->set.str[STRING_CERT_ORIG],
va_arg(param, char *));
break;
- case CURLOPT_SSLCERT_BLOB:
- /*
- * Blob that holds file name of the SSL certificate to use
- */
- result = Curl_setblobopt(&data->set.blobs[BLOB_CERT_ORIG],
- va_arg(param, struct curl_blob *));
- break;
+ case CURLOPT_SSLCERT_BLOB:
+ /*
+ * Blob that holds file name of the SSL certificate to use
+ */
+ result = Curl_setblobopt(&data->set.blobs[BLOB_CERT_ORIG],
+ va_arg(param, struct curl_blob *));
+ break;
#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_SSLCERT:
/*
@@ -1664,13 +1664,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
result = Curl_setstropt(&data->set.str[STRING_CERT_PROXY],
va_arg(param, char *));
break;
- case CURLOPT_PROXY_SSLCERT_BLOB:
- /*
- * Blob that holds file name of the SSL certificate to use for proxy
- */
- result = Curl_setblobopt(&data->set.blobs[BLOB_CERT_PROXY],
- va_arg(param, struct curl_blob *));
- break;
+ case CURLOPT_PROXY_SSLCERT_BLOB:
+ /*
+ * Blob that holds file name of the SSL certificate to use for proxy
+ */
+ result = Curl_setblobopt(&data->set.blobs[BLOB_CERT_PROXY],
+ va_arg(param, struct curl_blob *));
+ break;
#endif
case CURLOPT_SSLCERTTYPE:
/*
@@ -1695,13 +1695,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
result = Curl_setstropt(&data->set.str[STRING_KEY_ORIG],
va_arg(param, char *));
break;
- case CURLOPT_SSLKEY_BLOB:
- /*
- * Blob that holds file name of the SSL key to use
- */
- result = Curl_setblobopt(&data->set.blobs[BLOB_KEY_ORIG],
- va_arg(param, struct curl_blob *));
- break;
+ case CURLOPT_SSLKEY_BLOB:
+ /*
+ * Blob that holds file name of the SSL key to use
+ */
+ result = Curl_setblobopt(&data->set.blobs[BLOB_KEY_ORIG],
+ va_arg(param, struct curl_blob *));
+ break;
#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_SSLKEY:
/*
@@ -1710,13 +1710,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
result = Curl_setstropt(&data->set.str[STRING_KEY_PROXY],
va_arg(param, char *));
break;
- case CURLOPT_PROXY_SSLKEY_BLOB:
- /*
- * Blob that holds file name of the SSL key to use for proxy
- */
- result = Curl_setblobopt(&data->set.blobs[BLOB_KEY_PROXY],
- va_arg(param, struct curl_blob *));
- break;
+ case CURLOPT_PROXY_SSLKEY_BLOB:
+ /*
+ * Blob that holds file name of the SSL key to use for proxy
+ */
+ result = Curl_setblobopt(&data->set.blobs[BLOB_KEY_PROXY],
+ va_arg(param, struct curl_blob *));
+ break;
#endif
case CURLOPT_SSLKEYTYPE:
/*
@@ -2041,30 +2041,30 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
result = Curl_setstropt(&data->set.str[STRING_SSL_ISSUERCERT_ORIG],
va_arg(param, char *));
break;
- case CURLOPT_ISSUERCERT_BLOB:
- /*
- * Blob that holds Issuer certificate to check certificates issuer
- */
- result = Curl_setblobopt(&data->set.blobs[BLOB_SSL_ISSUERCERT_ORIG],
- va_arg(param, struct curl_blob *));
- break;
-#ifndef CURL_DISABLE_PROXY
- case CURLOPT_PROXY_ISSUERCERT:
- /*
- * Set Issuer certificate file
- * to check certificates issuer
- */
- result = Curl_setstropt(&data->set.str[STRING_SSL_ISSUERCERT_PROXY],
- va_arg(param, char *));
- break;
- case CURLOPT_PROXY_ISSUERCERT_BLOB:
- /*
- * Blob that holds Issuer certificate to check certificates issuer
- */
- result = Curl_setblobopt(&data->set.blobs[BLOB_SSL_ISSUERCERT_PROXY],
- va_arg(param, struct curl_blob *));
- break;
-#endif
+ case CURLOPT_ISSUERCERT_BLOB:
+ /*
+ * Blob that holds Issuer certificate to check certificates issuer
+ */
+ result = Curl_setblobopt(&data->set.blobs[BLOB_SSL_ISSUERCERT_ORIG],
+ va_arg(param, struct curl_blob *));
+ break;
+#ifndef CURL_DISABLE_PROXY
+ case CURLOPT_PROXY_ISSUERCERT:
+ /*
+ * Set Issuer certificate file
+ * to check certificates issuer
+ */
+ result = Curl_setstropt(&data->set.str[STRING_SSL_ISSUERCERT_PROXY],
+ va_arg(param, char *));
+ break;
+ case CURLOPT_PROXY_ISSUERCERT_BLOB:
+ /*
+ * Blob that holds Issuer certificate to check certificates issuer
+ */
+ result = Curl_setblobopt(&data->set.blobs[BLOB_SSL_ISSUERCERT_PROXY],
+ va_arg(param, struct curl_blob *));
+ break;
+#endif
#ifndef CURL_DISABLE_TELNET
case CURLOPT_TELNETOPTIONS:
/*
@@ -2078,9 +2078,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* The application kindly asks for a differently sized receive buffer.
* If it seems reasonable, we'll use it.
*/
- if(data->state.buffer)
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
+ if(data->state.buffer)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
arg = va_arg(param, long);
if(arg > READBUFFER_MAX)
@@ -2210,7 +2210,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* Make transfers attempt to use SSL/TLS.
*/
arg = va_arg(param, long);
- if((arg < CURLUSESSL_NONE) || (arg >= CURLUSESSL_LAST))
+ if((arg < CURLUSESSL_NONE) || (arg >= CURLUSESSL_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.use_ssl = (curl_usessl)arg;
break;
@@ -2220,9 +2220,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.ssl.enable_beast =
(bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE);
data->set.ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE);
- data->set.ssl.no_partialchain = !!(arg & CURLSSLOPT_NO_PARTIALCHAIN);
- data->set.ssl.revoke_best_effort = !!(arg & CURLSSLOPT_REVOKE_BEST_EFFORT);
- data->set.ssl.native_ca_store = !!(arg & CURLSSLOPT_NATIVE_CA);
+ data->set.ssl.no_partialchain = !!(arg & CURLSSLOPT_NO_PARTIALCHAIN);
+ data->set.ssl.revoke_best_effort = !!(arg & CURLSSLOPT_REVOKE_BEST_EFFORT);
+ data->set.ssl.native_ca_store = !!(arg & CURLSSLOPT_NATIVE_CA);
break;
#ifndef CURL_DISABLE_PROXY
@@ -2231,21 +2231,21 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.proxy_ssl.enable_beast =
(bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE);
data->set.proxy_ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE);
- data->set.proxy_ssl.no_partialchain = !!(arg & CURLSSLOPT_NO_PARTIALCHAIN);
- data->set.proxy_ssl.native_ca_store = !!(arg & CURLSSLOPT_NATIVE_CA);
- data->set.proxy_ssl.revoke_best_effort =
- !!(arg & CURLSSLOPT_REVOKE_BEST_EFFORT);
+ data->set.proxy_ssl.no_partialchain = !!(arg & CURLSSLOPT_NO_PARTIALCHAIN);
+ data->set.proxy_ssl.native_ca_store = !!(arg & CURLSSLOPT_NATIVE_CA);
+ data->set.proxy_ssl.revoke_best_effort =
+ !!(arg & CURLSSLOPT_REVOKE_BEST_EFFORT);
break;
#endif
- case CURLOPT_SSL_EC_CURVES:
- /*
- * Set accepted curves in SSL connection setup.
- * Specify colon-delimited list of curve algorithm names.
- */
- result = Curl_setstropt(&data->set.str[STRING_SSL_EC_CURVES],
- va_arg(param, char *));
- break;
+ case CURLOPT_SSL_EC_CURVES:
+ /*
+ * Set accepted curves in SSL connection setup.
+ * Specify colon-delimited list of curve algorithm names.
+ */
+ result = Curl_setstropt(&data->set.str[STRING_SSL_EC_CURVES],
+ va_arg(param, char *));
+ break;
#endif
case CURLOPT_IPRESOLVE:
arg = va_arg(param, long);
@@ -2345,9 +2345,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_SSL_SESSIONID_CACHE:
data->set.ssl.primary.sessionid = (0 != va_arg(param, long)) ?
TRUE : FALSE;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
data->set.proxy_ssl.primary.sessionid = data->set.ssl.primary.sessionid;
-#endif
+#endif
break;
#ifdef USE_SSH
@@ -2390,7 +2390,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_SSH_KEYFUNCTION:
/* setting to NULL is fine since the ssh.c functions themselves will
- then revert to use the internal default */
+ then revert to use the internal default */
data->set.ssh_keyfunc = va_arg(param, curl_sshkeycallback);
break;
@@ -2493,10 +2493,10 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
/* Set the list of mail recipients */
data->set.mail_rcpt = va_arg(param, struct curl_slist *);
break;
- case CURLOPT_MAIL_RCPT_ALLLOWFAILS:
- /* allow RCPT TO command to fail for some recipients */
- data->set.mail_rcpt_allowfails = (0 != va_arg(param, long)) ? TRUE : FALSE;
- break;
+ case CURLOPT_MAIL_RCPT_ALLLOWFAILS:
+ /* allow RCPT TO command to fail for some recipients */
+ data->set.mail_rcpt_allowfails = (0 != va_arg(param, long)) ? TRUE : FALSE;
+ break;
#endif
case CURLOPT_SASL_AUTHZID:
@@ -2516,9 +2516,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* Set the RTSP request method (OPTIONS, SETUP, PLAY, etc...)
* Would this be better if the RTSPREQ_* were just moved into here?
*/
- long in_rtspreq = va_arg(param, long);
+ long in_rtspreq = va_arg(param, long);
Curl_RtspReq rtspreq = RTSPREQ_NONE;
- switch(in_rtspreq) {
+ switch(in_rtspreq) {
case CURL_RTSPREQ_OPTIONS:
rtspreq = RTSPREQ_OPTIONS;
break;
@@ -2608,7 +2608,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_RTSP_SERVER_CSEQ:
/* Same as the above, but for server-initiated requests */
- data->state.rtsp_next_server_CSeq = va_arg(param, long);
+ data->state.rtsp_next_server_CSeq = va_arg(param, long);
break;
case CURLOPT_INTERLEAVEDATA:
@@ -2649,11 +2649,11 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_PROXY_TLSAUTH_USERNAME:
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_PROXY],
va_arg(param, char *));
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
!data->set.proxy_ssl.authtype)
data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
-#endif
+#endif
break;
case CURLOPT_TLSAUTH_PASSWORD:
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_ORIG],
@@ -2664,11 +2664,11 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
case CURLOPT_PROXY_TLSAUTH_PASSWORD:
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_PROXY],
va_arg(param, char *));
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
!data->set.proxy_ssl.authtype)
data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
-#endif
+#endif
break;
case CURLOPT_TLSAUTH_TYPE:
argptr = va_arg(param, char *);
@@ -2678,7 +2678,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
else
data->set.ssl.authtype = CURL_TLSAUTH_NONE;
break;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_TLSAUTH_TYPE:
argptr = va_arg(param, char *);
if(!argptr ||
@@ -2688,35 +2688,35 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.proxy_ssl.authtype = CURL_TLSAUTH_NONE;
break;
#endif
-#endif
+#endif
#ifdef USE_ARES
case CURLOPT_DNS_SERVERS:
- result = Curl_setstropt(&data->set.str[STRING_DNS_SERVERS],
- va_arg(param, char *));
- if(result)
- return result;
- result = Curl_set_dns_servers(data, data->set.str[STRING_DNS_SERVERS]);
+ result = Curl_setstropt(&data->set.str[STRING_DNS_SERVERS],
+ va_arg(param, char *));
+ if(result)
+ return result;
+ result = Curl_set_dns_servers(data, data->set.str[STRING_DNS_SERVERS]);
break;
case CURLOPT_DNS_INTERFACE:
- result = Curl_setstropt(&data->set.str[STRING_DNS_INTERFACE],
- va_arg(param, char *));
- if(result)
- return result;
- result = Curl_set_dns_interface(data, data->set.str[STRING_DNS_INTERFACE]);
+ result = Curl_setstropt(&data->set.str[STRING_DNS_INTERFACE],
+ va_arg(param, char *));
+ if(result)
+ return result;
+ result = Curl_set_dns_interface(data, data->set.str[STRING_DNS_INTERFACE]);
break;
case CURLOPT_DNS_LOCAL_IP4:
- result = Curl_setstropt(&data->set.str[STRING_DNS_LOCAL_IP4],
- va_arg(param, char *));
- if(result)
- return result;
- result = Curl_set_dns_local_ip4(data, data->set.str[STRING_DNS_LOCAL_IP4]);
+ result = Curl_setstropt(&data->set.str[STRING_DNS_LOCAL_IP4],
+ va_arg(param, char *));
+ if(result)
+ return result;
+ result = Curl_set_dns_local_ip4(data, data->set.str[STRING_DNS_LOCAL_IP4]);
break;
case CURLOPT_DNS_LOCAL_IP6:
- result = Curl_setstropt(&data->set.str[STRING_DNS_LOCAL_IP6],
- va_arg(param, char *));
- if(result)
- return result;
- result = Curl_set_dns_local_ip6(data, data->set.str[STRING_DNS_LOCAL_IP6]);
+ result = Curl_setstropt(&data->set.str[STRING_DNS_LOCAL_IP6],
+ va_arg(param, char *));
+ if(result)
+ return result;
+ result = Curl_set_dns_local_ip6(data, data->set.str[STRING_DNS_LOCAL_IP6]);
break;
#endif
case CURLOPT_TCP_KEEPALIVE:
@@ -2842,46 +2842,46 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.trailer_data = va_arg(param, void *);
#endif
break;
-#ifdef USE_HSTS
- case CURLOPT_HSTSREADFUNCTION:
- data->set.hsts_read = va_arg(param, curl_hstsread_callback);
- break;
- case CURLOPT_HSTSREADDATA:
- data->set.hsts_read_userp = va_arg(param, void *);
- break;
- case CURLOPT_HSTSWRITEFUNCTION:
- data->set.hsts_write = va_arg(param, curl_hstswrite_callback);
- break;
- case CURLOPT_HSTSWRITEDATA:
- data->set.hsts_write_userp = va_arg(param, void *);
- break;
- case CURLOPT_HSTS:
- if(!data->hsts) {
- data->hsts = Curl_hsts_init();
- if(!data->hsts)
- return CURLE_OUT_OF_MEMORY;
- }
- argptr = va_arg(param, char *);
- result = Curl_setstropt(&data->set.str[STRING_HSTS], argptr);
- if(result)
- return result;
- if(argptr)
- (void)Curl_hsts_loadfile(data, data->hsts, argptr);
- break;
- case CURLOPT_HSTS_CTRL:
- arg = va_arg(param, long);
- if(arg & CURLHSTS_ENABLE) {
- if(!data->hsts) {
- data->hsts = Curl_hsts_init();
- if(!data->hsts)
- return CURLE_OUT_OF_MEMORY;
- }
- }
- else
- Curl_hsts_cleanup(&data->hsts);
- break;
-#endif
-#ifndef CURL_DISABLE_ALTSVC
+#ifdef USE_HSTS
+ case CURLOPT_HSTSREADFUNCTION:
+ data->set.hsts_read = va_arg(param, curl_hstsread_callback);
+ break;
+ case CURLOPT_HSTSREADDATA:
+ data->set.hsts_read_userp = va_arg(param, void *);
+ break;
+ case CURLOPT_HSTSWRITEFUNCTION:
+ data->set.hsts_write = va_arg(param, curl_hstswrite_callback);
+ break;
+ case CURLOPT_HSTSWRITEDATA:
+ data->set.hsts_write_userp = va_arg(param, void *);
+ break;
+ case CURLOPT_HSTS:
+ if(!data->hsts) {
+ data->hsts = Curl_hsts_init();
+ if(!data->hsts)
+ return CURLE_OUT_OF_MEMORY;
+ }
+ argptr = va_arg(param, char *);
+ result = Curl_setstropt(&data->set.str[STRING_HSTS], argptr);
+ if(result)
+ return result;
+ if(argptr)
+ (void)Curl_hsts_loadfile(data, data->hsts, argptr);
+ break;
+ case CURLOPT_HSTS_CTRL:
+ arg = va_arg(param, long);
+ if(arg & CURLHSTS_ENABLE) {
+ if(!data->hsts) {
+ data->hsts = Curl_hsts_init();
+ if(!data->hsts)
+ return CURLE_OUT_OF_MEMORY;
+ }
+ }
+ else
+ Curl_hsts_cleanup(&data->hsts);
+ break;
+#endif
+#ifndef CURL_DISABLE_ALTSVC
case CURLOPT_ALTSVC:
if(!data->asi) {
data->asi = Curl_altsvc_init();
@@ -2892,8 +2892,8 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
result = Curl_setstropt(&data->set.str[STRING_ALTSVC], argptr);
if(result)
return result;
- if(argptr)
- (void)Curl_altsvc_load(data->asi, argptr);
+ if(argptr)
+ (void)Curl_altsvc_load(data->asi, argptr);
break;
case CURLOPT_ALTSVC_CTRL:
if(!data->asi) {
diff --git a/contrib/libs/curl/lib/setopt.h b/contrib/libs/curl/lib/setopt.h
index 4e57811345..affbfd9960 100644
--- a/contrib/libs/curl/lib/setopt.h
+++ b/contrib/libs/curl/lib/setopt.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -23,8 +23,8 @@
***************************************************************************/
CURLcode Curl_setstropt(char **charp, const char *s);
-CURLcode Curl_setblobopt(struct curl_blob **blobp,
- const struct curl_blob *blob);
+CURLcode Curl_setblobopt(struct curl_blob **blobp,
+ const struct curl_blob *blob);
CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list arg);
#endif /* HEADER_CURL_SETOPT_H */
diff --git a/contrib/libs/curl/lib/setup-os400.h b/contrib/libs/curl/lib/setup-os400.h
index bb50f89eb7..8c97371e4d 100644
--- a/contrib/libs/curl/lib/setup-os400.h
+++ b/contrib/libs/curl/lib/setup-os400.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -200,21 +200,21 @@ extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,
/* Some socket functions must be wrapped to process textual addresses
like AF_UNIX. */
-extern int Curl_os400_connect(int sd, struct sockaddr *destaddr, int addrlen);
-extern int Curl_os400_bind(int sd, struct sockaddr *localaddr, int addrlen);
+extern int Curl_os400_connect(int sd, struct sockaddr *destaddr, int addrlen);
+extern int Curl_os400_bind(int sd, struct sockaddr *localaddr, int addrlen);
extern int Curl_os400_sendto(int sd, char *buffer, int buflen, int flags,
- struct sockaddr *dstaddr, int addrlen);
+ struct sockaddr *dstaddr, int addrlen);
extern int Curl_os400_recvfrom(int sd, char *buffer, int buflen, int flags,
struct sockaddr *fromaddr, int *addrlen);
-extern int Curl_os400_getpeername(int sd, struct sockaddr *addr, int *addrlen);
-extern int Curl_os400_getsockname(int sd, struct sockaddr *addr, int *addrlen);
+extern int Curl_os400_getpeername(int sd, struct sockaddr *addr, int *addrlen);
+extern int Curl_os400_getsockname(int sd, struct sockaddr *addr, int *addrlen);
#define connect Curl_os400_connect
#define bind Curl_os400_bind
#define sendto Curl_os400_sendto
#define recvfrom Curl_os400_recvfrom
-#define getpeername Curl_os400_getpeername
-#define getsockname Curl_os400_getsockname
+#define getpeername Curl_os400_getpeername
+#define getsockname Curl_os400_getsockname
#ifdef HAVE_LIBZ
#define zlibVersion Curl_os400_zlibVersion
diff --git a/contrib/libs/curl/lib/setup-vms.h b/contrib/libs/curl/lib/setup-vms.h
index ae13f72175..ba75dc295b 100644
--- a/contrib/libs/curl/lib/setup-vms.h
+++ b/contrib/libs/curl/lib/setup-vms.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -73,7 +73,7 @@ char *decc$getenv(const char *__name);
# endif
#endif
- struct passwd *decc_getpwuid(uid_t uid);
+ struct passwd *decc_getpwuid(uid_t uid);
#ifdef __DECC
# if __INITIAL_POINTER_SIZE == 32
@@ -138,9 +138,9 @@ static char *vms_getenv(const char *envvar)
static struct passwd vms_passwd_cache;
-static struct passwd *vms_getpwuid(uid_t uid)
+static struct passwd *vms_getpwuid(uid_t uid)
{
- struct passwd *my_passwd;
+ struct passwd *my_passwd;
/* Hack needed to support 64 bit builds, decc_getpwnam is 32 bit only */
#ifdef __DECC
diff --git a/contrib/libs/curl/lib/setup-win32.h b/contrib/libs/curl/lib/setup-win32.h
index 2bd432694d..c35dec88cb 100644
--- a/contrib/libs/curl/lib/setup-win32.h
+++ b/contrib/libs/curl/lib/setup-win32.h
@@ -1,122 +1,122 @@
-#ifndef HEADER_CURL_SETUP_WIN32_H
-#define HEADER_CURL_SETUP_WIN32_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 header files for windows builds before redefining anything.
- * Use this preprocessor block only to include or exclude windows.h,
- * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
- * to any other further and independent block. Under Cygwin things work
- * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
- * never be included when __CYGWIN__ is defined. configure script takes
- * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
- * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
- */
-
-#ifdef HAVE_WINDOWS_H
-# if defined(UNICODE) && !defined(_UNICODE)
-# define _UNICODE
-# endif
-# if defined(_UNICODE) && !defined(UNICODE)
-# define UNICODE
-# endif
-# include <winerror.h>
-# include <windows.h>
-# ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-# ifdef HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-# endif
-# else
-# ifdef HAVE_WINSOCK_H
-# include <winsock.h>
-# endif
-# endif
-# include <tchar.h>
-# ifdef UNICODE
- typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
-# endif
-#endif
-
-/*
- * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
- * undefine USE_WINSOCK.
- */
-
-#undef USE_WINSOCK
-
-#ifdef HAVE_WINSOCK2_H
-# define USE_WINSOCK 2
-#else
-# ifdef HAVE_WINSOCK_H
-# error "WinSock version 1 is no longer supported, version 2 is required!"
-# endif
-#endif
-
-/*
- * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
- * those symbols to compare against, and even those that do may be missing
- * newer symbols.
- */
-
-#ifndef _WIN32_WINNT_NT4
-#define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
-#endif
-#ifndef _WIN32_WINNT_WIN2K
-#define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
-#endif
-#ifndef _WIN32_WINNT_WINXP
-#define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
-#endif
-#ifndef _WIN32_WINNT_WS03
-#define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
-#endif
-#ifndef _WIN32_WINNT_WIN6
-#define _WIN32_WINNT_WIN6 0x0600 /* Windows Vista */
-#endif
-#ifndef _WIN32_WINNT_VISTA
-#define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
-#endif
-#ifndef _WIN32_WINNT_WS08
-#define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
-#endif
-#ifndef _WIN32_WINNT_LONGHORN
-#define _WIN32_WINNT_LONGHORN 0x0600 /* Windows Vista */
-#endif
-#ifndef _WIN32_WINNT_WIN7
-#define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
-#endif
-#ifndef _WIN32_WINNT_WIN8
-#define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
-#endif
-#ifndef _WIN32_WINNT_WINBLUE
-#define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
-#endif
-#ifndef _WIN32_WINNT_WINTHRESHOLD
-#define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
-#endif
-#ifndef _WIN32_WINNT_WIN10
-#define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
-#endif
-
-#endif /* HEADER_CURL_SETUP_WIN32_H */
+#ifndef HEADER_CURL_SETUP_WIN32_H
+#define HEADER_CURL_SETUP_WIN32_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 header files for windows builds before redefining anything.
+ * Use this preprocessor block only to include or exclude windows.h,
+ * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
+ * to any other further and independent block. Under Cygwin things work
+ * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
+ * never be included when __CYGWIN__ is defined. configure script takes
+ * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
+ * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
+ */
+
+#ifdef HAVE_WINDOWS_H
+# if defined(UNICODE) && !defined(_UNICODE)
+# define _UNICODE
+# endif
+# if defined(_UNICODE) && !defined(UNICODE)
+# define UNICODE
+# endif
+# include <winerror.h>
+# include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# ifdef HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+# endif
+# else
+# ifdef HAVE_WINSOCK_H
+# include <winsock.h>
+# endif
+# endif
+# include <tchar.h>
+# ifdef UNICODE
+ typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
+# endif
+#endif
+
+/*
+ * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
+ * undefine USE_WINSOCK.
+ */
+
+#undef USE_WINSOCK
+
+#ifdef HAVE_WINSOCK2_H
+# define USE_WINSOCK 2
+#else
+# ifdef HAVE_WINSOCK_H
+# error "WinSock version 1 is no longer supported, version 2 is required!"
+# endif
+#endif
+
+/*
+ * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
+ * those symbols to compare against, and even those that do may be missing
+ * newer symbols.
+ */
+
+#ifndef _WIN32_WINNT_NT4
+#define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
+#endif
+#ifndef _WIN32_WINNT_WIN2K
+#define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
+#endif
+#ifndef _WIN32_WINNT_WINXP
+#define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
+#endif
+#ifndef _WIN32_WINNT_WS03
+#define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
+#endif
+#ifndef _WIN32_WINNT_WIN6
+#define _WIN32_WINNT_WIN6 0x0600 /* Windows Vista */
+#endif
+#ifndef _WIN32_WINNT_VISTA
+#define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
+#endif
+#ifndef _WIN32_WINNT_WS08
+#define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
+#endif
+#ifndef _WIN32_WINNT_LONGHORN
+#define _WIN32_WINNT_LONGHORN 0x0600 /* Windows Vista */
+#endif
+#ifndef _WIN32_WINNT_WIN7
+#define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
+#endif
+#ifndef _WIN32_WINNT_WIN8
+#define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
+#endif
+#ifndef _WIN32_WINNT_WINBLUE
+#define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
+#endif
+#ifndef _WIN32_WINNT_WINTHRESHOLD
+#define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
+#endif
+#ifndef _WIN32_WINNT_WIN10
+#define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
+#endif
+
+#endif /* HEADER_CURL_SETUP_WIN32_H */
diff --git a/contrib/libs/curl/lib/sha256.c b/contrib/libs/curl/lib/sha256.c
index e1b3459bbb..7d2a4f705a 100644
--- a/contrib/libs/curl/lib/sha256.c
+++ b/contrib/libs/curl/lib/sha256.c
@@ -5,12 +5,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -36,208 +36,208 @@
#define USE_OPENSSL_SHA256
#endif
-#endif /* USE_OPENSSL */
-
-#ifdef USE_MBEDTLS
-#error #include <mbedtls/version.h>
-
-#if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
- #define HAS_RESULT_CODE_BASED_FUNCTIONS
+#endif /* USE_OPENSSL */
+
+#ifdef USE_MBEDTLS
+#error #include <mbedtls/version.h>
+
+#if(MBEDTLS_VERSION_NUMBER >= 0x02070000)
+ #define HAS_RESULT_CODE_BASED_FUNCTIONS
#endif
-#endif /* USE_MBEDTLS */
-
-/* Please keep the SSL backend-specific #if branches in this order:
- *
- * 1. USE_OPENSSL
- * 2. USE_GNUTLS_NETTLE
- * 3. USE_GNUTLS
- * 4. USE_MBEDTLS
- * 5. USE_COMMON_CRYPTO
- * 6. USE_WIN32_CRYPTO
- *
- * This ensures that the same SSL branch gets activated throughout this source
- * file even if multiple backends are enabled at the same time.
- */
-
-#if defined(USE_OPENSSL_SHA256)
-
+#endif /* USE_MBEDTLS */
+
+/* Please keep the SSL backend-specific #if branches in this order:
+ *
+ * 1. USE_OPENSSL
+ * 2. USE_GNUTLS_NETTLE
+ * 3. USE_GNUTLS
+ * 4. USE_MBEDTLS
+ * 5. USE_COMMON_CRYPTO
+ * 6. USE_WIN32_CRYPTO
+ *
+ * This ensures that the same SSL branch gets activated throughout this source
+ * file even if multiple backends are enabled at the same time.
+ */
+
+#if defined(USE_OPENSSL_SHA256)
+
/* When OpenSSL is available we use the SHA256-function from OpenSSL */
#include <openssl/sha.h>
-
-#elif defined(USE_GNUTLS_NETTLE)
-
-#error #include <nettle/sha.h>
-
-#include "curl_memory.h"
-
-/* The last #include file should be: */
-#include "memdebug.h"
-
-typedef struct sha256_ctx SHA256_CTX;
-
-static void SHA256_Init(SHA256_CTX *ctx)
-{
- sha256_init(ctx);
-}
-
-static void SHA256_Update(SHA256_CTX *ctx,
- const unsigned char *data,
- unsigned int length)
-{
- sha256_update(ctx, length, data);
-}
-
-static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
-{
- sha256_digest(ctx, SHA256_DIGEST_SIZE, digest);
-}
-
-#elif defined(USE_GNUTLS)
-
-#include <gcrypt.h>
-
-#include "curl_memory.h"
-
-/* The last #include file should be: */
-#include "memdebug.h"
-
-typedef gcry_md_hd_t SHA256_CTX;
-
-static void SHA256_Init(SHA256_CTX *ctx)
-{
- gcry_md_open(ctx, GCRY_MD_SHA256, 0);
-}
-
-static void SHA256_Update(SHA256_CTX *ctx,
- const unsigned char *data,
- unsigned int length)
-{
- gcry_md_write(*ctx, data, length);
-}
-
-static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
-{
- memcpy(digest, gcry_md_read(*ctx, 0), SHA256_DIGEST_LENGTH);
- gcry_md_close(*ctx);
-}
-
-#elif defined(USE_MBEDTLS)
-
-#error #include <mbedtls/sha256.h>
-
-#include "curl_memory.h"
-
-/* The last #include file should be: */
-#include "memdebug.h"
-
-typedef mbedtls_sha256_context SHA256_CTX;
-
-static void SHA256_Init(SHA256_CTX *ctx)
-{
-#if !defined(HAS_RESULT_CODE_BASED_FUNCTIONS)
- mbedtls_sha256_starts(ctx, 0);
+
+#elif defined(USE_GNUTLS_NETTLE)
+
+#error #include <nettle/sha.h>
+
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef struct sha256_ctx SHA256_CTX;
+
+static void SHA256_Init(SHA256_CTX *ctx)
+{
+ sha256_init(ctx);
+}
+
+static void SHA256_Update(SHA256_CTX *ctx,
+ const unsigned char *data,
+ unsigned int length)
+{
+ sha256_update(ctx, length, data);
+}
+
+static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
+{
+ sha256_digest(ctx, SHA256_DIGEST_SIZE, digest);
+}
+
+#elif defined(USE_GNUTLS)
+
+#include <gcrypt.h>
+
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef gcry_md_hd_t SHA256_CTX;
+
+static void SHA256_Init(SHA256_CTX *ctx)
+{
+ gcry_md_open(ctx, GCRY_MD_SHA256, 0);
+}
+
+static void SHA256_Update(SHA256_CTX *ctx,
+ const unsigned char *data,
+ unsigned int length)
+{
+ gcry_md_write(*ctx, data, length);
+}
+
+static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
+{
+ memcpy(digest, gcry_md_read(*ctx, 0), SHA256_DIGEST_LENGTH);
+ gcry_md_close(*ctx);
+}
+
+#elif defined(USE_MBEDTLS)
+
+#error #include <mbedtls/sha256.h>
+
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef mbedtls_sha256_context SHA256_CTX;
+
+static void SHA256_Init(SHA256_CTX *ctx)
+{
+#if !defined(HAS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_sha256_starts(ctx, 0);
+#else
+ (void) mbedtls_sha256_starts_ret(ctx, 0);
+#endif
+}
+
+static void SHA256_Update(SHA256_CTX *ctx,
+ const unsigned char *data,
+ unsigned int length)
+{
+#if !defined(HAS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_sha256_update(ctx, data, length);
+#else
+ (void) mbedtls_sha256_update_ret(ctx, data, length);
+#endif
+}
+
+static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
+{
+#if !defined(HAS_RESULT_CODE_BASED_FUNCTIONS)
+ mbedtls_sha256_finish(ctx, digest);
+#else
+ (void) mbedtls_sha256_finish_ret(ctx, digest);
+#endif
+}
+
+#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
+ (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
+ (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
+ (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
+
+#include <CommonCrypto/CommonDigest.h>
+
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
+
+typedef CC_SHA256_CTX SHA256_CTX;
+
+static void SHA256_Init(SHA256_CTX *ctx)
+{
+ (void) CC_SHA256_Init(ctx);
+}
+
+static void SHA256_Update(SHA256_CTX *ctx,
+ const unsigned char *data,
+ unsigned int length)
+{
+ (void) CC_SHA256_Update(ctx, data, length);
+}
+
+static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
+{
+ (void) CC_SHA256_Final(digest, ctx);
+}
+
+#elif defined(USE_WIN32_CRYPTO)
+
+#include <wincrypt.h>
+
+struct sha256_ctx {
+ HCRYPTPROV hCryptProv;
+ HCRYPTHASH hHash;
+};
+typedef struct sha256_ctx SHA256_CTX;
+
+#if !defined(CALG_SHA_256)
+#define CALG_SHA_256 0x0000800c
+#endif
+
+static void SHA256_Init(SHA256_CTX *ctx)
+{
+ if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL, PROV_RSA_AES,
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ CryptCreateHash(ctx->hCryptProv, CALG_SHA_256, 0, 0, &ctx->hHash);
+ }
+}
+
+static void SHA256_Update(SHA256_CTX *ctx,
+ const unsigned char *data,
+ unsigned int length)
+{
+ CryptHashData(ctx->hHash, (unsigned char *) data, length, 0);
+}
+
+static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
+{
+ unsigned long length = 0;
+
+ CryptGetHashParam(ctx->hHash, HP_HASHVAL, NULL, &length, 0);
+ if(length == SHA256_DIGEST_LENGTH)
+ CryptGetHashParam(ctx->hHash, HP_HASHVAL, digest, &length, 0);
+
+ if(ctx->hHash)
+ CryptDestroyHash(ctx->hHash);
+
+ if(ctx->hCryptProv)
+ CryptReleaseContext(ctx->hCryptProv, 0);
+}
+
#else
- (void) mbedtls_sha256_starts_ret(ctx, 0);
-#endif
-}
-
-static void SHA256_Update(SHA256_CTX *ctx,
- const unsigned char *data,
- unsigned int length)
-{
-#if !defined(HAS_RESULT_CODE_BASED_FUNCTIONS)
- mbedtls_sha256_update(ctx, data, length);
-#else
- (void) mbedtls_sha256_update_ret(ctx, data, length);
-#endif
-}
-
-static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
-{
-#if !defined(HAS_RESULT_CODE_BASED_FUNCTIONS)
- mbedtls_sha256_finish(ctx, digest);
-#else
- (void) mbedtls_sha256_finish_ret(ctx, digest);
-#endif
-}
-
-#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
- (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
- (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
- (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
-
-#include <CommonCrypto/CommonDigest.h>
-
-#include "curl_memory.h"
-
-/* The last #include file should be: */
-#include "memdebug.h"
-
-typedef CC_SHA256_CTX SHA256_CTX;
-
-static void SHA256_Init(SHA256_CTX *ctx)
-{
- (void) CC_SHA256_Init(ctx);
-}
-
-static void SHA256_Update(SHA256_CTX *ctx,
- const unsigned char *data,
- unsigned int length)
-{
- (void) CC_SHA256_Update(ctx, data, length);
-}
-
-static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
-{
- (void) CC_SHA256_Final(digest, ctx);
-}
-
-#elif defined(USE_WIN32_CRYPTO)
-
-#include <wincrypt.h>
-
-struct sha256_ctx {
- HCRYPTPROV hCryptProv;
- HCRYPTHASH hHash;
-};
-typedef struct sha256_ctx SHA256_CTX;
-
-#if !defined(CALG_SHA_256)
-#define CALG_SHA_256 0x0000800c
-#endif
-
-static void SHA256_Init(SHA256_CTX *ctx)
-{
- if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL, PROV_RSA_AES,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
- CryptCreateHash(ctx->hCryptProv, CALG_SHA_256, 0, 0, &ctx->hHash);
- }
-}
-
-static void SHA256_Update(SHA256_CTX *ctx,
- const unsigned char *data,
- unsigned int length)
-{
- CryptHashData(ctx->hHash, (unsigned char *) data, length, 0);
-}
-
-static void SHA256_Final(unsigned char *digest, SHA256_CTX *ctx)
-{
- unsigned long length = 0;
-
- CryptGetHashParam(ctx->hHash, HP_HASHVAL, NULL, &length, 0);
- if(length == SHA256_DIGEST_LENGTH)
- CryptGetHashParam(ctx->hHash, HP_HASHVAL, digest, &length, 0);
-
- if(ctx->hHash)
- CryptDestroyHash(ctx->hHash);
-
- if(ctx->hCryptProv)
- CryptReleaseContext(ctx->hCryptProv, 0);
-}
-
-#else
-
+
/* When no other crypto library is available we use this code segment */
/* This is based on SHA256 implementation in LibTomCrypt that was released into
@@ -281,7 +281,7 @@ do { \
} while(0)
#endif
-struct sha256_state {
+struct sha256_state {
#ifdef HAVE_LONGLONG
unsigned long long length;
#else
@@ -289,10 +289,10 @@ struct sha256_state {
#endif
unsigned long state[8], curlen;
unsigned char buf[64];
-};
-typedef struct sha256_state SHA256_CTX;
-
-/* The K array */
+};
+typedef struct sha256_state SHA256_CTX;
+
+/* The K array */
static const unsigned long K[64] = {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
@@ -308,7 +308,7 @@ static const unsigned long K[64] = {
0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
};
-
+
/* Various logical functions */
#define RORc(x, y) \
(((((unsigned long)(x) & 0xFFFFFFFFUL) >> (unsigned long)((y) & 31)) | \
@@ -321,15 +321,15 @@ static const unsigned long K[64] = {
#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25))
#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3))
#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10))
-
-/* Compress 512-bits */
+
+/* Compress 512-bits */
static int sha256_compress(struct sha256_state *md,
unsigned char *buf)
{
unsigned long S[8], W[64];
int i;
-
- /* Copy state into S */
+
+ /* Copy state into S */
for(i = 0; i < 8; i++) {
S[i] = md->state[i];
}
@@ -341,7 +341,7 @@ static int sha256_compress(struct sha256_state *md,
W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) +
W[i - 16];
}
-
+
/* Compress */
#define RND(a,b,c,d,e,f,g,h,i) \
unsigned long t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
@@ -354,15 +354,15 @@ static int sha256_compress(struct sha256_state *md,
t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4];
S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t;
}
-
- /* Feedback */
+
+ /* Feedback */
for(i = 0; i < 8; i++) {
md->state[i] = md->state[i] + S[i];
}
-
+
return 0;
}
-
+
/* Initialize the hash state */
static void SHA256_Init(struct sha256_state *md)
{
@@ -377,8 +377,8 @@ static void SHA256_Init(struct sha256_state *md)
md->state[6] = 0x1F83D9ABUL;
md->state[7] = 0x5BE0CD19UL;
}
-
-/*
+
+/*
Process a block of memory though the hash
@param md The hash state
@param in The data to hash
@@ -390,7 +390,7 @@ static int SHA256_Update(struct sha256_state *md,
unsigned long inlen)
{
unsigned long n;
-
+
#define block_size 64
if(md->curlen > sizeof(md->buf))
return -1;
@@ -416,11 +416,11 @@ static int SHA256_Update(struct sha256_state *md,
}
}
}
-
+
return 0;
}
-
-/*
+
+/*
Terminate the hash to get the digest
@param md The hash state
@param out [out] The destination of the hash (32 bytes)
@@ -430,17 +430,17 @@ static int SHA256_Final(unsigned char *out,
struct sha256_state *md)
{
int i;
-
+
if(md->curlen >= sizeof(md->buf))
return -1;
-
- /* Increase the length of the message */
+
+ /* Increase the length of the message */
md->length += md->curlen * 8;
-
- /* Append the '1' bit */
+
+ /* Append the '1' bit */
md->buf[md->curlen++] = (unsigned char)0x80;
-
- /* If the length is currently above 56 bytes we append zeros
+
+ /* If the length is currently above 56 bytes we append zeros
* then compress. Then we can fall back to padding zeros and length
* encoding like normal.
*/
@@ -451,44 +451,44 @@ static int SHA256_Final(unsigned char *out,
sha256_compress(md, md->buf);
md->curlen = 0;
}
-
- /* Pad up to 56 bytes of zeroes */
+
+ /* Pad up to 56 bytes of zeroes */
while(md->curlen < 56) {
md->buf[md->curlen++] = (unsigned char)0;
}
-
- /* Store length */
+
+ /* Store length */
WPA_PUT_BE64(md->buf + 56, md->length);
sha256_compress(md, md->buf);
-
- /* Copy output */
+
+ /* Copy output */
for(i = 0; i < 8; i++)
WPA_PUT_BE32(out + (4 * i), md->state[i]);
-
+
return 0;
}
-#endif /* CRYPTO LIBS */
-
-/*
- * Curl_sha256it()
- *
- * Generates a SHA256 hash for the given input data.
- *
- * Parameters:
- *
- * output [in/out] - The output buffer.
- * input [in] - The input data.
- * length [in] - The input length.
- */
-void Curl_sha256it(unsigned char *output, const unsigned char *input,
- const size_t length)
+#endif /* CRYPTO LIBS */
+
+/*
+ * Curl_sha256it()
+ *
+ * Generates a SHA256 hash for the given input data.
+ *
+ * Parameters:
+ *
+ * output [in/out] - The output buffer.
+ * input [in] - The input data.
+ * length [in] - The input length.
+ */
+void Curl_sha256it(unsigned char *output, const unsigned char *input,
+ const size_t length)
{
SHA256_CTX ctx;
-
+
SHA256_Init(&ctx);
- SHA256_Update(&ctx, input, curlx_uztoui(length));
- SHA256_Final(output, &ctx);
+ SHA256_Update(&ctx, input, curlx_uztoui(length));
+ SHA256_Final(output, &ctx);
}
#endif /* CURL_DISABLE_CRYPTO_AUTH */
diff --git a/contrib/libs/curl/lib/share.c b/contrib/libs/curl/lib/share.c
index 289f89676c..5ce9830335 100644
--- a/contrib/libs/curl/lib/share.c
+++ b/contrib/libs/curl/lib/share.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -70,7 +70,7 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
case CURLSHOPT_SHARE:
/* this is a type this share will share */
type = va_arg(param, int);
-
+
switch(type) {
case CURL_LOCK_DATA_DNS:
break;
@@ -92,7 +92,7 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
if(!share->sslsession) {
share->max_ssl_sessions = 8;
share->sslsession = calloc(share->max_ssl_sessions,
- sizeof(struct Curl_ssl_session));
+ sizeof(struct Curl_ssl_session));
share->sessionage = 0;
if(!share->sslsession)
res = CURLSHE_NOMEM;
@@ -102,7 +102,7 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
#endif
break;
- case CURL_LOCK_DATA_CONNECT:
+ case CURL_LOCK_DATA_CONNECT:
if(Curl_conncache_init(&share->conn_cache, 103))
res = CURLSHE_NOMEM;
break;
@@ -116,8 +116,8 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
default:
res = CURLSHE_BAD_OPTION;
}
- if(!res)
- share->specifier |= (1<<type);
+ if(!res)
+ share->specifier |= (1<<type);
break;
case CURLSHOPT_UNSHARE:
diff --git a/contrib/libs/curl/lib/share.h b/contrib/libs/curl/lib/share.h
index 58863fc4ac..01aa9cda59 100644
--- a/contrib/libs/curl/lib/share.h
+++ b/contrib/libs/curl/lib/share.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -46,7 +46,7 @@ struct Curl_share {
curl_unlock_function unlockfunc;
void *clientdata;
struct conncache conn_cache;
- struct Curl_hash hostcache;
+ struct Curl_hash hostcache;
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
struct CookieInfo *cookies;
#endif
@@ -54,7 +54,7 @@ struct Curl_share {
struct PslCache psl;
#endif
- struct Curl_ssl_session *sslsession;
+ struct Curl_ssl_session *sslsession;
size_t max_ssl_sessions;
long sessionage;
};
diff --git a/contrib/libs/curl/lib/sigpipe.h b/contrib/libs/curl/lib/sigpipe.h
index ba54c80770..430cfc6489 100644
--- a/contrib/libs/curl/lib/sigpipe.h
+++ b/contrib/libs/curl/lib/sigpipe.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/slist.c b/contrib/libs/curl/lib/slist.c
index f5fb5161ca..907c203f38 100644
--- a/contrib/libs/curl/lib/slist.c
+++ b/contrib/libs/curl/lib/slist.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/slist.h b/contrib/libs/curl/lib/slist.h
index 4bb5c29631..3114259cfe 100644
--- a/contrib/libs/curl/lib/slist.h
+++ b/contrib/libs/curl/lib/slist.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/smb.c b/contrib/libs/curl/lib/smb.c
index d49c56b884..dd914a05bf 100644
--- a/contrib/libs/curl/lib/smb.c
+++ b/contrib/libs/curl/lib/smb.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2014, Bill Nagel <wnagel@tycoint.com>, Exacq Technologies
- * Copyright (C) 2016-2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2016-2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -23,7 +23,7 @@
#include "curl_setup.h"
-#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
+#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
(CURL_SIZEOF_CURL_OFF_T > 4)
#define BUILDING_CURL_SMB_C
@@ -86,7 +86,7 @@ const struct Curl_handler Curl_handler_smb = {
ZERO_NULL, /* connection_check */
PORT_SMB, /* defport */
CURLPROTO_SMB, /* protocol */
- CURLPROTO_SMB, /* family */
+ CURLPROTO_SMB, /* family */
PROTOPT_NONE /* flags */
};
@@ -112,7 +112,7 @@ const struct Curl_handler Curl_handler_smbs = {
ZERO_NULL, /* connection_check */
PORT_SMBS, /* defport */
CURLPROTO_SMBS, /* protocol */
- CURLPROTO_SMB, /* family */
+ CURLPROTO_SMB, /* family */
PROTOPT_SSL /* flags */
};
#endif
@@ -204,7 +204,7 @@ static void conn_state(struct connectdata *conn, enum smb_conn_state newstate)
static void request_state(struct connectdata *conn,
enum smb_req_state newstate)
{
- struct smb_request *req = conn->data->req.p.smb;
+ struct smb_request *req = conn->data->req.p.smb;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
/* For debug purposes */
static const char * const names[] = {
@@ -234,7 +234,7 @@ static CURLcode smb_setup_connection(struct connectdata *conn)
struct smb_request *req;
/* Initialize the request state */
- conn->data->req.p.smb = req = calloc(1, sizeof(struct smb_request));
+ conn->data->req.p.smb = req = calloc(1, sizeof(struct smb_request));
if(!req)
return CURLE_OUT_OF_MEMORY;
@@ -342,7 +342,7 @@ static void smb_format_message(struct connectdata *conn, struct smb_header *h,
unsigned char cmd, size_t len)
{
struct smb_conn *smbc = &conn->proto.smbc;
- struct smb_request *req = conn->data->req.p.smb;
+ struct smb_request *req = conn->data->req.p.smb;
unsigned int pid;
memset(h, 0, sizeof(*h));
@@ -505,7 +505,7 @@ static CURLcode smb_send_tree_connect(struct connectdata *conn)
static CURLcode smb_send_open(struct connectdata *conn)
{
- struct smb_request *req = conn->data->req.p.smb;
+ struct smb_request *req = conn->data->req.p.smb;
struct smb_nt_create msg;
size_t byte_count;
@@ -535,7 +535,7 @@ static CURLcode smb_send_open(struct connectdata *conn)
static CURLcode smb_send_close(struct connectdata *conn)
{
- struct smb_request *req = conn->data->req.p.smb;
+ struct smb_request *req = conn->data->req.p.smb;
struct smb_close msg;
memset(&msg, 0, sizeof(msg));
@@ -556,7 +556,7 @@ static CURLcode smb_send_tree_disconnect(struct connectdata *conn)
static CURLcode smb_send_read(struct connectdata *conn)
{
- struct smb_request *req = conn->data->req.p.smb;
+ struct smb_request *req = conn->data->req.p.smb;
curl_off_t offset = conn->data->req.offset;
struct smb_read msg;
@@ -575,7 +575,7 @@ static CURLcode smb_send_read(struct connectdata *conn)
static CURLcode smb_send_write(struct connectdata *conn)
{
struct smb_write *msg;
- struct smb_request *req = conn->data->req.p.smb;
+ struct smb_request *req = conn->data->req.p.smb;
curl_off_t offset = conn->data->req.offset;
curl_off_t upload_size = conn->data->req.size - conn->data->req.bytecount;
CURLcode result = Curl_get_upload_buffer(conn->data);
@@ -682,8 +682,8 @@ static CURLcode smb_connection_state(struct connectdata *conn, bool *done)
switch(smbc->state) {
case SMB_NEGOTIATE:
- if((smbc->got < sizeof(*nrsp) + sizeof(smbc->challenge) - 1) ||
- h->status) {
+ if((smbc->got < sizeof(*nrsp) + sizeof(smbc->challenge) - 1) ||
+ h->status) {
connclose(conn, "SMB: negotiation failed");
return CURLE_COULDNT_CONNECT;
}
@@ -738,7 +738,7 @@ static void get_posix_time(time_t *out, curl_off_t timestamp)
static CURLcode smb_request_state(struct connectdata *conn, bool *done)
{
- struct smb_request *req = conn->data->req.p.smb;
+ struct smb_request *req = conn->data->req.p.smb;
struct smb_header *h;
struct smb_conn *smbc = &conn->proto.smbc;
enum smb_req_state next_state = SMB_DONE;
@@ -923,7 +923,7 @@ static CURLcode smb_done(struct connectdata *conn, CURLcode status,
bool premature)
{
(void) premature;
- Curl_safefree(conn->data->req.p.smb);
+ Curl_safefree(conn->data->req.p.smb);
return status;
}
@@ -957,14 +957,14 @@ static CURLcode smb_do(struct connectdata *conn, bool *done)
static CURLcode smb_parse_url_path(struct connectdata *conn)
{
struct Curl_easy *data = conn->data;
- struct smb_request *req = data->req.p.smb;
+ struct smb_request *req = data->req.p.smb;
struct smb_conn *smbc = &conn->proto.smbc;
char *path;
char *slash;
/* URL decode the path */
CURLcode result = Curl_urldecode(data, data->state.up.path, 0, &path, NULL,
- REJECT_CTRL);
+ REJECT_CTRL);
if(result)
return result;
@@ -996,5 +996,5 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
return CURLE_OK;
}
-#endif /* CURL_DISABLE_SMB && USE_CURL_NTLM_CORE &&
- CURL_SIZEOF_CURL_OFF_T > 4 */
+#endif /* CURL_DISABLE_SMB && USE_CURL_NTLM_CORE &&
+ CURL_SIZEOF_CURL_OFF_T > 4 */
diff --git a/contrib/libs/curl/lib/smb.h b/contrib/libs/curl/lib/smb.h
index a3939eefe9..907cf0c8e2 100644
--- a/contrib/libs/curl/lib/smb.h
+++ b/contrib/libs/curl/lib/smb.h
@@ -8,11 +8,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2014, Bill Nagel <wnagel@tycoint.com>, Exacq Technologies
- * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -243,13 +243,13 @@ struct smb_tree_disconnect {
#endif /* BUILDING_CURL_SMB_C */
-#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
+#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
(CURL_SIZEOF_CURL_OFF_T > 4)
extern const struct Curl_handler Curl_handler_smb;
extern const struct Curl_handler Curl_handler_smbs;
-#endif /* CURL_DISABLE_SMB && USE_CURL_NTLM_CORE &&
- CURL_SIZEOF_CURL_OFF_T > 4 */
+#endif /* CURL_DISABLE_SMB && USE_CURL_NTLM_CORE &&
+ CURL_SIZEOF_CURL_OFF_T > 4 */
#endif /* HEADER_CURL_SMB_H */
diff --git a/contrib/libs/curl/lib/smtp.c b/contrib/libs/curl/lib/smtp.c
index 8c721262a4..509d802f1c 100644
--- a/contrib/libs/curl/lib/smtp.c
+++ b/contrib/libs/curl/lib/smtp.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -27,9 +27,9 @@
* RFC4752 The Kerberos V5 ("GSSAPI") SASL Mechanism
* RFC4954 SMTP Authentication
* RFC5321 SMTP protocol
- * RFC5890 Internationalized Domain Names for Applications (IDNA)
- * RFC6531 SMTP Extension for Internationalized Email
- * RFC6532 Internationalized Email Headers
+ * RFC5890 Internationalized Domain Names for Applications (IDNA)
+ * RFC6531 SMTP Extension for Internationalized Email
+ * RFC6532 Internationalized Email Headers
* RFC6749 OAuth 2.0 Authorization Framework
* RFC8314 Use of TLS for Email Submission and Access
* Draft SMTP URL Interface <draft-earhart-url-smtp-00.txt>
@@ -104,8 +104,8 @@ static CURLcode smtp_setup_connection(struct connectdata *conn);
static CURLcode smtp_parse_url_options(struct connectdata *conn);
static CURLcode smtp_parse_url_path(struct connectdata *conn);
static CURLcode smtp_parse_custom_request(struct connectdata *conn);
-static CURLcode smtp_parse_address(struct connectdata *conn, const char *fqma,
- char **address, struct hostname *host);
+static CURLcode smtp_parse_address(struct connectdata *conn, const char *fqma,
+ char **address, struct hostname *host);
static CURLcode smtp_perform_auth(struct connectdata *conn, const char *mech,
const char *initresp);
static CURLcode smtp_continue_auth(struct connectdata *conn, const char *resp);
@@ -133,7 +133,7 @@ const struct Curl_handler Curl_handler_smtp = {
ZERO_NULL, /* connection_check */
PORT_SMTP, /* defport */
CURLPROTO_SMTP, /* protocol */
- CURLPROTO_SMTP, /* family */
+ CURLPROTO_SMTP, /* family */
PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY | /* flags */
PROTOPT_URLOPTIONS
};
@@ -161,7 +161,7 @@ const struct Curl_handler Curl_handler_smtps = {
ZERO_NULL, /* connection_check */
PORT_SMTPS, /* defport */
CURLPROTO_SMTPS, /* protocol */
- CURLPROTO_SMTP, /* family */
+ CURLPROTO_SMTP, /* family */
PROTOPT_CLOSEACTION | PROTOPT_SSL
| PROTOPT_NOURLQUERY | PROTOPT_URLOPTIONS /* flags */
};
@@ -185,7 +185,7 @@ static void smtp_to_smtps(struct connectdata *conn)
conn->handler = &Curl_handler_smtps;
/* Set the connection's upgraded to TLS flag */
- conn->bits.tls_upgraded = TRUE;
+ conn->bits.tls_upgraded = TRUE;
}
#else
#define smtp_to_smtps(x) Curl_nop_stmt
@@ -486,57 +486,57 @@ static CURLcode smtp_perform_command(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
-
- if(smtp->rcpt) {
- /* We notify the server we are sending UTF-8 data if a) it supports the
- SMTPUTF8 extension and b) The mailbox contains UTF-8 charaacters, in
- either the local address or host name parts. This is regardless of
- whether the host name is encoded using IDN ACE */
- bool utf8 = FALSE;
-
- if((!smtp->custom) || (!smtp->custom[0])) {
- char *address = NULL;
- struct hostname host = { NULL, NULL, NULL, NULL };
-
- /* Parse the mailbox to verify into the local address and host name
- parts, converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, smtp->rcpt->data,
- &address, &host);
- if(result)
- return result;
-
- /* Establish whether we should report SMTPUTF8 to the server for this
- mailbox as per RFC-6531 sect. 3.1 point 6 */
- utf8 = (conn->proto.smtpc.utf8_supported) &&
- ((host.encalloc) || (!Curl_is_ASCII_name(address)) ||
- (!Curl_is_ASCII_name(host.name)));
-
- /* Send the VRFY command (Note: The host name part may be absent when the
- host is a local system) */
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "VRFY %s%s%s%s",
- address,
- host.name ? "@" : "",
- host.name ? host.name : "",
- utf8 ? " SMTPUTF8" : "");
-
- Curl_free_idnconverted_hostname(&host);
- free(address);
- }
- else {
- /* Establish whether we should report that we support SMTPUTF8 for EXPN
- commands to the server as per RFC-6531 sect. 3.1 point 6 */
- utf8 = (conn->proto.smtpc.utf8_supported) &&
- (!strcmp(smtp->custom, "EXPN"));
-
- /* Send the custom recipient based command such as the EXPN command */
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s %s%s", smtp->custom,
- smtp->rcpt->data,
- utf8 ? " SMTPUTF8" : "");
- }
- }
+ struct SMTP *smtp = data->req.p.smtp;
+
+ if(smtp->rcpt) {
+ /* We notify the server we are sending UTF-8 data if a) it supports the
+ SMTPUTF8 extension and b) The mailbox contains UTF-8 charaacters, in
+ either the local address or host name parts. This is regardless of
+ whether the host name is encoded using IDN ACE */
+ bool utf8 = FALSE;
+
+ if((!smtp->custom) || (!smtp->custom[0])) {
+ char *address = NULL;
+ struct hostname host = { NULL, NULL, NULL, NULL };
+
+ /* Parse the mailbox to verify into the local address and host name
+ parts, converting the host name to an IDN A-label if necessary */
+ result = smtp_parse_address(conn, smtp->rcpt->data,
+ &address, &host);
+ if(result)
+ return result;
+
+ /* Establish whether we should report SMTPUTF8 to the server for this
+ mailbox as per RFC-6531 sect. 3.1 point 6 */
+ utf8 = (conn->proto.smtpc.utf8_supported) &&
+ ((host.encalloc) || (!Curl_is_ASCII_name(address)) ||
+ (!Curl_is_ASCII_name(host.name)));
+
+ /* Send the VRFY command (Note: The host name part may be absent when the
+ host is a local system) */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "VRFY %s%s%s%s",
+ address,
+ host.name ? "@" : "",
+ host.name ? host.name : "",
+ utf8 ? " SMTPUTF8" : "");
+
+ Curl_free_idnconverted_hostname(&host);
+ free(address);
+ }
+ else {
+ /* Establish whether we should report that we support SMTPUTF8 for EXPN
+ commands to the server as per RFC-6531 sect. 3.1 point 6 */
+ utf8 = (conn->proto.smtpc.utf8_supported) &&
+ (!strcmp(smtp->custom, "EXPN"));
+
+ /* Send the custom recipient based command such as the EXPN command */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s %s%s", smtp->custom,
+ smtp->rcpt->data,
+ utf8 ? " SMTPUTF8" : "");
+ }
+ }
else
- /* Send the non-recipient based command such as HELP */
+ /* Send the non-recipient based command such as HELP */
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s",
smtp->custom && smtp->custom[0] != '\0' ?
smtp->custom : "HELP");
@@ -561,43 +561,43 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- /* We notify the server we are sending UTF-8 data if a) it supports the
- SMTPUTF8 extension and b) The mailbox contains UTF-8 charaacters, in
- either the local address or host name parts. This is regardless of
- whether the host name is encoded using IDN ACE */
- bool utf8 = FALSE;
-
+ /* We notify the server we are sending UTF-8 data if a) it supports the
+ SMTPUTF8 extension and b) The mailbox contains UTF-8 charaacters, in
+ either the local address or host name parts. This is regardless of
+ whether the host name is encoded using IDN ACE */
+ bool utf8 = FALSE;
+
/* Calculate the FROM parameter */
- if(data->set.str[STRING_MAIL_FROM]) {
- char *address = NULL;
- struct hostname host = { NULL, NULL, NULL, NULL };
-
- /* Parse the FROM mailbox into the local address and host name parts,
- converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, data->set.str[STRING_MAIL_FROM],
- &address, &host);
- if(result)
- return result;
-
- /* Establish whether we should report SMTPUTF8 to the server for this
- mailbox as per RFC-6531 sect. 3.1 point 4 and sect. 3.4 */
- utf8 = (conn->proto.smtpc.utf8_supported) &&
- ((host.encalloc) || (!Curl_is_ASCII_name(address)) ||
- (!Curl_is_ASCII_name(host.name)));
-
- if(host.name) {
- from = aprintf("<%s@%s>", address, host.name);
-
- Curl_free_idnconverted_hostname(&host);
- }
- else
- /* An invalid mailbox was provided but we'll simply let the server worry
- about that and reply with a 501 error */
- from = aprintf("<%s>", address);
-
- free(address);
- }
- else
+ if(data->set.str[STRING_MAIL_FROM]) {
+ char *address = NULL;
+ struct hostname host = { NULL, NULL, NULL, NULL };
+
+ /* Parse the FROM mailbox into the local address and host name parts,
+ converting the host name to an IDN A-label if necessary */
+ result = smtp_parse_address(conn, data->set.str[STRING_MAIL_FROM],
+ &address, &host);
+ if(result)
+ return result;
+
+ /* Establish whether we should report SMTPUTF8 to the server for this
+ mailbox as per RFC-6531 sect. 3.1 point 4 and sect. 3.4 */
+ utf8 = (conn->proto.smtpc.utf8_supported) &&
+ ((host.encalloc) || (!Curl_is_ASCII_name(address)) ||
+ (!Curl_is_ASCII_name(host.name)));
+
+ if(host.name) {
+ from = aprintf("<%s@%s>", address, host.name);
+
+ Curl_free_idnconverted_hostname(&host);
+ }
+ else
+ /* An invalid mailbox was provided but we'll simply let the server worry
+ about that and reply with a 501 error */
+ from = aprintf("<%s>", address);
+
+ free(address);
+ }
+ else
/* Null reverse-path, RFC-5321, sect. 3.6.3 */
from = strdup("<>");
@@ -606,38 +606,38 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
/* Calculate the optional AUTH parameter */
if(data->set.str[STRING_MAIL_AUTH] && conn->proto.smtpc.sasl.authused) {
- if(data->set.str[STRING_MAIL_AUTH][0] != '\0') {
- char *address = NULL;
- struct hostname host = { NULL, NULL, NULL, NULL };
-
- /* Parse the AUTH mailbox into the local address and host name parts,
- converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, data->set.str[STRING_MAIL_AUTH],
- &address, &host);
- if(result) {
- free(from);
- return result;
- }
-
- /* Establish whether we should report SMTPUTF8 to the server for this
- mailbox as per RFC-6531 sect. 3.1 point 4 and sect. 3.4 */
- if((!utf8) && (conn->proto.smtpc.utf8_supported) &&
- ((host.encalloc) || (!Curl_is_ASCII_name(address)) ||
- (!Curl_is_ASCII_name(host.name))))
- utf8 = TRUE;
-
- if(host.name) {
- auth = aprintf("<%s@%s>", address, host.name);
-
- Curl_free_idnconverted_hostname(&host);
- }
- else
- /* An invalid mailbox was provided but we'll simply let the server
- worry about it */
- auth = aprintf("<%s>", address);
-
- free(address);
- }
+ if(data->set.str[STRING_MAIL_AUTH][0] != '\0') {
+ char *address = NULL;
+ struct hostname host = { NULL, NULL, NULL, NULL };
+
+ /* Parse the AUTH mailbox into the local address and host name parts,
+ converting the host name to an IDN A-label if necessary */
+ result = smtp_parse_address(conn, data->set.str[STRING_MAIL_AUTH],
+ &address, &host);
+ if(result) {
+ free(from);
+ return result;
+ }
+
+ /* Establish whether we should report SMTPUTF8 to the server for this
+ mailbox as per RFC-6531 sect. 3.1 point 4 and sect. 3.4 */
+ if((!utf8) && (conn->proto.smtpc.utf8_supported) &&
+ ((host.encalloc) || (!Curl_is_ASCII_name(address)) ||
+ (!Curl_is_ASCII_name(host.name))))
+ utf8 = TRUE;
+
+ if(host.name) {
+ auth = aprintf("<%s@%s>", address, host.name);
+
+ Curl_free_idnconverted_hostname(&host);
+ }
+ else
+ /* An invalid mailbox was provided but we'll simply let the server
+ worry about it */
+ auth = aprintf("<%s>", address);
+
+ free(address);
+ }
else
/* Empty AUTH, RFC-2554, sect. 5 */
auth = strdup("<>");
@@ -671,7 +671,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
if(result) {
free(from);
free(auth);
-
+
return result;
}
@@ -694,33 +694,33 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
}
}
- /* If the mailboxes in the FROM and AUTH parameters don't include a UTF-8
- based address then quickly scan through the recipient list and check if
- any there do, as we need to correctly identify our support for SMTPUTF8
- in the envelope, as per RFC-6531 sect. 3.4 */
- if(conn->proto.smtpc.utf8_supported && !utf8) {
- struct SMTP *smtp = data->req.p.smtp;
- struct curl_slist *rcpt = smtp->rcpt;
-
- while(rcpt && !utf8) {
- /* Does the host name contain non-ASCII characters? */
- if(!Curl_is_ASCII_name(rcpt->data))
- utf8 = TRUE;
-
- rcpt = rcpt->next;
- }
- }
-
+ /* If the mailboxes in the FROM and AUTH parameters don't include a UTF-8
+ based address then quickly scan through the recipient list and check if
+ any there do, as we need to correctly identify our support for SMTPUTF8
+ in the envelope, as per RFC-6531 sect. 3.4 */
+ if(conn->proto.smtpc.utf8_supported && !utf8) {
+ struct SMTP *smtp = data->req.p.smtp;
+ struct curl_slist *rcpt = smtp->rcpt;
+
+ while(rcpt && !utf8) {
+ /* Does the host name contain non-ASCII characters? */
+ if(!Curl_is_ASCII_name(rcpt->data))
+ utf8 = TRUE;
+
+ rcpt = rcpt->next;
+ }
+ }
+
/* Send the MAIL command */
- result = Curl_pp_sendf(&conn->proto.smtpc.pp,
- "MAIL FROM:%s%s%s%s%s%s",
- from, /* Mandatory */
- auth ? " AUTH=" : "", /* Optional on AUTH support */
- auth ? auth : "", /* */
- size ? " SIZE=" : "", /* Optional on SIZE support */
- size ? size : "", /* */
- utf8 ? " SMTPUTF8" /* Internationalised mailbox */
- : ""); /* included in our envelope */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp,
+ "MAIL FROM:%s%s%s%s%s%s",
+ from, /* Mandatory */
+ auth ? " AUTH=" : "", /* Optional on AUTH support */
+ auth ? auth : "", /* */
+ size ? " SIZE=" : "", /* Optional on SIZE support */
+ size ? size : "", /* */
+ utf8 ? " SMTPUTF8" /* Internationalised mailbox */
+ : ""); /* included in our envelope */
free(from);
free(auth);
@@ -743,29 +743,29 @@ static CURLcode smtp_perform_rcpt_to(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
- char *address = NULL;
- struct hostname host = { NULL, NULL, NULL, NULL };
-
- /* Parse the recipient mailbox into the local address and host name parts,
- converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, smtp->rcpt->data,
- &address, &host);
- if(result)
- return result;
-
+ struct SMTP *smtp = data->req.p.smtp;
+ char *address = NULL;
+ struct hostname host = { NULL, NULL, NULL, NULL };
+
+ /* Parse the recipient mailbox into the local address and host name parts,
+ converting the host name to an IDN A-label if necessary */
+ result = smtp_parse_address(conn, smtp->rcpt->data,
+ &address, &host);
+ if(result)
+ return result;
+
/* Send the RCPT TO command */
- if(host.name)
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s@%s>", address,
- host.name);
+ if(host.name)
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s@%s>", address,
+ host.name);
else
- /* An invalid mailbox was provided but we'll simply let the server worry
- about that and reply with a 501 error */
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>", address);
-
- Curl_free_idnconverted_hostname(&host);
- free(address);
-
+ /* An invalid mailbox was provided but we'll simply let the server worry
+ about that and reply with a 501 error */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>", address);
+
+ Curl_free_idnconverted_hostname(&host);
+ free(address);
+
if(!result)
state(conn, SMTP_RCPT);
@@ -865,10 +865,10 @@ static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, int smtpcode,
else if(len >= 4 && !memcmp(line, "SIZE", 4))
smtpc->size_supported = TRUE;
- /* Does the server support the UTF-8 capability? */
- else if(len >= 8 && !memcmp(line, "SMTPUTF8", 8))
- smtpc->utf8_supported = TRUE;
-
+ /* Does the server support the UTF-8 capability? */
+ else if(len >= 8 && !memcmp(line, "SMTPUTF8", 8))
+ smtpc->utf8_supported = TRUE;
+
/* Does the server support authentication? */
else if(len >= 5 && !memcmp(line, "AUTH ", 5)) {
smtpc->auth_supported = TRUE;
@@ -991,7 +991,7 @@ static CURLcode smtp_state_command_resp(struct connectdata *conn, int smtpcode,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
+ struct SMTP *smtp = data->req.p.smtp;
char *line = data->state.buffer;
size_t len = strlen(line);
@@ -1057,54 +1057,54 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
- bool is_smtp_err = FALSE;
- bool is_smtp_blocking_err = FALSE;
+ struct SMTP *smtp = data->req.p.smtp;
+ bool is_smtp_err = FALSE;
+ bool is_smtp_blocking_err = FALSE;
(void)instate; /* no use for this yet */
- is_smtp_err = (smtpcode/100 != 2) ? TRUE : FALSE;
-
- /* If there's multiple RCPT TO to be issued, it's possible to ignore errors
- and proceed with only the valid addresses. */
- is_smtp_blocking_err =
- (is_smtp_err && !data->set.mail_rcpt_allowfails) ? TRUE : FALSE;
-
- if(is_smtp_err) {
- /* Remembering the last failure which we can report if all "RCPT TO" have
- failed and we cannot proceed. */
- smtp->rcpt_last_error = smtpcode;
-
- if(is_smtp_blocking_err) {
- failf(data, "RCPT failed: %d", smtpcode);
- result = CURLE_SEND_ERROR;
- }
+ is_smtp_err = (smtpcode/100 != 2) ? TRUE : FALSE;
+
+ /* If there's multiple RCPT TO to be issued, it's possible to ignore errors
+ and proceed with only the valid addresses. */
+ is_smtp_blocking_err =
+ (is_smtp_err && !data->set.mail_rcpt_allowfails) ? TRUE : FALSE;
+
+ if(is_smtp_err) {
+ /* Remembering the last failure which we can report if all "RCPT TO" have
+ failed and we cannot proceed. */
+ smtp->rcpt_last_error = smtpcode;
+
+ if(is_smtp_blocking_err) {
+ failf(data, "RCPT failed: %d", smtpcode);
+ result = CURLE_SEND_ERROR;
+ }
}
else {
- /* Some RCPT TO commands have succeeded. */
- smtp->rcpt_had_ok = TRUE;
- }
-
- if(!is_smtp_blocking_err) {
+ /* Some RCPT TO commands have succeeded. */
+ smtp->rcpt_had_ok = TRUE;
+ }
+
+ if(!is_smtp_blocking_err) {
smtp->rcpt = smtp->rcpt->next;
if(smtp->rcpt)
/* Send the next RCPT TO command */
result = smtp_perform_rcpt_to(conn);
else {
- /* We weren't able to issue a successful RCPT TO command while going
- over recipients (potentially multiple). Sending back last error. */
- if(!smtp->rcpt_had_ok) {
- failf(data, "RCPT failed: %d (last error)", smtp->rcpt_last_error);
- result = CURLE_SEND_ERROR;
- }
- else {
- /* Send the DATA command */
- result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "DATA");
-
- if(!result)
- state(conn, SMTP_DATA);
- }
+ /* We weren't able to issue a successful RCPT TO command while going
+ over recipients (potentially multiple). Sending back last error. */
+ if(!smtp->rcpt_had_ok) {
+ failf(data, "RCPT failed: %d (last error)", smtp->rcpt_last_error);
+ result = CURLE_SEND_ERROR;
+ }
+ else {
+ /* Send the DATA command */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "DATA");
+
+ if(!result)
+ state(conn, SMTP_DATA);
+ }
}
}
@@ -1280,7 +1280,7 @@ static CURLcode smtp_init(struct connectdata *conn)
struct Curl_easy *data = conn->data;
struct SMTP *smtp;
- smtp = data->req.p.smtp = calloc(sizeof(struct SMTP), 1);
+ smtp = data->req.p.smtp = calloc(sizeof(struct SMTP), 1);
if(!smtp)
result = CURLE_OUT_OF_MEMORY;
@@ -1324,7 +1324,7 @@ static CURLcode smtp_connect(struct connectdata *conn, bool *done)
Curl_sasl_init(&smtpc->sasl, &saslsmtp);
/* Initialise the pingpong layer */
- Curl_pp_setup(pp);
+ Curl_pp_setup(pp);
Curl_pp_init(pp);
/* Parse the URL options */
@@ -1359,7 +1359,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
+ struct SMTP *smtp = data->req.p.smtp;
struct pingpong *pp = &conn->proto.smtpc.pp;
char *eob;
ssize_t len;
@@ -1445,7 +1445,7 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected,
/* This is SMTP and no proxy */
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
+ struct SMTP *smtp = data->req.p.smtp;
DEBUGF(infof(conn->data, "DO phase starts\n"));
@@ -1459,12 +1459,12 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected,
/* Store the first recipient (or NULL if not specified) */
smtp->rcpt = data->set.mail_rcpt;
- /* Track of whether we've successfully sent at least one RCPT TO command */
- smtp->rcpt_had_ok = FALSE;
-
- /* Track of the last error we've received by sending RCPT TO command */
- smtp->rcpt_last_error = 0;
-
+ /* Track of whether we've successfully sent at least one RCPT TO command */
+ smtp->rcpt_had_ok = FALSE;
+
+ /* Track of the last error we've received by sending RCPT TO command */
+ smtp->rcpt_last_error = 0;
+
/* Initial data character is the first character in line: it is implicitly
preceded by a virtual CRLF. */
smtp->trailing_crlf = TRUE;
@@ -1553,7 +1553,7 @@ static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection)
/* Call this when the DO phase has completed */
static CURLcode smtp_dophase_done(struct connectdata *conn, bool connected)
{
- struct SMTP *smtp = conn->data->req.p.smtp;
+ struct SMTP *smtp = conn->data->req.p.smtp;
(void)connected;
@@ -1620,7 +1620,7 @@ static CURLcode smtp_setup_connection(struct connectdata *conn)
CURLcode result;
/* Clear the TLS upgraded flag */
- conn->bits.tls_upgraded = FALSE;
+ conn->bits.tls_upgraded = FALSE;
/* Initialise the SMTP layer */
result = smtp_init(conn);
@@ -1692,8 +1692,8 @@ static CURLcode smtp_parse_url_path(struct connectdata *conn)
}
/* URL decode the path and use it as the domain in our EHLO */
- return Curl_urldecode(conn->data, path, 0, &smtpc->domain, NULL,
- REJECT_CTRL);
+ return Curl_urldecode(conn->data, path, 0, &smtpc->domain, NULL,
+ REJECT_CTRL);
}
/***********************************************************************
@@ -1706,88 +1706,88 @@ static CURLcode smtp_parse_custom_request(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
+ struct SMTP *smtp = data->req.p.smtp;
const char *custom = data->set.str[STRING_CUSTOMREQUEST];
/* URL decode the custom request */
if(custom)
- result = Curl_urldecode(data, custom, 0, &smtp->custom, NULL, REJECT_CTRL);
+ result = Curl_urldecode(data, custom, 0, &smtp->custom, NULL, REJECT_CTRL);
+
+ return result;
+}
+
+/***********************************************************************
+ *
+ * smtp_parse_address()
+ *
+ * Parse the fully qualified mailbox address into a local address part and the
+ * host name, converting the host name to an IDN A-label, as per RFC-5890, if
+ * necessary.
+ *
+ * Parameters:
+ *
+ * conn [in] - The connection handle.
+ * fqma [in] - The fully qualified mailbox address (which may or
+ * may not contain UTF-8 characters).
+ * address [in/out] - A new allocated buffer which holds the local
+ * address part of the mailbox. This buffer must be
+ * free'ed by the caller.
+ * host [in/out] - The host name structure that holds the original,
+ * and optionally encoded, host name.
+ * Curl_free_idnconverted_hostname() must be called
+ * once the caller has finished with the structure.
+ *
+ * Returns CURLE_OK on success.
+ *
+ * Notes:
+ *
+ * Should a UTF-8 host name require conversion to IDN ACE and we cannot honor
+ * that conversion then we shall return success. This allow the caller to send
+ * the data to the server as a U-label (as per RFC-6531 sect. 3.2).
+ *
+ * If an mailbox '@' separator cannot be located then the mailbox is considered
+ * to be either a local mailbox or an invalid mailbox (depending on what the
+ * calling function deems it to be) then the input will simply be returned in
+ * the address part with the host name being NULL.
+ */
+static CURLcode smtp_parse_address(struct connectdata *conn, const char *fqma,
+ char **address, struct hostname *host)
+{
+ CURLcode result = CURLE_OK;
+ size_t length;
+
+ /* Duplicate the fully qualified email address so we can manipulate it,
+ ensuring it doesn't contain the delimiters if specified */
+ char *dup = strdup(fqma[0] == '<' ? fqma + 1 : fqma);
+ if(!dup)
+ return CURLE_OUT_OF_MEMORY;
+
+ length = strlen(dup);
+ if(length) {
+ if(dup[length - 1] == '>')
+ dup[length - 1] = '\0';
+ }
+
+ /* Extract the host name from the address (if we can) */
+ host->name = strpbrk(dup, "@");
+ if(host->name) {
+ *host->name = '\0';
+ host->name = host->name + 1;
+
+ /* Attempt to convert the host name to IDN ACE */
+ (void) Curl_idnconvert_hostname(conn, host);
+
+ /* If Curl_idnconvert_hostname() fails then we shall attempt to continue
+ and send the host name using UTF-8 rather than as 7-bit ACE (which is
+ our preference) */
+ }
+
+ /* Extract the local address from the mailbox */
+ *address = dup;
return result;
}
-/***********************************************************************
- *
- * smtp_parse_address()
- *
- * Parse the fully qualified mailbox address into a local address part and the
- * host name, converting the host name to an IDN A-label, as per RFC-5890, if
- * necessary.
- *
- * Parameters:
- *
- * conn [in] - The connection handle.
- * fqma [in] - The fully qualified mailbox address (which may or
- * may not contain UTF-8 characters).
- * address [in/out] - A new allocated buffer which holds the local
- * address part of the mailbox. This buffer must be
- * free'ed by the caller.
- * host [in/out] - The host name structure that holds the original,
- * and optionally encoded, host name.
- * Curl_free_idnconverted_hostname() must be called
- * once the caller has finished with the structure.
- *
- * Returns CURLE_OK on success.
- *
- * Notes:
- *
- * Should a UTF-8 host name require conversion to IDN ACE and we cannot honor
- * that conversion then we shall return success. This allow the caller to send
- * the data to the server as a U-label (as per RFC-6531 sect. 3.2).
- *
- * If an mailbox '@' separator cannot be located then the mailbox is considered
- * to be either a local mailbox or an invalid mailbox (depending on what the
- * calling function deems it to be) then the input will simply be returned in
- * the address part with the host name being NULL.
- */
-static CURLcode smtp_parse_address(struct connectdata *conn, const char *fqma,
- char **address, struct hostname *host)
-{
- CURLcode result = CURLE_OK;
- size_t length;
-
- /* Duplicate the fully qualified email address so we can manipulate it,
- ensuring it doesn't contain the delimiters if specified */
- char *dup = strdup(fqma[0] == '<' ? fqma + 1 : fqma);
- if(!dup)
- return CURLE_OUT_OF_MEMORY;
-
- length = strlen(dup);
- if(length) {
- if(dup[length - 1] == '>')
- dup[length - 1] = '\0';
- }
-
- /* Extract the host name from the address (if we can) */
- host->name = strpbrk(dup, "@");
- if(host->name) {
- *host->name = '\0';
- host->name = host->name + 1;
-
- /* Attempt to convert the host name to IDN ACE */
- (void) Curl_idnconvert_hostname(conn, host);
-
- /* If Curl_idnconvert_hostname() fails then we shall attempt to continue
- and send the host name using UTF-8 rather than as 7-bit ACE (which is
- our preference) */
- }
-
- /* Extract the local address from the mailbox */
- *address = dup;
-
- return result;
-}
-
CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)
{
/* When sending a SMTP payload we must detect CRLF. sequences making sure
@@ -1799,7 +1799,7 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)
ssize_t i;
ssize_t si;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.p.smtp;
+ struct SMTP *smtp = data->req.p.smtp;
char *scratch = data->state.scratch;
char *newscratch = NULL;
char *oldscratch = NULL;
diff --git a/contrib/libs/curl/lib/smtp.h b/contrib/libs/curl/lib/smtp.h
index 0456d1b02d..c7c62ee857 100644
--- a/contrib/libs/curl/lib/smtp.h
+++ b/contrib/libs/curl/lib/smtp.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2009 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2009 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -55,9 +55,9 @@ struct SMTP {
curl_pp_transfer transfer;
char *custom; /* Custom Request */
struct curl_slist *rcpt; /* Recipient list */
- bool rcpt_had_ok; /* Whether any of RCPT TO commands (depends on
- total number of recipients) succeeded so far */
- int rcpt_last_error; /* The last error received for RCPT TO command */
+ bool rcpt_had_ok; /* Whether any of RCPT TO commands (depends on
+ total number of recipients) succeeded so far */
+ int rcpt_last_error; /* The last error received for RCPT TO command */
size_t eob; /* Number of bytes of the EOB (End Of Body) that
have been received so far */
bool trailing_crlf; /* Specifies if the tailing CRLF is present */
@@ -74,8 +74,8 @@ struct smtp_conn {
bool tls_supported; /* StartTLS capability supported by server */
bool size_supported; /* If server supports SIZE extension according to
RFC 1870 */
- bool utf8_supported; /* If server supports SMTPUTF8 extension according
- to RFC 6531 */
+ bool utf8_supported; /* If server supports SMTPUTF8 extension according
+ to RFC 6531 */
bool auth_supported; /* AUTH capability supported by server */
};
diff --git a/contrib/libs/curl/lib/sockaddr.h b/contrib/libs/curl/lib/sockaddr.h
index 6c89eeac71..84c08d9bb5 100644
--- a/contrib/libs/curl/lib/sockaddr.h
+++ b/contrib/libs/curl/lib/sockaddr.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/socketpair.c b/contrib/libs/curl/lib/socketpair.c
index 184630617a..2c580ad2de 100644
--- a/contrib/libs/curl/lib/socketpair.c
+++ b/contrib/libs/curl/lib/socketpair.c
@@ -1,121 +1,121 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "socketpair.h"
-
-#if !defined(HAVE_SOCKETPAIR) && !defined(CURL_DISABLE_SOCKETPAIR)
-#ifdef WIN32
-/*
- * This is a socketpair() implementation for Windows.
- */
-#include <string.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <windows.h>
-#include <io.h>
-#else
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h> /* IPPROTO_TCP */
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK 0x7f000001
-#endif /* !INADDR_LOOPBACK */
-#endif /* !WIN32 */
-
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
-#include "curl_memory.h"
-#include "memdebug.h"
-
-int Curl_socketpair(int domain, int type, int protocol,
- curl_socket_t socks[2])
-{
- union {
- struct sockaddr_in inaddr;
- struct sockaddr addr;
- } a;
- curl_socket_t listener;
- curl_socklen_t addrlen = sizeof(a.inaddr);
- int reuse = 1;
- char data[2][12];
- ssize_t dlen;
- (void)domain;
- (void)type;
- (void)protocol;
-
- listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if(listener == CURL_SOCKET_BAD)
- return -1;
-
- memset(&a, 0, sizeof(a));
- a.inaddr.sin_family = AF_INET;
- a.inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- a.inaddr.sin_port = 0;
-
- socks[0] = socks[1] = CURL_SOCKET_BAD;
-
- if(setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,
- (char *)&reuse, (curl_socklen_t)sizeof(reuse)) == -1)
- goto error;
- if(bind(listener, &a.addr, sizeof(a.inaddr)) == -1)
- goto error;
- if(getsockname(listener, &a.addr, &addrlen) == -1)
- goto error;
- if(listen(listener, 1) == -1)
- goto error;
- socks[0] = socket(AF_INET, SOCK_STREAM, 0);
- if(socks[0] == CURL_SOCKET_BAD)
- goto error;
- if(connect(socks[0], &a.addr, sizeof(a.inaddr)) == -1)
- goto error;
- socks[1] = accept(listener, NULL, NULL);
- if(socks[1] == CURL_SOCKET_BAD)
- goto error;
-
- /* verify that nothing else connected */
- msnprintf(data[0], sizeof(data[0]), "%p", socks);
- dlen = strlen(data[0]);
- if(swrite(socks[0], data[0], dlen) != dlen)
- goto error;
- if(sread(socks[1], data[1], sizeof(data[1])) != dlen)
- goto error;
- if(memcmp(data[0], data[1], dlen))
- goto error;
-
- sclose(listener);
- return 0;
-
- error:
- sclose(listener);
- sclose(socks[0]);
- sclose(socks[1]);
- return -1;
-}
-
-#endif /* ! HAVE_SOCKETPAIR */
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "socketpair.h"
+
+#if !defined(HAVE_SOCKETPAIR) && !defined(CURL_DISABLE_SOCKETPAIR)
+#ifdef WIN32
+/*
+ * This is a socketpair() implementation for Windows.
+ */
+#include <string.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <windows.h>
+#include <io.h>
+#else
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h> /* IPPROTO_TCP */
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifndef INADDR_LOOPBACK
+#define INADDR_LOOPBACK 0x7f000001
+#endif /* !INADDR_LOOPBACK */
+#endif /* !WIN32 */
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "memdebug.h"
+
+int Curl_socketpair(int domain, int type, int protocol,
+ curl_socket_t socks[2])
+{
+ union {
+ struct sockaddr_in inaddr;
+ struct sockaddr addr;
+ } a;
+ curl_socket_t listener;
+ curl_socklen_t addrlen = sizeof(a.inaddr);
+ int reuse = 1;
+ char data[2][12];
+ ssize_t dlen;
+ (void)domain;
+ (void)type;
+ (void)protocol;
+
+ listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ if(listener == CURL_SOCKET_BAD)
+ return -1;
+
+ memset(&a, 0, sizeof(a));
+ a.inaddr.sin_family = AF_INET;
+ a.inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ a.inaddr.sin_port = 0;
+
+ socks[0] = socks[1] = CURL_SOCKET_BAD;
+
+ if(setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,
+ (char *)&reuse, (curl_socklen_t)sizeof(reuse)) == -1)
+ goto error;
+ if(bind(listener, &a.addr, sizeof(a.inaddr)) == -1)
+ goto error;
+ if(getsockname(listener, &a.addr, &addrlen) == -1)
+ goto error;
+ if(listen(listener, 1) == -1)
+ goto error;
+ socks[0] = socket(AF_INET, SOCK_STREAM, 0);
+ if(socks[0] == CURL_SOCKET_BAD)
+ goto error;
+ if(connect(socks[0], &a.addr, sizeof(a.inaddr)) == -1)
+ goto error;
+ socks[1] = accept(listener, NULL, NULL);
+ if(socks[1] == CURL_SOCKET_BAD)
+ goto error;
+
+ /* verify that nothing else connected */
+ msnprintf(data[0], sizeof(data[0]), "%p", socks);
+ dlen = strlen(data[0]);
+ if(swrite(socks[0], data[0], dlen) != dlen)
+ goto error;
+ if(sread(socks[1], data[1], sizeof(data[1])) != dlen)
+ goto error;
+ if(memcmp(data[0], data[1], dlen))
+ goto error;
+
+ sclose(listener);
+ return 0;
+
+ error:
+ sclose(listener);
+ sclose(socks[0]);
+ sclose(socks[1]);
+ return -1;
+}
+
+#endif /* ! HAVE_SOCKETPAIR */
diff --git a/contrib/libs/curl/lib/socketpair.h b/contrib/libs/curl/lib/socketpair.h
index 3c666d0dda..033a235aa2 100644
--- a/contrib/libs/curl/lib/socketpair.h
+++ b/contrib/libs/curl/lib/socketpair.h
@@ -1,36 +1,36 @@
-#ifndef HEADER_CURL_SOCKETPAIR_H
-#define HEADER_CURL_SOCKETPAIR_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
-#ifndef HAVE_SOCKETPAIR
-int Curl_socketpair(int domain, int type, int protocol,
- curl_socket_t socks[2]);
-#else
-#define Curl_socketpair(a,b,c,d) socketpair(a,b,c,d)
-#endif
-
-/* Defined here to allow specific build configs to disable it completely */
-#define USE_SOCKETPAIR 1
-
-#endif /* HEADER_CURL_SOCKETPAIR_H */
+#ifndef HEADER_CURL_SOCKETPAIR_H
+#define HEADER_CURL_SOCKETPAIR_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
+#ifndef HAVE_SOCKETPAIR
+int Curl_socketpair(int domain, int type, int protocol,
+ curl_socket_t socks[2]);
+#else
+#define Curl_socketpair(a,b,c,d) socketpair(a,b,c,d)
+#endif
+
+/* Defined here to allow specific build configs to disable it completely */
+#define USE_SOCKETPAIR 1
+
+#endif /* HEADER_CURL_SOCKETPAIR_H */
diff --git a/contrib/libs/curl/lib/socks.c b/contrib/libs/curl/lib/socks.c
index 45c16fcdca..a2d1e621f9 100644
--- a/contrib/libs/curl/lib/socks.c
+++ b/contrib/libs/curl/lib/socks.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -37,19 +37,19 @@
#include "connect.h"
#include "timeval.h"
#include "socks.h"
-#include "multiif.h" /* for getsock macros */
+#include "multiif.h" /* for getsock macros */
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
-#include "curl_memory.h"
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
#include "memdebug.h"
-#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
+#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
/*
* Helper read-from-socket functions. Does the same as Curl_read() but it
* blocks until all bytes amount of buffersize will be read. No more, no less.
*
- * This is STUPID BLOCKING behavior. Only used by the SOCKS GSSAPI functions.
+ * This is STUPID BLOCKING behavior. Only used by the SOCKS GSSAPI functions.
*/
int Curl_blockread_all(struct connectdata *conn, /* connection data */
curl_socket_t sockfd, /* read from this socket */
@@ -62,15 +62,15 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */
int result;
*n = 0;
for(;;) {
- timediff_t timeout_ms = Curl_timeleft(conn->data, NULL, TRUE);
- if(timeout_ms < 0) {
+ timediff_t timeout_ms = Curl_timeleft(conn->data, NULL, TRUE);
+ if(timeout_ms < 0) {
/* we already got the timeout */
result = CURLE_OPERATION_TIMEDOUT;
break;
}
- if(!timeout_ms)
- timeout_ms = TIMEDIFF_T_MAX;
- if(SOCKET_READABLE(sockfd, timeout_ms) <= 0) {
+ if(!timeout_ms)
+ timeout_ms = TIMEDIFF_T_MAX;
+ if(SOCKET_READABLE(sockfd, timeout_ms) <= 0) {
result = ~CURLE_OK;
break;
}
@@ -97,82 +97,82 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */
}
return result;
}
-#endif
-
-#ifndef DEBUGBUILD
-#define sxstate(x,y) socksstate(x,y)
-#else
-#define sxstate(x,y) socksstate(x,y, __LINE__)
-#endif
-
-
-/* always use this function to change state, to make debugging easier */
-static void socksstate(struct connectdata *conn,
- enum connect_t state
-#ifdef DEBUGBUILD
- , int lineno
-#endif
-)
-{
- enum connect_t oldstate = conn->cnnct.state;
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
- /* synced with the state list in urldata.h */
- static const char * const statename[] = {
- "INIT",
- "SOCKS_INIT",
- "SOCKS_SEND",
- "SOCKS_READ_INIT",
- "SOCKS_READ",
- "GSSAPI_INIT",
- "AUTH_INIT",
- "AUTH_SEND",
- "AUTH_READ",
- "REQ_INIT",
- "RESOLVING",
- "RESOLVED",
- "RESOLVE_REMOTE",
- "REQ_SEND",
- "REQ_SENDING",
- "REQ_READ",
- "REQ_READ_MORE",
- "DONE"
- };
-#endif
-
- if(oldstate == state)
- /* don't bother when the new state is the same as the old state */
- return;
-
- conn->cnnct.state = state;
-
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
- infof(conn->data,
- "SXSTATE: %s => %s conn %p; line %d\n",
- statename[oldstate], statename[conn->cnnct.state], conn,
- lineno);
-#endif
-}
-
-int Curl_SOCKS_getsock(struct connectdata *conn, curl_socket_t *sock,
- int sockindex)
-{
- int rc = 0;
- sock[0] = conn->sock[sockindex];
- switch(conn->cnnct.state) {
- case CONNECT_RESOLVING:
- case CONNECT_SOCKS_READ:
- case CONNECT_AUTH_READ:
- case CONNECT_REQ_READ:
- case CONNECT_REQ_READ_MORE:
- rc = GETSOCK_READSOCK(0);
- break;
- default:
- rc = GETSOCK_WRITESOCK(0);
- break;
- }
- return rc;
-}
-
+#endif
+
+#ifndef DEBUGBUILD
+#define sxstate(x,y) socksstate(x,y)
+#else
+#define sxstate(x,y) socksstate(x,y, __LINE__)
+#endif
+
+
+/* always use this function to change state, to make debugging easier */
+static void socksstate(struct connectdata *conn,
+ enum connect_t state
+#ifdef DEBUGBUILD
+ , int lineno
+#endif
+)
+{
+ enum connect_t oldstate = conn->cnnct.state;
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+ /* synced with the state list in urldata.h */
+ static const char * const statename[] = {
+ "INIT",
+ "SOCKS_INIT",
+ "SOCKS_SEND",
+ "SOCKS_READ_INIT",
+ "SOCKS_READ",
+ "GSSAPI_INIT",
+ "AUTH_INIT",
+ "AUTH_SEND",
+ "AUTH_READ",
+ "REQ_INIT",
+ "RESOLVING",
+ "RESOLVED",
+ "RESOLVE_REMOTE",
+ "REQ_SEND",
+ "REQ_SENDING",
+ "REQ_READ",
+ "REQ_READ_MORE",
+ "DONE"
+ };
+#endif
+
+ if(oldstate == state)
+ /* don't bother when the new state is the same as the old state */
+ return;
+
+ conn->cnnct.state = state;
+
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+ infof(conn->data,
+ "SXSTATE: %s => %s conn %p; line %d\n",
+ statename[oldstate], statename[conn->cnnct.state], conn,
+ lineno);
+#endif
+}
+
+int Curl_SOCKS_getsock(struct connectdata *conn, curl_socket_t *sock,
+ int sockindex)
+{
+ int rc = 0;
+ sock[0] = conn->sock[sockindex];
+ switch(conn->cnnct.state) {
+ case CONNECT_RESOLVING:
+ case CONNECT_SOCKS_READ:
+ case CONNECT_AUTH_READ:
+ case CONNECT_REQ_READ:
+ case CONNECT_REQ_READ_MORE:
+ rc = GETSOCK_READSOCK(0);
+ break;
+ default:
+ rc = GETSOCK_WRITESOCK(0);
+ break;
+ }
+ return rc;
+}
+
/*
* This function logs in to a SOCKS4 proxy and sends the specifics to the final
* destination server.
@@ -184,98 +184,98 @@ int Curl_SOCKS_getsock(struct connectdata *conn, curl_socket_t *sock,
* Set protocol4a=true for "SOCKS 4A (Simple Extension to SOCKS 4 Protocol)"
* Nonsupport "Identification Protocol (RFC1413)"
*/
-CURLproxycode Curl_SOCKS4(const char *proxy_user,
- const char *hostname,
- int remote_port,
- int sockindex,
- struct connectdata *conn,
- bool *done)
+CURLproxycode Curl_SOCKS4(const char *proxy_user,
+ const char *hostname,
+ int remote_port,
+ int sockindex,
+ struct connectdata *conn,
+ bool *done)
{
const bool protocol4a =
(conn->socks_proxy.proxytype == CURLPROXY_SOCKS4A) ? TRUE : FALSE;
- unsigned char *socksreq = &conn->cnnct.socksreq[0];
- CURLcode result;
- curl_socket_t sockfd = conn->sock[sockindex];
+ unsigned char *socksreq = &conn->cnnct.socksreq[0];
+ CURLcode result;
+ curl_socket_t sockfd = conn->sock[sockindex];
struct Curl_easy *data = conn->data;
- struct connstate *sx = &conn->cnnct;
- struct Curl_dns_entry *dns = NULL;
- ssize_t actualread;
- ssize_t written;
-
- if(!SOCKS_STATE(sx->state) && !*done)
- sxstate(conn, CONNECT_SOCKS_INIT);
-
- switch(sx->state) {
- case CONNECT_SOCKS_INIT:
- /* SOCKS4 can only do IPv4, insist! */
- conn->ip_version = CURL_IPRESOLVE_V4;
- if(conn->bits.httpproxy)
- infof(conn->data, "SOCKS4%s: connecting to HTTP proxy %s port %d\n",
- protocol4a ? "a" : "", hostname, remote_port);
-
- infof(data, "SOCKS4 communication to %s:%d\n", hostname, remote_port);
-
- /*
- * Compose socks4 request
- *
- * Request format
- *
- * +----+----+----+----+----+----+----+----+----+----+....+----+
- * | VN | CD | DSTPORT | DSTIP | USERID |NULL|
- * +----+----+----+----+----+----+----+----+----+----+....+----+
- * # of bytes: 1 1 2 4 variable 1
- */
-
- socksreq[0] = 4; /* version (SOCKS4) */
- socksreq[1] = 1; /* connect */
- socksreq[2] = (unsigned char)((remote_port >> 8) & 0xff); /* PORT MSB */
- socksreq[3] = (unsigned char)(remote_port & 0xff); /* PORT LSB */
-
- /* DNS resolve only for SOCKS4, not SOCKS4a */
- if(!protocol4a) {
- enum resolve_t rc =
- Curl_resolv(conn, hostname, remote_port, FALSE, &dns);
-
- if(rc == CURLRESOLV_ERROR)
- return CURLPX_RESOLVE_HOST;
- else if(rc == CURLRESOLV_PENDING) {
- sxstate(conn, CONNECT_RESOLVING);
- infof(data, "SOCKS4 non-blocking resolve of %s\n", hostname);
- return CURLPX_OK;
- }
- sxstate(conn, CONNECT_RESOLVED);
- goto CONNECT_RESOLVED;
- }
-
- /* socks4a doesn't resolve anything locally */
- sxstate(conn, CONNECT_REQ_INIT);
- goto CONNECT_REQ_INIT;
-
- case CONNECT_RESOLVING:
- /* check if we have the name resolved by now */
- dns = Curl_fetch_addr(conn, hostname, (int)conn->port);
-
- if(dns) {
-#ifdef CURLRES_ASYNCH
- conn->async.dns = dns;
- conn->async.done = TRUE;
-#endif
- infof(data, "Hostname '%s' was found\n", hostname);
- sxstate(conn, CONNECT_RESOLVED);
- }
- else {
- result = Curl_resolv_check(data->conn, &dns);
- if(!dns) {
- if(result)
- return CURLPX_RESOLVE_HOST;
- return CURLPX_OK;
- }
- }
- /* FALLTHROUGH */
- CONNECT_RESOLVED:
- case CONNECT_RESOLVED: {
- struct Curl_addrinfo *hp = NULL;
- char buf[64];
+ struct connstate *sx = &conn->cnnct;
+ struct Curl_dns_entry *dns = NULL;
+ ssize_t actualread;
+ ssize_t written;
+
+ if(!SOCKS_STATE(sx->state) && !*done)
+ sxstate(conn, CONNECT_SOCKS_INIT);
+
+ switch(sx->state) {
+ case CONNECT_SOCKS_INIT:
+ /* SOCKS4 can only do IPv4, insist! */
+ conn->ip_version = CURL_IPRESOLVE_V4;
+ if(conn->bits.httpproxy)
+ infof(conn->data, "SOCKS4%s: connecting to HTTP proxy %s port %d\n",
+ protocol4a ? "a" : "", hostname, remote_port);
+
+ infof(data, "SOCKS4 communication to %s:%d\n", hostname, remote_port);
+
+ /*
+ * Compose socks4 request
+ *
+ * Request format
+ *
+ * +----+----+----+----+----+----+----+----+----+----+....+----+
+ * | VN | CD | DSTPORT | DSTIP | USERID |NULL|
+ * +----+----+----+----+----+----+----+----+----+----+....+----+
+ * # of bytes: 1 1 2 4 variable 1
+ */
+
+ socksreq[0] = 4; /* version (SOCKS4) */
+ socksreq[1] = 1; /* connect */
+ socksreq[2] = (unsigned char)((remote_port >> 8) & 0xff); /* PORT MSB */
+ socksreq[3] = (unsigned char)(remote_port & 0xff); /* PORT LSB */
+
+ /* DNS resolve only for SOCKS4, not SOCKS4a */
+ if(!protocol4a) {
+ enum resolve_t rc =
+ Curl_resolv(conn, hostname, remote_port, FALSE, &dns);
+
+ if(rc == CURLRESOLV_ERROR)
+ return CURLPX_RESOLVE_HOST;
+ else if(rc == CURLRESOLV_PENDING) {
+ sxstate(conn, CONNECT_RESOLVING);
+ infof(data, "SOCKS4 non-blocking resolve of %s\n", hostname);
+ return CURLPX_OK;
+ }
+ sxstate(conn, CONNECT_RESOLVED);
+ goto CONNECT_RESOLVED;
+ }
+
+ /* socks4a doesn't resolve anything locally */
+ sxstate(conn, CONNECT_REQ_INIT);
+ goto CONNECT_REQ_INIT;
+
+ case CONNECT_RESOLVING:
+ /* check if we have the name resolved by now */
+ dns = Curl_fetch_addr(conn, hostname, (int)conn->port);
+
+ if(dns) {
+#ifdef CURLRES_ASYNCH
+ conn->async.dns = dns;
+ conn->async.done = TRUE;
+#endif
+ infof(data, "Hostname '%s' was found\n", hostname);
+ sxstate(conn, CONNECT_RESOLVED);
+ }
+ else {
+ result = Curl_resolv_check(data->conn, &dns);
+ if(!dns) {
+ if(result)
+ return CURLPX_RESOLVE_HOST;
+ return CURLPX_OK;
+ }
+ }
+ /* FALLTHROUGH */
+ CONNECT_RESOLVED:
+ case CONNECT_RESOLVED: {
+ struct Curl_addrinfo *hp = NULL;
+ char buf[64];
/*
* We cannot use 'hostent' as a struct that Curl_resolv() returns. It
* returns a Curl_addrinfo pointer that may not always look the same.
@@ -306,188 +306,188 @@ CURLproxycode Curl_SOCKS4(const char *proxy_user,
if(!hp) {
failf(data, "Failed to resolve \"%s\" for SOCKS4 connect.",
hostname);
- return CURLPX_RESOLVE_HOST;
+ return CURLPX_RESOLVE_HOST;
}
}
- /* FALLTHROUGH */
- CONNECT_REQ_INIT:
- case CONNECT_REQ_INIT:
- /*
- * This is currently not supporting "Identification Protocol (RFC1413)".
- */
- socksreq[8] = 0; /* ensure empty userid is NUL-terminated */
- if(proxy_user) {
- size_t plen = strlen(proxy_user);
- if(plen >= sizeof(sx->socksreq) - 8) {
- failf(data, "Too long SOCKS proxy user name, can't use!\n");
- return CURLPX_LONG_USER;
- }
- /* copy the proxy name WITH trailing zero */
- memcpy(socksreq + 8, proxy_user, plen + 1);
- }
-
- /*
- * Make connection
- */
- {
- size_t packetsize = 9 +
- strlen((char *)socksreq + 8); /* size including NUL */
-
- /* If SOCKS4a, set special invalid IP address 0.0.0.x */
- if(protocol4a) {
- size_t hostnamelen = 0;
- socksreq[4] = 0;
- socksreq[5] = 0;
- socksreq[6] = 0;
- socksreq[7] = 1;
- /* append hostname */
- hostnamelen = strlen(hostname) + 1; /* length including NUL */
- if(hostnamelen <= 255)
- strcpy((char *)socksreq + packetsize, hostname);
- else {
- failf(data, "SOCKS4: too long host name");
- return CURLPX_LONG_HOSTNAME;
- }
- packetsize += hostnamelen;
- }
- sx->outp = socksreq;
- sx->outstanding = packetsize;
- sxstate(conn, CONNECT_REQ_SENDING);
- }
- /* FALLTHROUGH */
- case CONNECT_REQ_SENDING:
+ /* FALLTHROUGH */
+ CONNECT_REQ_INIT:
+ case CONNECT_REQ_INIT:
+ /*
+ * This is currently not supporting "Identification Protocol (RFC1413)".
+ */
+ socksreq[8] = 0; /* ensure empty userid is NUL-terminated */
+ if(proxy_user) {
+ size_t plen = strlen(proxy_user);
+ if(plen >= sizeof(sx->socksreq) - 8) {
+ failf(data, "Too long SOCKS proxy user name, can't use!\n");
+ return CURLPX_LONG_USER;
+ }
+ /* copy the proxy name WITH trailing zero */
+ memcpy(socksreq + 8, proxy_user, plen + 1);
+ }
+
+ /*
+ * Make connection
+ */
+ {
+ size_t packetsize = 9 +
+ strlen((char *)socksreq + 8); /* size including NUL */
+
+ /* If SOCKS4a, set special invalid IP address 0.0.0.x */
+ if(protocol4a) {
+ size_t hostnamelen = 0;
+ socksreq[4] = 0;
+ socksreq[5] = 0;
+ socksreq[6] = 0;
+ socksreq[7] = 1;
+ /* append hostname */
+ hostnamelen = strlen(hostname) + 1; /* length including NUL */
+ if(hostnamelen <= 255)
+ strcpy((char *)socksreq + packetsize, hostname);
+ else {
+ failf(data, "SOCKS4: too long host name");
+ return CURLPX_LONG_HOSTNAME;
+ }
+ packetsize += hostnamelen;
+ }
+ sx->outp = socksreq;
+ sx->outstanding = packetsize;
+ sxstate(conn, CONNECT_REQ_SENDING);
+ }
+ /* FALLTHROUGH */
+ case CONNECT_REQ_SENDING:
/* Send request */
- result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
- sx->outstanding, &written);
- if(result && (CURLE_AGAIN != result)) {
+ result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
+ sx->outstanding, &written);
+ if(result && (CURLE_AGAIN != result)) {
failf(data, "Failed to send SOCKS4 connect request.");
- return CURLPX_SEND_CONNECT;
+ return CURLPX_SEND_CONNECT;
}
- if(written != sx->outstanding) {
- /* not done, remain in state */
- sx->outstanding -= written;
- sx->outp += written;
- return CURLPX_OK;
+ if(written != sx->outstanding) {
+ /* not done, remain in state */
+ sx->outstanding -= written;
+ sx->outp += written;
+ return CURLPX_OK;
}
- /* done sending! */
- sx->outstanding = 8; /* receive data size */
- sx->outp = socksreq;
- sxstate(conn, CONNECT_SOCKS_READ);
+ /* done sending! */
+ sx->outstanding = 8; /* receive data size */
+ sx->outp = socksreq;
+ sxstate(conn, CONNECT_SOCKS_READ);
- /* FALLTHROUGH */
- case CONNECT_SOCKS_READ:
+ /* FALLTHROUGH */
+ case CONNECT_SOCKS_READ:
/* Receive response */
- result = Curl_read_plain(sockfd, (char *)sx->outp,
- sx->outstanding, &actualread);
- if(result && (CURLE_AGAIN != result)) {
- failf(data, "SOCKS4: Failed receiving connect request ack: %s",
- curl_easy_strerror(result));
- return CURLPX_RECV_CONNECT;
- }
- else if(!result && !actualread) {
- /* connection closed */
- failf(data, "connection to proxy closed");
- return CURLPX_CLOSED;
- }
- else if(actualread != sx->outstanding) {
- /* remain in reading state */
- sx->outstanding -= actualread;
- sx->outp += actualread;
- return CURLPX_OK;
- }
- sxstate(conn, CONNECT_DONE);
- break;
- default: /* lots of unused states in SOCKS4 */
- break;
- }
-
- /*
- * Response format
- *
- * +----+----+----+----+----+----+----+----+
- * | VN | CD | DSTPORT | DSTIP |
- * +----+----+----+----+----+----+----+----+
- * # of bytes: 1 1 2 4
- *
- * VN is the version of the reply code and should be 0. CD is the result
- * code with one of the following values:
- *
- * 90: request granted
- * 91: request rejected or failed
- * 92: request rejected because SOCKS server cannot connect to
- * identd on the client
- * 93: request rejected because the client program and identd
- * report different user-ids
- */
-
- /* wrong version ? */
- if(socksreq[0] != 0) {
- failf(data,
- "SOCKS4 reply has wrong version, version should be 0.");
- return CURLPX_BAD_VERSION;
- }
-
- /* Result */
- switch(socksreq[1]) {
- case 90:
- infof(data, "SOCKS4%s request granted.\n", protocol4a?"a":"");
- break;
- case 91:
- failf(data,
- "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
- ", request rejected or failed.",
- (unsigned char)socksreq[4], (unsigned char)socksreq[5],
- (unsigned char)socksreq[6], (unsigned char)socksreq[7],
- (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
- (unsigned char)socksreq[1]);
- return CURLPX_REQUEST_FAILED;
- case 92:
- failf(data,
- "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
- ", request rejected because SOCKS server cannot connect to "
- "identd on the client.",
- (unsigned char)socksreq[4], (unsigned char)socksreq[5],
- (unsigned char)socksreq[6], (unsigned char)socksreq[7],
- (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
- (unsigned char)socksreq[1]);
- return CURLPX_IDENTD;
- case 93:
- failf(data,
- "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
- ", request rejected because the client program and identd "
- "report different user-ids.",
- (unsigned char)socksreq[4], (unsigned char)socksreq[5],
- (unsigned char)socksreq[6], (unsigned char)socksreq[7],
- (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
- (unsigned char)socksreq[1]);
- return CURLPX_IDENTD_DIFFER;
- default:
- failf(data,
- "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
- ", Unknown.",
- (unsigned char)socksreq[4], (unsigned char)socksreq[5],
- (unsigned char)socksreq[6], (unsigned char)socksreq[7],
- (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
- (unsigned char)socksreq[1]);
- return CURLPX_UNKNOWN_FAIL;
+ result = Curl_read_plain(sockfd, (char *)sx->outp,
+ sx->outstanding, &actualread);
+ if(result && (CURLE_AGAIN != result)) {
+ failf(data, "SOCKS4: Failed receiving connect request ack: %s",
+ curl_easy_strerror(result));
+ return CURLPX_RECV_CONNECT;
+ }
+ else if(!result && !actualread) {
+ /* connection closed */
+ failf(data, "connection to proxy closed");
+ return CURLPX_CLOSED;
+ }
+ else if(actualread != sx->outstanding) {
+ /* remain in reading state */
+ sx->outstanding -= actualread;
+ sx->outp += actualread;
+ return CURLPX_OK;
+ }
+ sxstate(conn, CONNECT_DONE);
+ break;
+ default: /* lots of unused states in SOCKS4 */
+ break;
+ }
+
+ /*
+ * Response format
+ *
+ * +----+----+----+----+----+----+----+----+
+ * | VN | CD | DSTPORT | DSTIP |
+ * +----+----+----+----+----+----+----+----+
+ * # of bytes: 1 1 2 4
+ *
+ * VN is the version of the reply code and should be 0. CD is the result
+ * code with one of the following values:
+ *
+ * 90: request granted
+ * 91: request rejected or failed
+ * 92: request rejected because SOCKS server cannot connect to
+ * identd on the client
+ * 93: request rejected because the client program and identd
+ * report different user-ids
+ */
+
+ /* wrong version ? */
+ if(socksreq[0] != 0) {
+ failf(data,
+ "SOCKS4 reply has wrong version, version should be 0.");
+ return CURLPX_BAD_VERSION;
}
- *done = TRUE;
- return CURLPX_OK; /* Proxy was successful! */
+ /* Result */
+ switch(socksreq[1]) {
+ case 90:
+ infof(data, "SOCKS4%s request granted.\n", protocol4a?"a":"");
+ break;
+ case 91:
+ failf(data,
+ "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
+ ", request rejected or failed.",
+ (unsigned char)socksreq[4], (unsigned char)socksreq[5],
+ (unsigned char)socksreq[6], (unsigned char)socksreq[7],
+ (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
+ (unsigned char)socksreq[1]);
+ return CURLPX_REQUEST_FAILED;
+ case 92:
+ failf(data,
+ "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
+ ", request rejected because SOCKS server cannot connect to "
+ "identd on the client.",
+ (unsigned char)socksreq[4], (unsigned char)socksreq[5],
+ (unsigned char)socksreq[6], (unsigned char)socksreq[7],
+ (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
+ (unsigned char)socksreq[1]);
+ return CURLPX_IDENTD;
+ case 93:
+ failf(data,
+ "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
+ ", request rejected because the client program and identd "
+ "report different user-ids.",
+ (unsigned char)socksreq[4], (unsigned char)socksreq[5],
+ (unsigned char)socksreq[6], (unsigned char)socksreq[7],
+ (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
+ (unsigned char)socksreq[1]);
+ return CURLPX_IDENTD_DIFFER;
+ default:
+ failf(data,
+ "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d)"
+ ", Unknown.",
+ (unsigned char)socksreq[4], (unsigned char)socksreq[5],
+ (unsigned char)socksreq[6], (unsigned char)socksreq[7],
+ (((unsigned char)socksreq[2] << 8) | (unsigned char)socksreq[3]),
+ (unsigned char)socksreq[1]);
+ return CURLPX_UNKNOWN_FAIL;
+ }
+
+ *done = TRUE;
+ return CURLPX_OK; /* Proxy was successful! */
}
/*
* This function logs in to a SOCKS5 proxy and sends the specifics to the final
* destination server.
*/
-CURLproxycode Curl_SOCKS5(const char *proxy_user,
- const char *proxy_password,
- const char *hostname,
- int remote_port,
- int sockindex,
- struct connectdata *conn,
- bool *done)
+CURLproxycode Curl_SOCKS5(const char *proxy_user,
+ const char *proxy_password,
+ const char *hostname,
+ int remote_port,
+ int sockindex,
+ struct connectdata *conn,
+ bool *done)
{
/*
According to the RFC1928, section "6. Replies". This is what a SOCK5
@@ -505,13 +505,13 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
o REP Reply field:
o X'00' succeeded
*/
- unsigned char *socksreq = &conn->cnnct.socksreq[0];
- char dest[256] = "unknown"; /* printable hostname:port */
+ unsigned char *socksreq = &conn->cnnct.socksreq[0];
+ char dest[256] = "unknown"; /* printable hostname:port */
int idx;
ssize_t actualread;
ssize_t written;
- CURLcode result;
- curl_socket_t sockfd = conn->sock[sockindex];
+ CURLcode result;
+ curl_socket_t sockfd = conn->sock[sockindex];
struct Curl_easy *data = conn->data;
bool socks5_resolve_local =
(conn->socks_proxy.proxytype == CURLPROXY_SOCKS5) ? TRUE : FALSE;
@@ -519,148 +519,148 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
ssize_t len = 0;
const unsigned long auth = data->set.socks5auth;
bool allow_gssapi = FALSE;
- struct connstate *sx = &conn->cnnct;
- struct Curl_dns_entry *dns = NULL;
-
- if(!SOCKS_STATE(sx->state) && !*done)
- sxstate(conn, CONNECT_SOCKS_INIT);
-
- switch(sx->state) {
- case CONNECT_SOCKS_INIT:
- if(conn->bits.httpproxy)
- infof(conn->data, "SOCKS5: connecting to HTTP proxy %s port %d\n",
- hostname, remote_port);
-
- /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
- if(!socks5_resolve_local && hostname_len > 255) {
- infof(conn->data, "SOCKS5: server resolving disabled for hostnames of "
- "length > 255 [actual len=%zu]\n", hostname_len);
- socks5_resolve_local = TRUE;
- }
-
- if(auth & ~(CURLAUTH_BASIC | CURLAUTH_GSSAPI))
- infof(conn->data,
- "warning: unsupported value passed to CURLOPT_SOCKS5_AUTH: %lu\n",
- auth);
- if(!(auth & CURLAUTH_BASIC))
- /* disable username/password auth */
- proxy_user = NULL;
+ struct connstate *sx = &conn->cnnct;
+ struct Curl_dns_entry *dns = NULL;
+
+ if(!SOCKS_STATE(sx->state) && !*done)
+ sxstate(conn, CONNECT_SOCKS_INIT);
+
+ switch(sx->state) {
+ case CONNECT_SOCKS_INIT:
+ if(conn->bits.httpproxy)
+ infof(conn->data, "SOCKS5: connecting to HTTP proxy %s port %d\n",
+ hostname, remote_port);
+
+ /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
+ if(!socks5_resolve_local && hostname_len > 255) {
+ infof(conn->data, "SOCKS5: server resolving disabled for hostnames of "
+ "length > 255 [actual len=%zu]\n", hostname_len);
+ socks5_resolve_local = TRUE;
+ }
+
+ if(auth & ~(CURLAUTH_BASIC | CURLAUTH_GSSAPI))
+ infof(conn->data,
+ "warning: unsupported value passed to CURLOPT_SOCKS5_AUTH: %lu\n",
+ auth);
+ if(!(auth & CURLAUTH_BASIC))
+ /* disable username/password auth */
+ proxy_user = NULL;
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
- if(auth & CURLAUTH_GSSAPI)
- allow_gssapi = TRUE;
+ if(auth & CURLAUTH_GSSAPI)
+ allow_gssapi = TRUE;
#endif
- idx = 0;
- socksreq[idx++] = 5; /* version */
- idx++; /* number of authentication methods */
- socksreq[idx++] = 0; /* no authentication */
- if(allow_gssapi)
- socksreq[idx++] = 1; /* GSS-API */
- if(proxy_user)
- socksreq[idx++] = 2; /* username/password */
- /* write the number of authentication methods */
- socksreq[1] = (unsigned char) (idx - 2);
-
- result = Curl_write_plain(conn, sockfd, (char *)socksreq, idx, &written);
- if(result && (CURLE_AGAIN != result)) {
- failf(data, "Unable to send initial SOCKS5 request.");
- return CURLPX_SEND_CONNECT;
- }
- if(written != idx) {
- sxstate(conn, CONNECT_SOCKS_SEND);
- sx->outstanding = idx - written;
- sx->outp = &socksreq[written];
- return CURLPX_OK;
- }
- sxstate(conn, CONNECT_SOCKS_READ);
- goto CONNECT_SOCKS_READ_INIT;
- case CONNECT_SOCKS_SEND:
- result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
- sx->outstanding, &written);
- if(result && (CURLE_AGAIN != result)) {
- failf(data, "Unable to send initial SOCKS5 request.");
- return CURLPX_SEND_CONNECT;
- }
- if(written != sx->outstanding) {
- /* not done, remain in state */
- sx->outstanding -= written;
- sx->outp += written;
- return CURLPX_OK;
- }
- /* FALLTHROUGH */
- CONNECT_SOCKS_READ_INIT:
- case CONNECT_SOCKS_READ_INIT:
- sx->outstanding = 2; /* expect two bytes */
- sx->outp = socksreq; /* store it here */
- /* FALLTHROUGH */
- case CONNECT_SOCKS_READ:
- result = Curl_read_plain(sockfd, (char *)sx->outp,
- sx->outstanding, &actualread);
- if(result && (CURLE_AGAIN != result)) {
- failf(data, "Unable to receive initial SOCKS5 response.");
- return CURLPX_RECV_CONNECT;
- }
- else if(!result && !actualread) {
- /* connection closed */
- failf(data, "Connection to proxy closed");
- return CURLPX_CLOSED;
- }
- else if(actualread != sx->outstanding) {
- /* remain in reading state */
- sx->outstanding -= actualread;
- sx->outp += actualread;
- return CURLPX_OK;
- }
- else if(socksreq[0] != 5) {
- failf(data, "Received invalid version in initial SOCKS5 response.");
- return CURLPX_BAD_VERSION;
- }
- else if(socksreq[1] == 0) {
- /* DONE! No authentication needed. Send request. */
- sxstate(conn, CONNECT_REQ_INIT);
- goto CONNECT_REQ_INIT;
- }
- else if(socksreq[1] == 2) {
- /* regular name + password authentication */
- sxstate(conn, CONNECT_AUTH_INIT);
- goto CONNECT_AUTH_INIT;
- }
+ idx = 0;
+ socksreq[idx++] = 5; /* version */
+ idx++; /* number of authentication methods */
+ socksreq[idx++] = 0; /* no authentication */
+ if(allow_gssapi)
+ socksreq[idx++] = 1; /* GSS-API */
+ if(proxy_user)
+ socksreq[idx++] = 2; /* username/password */
+ /* write the number of authentication methods */
+ socksreq[1] = (unsigned char) (idx - 2);
+
+ result = Curl_write_plain(conn, sockfd, (char *)socksreq, idx, &written);
+ if(result && (CURLE_AGAIN != result)) {
+ failf(data, "Unable to send initial SOCKS5 request.");
+ return CURLPX_SEND_CONNECT;
+ }
+ if(written != idx) {
+ sxstate(conn, CONNECT_SOCKS_SEND);
+ sx->outstanding = idx - written;
+ sx->outp = &socksreq[written];
+ return CURLPX_OK;
+ }
+ sxstate(conn, CONNECT_SOCKS_READ);
+ goto CONNECT_SOCKS_READ_INIT;
+ case CONNECT_SOCKS_SEND:
+ result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
+ sx->outstanding, &written);
+ if(result && (CURLE_AGAIN != result)) {
+ failf(data, "Unable to send initial SOCKS5 request.");
+ return CURLPX_SEND_CONNECT;
+ }
+ if(written != sx->outstanding) {
+ /* not done, remain in state */
+ sx->outstanding -= written;
+ sx->outp += written;
+ return CURLPX_OK;
+ }
+ /* FALLTHROUGH */
+ CONNECT_SOCKS_READ_INIT:
+ case CONNECT_SOCKS_READ_INIT:
+ sx->outstanding = 2; /* expect two bytes */
+ sx->outp = socksreq; /* store it here */
+ /* FALLTHROUGH */
+ case CONNECT_SOCKS_READ:
+ result = Curl_read_plain(sockfd, (char *)sx->outp,
+ sx->outstanding, &actualread);
+ if(result && (CURLE_AGAIN != result)) {
+ failf(data, "Unable to receive initial SOCKS5 response.");
+ return CURLPX_RECV_CONNECT;
+ }
+ else if(!result && !actualread) {
+ /* connection closed */
+ failf(data, "Connection to proxy closed");
+ return CURLPX_CLOSED;
+ }
+ else if(actualread != sx->outstanding) {
+ /* remain in reading state */
+ sx->outstanding -= actualread;
+ sx->outp += actualread;
+ return CURLPX_OK;
+ }
+ else if(socksreq[0] != 5) {
+ failf(data, "Received invalid version in initial SOCKS5 response.");
+ return CURLPX_BAD_VERSION;
+ }
+ else if(socksreq[1] == 0) {
+ /* DONE! No authentication needed. Send request. */
+ sxstate(conn, CONNECT_REQ_INIT);
+ goto CONNECT_REQ_INIT;
+ }
+ else if(socksreq[1] == 2) {
+ /* regular name + password authentication */
+ sxstate(conn, CONNECT_AUTH_INIT);
+ goto CONNECT_AUTH_INIT;
+ }
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
- else if(allow_gssapi && (socksreq[1] == 1)) {
- sxstate(conn, CONNECT_GSSAPI_INIT);
- result = Curl_SOCKS5_gssapi_negotiate(sockindex, conn);
- if(result) {
- failf(data, "Unable to negotiate SOCKS5 GSS-API context.");
- return CURLPX_GSSAPI;
- }
+ else if(allow_gssapi && (socksreq[1] == 1)) {
+ sxstate(conn, CONNECT_GSSAPI_INIT);
+ result = Curl_SOCKS5_gssapi_negotiate(sockindex, conn);
+ if(result) {
+ failf(data, "Unable to negotiate SOCKS5 GSS-API context.");
+ return CURLPX_GSSAPI;
+ }
}
#endif
- else {
- /* error */
- if(!allow_gssapi && (socksreq[1] == 1)) {
- failf(data,
- "SOCKS5 GSSAPI per-message authentication is not supported.");
- return CURLPX_GSSAPI_PERMSG;
- }
- else if(socksreq[1] == 255) {
- failf(data, "No authentication method was acceptable.");
- return CURLPX_NO_AUTH;
- }
- }
- failf(data,
- "Undocumented SOCKS5 mode attempted to be used by server.");
- return CURLPX_UNKNOWN_MODE;
-#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
- case CONNECT_GSSAPI_INIT:
- /* GSSAPI stuff done non-blocking */
- break;
-#endif
-
- default: /* do nothing! */
- break;
-
- CONNECT_AUTH_INIT:
- case CONNECT_AUTH_INIT: {
+ else {
+ /* error */
+ if(!allow_gssapi && (socksreq[1] == 1)) {
+ failf(data,
+ "SOCKS5 GSSAPI per-message authentication is not supported.");
+ return CURLPX_GSSAPI_PERMSG;
+ }
+ else if(socksreq[1] == 255) {
+ failf(data, "No authentication method was acceptable.");
+ return CURLPX_NO_AUTH;
+ }
+ }
+ failf(data,
+ "Undocumented SOCKS5 mode attempted to be used by server.");
+ return CURLPX_UNKNOWN_MODE;
+#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
+ case CONNECT_GSSAPI_INIT:
+ /* GSSAPI stuff done non-blocking */
+ break;
+#endif
+
+ default: /* do nothing! */
+ break;
+
+ CONNECT_AUTH_INIT:
+ case CONNECT_AUTH_INIT: {
/* Needs user name and password */
size_t proxy_user_len, proxy_password_len;
if(proxy_user && proxy_password) {
@@ -686,7 +686,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
/* the length must fit in a single byte */
if(proxy_user_len >= 255) {
failf(data, "Excessive user name length for proxy auth");
- return CURLPX_LONG_USER;
+ return CURLPX_LONG_USER;
}
memcpy(socksreq + len, proxy_user, proxy_user_len);
}
@@ -696,336 +696,336 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
/* the length must fit in a single byte */
if(proxy_password_len > 255) {
failf(data, "Excessive password length for proxy auth");
- return CURLPX_LONG_PASSWD;
+ return CURLPX_LONG_PASSWD;
}
memcpy(socksreq + len, proxy_password, proxy_password_len);
}
len += proxy_password_len;
- sxstate(conn, CONNECT_AUTH_SEND);
- sx->outstanding = len;
- sx->outp = socksreq;
- }
- /* FALLTHROUGH */
- case CONNECT_AUTH_SEND:
- result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
- sx->outstanding, &written);
- if(result && (CURLE_AGAIN != result)) {
+ sxstate(conn, CONNECT_AUTH_SEND);
+ sx->outstanding = len;
+ sx->outp = socksreq;
+ }
+ /* FALLTHROUGH */
+ case CONNECT_AUTH_SEND:
+ result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
+ sx->outstanding, &written);
+ if(result && (CURLE_AGAIN != result)) {
failf(data, "Failed to send SOCKS5 sub-negotiation request.");
- return CURLPX_SEND_AUTH;
- }
- if(sx->outstanding != written) {
- /* remain in state */
- sx->outstanding -= written;
- sx->outp += written;
- return CURLPX_OK;
- }
- sx->outp = socksreq;
- sx->outstanding = 2;
- sxstate(conn, CONNECT_AUTH_READ);
- /* FALLTHROUGH */
- case CONNECT_AUTH_READ:
- result = Curl_read_plain(sockfd, (char *)sx->outp,
- sx->outstanding, &actualread);
- if(result && (CURLE_AGAIN != result)) {
+ return CURLPX_SEND_AUTH;
+ }
+ if(sx->outstanding != written) {
+ /* remain in state */
+ sx->outstanding -= written;
+ sx->outp += written;
+ return CURLPX_OK;
+ }
+ sx->outp = socksreq;
+ sx->outstanding = 2;
+ sxstate(conn, CONNECT_AUTH_READ);
+ /* FALLTHROUGH */
+ case CONNECT_AUTH_READ:
+ result = Curl_read_plain(sockfd, (char *)sx->outp,
+ sx->outstanding, &actualread);
+ if(result && (CURLE_AGAIN != result)) {
failf(data, "Unable to receive SOCKS5 sub-negotiation response.");
- return CURLPX_RECV_AUTH;
- }
- else if(!result && !actualread) {
- /* connection closed */
- failf(data, "connection to proxy closed");
- return CURLPX_CLOSED;
- }
- else if(actualread != sx->outstanding) {
- /* remain in state */
- sx->outstanding -= actualread;
- sx->outp += actualread;
- return CURLPX_OK;
- }
+ return CURLPX_RECV_AUTH;
+ }
+ else if(!result && !actualread) {
+ /* connection closed */
+ failf(data, "connection to proxy closed");
+ return CURLPX_CLOSED;
+ }
+ else if(actualread != sx->outstanding) {
+ /* remain in state */
+ sx->outstanding -= actualread;
+ sx->outp += actualread;
+ return CURLPX_OK;
+ }
/* ignore the first (VER) byte */
- else if(socksreq[1] != 0) { /* status */
+ else if(socksreq[1] != 0) { /* status */
failf(data, "User was rejected by the SOCKS5 server (%d %d).",
socksreq[0], socksreq[1]);
- return CURLPX_USER_REJECTED;
+ return CURLPX_USER_REJECTED;
}
/* Everything is good so far, user was authenticated! */
- sxstate(conn, CONNECT_REQ_INIT);
- /* FALLTHROUGH */
- CONNECT_REQ_INIT:
- case CONNECT_REQ_INIT:
- if(socks5_resolve_local) {
- enum resolve_t rc = Curl_resolv(conn, hostname, remote_port,
- FALSE, &dns);
-
- if(rc == CURLRESOLV_ERROR)
- return CURLPX_RESOLVE_HOST;
-
- if(rc == CURLRESOLV_PENDING) {
- sxstate(conn, CONNECT_RESOLVING);
- return CURLPX_OK;
+ sxstate(conn, CONNECT_REQ_INIT);
+ /* FALLTHROUGH */
+ CONNECT_REQ_INIT:
+ case CONNECT_REQ_INIT:
+ if(socks5_resolve_local) {
+ enum resolve_t rc = Curl_resolv(conn, hostname, remote_port,
+ FALSE, &dns);
+
+ if(rc == CURLRESOLV_ERROR)
+ return CURLPX_RESOLVE_HOST;
+
+ if(rc == CURLRESOLV_PENDING) {
+ sxstate(conn, CONNECT_RESOLVING);
+ return CURLPX_OK;
}
- sxstate(conn, CONNECT_RESOLVED);
- goto CONNECT_RESOLVED;
- }
- goto CONNECT_RESOLVE_REMOTE;
-
- case CONNECT_RESOLVING:
- /* check if we have the name resolved by now */
- dns = Curl_fetch_addr(conn, hostname, remote_port);
-
- if(dns) {
-#ifdef CURLRES_ASYNCH
- conn->async.dns = dns;
- conn->async.done = TRUE;
-#endif
- infof(data, "SOCKS5: hostname '%s' found\n", hostname);
- }
-
- if(!dns) {
- result = Curl_resolv_check(data->conn, &dns);
- if(!dns) {
- if(result)
- return CURLPX_RESOLVE_HOST;
- return CURLPX_OK;
- }
- }
- /* FALLTHROUGH */
- CONNECT_RESOLVED:
- case CONNECT_RESOLVED: {
- struct Curl_addrinfo *hp = NULL;
- size_t destlen;
+ sxstate(conn, CONNECT_RESOLVED);
+ goto CONNECT_RESOLVED;
+ }
+ goto CONNECT_RESOLVE_REMOTE;
+
+ case CONNECT_RESOLVING:
+ /* check if we have the name resolved by now */
+ dns = Curl_fetch_addr(conn, hostname, remote_port);
+
+ if(dns) {
+#ifdef CURLRES_ASYNCH
+ conn->async.dns = dns;
+ conn->async.done = TRUE;
+#endif
+ infof(data, "SOCKS5: hostname '%s' found\n", hostname);
+ }
+
+ if(!dns) {
+ result = Curl_resolv_check(data->conn, &dns);
+ if(!dns) {
+ if(result)
+ return CURLPX_RESOLVE_HOST;
+ return CURLPX_OK;
+ }
+ }
+ /* FALLTHROUGH */
+ CONNECT_RESOLVED:
+ case CONNECT_RESOLVED: {
+ struct Curl_addrinfo *hp = NULL;
+ size_t destlen;
if(dns)
hp = dns->addr;
- if(!hp) {
- failf(data, "Failed to resolve \"%s\" for SOCKS5 connect.",
- hostname);
- return CURLPX_RESOLVE_HOST;
- }
-
- Curl_printable_address(hp, dest, sizeof(dest));
- destlen = strlen(dest);
- msnprintf(dest + destlen, sizeof(dest) - destlen, ":%d", remote_port);
-
- len = 0;
- socksreq[len++] = 5; /* version (SOCKS5) */
- socksreq[len++] = 1; /* connect */
- socksreq[len++] = 0; /* must be zero */
- if(hp->ai_family == AF_INET) {
- int i;
- struct sockaddr_in *saddr_in;
- socksreq[len++] = 1; /* ATYP: IPv4 = 1 */
-
- saddr_in = (struct sockaddr_in *)(void *)hp->ai_addr;
- for(i = 0; i < 4; i++) {
- socksreq[len++] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[i];
+ if(!hp) {
+ failf(data, "Failed to resolve \"%s\" for SOCKS5 connect.",
+ hostname);
+ return CURLPX_RESOLVE_HOST;
+ }
+
+ Curl_printable_address(hp, dest, sizeof(dest));
+ destlen = strlen(dest);
+ msnprintf(dest + destlen, sizeof(dest) - destlen, ":%d", remote_port);
+
+ len = 0;
+ socksreq[len++] = 5; /* version (SOCKS5) */
+ socksreq[len++] = 1; /* connect */
+ socksreq[len++] = 0; /* must be zero */
+ if(hp->ai_family == AF_INET) {
+ int i;
+ struct sockaddr_in *saddr_in;
+ socksreq[len++] = 1; /* ATYP: IPv4 = 1 */
+
+ saddr_in = (struct sockaddr_in *)(void *)hp->ai_addr;
+ for(i = 0; i < 4; i++) {
+ socksreq[len++] = ((unsigned char *)&saddr_in->sin_addr.s_addr)[i];
}
-
- infof(data, "SOCKS5 connect to IPv4 %s (locally resolved)\n", dest);
- }
+
+ infof(data, "SOCKS5 connect to IPv4 %s (locally resolved)\n", dest);
+ }
#ifdef ENABLE_IPV6
- else if(hp->ai_family == AF_INET6) {
- int i;
- struct sockaddr_in6 *saddr_in6;
- socksreq[len++] = 4; /* ATYP: IPv6 = 4 */
-
- saddr_in6 = (struct sockaddr_in6 *)(void *)hp->ai_addr;
- for(i = 0; i < 16; i++) {
- socksreq[len++] =
- ((unsigned char *)&saddr_in6->sin6_addr.s6_addr)[i];
+ else if(hp->ai_family == AF_INET6) {
+ int i;
+ struct sockaddr_in6 *saddr_in6;
+ socksreq[len++] = 4; /* ATYP: IPv6 = 4 */
+
+ saddr_in6 = (struct sockaddr_in6 *)(void *)hp->ai_addr;
+ for(i = 0; i < 16; i++) {
+ socksreq[len++] =
+ ((unsigned char *)&saddr_in6->sin6_addr.s6_addr)[i];
}
- infof(data, "SOCKS5 connect to IPv6 %s (locally resolved)\n", dest);
+ infof(data, "SOCKS5 connect to IPv6 %s (locally resolved)\n", dest);
}
-#endif
- else {
- hp = NULL; /* fail! */
- failf(data, "SOCKS5 connection to %s not supported\n", dest);
+#endif
+ else {
+ hp = NULL; /* fail! */
+ failf(data, "SOCKS5 connection to %s not supported\n", dest);
}
- Curl_resolv_unlock(data, dns); /* not used anymore from now on */
- goto CONNECT_REQ_SEND;
+ Curl_resolv_unlock(data, dns); /* not used anymore from now on */
+ goto CONNECT_REQ_SEND;
}
- CONNECT_RESOLVE_REMOTE:
- case CONNECT_RESOLVE_REMOTE:
- /* Authentication is complete, now specify destination to the proxy */
- len = 0;
- socksreq[len++] = 5; /* version (SOCKS5) */
- socksreq[len++] = 1; /* connect */
- socksreq[len++] = 0; /* must be zero */
-
- if(!socks5_resolve_local) {
- socksreq[len++] = 3; /* ATYP: domain name = 3 */
- socksreq[len++] = (char) hostname_len; /* one byte address length */
- memcpy(&socksreq[len], hostname, hostname_len); /* address w/o NULL */
- len += hostname_len;
- infof(data, "SOCKS5 connect to %s:%d (remotely resolved)\n",
- hostname, remote_port);
- }
- /* FALLTHROUGH */
-
- CONNECT_REQ_SEND:
- case CONNECT_REQ_SEND:
- /* PORT MSB */
- socksreq[len++] = (unsigned char)((remote_port >> 8) & 0xff);
- /* PORT LSB */
- socksreq[len++] = (unsigned char)(remote_port & 0xff);
+ CONNECT_RESOLVE_REMOTE:
+ case CONNECT_RESOLVE_REMOTE:
+ /* Authentication is complete, now specify destination to the proxy */
+ len = 0;
+ socksreq[len++] = 5; /* version (SOCKS5) */
+ socksreq[len++] = 1; /* connect */
+ socksreq[len++] = 0; /* must be zero */
+ if(!socks5_resolve_local) {
+ socksreq[len++] = 3; /* ATYP: domain name = 3 */
+ socksreq[len++] = (char) hostname_len; /* one byte address length */
+ memcpy(&socksreq[len], hostname, hostname_len); /* address w/o NULL */
+ len += hostname_len;
+ infof(data, "SOCKS5 connect to %s:%d (remotely resolved)\n",
+ hostname, remote_port);
+ }
+ /* FALLTHROUGH */
+
+ CONNECT_REQ_SEND:
+ case CONNECT_REQ_SEND:
+ /* PORT MSB */
+ socksreq[len++] = (unsigned char)((remote_port >> 8) & 0xff);
+ /* PORT LSB */
+ socksreq[len++] = (unsigned char)(remote_port & 0xff);
+
+#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
+ if(conn->socks5_gssapi_enctype) {
+ failf(data, "SOCKS5 GSS-API protection not yet implemented.");
+ return CURLPX_GSSAPI_PROTECTION;
+ }
+#endif
+ sx->outp = socksreq;
+ sx->outstanding = len;
+ sxstate(conn, CONNECT_REQ_SENDING);
+ /* FALLTHROUGH */
+ case CONNECT_REQ_SENDING:
+ result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
+ sx->outstanding, &written);
+ if(result && (CURLE_AGAIN != result)) {
+ failf(data, "Failed to send SOCKS5 connect request.");
+ return CURLPX_SEND_REQUEST;
+ }
+ if(sx->outstanding != written) {
+ /* remain in state */
+ sx->outstanding -= written;
+ sx->outp += written;
+ return CURLPX_OK;
+ }
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
- if(conn->socks5_gssapi_enctype) {
- failf(data, "SOCKS5 GSS-API protection not yet implemented.");
- return CURLPX_GSSAPI_PROTECTION;
- }
+ if(conn->socks5_gssapi_enctype) {
+ failf(data, "SOCKS5 GSS-API protection not yet implemented.");
+ return CURLPX_GSSAPI_PROTECTION;
+ }
#endif
- sx->outp = socksreq;
- sx->outstanding = len;
- sxstate(conn, CONNECT_REQ_SENDING);
- /* FALLTHROUGH */
- case CONNECT_REQ_SENDING:
- result = Curl_write_plain(conn, sockfd, (char *)sx->outp,
- sx->outstanding, &written);
- if(result && (CURLE_AGAIN != result)) {
- failf(data, "Failed to send SOCKS5 connect request.");
- return CURLPX_SEND_REQUEST;
- }
- if(sx->outstanding != written) {
- /* remain in state */
- sx->outstanding -= written;
- sx->outp += written;
- return CURLPX_OK;
- }
-#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
- if(conn->socks5_gssapi_enctype) {
- failf(data, "SOCKS5 GSS-API protection not yet implemented.");
- return CURLPX_GSSAPI_PROTECTION;
- }
-#endif
- sx->outstanding = 10; /* minimum packet size is 10 */
- sx->outp = socksreq;
- sxstate(conn, CONNECT_REQ_READ);
- /* FALLTHROUGH */
- case CONNECT_REQ_READ:
- result = Curl_read_plain(sockfd, (char *)sx->outp,
- sx->outstanding, &actualread);
- if(result && (CURLE_AGAIN != result)) {
- failf(data, "Failed to receive SOCKS5 connect request ack.");
- return CURLPX_RECV_REQACK;
- }
- else if(!result && !actualread) {
- /* connection closed */
- failf(data, "connection to proxy closed");
- return CURLPX_CLOSED;
- }
- else if(actualread != sx->outstanding) {
- /* remain in state */
- sx->outstanding -= actualread;
- sx->outp += actualread;
- return CURLPX_OK;
- }
-
- if(socksreq[0] != 5) { /* version */
- failf(data,
- "SOCKS5 reply has wrong version, version should be 5.");
- return CURLPX_BAD_VERSION;
- }
- else if(socksreq[1] != 0) { /* Anything besides 0 is an error */
- CURLproxycode rc = CURLPX_REPLY_UNASSIGNED;
- int code = socksreq[1];
- failf(data, "Can't complete SOCKS5 connection to %s. (%d)",
- hostname, (unsigned char)socksreq[1]);
- if(code < 9) {
- /* RFC 1928 section 6 lists: */
- static const CURLproxycode lookup[] = {
- CURLPX_OK,
- CURLPX_REPLY_GENERAL_SERVER_FAILURE,
- CURLPX_REPLY_NOT_ALLOWED,
- CURLPX_REPLY_NETWORK_UNREACHABLE,
- CURLPX_REPLY_HOST_UNREACHABLE,
- CURLPX_REPLY_CONNECTION_REFUSED,
- CURLPX_REPLY_TTL_EXPIRED,
- CURLPX_REPLY_COMMAND_NOT_SUPPORTED,
- CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED,
- };
- rc = lookup[code];
- }
- return rc;
- }
-
- /* Fix: in general, returned BND.ADDR is variable length parameter by RFC
- 1928, so the reply packet should be read until the end to avoid errors
- at subsequent protocol level.
-
- +----+-----+-------+------+----------+----------+
- |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT |
- +----+-----+-------+------+----------+----------+
- | 1 | 1 | X'00' | 1 | Variable | 2 |
- +----+-----+-------+------+----------+----------+
-
- ATYP:
- o IP v4 address: X'01', BND.ADDR = 4 byte
- o domain name: X'03', BND.ADDR = [ 1 byte length, string ]
- o IP v6 address: X'04', BND.ADDR = 16 byte
- */
-
- /* Calculate real packet size */
- if(socksreq[3] == 3) {
- /* domain name */
- int addrlen = (int) socksreq[4];
- len = 5 + addrlen + 2;
- }
- else if(socksreq[3] == 4) {
- /* IPv6 */
- len = 4 + 16 + 2;
- }
- else if(socksreq[3] == 1) {
- len = 4 + 4 + 2;
- }
- else {
- failf(data, "SOCKS5 reply has wrong address type.");
- return CURLPX_BAD_ADDRESS_TYPE;
- }
-
- /* At this point we already read first 10 bytes */
+ sx->outstanding = 10; /* minimum packet size is 10 */
+ sx->outp = socksreq;
+ sxstate(conn, CONNECT_REQ_READ);
+ /* FALLTHROUGH */
+ case CONNECT_REQ_READ:
+ result = Curl_read_plain(sockfd, (char *)sx->outp,
+ sx->outstanding, &actualread);
+ if(result && (CURLE_AGAIN != result)) {
+ failf(data, "Failed to receive SOCKS5 connect request ack.");
+ return CURLPX_RECV_REQACK;
+ }
+ else if(!result && !actualread) {
+ /* connection closed */
+ failf(data, "connection to proxy closed");
+ return CURLPX_CLOSED;
+ }
+ else if(actualread != sx->outstanding) {
+ /* remain in state */
+ sx->outstanding -= actualread;
+ sx->outp += actualread;
+ return CURLPX_OK;
+ }
+
+ if(socksreq[0] != 5) { /* version */
+ failf(data,
+ "SOCKS5 reply has wrong version, version should be 5.");
+ return CURLPX_BAD_VERSION;
+ }
+ else if(socksreq[1] != 0) { /* Anything besides 0 is an error */
+ CURLproxycode rc = CURLPX_REPLY_UNASSIGNED;
+ int code = socksreq[1];
+ failf(data, "Can't complete SOCKS5 connection to %s. (%d)",
+ hostname, (unsigned char)socksreq[1]);
+ if(code < 9) {
+ /* RFC 1928 section 6 lists: */
+ static const CURLproxycode lookup[] = {
+ CURLPX_OK,
+ CURLPX_REPLY_GENERAL_SERVER_FAILURE,
+ CURLPX_REPLY_NOT_ALLOWED,
+ CURLPX_REPLY_NETWORK_UNREACHABLE,
+ CURLPX_REPLY_HOST_UNREACHABLE,
+ CURLPX_REPLY_CONNECTION_REFUSED,
+ CURLPX_REPLY_TTL_EXPIRED,
+ CURLPX_REPLY_COMMAND_NOT_SUPPORTED,
+ CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED,
+ };
+ rc = lookup[code];
+ }
+ return rc;
+ }
+
+ /* Fix: in general, returned BND.ADDR is variable length parameter by RFC
+ 1928, so the reply packet should be read until the end to avoid errors
+ at subsequent protocol level.
+
+ +----+-----+-------+------+----------+----------+
+ |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT |
+ +----+-----+-------+------+----------+----------+
+ | 1 | 1 | X'00' | 1 | Variable | 2 |
+ +----+-----+-------+------+----------+----------+
+
+ ATYP:
+ o IP v4 address: X'01', BND.ADDR = 4 byte
+ o domain name: X'03', BND.ADDR = [ 1 byte length, string ]
+ o IP v6 address: X'04', BND.ADDR = 16 byte
+ */
+
+ /* Calculate real packet size */
+ if(socksreq[3] == 3) {
+ /* domain name */
+ int addrlen = (int) socksreq[4];
+ len = 5 + addrlen + 2;
+ }
+ else if(socksreq[3] == 4) {
+ /* IPv6 */
+ len = 4 + 16 + 2;
+ }
+ else if(socksreq[3] == 1) {
+ len = 4 + 4 + 2;
+ }
+ else {
+ failf(data, "SOCKS5 reply has wrong address type.");
+ return CURLPX_BAD_ADDRESS_TYPE;
+ }
+
+ /* At this point we already read first 10 bytes */
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
- if(!conn->socks5_gssapi_enctype) {
- /* decrypt_gssapi_blockread already read the whole packet */
+ if(!conn->socks5_gssapi_enctype) {
+ /* decrypt_gssapi_blockread already read the whole packet */
#endif
- if(len > 10) {
- sx->outstanding = len - 10; /* get the rest */
- sx->outp = &socksreq[10];
- sxstate(conn, CONNECT_REQ_READ_MORE);
+ if(len > 10) {
+ sx->outstanding = len - 10; /* get the rest */
+ sx->outp = &socksreq[10];
+ sxstate(conn, CONNECT_REQ_READ_MORE);
+ }
+ else {
+ sxstate(conn, CONNECT_DONE);
+ break;
}
- else {
- sxstate(conn, CONNECT_DONE);
- break;
- }
-#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
+#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
}
#endif
- /* FALLTHROUGH */
- case CONNECT_REQ_READ_MORE:
- result = Curl_read_plain(sockfd, (char *)sx->outp,
- sx->outstanding, &actualread);
- if(result && (CURLE_AGAIN != result)) {
- failf(data, "Failed to receive SOCKS5 connect request ack.");
- return CURLPX_RECV_ADDRESS;
- }
- else if(!result && !actualread) {
- /* connection closed */
- failf(data, "connection to proxy closed");
- return CURLPX_CLOSED;
- }
- else if(actualread != sx->outstanding) {
- /* remain in state */
- sx->outstanding -= actualread;
- sx->outp += actualread;
- return CURLPX_OK;
- }
- sxstate(conn, CONNECT_DONE);
+ /* FALLTHROUGH */
+ case CONNECT_REQ_READ_MORE:
+ result = Curl_read_plain(sockfd, (char *)sx->outp,
+ sx->outstanding, &actualread);
+ if(result && (CURLE_AGAIN != result)) {
+ failf(data, "Failed to receive SOCKS5 connect request ack.");
+ return CURLPX_RECV_ADDRESS;
+ }
+ else if(!result && !actualread) {
+ /* connection closed */
+ failf(data, "connection to proxy closed");
+ return CURLPX_CLOSED;
+ }
+ else if(actualread != sx->outstanding) {
+ /* remain in state */
+ sx->outstanding -= actualread;
+ sx->outp += actualread;
+ return CURLPX_OK;
+ }
+ sxstate(conn, CONNECT_DONE);
}
infof(data, "SOCKS5 request granted.\n");
- *done = TRUE;
- return CURLPX_OK; /* Proxy was successful! */
+ *done = TRUE;
+ return CURLPX_OK; /* Proxy was successful! */
}
#endif /* CURL_DISABLE_PROXY */
diff --git a/contrib/libs/curl/lib/socks.h b/contrib/libs/curl/lib/socks.h
index c23175e722..1fae58b6fa 100644
--- a/contrib/libs/curl/lib/socks.h
+++ b/contrib/libs/curl/lib/socks.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -27,13 +27,13 @@
#ifdef CURL_DISABLE_PROXY
#define Curl_SOCKS4(a,b,c,d,e) CURLE_NOT_BUILT_IN
#define Curl_SOCKS5(a,b,c,d,e,f) CURLE_NOT_BUILT_IN
-#define Curl_SOCKS_getsock(x,y,z) 0
+#define Curl_SOCKS_getsock(x,y,z) 0
#else
/*
* Helper read-from-socket functions. Does the same as Curl_read() but it
* blocks until all bytes amount of buffersize will be read. No more, no less.
*
- * This is STUPID BLOCKING behavior
+ * This is STUPID BLOCKING behavior
*/
int Curl_blockread_all(struct connectdata *conn,
curl_socket_t sockfd,
@@ -41,31 +41,31 @@ int Curl_blockread_all(struct connectdata *conn,
ssize_t buffersize,
ssize_t *n);
-int Curl_SOCKS_getsock(struct connectdata *conn,
- curl_socket_t *sock,
- int sockindex);
+int Curl_SOCKS_getsock(struct connectdata *conn,
+ curl_socket_t *sock,
+ int sockindex);
/*
* This function logs in to a SOCKS4(a) proxy and sends the specifics to the
* final destination server.
*/
-CURLproxycode Curl_SOCKS4(const char *proxy_name,
- const char *hostname,
- int remote_port,
- int sockindex,
- struct connectdata *conn,
- bool *done);
+CURLproxycode Curl_SOCKS4(const char *proxy_name,
+ const char *hostname,
+ int remote_port,
+ int sockindex,
+ struct connectdata *conn,
+ bool *done);
/*
* This function logs in to a SOCKS5 proxy and sends the specifics to the
* final destination server.
*/
-CURLproxycode Curl_SOCKS5(const char *proxy_name,
- const char *proxy_password,
- const char *hostname,
- int remote_port,
- int sockindex,
- struct connectdata *conn,
- bool *done);
+CURLproxycode Curl_SOCKS5(const char *proxy_name,
+ const char *proxy_password,
+ const char *hostname,
+ int remote_port,
+ int sockindex,
+ struct connectdata *conn,
+ bool *done);
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
/*
diff --git a/contrib/libs/curl/lib/socks_gssapi.c b/contrib/libs/curl/lib/socks_gssapi.c
index c7ec4b0a43..a96579692b 100644
--- a/contrib/libs/curl/lib/socks_gssapi.c
+++ b/contrib/libs/curl/lib/socks_gssapi.c
@@ -5,12 +5,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2009, Markus Moeller, <markus_moeller@compuserve.com>
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -115,7 +115,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
gss_buffer_desc gss_send_token = GSS_C_EMPTY_BUFFER;
gss_buffer_desc gss_recv_token = GSS_C_EMPTY_BUFFER;
gss_buffer_desc gss_w_token = GSS_C_EMPTY_BUFFER;
- gss_buffer_desc *gss_token = GSS_C_NO_BUFFER;
+ gss_buffer_desc *gss_token = GSS_C_NO_BUFFER;
gss_name_t server = GSS_C_NO_NAME;
gss_name_t gss_client_name = GSS_C_NO_NAME;
unsigned short us_length;
@@ -167,8 +167,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
return CURLE_COULDNT_CONNECT;
}
- (void)curlx_nonblock(sock, FALSE);
-
+ (void)curlx_nonblock(sock, FALSE);
+
/* As long as we need to keep sending some context info, and there's no */
/* errors, keep sending it... */
for(;;) {
@@ -227,8 +227,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
gss_release_buffer(&gss_status, &gss_send_token);
gss_release_buffer(&gss_status, &gss_recv_token);
- if(gss_major_status != GSS_S_CONTINUE_NEEDED)
- break;
+ if(gss_major_status != GSS_S_CONTINUE_NEEDED)
+ break;
/* analyse response */
@@ -328,7 +328,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
user[gss_send_token.length] = '\0';
gss_release_name(&gss_status, &gss_client_name);
gss_release_buffer(&gss_status, &gss_send_token);
- infof(data, "SOCKS5 server authenticated user %s with GSS-API.\n",user);
+ infof(data, "SOCKS5 server authenticated user %s with GSS-API.\n",user);
free(user);
user = NULL;
@@ -493,7 +493,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
gss_release_buffer(&gss_status, &gss_recv_token);
if(gss_w_token.length != 1) {
- failf(data, "Invalid GSS-API encryption response length (%zu).",
+ failf(data, "Invalid GSS-API encryption response length (%zu).",
gss_w_token.length);
gss_release_buffer(&gss_status, &gss_w_token);
gss_delete_sec_context(&gss_status, &gss_context, NULL);
@@ -505,7 +505,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
}
else {
if(gss_recv_token.length != 1) {
- failf(data, "Invalid GSS-API encryption response length (%zu).",
+ failf(data, "Invalid GSS-API encryption response length (%zu).",
gss_recv_token.length);
gss_release_buffer(&gss_status, &gss_recv_token);
gss_delete_sec_context(&gss_status, &gss_context, NULL);
@@ -516,8 +516,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
gss_release_buffer(&gss_status, &gss_recv_token);
}
- (void)curlx_nonblock(sock, TRUE);
-
+ (void)curlx_nonblock(sock, TRUE);
+
infof(data, "SOCKS5 access with%s protection granted.\n",
(socksreq[0] == 0)?"out GSS-API data":
((socksreq[0] == 1)?" GSS-API integrity":" GSS-API confidentiality"));
diff --git a/contrib/libs/curl/lib/socks_sspi.c b/contrib/libs/curl/lib/socks_sspi.c
index 7f35acb27d..b9ac2ade8e 100644
--- a/contrib/libs/curl/lib/socks_sspi.c
+++ b/contrib/libs/curl/lib/socks_sspi.c
@@ -5,12 +5,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2009, 2011, Markus Moeller, <markus_moeller@compuserve.com>
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -153,14 +153,14 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
return CURLE_COULDNT_CONNECT;
}
- (void)curlx_nonblock(sock, FALSE);
-
+ (void)curlx_nonblock(sock, FALSE);
+
/* As long as we need to keep sending some context info, and there's no */
/* errors, keep sending it... */
for(;;) {
TCHAR *sname;
- sname = curlx_convert_UTF8_to_tchar(service_name);
+ sname = curlx_convert_UTF8_to_tchar(service_name);
if(!sname)
return CURLE_OUT_OF_MEMORY;
@@ -180,7 +180,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
&sspi_ret_flags,
&expiry);
- curlx_unicodefree(sname);
+ curlx_unicodefree(sname);
if(sspi_recv_token.pvBuffer) {
s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);
@@ -327,7 +327,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
failf(data, "Failed to determine user name.");
return CURLE_COULDNT_CONNECT;
}
- infof(data, "SOCKS5 server authenticated user %s with GSS-API.\n",
+ infof(data, "SOCKS5 server authenticated user %s with GSS-API.\n",
names.sUserName);
s_pSecFn->FreeContextBuffer(names.sUserName);
@@ -589,7 +589,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
memcpy(socksreq, sspi_w_token[0].pvBuffer, sspi_w_token[0].cbBuffer);
s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);
}
- (void)curlx_nonblock(sock, TRUE);
+ (void)curlx_nonblock(sock, TRUE);
infof(data, "SOCKS5 access with%s protection granted.\n",
(socksreq[0] == 0)?"out GSS-API data":
diff --git a/contrib/libs/curl/lib/speedcheck.c b/contrib/libs/curl/lib/speedcheck.c
index b4754d4ca3..2665a44c55 100644
--- a/contrib/libs/curl/lib/speedcheck.c
+++ b/contrib/libs/curl/lib/speedcheck.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/speedcheck.h b/contrib/libs/curl/lib/speedcheck.h
index ca6e6cdefe..1d4c7bfeff 100644
--- a/contrib/libs/curl/lib/speedcheck.h
+++ b/contrib/libs/curl/lib/speedcheck.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/splay.c b/contrib/libs/curl/lib/splay.c
index 9a6c1076e8..98baf5d871 100644
--- a/contrib/libs/curl/lib/splay.c
+++ b/contrib/libs/curl/lib/splay.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1997 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1997 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -206,9 +206,9 @@ struct Curl_tree *Curl_splaygetbest(struct curltime i,
*
* @unittest: 1309
*/
-int Curl_splayremove(struct Curl_tree *t,
- struct Curl_tree *removenode,
- struct Curl_tree **newroot)
+int Curl_splayremove(struct Curl_tree *t,
+ struct Curl_tree *removenode,
+ struct Curl_tree **newroot)
{
static const struct curltime KEY_NOTUSED = {
(time_t)-1, (unsigned int)-1
diff --git a/contrib/libs/curl/lib/splay.h b/contrib/libs/curl/lib/splay.h
index 390662e941..eb9f65f1e0 100644
--- a/contrib/libs/curl/lib/splay.h
+++ b/contrib/libs/curl/lib/splay.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1997 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1997 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -44,9 +44,9 @@ struct Curl_tree *Curl_splaygetbest(struct curltime key,
struct Curl_tree *t,
struct Curl_tree **removed);
-int Curl_splayremove(struct Curl_tree *t,
- struct Curl_tree *removenode,
- struct Curl_tree **newroot);
+int Curl_splayremove(struct Curl_tree *t,
+ struct Curl_tree *removenode,
+ struct Curl_tree **newroot);
#define Curl_splaycomparekeys(i,j) ( ((i.tv_sec) < (j.tv_sec)) ? -1 : \
( ((i.tv_sec) > (j.tv_sec)) ? 1 : \
diff --git a/contrib/libs/curl/lib/strcase.c b/contrib/libs/curl/lib/strcase.c
index 4c6a62a49b..955e3c79ea 100644
--- a/contrib/libs/curl/lib/strcase.c
+++ b/contrib/libs/curl/lib/strcase.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,8 +26,8 @@
#include "strcase.h"
-static char raw_tolower(char in);
-
+static char raw_tolower(char in);
+
/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because
its behavior is altered by the current locale. */
char Curl_raw_toupper(char in)
@@ -95,75 +95,75 @@ char Curl_raw_toupper(char in)
return in;
}
-
-/* Portable, consistent tolower (remember EBCDIC). Do not use tolower() because
- its behavior is altered by the current locale. */
-static char raw_tolower(char in)
-{
-#if !defined(CURL_DOES_CONVERSIONS)
- if(in >= 'A' && in <= 'Z')
- return (char)('a' + in - 'A');
-#else
- switch(in) {
- case 'A':
- return 'a';
- case 'B':
- return 'b';
- case 'C':
- return 'c';
- case 'D':
- return 'd';
- case 'E':
- return 'e';
- case 'F':
- return 'f';
- case 'G':
- return 'g';
- case 'H':
- return 'h';
- case 'I':
- return 'i';
- case 'J':
- return 'j';
- case 'K':
- return 'k';
- case 'L':
- return 'l';
- case 'M':
- return 'm';
- case 'N':
- return 'n';
- case 'O':
- return 'o';
- case 'P':
- return 'p';
- case 'Q':
- return 'q';
- case 'R':
- return 'r';
- case 'S':
- return 's';
- case 'T':
- return 't';
- case 'U':
- return 'u';
- case 'V':
- return 'v';
- case 'W':
- return 'w';
- case 'X':
- return 'x';
- case 'Y':
- return 'y';
- case 'Z':
- return 'z';
- }
-#endif
-
- return in;
-}
-
-
+
+/* Portable, consistent tolower (remember EBCDIC). Do not use tolower() because
+ its behavior is altered by the current locale. */
+static char raw_tolower(char in)
+{
+#if !defined(CURL_DOES_CONVERSIONS)
+ if(in >= 'A' && in <= 'Z')
+ return (char)('a' + in - 'A');
+#else
+ switch(in) {
+ case 'A':
+ return 'a';
+ case 'B':
+ return 'b';
+ case 'C':
+ return 'c';
+ case 'D':
+ return 'd';
+ case 'E':
+ return 'e';
+ case 'F':
+ return 'f';
+ case 'G':
+ return 'g';
+ case 'H':
+ return 'h';
+ case 'I':
+ return 'i';
+ case 'J':
+ return 'j';
+ case 'K':
+ return 'k';
+ case 'L':
+ return 'l';
+ case 'M':
+ return 'm';
+ case 'N':
+ return 'n';
+ case 'O':
+ return 'o';
+ case 'P':
+ return 'p';
+ case 'Q':
+ return 'q';
+ case 'R':
+ return 'r';
+ case 'S':
+ return 's';
+ case 'T':
+ return 't';
+ case 'U':
+ return 'u';
+ case 'V':
+ return 'v';
+ case 'W':
+ return 'w';
+ case 'X':
+ return 'x';
+ case 'Y':
+ return 'y';
+ case 'Z':
+ return 'z';
+ }
+#endif
+
+ return in;
+}
+
+
/*
* Curl_strcasecompare() is for doing "raw" case insensitive strings. This is
* meant to be locale independent and only compare strings we know are safe
@@ -236,21 +236,21 @@ void Curl_strntoupper(char *dest, const char *src, size_t n)
} while(*src++ && --n);
}
-/* Copy a lower case version of the string from src to dest. The
- * strings may overlap. No more than n characters of the string are copied
- * (including any NUL) and the destination string will NOT be
- * NUL-terminated if that limit is reached.
- */
-void Curl_strntolower(char *dest, const char *src, size_t n)
-{
- if(n < 1)
- return;
-
- do {
- *dest++ = raw_tolower(*src);
- } while(*src++ && --n);
-}
-
+/* Copy a lower case version of the string from src to dest. The
+ * strings may overlap. No more than n characters of the string are copied
+ * (including any NUL) and the destination string will NOT be
+ * NUL-terminated if that limit is reached.
+ */
+void Curl_strntolower(char *dest, const char *src, size_t n)
+{
+ if(n < 1)
+ return;
+
+ do {
+ *dest++ = raw_tolower(*src);
+ } while(*src++ && --n);
+}
+
/* --- public functions --- */
int curl_strequal(const char *first, const char *second)
diff --git a/contrib/libs/curl/lib/strcase.h b/contrib/libs/curl/lib/strcase.h
index 0a8cc5348d..10dc698817 100644
--- a/contrib/libs/curl/lib/strcase.h
+++ b/contrib/libs/curl/lib/strcase.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -46,6 +46,6 @@ char Curl_raw_toupper(char in);
#define checkprefix(a,b) curl_strnequal(a,b,strlen(a))
void Curl_strntoupper(char *dest, const char *src, size_t n);
-void Curl_strntolower(char *dest, const char *src, size_t n);
+void Curl_strntolower(char *dest, const char *src, size_t n);
#endif /* HEADER_CURL_STRCASE_H */
diff --git a/contrib/libs/curl/lib/strdup.c b/contrib/libs/curl/lib/strdup.c
index cd47909ade..9af47ea473 100644
--- a/contrib/libs/curl/lib/strdup.c
+++ b/contrib/libs/curl/lib/strdup.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -39,13 +39,13 @@ char *curlx_strdup(const char *str)
if(!str)
return (char *)NULL;
- len = strlen(str) + 1;
+ len = strlen(str) + 1;
- newstr = malloc(len);
+ newstr = malloc(len);
if(!newstr)
return (char *)NULL;
- memcpy(newstr, str, len);
+ memcpy(newstr, str, len);
return newstr;
}
#endif
diff --git a/contrib/libs/curl/lib/strdup.h b/contrib/libs/curl/lib/strdup.h
index fab4ff3587..0936956f89 100644
--- a/contrib/libs/curl/lib/strdup.h
+++ b/contrib/libs/curl/lib/strdup.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/strerror.c b/contrib/libs/curl/lib/strerror.c
index cb514962e0..1751fd38f5 100644
--- a/contrib/libs/curl/lib/strerror.c
+++ b/contrib/libs/curl/lib/strerror.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2004 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2004 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -314,15 +314,15 @@ curl_easy_strerror(CURLcode error)
case CURLE_AUTH_ERROR:
return "An authentication function returned an error";
- case CURLE_HTTP3:
- return "HTTP/3 error";
-
- case CURLE_QUIC_CONNECT_ERROR:
- return "QUIC connection error";
-
- case CURLE_PROXY:
- return "proxy handshake error";
-
+ case CURLE_HTTP3:
+ return "HTTP/3 error";
+
+ case CURLE_QUIC_CONNECT_ERROR:
+ return "QUIC connection error";
+
+ case CURLE_PROXY:
+ return "proxy handshake error";
+
/* error codes not used by current libcurl */
case CURLE_OBSOLETE20:
case CURLE_OBSOLETE24:
@@ -395,12 +395,12 @@ curl_multi_strerror(CURLMcode error)
case CURLM_RECURSIVE_API_CALL:
return "API function called from within callback";
- case CURLM_WAKEUP_FAILURE:
- return "Wakeup is unavailable or failed";
-
- case CURLM_BAD_FUNCTION_ARGUMENT:
- return "A libcurl function was given a bad argument";
-
+ case CURLM_WAKEUP_FAILURE:
+ return "Wakeup is unavailable or failed";
+
+ case CURLM_BAD_FUNCTION_ARGUMENT:
+ return "A libcurl function was given a bad argument";
+
case CURLM_LAST:
break;
}
@@ -451,26 +451,26 @@ curl_share_strerror(CURLSHcode error)
}
#ifdef USE_WINSOCK
-/* This is a helper function for Curl_strerror that converts Winsock error
- * codes (WSAGetLastError) to error messages.
- * Returns NULL if no error message was found for error code.
+/* This is a helper function for Curl_strerror that converts Winsock error
+ * codes (WSAGetLastError) to error messages.
+ * Returns NULL if no error message was found for error code.
*/
static const char *
get_winsock_error (int err, char *buf, size_t len)
{
-#ifndef CURL_DISABLE_VERBOSE_STRINGS
- const char *p;
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
+ const char *p;
#endif
- if(!len)
- return NULL;
-
- *buf = '\0';
-
-#ifdef CURL_DISABLE_VERBOSE_STRINGS
- (void)err;
- return NULL;
-#else
+ if(!len)
+ return NULL;
+
+ *buf = '\0';
+
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+ (void)err;
+ return NULL;
+#else
switch(err) {
case WSAEINTR:
p = "Call interrupted";
@@ -641,54 +641,54 @@ get_winsock_error (int err, char *buf, size_t len)
}
strncpy(buf, p, len);
buf [len-1] = '\0';
- return buf;
-#endif
-}
-#endif /* USE_WINSOCK */
-
-#if defined(WIN32) || defined(_WIN32_WCE)
-/* This is a helper function for Curl_strerror that converts Windows API error
- * codes (GetLastError) to error messages.
- * Returns NULL if no error message was found for error code.
- */
-static const char *
-get_winapi_error(int err, char *buf, size_t buflen)
-{
- char *p;
- wchar_t wbuf[256];
-
- if(!buflen)
- return NULL;
-
- *buf = '\0';
- *wbuf = L'\0';
-
- /* We return the local codepage version of the error string because if it is
- output to the user's terminal it will likely be with functions which
- expect the local codepage (eg fprintf, failf, infof).
- FormatMessageW -> wcstombs is used for Windows CE compatibility. */
- if(FormatMessageW((FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
- LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL)) {
- size_t written = wcstombs(buf, wbuf, buflen - 1);
- if(written != (size_t)-1)
- buf[written] = '\0';
- else
- *buf = '\0';
- }
-
- /* Truncate multiple lines */
- p = strchr(buf, '\n');
- if(p) {
- if(p > buf && *(p-1) == '\r')
- *(p-1) = '\0';
- else
- *p = '\0';
- }
-
- return (*buf ? buf : NULL);
+ return buf;
+#endif
+}
+#endif /* USE_WINSOCK */
+
+#if defined(WIN32) || defined(_WIN32_WCE)
+/* This is a helper function for Curl_strerror that converts Windows API error
+ * codes (GetLastError) to error messages.
+ * Returns NULL if no error message was found for error code.
+ */
+static const char *
+get_winapi_error(int err, char *buf, size_t buflen)
+{
+ char *p;
+ wchar_t wbuf[256];
+
+ if(!buflen)
+ return NULL;
+
+ *buf = '\0';
+ *wbuf = L'\0';
+
+ /* We return the local codepage version of the error string because if it is
+ output to the user's terminal it will likely be with functions which
+ expect the local codepage (eg fprintf, failf, infof).
+ FormatMessageW -> wcstombs is used for Windows CE compatibility. */
+ if(FormatMessageW((FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
+ LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL)) {
+ size_t written = wcstombs(buf, wbuf, buflen - 1);
+ if(written != (size_t)-1)
+ buf[written] = '\0';
+ else
+ *buf = '\0';
+ }
+
+ /* Truncate multiple lines */
+ p = strchr(buf, '\n');
+ if(p) {
+ if(p > buf && *(p-1) == '\r')
+ *(p-1) = '\0';
+ else
+ *p = '\0';
+ }
+
+ return (*buf ? buf : NULL);
}
-#endif /* WIN32 || _WIN32_WCE */
+#endif /* WIN32 || _WIN32_WCE */
/*
* Our thread-safe and smart strerror() replacement.
@@ -700,14 +700,14 @@ get_winapi_error(int err, char *buf, size_t buflen)
*
* We don't do range checking (on systems other than Windows) since there is
* no good reliable and portable way to do it.
- *
- * On Windows different types of error codes overlap. This function has an
- * order of preference when trying to match error codes:
- * CRT (errno), Winsock (WSAGetLastError), Windows API (GetLastError).
- *
- * It may be more correct to call one of the variant functions instead:
- * Call Curl_sspi_strerror if the error code is definitely Windows SSPI.
- * Call Curl_winapi_strerror if the error code is definitely Windows API.
+ *
+ * On Windows different types of error codes overlap. This function has an
+ * order of preference when trying to match error codes:
+ * CRT (errno), Winsock (WSAGetLastError), Windows API (GetLastError).
+ *
+ * It may be more correct to call one of the variant functions instead:
+ * Call Curl_sspi_strerror if the error code is definitely Windows SSPI.
+ * Call Curl_winapi_strerror if the error code is definitely Windows API.
*/
const char *Curl_strerror(int err, char *buf, size_t buflen)
{
@@ -718,30 +718,30 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
char *p;
size_t max;
- if(!buflen)
- return NULL;
-
+ if(!buflen)
+ return NULL;
+
DEBUGASSERT(err >= 0);
max = buflen - 1;
*buf = '\0';
-#if defined(WIN32) || defined(_WIN32_WCE)
-#if defined(WIN32)
+#if defined(WIN32) || defined(_WIN32_WCE)
+#if defined(WIN32)
/* 'sys_nerr' is the maximum errno number, it is not widely portable */
if(err >= 0 && err < sys_nerr)
strncpy(buf, strerror(err), max);
- else
-#endif
- {
- if(
-#ifdef USE_WINSOCK
- !get_winsock_error(err, buf, max) &&
-#endif
- !get_winapi_error((DWORD)err, buf, max))
+ else
+#endif
+ {
+ if(
+#ifdef USE_WINSOCK
+ !get_winsock_error(err, buf, max) &&
+#endif
+ !get_winapi_error((DWORD)err, buf, max))
msnprintf(buf, max, "Unknown error %d (%#x)", err, err);
}
-#else /* not Windows coming up */
+#else /* not Windows coming up */
#if defined(HAVE_STRERROR_R) && defined(HAVE_POSIX_STRERROR_R)
/*
@@ -781,7 +781,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
}
#else
{
- const char *msg = strerror(err);
+ const char *msg = strerror(err);
if(msg)
strncpy(buf, msg, max);
else
@@ -789,9 +789,9 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
}
#endif
-#endif /* end of not Windows */
+#endif /* end of not Windows */
- buf[max] = '\0'; /* make sure the string is null-terminated */
+ buf[max] = '\0'; /* make sure the string is null-terminated */
/* strip trailing '\r\n' or '\n'. */
p = strrchr(buf, '\n');
@@ -812,52 +812,52 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
return buf;
}
-/*
- * Curl_winapi_strerror:
- * Variant of Curl_strerror if the error code is definitely Windows API.
- */
-#if defined(WIN32) || defined(_WIN32_WCE)
-const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen)
-{
-#ifdef PRESERVE_WINDOWS_ERROR_CODE
- DWORD old_win_err = GetLastError();
-#endif
- int old_errno = errno;
-
- if(!buflen)
- return NULL;
-
- *buf = '\0';
-
-#ifndef CURL_DISABLE_VERBOSE_STRINGS
- if(!get_winapi_error(err, buf, buflen)) {
- msnprintf(buf, buflen, "Unknown error %u (0x%08X)", err, err);
- }
-#else
- {
- const char *txt = (err == ERROR_SUCCESS) ? "No error" : "Error";
- strncpy(buf, txt, buflen);
- buf[buflen - 1] = '\0';
- }
-#endif
-
- if(errno != old_errno)
- errno = old_errno;
-
-#ifdef PRESERVE_WINDOWS_ERROR_CODE
- if(old_win_err != GetLastError())
- SetLastError(old_win_err);
-#endif
-
- return buf;
-}
-#endif /* WIN32 || _WIN32_WCE */
-
+/*
+ * Curl_winapi_strerror:
+ * Variant of Curl_strerror if the error code is definitely Windows API.
+ */
+#if defined(WIN32) || defined(_WIN32_WCE)
+const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen)
+{
+#ifdef PRESERVE_WINDOWS_ERROR_CODE
+ DWORD old_win_err = GetLastError();
+#endif
+ int old_errno = errno;
+
+ if(!buflen)
+ return NULL;
+
+ *buf = '\0';
+
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
+ if(!get_winapi_error(err, buf, buflen)) {
+ msnprintf(buf, buflen, "Unknown error %u (0x%08X)", err, err);
+ }
+#else
+ {
+ const char *txt = (err == ERROR_SUCCESS) ? "No error" : "Error";
+ strncpy(buf, txt, buflen);
+ buf[buflen - 1] = '\0';
+ }
+#endif
+
+ if(errno != old_errno)
+ errno = old_errno;
+
+#ifdef PRESERVE_WINDOWS_ERROR_CODE
+ if(old_win_err != GetLastError())
+ SetLastError(old_win_err);
+#endif
+
+ return buf;
+}
+#endif /* WIN32 || _WIN32_WCE */
+
#ifdef USE_WINDOWS_SSPI
-/*
- * Curl_sspi_strerror:
- * Variant of Curl_strerror if the error code is definitely Windows SSPI.
- */
+/*
+ * Curl_sspi_strerror:
+ * Variant of Curl_strerror if the error code is definitely Windows SSPI.
+ */
const char *Curl_sspi_strerror(int err, char *buf, size_t buflen)
{
#ifdef PRESERVE_WINDOWS_ERROR_CODE
@@ -866,120 +866,120 @@ const char *Curl_sspi_strerror(int err, char *buf, size_t buflen)
int old_errno = errno;
const char *txt;
- if(!buflen)
- return NULL;
+ if(!buflen)
+ return NULL;
+
+ *buf = '\0';
- *buf = '\0';
-
#ifndef CURL_DISABLE_VERBOSE_STRINGS
switch(err) {
case SEC_E_OK:
txt = "No error";
break;
-#define SEC2TXT(sec) case sec: txt = #sec; break
- SEC2TXT(CRYPT_E_REVOKED);
- SEC2TXT(SEC_E_ALGORITHM_MISMATCH);
- SEC2TXT(SEC_E_BAD_BINDINGS);
- SEC2TXT(SEC_E_BAD_PKGID);
- SEC2TXT(SEC_E_BUFFER_TOO_SMALL);
- SEC2TXT(SEC_E_CANNOT_INSTALL);
- SEC2TXT(SEC_E_CANNOT_PACK);
- SEC2TXT(SEC_E_CERT_EXPIRED);
- SEC2TXT(SEC_E_CERT_UNKNOWN);
- SEC2TXT(SEC_E_CERT_WRONG_USAGE);
- SEC2TXT(SEC_E_CONTEXT_EXPIRED);
- SEC2TXT(SEC_E_CROSSREALM_DELEGATION_FAILURE);
- SEC2TXT(SEC_E_CRYPTO_SYSTEM_INVALID);
- SEC2TXT(SEC_E_DECRYPT_FAILURE);
- SEC2TXT(SEC_E_DELEGATION_POLICY);
- SEC2TXT(SEC_E_DELEGATION_REQUIRED);
- SEC2TXT(SEC_E_DOWNGRADE_DETECTED);
- SEC2TXT(SEC_E_ENCRYPT_FAILURE);
- SEC2TXT(SEC_E_ILLEGAL_MESSAGE);
- SEC2TXT(SEC_E_INCOMPLETE_CREDENTIALS);
- SEC2TXT(SEC_E_INCOMPLETE_MESSAGE);
- SEC2TXT(SEC_E_INSUFFICIENT_MEMORY);
- SEC2TXT(SEC_E_INTERNAL_ERROR);
- SEC2TXT(SEC_E_INVALID_HANDLE);
- SEC2TXT(SEC_E_INVALID_PARAMETER);
- SEC2TXT(SEC_E_INVALID_TOKEN);
- SEC2TXT(SEC_E_ISSUING_CA_UNTRUSTED);
- SEC2TXT(SEC_E_ISSUING_CA_UNTRUSTED_KDC);
- SEC2TXT(SEC_E_KDC_CERT_EXPIRED);
- SEC2TXT(SEC_E_KDC_CERT_REVOKED);
- SEC2TXT(SEC_E_KDC_INVALID_REQUEST);
- SEC2TXT(SEC_E_KDC_UNABLE_TO_REFER);
- SEC2TXT(SEC_E_KDC_UNKNOWN_ETYPE);
- SEC2TXT(SEC_E_LOGON_DENIED);
- SEC2TXT(SEC_E_MAX_REFERRALS_EXCEEDED);
- SEC2TXT(SEC_E_MESSAGE_ALTERED);
- SEC2TXT(SEC_E_MULTIPLE_ACCOUNTS);
- SEC2TXT(SEC_E_MUST_BE_KDC);
- SEC2TXT(SEC_E_NOT_OWNER);
- SEC2TXT(SEC_E_NO_AUTHENTICATING_AUTHORITY);
- SEC2TXT(SEC_E_NO_CREDENTIALS);
- SEC2TXT(SEC_E_NO_IMPERSONATION);
- SEC2TXT(SEC_E_NO_IP_ADDRESSES);
- SEC2TXT(SEC_E_NO_KERB_KEY);
- SEC2TXT(SEC_E_NO_PA_DATA);
- SEC2TXT(SEC_E_NO_S4U_PROT_SUPPORT);
- SEC2TXT(SEC_E_NO_TGT_REPLY);
- SEC2TXT(SEC_E_OUT_OF_SEQUENCE);
- SEC2TXT(SEC_E_PKINIT_CLIENT_FAILURE);
- SEC2TXT(SEC_E_PKINIT_NAME_MISMATCH);
- SEC2TXT(SEC_E_POLICY_NLTM_ONLY);
- SEC2TXT(SEC_E_QOP_NOT_SUPPORTED);
- SEC2TXT(SEC_E_REVOCATION_OFFLINE_C);
- SEC2TXT(SEC_E_REVOCATION_OFFLINE_KDC);
- SEC2TXT(SEC_E_SECPKG_NOT_FOUND);
- SEC2TXT(SEC_E_SECURITY_QOS_FAILED);
- SEC2TXT(SEC_E_SHUTDOWN_IN_PROGRESS);
- SEC2TXT(SEC_E_SMARTCARD_CERT_EXPIRED);
- SEC2TXT(SEC_E_SMARTCARD_CERT_REVOKED);
- SEC2TXT(SEC_E_SMARTCARD_LOGON_REQUIRED);
- SEC2TXT(SEC_E_STRONG_CRYPTO_NOT_SUPPORTED);
- SEC2TXT(SEC_E_TARGET_UNKNOWN);
- SEC2TXT(SEC_E_TIME_SKEW);
- SEC2TXT(SEC_E_TOO_MANY_PRINCIPALS);
- SEC2TXT(SEC_E_UNFINISHED_CONTEXT_DELETED);
- SEC2TXT(SEC_E_UNKNOWN_CREDENTIALS);
- SEC2TXT(SEC_E_UNSUPPORTED_FUNCTION);
- SEC2TXT(SEC_E_UNSUPPORTED_PREAUTH);
- SEC2TXT(SEC_E_UNTRUSTED_ROOT);
- SEC2TXT(SEC_E_WRONG_CREDENTIAL_HANDLE);
- SEC2TXT(SEC_E_WRONG_PRINCIPAL);
- SEC2TXT(SEC_I_COMPLETE_AND_CONTINUE);
- SEC2TXT(SEC_I_COMPLETE_NEEDED);
- SEC2TXT(SEC_I_CONTEXT_EXPIRED);
- SEC2TXT(SEC_I_CONTINUE_NEEDED);
- SEC2TXT(SEC_I_INCOMPLETE_CREDENTIALS);
- SEC2TXT(SEC_I_LOCAL_LOGON);
- SEC2TXT(SEC_I_NO_LSA_CONTEXT);
- SEC2TXT(SEC_I_RENEGOTIATE);
- SEC2TXT(SEC_I_SIGNATURE_NEEDED);
+#define SEC2TXT(sec) case sec: txt = #sec; break
+ SEC2TXT(CRYPT_E_REVOKED);
+ SEC2TXT(SEC_E_ALGORITHM_MISMATCH);
+ SEC2TXT(SEC_E_BAD_BINDINGS);
+ SEC2TXT(SEC_E_BAD_PKGID);
+ SEC2TXT(SEC_E_BUFFER_TOO_SMALL);
+ SEC2TXT(SEC_E_CANNOT_INSTALL);
+ SEC2TXT(SEC_E_CANNOT_PACK);
+ SEC2TXT(SEC_E_CERT_EXPIRED);
+ SEC2TXT(SEC_E_CERT_UNKNOWN);
+ SEC2TXT(SEC_E_CERT_WRONG_USAGE);
+ SEC2TXT(SEC_E_CONTEXT_EXPIRED);
+ SEC2TXT(SEC_E_CROSSREALM_DELEGATION_FAILURE);
+ SEC2TXT(SEC_E_CRYPTO_SYSTEM_INVALID);
+ SEC2TXT(SEC_E_DECRYPT_FAILURE);
+ SEC2TXT(SEC_E_DELEGATION_POLICY);
+ SEC2TXT(SEC_E_DELEGATION_REQUIRED);
+ SEC2TXT(SEC_E_DOWNGRADE_DETECTED);
+ SEC2TXT(SEC_E_ENCRYPT_FAILURE);
+ SEC2TXT(SEC_E_ILLEGAL_MESSAGE);
+ SEC2TXT(SEC_E_INCOMPLETE_CREDENTIALS);
+ SEC2TXT(SEC_E_INCOMPLETE_MESSAGE);
+ SEC2TXT(SEC_E_INSUFFICIENT_MEMORY);
+ SEC2TXT(SEC_E_INTERNAL_ERROR);
+ SEC2TXT(SEC_E_INVALID_HANDLE);
+ SEC2TXT(SEC_E_INVALID_PARAMETER);
+ SEC2TXT(SEC_E_INVALID_TOKEN);
+ SEC2TXT(SEC_E_ISSUING_CA_UNTRUSTED);
+ SEC2TXT(SEC_E_ISSUING_CA_UNTRUSTED_KDC);
+ SEC2TXT(SEC_E_KDC_CERT_EXPIRED);
+ SEC2TXT(SEC_E_KDC_CERT_REVOKED);
+ SEC2TXT(SEC_E_KDC_INVALID_REQUEST);
+ SEC2TXT(SEC_E_KDC_UNABLE_TO_REFER);
+ SEC2TXT(SEC_E_KDC_UNKNOWN_ETYPE);
+ SEC2TXT(SEC_E_LOGON_DENIED);
+ SEC2TXT(SEC_E_MAX_REFERRALS_EXCEEDED);
+ SEC2TXT(SEC_E_MESSAGE_ALTERED);
+ SEC2TXT(SEC_E_MULTIPLE_ACCOUNTS);
+ SEC2TXT(SEC_E_MUST_BE_KDC);
+ SEC2TXT(SEC_E_NOT_OWNER);
+ SEC2TXT(SEC_E_NO_AUTHENTICATING_AUTHORITY);
+ SEC2TXT(SEC_E_NO_CREDENTIALS);
+ SEC2TXT(SEC_E_NO_IMPERSONATION);
+ SEC2TXT(SEC_E_NO_IP_ADDRESSES);
+ SEC2TXT(SEC_E_NO_KERB_KEY);
+ SEC2TXT(SEC_E_NO_PA_DATA);
+ SEC2TXT(SEC_E_NO_S4U_PROT_SUPPORT);
+ SEC2TXT(SEC_E_NO_TGT_REPLY);
+ SEC2TXT(SEC_E_OUT_OF_SEQUENCE);
+ SEC2TXT(SEC_E_PKINIT_CLIENT_FAILURE);
+ SEC2TXT(SEC_E_PKINIT_NAME_MISMATCH);
+ SEC2TXT(SEC_E_POLICY_NLTM_ONLY);
+ SEC2TXT(SEC_E_QOP_NOT_SUPPORTED);
+ SEC2TXT(SEC_E_REVOCATION_OFFLINE_C);
+ SEC2TXT(SEC_E_REVOCATION_OFFLINE_KDC);
+ SEC2TXT(SEC_E_SECPKG_NOT_FOUND);
+ SEC2TXT(SEC_E_SECURITY_QOS_FAILED);
+ SEC2TXT(SEC_E_SHUTDOWN_IN_PROGRESS);
+ SEC2TXT(SEC_E_SMARTCARD_CERT_EXPIRED);
+ SEC2TXT(SEC_E_SMARTCARD_CERT_REVOKED);
+ SEC2TXT(SEC_E_SMARTCARD_LOGON_REQUIRED);
+ SEC2TXT(SEC_E_STRONG_CRYPTO_NOT_SUPPORTED);
+ SEC2TXT(SEC_E_TARGET_UNKNOWN);
+ SEC2TXT(SEC_E_TIME_SKEW);
+ SEC2TXT(SEC_E_TOO_MANY_PRINCIPALS);
+ SEC2TXT(SEC_E_UNFINISHED_CONTEXT_DELETED);
+ SEC2TXT(SEC_E_UNKNOWN_CREDENTIALS);
+ SEC2TXT(SEC_E_UNSUPPORTED_FUNCTION);
+ SEC2TXT(SEC_E_UNSUPPORTED_PREAUTH);
+ SEC2TXT(SEC_E_UNTRUSTED_ROOT);
+ SEC2TXT(SEC_E_WRONG_CREDENTIAL_HANDLE);
+ SEC2TXT(SEC_E_WRONG_PRINCIPAL);
+ SEC2TXT(SEC_I_COMPLETE_AND_CONTINUE);
+ SEC2TXT(SEC_I_COMPLETE_NEEDED);
+ SEC2TXT(SEC_I_CONTEXT_EXPIRED);
+ SEC2TXT(SEC_I_CONTINUE_NEEDED);
+ SEC2TXT(SEC_I_INCOMPLETE_CREDENTIALS);
+ SEC2TXT(SEC_I_LOCAL_LOGON);
+ SEC2TXT(SEC_I_NO_LSA_CONTEXT);
+ SEC2TXT(SEC_I_RENEGOTIATE);
+ SEC2TXT(SEC_I_SIGNATURE_NEEDED);
default:
txt = "Unknown error";
}
- if(err == SEC_E_ILLEGAL_MESSAGE) {
- msnprintf(buf, buflen,
+ if(err == SEC_E_ILLEGAL_MESSAGE) {
+ msnprintf(buf, buflen,
"SEC_E_ILLEGAL_MESSAGE (0x%08X) - This error usually occurs "
"when a fatal SSL/TLS alert is received (e.g. handshake failed)."
" More detail may be available in the Windows System event log.",
err);
- }
+ }
else {
- char txtbuf[80];
- char msgbuf[256];
-
+ char txtbuf[80];
+ char msgbuf[256];
+
msnprintf(txtbuf, sizeof(txtbuf), "%s (0x%08X)", txt, err);
- if(get_winapi_error(err, msgbuf, sizeof(msgbuf)))
- msnprintf(buf, buflen, "%s - %s", txtbuf, msgbuf);
- else {
- strncpy(buf, txtbuf, buflen);
- buf[buflen - 1] = '\0';
+ if(get_winapi_error(err, msgbuf, sizeof(msgbuf)))
+ msnprintf(buf, buflen, "%s - %s", txtbuf, msgbuf);
+ else {
+ strncpy(buf, txtbuf, buflen);
+ buf[buflen - 1] = '\0';
}
}
@@ -988,8 +988,8 @@ const char *Curl_sspi_strerror(int err, char *buf, size_t buflen)
txt = "No error";
else
txt = "Error";
- strncpy(buf, txt, buflen);
- buf[buflen - 1] = '\0';
+ strncpy(buf, txt, buflen);
+ buf[buflen - 1] = '\0';
#endif
if(errno != old_errno)
@@ -1000,6 +1000,6 @@ const char *Curl_sspi_strerror(int err, char *buf, size_t buflen)
SetLastError(old_win_err);
#endif
- return buf;
+ return buf;
}
#endif /* USE_WINDOWS_SSPI */
diff --git a/contrib/libs/curl/lib/strerror.h b/contrib/libs/curl/lib/strerror.h
index f0f2278ad4..96a7e27c51 100644
--- a/contrib/libs/curl/lib/strerror.h
+++ b/contrib/libs/curl/lib/strerror.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -24,12 +24,12 @@
#include "urldata.h"
-#define STRERROR_LEN 256 /* a suitable length */
+#define STRERROR_LEN 256 /* a suitable length */
const char *Curl_strerror(int err, char *buf, size_t buflen);
-#if defined(WIN32) || defined(_WIN32_WCE)
-const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen);
-#endif
+#if defined(WIN32) || defined(_WIN32_WCE)
+const char *Curl_winapi_strerror(DWORD err, char *buf, size_t buflen);
+#endif
#ifdef USE_WINDOWS_SSPI
const char *Curl_sspi_strerror(int err, char *buf, size_t buflen);
#endif
diff --git a/contrib/libs/curl/lib/strtok.c b/contrib/libs/curl/lib/strtok.c
index 789cd13907..d53e587ab3 100644
--- a/contrib/libs/curl/lib/strtok.c
+++ b/contrib/libs/curl/lib/strtok.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -52,7 +52,7 @@ Curl_strtok_r(char *ptr, const char *sep, char **end)
if(**end) {
/* the end is not a null byte */
- **end = '\0'; /* null-terminate it! */
+ **end = '\0'; /* null-terminate it! */
++*end; /* advance the last pointer to beyond the null byte */
}
diff --git a/contrib/libs/curl/lib/strtok.h b/contrib/libs/curl/lib/strtok.h
index 14d5a4aacd..831ef0c009 100644
--- a/contrib/libs/curl/lib/strtok.h
+++ b/contrib/libs/curl/lib/strtok.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/strtoofft.c b/contrib/libs/curl/lib/strtoofft.c
index 08354b99d7..ac87cfc5bd 100644
--- a/contrib/libs/curl/lib/strtoofft.c
+++ b/contrib/libs/curl/lib/strtoofft.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/strtoofft.h b/contrib/libs/curl/lib/strtoofft.h
index 7a482fce47..4d22ba36c9 100644
--- a/contrib/libs/curl/lib/strtoofft.h
+++ b/contrib/libs/curl/lib/strtoofft.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/system_win32.c b/contrib/libs/curl/lib/system_win32.c
index ab3819ba18..b377da7d8b 100644
--- a/contrib/libs/curl/lib/system_win32.c
+++ b/contrib/libs/curl/lib/system_win32.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,7 +26,7 @@
#include <curl/curl.h>
#include "system_win32.h"
-#include "version_win32.h"
+#include "version_win32.h"
#include "curl_sspi.h"
#include "warnless.h"
@@ -55,7 +55,7 @@ CURLcode Curl_win32_init(long flags)
WSADATA wsaData;
int res;
- wVersionRequested = MAKEWORD(2, 2);
+ wVersionRequested = MAKEWORD(2, 2);
res = WSAStartup(wVersionRequested, &wsaData);
if(res != 0)
@@ -78,9 +78,9 @@ CURLcode Curl_win32_init(long flags)
return CURLE_FAILED_INIT;
}
/* The Windows Sockets DLL is acceptable. Proceed. */
-#elif defined(USE_LWIPSOCK)
+#elif defined(USE_LWIPSOCK)
lwip_init();
-#endif
+#endif
} /* CURL_GLOBAL_WIN32 */
#ifdef USE_WINDOWS_SSPI
@@ -102,14 +102,14 @@ CURLcode Curl_win32_init(long flags)
Curl_if_nametoindex = pIfNameToIndex;
}
- if(curlx_verify_windows_version(6, 0, PLATFORM_WINNT,
- VERSION_GREATER_THAN_EQUAL)) {
+ if(curlx_verify_windows_version(6, 0, PLATFORM_WINNT,
+ VERSION_GREATER_THAN_EQUAL)) {
Curl_isVistaOrGreater = TRUE;
}
else
Curl_isVistaOrGreater = FALSE;
- QueryPerformanceFrequency(&Curl_freq);
+ QueryPerformanceFrequency(&Curl_freq);
return CURLE_OK;
}
diff --git a/contrib/libs/curl/lib/system_win32.h b/contrib/libs/curl/lib/system_win32.h
index e471be07c7..69e0c812c0 100644
--- a/contrib/libs/curl/lib/system_win32.h
+++ b/contrib/libs/curl/lib/system_win32.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/telnet.c b/contrib/libs/curl/lib/telnet.c
index 85b90a8ac2..8bf64a9f2b 100644
--- a/contrib/libs/curl/lib/telnet.c
+++ b/contrib/libs/curl/lib/telnet.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -69,12 +69,12 @@
do { \
x->subend = x->subpointer; \
CURL_SB_CLEAR(x); \
- } while(0)
+ } while(0)
#define CURL_SB_ACCUM(x,c) \
do { \
if(x->subpointer < (x->subbuffer + sizeof(x->subbuffer))) \
*x->subpointer++ = (c); \
- } while(0)
+ } while(0)
#define CURL_SB_GET(x) ((*x->subpointer++)&0xff)
#define CURL_SB_LEN(x) (x->subend - x->subpointer)
@@ -188,7 +188,7 @@ const struct Curl_handler Curl_handler_telnet = {
ZERO_NULL, /* connection_check */
PORT_TELNET, /* defport */
CURLPROTO_TELNET, /* protocol */
- CURLPROTO_TELNET, /* family */
+ CURLPROTO_TELNET, /* family */
PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */
};
@@ -202,7 +202,7 @@ CURLcode init_telnet(struct connectdata *conn)
if(!tn)
return CURLE_OUT_OF_MEMORY;
- conn->data->req.p.telnet = tn; /* make us known */
+ conn->data->req.p.telnet = tn; /* make us known */
tn->telrcv_state = CURL_TS_DATA;
@@ -247,7 +247,7 @@ CURLcode init_telnet(struct connectdata *conn)
static void negotiate(struct connectdata *conn)
{
int i;
- struct TELNET *tn = (struct TELNET *) conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *) conn->data->req.p.telnet;
for(i = 0; i < CURL_NTELOPTS; i++) {
if(i == CURL_TELOPT_ECHO)
@@ -320,7 +320,7 @@ static void send_negotiation(struct connectdata *conn, int cmd, int option)
static
void set_remote_option(struct connectdata *conn, int option, int newstate)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
if(newstate == CURL_YES) {
switch(tn->him[option]) {
case CURL_NO:
@@ -394,7 +394,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
static
void rec_will(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->him[option]) {
case CURL_NO:
if(tn->him_preferred[option] == CURL_YES) {
@@ -442,7 +442,7 @@ void rec_will(struct connectdata *conn, int option)
static
void rec_wont(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->him[option]) {
case CURL_NO:
/* Already disabled */
@@ -484,7 +484,7 @@ void rec_wont(struct connectdata *conn, int option)
static void
set_local_option(struct connectdata *conn, int option, int newstate)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
if(newstate == CURL_YES) {
switch(tn->us[option]) {
case CURL_NO:
@@ -558,7 +558,7 @@ set_local_option(struct connectdata *conn, int option, int newstate)
static
void rec_do(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->us[option]) {
case CURL_NO:
if(tn->us_preferred[option] == CURL_YES) {
@@ -618,7 +618,7 @@ void rec_do(struct connectdata *conn, int option)
static
void rec_dont(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->us[option]) {
case CURL_NO:
/* Already disabled */
@@ -777,7 +777,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
char option_keyword[128] = "";
char option_arg[256] = "";
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
CURLcode result = CURLE_OK;
int binary_option;
@@ -884,7 +884,7 @@ static void suboption(struct connectdata *conn)
char varname[128] = "";
char varval[128] = "";
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2);
switch(CURL_SB_GET(tn)) {
@@ -959,7 +959,7 @@ static void sendsuboption(struct connectdata *conn, int option)
unsigned char *uc1, *uc2;
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
switch(option) {
case CURL_TELOPT_NAWS:
@@ -1017,7 +1017,7 @@ CURLcode telrcv(struct connectdata *conn,
int in = 0;
int startwrite = -1;
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
#define startskipping() \
if(startwrite >= 0) { \
@@ -1235,7 +1235,7 @@ static CURLcode send_telnet_data(struct connectdata *conn,
static CURLcode telnet_done(struct connectdata *conn,
CURLcode status, bool premature)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
(void)status; /* unused */
(void)premature; /* not used */
@@ -1245,7 +1245,7 @@ static CURLcode telnet_done(struct connectdata *conn,
curl_slist_free_all(tn->telnet_vars);
tn->telnet_vars = NULL;
- Curl_safefree(conn->data->req.p.telnet);
+ Curl_safefree(conn->data->req.p.telnet);
return CURLE_OK;
}
@@ -1265,7 +1265,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
DWORD readfile_read;
int err;
#else
- timediff_t interval_ms;
+ timediff_t interval_ms;
struct pollfd pfd[2];
int poll_cnt;
curl_off_t total_dl = 0;
@@ -1283,7 +1283,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
if(result)
return result;
- tn = data->req.p.telnet;
+ tn = data->req.p.telnet;
result = check_telnet_options(conn);
if(result)
@@ -1296,15 +1296,15 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
*/
/* First, create a sockets event object */
- event_handle = WSACreateEvent();
+ event_handle = WSACreateEvent();
if(event_handle == WSA_INVALID_EVENT) {
failf(data, "WSACreateEvent failed (%d)", SOCKERRNO);
return CURLE_FAILED_INIT;
}
/* Tell winsock what events we want to listen to */
- if(WSAEventSelect(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) {
- WSACloseEvent(event_handle);
+ if(WSAEventSelect(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) {
+ WSACloseEvent(event_handle);
return CURLE_OK;
}
@@ -1335,7 +1335,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
DWORD waitret = WaitForMultipleObjects(obj_count, objs,
FALSE, wait_timeout);
switch(waitret) {
-
+
case WAIT_TIMEOUT:
{
for(;;) {
@@ -1405,9 +1405,9 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
break;
case WAIT_OBJECT_0:
- {
+ {
events.lNetworkEvents = 0;
- if(WSAEnumNetworkEvents(sockfd, event_handle, &events) == SOCKET_ERROR) {
+ if(WSAEnumNetworkEvents(sockfd, event_handle, &events) == SOCKET_ERROR) {
err = SOCKERRNO;
if(err != EINPROGRESS) {
infof(data, "WSAEnumNetworkEvents failed (%d)", err);
@@ -1451,8 +1451,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
if(events.lNetworkEvents & FD_CLOSE) {
keepon = FALSE;
}
- }
- break;
+ }
+ break;
}
@@ -1467,7 +1467,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
}
/* We called WSACreateEvent, so call WSACloseEvent */
- if(!WSACloseEvent(event_handle)) {
+ if(!WSACloseEvent(event_handle)) {
infof(data, "WSACloseEvent failed (%d)", SOCKERRNO);
}
#else
diff --git a/contrib/libs/curl/lib/telnet.h b/contrib/libs/curl/lib/telnet.h
index 87631034ce..1427473a9f 100644
--- a/contrib/libs/curl/lib/telnet.h
+++ b/contrib/libs/curl/lib/telnet.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/tftp.c b/contrib/libs/curl/lib/tftp.c
index 7a7beb677b..fba3f5e8c2 100644
--- a/contrib/libs/curl/lib/tftp.c
+++ b/contrib/libs/curl/lib/tftp.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -115,11 +115,11 @@ typedef enum {
TFTP_ERR_NORESPONSE
} tftp_error_t;
-struct tftp_packet {
+struct tftp_packet {
unsigned char *data;
-};
+};
-struct tftp_state_data {
+struct tftp_state_data {
tftp_state_t state;
tftp_mode_t mode;
tftp_error_t error;
@@ -140,21 +140,21 @@ struct tftp_state_data {
int sbytes;
int blksize;
int requested_blksize;
- struct tftp_packet rpacket;
- struct tftp_packet spacket;
-};
+ struct tftp_packet rpacket;
+ struct tftp_packet spacket;
+};
/* Forward declarations */
-static CURLcode tftp_rx(struct tftp_state_data *state, tftp_event_t event);
-static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event);
+static CURLcode tftp_rx(struct tftp_state_data *state, tftp_event_t event);
+static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event);
static CURLcode tftp_connect(struct connectdata *conn, bool *done);
static CURLcode tftp_disconnect(struct connectdata *conn,
bool dead_connection);
static CURLcode tftp_do(struct connectdata *conn, bool *done);
static CURLcode tftp_done(struct connectdata *conn,
CURLcode, bool premature);
-static CURLcode tftp_setup_connection(struct connectdata *conn);
+static CURLcode tftp_setup_connection(struct connectdata *conn);
static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done);
static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done);
static int tftp_getsock(struct connectdata *conn, curl_socket_t *socks);
@@ -183,7 +183,7 @@ const struct Curl_handler Curl_handler_tftp = {
ZERO_NULL, /* connection_check */
PORT_TFTP, /* defport */
CURLPROTO_TFTP, /* protocol */
- CURLPROTO_TFTP, /* family */
+ CURLPROTO_TFTP, /* family */
PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */
};
@@ -197,7 +197,7 @@ const struct Curl_handler Curl_handler_tftp = {
*
*
**********************************************************/
-static CURLcode tftp_set_timeouts(struct tftp_state_data *state)
+static CURLcode tftp_set_timeouts(struct tftp_state_data *state)
{
time_t maxtime, timeout;
timediff_t timeout_ms;
@@ -280,25 +280,25 @@ static CURLcode tftp_set_timeouts(struct tftp_state_data *state)
*
**********************************************************/
-static void setpacketevent(struct tftp_packet *packet, unsigned short num)
+static void setpacketevent(struct tftp_packet *packet, unsigned short num)
{
packet->data[0] = (unsigned char)(num >> 8);
packet->data[1] = (unsigned char)(num & 0xff);
}
-static void setpacketblock(struct tftp_packet *packet, unsigned short num)
+static void setpacketblock(struct tftp_packet *packet, unsigned short num)
{
packet->data[2] = (unsigned char)(num >> 8);
packet->data[3] = (unsigned char)(num & 0xff);
}
-static unsigned short getrpacketevent(const struct tftp_packet *packet)
+static unsigned short getrpacketevent(const struct tftp_packet *packet)
{
return (unsigned short)((packet->data[0] << 8) | packet->data[1]);
}
-static unsigned short getrpacketblock(const struct tftp_packet *packet)
+static unsigned short getrpacketblock(const struct tftp_packet *packet)
{
return (unsigned short)((packet->data[2] << 8) | packet->data[3]);
}
@@ -331,7 +331,7 @@ static const char *tftp_option_get(const char *buf, size_t len,
return &buf[loc];
}
-static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
+static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
const char *ptr, int len)
{
const char *tmp = ptr;
@@ -404,7 +404,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
return CURLE_OK;
}
-static CURLcode tftp_option_add(struct tftp_state_data *state, size_t *csize,
+static CURLcode tftp_option_add(struct tftp_state_data *state, size_t *csize,
char *buf, const char *option)
{
if(( strlen(option) + *csize + 1) > (size_t)state->blksize)
@@ -414,7 +414,7 @@ static CURLcode tftp_option_add(struct tftp_state_data *state, size_t *csize,
return CURLE_OK;
}
-static CURLcode tftp_connect_for_tx(struct tftp_state_data *state,
+static CURLcode tftp_connect_for_tx(struct tftp_state_data *state,
tftp_event_t event)
{
CURLcode result;
@@ -430,7 +430,7 @@ static CURLcode tftp_connect_for_tx(struct tftp_state_data *state,
return tftp_tx(state, event);
}
-static CURLcode tftp_connect_for_rx(struct tftp_state_data *state,
+static CURLcode tftp_connect_for_rx(struct tftp_state_data *state,
tftp_event_t event)
{
CURLcode result;
@@ -446,8 +446,8 @@ static CURLcode tftp_connect_for_rx(struct tftp_state_data *state,
return tftp_rx(state, event);
}
-static CURLcode tftp_send_first(struct tftp_state_data *state,
- tftp_event_t event)
+static CURLcode tftp_send_first(struct tftp_state_data *state,
+ tftp_event_t event)
{
size_t sbytes;
ssize_t senddata;
@@ -488,7 +488,7 @@ static CURLcode tftp_send_first(struct tftp_state_data *state,
file name so we skip the always-present first letter of the path
string. */
result = Curl_urldecode(data, &state->conn->data->state.up.path[1], 0,
- &filename, NULL, REJECT_ZERO);
+ &filename, NULL, REJECT_ZERO);
if(result)
return result;
@@ -600,8 +600,8 @@ static CURLcode tftp_send_first(struct tftp_state_data *state,
* Event handler for the RX state
*
**********************************************************/
-static CURLcode tftp_rx(struct tftp_state_data *state,
- tftp_event_t event)
+static CURLcode tftp_rx(struct tftp_state_data *state,
+ tftp_event_t event)
{
ssize_t sbytes;
int rblock;
@@ -723,7 +723,7 @@ static CURLcode tftp_rx(struct tftp_state_data *state,
* Event handler for the TX state
*
**********************************************************/
-static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
+static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
{
struct Curl_easy *data = state->conn->data;
ssize_t sbytes;
@@ -923,7 +923,7 @@ static CURLcode tftp_translate_code(tftp_error_t error)
* The tftp state machine event dispatcher
*
**********************************************************/
-static CURLcode tftp_state_machine(struct tftp_state_data *state,
+static CURLcode tftp_state_machine(struct tftp_state_data *state,
tftp_event_t event)
{
CURLcode result = CURLE_OK;
@@ -964,7 +964,7 @@ static CURLcode tftp_state_machine(struct tftp_state_data *state,
**********************************************************/
static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection)
{
- struct tftp_state_data *state = conn->proto.tftpc;
+ struct tftp_state_data *state = conn->proto.tftpc;
(void) dead_connection;
/* done, free dynamically allocated pkt buffers */
@@ -986,13 +986,13 @@ static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection)
**********************************************************/
static CURLcode tftp_connect(struct connectdata *conn, bool *done)
{
- struct tftp_state_data *state;
+ struct tftp_state_data *state;
int blksize;
int need_blksize;
blksize = TFTP_BLKSIZE_DEFAULT;
- state = conn->proto.tftpc = calloc(1, sizeof(struct tftp_state_data));
+ state = conn->proto.tftpc = calloc(1, sizeof(struct tftp_state_data));
if(!state)
return CURLE_OUT_OF_MEMORY;
@@ -1081,7 +1081,7 @@ static CURLcode tftp_done(struct connectdata *conn, CURLcode status,
bool premature)
{
CURLcode result = CURLE_OK;
- struct tftp_state_data *state = conn->proto.tftpc;
+ struct tftp_state_data *state = conn->proto.tftpc;
(void)status; /* unused */
(void)premature; /* not used */
@@ -1122,7 +1122,7 @@ static CURLcode tftp_receive_packet(struct connectdata *conn)
curl_socklen_t fromlen;
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct tftp_state_data *state = conn->proto.tftpc;
+ struct tftp_state_data *state = conn->proto.tftpc;
struct SingleRequest *k = &data->req;
/* Receive the packet */
@@ -1209,8 +1209,8 @@ static CURLcode tftp_receive_packet(struct connectdata *conn)
**********************************************************/
static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event)
{
- time_t current;
- struct tftp_state_data *state = conn->proto.tftpc;
+ time_t current;
+ struct tftp_state_data *state = conn->proto.tftpc;
if(event)
*event = TFTP_EVENT_NONE;
@@ -1247,7 +1247,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
tftp_event_t event;
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct tftp_state_data *state = conn->proto.tftpc;
+ struct tftp_state_data *state = conn->proto.tftpc;
long timeout_ms = tftp_state_timeout(conn, &event);
*done = FALSE;
@@ -1331,7 +1331,7 @@ static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done)
static CURLcode tftp_perform(struct connectdata *conn, bool *dophase_done)
{
CURLcode result = CURLE_OK;
- struct tftp_state_data *state = conn->proto.tftpc;
+ struct tftp_state_data *state = conn->proto.tftpc;
*dophase_done = FALSE;
@@ -1361,7 +1361,7 @@ static CURLcode tftp_perform(struct connectdata *conn, bool *dophase_done)
static CURLcode tftp_do(struct connectdata *conn, bool *done)
{
- struct tftp_state_data *state;
+ struct tftp_state_data *state;
CURLcode result;
*done = FALSE;
@@ -1372,7 +1372,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done)
return result;
}
- state = conn->proto.tftpc;
+ state = conn->proto.tftpc;
if(!state)
return CURLE_TFTP_ILLEGAL;
@@ -1387,7 +1387,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done)
return result;
}
-static CURLcode tftp_setup_connection(struct connectdata *conn)
+static CURLcode tftp_setup_connection(struct connectdata *conn)
{
struct Curl_easy *data = conn->data;
char *type;
diff --git a/contrib/libs/curl/lib/tftp.h b/contrib/libs/curl/lib/tftp.h
index ca386c1bf4..4b5bea2757 100644
--- a/contrib/libs/curl/lib/tftp.h
+++ b/contrib/libs/curl/lib/tftp.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/timeval.c b/contrib/libs/curl/lib/timeval.c
index f467a03fa2..8523dad400 100644
--- a/contrib/libs/curl/lib/timeval.c
+++ b/contrib/libs/curl/lib/timeval.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -28,7 +28,7 @@
extern LARGE_INTEGER Curl_freq;
extern bool Curl_isVistaOrGreater;
-/* In case of bug fix this function has a counterpart in tool_util.c */
+/* In case of bug fix this function has a counterpart in tool_util.c */
struct curltime Curl_now(void)
{
struct curltime now;
diff --git a/contrib/libs/curl/lib/timeval.h b/contrib/libs/curl/lib/timeval.h
index bf70e950f7..685e72961d 100644
--- a/contrib/libs/curl/lib/timeval.h
+++ b/contrib/libs/curl/lib/timeval.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/transfer.c b/contrib/libs/curl/lib/transfer.c
index 482d4bc26a..bfd0218fef 100644
--- a/contrib/libs/curl/lib/transfer.c
+++ b/contrib/libs/curl/lib/transfer.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -48,8 +48,8 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
-#elif defined(HAVE_UNISTD_H)
-#include <unistd.h>
+#elif defined(HAVE_UNISTD_H)
+#include <unistd.h>
#endif
#ifndef HAVE_SOCKET
@@ -78,7 +78,7 @@
#include "mime.h"
#include "strcase.h"
#include "urlapi-int.h"
-#include "hsts.h"
+#include "hsts.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -129,13 +129,13 @@ static size_t Curl_trailers_read(char *buffer, size_t size, size_t nitems,
void *raw)
{
struct Curl_easy *data = (struct Curl_easy *)raw;
- struct dynbuf *trailers_buf = &data->state.trailers_buf;
- size_t bytes_left = Curl_dyn_len(trailers_buf) -
- data->state.trailers_bytes_sent;
+ struct dynbuf *trailers_buf = &data->state.trailers_buf;
+ size_t bytes_left = Curl_dyn_len(trailers_buf) -
+ data->state.trailers_bytes_sent;
size_t to_copy = (size*nitems < bytes_left) ? size*nitems : bytes_left;
if(to_copy) {
memcpy(buffer,
- Curl_dyn_ptr(trailers_buf) + data->state.trailers_bytes_sent,
+ Curl_dyn_ptr(trailers_buf) + data->state.trailers_bytes_sent,
to_copy);
data->state.trailers_bytes_sent += to_copy;
}
@@ -145,8 +145,8 @@ static size_t Curl_trailers_read(char *buffer, size_t size, size_t nitems,
static size_t Curl_trailers_left(void *raw)
{
struct Curl_easy *data = (struct Curl_easy *)raw;
- struct dynbuf *trailers_buf = &data->state.trailers_buf;
- return Curl_dyn_len(trailers_buf) - data->state.trailers_bytes_sent;
+ struct dynbuf *trailers_buf = &data->state.trailers_buf;
+ return Curl_dyn_len(trailers_buf) - data->state.trailers_bytes_sent;
}
#endif
@@ -168,7 +168,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
bool sending_http_headers = FALSE;
if(conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_RTSP)) {
- const struct HTTP *http = data->req.p.http;
+ const struct HTTP *http = data->req.p.http;
if(http->sending == HTTPSEND_REQUEST)
/* We're sending the HTTP request headers, not the data.
@@ -188,8 +188,8 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
infof(data,
"Moving trailers state machine from initialized to sending.\n");
data->state.trailers_state = TRAILERS_SENDING;
- Curl_dyn_init(&data->state.trailers_buf, DYN_TRAILERS);
-
+ Curl_dyn_init(&data->state.trailers_buf, DYN_TRAILERS);
+
data->state.trailers_bytes_sent = 0;
Curl_set_in_callback(data, true);
trailers_ret_code = data->set.trailer_callback(&trailers,
@@ -205,7 +205,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
result = CURLE_ABORTED_BY_CALLBACK;
}
if(result) {
- Curl_dyn_free(&data->state.trailers_buf);
+ Curl_dyn_free(&data->state.trailers_buf);
curl_slist_free_all(trailers);
return result;
}
@@ -368,7 +368,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
#ifndef CURL_DISABLE_HTTP
if(data->state.trailers_state == TRAILERS_SENDING &&
!Curl_trailers_left(data)) {
- Curl_dyn_free(&data->state.trailers_buf);
+ Curl_dyn_free(&data->state.trailers_buf);
data->state.trailers_state = TRAILERS_DONE;
data->set.trailer_data = NULL;
data->set.trailer_callback = NULL;
@@ -427,15 +427,15 @@ CURLcode Curl_readrewind(struct connectdata *conn)
CURLOPT_HTTPPOST, call app to rewind
*/
if(conn->handler->protocol & PROTO_FAMILY_HTTP) {
- struct HTTP *http = data->req.p.http;
+ struct HTTP *http = data->req.p.http;
if(http->sendit)
mimepart = http->sendit;
}
if(data->set.postfields)
; /* do nothing */
- else if(data->state.httpreq == HTTPREQ_POST_MIME ||
- data->state.httpreq == HTTPREQ_POST_FORM) {
+ else if(data->state.httpreq == HTTPREQ_POST_MIME ||
+ data->state.httpreq == HTTPREQ_POST_FORM) {
if(Curl_mime_rewind(mimepart)) {
failf(data, "Cannot rewind mime/post data");
return CURLE_SEND_FAIL_REWIND;
@@ -485,15 +485,15 @@ CURLcode Curl_readrewind(struct connectdata *conn)
return CURLE_OK;
}
-static int data_pending(const struct Curl_easy *data)
+static int data_pending(const struct Curl_easy *data)
{
- struct connectdata *conn = data->conn;
-
-#ifdef ENABLE_QUIC
- if(conn->transport == TRNSPRT_QUIC)
- return Curl_quic_data_pending(data);
-#endif
-
+ struct connectdata *conn = data->conn;
+
+#ifdef ENABLE_QUIC
+ if(conn->transport == TRNSPRT_QUIC)
+ return Curl_quic_data_pending(data);
+#endif
+
/* in the case of libssh2, we can never be really sure that we have emptied
its internal buffers so we MUST always try until we get EAGAIN back */
return conn->handler->protocol&(CURLPROTO_SCP|CURLPROTO_SFTP) ||
@@ -563,8 +563,8 @@ static CURLcode readwrite_data(struct Curl_easy *data,
size_t excess = 0; /* excess bytes read */
bool readmore = FALSE; /* used by RTP to signal for more data */
int maxloops = 100;
- char *buf = data->state.buffer;
- DEBUGASSERT(buf);
+ char *buf = data->state.buffer;
+ DEBUGASSERT(buf);
*done = FALSE;
*comeback = FALSE;
@@ -575,20 +575,20 @@ static CURLcode readwrite_data(struct Curl_easy *data,
bool is_empty_data = FALSE;
size_t buffersize = data->set.buffer_size;
size_t bytestoread = buffersize;
-#ifdef USE_NGHTTP2
- bool is_http2 = ((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
- (conn->httpversion == 20));
-#endif
+#ifdef USE_NGHTTP2
+ bool is_http2 = ((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
+ (conn->httpversion == 20));
+#endif
if(
-#ifdef USE_NGHTTP2
+#ifdef USE_NGHTTP2
/* For HTTP/2, read data without caring about the content
length. This is safe because body in HTTP/2 is always
segmented thanks to its framing layer. Meanwhile, we have to
call Curl_read to ensure that http2_handle_stream_close is
called when we read all incoming bytes for a particular
stream. */
- !is_http2 &&
+ !is_http2 &&
#endif
k->size != -1 && !k->header) {
/* make sure we don't read too much */
@@ -599,7 +599,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
if(bytestoread) {
/* receive data from the network! */
- result = Curl_read(conn, conn->sockfd, buf, bytestoread, &nread);
+ result = Curl_read(conn, conn->sockfd, buf, bytestoread, &nread);
/* read would've blocked */
if(CURLE_AGAIN == result)
@@ -627,24 +627,24 @@ static CURLcode readwrite_data(struct Curl_easy *data,
is_empty_data = ((nread == 0) && (k->bodywrites == 0)) ? TRUE : FALSE;
if(0 < nread || is_empty_data) {
- buf[nread] = 0;
+ buf[nread] = 0;
}
else {
- /* if we receive 0 or less here, either the http2 stream is closed or the
- server closed the connection and we bail out from this! */
-#ifdef USE_NGHTTP2
- if(is_http2 && !nread)
- DEBUGF(infof(data, "nread == 0, stream closed, bailing\n"));
- else
-#endif
- DEBUGF(infof(data, "nread <= 0, server closed connection, bailing\n"));
+ /* if we receive 0 or less here, either the http2 stream is closed or the
+ server closed the connection and we bail out from this! */
+#ifdef USE_NGHTTP2
+ if(is_http2 && !nread)
+ DEBUGF(infof(data, "nread == 0, stream closed, bailing\n"));
+ else
+#endif
+ DEBUGF(infof(data, "nread <= 0, server closed connection, bailing\n"));
k->keepon &= ~KEEP_RECV;
break;
}
/* Default buffer to use when we write the buffer, it may be changed
in the flow below before the actual storing is done. */
- k->str = buf;
+ k->str = buf;
if(conn->handler->readwrite) {
result = conn->handler->readwrite(data, conn, &nread, &readmore);
@@ -693,7 +693,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
/* This is not an 'else if' since it may be a rest from the header
parsing, where the beginning of the buffer is headers and the end
is non-headers. */
- if(!k->header && (nread > 0 || is_empty_data)) {
+ if(!k->header && (nread > 0 || is_empty_data)) {
if(data->set.opt_no_body) {
/* data arrives although we want none, bail out */
@@ -724,7 +724,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
infof(data, "Ignoring the response-body\n");
}
if(data->state.resume_from && !k->content_range &&
- (data->state.httpreq == HTTPREQ_GET) &&
+ (data->state.httpreq == HTTPREQ_GET) &&
!k->ignorebody) {
if(k->size == data->state.resume_from) {
@@ -774,9 +774,9 @@ static CURLcode readwrite_data(struct Curl_easy *data,
/* pass data to the debug function before it gets "dechunked" */
if(data->set.verbose) {
if(k->badheader) {
- Curl_debug(data, CURLINFO_DATA_IN,
- Curl_dyn_ptr(&data->state.headerb),
- Curl_dyn_len(&data->state.headerb));
+ Curl_debug(data, CURLINFO_DATA_IN,
+ Curl_dyn_ptr(&data->state.headerb),
+ Curl_dyn_len(&data->state.headerb));
if(k->badheader == HEADER_PARTHEADER)
Curl_debug(data, CURLINFO_DATA_IN,
k->str, (size_t)nread);
@@ -794,14 +794,14 @@ static CURLcode readwrite_data(struct Curl_easy *data,
* and writes away the data. The returned 'nread' holds the number
* of actual data it wrote to the client.
*/
- CURLcode extra;
+ CURLcode extra;
CHUNKcode res =
- Curl_httpchunk_read(conn, k->str, nread, &nread, &extra);
+ Curl_httpchunk_read(conn, k->str, nread, &nread, &extra);
if(CHUNKE_OK < res) {
- if(CHUNKE_PASSTHRU_ERROR == res) {
- failf(data, "Failed reading the chunked-encoded stream");
- return extra;
+ if(CHUNKE_PASSTHRU_ERROR == res) {
+ failf(data, "Failed reading the chunked-encoded stream");
+ return extra;
}
failf(data, "%s in chunked-encoding", Curl_chunked_strerror(res));
return CURLE_RECV_ERROR;
@@ -827,9 +827,9 @@ static CURLcode readwrite_data(struct Curl_easy *data,
/* Account for body content stored in the header buffer */
if((k->badheader == HEADER_PARTHEADER) && !k->ignorebody) {
- size_t headlen = Curl_dyn_len(&data->state.headerb);
- DEBUGF(infof(data, "Increasing bytecount by %zu\n", headlen));
- k->bytecount += headlen;
+ size_t headlen = Curl_dyn_len(&data->state.headerb);
+ DEBUGF(infof(data, "Increasing bytecount by %zu\n", headlen));
+ k->bytecount += headlen;
}
if((-1 != k->maxdownload) &&
@@ -844,7 +844,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
", maxdownload = %" CURL_FORMAT_CURL_OFF_T
", bytecount = %" CURL_FORMAT_CURL_OFF_T "\n",
excess, k->size, k->maxdownload, k->bytecount);
- connclose(conn, "excess found in a read");
+ connclose(conn, "excess found in a read");
}
nread = (ssize_t) (k->maxdownload - k->bytecount);
@@ -864,16 +864,16 @@ static CURLcode readwrite_data(struct Curl_easy *data,
if(k->badheader && !k->ignorebody) {
/* we parsed a piece of data wrongly assuming it was a header
and now we output it as body instead */
- size_t headlen = Curl_dyn_len(&data->state.headerb);
+ size_t headlen = Curl_dyn_len(&data->state.headerb);
/* Don't let excess data pollute body writes */
- if(k->maxdownload == -1 || (curl_off_t)headlen <= k->maxdownload)
+ if(k->maxdownload == -1 || (curl_off_t)headlen <= k->maxdownload)
result = Curl_client_write(conn, CLIENTWRITE_BODY,
- Curl_dyn_ptr(&data->state.headerb),
- headlen);
+ Curl_dyn_ptr(&data->state.headerb),
+ headlen);
else
result = Curl_client_write(conn, CLIENTWRITE_BODY,
- Curl_dyn_ptr(&data->state.headerb),
+ Curl_dyn_ptr(&data->state.headerb),
(size_t)k->maxdownload);
if(result)
@@ -907,14 +907,14 @@ static CURLcode readwrite_data(struct Curl_easy *data,
} /* if(!header and data to read) */
- if(conn->handler->readwrite && excess) {
+ if(conn->handler->readwrite && excess) {
/* Parse the excess data */
k->str += nread;
- if(&k->str[excess] > &buf[data->set.buffer_size]) {
+ if(&k->str[excess] > &buf[data->set.buffer_size]) {
/* the excess amount was too excessive(!), make sure
it doesn't read out of buffer */
- excess = &buf[data->set.buffer_size] - k->str;
+ excess = &buf[data->set.buffer_size] - k->str;
}
nread = (ssize_t)excess;
@@ -938,7 +938,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
break;
}
- } while(data_pending(data) && maxloops--);
+ } while(data_pending(data) && maxloops--);
if(maxloops <= 0) {
/* we mark it as read-again-please */
@@ -1029,7 +1029,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
/* HTTP pollution, this should be written nicer to become more
protocol agnostic. */
size_t fillcount;
- struct HTTP *http = k->p.http;
+ struct HTTP *http = k->p.http;
if((k->exp100 == EXP100_SENDING_REQUEST) &&
(http->sending == HTTPSEND_BODY)) {
@@ -1153,9 +1153,9 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
win_update_buffer_size(conn->writesockfd);
- /* show the data before we change the pointer upload_fromhere */
- Curl_debug(data, CURLINFO_DATA_OUT, k->upload_fromhere,
- (size_t)bytes_written);
+ /* show the data before we change the pointer upload_fromhere */
+ Curl_debug(data, CURLINFO_DATA_OUT, k->upload_fromhere,
+ (size_t)bytes_written);
k->writebytecount += bytes_written;
Curl_pgrsSetUploadCounter(data, k->writebytecount);
@@ -1193,7 +1193,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
}
- } while(0); /* just to break out from! */
+ } while(0); /* just to break out from! */
return CURLE_OK;
}
@@ -1250,7 +1250,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* We go ahead and do a read if we have a readable socket or if
the stream was rewound (in which case we have data in a
buffer) */
- if((k->keepon & KEEP_RECV) && (select_res & CURL_CSELECT_IN)) {
+ if((k->keepon & KEEP_RECV) && (select_res & CURL_CSELECT_IN)) {
result = readwrite_data(data, conn, k, &didwhat, done, comeback);
if(result || *done)
return result;
@@ -1445,16 +1445,16 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
if(!data->change.url && data->set.uh) {
CURLUcode uc;
- free(data->set.str[STRING_SET_URL]);
+ free(data->set.str[STRING_SET_URL]);
uc = curl_url_get(data->set.uh,
- CURLUPART_URL, &data->set.str[STRING_SET_URL], 0);
+ CURLUPART_URL, &data->set.str[STRING_SET_URL], 0);
if(uc) {
failf(data, "No URL set!");
return CURLE_URL_MALFORMAT;
}
}
- data->state.httpreq = data->set.method;
+ data->state.httpreq = data->set.method;
data->change.url = data->set.str[STRING_SET_URL];
/* Init the SSL session ID cache here. We do it here since we want to do it
@@ -1475,10 +1475,10 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
data->state.authproxy.want = data->set.proxyauth;
Curl_safefree(data->info.wouldredirect);
- if(data->state.httpreq == HTTPREQ_PUT)
+ if(data->state.httpreq == HTTPREQ_PUT)
data->state.infilesize = data->set.filesize;
- else if((data->state.httpreq != HTTPREQ_GET) &&
- (data->state.httpreq != HTTPREQ_HEAD)) {
+ else if((data->state.httpreq != HTTPREQ_GET) &&
+ (data->state.httpreq != HTTPREQ_HEAD)) {
data->state.infilesize = data->set.postfieldsize;
if(data->set.postfields && (data->state.infilesize == -1))
data->state.infilesize = (curl_off_t)strlen(data->set.postfields);
@@ -1528,8 +1528,8 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
}
}
#endif
- Curl_http2_init_state(&data->state);
- Curl_hsts_loadcb(data, data->hsts);
+ Curl_http2_init_state(&data->state);
+ Curl_hsts_loadcb(data, data->hsts);
}
return result;
@@ -1611,8 +1611,8 @@ CURLcode Curl_follow(struct Curl_easy *data,
DEBUGASSERT(data->state.uh);
uc = curl_url_set(data->state.uh, CURLUPART_URL, newurl,
- (type == FOLLOW_FAKE) ? CURLU_NON_SUPPORT_SCHEME :
- ((type == FOLLOW_REDIR) ? CURLU_URLENCODE : 0) );
+ (type == FOLLOW_FAKE) ? CURLU_NON_SUPPORT_SCHEME :
+ ((type == FOLLOW_REDIR) ? CURLU_URLENCODE : 0) );
if(uc) {
if(type != FOLLOW_FAKE)
return Curl_uc_to_curlcode(uc);
@@ -1690,12 +1690,12 @@ CURLcode Curl_follow(struct Curl_easy *data,
* This behaviour is forbidden by RFC1945 and the obsolete RFC2616, and
* can be overridden with CURLOPT_POSTREDIR.
*/
- if((data->state.httpreq == HTTPREQ_POST
- || data->state.httpreq == HTTPREQ_POST_FORM
- || data->state.httpreq == HTTPREQ_POST_MIME)
+ if((data->state.httpreq == HTTPREQ_POST
+ || data->state.httpreq == HTTPREQ_POST_FORM
+ || data->state.httpreq == HTTPREQ_POST_MIME)
&& !(data->set.keep_post & CURL_REDIR_POST_301)) {
infof(data, "Switch from POST to GET\n");
- data->state.httpreq = HTTPREQ_GET;
+ data->state.httpreq = HTTPREQ_GET;
}
break;
case 302: /* Found */
@@ -1715,29 +1715,29 @@ CURLcode Curl_follow(struct Curl_easy *data,
* This behaviour is forbidden by RFC1945 and the obsolete RFC2616, and
* can be overridden with CURLOPT_POSTREDIR.
*/
- if((data->state.httpreq == HTTPREQ_POST
- || data->state.httpreq == HTTPREQ_POST_FORM
- || data->state.httpreq == HTTPREQ_POST_MIME)
+ if((data->state.httpreq == HTTPREQ_POST
+ || data->state.httpreq == HTTPREQ_POST_FORM
+ || data->state.httpreq == HTTPREQ_POST_MIME)
&& !(data->set.keep_post & CURL_REDIR_POST_302)) {
infof(data, "Switch from POST to GET\n");
- data->state.httpreq = HTTPREQ_GET;
+ data->state.httpreq = HTTPREQ_GET;
}
break;
case 303: /* See Other */
- /* 'See Other' location is not the resource but a substitute for the
- * resource. In this case we switch the method to GET/HEAD, unless the
- * method is POST and the user specified to keep it as POST.
- * https://github.com/curl/curl/issues/5237#issuecomment-614641049
- */
- if(data->state.httpreq != HTTPREQ_GET &&
- ((data->state.httpreq != HTTPREQ_POST &&
- data->state.httpreq != HTTPREQ_POST_FORM &&
- data->state.httpreq != HTTPREQ_POST_MIME) ||
- !(data->set.keep_post & CURL_REDIR_POST_303))) {
- data->state.httpreq = HTTPREQ_GET;
- data->set.upload = false;
- infof(data, "Switch to %s\n",
+ /* 'See Other' location is not the resource but a substitute for the
+ * resource. In this case we switch the method to GET/HEAD, unless the
+ * method is POST and the user specified to keep it as POST.
+ * https://github.com/curl/curl/issues/5237#issuecomment-614641049
+ */
+ if(data->state.httpreq != HTTPREQ_GET &&
+ ((data->state.httpreq != HTTPREQ_POST &&
+ data->state.httpreq != HTTPREQ_POST_FORM &&
+ data->state.httpreq != HTTPREQ_POST_MIME) ||
+ !(data->set.keep_post & CURL_REDIR_POST_303))) {
+ data->state.httpreq = HTTPREQ_GET;
+ data->set.upload = false;
+ infof(data, "Switch to %s\n",
data->set.opt_no_body?"HEAD":"GET");
}
break;
@@ -1804,15 +1804,15 @@ CURLcode Curl_retry_request(struct connectdata *conn,
retry = TRUE;
}
if(retry) {
-#define CONN_MAX_RETRIES 5
- if(data->state.retrycount++ >= CONN_MAX_RETRIES) {
- failf(data, "Connection died, tried %d times before giving up",
- CONN_MAX_RETRIES);
- data->state.retrycount = 0;
- return CURLE_SEND_ERROR;
- }
- infof(conn->data, "Connection died, retrying a fresh connect\
-(retry count: %d)\n", data->state.retrycount);
+#define CONN_MAX_RETRIES 5
+ if(data->state.retrycount++ >= CONN_MAX_RETRIES) {
+ failf(data, "Connection died, tried %d times before giving up",
+ CONN_MAX_RETRIES);
+ data->state.retrycount = 0;
+ return CURLE_SEND_ERROR;
+ }
+ infof(conn->data, "Connection died, retrying a fresh connect\
+(retry count: %d)\n", data->state.retrycount);
*url = strdup(conn->data->change.url);
if(!*url)
return CURLE_OUT_OF_MEMORY;
@@ -1854,21 +1854,21 @@ Curl_setup_transfer(
{
struct SingleRequest *k = &data->req;
struct connectdata *conn = data->conn;
- struct HTTP *http = data->req.p.http;
- bool httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
- (http->sending == HTTPSEND_REQUEST));
+ struct HTTP *http = data->req.p.http;
+ bool httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
+ (http->sending == HTTPSEND_REQUEST));
DEBUGASSERT(conn != NULL);
DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));
- if(conn->bits.multiplex || conn->httpversion == 20 || httpsending) {
+ if(conn->bits.multiplex || conn->httpversion == 20 || httpsending) {
/* when multiplexing, the read/write sockets need to be the same! */
conn->sockfd = sockindex == -1 ?
((writesockindex == -1 ? CURL_SOCKET_BAD : conn->sock[writesockindex])) :
conn->sock[sockindex];
conn->writesockfd = conn->sockfd;
- if(httpsending)
- /* special and very HTTP-specific */
- writesockindex = FIRSTSOCKET;
+ if(httpsending)
+ /* special and very HTTP-specific */
+ writesockindex = FIRSTSOCKET;
}
else {
conn->sockfd = sockindex == -1 ?
diff --git a/contrib/libs/curl/lib/transfer.h b/contrib/libs/curl/lib/transfer.h
index 482820e9b7..178bb58fb0 100644
--- a/contrib/libs/curl/lib/transfer.h
+++ b/contrib/libs/curl/lib/transfer.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/url.c b/contrib/libs/curl/lib/url.c
index b82b3f54db..95e37dfeed 100644
--- a/contrib/libs/curl/lib/url.c
+++ b/contrib/libs/curl/lib/url.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -96,7 +96,7 @@ bool curl_win32_idn_to_ascii(const char *in, char **out);
#include "getinfo.h"
#include "urlapi-int.h"
#include "system_win32.h"
-#include "hsts.h"
+#include "hsts.h"
/* And now for the protocols */
#include "ftp.h"
@@ -107,7 +107,7 @@ bool curl_win32_idn_to_ascii(const char *in, char **out);
#include "http2.h"
#include "file.h"
#include "curl_ldap.h"
-#include "vssh/ssh.h"
+#include "vssh/ssh.h"
#include "imap.h"
#include "url.h"
#include "connect.h"
@@ -115,7 +115,7 @@ bool curl_win32_idn_to_ascii(const char *in, char **out);
#include "http_ntlm.h"
#include "curl_rtmp.h"
#include "gopher.h"
-#include "mqtt.h"
+#include "mqtt.h"
#include "http_proxy.h"
#include "conncache.h"
#include "multihandle.h"
@@ -123,7 +123,7 @@ bool curl_win32_idn_to_ascii(const char *in, char **out);
#include "strdup.h"
#include "setopt.h"
#include "altsvc.h"
-#include "dynbuf.h"
+#include "dynbuf.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -140,37 +140,37 @@ static void conn_free(struct connectdata *conn);
# error READBUFFER_SIZE is too small
#endif
-/*
-* get_protocol_family()
-*
-* This is used to return the protocol family for a given protocol.
-*
-* Parameters:
-*
-* 'h' [in] - struct Curl_handler pointer.
-*
-* Returns the family as a single bit protocol identifier.
-*/
-static unsigned int get_protocol_family(const struct Curl_handler *h)
-{
- DEBUGASSERT(h);
- DEBUGASSERT(h->family);
- return h->family;
-}
-
-
/*
- * Protocol table. Schemes (roughly) in 2019 popularity order:
- *
- * HTTPS, HTTP, FTP, FTPS, SFTP, FILE, SCP, SMTP, LDAP, IMAPS, TELNET, IMAP,
- * LDAPS, SMTPS, TFTP, SMB, POP3, GOPHER POP3S, RTSP, RTMP, SMBS, DICT
+* get_protocol_family()
+*
+* This is used to return the protocol family for a given protocol.
+*
+* Parameters:
+*
+* 'h' [in] - struct Curl_handler pointer.
+*
+* Returns the family as a single bit protocol identifier.
+*/
+static unsigned int get_protocol_family(const struct Curl_handler *h)
+{
+ DEBUGASSERT(h);
+ DEBUGASSERT(h->family);
+ return h->family;
+}
+
+
+/*
+ * Protocol table. Schemes (roughly) in 2019 popularity order:
+ *
+ * HTTPS, HTTP, FTP, FTPS, SFTP, FILE, SCP, SMTP, LDAP, IMAPS, TELNET, IMAP,
+ * LDAPS, SMTPS, TFTP, SMB, POP3, GOPHER POP3S, RTSP, RTMP, SMBS, DICT
*/
static const struct Curl_handler * const protocols[] = {
-#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
- &Curl_handler_https,
-#endif
-
+#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
+ &Curl_handler_https,
+#endif
+
#ifndef CURL_DISABLE_HTTP
&Curl_handler_http,
#endif
@@ -183,25 +183,25 @@ static const struct Curl_handler * const protocols[] = {
&Curl_handler_ftps,
#endif
-#if defined(USE_SSH)
- &Curl_handler_sftp,
+#if defined(USE_SSH)
+ &Curl_handler_sftp,
+#endif
+
+#ifndef CURL_DISABLE_FILE
+ &Curl_handler_file,
#endif
-#ifndef CURL_DISABLE_FILE
- &Curl_handler_file,
+#if defined(USE_SSH) && !defined(USE_WOLFSSH)
+ &Curl_handler_scp,
+#endif
+
+#ifndef CURL_DISABLE_SMTP
+ &Curl_handler_smtp,
+#ifdef USE_SSL
+ &Curl_handler_smtps,
+#endif
#endif
-#if defined(USE_SSH) && !defined(USE_WOLFSSH)
- &Curl_handler_scp,
-#endif
-
-#ifndef CURL_DISABLE_SMTP
- &Curl_handler_smtp,
-#ifdef USE_SSL
- &Curl_handler_smtps,
-#endif
-#endif
-
#ifndef CURL_DISABLE_LDAP
&Curl_handler_ldap,
#if !defined(CURL_DISABLE_LDAPS) && \
@@ -211,19 +211,19 @@ static const struct Curl_handler * const protocols[] = {
#endif
#endif
-#ifndef CURL_DISABLE_IMAP
- &Curl_handler_imap,
-#ifdef USE_SSL
- &Curl_handler_imaps,
+#ifndef CURL_DISABLE_IMAP
+ &Curl_handler_imap,
+#ifdef USE_SSL
+ &Curl_handler_imaps,
#endif
#endif
-#ifndef CURL_DISABLE_TELNET
- &Curl_handler_telnet,
+#ifndef CURL_DISABLE_TELNET
+ &Curl_handler_telnet,
#endif
-#ifndef CURL_DISABLE_TFTP
- &Curl_handler_tftp,
+#ifndef CURL_DISABLE_TFTP
+ &Curl_handler_tftp,
#endif
#ifndef CURL_DISABLE_POP3
@@ -233,8 +233,8 @@ static const struct Curl_handler * const protocols[] = {
#endif
#endif
-#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
- (CURL_SIZEOF_CURL_OFF_T > 4)
+#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
+ (CURL_SIZEOF_CURL_OFF_T > 4)
&Curl_handler_smb,
#ifdef USE_SSL
&Curl_handler_smbs,
@@ -245,10 +245,10 @@ static const struct Curl_handler * const protocols[] = {
&Curl_handler_rtsp,
#endif
-#ifndef CURL_DISABLE_MQTT
- &Curl_handler_mqtt,
-#endif
-
+#ifndef CURL_DISABLE_MQTT
+ &Curl_handler_mqtt,
+#endif
+
#ifndef CURL_DISABLE_GOPHER
&Curl_handler_gopher,
#endif
@@ -262,10 +262,10 @@ static const struct Curl_handler * const protocols[] = {
&Curl_handler_rtmpts,
#endif
-#ifndef CURL_DISABLE_DICT
- &Curl_handler_dict,
-#endif
-
+#ifndef CURL_DISABLE_DICT
+ &Curl_handler_dict,
+#endif
+
(struct Curl_handler *) NULL
};
@@ -291,7 +291,7 @@ static const struct Curl_handler Curl_handler_dummy = {
ZERO_NULL, /* connection_check */
0, /* defport */
0, /* protocol */
- 0, /* family */
+ 0, /* family */
PROTOPT_NONE /* flags */
};
@@ -299,16 +299,16 @@ void Curl_freeset(struct Curl_easy *data)
{
/* Free all dynamic strings stored in the data->set substructure. */
enum dupstring i;
- enum dupblob j;
-
+ enum dupblob j;
+
for(i = (enum dupstring)0; i < STRING_LAST; i++) {
Curl_safefree(data->set.str[i]);
}
- for(j = (enum dupblob)0; j < BLOB_LAST; j++) {
- Curl_safefree(data->set.blobs[j]);
- }
-
+ for(j = (enum dupblob)0; j < BLOB_LAST; j++) {
+ Curl_safefree(data->set.blobs[j]);
+ }
+
if(data->change.referer_alloc) {
Curl_safefree(data->change.referer);
data->change.referer_alloc = FALSE;
@@ -348,17 +348,17 @@ static void up_free(struct Curl_easy *data)
* when curl_easy_perform() is invoked.
*/
-CURLcode Curl_close(struct Curl_easy **datap)
+CURLcode Curl_close(struct Curl_easy **datap)
{
struct Curl_multi *m;
- struct Curl_easy *data;
+ struct Curl_easy *data;
- if(!datap || !*datap)
+ if(!datap || !*datap)
return CURLE_OK;
- data = *datap;
- *datap = NULL;
-
+ data = *datap;
+ *datap = NULL;
+
Curl_expire_clear(data); /* shut off timers */
m = data->multi;
@@ -407,13 +407,13 @@ CURLcode Curl_close(struct Curl_easy **datap)
up_free(data);
Curl_safefree(data->state.buffer);
- Curl_dyn_free(&data->state.headerb);
+ Curl_dyn_free(&data->state.headerb);
Curl_safefree(data->state.ulbuf);
- Curl_flush_cookies(data, TRUE);
- Curl_altsvc_save(data, data->asi, data->set.str[STRING_ALTSVC]);
- Curl_altsvc_cleanup(&data->asi);
- Curl_hsts_save(data, data->hsts, data->set.str[STRING_HSTS]);
- Curl_hsts_cleanup(&data->hsts);
+ Curl_flush_cookies(data, TRUE);
+ Curl_altsvc_save(data, data->asi, data->set.str[STRING_ALTSVC]);
+ Curl_altsvc_cleanup(&data->asi);
+ Curl_hsts_save(data, data->hsts, data->set.str[STRING_HSTS]);
+ Curl_hsts_cleanup(&data->hsts);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
Curl_http_auth_cleanup_digest(data);
#endif
@@ -433,23 +433,23 @@ CURLcode Curl_close(struct Curl_easy **datap)
Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
}
- Curl_safefree(data->state.aptr.proxyuserpwd);
- Curl_safefree(data->state.aptr.uagent);
- Curl_safefree(data->state.aptr.userpwd);
- Curl_safefree(data->state.aptr.accept_encoding);
- Curl_safefree(data->state.aptr.te);
- Curl_safefree(data->state.aptr.rangeline);
- Curl_safefree(data->state.aptr.ref);
- Curl_safefree(data->state.aptr.host);
- Curl_safefree(data->state.aptr.cookiehost);
- Curl_safefree(data->state.aptr.rtsp_transport);
-
-#ifndef CURL_DISABLE_DOH
- Curl_dyn_free(&data->req.doh.probe[0].serverdoh);
- Curl_dyn_free(&data->req.doh.probe[1].serverdoh);
- curl_slist_free_all(data->req.doh.headers);
-#endif
-
+ Curl_safefree(data->state.aptr.proxyuserpwd);
+ Curl_safefree(data->state.aptr.uagent);
+ Curl_safefree(data->state.aptr.userpwd);
+ Curl_safefree(data->state.aptr.accept_encoding);
+ Curl_safefree(data->state.aptr.te);
+ Curl_safefree(data->state.aptr.rangeline);
+ Curl_safefree(data->state.aptr.ref);
+ Curl_safefree(data->state.aptr.host);
+ Curl_safefree(data->state.aptr.cookiehost);
+ Curl_safefree(data->state.aptr.rtsp_transport);
+
+#ifndef CURL_DISABLE_DOH
+ Curl_dyn_free(&data->req.doh.probe[0].serverdoh);
+ Curl_dyn_free(&data->req.doh.probe[1].serverdoh);
+ curl_slist_free_all(data->req.doh.headers);
+#endif
+
/* destruct wildcard structures if it is needed */
Curl_wildcard_dtor(&data->wildcard);
Curl_freeset(data);
@@ -490,14 +490,14 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
set->postfieldsize = -1; /* unknown size */
set->maxredirs = -1; /* allow any amount by default */
- set->method = HTTPREQ_GET; /* Default HTTP request */
+ set->method = HTTPREQ_GET; /* Default HTTP request */
set->rtspreq = RTSPREQ_OPTIONS; /* Default RTSP request */
#ifndef CURL_DISABLE_FTP
set->ftp_use_epsv = TRUE; /* FTP defaults to EPSV operations */
set->ftp_use_eprt = TRUE; /* FTP defaults to EPRT operations */
set->ftp_use_pret = FALSE; /* mainly useful for drftpd servers */
set->ftp_filemethod = FTPFILE_MULTICWD;
- set->ftp_skip_ip = TRUE; /* skip PASV IP by default */
+ set->ftp_skip_ip = TRUE; /* skip PASV IP by default */
#endif
set->dns_cache_timeout = 60; /* Timeout every 60 seconds by default */
@@ -530,9 +530,9 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
type */
set->ssl.primary.sessionid = TRUE; /* session ID caching enabled by
default */
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
set->proxy_ssl = set->ssl;
-#endif
+#endif
set->new_file_perms = 0644; /* Default permissions */
set->new_directory_perms = 0755; /* Default permissions */
@@ -641,22 +641,22 @@ CURLcode Curl_open(struct Curl_easy **curl)
return result;
}
- result = Curl_init_userdefined(data);
- if(!result) {
- Curl_dyn_init(&data->state.headerb, CURL_MAX_HTTP_HEADER);
- Curl_convert_init(data);
- Curl_initinfo(data);
+ result = Curl_init_userdefined(data);
+ if(!result) {
+ Curl_dyn_init(&data->state.headerb, CURL_MAX_HTTP_HEADER);
+ Curl_convert_init(data);
+ Curl_initinfo(data);
- /* most recent connection is not yet defined */
- data->state.lastconnect_id = -1;
+ /* most recent connection is not yet defined */
+ data->state.lastconnect_id = -1;
- data->progress.flags |= PGRS_HIDE;
- data->state.current_speed = -1; /* init to negative == impossible */
+ data->progress.flags |= PGRS_HIDE;
+ data->state.current_speed = -1; /* init to negative == impossible */
}
if(result) {
Curl_resolver_cleanup(data->state.resolver);
- Curl_dyn_free(&data->state.headerb);
+ Curl_dyn_free(&data->state.headerb);
Curl_freeset(data);
free(data);
data = NULL;
@@ -702,13 +702,13 @@ static void conn_reset_all_postponed_data(struct connectdata *conn)
}
#else /* ! USE_RECV_BEFORE_SEND_WORKAROUND */
/* Use "do-nothing" macro instead of function when workaround not used */
-#define conn_reset_all_postponed_data(c) do {} while(0)
+#define conn_reset_all_postponed_data(c) do {} while(0)
#endif /* ! USE_RECV_BEFORE_SEND_WORKAROUND */
static void conn_shutdown(struct connectdata *conn)
{
- DEBUGASSERT(conn);
+ DEBUGASSERT(conn);
infof(conn->data, "Closing connection %ld\n", conn->connection_id);
DEBUGASSERT(conn->data);
@@ -733,26 +733,26 @@ static void conn_shutdown(struct connectdata *conn)
static void conn_free(struct connectdata *conn)
{
- DEBUGASSERT(conn);
-
- Curl_free_idnconverted_hostname(&conn->host);
- Curl_free_idnconverted_hostname(&conn->conn_to_host);
-#ifndef CURL_DISABLE_PROXY
- Curl_free_idnconverted_hostname(&conn->http_proxy.host);
- Curl_free_idnconverted_hostname(&conn->socks_proxy.host);
- Curl_safefree(conn->http_proxy.user);
- Curl_safefree(conn->socks_proxy.user);
- Curl_safefree(conn->http_proxy.passwd);
- Curl_safefree(conn->socks_proxy.passwd);
- Curl_safefree(conn->http_proxy.host.rawalloc); /* http proxy name buffer */
- Curl_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name buffer */
- Curl_free_primary_ssl_config(&conn->proxy_ssl_config);
-#endif
+ DEBUGASSERT(conn);
+
+ Curl_free_idnconverted_hostname(&conn->host);
+ Curl_free_idnconverted_hostname(&conn->conn_to_host);
+#ifndef CURL_DISABLE_PROXY
+ Curl_free_idnconverted_hostname(&conn->http_proxy.host);
+ Curl_free_idnconverted_hostname(&conn->socks_proxy.host);
+ Curl_safefree(conn->http_proxy.user);
+ Curl_safefree(conn->socks_proxy.user);
+ Curl_safefree(conn->http_proxy.passwd);
+ Curl_safefree(conn->socks_proxy.passwd);
+ Curl_safefree(conn->http_proxy.host.rawalloc); /* http proxy name buffer */
+ Curl_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name buffer */
+ Curl_free_primary_ssl_config(&conn->proxy_ssl_config);
+#endif
Curl_safefree(conn->user);
Curl_safefree(conn->passwd);
Curl_safefree(conn->sasl_authzid);
Curl_safefree(conn->options);
- Curl_dyn_free(&conn->trailer);
+ Curl_dyn_free(&conn->trailer);
Curl_safefree(conn->host.rawalloc); /* host name buffer */
Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */
Curl_safefree(conn->hostname_resolve);
@@ -791,18 +791,18 @@ static void conn_free(struct connectdata *conn)
CURLcode Curl_disconnect(struct Curl_easy *data,
struct connectdata *conn, bool dead_connection)
{
- /* there must be a connection to close */
- DEBUGASSERT(conn);
-
- /* it must be removed from the connection cache */
- DEBUGASSERT(!conn->bundle);
-
- /* there must be an associated transfer */
- DEBUGASSERT(data);
-
- /* the transfer must be detached from the connection */
- DEBUGASSERT(!data->conn);
-
+ /* there must be a connection to close */
+ DEBUGASSERT(conn);
+
+ /* it must be removed from the connection cache */
+ DEBUGASSERT(!conn->bundle);
+
+ /* there must be an associated transfer */
+ DEBUGASSERT(data);
+
+ /* the transfer must be detached from the connection */
+ DEBUGASSERT(!data->conn);
+
/*
* If this connection isn't marked to force-close, leave it open if there
* are other users of it
@@ -819,7 +819,7 @@ CURLcode Curl_disconnect(struct Curl_easy *data,
/* Cleanup NTLM connection-related data */
Curl_http_auth_cleanup_ntlm(conn);
-
+
/* Cleanup NEGOTIATE connection-related data */
Curl_http_auth_cleanup_negotiate(conn);
@@ -883,8 +883,8 @@ static int IsMultiplexingPossible(const struct Curl_easy *handle,
#ifndef CURL_DISABLE_PROXY
static bool
-proxy_info_matches(const struct proxy_info *data,
- const struct proxy_info *needle)
+proxy_info_matches(const struct proxy_info *data,
+ const struct proxy_info *needle)
{
if((data->proxytype == needle->proxytype) &&
(data->port == needle->port) &&
@@ -893,37 +893,37 @@ proxy_info_matches(const struct proxy_info *data,
return FALSE;
}
-
-static bool
-socks_proxy_info_matches(const struct proxy_info *data,
- const struct proxy_info *needle)
-{
- if(!proxy_info_matches(data, needle))
- return FALSE;
-
- /* the user information is case-sensitive
- or at least it is not defined as case-insensitive
- see https://tools.ietf.org/html/rfc3986#section-3.2.1 */
- if((data->user == NULL) != (needle->user == NULL))
- return FALSE;
- /* curl_strequal does a case insentive comparison, so do not use it here! */
- if(data->user &&
- needle->user &&
- strcmp(data->user, needle->user) != 0)
- return FALSE;
- if((data->passwd == NULL) != (needle->passwd == NULL))
- return FALSE;
- /* curl_strequal does a case insentive comparison, so do not use it here! */
- if(data->passwd &&
- needle->passwd &&
- strcmp(data->passwd, needle->passwd) != 0)
- return FALSE;
- return TRUE;
-}
+
+static bool
+socks_proxy_info_matches(const struct proxy_info *data,
+ const struct proxy_info *needle)
+{
+ if(!proxy_info_matches(data, needle))
+ return FALSE;
+
+ /* the user information is case-sensitive
+ or at least it is not defined as case-insensitive
+ see https://tools.ietf.org/html/rfc3986#section-3.2.1 */
+ if((data->user == NULL) != (needle->user == NULL))
+ return FALSE;
+ /* curl_strequal does a case insentive comparison, so do not use it here! */
+ if(data->user &&
+ needle->user &&
+ strcmp(data->user, needle->user) != 0)
+ return FALSE;
+ if((data->passwd == NULL) != (needle->passwd == NULL))
+ return FALSE;
+ /* curl_strequal does a case insentive comparison, so do not use it here! */
+ if(data->passwd &&
+ needle->passwd &&
+ strcmp(data->passwd, needle->passwd) != 0)
+ return FALSE;
+ return TRUE;
+}
#else
/* disabled, won't get called */
#define proxy_info_matches(x,y) FALSE
-#define socks_proxy_info_matches(x,y) FALSE
+#define socks_proxy_info_matches(x,y) FALSE
#endif
/* A connection has to have been idle for a shorter time than 'maxage_conn' to
@@ -1018,12 +1018,12 @@ static int call_extract_if_dead(struct connectdata *conn, void *param)
static void prune_dead_connections(struct Curl_easy *data)
{
struct curltime now = Curl_now();
- timediff_t elapsed;
-
- CONNCACHE_LOCK(data);
- elapsed =
+ timediff_t elapsed;
+
+ CONNCACHE_LOCK(data);
+ elapsed =
Curl_timediff(now, data->state.conn_cache->last_cleanup);
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
if(elapsed >= 1000L) {
struct prunedead prune;
@@ -1031,17 +1031,17 @@ static void prune_dead_connections(struct Curl_easy *data)
prune.extracted = NULL;
while(Curl_conncache_foreach(data, data->state.conn_cache, &prune,
call_extract_if_dead)) {
- /* unlocked */
-
- /* remove connection from cache */
- Curl_conncache_remove_conn(data, prune.extracted, TRUE);
-
+ /* unlocked */
+
+ /* remove connection from cache */
+ Curl_conncache_remove_conn(data, prune.extracted, TRUE);
+
/* disconnect it */
- (void)Curl_disconnect(data, prune.extracted, TRUE);
+ (void)Curl_disconnect(data, prune.extracted, TRUE);
}
- CONNCACHE_LOCK(data);
+ CONNCACHE_LOCK(data);
data->state.conn_cache->last_cleanup = now;
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
}
}
@@ -1074,15 +1074,15 @@ ConnectionExists(struct Curl_easy *data,
bool wantNTLMhttp = ((data->state.authhost.want &
(CURLAUTH_NTLM | CURLAUTH_NTLM_WB)) &&
(needle->handler->protocol & PROTO_FAMILY_HTTP));
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
bool wantProxyNTLMhttp = (needle->bits.proxy_user_passwd &&
((data->state.authproxy.want &
(CURLAUTH_NTLM | CURLAUTH_NTLM_WB)) &&
(needle->handler->protocol & PROTO_FAMILY_HTTP)));
-#else
- bool wantProxyNTLMhttp = FALSE;
+#else
+ bool wantProxyNTLMhttp = FALSE;
+#endif
#endif
-#endif
*force_reuse = FALSE;
*waitpipe = FALSE;
@@ -1093,7 +1093,7 @@ ConnectionExists(struct Curl_easy *data,
&hostbundle);
if(bundle) {
/* Max pipe length is zero (unlimited) for multiplexed connections */
- struct Curl_llist_element *curr;
+ struct Curl_llist_element *curr;
infof(data, "Found bundle for host %s: %p [%s]\n",
hostbundle, (void *)bundle, (bundle->multiuse == BUNDLE_MULTIPLEX ?
@@ -1102,10 +1102,10 @@ ConnectionExists(struct Curl_easy *data,
/* We can't multiplex if we don't know anything about the server */
if(canmultiplex) {
if(bundle->multiuse == BUNDLE_UNKNOWN) {
- if(data->set.pipewait) {
+ if(data->set.pipewait) {
infof(data, "Server doesn't support multiplex yet, wait\n");
*waitpipe = TRUE;
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
return FALSE; /* no re-use */
}
@@ -1126,7 +1126,7 @@ ConnectionExists(struct Curl_easy *data,
curr = bundle->conn_list.head;
while(curr) {
bool match = FALSE;
- size_t multiplexed = 0;
+ size_t multiplexed = 0;
/*
* Note that if we use a HTTP proxy in normal mode (no tunneling), we
@@ -1135,21 +1135,21 @@ ConnectionExists(struct Curl_easy *data,
check = curr->ptr;
curr = curr->next;
- if(check->bits.connect_only || check->bits.close)
- /* connect-only or to-be-closed connections will not be reused */
+ if(check->bits.connect_only || check->bits.close)
+ /* connect-only or to-be-closed connections will not be reused */
continue;
- if(extract_if_dead(check, data)) {
- /* disconnect it */
- (void)Curl_disconnect(data, check, TRUE);
- continue;
- }
+ if(extract_if_dead(check, data)) {
+ /* disconnect it */
+ (void)Curl_disconnect(data, check, TRUE);
+ continue;
+ }
+
+ if(bundle->multiuse == BUNDLE_MULTIPLEX)
+ multiplexed = CONN_INUSE(check);
- if(bundle->multiuse == BUNDLE_MULTIPLEX)
- multiplexed = CONN_INUSE(check);
-
if(canmultiplex) {
- ;
+ ;
}
else {
if(multiplexed) {
@@ -1169,9 +1169,9 @@ ConnectionExists(struct Curl_easy *data,
}
}
- if(check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) {
- foundPendingCandidate = TRUE;
- /* Don't pick a connection that hasn't connected yet */
+ if(check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) {
+ foundPendingCandidate = TRUE;
+ /* Don't pick a connection that hasn't connected yet */
infof(data, "Connection #%ld isn't open enough, can't reuse\n",
check->connection_id);
continue;
@@ -1184,8 +1184,8 @@ ConnectionExists(struct Curl_easy *data,
continue;
if(strcmp(needle->unix_domain_socket, check->unix_domain_socket))
continue;
- if(needle->bits.abstract_unix_socket !=
- check->bits.abstract_unix_socket)
+ if(needle->bits.abstract_unix_socket !=
+ check->bits.abstract_unix_socket)
continue;
}
else if(check->unix_domain_socket)
@@ -1195,21 +1195,21 @@ ConnectionExists(struct Curl_easy *data,
if((needle->handler->flags&PROTOPT_SSL) !=
(check->handler->flags&PROTOPT_SSL))
/* don't do mixed SSL and non-SSL connections */
- if(get_protocol_family(check->handler) !=
- needle->handler->protocol || !check->bits.tls_upgraded)
+ if(get_protocol_family(check->handler) !=
+ needle->handler->protocol || !check->bits.tls_upgraded)
/* except protocols that have been upgraded via TLS */
continue;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(needle->bits.httpproxy != check->bits.httpproxy ||
needle->bits.socksproxy != check->bits.socksproxy)
continue;
- if(needle->bits.socksproxy &&
- !socks_proxy_info_matches(&needle->socks_proxy,
- &check->socks_proxy))
+ if(needle->bits.socksproxy &&
+ !socks_proxy_info_matches(&needle->socks_proxy,
+ &check->socks_proxy))
continue;
-#endif
+#endif
if(needle->bits.conn_to_host != check->bits.conn_to_host)
/* don't mix connections that use the "connect to host" feature and
* connections that don't use this feature */
@@ -1220,7 +1220,7 @@ ConnectionExists(struct Curl_easy *data,
* connections that don't use this feature */
continue;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(needle->bits.httpproxy) {
if(!proxy_info_matches(&needle->http_proxy, &check->http_proxy))
continue;
@@ -1247,7 +1247,7 @@ ConnectionExists(struct Curl_easy *data,
}
}
}
-#endif
+#endif
DEBUGASSERT(!check->data || GOOD_EASY_HANDLE(check->data));
@@ -1256,7 +1256,7 @@ ConnectionExists(struct Curl_easy *data,
already in use so we skip it */
continue;
- if(check->data && (check->data->multi != needle->data->multi))
+ if(check->data && (check->data->multi != needle->data->multi))
/* this could be subject for multiplex use, but only if they belong to
* the same multi handle */
continue;
@@ -1290,25 +1290,25 @@ ConnectionExists(struct Curl_easy *data,
}
}
- if((needle->handler->flags&PROTOPT_SSL)
-#ifndef CURL_DISABLE_PROXY
- || !needle->bits.httpproxy || needle->bits.tunnel_proxy
-#endif
- ) {
+ if((needle->handler->flags&PROTOPT_SSL)
+#ifndef CURL_DISABLE_PROXY
+ || !needle->bits.httpproxy || needle->bits.tunnel_proxy
+#endif
+ ) {
/* The requested connection does not use a HTTP proxy or it uses SSL or
it is a non-SSL protocol tunneled or it is a non-SSL protocol which
is allowed to be upgraded via TLS */
if((strcasecompare(needle->handler->scheme, check->handler->scheme) ||
- (get_protocol_family(check->handler) ==
- needle->handler->protocol && check->bits.tls_upgraded)) &&
+ (get_protocol_family(check->handler) ==
+ needle->handler->protocol && check->bits.tls_upgraded)) &&
(!needle->bits.conn_to_host || strcasecompare(
needle->conn_to_host.name, check->conn_to_host.name)) &&
(!needle->bits.conn_to_port ||
needle->conn_to_port == check->conn_to_port) &&
strcasecompare(needle->host.name, check->host.name) &&
needle->remote_port == check->remote_port) {
- /* The schemes match or the protocol family is the same and the
+ /* The schemes match or the protocol family is the same and the
previous connection was TLS upgraded, and the hostname and host
port match */
if(needle->handler->flags & PROTOPT_SSL) {
@@ -1349,21 +1349,21 @@ ConnectionExists(struct Curl_easy *data,
partway through a handshake!) */
if(wantNTLMhttp) {
if(strcmp(needle->user, check->user) ||
- strcmp(needle->passwd, check->passwd)) {
-
- /* we prefer a credential match, but this is at least a connection
- that can be reused and "upgraded" to NTLM */
- if(check->http_ntlm_state == NTLMSTATE_NONE)
- chosen = check;
+ strcmp(needle->passwd, check->passwd)) {
+
+ /* we prefer a credential match, but this is at least a connection
+ that can be reused and "upgraded" to NTLM */
+ if(check->http_ntlm_state == NTLMSTATE_NONE)
+ chosen = check;
continue;
- }
+ }
}
else if(check->http_ntlm_state != NTLMSTATE_NONE) {
/* Connection is using NTLM auth but we don't want NTLM */
continue;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
/* Same for Proxy NTLM authentication */
if(wantProxyNTLMhttp) {
/* Both check->http_proxy.user and check->http_proxy.passwd can be
@@ -1379,7 +1379,7 @@ ConnectionExists(struct Curl_easy *data,
/* Proxy connection is using NTLM auth but we don't want NTLM */
continue;
}
-#endif
+#endif
if(wantNTLMhttp || wantProxyNTLMhttp) {
/* Credentials are already checked, we can use this connection */
chosen = check;
@@ -1417,13 +1417,13 @@ ConnectionExists(struct Curl_easy *data,
multiplexed);
continue;
}
- else if(multiplexed >=
- Curl_multi_max_concurrent_streams(needle->data->multi)) {
- infof(data, "client side MAX_CONCURRENT_STREAMS reached"
- ", skip (%zu)\n",
- multiplexed);
- continue;
- }
+ else if(multiplexed >=
+ Curl_multi_max_concurrent_streams(needle->data->multi)) {
+ infof(data, "client side MAX_CONCURRENT_STREAMS reached"
+ ", skip (%zu)\n",
+ multiplexed);
+ continue;
+ }
}
#endif
/* When not multiplexed, we have a match here! */
@@ -1443,12 +1443,12 @@ ConnectionExists(struct Curl_easy *data,
if(chosen) {
/* mark it as used before releasing the lock */
chosen->data = data; /* own it! */
- Curl_attach_connnection(data, chosen);
- CONNCACHE_UNLOCK(data);
+ Curl_attach_connnection(data, chosen);
+ CONNCACHE_UNLOCK(data);
*usethis = chosen;
return TRUE; /* yes, we found one to use! */
}
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
if(foundPendingCandidate && data->set.pipewait) {
infof(data,
@@ -1467,10 +1467,10 @@ void Curl_verboseconnect(struct connectdata *conn)
{
if(conn->data->set.verbose)
infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n",
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
conn->bits.socksproxy ? conn->socks_proxy.host.dispname :
conn->bits.httpproxy ? conn->http_proxy.host.dispname :
-#endif
+#endif
conn->bits.conn_to_host ? conn->conn_to_host.dispname :
conn->host.dispname,
conn->ip_addr_str, conn->port, conn->connection_id);
@@ -1480,14 +1480,14 @@ void Curl_verboseconnect(struct connectdata *conn)
/*
* Helpers for IDNA conversions.
*/
-bool Curl_is_ASCII_name(const char *hostname)
+bool Curl_is_ASCII_name(const char *hostname)
{
- /* get an UNSIGNED local version of the pointer */
+ /* get an UNSIGNED local version of the pointer */
const unsigned char *ch = (const unsigned char *)hostname;
- if(!hostname) /* bad input, consider it ASCII! */
- return TRUE;
-
+ if(!hostname) /* bad input, consider it ASCII! */
+ return TRUE;
+
while(*ch) {
if(*ch++ & 0x80)
return FALSE;
@@ -1512,8 +1512,8 @@ static void strip_trailing_dot(struct hostname *host)
/*
* Perform any necessary IDN conversion of hostname
*/
-CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
- struct hostname *host)
+CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
+ struct hostname *host)
{
struct Curl_easy *data = conn->data;
@@ -1528,7 +1528,7 @@ CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
host->dispname = host->name;
/* Check name for non-ASCII and convert hostname to ACE form if we can */
- if(!Curl_is_ASCII_name(host->name)) {
+ if(!Curl_is_ASCII_name(host->name)) {
#ifdef USE_LIBIDN2
if(idn2_check_version(IDN2_VERSION)) {
char *ace_hostname = NULL;
@@ -1561,9 +1561,9 @@ CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
host->name = host->encalloc;
}
else {
- char buffer[STRERROR_LEN];
- failf(data, "Failed to convert %s to ACE; %s\n", host->name,
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ char buffer[STRERROR_LEN];
+ failf(data, "Failed to convert %s to ACE; %s\n", host->name,
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
return CURLE_URL_MALFORMAT;
}
#else
@@ -1576,7 +1576,7 @@ CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
/*
* Frees data allocated by idnconvert_hostname()
*/
-void Curl_free_idnconverted_hostname(struct hostname *host)
+void Curl_free_idnconverted_hostname(struct hostname *host)
{
#if defined(USE_LIBIDN2)
if(host->encalloc) {
@@ -1617,10 +1617,10 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->ssl_extra = ssl;
conn->ssl[0].backend = (void *)ssl;
conn->ssl[1].backend = (void *)(ssl + sslsize);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
conn->proxy_ssl[0].backend = (void *)(ssl + 2 * sslsize);
conn->proxy_ssl[1].backend = (void *)(ssl + 3 * sslsize);
-#endif
+#endif
}
#endif
@@ -1659,7 +1659,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->data = data; /* Setup the association between this connection
and the Curl_easy */
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
conn->http_proxy.proxytype = data->set.proxytype;
conn->socks_proxy.proxytype = CURLPROXY_SOCKS4;
@@ -1693,20 +1693,20 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->ssl_config.verifystatus = data->set.ssl.primary.verifystatus;
conn->ssl_config.verifypeer = data->set.ssl.primary.verifypeer;
conn->ssl_config.verifyhost = data->set.ssl.primary.verifyhost;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
conn->proxy_ssl_config.verifystatus =
data->set.proxy_ssl.primary.verifystatus;
conn->proxy_ssl_config.verifypeer = data->set.proxy_ssl.primary.verifypeer;
conn->proxy_ssl_config.verifyhost = data->set.proxy_ssl.primary.verifyhost;
-#endif
+#endif
conn->ip_version = data->set.ipver;
conn->bits.connect_only = data->set.connect_only;
conn->transport = TRNSPRT_TCP; /* most of them are TCP streams */
#if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) && \
defined(NTLM_WB_ENABLED)
- conn->ntlm.ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
- conn->proxyntlm.ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
+ conn->ntlm.ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
+ conn->proxyntlm.ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
#endif
/* Initialize the easy handle list */
@@ -1729,7 +1729,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
it may live on without (this specific) Curl_easy */
conn->fclosesocket = data->set.fclosesocket;
conn->closesocket_client = data->set.closesocket_client;
- conn->lastused = Curl_now(); /* used now */
+ conn->lastused = Curl_now(); /* used now */
return conn;
error:
@@ -1860,12 +1860,12 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
CURLU *uh;
CURLUcode uc;
char *hostname;
- bool use_set_uh = (data->set.uh && !data->state.this_is_a_follow);
+ bool use_set_uh = (data->set.uh && !data->state.this_is_a_follow);
up_free(data); /* cleanup previous leftovers first */
/* parse the URL */
- if(use_set_uh) {
+ if(use_set_uh) {
uh = data->state.uh = curl_url_dup(data->set.uh);
}
else {
@@ -1888,8 +1888,8 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
data->change.url_alloc = TRUE;
}
- if(!use_set_uh) {
- char *newurl;
+ if(!use_set_uh) {
+ char *newurl;
uc = curl_url_set(uh, CURLUPART_URL, data->change.url,
CURLU_GUESS_SCHEME |
CURLU_NON_SUPPORT_SCHEME |
@@ -1900,82 +1900,82 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
DEBUGF(infof(data, "curl_url_set rejected %s\n", data->change.url));
return Curl_uc_to_curlcode(uc);
}
-
- /* after it was parsed, get the generated normalized version */
- uc = curl_url_get(uh, CURLUPART_URL, &newurl, 0);
- if(uc)
- return Curl_uc_to_curlcode(uc);
- if(data->change.url_alloc)
- free(data->change.url);
- data->change.url = newurl;
- data->change.url_alloc = TRUE;
+
+ /* after it was parsed, get the generated normalized version */
+ uc = curl_url_get(uh, CURLUPART_URL, &newurl, 0);
+ if(uc)
+ return Curl_uc_to_curlcode(uc);
+ if(data->change.url_alloc)
+ free(data->change.url);
+ data->change.url = newurl;
+ data->change.url_alloc = TRUE;
}
uc = curl_url_get(uh, CURLUPART_SCHEME, &data->state.up.scheme, 0);
if(uc)
return Curl_uc_to_curlcode(uc);
- uc = curl_url_get(uh, CURLUPART_HOST, &data->state.up.hostname, 0);
- if(uc) {
- if(!strcasecompare("file", data->state.up.scheme))
- return CURLE_OUT_OF_MEMORY;
- }
-
-#ifdef USE_HSTS
- if(data->hsts && strcasecompare("http", data->state.up.scheme)) {
- if(Curl_hsts(data->hsts, data->state.up.hostname, TRUE)) {
- char *url;
- Curl_safefree(data->state.up.scheme);
- uc = curl_url_set(uh, CURLUPART_SCHEME, "https", 0);
- if(uc)
- return Curl_uc_to_curlcode(uc);
- if(data->change.url_alloc)
- Curl_safefree(data->change.url);
- /* after update, get the updated version */
- uc = curl_url_get(uh, CURLUPART_URL, &url, 0);
- if(uc)
- return Curl_uc_to_curlcode(uc);
- uc = curl_url_get(uh, CURLUPART_SCHEME, &data->state.up.scheme, 0);
- if(uc)
- return Curl_uc_to_curlcode(uc);
- data->change.url = url;
- data->change.url_alloc = TRUE;
- infof(data, "Switched from HTTP to HTTPS due to HSTS => %s\n",
- data->change.url);
- }
- }
-#endif
-
+ uc = curl_url_get(uh, CURLUPART_HOST, &data->state.up.hostname, 0);
+ if(uc) {
+ if(!strcasecompare("file", data->state.up.scheme))
+ return CURLE_OUT_OF_MEMORY;
+ }
+
+#ifdef USE_HSTS
+ if(data->hsts && strcasecompare("http", data->state.up.scheme)) {
+ if(Curl_hsts(data->hsts, data->state.up.hostname, TRUE)) {
+ char *url;
+ Curl_safefree(data->state.up.scheme);
+ uc = curl_url_set(uh, CURLUPART_SCHEME, "https", 0);
+ if(uc)
+ return Curl_uc_to_curlcode(uc);
+ if(data->change.url_alloc)
+ Curl_safefree(data->change.url);
+ /* after update, get the updated version */
+ uc = curl_url_get(uh, CURLUPART_URL, &url, 0);
+ if(uc)
+ return Curl_uc_to_curlcode(uc);
+ uc = curl_url_get(uh, CURLUPART_SCHEME, &data->state.up.scheme, 0);
+ if(uc)
+ return Curl_uc_to_curlcode(uc);
+ data->change.url = url;
+ data->change.url_alloc = TRUE;
+ infof(data, "Switched from HTTP to HTTPS due to HSTS => %s\n",
+ data->change.url);
+ }
+ }
+#endif
+
result = findprotocol(data, conn, data->state.up.scheme);
if(result)
return result;
- /* we don't use the URL API's URL decoder option here since it rejects
- control codes and we want to allow them for some schemes in the user and
- password fields */
- uc = curl_url_get(uh, CURLUPART_USER, &data->state.up.user, 0);
+ /* we don't use the URL API's URL decoder option here since it rejects
+ control codes and we want to allow them for some schemes in the user and
+ password fields */
+ uc = curl_url_get(uh, CURLUPART_USER, &data->state.up.user, 0);
if(!uc) {
- char *decoded;
- result = Curl_urldecode(NULL, data->state.up.user, 0, &decoded, NULL,
- conn->handler->flags&PROTOPT_USERPWDCTRL ?
- REJECT_ZERO : REJECT_CTRL);
- if(result)
- return result;
- conn->user = decoded;
+ char *decoded;
+ result = Curl_urldecode(NULL, data->state.up.user, 0, &decoded, NULL,
+ conn->handler->flags&PROTOPT_USERPWDCTRL ?
+ REJECT_ZERO : REJECT_CTRL);
+ if(result)
+ return result;
+ conn->user = decoded;
conn->bits.user_passwd = TRUE;
}
else if(uc != CURLUE_NO_USER)
return Curl_uc_to_curlcode(uc);
- uc = curl_url_get(uh, CURLUPART_PASSWORD, &data->state.up.password, 0);
+ uc = curl_url_get(uh, CURLUPART_PASSWORD, &data->state.up.password, 0);
if(!uc) {
- char *decoded;
- result = Curl_urldecode(NULL, data->state.up.password, 0, &decoded, NULL,
- conn->handler->flags&PROTOPT_USERPWDCTRL ?
- REJECT_ZERO : REJECT_CTRL);
- if(result)
- return result;
- conn->passwd = decoded;
+ char *decoded;
+ result = Curl_urldecode(NULL, data->state.up.password, 0, &decoded, NULL,
+ conn->handler->flags&PROTOPT_USERPWDCTRL ?
+ REJECT_ZERO : REJECT_CTRL);
+ if(result)
+ return result;
+ conn->passwd = decoded;
conn->bits.user_passwd = TRUE;
}
else if(uc != CURLUE_NO_PASSWORD)
@@ -2009,7 +2009,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
(void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);
hostname = data->state.up.hostname;
- if(hostname && hostname[0] == '[') {
+ if(hostname && hostname[0] == '[') {
/* This looks like an IPv6 address literal. See if there is an address
scope. */
size_t hlen;
@@ -2023,7 +2023,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
}
/* make sure the connect struct gets its own copy of the host name */
- conn->host.rawalloc = strdup(hostname ? hostname : "");
+ conn->host.rawalloc = strdup(hostname ? hostname : "");
if(!conn->host.rawalloc)
return CURLE_OUT_OF_MEMORY;
conn->host.name = conn->host.rawalloc;
@@ -2079,7 +2079,7 @@ static CURLcode setup_range(struct Curl_easy *data)
*/
static CURLcode setup_connection_internals(struct connectdata *conn)
{
- const struct Curl_handler *p;
+ const struct Curl_handler *p;
CURLcode result;
/* Perform setup complement if some. */
@@ -2109,13 +2109,13 @@ static CURLcode setup_connection_internals(struct connectdata *conn)
void Curl_free_request_state(struct Curl_easy *data)
{
- Curl_safefree(data->req.p.http);
+ Curl_safefree(data->req.p.http);
Curl_safefree(data->req.newurl);
-
-#ifndef CURL_DISABLE_DOH
- Curl_close(&data->req.doh.probe[0].easy);
- Curl_close(&data->req.doh.probe[1].easy);
-#endif
+
+#ifndef CURL_DISABLE_DOH
+ Curl_close(&data->req.doh.probe[0].easy);
+ Curl_close(&data->req.doh.probe[1].easy);
+#endif
}
@@ -2426,18 +2426,18 @@ static CURLcode parse_proxy(struct Curl_easy *data,
static CURLcode parse_proxy_auth(struct Curl_easy *data,
struct connectdata *conn)
{
- const char *proxyuser = data->set.str[STRING_PROXYUSERNAME] ?
- data->set.str[STRING_PROXYUSERNAME] : "";
- const char *proxypasswd = data->set.str[STRING_PROXYPASSWORD] ?
- data->set.str[STRING_PROXYPASSWORD] : "";
- CURLcode result = CURLE_OK;
-
- if(proxyuser)
- result = Curl_urldecode(data, proxyuser, 0, &conn->http_proxy.user, NULL,
- REJECT_ZERO);
- if(!result && proxypasswd)
+ const char *proxyuser = data->set.str[STRING_PROXYUSERNAME] ?
+ data->set.str[STRING_PROXYUSERNAME] : "";
+ const char *proxypasswd = data->set.str[STRING_PROXYPASSWORD] ?
+ data->set.str[STRING_PROXYPASSWORD] : "";
+ CURLcode result = CURLE_OK;
+
+ if(proxyuser)
+ result = Curl_urldecode(data, proxyuser, 0, &conn->http_proxy.user, NULL,
+ REJECT_ZERO);
+ if(!result && proxypasswd)
result = Curl_urldecode(data, proxypasswd, 0, &conn->http_proxy.passwd,
- NULL, REJECT_ZERO);
+ NULL, REJECT_ZERO);
return result;
}
@@ -2602,9 +2602,9 @@ static CURLcode create_conn_helper_init_proxy(struct connectdata *conn)
conn->bits.socksproxy = FALSE;
conn->bits.proxy_user_passwd = FALSE;
conn->bits.tunnel_proxy = FALSE;
- /* CURLPROXY_HTTPS does not have its own flag in conn->bits, yet we need
- to signal that CURLPROXY_HTTPS is not used for this connection */
- conn->http_proxy.proxytype = CURLPROXY_HTTP;
+ /* CURLPROXY_HTTPS does not have its own flag in conn->bits, yet we need
+ to signal that CURLPROXY_HTTPS is not used for this connection */
+ conn->http_proxy.proxytype = CURLPROXY_HTTP;
}
out:
@@ -2658,12 +2658,12 @@ CURLcode Curl_parse_login_details(const char *login, const size_t len,
size_t plen;
size_t olen;
- /* the input length check is because this is called directcly from setopt
- and isn't going through the regular string length check */
- size_t llen = strlen(login);
- if(llen > CURL_MAX_INPUT_LENGTH)
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
+ /* the input length check is because this is called directcly from setopt
+ and isn't going through the regular string length check */
+ size_t llen = strlen(login);
+ if(llen > CURL_MAX_INPUT_LENGTH)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
/* Attempt to find the password separator */
if(passwdp) {
psep = strchr(login, ':');
@@ -2860,14 +2860,14 @@ static CURLcode override_login(struct Curl_easy *data,
/* for updated strings, we update them in the URL */
if(user_changed) {
- uc = curl_url_set(data->state.uh, CURLUPART_USER, *userp,
- CURLU_URLENCODE);
+ uc = curl_url_set(data->state.uh, CURLUPART_USER, *userp,
+ CURLU_URLENCODE);
if(uc)
return Curl_uc_to_curlcode(uc);
}
if(passwd_changed) {
- uc = curl_url_set(data->state.uh, CURLUPART_PASSWORD, *passwdp,
- CURLU_URLENCODE);
+ uc = curl_url_set(data->state.uh, CURLUPART_PASSWORD, *passwdp,
+ CURLU_URLENCODE);
if(uc)
return Curl_uc_to_curlcode(uc);
}
@@ -3124,16 +3124,16 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
conn_to_host = conn_to_host->next;
}
-#ifndef CURL_DISABLE_ALTSVC
+#ifndef CURL_DISABLE_ALTSVC
if(data->asi && !host && (port == -1) &&
- ((conn->handler->protocol == CURLPROTO_HTTPS) ||
-#ifdef CURLDEBUG
- /* allow debug builds to circumvent the HTTPS restriction */
- getenv("CURL_ALTSVC_HTTP")
-#else
- 0
-#endif
- )) {
+ ((conn->handler->protocol == CURLPROTO_HTTPS) ||
+#ifdef CURLDEBUG
+ /* allow debug builds to circumvent the HTTPS restriction */
+ getenv("CURL_ALTSVC_HTTP")
+#else
+ 0
+#endif
+ )) {
/* no connect_to match, try alt-svc! */
enum alpnid srcalpnid;
bool hit;
@@ -3225,7 +3225,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
else {
/* this is a fresh connect */
int rc;
- struct Curl_dns_entry *hostaddr = NULL;
+ struct Curl_dns_entry *hostaddr = NULL;
#ifdef USE_UNIX_SOCKETS
if(conn->unix_domain_socket) {
@@ -3240,7 +3240,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
else {
bool longpath = FALSE;
hostaddr->addr = Curl_unix2addr(path, &longpath,
- conn->bits.abstract_unix_socket);
+ conn->bits.abstract_unix_socket);
if(hostaddr->addr)
hostaddr->inuse++;
else {
@@ -3258,7 +3258,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
}
else
#endif
-
+
if(!conn->bits.proxy) {
struct hostname *connhost;
if(conn->bits.conn_to_host)
@@ -3287,11 +3287,11 @@ static CURLcode resolve_server(struct Curl_easy *data,
else if(!hostaddr) {
failf(data, "Couldn't resolve host '%s'", connhost->dispname);
- result = CURLE_COULDNT_RESOLVE_HOST;
+ result = CURLE_COULDNT_RESOLVE_HOST;
/* don't return yet, we need to clean up the timeout first */
}
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
else {
/* This is a proxy that hasn't been resolved yet. */
@@ -3317,7 +3317,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
/* don't return yet, we need to clean up the timeout first */
}
}
-#endif
+#endif
DEBUGASSERT(conn->dns_entry == NULL);
conn->dns_entry = hostaddr;
}
@@ -3333,14 +3333,14 @@ static CURLcode resolve_server(struct Curl_easy *data,
static void reuse_conn(struct connectdata *old_conn,
struct connectdata *conn)
{
-#ifndef CURL_DISABLE_PROXY
- Curl_free_idnconverted_hostname(&old_conn->http_proxy.host);
- Curl_free_idnconverted_hostname(&old_conn->socks_proxy.host);
+#ifndef CURL_DISABLE_PROXY
+ Curl_free_idnconverted_hostname(&old_conn->http_proxy.host);
+ Curl_free_idnconverted_hostname(&old_conn->socks_proxy.host);
free(old_conn->http_proxy.host.rawalloc);
free(old_conn->socks_proxy.host.rawalloc);
- Curl_free_primary_ssl_config(&old_conn->proxy_ssl_config);
-#endif
+ Curl_free_primary_ssl_config(&old_conn->proxy_ssl_config);
+#endif
/* free the SSL config struct from this connection struct as this was
allocated in vain and is targeted for destruction */
Curl_free_primary_ssl_config(&old_conn->ssl_config);
@@ -3360,7 +3360,7 @@ static void reuse_conn(struct connectdata *old_conn,
old_conn->passwd = NULL;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
conn->bits.proxy_user_passwd = old_conn->bits.proxy_user_passwd;
if(conn->bits.proxy_user_passwd) {
/* use the new proxy user name and proxy password though */
@@ -3377,16 +3377,16 @@ static void reuse_conn(struct connectdata *old_conn,
old_conn->http_proxy.passwd = NULL;
old_conn->socks_proxy.passwd = NULL;
}
- Curl_safefree(old_conn->http_proxy.user);
- Curl_safefree(old_conn->socks_proxy.user);
- Curl_safefree(old_conn->http_proxy.passwd);
- Curl_safefree(old_conn->socks_proxy.passwd);
-#endif
+ Curl_safefree(old_conn->http_proxy.user);
+ Curl_safefree(old_conn->socks_proxy.user);
+ Curl_safefree(old_conn->http_proxy.passwd);
+ Curl_safefree(old_conn->socks_proxy.passwd);
+#endif
/* host can change, when doing keepalive with a proxy or if the case is
different this time etc */
- Curl_free_idnconverted_hostname(&conn->host);
- Curl_free_idnconverted_hostname(&conn->conn_to_host);
+ Curl_free_idnconverted_hostname(&conn->host);
+ Curl_free_idnconverted_hostname(&conn->conn_to_host);
Curl_safefree(conn->host.rawalloc);
Curl_safefree(conn->conn_to_host.rawalloc);
conn->host = old_conn->host;
@@ -3493,7 +3493,7 @@ static CURLcode create_conn(struct Curl_easy *data,
result = CURLE_OUT_OF_MEMORY;
goto out;
}
- conn->bits.abstract_unix_socket = data->set.abstract_unix_socket;
+ conn->bits.abstract_unix_socket = data->set.abstract_unix_socket;
}
#endif
@@ -3510,7 +3510,7 @@ static CURLcode create_conn(struct Curl_easy *data,
*************************************************************/
if((conn->given->flags&PROTOPT_SSL) && conn->bits.httpproxy)
conn->bits.tunnel_proxy = TRUE;
-#endif
+#endif
/*************************************************************
* Figure out the remote port number and fix it in the URL
@@ -3541,26 +3541,26 @@ static CURLcode create_conn(struct Curl_easy *data,
/*************************************************************
* IDN-convert the hostnames
*************************************************************/
- result = Curl_idnconvert_hostname(conn, &conn->host);
+ result = Curl_idnconvert_hostname(conn, &conn->host);
if(result)
goto out;
if(conn->bits.conn_to_host) {
- result = Curl_idnconvert_hostname(conn, &conn->conn_to_host);
+ result = Curl_idnconvert_hostname(conn, &conn->conn_to_host);
if(result)
goto out;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy) {
- result = Curl_idnconvert_hostname(conn, &conn->http_proxy.host);
+ result = Curl_idnconvert_hostname(conn, &conn->http_proxy.host);
if(result)
goto out;
}
if(conn->bits.socksproxy) {
- result = Curl_idnconvert_hostname(conn, &conn->socks_proxy.host);
+ result = Curl_idnconvert_hostname(conn, &conn->socks_proxy.host);
if(result)
goto out;
}
-#endif
+#endif
/*************************************************************
* Check whether the host and the "connect to host" are equal.
@@ -3579,7 +3579,7 @@ static CURLcode create_conn(struct Curl_easy *data,
conn->bits.conn_to_port = FALSE;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
/*************************************************************
* If the "connect to" feature is used with an HTTP proxy,
* we set the tunnel_proxy bit.
@@ -3587,7 +3587,7 @@ static CURLcode create_conn(struct Curl_easy *data,
if((conn->bits.conn_to_host || conn->bits.conn_to_port) &&
conn->bits.httpproxy)
conn->bits.tunnel_proxy = TRUE;
-#endif
+#endif
/*************************************************************
* Setup internals depending on protocol. Needs to be done after
@@ -3620,7 +3620,7 @@ static CURLcode create_conn(struct Curl_easy *data,
if(!result) {
conn->bits.tcpconnect[FIRSTSOCKET] = TRUE; /* we are "connected */
- Curl_attach_connnection(data, conn);
+ Curl_attach_connnection(data, conn);
result = Curl_conncache_add_conn(data->state.conn_cache, conn);
if(result)
goto out;
@@ -3655,19 +3655,19 @@ static CURLcode create_conn(struct Curl_easy *data,
copies will be separately allocated.
*/
data->set.ssl.primary.CApath = data->set.str[STRING_SSL_CAPATH_ORIG];
- data->set.ssl.primary.CAfile = data->set.str[STRING_SSL_CAFILE_ORIG];
- data->set.ssl.primary.random_file = data->set.str[STRING_SSL_RANDOM_FILE];
- data->set.ssl.primary.egdsocket = data->set.str[STRING_SSL_EGDSOCKET];
- data->set.ssl.primary.cipher_list =
- data->set.str[STRING_SSL_CIPHER_LIST_ORIG];
- data->set.ssl.primary.cipher_list13 =
- data->set.str[STRING_SSL_CIPHER13_LIST_ORIG];
- data->set.ssl.primary.pinned_key =
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
- data->set.ssl.primary.cert_blob = data->set.blobs[BLOB_CERT_ORIG];
- data->set.ssl.primary.curves = data->set.str[STRING_SSL_EC_CURVES];
-
-#ifndef CURL_DISABLE_PROXY
+ data->set.ssl.primary.CAfile = data->set.str[STRING_SSL_CAFILE_ORIG];
+ data->set.ssl.primary.random_file = data->set.str[STRING_SSL_RANDOM_FILE];
+ data->set.ssl.primary.egdsocket = data->set.str[STRING_SSL_EGDSOCKET];
+ data->set.ssl.primary.cipher_list =
+ data->set.str[STRING_SSL_CIPHER_LIST_ORIG];
+ data->set.ssl.primary.cipher_list13 =
+ data->set.str[STRING_SSL_CIPHER13_LIST_ORIG];
+ data->set.ssl.primary.pinned_key =
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
+ data->set.ssl.primary.cert_blob = data->set.blobs[BLOB_CERT_ORIG];
+ data->set.ssl.primary.curves = data->set.str[STRING_SSL_EC_CURVES];
+
+#ifndef CURL_DISABLE_PROXY
data->set.proxy_ssl.primary.CApath = data->set.str[STRING_SSL_CAPATH_PROXY];
data->set.proxy_ssl.primary.CAfile = data->set.str[STRING_SSL_CAFILE_PROXY];
data->set.proxy_ssl.primary.random_file =
@@ -3677,18 +3677,18 @@ static CURLcode create_conn(struct Curl_easy *data,
data->set.str[STRING_SSL_CIPHER_LIST_PROXY];
data->set.proxy_ssl.primary.cipher_list13 =
data->set.str[STRING_SSL_CIPHER13_LIST_PROXY];
- data->set.proxy_ssl.primary.pinned_key =
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY];
- data->set.proxy_ssl.primary.cert_blob = data->set.blobs[BLOB_CERT_PROXY];
- data->set.proxy_ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_PROXY];
- data->set.proxy_ssl.issuercert = data->set.str[STRING_SSL_ISSUERCERT_PROXY];
- data->set.proxy_ssl.cert_type = data->set.str[STRING_CERT_TYPE_PROXY];
- data->set.proxy_ssl.key = data->set.str[STRING_KEY_PROXY];
- data->set.proxy_ssl.key_type = data->set.str[STRING_KEY_TYPE_PROXY];
- data->set.proxy_ssl.key_passwd = data->set.str[STRING_KEY_PASSWD_PROXY];
- data->set.proxy_ssl.primary.clientcert = data->set.str[STRING_CERT_PROXY];
- data->set.proxy_ssl.key_blob = data->set.blobs[BLOB_KEY_PROXY];
-#endif
+ data->set.proxy_ssl.primary.pinned_key =
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY];
+ data->set.proxy_ssl.primary.cert_blob = data->set.blobs[BLOB_CERT_PROXY];
+ data->set.proxy_ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_PROXY];
+ data->set.proxy_ssl.issuercert = data->set.str[STRING_SSL_ISSUERCERT_PROXY];
+ data->set.proxy_ssl.cert_type = data->set.str[STRING_CERT_TYPE_PROXY];
+ data->set.proxy_ssl.key = data->set.str[STRING_KEY_PROXY];
+ data->set.proxy_ssl.key_type = data->set.str[STRING_KEY_TYPE_PROXY];
+ data->set.proxy_ssl.key_passwd = data->set.str[STRING_KEY_PASSWD_PROXY];
+ data->set.proxy_ssl.primary.clientcert = data->set.str[STRING_CERT_PROXY];
+ data->set.proxy_ssl.key_blob = data->set.blobs[BLOB_KEY_PROXY];
+#endif
data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG];
data->set.ssl.issuercert = data->set.str[STRING_SSL_ISSUERCERT_ORIG];
data->set.ssl.cert_type = data->set.str[STRING_CERT_TYPE_ORIG];
@@ -3698,29 +3698,29 @@ static CURLcode create_conn(struct Curl_easy *data,
data->set.ssl.primary.clientcert = data->set.str[STRING_CERT_ORIG];
#ifdef USE_TLS_SRP
data->set.ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_ORIG];
- data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG];
-#ifndef CURL_DISABLE_PROXY
+ data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG];
+#ifndef CURL_DISABLE_PROXY
data->set.proxy_ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_PROXY];
data->set.proxy_ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_PROXY];
#endif
-#endif
+#endif
+
+ data->set.ssl.key_blob = data->set.blobs[BLOB_KEY_ORIG];
+ data->set.ssl.issuercert_blob = data->set.blobs[BLOB_SSL_ISSUERCERT_ORIG];
- data->set.ssl.key_blob = data->set.blobs[BLOB_KEY_ORIG];
- data->set.ssl.issuercert_blob = data->set.blobs[BLOB_SSL_ISSUERCERT_ORIG];
-
if(!Curl_clone_primary_ssl_config(&data->set.ssl.primary,
- &conn->ssl_config)) {
+ &conn->ssl_config)) {
result = CURLE_OUT_OF_MEMORY;
goto out;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(!Curl_clone_primary_ssl_config(&data->set.proxy_ssl.primary,
&conn->proxy_ssl_config)) {
result = CURLE_OUT_OF_MEMORY;
goto out;
}
-#endif
+#endif
prune_dead_connections(data);
@@ -3758,17 +3758,17 @@ static CURLcode create_conn(struct Curl_easy *data,
conn = conn_temp;
*in_connect = conn;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
infof(data, "Re-using existing connection! (#%ld) with %s %s\n",
conn->connection_id,
conn->bits.proxy?"proxy":"host",
conn->socks_proxy.host.name ? conn->socks_proxy.host.dispname :
conn->http_proxy.host.name ? conn->http_proxy.host.dispname :
- conn->host.dispname);
-#else
- infof(data, "Re-using existing connection! (#%ld) with host %s\n",
- conn->connection_id, conn->host.dispname);
-#endif
+ conn->host.dispname);
+#else
+ infof(data, "Re-using existing connection! (#%ld) with host %s\n",
+ conn->connection_id, conn->host.dispname);
+#endif
}
else {
/* We have decided that we want a new connection. However, we may not
@@ -3800,10 +3800,10 @@ static CURLcode create_conn(struct Curl_easy *data,
/* The bundle is full. Extract the oldest connection. */
conn_candidate = Curl_conncache_extract_bundle(data, bundle);
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
if(conn_candidate)
- (void)Curl_disconnect(data, conn_candidate, FALSE);
+ (void)Curl_disconnect(data, conn_candidate, FALSE);
else {
infof(data, "No more connections allowed to host %s: %zu\n",
bundlehost, max_host_connections);
@@ -3811,7 +3811,7 @@ static CURLcode create_conn(struct Curl_easy *data,
}
}
else
- CONNCACHE_UNLOCK(data);
+ CONNCACHE_UNLOCK(data);
}
@@ -3823,7 +3823,7 @@ static CURLcode create_conn(struct Curl_easy *data,
/* The cache is full. Let's see if we can kill a connection. */
conn_candidate = Curl_conncache_extract_oldest(data);
if(conn_candidate)
- (void)Curl_disconnect(data, conn_candidate, FALSE);
+ (void)Curl_disconnect(data, conn_candidate, FALSE);
else {
infof(data, "No connections available in cache\n");
connections_available = FALSE;
@@ -3844,8 +3844,8 @@ static CURLcode create_conn(struct Curl_easy *data,
* This is a brand new connection, so let's store it in the connection
* cache of ours!
*/
- Curl_attach_connnection(data, conn);
-
+ Curl_attach_connnection(data, conn);
+
result = Curl_conncache_add_conn(data->state.conn_cache, conn);
if(result)
goto out;
@@ -3897,12 +3897,12 @@ static CURLcode create_conn(struct Curl_easy *data,
/* Strip trailing dots. resolve_server copied the name. */
strip_trailing_dot(&conn->host);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy)
strip_trailing_dot(&conn->http_proxy.host);
if(conn->bits.socksproxy)
strip_trailing_dot(&conn->socks_proxy.host);
-#endif
+#endif
if(conn->bits.conn_to_host)
strip_trailing_dot(&conn->conn_to_host);
@@ -3933,23 +3933,23 @@ CURLcode Curl_setup_conn(struct connectdata *conn,
}
*protocol_done = FALSE; /* default to not done */
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
/* set proxy_connect_closed to false unconditionally already here since it
is used strictly to provide extra information to a parent function in the
case of proxy CONNECT failures and we must make sure we don't have it
lingering set from a previous invoke */
conn->bits.proxy_connect_closed = FALSE;
-#endif
+#endif
/*
* Set user-agent. Used for HTTP, but since we can attempt to tunnel
* basically anything through a http proxy we can't limit this based on
* protocol.
*/
if(data->set.str[STRING_USERAGENT]) {
- Curl_safefree(data->state.aptr.uagent);
- data->state.aptr.uagent =
+ Curl_safefree(data->state.aptr.uagent);
+ data->state.aptr.uagent =
aprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]);
- if(!data->state.aptr.uagent)
+ if(!data->state.aptr.uagent)
return CURLE_OUT_OF_MEMORY;
}
@@ -3971,9 +3971,9 @@ CURLcode Curl_setup_conn(struct connectdata *conn,
}
else {
Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */
- if(conn->ssl[FIRSTSOCKET].use ||
- (conn->handler->protocol & PROTO_FAMILY_SSH))
- Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
+ if(conn->ssl[FIRSTSOCKET].use ||
+ (conn->handler->protocol & PROTO_FAMILY_SSH))
+ Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
conn->bits.tcpconnect[FIRSTSOCKET] = TRUE;
*protocol_done = TRUE;
Curl_updateconninfo(conn, conn->sock[FIRSTSOCKET]);
@@ -4003,7 +4003,7 @@ CURLcode Curl_connect(struct Curl_easy *data,
result = create_conn(data, &conn, asyncp);
if(!result) {
- if(CONN_INUSE(conn) > 1)
+ if(CONN_INUSE(conn) > 1)
/* multiplexed */
*protocol_done = TRUE;
else if(!*asyncp) {
@@ -4020,8 +4020,8 @@ CURLcode Curl_connect(struct Curl_easy *data,
else if(result && conn) {
/* We're not allowed to return failure with memory left allocated in the
connectdata struct, free those here */
- Curl_detach_connnection(data);
- Curl_conncache_remove_conn(data, conn, TRUE);
+ Curl_detach_connnection(data);
+ Curl_conncache_remove_conn(data, conn, TRUE);
Curl_disconnect(data, conn, TRUE);
}
@@ -4042,11 +4042,11 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn)
{
struct SingleRequest *k = &data->req;
- /* if this is a pushed stream, we need this: */
- CURLcode result = Curl_preconnect(data);
- if(result)
- return result;
-
+ /* if this is a pushed stream, we need this: */
+ CURLcode result = Curl_preconnect(data);
+ if(result)
+ return result;
+
if(conn) {
conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to
use */
@@ -4061,7 +4061,7 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn)
if(data->set.opt_no_body)
/* in HTTP lingo, no body means using the HEAD request... */
- data->state.httpreq = HTTPREQ_HEAD;
+ data->state.httpreq = HTTPREQ_HEAD;
k->start = Curl_now(); /* start time */
k->now = k->start; /* current time is now */
diff --git a/contrib/libs/curl/lib/url.h b/contrib/libs/curl/lib/url.h
index 43c0212abe..a9d5bda29c 100644
--- a/contrib/libs/curl/lib/url.h
+++ b/contrib/libs/curl/lib/url.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -47,9 +47,9 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn);
CURLcode Curl_open(struct Curl_easy **curl);
CURLcode Curl_init_userdefined(struct Curl_easy *data);
-void Curl_freeset(struct Curl_easy *data);
+void Curl_freeset(struct Curl_easy *data);
CURLcode Curl_uc_to_curlcode(CURLUcode uc);
-CURLcode Curl_close(struct Curl_easy **datap); /* opposite of curl_open() */
+CURLcode Curl_close(struct Curl_easy **datap); /* opposite of curl_open() */
CURLcode Curl_connect(struct Curl_easy *, bool *async, bool *protocol_connect);
CURLcode Curl_disconnect(struct Curl_easy *data,
struct connectdata *, bool dead_connection);
@@ -62,11 +62,11 @@ CURLcode Curl_parse_login_details(const char *login, const size_t len,
const struct Curl_handler *Curl_builtin_scheme(const char *scheme);
-bool Curl_is_ASCII_name(const char *hostname);
-CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
- struct hostname *host);
-void Curl_free_idnconverted_hostname(struct hostname *host);
-
+bool Curl_is_ASCII_name(const char *hostname);
+CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
+ struct hostname *host);
+void Curl_free_idnconverted_hostname(struct hostname *host);
+
#define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */
#define CURL_DEFAULT_HTTPS_PROXY_PORT 443 /* default https proxy port unless
specified */
@@ -77,10 +77,10 @@ void Curl_free_idnconverted_hostname(struct hostname *host);
void Curl_verboseconnect(struct connectdata *conn);
#endif
-#ifdef CURL_DISABLE_PROXY
-#define CONNECT_PROXY_SSL() FALSE
-#else
-
+#ifdef CURL_DISABLE_PROXY
+#define CONNECT_PROXY_SSL() FALSE
+#else
+
#define CONNECT_PROXY_SSL()\
(conn->http_proxy.proxytype == CURLPROXY_HTTPS &&\
!conn->bits.proxy_ssl_connected[sockindex])
@@ -92,6 +92,6 @@ void Curl_verboseconnect(struct connectdata *conn);
#define CONNECT_SECONDARYSOCKET_PROXY_SSL()\
(conn->http_proxy.proxytype == CURLPROXY_HTTPS &&\
!conn->bits.proxy_ssl_connected[SECONDARYSOCKET])
-#endif /* !CURL_DISABLE_PROXY */
+#endif /* !CURL_DISABLE_PROXY */
#endif /* HEADER_CURL_URL_H */
diff --git a/contrib/libs/curl/lib/urlapi-int.h b/contrib/libs/curl/lib/urlapi-int.h
index ade63100e5..4257233094 100644
--- a/contrib/libs/curl/lib/urlapi-int.h
+++ b/contrib/libs/curl/lib/urlapi-int.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -28,7 +28,7 @@
bool Curl_is_absolute_url(const char *url, char *scheme, size_t buflen);
#ifdef DEBUGBUILD
-CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname, bool);
+CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname, bool);
#endif
#endif /* HEADER_CURL_URLAPI_INT_H */
diff --git a/contrib/libs/curl/lib/urlapi.c b/contrib/libs/curl/lib/urlapi.c
index 535bd9d909..ae75963595 100644
--- a/contrib/libs/curl/lib/urlapi.c
+++ b/contrib/libs/curl/lib/urlapi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -64,7 +64,7 @@ struct Curl_URL {
char *fragment;
char *scratch; /* temporary scratch area */
- char *temppath; /* temporary path pointer */
+ char *temppath; /* temporary path pointer */
long portnum; /* the numerical version */
};
@@ -83,7 +83,7 @@ static void free_urlhandle(struct Curl_URL *u)
free(u->query);
free(u->fragment);
free(u->scratch);
- free(u->temppath);
+ free(u->temppath);
}
/* move the full contents of one handle onto another and
@@ -225,7 +225,7 @@ static void strcpy_url(char *output, const char *url, bool relative)
break;
}
}
- *optr = 0; /* null-terminate output buffer */
+ *optr = 0; /* null-terminate output buffer */
}
@@ -353,7 +353,7 @@ static char *concat_url(const char *base, const char *relurl)
else {
/* We got a new absolute path for this server */
- if(relurl[1] == '/') {
+ if(relurl[1] == '/') {
/* the new URL starts with //, just keep the protocol part from the
original one */
*protsep = 0;
@@ -436,7 +436,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
char *userp = NULL;
char *passwdp = NULL;
char *optionsp = NULL;
- const struct Curl_handler *h = NULL;
+ const struct Curl_handler *h = NULL;
/* At this point, we're hoping all the other special cases have
* been taken care of, so conn->host.name is at most
@@ -456,10 +456,10 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
* ftp://user:password@ftp.my.site:8021/README */
*hostname = ++ptr;
- /* if this is a known scheme, get some details */
- if(u->scheme)
- h = Curl_builtin_scheme(u->scheme);
-
+ /* if this is a known scheme, get some details */
+ if(u->scheme)
+ h = Curl_builtin_scheme(u->scheme);
+
/* We could use the login information in the URL so extract it. Only parse
options if the handler says we should. Note that 'h' might be NULL! */
ccode = Curl_parse_login_details(login, ptr - login - 1,
@@ -497,8 +497,8 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
return result;
}
-UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname,
- bool has_scheme)
+UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname,
+ bool has_scheme)
{
char *portptr = NULL;
char endbracket;
@@ -543,14 +543,14 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname,
/* Browser behavior adaptation. If there's a colon with no digits after,
just cut off the name there which makes us ignore the colon and just
- use the default port. Firefox, Chrome and Safari all do that.
-
- Don't do it if the URL has no scheme, to make something that looks like
- a scheme not work!
- */
+ use the default port. Firefox, Chrome and Safari all do that.
+
+ Don't do it if the URL has no scheme, to make something that looks like
+ a scheme not work!
+ */
if(!portptr[1]) {
*portptr = '\0';
- return has_scheme ? CURLUE_OK : CURLUE_BAD_PORT_NUMBER;
+ return has_scheme ? CURLUE_OK : CURLUE_BAD_PORT_NUMBER;
}
if(!ISDIGIT(portptr[1]))
@@ -580,7 +580,7 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname,
}
/* scan for byte values < 31 or 127 */
-static CURLUcode junkscan(const char *part)
+static CURLUcode junkscan(const char *part)
{
if(part) {
static const char badbytes[]={
@@ -589,7 +589,7 @@ static CURLUcode junkscan(const char *part)
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x7f,
- 0x00 /* null-terminate */
+ 0x00 /* null-terminate */
};
size_t n = strlen(part);
size_t nfine = strcspn(part, badbytes);
@@ -607,12 +607,12 @@ static CURLUcode hostname_check(struct Curl_URL *u, char *hostname)
size_t hlen = strlen(hostname);
if(hostname[0] == '[') {
-#ifdef ENABLE_IPV6
+#ifdef ENABLE_IPV6
char dest[16]; /* fits a binary IPv6 address */
-#endif
+#endif
const char *l = "0123456789abcdefABCDEF:.";
- if(hlen < 4) /* '[::]' is the shortest possible valid string */
- return CURLUE_MALFORMED_INPUT;
+ if(hlen < 4) /* '[::]' is the shortest possible valid string */
+ return CURLUE_MALFORMED_INPUT;
hostname++;
hlen -= 2;
@@ -677,7 +677,7 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
CURLUcode result;
bool url_has_scheme = FALSE;
char schemebuf[MAX_SCHEME_LEN + 1];
- const char *schemep = NULL;
+ const char *schemep = NULL;
size_t schemelen = 0;
size_t urllen;
@@ -798,7 +798,7 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
if(junkscan(schemep))
return CURLUE_MALFORMED_INPUT;
-
+
}
else {
/* no scheme! */
@@ -806,7 +806,7 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
if(!(flags & (CURLU_DEFAULT_SCHEME|CURLU_GUESS_SCHEME)))
return CURLUE_MALFORMED_INPUT;
if(flags & CURLU_DEFAULT_SCHEME)
- schemep = DEFAULT_SCHEME;
+ schemep = DEFAULT_SCHEME;
/*
* The URL was badly formatted, let's try without scheme specified.
@@ -819,83 +819,83 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
p++;
len = p - hostp;
- if(len) {
- memcpy(hostname, hostp, len);
- hostname[len] = 0;
+ if(len) {
+ memcpy(hostname, hostp, len);
+ hostname[len] = 0;
+ }
+ else {
+ if(!(flags & CURLU_NO_AUTHORITY))
+ return CURLUE_MALFORMED_INPUT;
}
- else {
- if(!(flags & CURLU_NO_AUTHORITY))
- return CURLUE_MALFORMED_INPUT;
- }
len = strlen(p);
memcpy(path, p, len);
path[len] = 0;
- if(schemep) {
- u->scheme = strdup(schemep);
- if(!u->scheme)
- return CURLUE_OUT_OF_MEMORY;
- }
+ if(schemep) {
+ u->scheme = strdup(schemep);
+ if(!u->scheme)
+ return CURLUE_OUT_OF_MEMORY;
+ }
}
if(junkscan(path))
return CURLUE_MALFORMED_INPUT;
- if((flags & CURLU_URLENCODE) && path[0]) {
- /* worst case output length is 3x the original! */
- char *newp = malloc(strlen(path) * 3);
- if(!newp)
- return CURLUE_OUT_OF_MEMORY;
- path_alloced = TRUE;
- strcpy_url(newp, path, TRUE); /* consider it relative */
- u->temppath = path = newp;
- }
-
- fragment = strchr(path, '#');
- if(fragment) {
- *fragment++ = 0;
- if(fragment[0]) {
- u->fragment = strdup(fragment);
- if(!u->fragment)
- return CURLUE_OUT_OF_MEMORY;
- }
- }
-
+ if((flags & CURLU_URLENCODE) && path[0]) {
+ /* worst case output length is 3x the original! */
+ char *newp = malloc(strlen(path) * 3);
+ if(!newp)
+ return CURLUE_OUT_OF_MEMORY;
+ path_alloced = TRUE;
+ strcpy_url(newp, path, TRUE); /* consider it relative */
+ u->temppath = path = newp;
+ }
+
+ fragment = strchr(path, '#');
+ if(fragment) {
+ *fragment++ = 0;
+ if(fragment[0]) {
+ u->fragment = strdup(fragment);
+ if(!u->fragment)
+ return CURLUE_OUT_OF_MEMORY;
+ }
+ }
+
query = strchr(path, '?');
- if(query) {
+ if(query) {
*query++ = 0;
- /* done even if the query part is a blank string */
- u->query = strdup(query);
- if(!u->query)
- return CURLUE_OUT_OF_MEMORY;
- }
+ /* done even if the query part is a blank string */
+ u->query = strdup(query);
+ if(!u->query)
+ return CURLUE_OUT_OF_MEMORY;
+ }
if(!path[0])
- /* if there's no path left set, unset */
+ /* if there's no path left set, unset */
path = NULL;
- else {
- if(!(flags & CURLU_PATH_AS_IS)) {
- /* remove ../ and ./ sequences according to RFC3986 */
- char *newp = Curl_dedotdotify(path);
- if(!newp)
- return CURLUE_OUT_OF_MEMORY;
-
- if(strcmp(newp, path)) {
- /* if we got a new version */
- if(path_alloced)
- Curl_safefree(u->temppath);
- u->temppath = path = newp;
- path_alloced = TRUE;
- }
- else
- free(newp);
+ else {
+ if(!(flags & CURLU_PATH_AS_IS)) {
+ /* remove ../ and ./ sequences according to RFC3986 */
+ char *newp = Curl_dedotdotify(path);
+ if(!newp)
+ return CURLUE_OUT_OF_MEMORY;
+
+ if(strcmp(newp, path)) {
+ /* if we got a new version */
+ if(path_alloced)
+ Curl_safefree(u->temppath);
+ u->temppath = path = newp;
+ path_alloced = TRUE;
+ }
+ else
+ free(newp);
}
-
+
u->path = path_alloced?path:strdup(path);
if(!u->path)
return CURLUE_OUT_OF_MEMORY;
- u->temppath = NULL; /* used now */
+ u->temppath = NULL; /* used now */
}
if(hostname) {
@@ -905,52 +905,52 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
if(junkscan(hostname))
return CURLUE_MALFORMED_INPUT;
- result = parse_hostname_login(u, &hostname, flags);
+ result = parse_hostname_login(u, &hostname, flags);
if(result)
return result;
- result = Curl_parse_port(u, hostname, url_has_scheme);
+ result = Curl_parse_port(u, hostname, url_has_scheme);
if(result)
return result;
- if(0 == strlen(hostname) && (flags & CURLU_NO_AUTHORITY)) {
- /* Skip hostname check, it's allowed to be empty. */
- }
- else {
- result = hostname_check(u, hostname);
- if(result)
- return result;
- }
+ if(0 == strlen(hostname) && (flags & CURLU_NO_AUTHORITY)) {
+ /* Skip hostname check, it's allowed to be empty. */
+ }
+ else {
+ result = hostname_check(u, hostname);
+ if(result)
+ return result;
+ }
u->host = strdup(hostname);
if(!u->host)
return CURLUE_OUT_OF_MEMORY;
- if((flags & CURLU_GUESS_SCHEME) && !schemep) {
- /* legacy curl-style guess based on host name */
- if(checkprefix("ftp.", hostname))
- schemep = "ftp";
- else if(checkprefix("dict.", hostname))
- schemep = "dict";
- else if(checkprefix("ldap.", hostname))
- schemep = "ldap";
- else if(checkprefix("imap.", hostname))
- schemep = "imap";
- else if(checkprefix("smtp.", hostname))
- schemep = "smtp";
- else if(checkprefix("pop3.", hostname))
- schemep = "pop3";
- else
- schemep = "http";
-
- u->scheme = strdup(schemep);
- if(!u->scheme)
- return CURLUE_OUT_OF_MEMORY;
- }
+ if((flags & CURLU_GUESS_SCHEME) && !schemep) {
+ /* legacy curl-style guess based on host name */
+ if(checkprefix("ftp.", hostname))
+ schemep = "ftp";
+ else if(checkprefix("dict.", hostname))
+ schemep = "dict";
+ else if(checkprefix("ldap.", hostname))
+ schemep = "ldap";
+ else if(checkprefix("imap.", hostname))
+ schemep = "imap";
+ else if(checkprefix("smtp.", hostname))
+ schemep = "smtp";
+ else if(checkprefix("pop3.", hostname))
+ schemep = "pop3";
+ else
+ schemep = "http";
+
+ u->scheme = strdup(schemep);
+ if(!u->scheme)
+ return CURLUE_OUT_OF_MEMORY;
+ }
}
- Curl_safefree(u->scratch);
- Curl_safefree(u->temppath);
+ Curl_safefree(u->scratch);
+ Curl_safefree(u->temppath);
return CURLUE_OK;
}
@@ -1115,23 +1115,23 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what,
else
return CURLUE_NO_SCHEME;
- h = Curl_builtin_scheme(scheme);
- if(!port && (flags & CURLU_DEFAULT_PORT)) {
- /* there's no stored port number, but asked to deliver
- a default one for the scheme */
- if(h) {
- msnprintf(portbuf, sizeof(portbuf), "%ld", h->defport);
- port = portbuf;
+ h = Curl_builtin_scheme(scheme);
+ if(!port && (flags & CURLU_DEFAULT_PORT)) {
+ /* there's no stored port number, but asked to deliver
+ a default one for the scheme */
+ if(h) {
+ msnprintf(portbuf, sizeof(portbuf), "%ld", h->defport);
+ port = portbuf;
}
}
- else if(port) {
- /* there is a stored port number, but asked to inhibit if it matches
- the default one for the scheme */
- if(h && (h->defport == u->portnum) &&
- (flags & CURLU_NO_DEFAULT_PORT))
- port = NULL;
- }
-
+ else if(port) {
+ /* there is a stored port number, but asked to inhibit if it matches
+ the default one for the scheme */
+ if(h && (h->defport == u->portnum) &&
+ (flags & CURLU_NO_DEFAULT_PORT))
+ port = NULL;
+ }
+
if(h && !(h->flags & PROTOPT_URLOPTIONS))
options = NULL;
@@ -1190,10 +1190,10 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what,
if(urldecode) {
char *decoded;
size_t dlen;
- /* this unconditional rejection of control bytes is documented
- API behavior */
- CURLcode res = Curl_urldecode(NULL, *part, 0, &decoded, &dlen,
- REJECT_CTRL);
+ /* this unconditional rejection of control bytes is documented
+ API behavior */
+ CURLcode res = Curl_urldecode(NULL, *part, 0, &decoded, &dlen,
+ REJECT_CTRL);
free(*part);
if(res) {
*part = NULL;
@@ -1260,7 +1260,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
return CURLUE_UNKNOWN_PART;
}
if(storep && *storep) {
- Curl_safefree(*storep);
+ Curl_safefree(*storep);
}
return CURLUE_OK;
}
@@ -1288,7 +1288,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
break;
case CURLUPART_HOST:
storep = &u->host;
- Curl_safefree(u->zoneid);
+ Curl_safefree(u->zoneid);
break;
case CURLUPART_ZONEID:
storep = &u->zoneid;
@@ -1380,8 +1380,8 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
default:
return CURLUE_UNKNOWN_PART;
}
- DEBUGASSERT(storep);
- {
+ DEBUGASSERT(storep);
+ {
const char *newp = part;
size_t nalloc = strlen(part);
@@ -1395,14 +1395,14 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
char *enc = malloc(nalloc * 3 + 1); /* for worst case! */
if(!enc)
return CURLUE_OUT_OF_MEMORY;
- for(i = (const unsigned char *)part, o = enc; *i; i++) {
- if((*i == ' ') && plusencode) {
- *o = '+';
- o++;
+ for(i = (const unsigned char *)part, o = enc; *i; i++) {
+ if((*i == ' ') && plusencode) {
+ *o = '+';
+ o++;
}
- else if(Curl_isunreserved(*i) ||
- ((*i == '/') && urlskipslash) ||
- ((*i == '=') && equalsencode)) {
+ else if(Curl_isunreserved(*i) ||
+ ((*i == '/') && urlskipslash) ||
+ ((*i == '=') && equalsencode)) {
if((*i == '=') && equalsencode)
/* only skip the first equals sign */
equalsencode = FALSE;
@@ -1414,7 +1414,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
o += 3;
}
}
- *o = 0; /* null-terminate */
+ *o = 0; /* null-terminate */
newp = enc;
}
else {
@@ -1460,15 +1460,15 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
}
if(what == CURLUPART_HOST) {
- if(0 == strlen(newp) && (flags & CURLU_NO_AUTHORITY)) {
- /* Skip hostname check, it's allowed to be empty. */
+ if(0 == strlen(newp) && (flags & CURLU_NO_AUTHORITY)) {
+ /* Skip hostname check, it's allowed to be empty. */
+ }
+ else {
+ if(hostname_check(u, (char *)newp)) {
+ free((char *)newp);
+ return CURLUE_MALFORMED_INPUT;
+ }
}
- else {
- if(hostname_check(u, (char *)newp)) {
- free((char *)newp);
- return CURLUE_MALFORMED_INPUT;
- }
- }
}
free(*storep);
diff --git a/contrib/libs/curl/lib/urldata.h b/contrib/libs/curl/lib/urldata.h
index cc4a82c501..b824856427 100644
--- a/contrib/libs/curl/lib/urldata.h
+++ b/contrib/libs/curl/lib/urldata.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -49,7 +49,7 @@
#define PORT_RTMPT PORT_HTTP
#define PORT_RTMPS PORT_HTTPS
#define PORT_GOPHER 70
-#define PORT_MQTT 1883
+#define PORT_MQTT 1883
#define DICT_MATCH "/MATCH:"
#define DICT_MATCH2 "/M:"
@@ -69,17 +69,17 @@
#define PROTO_FAMILY_POP3 (CURLPROTO_POP3|CURLPROTO_POP3S)
#define PROTO_FAMILY_SMB (CURLPROTO_SMB|CURLPROTO_SMBS)
#define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS)
-#define PROTO_FAMILY_SSH (CURLPROTO_SCP|CURLPROTO_SFTP)
+#define PROTO_FAMILY_SSH (CURLPROTO_SCP|CURLPROTO_SFTP)
#define DEFAULT_CONNCACHE_SIZE 5
/* length of longest IPv6 address string including the trailing null */
#define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")
-/* Default FTP/IMAP etc response timeout in milliseconds */
+/* Default FTP/IMAP etc response timeout in milliseconds */
#define RESP_TIMEOUT (120*1000)
-/* Max string input length is a precaution against abuse and to detect junk
+/* Max string input length is a precaution against abuse and to detect junk
input easier and better. */
#define CURL_MAX_INPUT_LENGTH 8000000
@@ -102,7 +102,7 @@
#include "hostip.h"
#include "hash.h"
#include "splay.h"
-#include "dynbuf.h"
+#include "dynbuf.h"
/* return the count of bytes sent, or -1 on error */
typedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */
@@ -124,11 +124,11 @@ typedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */
#include "smtp.h"
#include "ftp.h"
#include "file.h"
-#include "vssh/ssh.h"
+#include "vssh/ssh.h"
#include "http.h"
#include "rtsp.h"
#include "smb.h"
-#include "mqtt.h"
+#include "mqtt.h"
#include "wildcard.h"
#include "multihandle.h"
#include "quic.h"
@@ -156,13 +156,13 @@ typedef ssize_t (Curl_recv)(struct connectdata *conn, /* connection data */
((x) && ((x)->magic == CURLEASY_MAGIC_NUMBER))
/* the type we use for storing a single boolean bit */
-#ifdef _MSC_VER
-typedef bool bit;
-#define BIT(x) bool x
-#else
+#ifdef _MSC_VER
+typedef bool bit;
+#define BIT(x) bool x
+#else
typedef unsigned int bit;
-#define BIT(x) bit x:1
-#endif
+#define BIT(x) bit x:1
+#endif
#ifdef HAVE_GSSAPI
/* Types needed for krb5-ftp connections */
@@ -170,7 +170,7 @@ struct krb5buffer {
void *data;
size_t size;
size_t index;
- BIT(eof_flag);
+ BIT(eof_flag);
};
enum protection_level {
@@ -210,10 +210,10 @@ struct ssl_connect_data {
#if defined(USE_SSL)
struct ssl_backend_data *backend;
#endif
- /* Use ssl encrypted communications TRUE/FALSE. The library is not
- necessarily using ssl at the moment but at least asked to or means to use
- it. See 'state' for the exact current state of the connection. */
- BIT(use);
+ /* Use ssl encrypted communications TRUE/FALSE. The library is not
+ necessarily using ssl at the moment but at least asked to or means to use
+ it. See 'state' for the exact current state of the connection. */
+ BIT(use);
};
struct ssl_primary_config {
@@ -226,13 +226,13 @@ struct ssl_primary_config {
char *egdsocket; /* path to file containing the EGD daemon socket */
char *cipher_list; /* list of ciphers to use */
char *cipher_list13; /* list of TLS 1.3 cipher suites to use */
- char *pinned_key;
- struct curl_blob *cert_blob;
- char *curves; /* list of curves to use */
- BIT(verifypeer); /* set TRUE if this is desired */
- BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */
- BIT(verifystatus); /* set TRUE if certificate status must be checked */
- BIT(sessionid); /* cache session IDs or not */
+ char *pinned_key;
+ struct curl_blob *cert_blob;
+ char *curves; /* list of curves to use */
+ BIT(verifypeer); /* set TRUE if this is desired */
+ BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */
+ BIT(verifystatus); /* set TRUE if certificate status must be checked */
+ BIT(sessionid); /* cache session IDs or not */
};
struct ssl_config_data {
@@ -240,12 +240,12 @@ struct ssl_config_data {
long certverifyresult; /* result from the certificate verification */
char *CRLfile; /* CRL to check certificate revocation */
char *issuercert;/* optional issuer certificate filename */
- struct curl_blob *issuercert_blob;
+ struct curl_blob *issuercert_blob;
curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
void *fsslctxp; /* parameter for call back */
char *cert_type; /* format for certificate (default: PEM)*/
char *key; /* private key file name */
- struct curl_blob *key_blob;
+ struct curl_blob *key_blob;
char *key_type; /* format for private key (default: PEM) */
char *key_passwd; /* plain text private key password */
#ifdef USE_TLS_SRP
@@ -253,14 +253,14 @@ struct ssl_config_data {
char *password; /* TLS password (for, e.g., SRP) */
enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */
#endif
- BIT(certinfo); /* gather lots of certificate info */
- BIT(falsestart);
- BIT(enable_beast); /* allow this flaw for interoperability's sake*/
- BIT(no_revoke); /* disable SSL certificate revocation checks */
- BIT(no_partialchain); /* don't accept partial certificate chains */
- BIT(revoke_best_effort); /* ignore SSL revocation offline/missing revocation
- list errors */
- BIT(native_ca_store); /* use the native ca store of operating system */
+ BIT(certinfo); /* gather lots of certificate info */
+ BIT(falsestart);
+ BIT(enable_beast); /* allow this flaw for interoperability's sake*/
+ BIT(no_revoke); /* disable SSL certificate revocation checks */
+ BIT(no_partialchain); /* don't accept partial certificate chains */
+ BIT(revoke_best_effort); /* ignore SSL revocation offline/missing revocation
+ list errors */
+ BIT(native_ca_store); /* use the native ca store of operating system */
};
struct ssl_general_config {
@@ -268,7 +268,7 @@ struct ssl_general_config {
};
/* information stored about one single SSL session */
-struct Curl_ssl_session {
+struct Curl_ssl_session {
char *name; /* host name for which this ID was used */
char *conn_to_host; /* host name for the connection (may be NULL) */
const char *scheme; /* protocol scheme used */
@@ -303,8 +303,8 @@ struct digestdata {
char *qop;
char *algorithm;
int nc; /* nounce count */
- BIT(stale); /* set true for re-negotiation */
- BIT(userhash);
+ BIT(stale); /* set true for re-negotiation */
+ BIT(userhash);
#endif
};
@@ -370,15 +370,15 @@ struct ntlmdata {
unsigned char nonce[8];
void *target_info; /* TargetInfo received in the ntlm type-2 message */
unsigned int target_info_len;
-
-#if defined(NTLM_WB_ENABLED)
- /* used for communication with Samba's winbind daemon helper ntlm_auth */
- curl_socket_t ntlm_auth_hlpr_socket;
- pid_t ntlm_auth_hlpr_pid;
- char *challenge; /* The received base64 encoded ntlm type-2 message */
- char *response; /* The generated base64 ntlm type-1/type-3 message */
+
+#if defined(NTLM_WB_ENABLED)
+ /* used for communication with Samba's winbind daemon helper ntlm_auth */
+ curl_socket_t ntlm_auth_hlpr_socket;
+ pid_t ntlm_auth_hlpr_pid;
+ char *challenge; /* The received base64 encoded ntlm type-2 message */
+ char *response; /* The generated base64 ntlm type-1/type-3 message */
+#endif
#endif
-#endif
};
#endif
@@ -406,10 +406,10 @@ struct negotiatedata {
size_t output_token_length;
#endif
#endif
- BIT(noauthpersist);
- BIT(havenoauthpersist);
- BIT(havenegdata);
- BIT(havemultiplerequests);
+ BIT(noauthpersist);
+ BIT(havenoauthpersist);
+ BIT(havenegdata);
+ BIT(havemultiplerequests);
};
#endif
@@ -418,76 +418,76 @@ struct negotiatedata {
* Boolean values that concerns this connection.
*/
struct ConnectBits {
- bool tcpconnect[2]; /* the TCP layer (or similar) is connected, this is set
- the first time on the first connect function call */
-#ifndef CURL_DISABLE_PROXY
+ bool tcpconnect[2]; /* the TCP layer (or similar) is connected, this is set
+ the first time on the first connect function call */
+#ifndef CURL_DISABLE_PROXY
bool proxy_ssl_connected[2]; /* TRUE when SSL initialization for HTTPS proxy
is complete */
- BIT(httpproxy); /* if set, this transfer is done through a http proxy */
- BIT(socksproxy); /* if set, this transfer is done through a socks proxy */
- BIT(proxy_user_passwd); /* user+password for the proxy? */
- BIT(tunnel_proxy); /* if CONNECT is used to "tunnel" through the proxy.
- This is implicit when SSL-protocols are used through
- proxies, but can also be enabled explicitly by
- apps */
- BIT(proxy_connect_closed); /* TRUE if a proxy disconnected the connection
- in a CONNECT request with auth, so that
- libcurl should reconnect and continue. */
-#endif
- /* always modify bits.close with the connclose() and connkeep() macros! */
- BIT(close); /* if set, we close the connection after this request */
- BIT(reuse); /* if set, this is a re-used connection */
- BIT(altused); /* this is an alt-svc "redirect" */
- BIT(conn_to_host); /* if set, this connection has a "connect to host"
- that overrides the host in the URL */
- BIT(conn_to_port); /* if set, this connection has a "connect to port"
- that overrides the port in the URL (remote port) */
- BIT(proxy); /* if set, this transfer is done through a proxy - any type */
- BIT(user_passwd); /* do we use user+password for this connection? */
- BIT(ipv6_ip); /* we communicate with a remote site specified with pure IPv6
- IP address */
- BIT(ipv6); /* we communicate with a site using an IPv6 address */
- BIT(do_more); /* this is set TRUE if the ->curl_do_more() function is
- supposed to be called, after ->curl_do() */
- BIT(protoconnstart);/* the protocol layer has STARTED its operation after
- the TCP layer connect */
- BIT(retry); /* this connection is about to get closed and then
- re-attempted at another connection. */
- BIT(authneg); /* TRUE when the auth phase has started, which means
- that we are creating a request with an auth header,
- but it is not the final request in the auth
- negotiation. */
- BIT(rewindaftersend);/* TRUE when the sending couldn't be stopped even
- though it will be discarded. When the whole send
- operation is done, we must call the data rewind
- callback. */
+ BIT(httpproxy); /* if set, this transfer is done through a http proxy */
+ BIT(socksproxy); /* if set, this transfer is done through a socks proxy */
+ BIT(proxy_user_passwd); /* user+password for the proxy? */
+ BIT(tunnel_proxy); /* if CONNECT is used to "tunnel" through the proxy.
+ This is implicit when SSL-protocols are used through
+ proxies, but can also be enabled explicitly by
+ apps */
+ BIT(proxy_connect_closed); /* TRUE if a proxy disconnected the connection
+ in a CONNECT request with auth, so that
+ libcurl should reconnect and continue. */
+#endif
+ /* always modify bits.close with the connclose() and connkeep() macros! */
+ BIT(close); /* if set, we close the connection after this request */
+ BIT(reuse); /* if set, this is a re-used connection */
+ BIT(altused); /* this is an alt-svc "redirect" */
+ BIT(conn_to_host); /* if set, this connection has a "connect to host"
+ that overrides the host in the URL */
+ BIT(conn_to_port); /* if set, this connection has a "connect to port"
+ that overrides the port in the URL (remote port) */
+ BIT(proxy); /* if set, this transfer is done through a proxy - any type */
+ BIT(user_passwd); /* do we use user+password for this connection? */
+ BIT(ipv6_ip); /* we communicate with a remote site specified with pure IPv6
+ IP address */
+ BIT(ipv6); /* we communicate with a site using an IPv6 address */
+ BIT(do_more); /* this is set TRUE if the ->curl_do_more() function is
+ supposed to be called, after ->curl_do() */
+ BIT(protoconnstart);/* the protocol layer has STARTED its operation after
+ the TCP layer connect */
+ BIT(retry); /* this connection is about to get closed and then
+ re-attempted at another connection. */
+ BIT(authneg); /* TRUE when the auth phase has started, which means
+ that we are creating a request with an auth header,
+ but it is not the final request in the auth
+ negotiation. */
+ BIT(rewindaftersend);/* TRUE when the sending couldn't be stopped even
+ though it will be discarded. When the whole send
+ operation is done, we must call the data rewind
+ callback. */
#ifndef CURL_DISABLE_FTP
- BIT(ftp_use_epsv); /* As set with CURLOPT_FTP_USE_EPSV, but if we find out
- EPSV doesn't work we disable it for the forthcoming
- requests */
- BIT(ftp_use_eprt); /* As set with CURLOPT_FTP_USE_EPRT, but if we find out
- EPRT doesn't work we disable it for the forthcoming
- requests */
- BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */
- BIT(ftp_use_control_ssl); /* Enabled SSL for the control connection */
+ BIT(ftp_use_epsv); /* As set with CURLOPT_FTP_USE_EPSV, but if we find out
+ EPSV doesn't work we disable it for the forthcoming
+ requests */
+ BIT(ftp_use_eprt); /* As set with CURLOPT_FTP_USE_EPRT, but if we find out
+ EPRT doesn't work we disable it for the forthcoming
+ requests */
+ BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */
+ BIT(ftp_use_control_ssl); /* Enabled SSL for the control connection */
#endif
- BIT(netrc); /* name+password provided by netrc */
- BIT(bound); /* set true if bind() has already been done on this socket/
- connection */
- BIT(multiplex); /* connection is multiplexed */
- BIT(tcp_fastopen); /* use TCP Fast Open */
- BIT(tls_enable_npn); /* TLS NPN extension? */
- BIT(tls_enable_alpn); /* TLS ALPN extension? */
- BIT(connect_only);
- BIT(doh);
-#ifdef USE_UNIX_SOCKETS
- BIT(abstract_unix_socket);
-#endif
- BIT(tls_upgraded);
- BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
- accept() */
- BIT(parallel_connect); /* set TRUE when a parallel connect attempt has
- started (happy eyeballs) */
+ BIT(netrc); /* name+password provided by netrc */
+ BIT(bound); /* set true if bind() has already been done on this socket/
+ connection */
+ BIT(multiplex); /* connection is multiplexed */
+ BIT(tcp_fastopen); /* use TCP Fast Open */
+ BIT(tls_enable_npn); /* TLS NPN extension? */
+ BIT(tls_enable_alpn); /* TLS ALPN extension? */
+ BIT(connect_only);
+ BIT(doh);
+#ifdef USE_UNIX_SOCKETS
+ BIT(abstract_unix_socket);
+#endif
+ BIT(tls_upgraded);
+ BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
+ accept() */
+ BIT(parallel_connect); /* set TRUE when a parallel connect attempt has
+ started (happy eyeballs) */
};
struct hostname {
@@ -519,8 +519,8 @@ struct Curl_async {
int port;
struct Curl_dns_entry *dns;
int status; /* if done is TRUE, this is the status from the callback */
- struct thread_data *tdata;
- BIT(done); /* set TRUE when the lookup is complete */
+ struct thread_data *tdata;
+ BIT(done); /* set TRUE when the lookup is complete */
};
#define FIRSTSOCKET 0
@@ -547,22 +547,22 @@ enum upgrade101 {
UPGR101_WORKING /* talking upgraded protocol */
};
-enum doh_slots {
- /* Explicit values for first two symbols so as to match hard-coded
- * constants in existing code
- */
- DOH_PROBE_SLOT_IPADDR_V4 = 0, /* make 'V4' stand out for readability */
- DOH_PROBE_SLOT_IPADDR_V6 = 1, /* 'V6' likewise */
-
- /* Space here for (possibly build-specific) additional slot definitions */
-
- /* for example */
- /* #ifdef WANT_DOH_FOOBAR_TXT */
- /* DOH_PROBE_SLOT_FOOBAR_TXT, */
- /* #endif */
-
- /* AFTER all slot definitions, establish how many we have */
- DOH_PROBE_SLOTS
+enum doh_slots {
+ /* Explicit values for first two symbols so as to match hard-coded
+ * constants in existing code
+ */
+ DOH_PROBE_SLOT_IPADDR_V4 = 0, /* make 'V4' stand out for readability */
+ DOH_PROBE_SLOT_IPADDR_V6 = 1, /* 'V6' likewise */
+
+ /* Space here for (possibly build-specific) additional slot definitions */
+
+ /* for example */
+ /* #ifdef WANT_DOH_FOOBAR_TXT */
+ /* DOH_PROBE_SLOT_FOOBAR_TXT, */
+ /* #endif */
+
+ /* AFTER all slot definitions, establish how many we have */
+ DOH_PROBE_SLOTS
};
/* one of these for each DoH request */
@@ -571,12 +571,12 @@ struct dnsprobe {
int dnstype;
unsigned char dohbuffer[512];
size_t dohlen;
- struct dynbuf serverdoh;
+ struct dynbuf serverdoh;
};
struct dohdata {
struct curl_slist *headers;
- struct dnsprobe probe[DOH_PROBE_SLOTS];
+ struct dnsprobe probe[DOH_PROBE_SLOTS];
unsigned int pending; /* still outstanding requests */
const char *host;
int port;
@@ -624,8 +624,8 @@ struct SingleRequest {
enum expect100 exp100; /* expect 100 continue state */
enum upgrade101 upgr101; /* 101 upgrade state */
- /* Content unencoding stack. See sec 3.5, RFC2616. */
- struct contenc_writer *writer_stack;
+ /* Content unencoding stack. See sec 3.5, RFC2616. */
+ struct contenc_writer *writer_stack;
time_t timeofdoc;
long bodywrites;
int keepon;
@@ -643,40 +643,40 @@ struct SingleRequest {
and the 'upload_present' contains the number of bytes available at this
position */
char *upload_fromhere;
-
- /* Allocated protocol-specific data. Each protocol handler makes sure this
- points to data it needs. */
- union {
- struct FILEPROTO *file;
- struct FTP *ftp;
- struct HTTP *http;
- struct IMAP *imap;
- struct ldapreqinfo *ldap;
- struct MQTT *mqtt;
- struct POP3 *pop3;
- struct RTSP *rtsp;
- struct smb_request *smb;
- struct SMTP *smtp;
- struct SSHPROTO *ssh;
- struct TELNET *telnet;
- } p;
+
+ /* Allocated protocol-specific data. Each protocol handler makes sure this
+ points to data it needs. */
+ union {
+ struct FILEPROTO *file;
+ struct FTP *ftp;
+ struct HTTP *http;
+ struct IMAP *imap;
+ struct ldapreqinfo *ldap;
+ struct MQTT *mqtt;
+ struct POP3 *pop3;
+ struct RTSP *rtsp;
+ struct smb_request *smb;
+ struct SMTP *smtp;
+ struct SSHPROTO *ssh;
+ struct TELNET *telnet;
+ } p;
#ifndef CURL_DISABLE_DOH
struct dohdata doh; /* DoH specific data for this request */
#endif
- BIT(header); /* incoming data has HTTP header */
- BIT(content_range); /* set TRUE if Content-Range: was found */
- BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding
- upload and we're uploading the last chunk */
- BIT(ignorebody); /* we read a response-body but we ignore it! */
- BIT(http_bodyless); /* HTTP response status code is between 100 and 199,
- 204 or 304 */
- BIT(chunk); /* if set, this is a chunked transfer-encoding */
- BIT(upload_chunky); /* set TRUE if we are doing chunked transfer-encoding
- on upload */
- BIT(getheader); /* TRUE if header parsing is wanted */
- BIT(forbidchunk); /* used only to explicitly forbid chunk-upload for
- specific upload buffers. See readmoredata() in http.c
- for details. */
+ BIT(header); /* incoming data has HTTP header */
+ BIT(content_range); /* set TRUE if Content-Range: was found */
+ BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding
+ upload and we're uploading the last chunk */
+ BIT(ignorebody); /* we read a response-body but we ignore it! */
+ BIT(http_bodyless); /* HTTP response status code is between 100 and 199,
+ 204 or 304 */
+ BIT(chunk); /* if set, this is a chunked transfer-encoding */
+ BIT(upload_chunky); /* set TRUE if we are doing chunked transfer-encoding
+ on upload */
+ BIT(getheader); /* TRUE if header parsing is wanted */
+ BIT(forbidchunk); /* used only to explicitly forbid chunk-upload for
+ specific upload buffers. See readmoredata() in http.c
+ for details. */
};
/*
@@ -753,8 +753,8 @@ struct Curl_handler {
long defport; /* Default port. */
unsigned int protocol; /* See CURLPROTO_* - this needs to be the single
specific protocol bit */
- unsigned int family; /* single bit for protocol family; basically the
- non-TLS name of the protocol this is */
+ unsigned int family; /* single bit for protocol family; basically the
+ non-TLS name of the protocol this is */
unsigned int flags; /* Extra particular characteristics, see PROTOPT_* */
};
@@ -782,8 +782,8 @@ struct Curl_handler {
HTTP proxy as HTTP proxies may know
this protocol and act as a gateway */
#define PROTOPT_WILDCARD (1<<12) /* protocol supports wildcard matching */
-#define PROTOPT_USERPWDCTRL (1<<13) /* Allow "control bytes" (< 32 ascii) in
- user name and password */
+#define PROTOPT_USERPWDCTRL (1<<13) /* Allow "control bytes" (< 32 ascii) in
+ user name and password */
#define CONNCHECK_NONE 0 /* No checks */
#define CONNCHECK_ISDEAD (1<<0) /* Check if the connection is dead. */
@@ -816,59 +816,59 @@ struct proxy_info {
/* struct for HTTP CONNECT state data */
struct http_connect_state {
- struct dynbuf rcvbuf;
- enum keeponval {
- KEEPON_DONE,
- KEEPON_CONNECT,
- KEEPON_IGNORE
- } keepon;
+ struct dynbuf rcvbuf;
+ enum keeponval {
+ KEEPON_DONE,
+ KEEPON_CONNECT,
+ KEEPON_IGNORE
+ } keepon;
curl_off_t cl; /* size of content to read and ignore */
enum {
TUNNEL_INIT, /* init/default/no tunnel state */
TUNNEL_CONNECT, /* CONNECT has been sent off */
TUNNEL_COMPLETE /* CONNECT response received completely */
} tunnel_state;
- BIT(chunked_encoding);
- BIT(close_connection);
+ BIT(chunked_encoding);
+ BIT(close_connection);
};
struct ldapconninfo;
-/* for the (SOCKS) connect state machine */
-enum connect_t {
- CONNECT_INIT,
- CONNECT_SOCKS_INIT, /* 1 */
- CONNECT_SOCKS_SEND, /* 2 waiting to send more first data */
- CONNECT_SOCKS_READ_INIT, /* 3 set up read */
- CONNECT_SOCKS_READ, /* 4 read server response */
- CONNECT_GSSAPI_INIT, /* 5 */
- CONNECT_AUTH_INIT, /* 6 setup outgoing auth buffer */
- CONNECT_AUTH_SEND, /* 7 send auth */
- CONNECT_AUTH_READ, /* 8 read auth response */
- CONNECT_REQ_INIT, /* 9 init SOCKS "request" */
- CONNECT_RESOLVING, /* 10 */
- CONNECT_RESOLVED, /* 11 */
- CONNECT_RESOLVE_REMOTE, /* 12 */
- CONNECT_REQ_SEND, /* 13 */
- CONNECT_REQ_SENDING, /* 14 */
- CONNECT_REQ_READ, /* 15 */
- CONNECT_REQ_READ_MORE, /* 16 */
- CONNECT_DONE /* 17 connected fine to the remote or the SOCKS proxy */
-};
-
-#define SOCKS_STATE(x) (((x) >= CONNECT_SOCKS_INIT) && \
- ((x) < CONNECT_DONE))
-#define SOCKS_REQUEST_BUFSIZE 600 /* room for large user/pw (255 max each) */
-
-struct connstate {
- enum connect_t state;
- unsigned char socksreq[SOCKS_REQUEST_BUFSIZE];
-
- /* CONNECT_SOCKS_SEND */
- ssize_t outstanding; /* send this many bytes more */
- unsigned char *outp; /* send from this pointer */
-};
-
+/* for the (SOCKS) connect state machine */
+enum connect_t {
+ CONNECT_INIT,
+ CONNECT_SOCKS_INIT, /* 1 */
+ CONNECT_SOCKS_SEND, /* 2 waiting to send more first data */
+ CONNECT_SOCKS_READ_INIT, /* 3 set up read */
+ CONNECT_SOCKS_READ, /* 4 read server response */
+ CONNECT_GSSAPI_INIT, /* 5 */
+ CONNECT_AUTH_INIT, /* 6 setup outgoing auth buffer */
+ CONNECT_AUTH_SEND, /* 7 send auth */
+ CONNECT_AUTH_READ, /* 8 read auth response */
+ CONNECT_REQ_INIT, /* 9 init SOCKS "request" */
+ CONNECT_RESOLVING, /* 10 */
+ CONNECT_RESOLVED, /* 11 */
+ CONNECT_RESOLVE_REMOTE, /* 12 */
+ CONNECT_REQ_SEND, /* 13 */
+ CONNECT_REQ_SENDING, /* 14 */
+ CONNECT_REQ_READ, /* 15 */
+ CONNECT_REQ_READ_MORE, /* 16 */
+ CONNECT_DONE /* 17 connected fine to the remote or the SOCKS proxy */
+};
+
+#define SOCKS_STATE(x) (((x) >= CONNECT_SOCKS_INIT) && \
+ ((x) < CONNECT_DONE))
+#define SOCKS_REQUEST_BUFSIZE 600 /* room for large user/pw (255 max each) */
+
+struct connstate {
+ enum connect_t state;
+ unsigned char socksreq[SOCKS_REQUEST_BUFSIZE];
+
+ /* CONNECT_SOCKS_SEND */
+ ssize_t outstanding; /* send this many bytes more */
+ unsigned char *outp; /* send from this pointer */
+};
+
/*
* The connectdata struct contains all fields and variables that should be
* unique for an entire connection.
@@ -878,8 +878,8 @@ struct connectdata {
caution that this might very well vary between different times this
connection is used! */
struct Curl_easy *data;
- struct connstate cnnct;
- struct Curl_llist_element bundle_node; /* conncache */
+ struct connstate cnnct;
+ struct Curl_llist_element bundle_node; /* conncache */
/* chunk is for HTTP chunked encoding, but is in the general connectdata
struct only because we can do just about any protocol through a HTTP proxy
@@ -901,15 +901,15 @@ struct connectdata {
/* 'dns_entry' is the particular host we use. This points to an entry in the
DNS cache and it will not get pruned while locked. It gets unlocked in
- multi_done(). This entry will be NULL if the connection is re-used as then
+ multi_done(). This entry will be NULL if the connection is re-used as then
there is no name resolve done. */
struct Curl_dns_entry *dns_entry;
/* 'ip_addr' is the particular IP we connected to. It points to a struct
within the DNS cache, so this pointer is only valid as long as the DNS
- cache entry remains locked. It gets unlocked in multi_done() */
- struct Curl_addrinfo *ip_addr;
- struct Curl_addrinfo *tempaddr[2]; /* for happy eyeballs */
+ cache entry remains locked. It gets unlocked in multi_done() */
+ struct Curl_addrinfo *ip_addr;
+ struct Curl_addrinfo *tempaddr[2]; /* for happy eyeballs */
/* 'ip_addr_str' is the ip_addr data as a human readable string.
It remains available as long as the connection does, which is longer than
@@ -934,10 +934,10 @@ struct connectdata {
char *secondaryhostname; /* secondary socket host name (ftp) */
struct hostname conn_to_host; /* the host to connect to. valid only if
bits.conn_to_host is set */
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
struct proxy_info socks_proxy;
struct proxy_info http_proxy;
-#endif
+#endif
long port; /* which port to use locally */
int remote_port; /* the remote port, not the proxy port! */
int conn_to_port; /* the remote port to connect to. valid only if
@@ -977,7 +977,7 @@ struct connectdata {
curl_socket_t sock[2]; /* two sockets, the second is used for the data
transfer when doing FTP */
curl_socket_t tempsock[2]; /* temporary sockets for happy eyeballs */
- int tempfamily[2]; /* family used for the temp sockets */
+ int tempfamily[2]; /* family used for the temp sockets */
Curl_recv *recv[2];
Curl_send *send[2];
@@ -985,16 +985,16 @@ struct connectdata {
struct postponed_data postponed[2]; /* two buffers for two sockets */
#endif /* USE_RECV_BEFORE_SEND_WORKAROUND */
struct ssl_connect_data ssl[2]; /* this is for ssl-stuff */
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
struct ssl_connect_data proxy_ssl[2]; /* this is for proxy ssl-stuff */
-#endif
+#endif
#ifdef USE_SSL
void *ssl_extra; /* separately allocated backend-specific data */
#endif
struct ssl_primary_config ssl_config;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
struct ssl_primary_config proxy_ssl_config;
-#endif
+#endif
struct ConnectBits bits; /* various state-flags for this connection */
/* connecttime: when connect() is called on the current IP address. Used to
@@ -1004,10 +1004,10 @@ struct connectdata {
/* The two fields below get set in Curl_connecthost */
int num_addr; /* number of addresses to try to connect to */
- /* how long time in milliseconds to spend on trying to connect to each IP
- address, per family */
- timediff_t timeoutms_per_addr[2];
-
+ /* how long time in milliseconds to spend on trying to connect to each IP
+ address, per family */
+ timediff_t timeoutms_per_addr[2];
+
const struct Curl_handler *handler; /* Connection's protocol handler */
const struct Curl_handler *given; /* The protocol first given */
@@ -1028,7 +1028,7 @@ struct connectdata {
CURL_SOCKET_BAD disables */
#ifdef HAVE_GSSAPI
- BIT(sec_complete); /* if Kerberos is enabled for this connection */
+ BIT(sec_complete); /* if Kerberos is enabled for this connection */
enum protection_level command_prot;
enum protection_level data_prot;
enum protection_level request_data_prot;
@@ -1043,7 +1043,7 @@ struct connectdata {
struct kerberos5data krb5; /* variables into the structure definition, */
#endif /* however, some of them are ftp specific. */
- struct Curl_llist easyq; /* List of easy handles using this connection */
+ struct Curl_llist easyq; /* List of easy handles using this connection */
curl_seek_callback seek_func; /* function that seeks the input */
void *seek_client; /* pointer to pass to the seek() above */
@@ -1073,8 +1073,8 @@ struct connectdata {
/* data used for the asynch name resolve callback */
struct Curl_async async;
- /* for chunked-encoded trailer */
- struct dynbuf trailer;
+ /* for chunked-encoded trailer */
+ struct dynbuf trailer;
union {
struct ftp_conn ftpc;
@@ -1088,7 +1088,7 @@ struct connectdata {
struct smb_conn smbc;
void *rtmp;
struct ldapconninfo *ldapc;
- struct mqtt_conn mqtt;
+ struct mqtt_conn mqtt;
} proto;
int cselect_bits; /* bitmask of socket events */
@@ -1153,9 +1153,9 @@ struct PureInfo {
OpenSSL, GnuTLS, Schannel, NSS and GSKit
builds. Asked for with CURLOPT_CERTINFO
/ CURLINFO_CERTINFO */
- CURLproxycode pxcode;
- BIT(timecond); /* set to TRUE if the time condition didn't match, which
- thus made the document NOT get fetched */
+ CURLproxycode pxcode;
+ BIT(timecond); /* set to TRUE if the time condition didn't match, which
+ thus made the document NOT get fetched */
};
@@ -1202,8 +1202,8 @@ struct Progress {
curl_off_t speeder[ CURR_TIME ];
struct curltime speeder_time[ CURR_TIME ];
int speeder_c;
- BIT(callback); /* set when progress callback is used */
- BIT(is_t_startransfer_set);
+ BIT(callback); /* set when progress callback is used */
+ BIT(is_t_startransfer_set);
};
typedef enum {
@@ -1239,12 +1239,12 @@ struct auth {
unsigned long picked;
unsigned long avail; /* Bitmask for what the server reports to support for
this resource */
- BIT(done); /* TRUE when the auth phase is done and ready to do the
- actual request */
- BIT(multipass); /* TRUE if this is not yet authenticated but within the
- auth multipass negotiation */
- BIT(iestyle); /* TRUE if digest should be done IE-style or FALSE if it
- should be RFC compliant */
+ BIT(done); /* TRUE when the auth phase is done and ready to do the
+ actual request */
+ BIT(multipass); /* TRUE if this is not yet authenticated but within the
+ auth multipass negotiation */
+ BIT(iestyle); /* TRUE if digest should be done IE-style or FALSE if it
+ should be RFC compliant */
};
struct Curl_http2_dep {
@@ -1258,7 +1258,7 @@ struct Curl_http2_dep {
* BODY).
*/
struct tempbuf {
- struct dynbuf b;
+ struct dynbuf b;
int type; /* type of the 'tempwrite' buffer as a bitmask that is used with
Curl_client_write() */
};
@@ -1268,8 +1268,8 @@ typedef enum {
EXPIRE_100_TIMEOUT,
EXPIRE_ASYNC_NAME,
EXPIRE_CONNECTTIMEOUT,
- EXPIRE_DNS_PER_NAME, /* family1 */
- EXPIRE_DNS_PER_NAME2, /* family2 */
+ EXPIRE_DNS_PER_NAME, /* family1 */
+ EXPIRE_DNS_PER_NAME2, /* family2 */
EXPIRE_HAPPY_EYEBALLS_DNS, /* See asyn-ares.c */
EXPIRE_HAPPY_EYEBALLS,
EXPIRE_MULTI_PENDING,
@@ -1294,7 +1294,7 @@ typedef enum {
* One instance for each timeout an easy handle can set.
*/
struct time_node {
- struct Curl_llist_element list;
+ struct Curl_llist_element list;
struct curltime time;
expire_id eid;
};
@@ -1315,13 +1315,13 @@ struct UrlState {
/* Points to the connection cache */
struct conncache *conn_cache;
- int retrycount; /* number of retries on a new connection */
-
+ int retrycount; /* number of retries on a new connection */
+
/* buffers to store authentication data in, as parsed from input options */
struct curltime keeps_speed; /* for the progress meter really */
- long lastconnect_id; /* The last connection, -1 if undefined */
- struct dynbuf headerb; /* buffer to store headers in */
+ long lastconnect_id; /* The last connection, -1 if undefined */
+ struct dynbuf headerb; /* buffer to store headers in */
char *buffer; /* download buffer */
char *ulbuf; /* allocated upload buffer or NULL */
@@ -1334,7 +1334,7 @@ struct UrlState {
strdup() data.
*/
int first_remote_port; /* remote port of the first (not followed) request */
- struct Curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
+ struct Curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
long sessionage; /* number of the most recent session */
unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
struct tempbuf tempwrite[3]; /* BOTH, HEADER, BODY */
@@ -1358,7 +1358,7 @@ struct UrlState {
#endif /* USE_OPENSSL */
struct curltime expiretime; /* set this with Curl_expire() only */
struct Curl_tree timenode; /* for the splay stuff */
- struct Curl_llist timeoutlist; /* list of pending timeouts */
+ struct Curl_llist timeoutlist; /* list of pending timeouts */
struct time_node expires[EXPIRE_LAST]; /* nodes for each expire type */
/* a place to store the most recently set FTP entrypath */
@@ -1367,11 +1367,11 @@ struct UrlState {
int httpversion; /* the lowest HTTP version*10 reported by any server
involved in this request */
-#if !defined(WIN32) && !defined(MSDOS) && !defined(__EMX__)
+#if !defined(WIN32) && !defined(MSDOS) && !defined(__EMX__)
/* do FTP line-end conversions on most platforms */
#define CURL_DO_LINEEND_CONV
/* for FTP downloads: track CRLF sequences that span blocks */
- BIT(prev_block_had_trailing_cr);
+ BIT(prev_block_had_trailing_cr);
/* for FTP downloads: how many CRLFs did we converted to LFs? */
curl_off_t crlf_conversions;
#endif
@@ -1398,60 +1398,60 @@ struct UrlState {
int stream_weight;
CURLU *uh; /* URL handle for the current parsed URL */
struct urlpieces up;
- Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
+ Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
#ifndef CURL_DISABLE_HTTP
size_t trailers_bytes_sent;
- struct dynbuf trailers_buf; /* a buffer containing the compiled trailing
- headers */
+ struct dynbuf trailers_buf; /* a buffer containing the compiled trailing
+ headers */
#endif
trailers_state trailers_state; /* whether we are sending trailers
and what stage are we at */
-
- /* Dynamically allocated strings, MUST be freed before this struct is
- killed. */
- struct dynamically_allocated_data {
- char *proxyuserpwd;
- char *uagent;
- char *accept_encoding;
- char *userpwd;
- char *rangeline;
- char *ref;
- char *host;
- char *cookiehost;
- char *rtsp_transport;
- char *te; /* TE: request header */
- } aptr;
-
+
+ /* Dynamically allocated strings, MUST be freed before this struct is
+ killed. */
+ struct dynamically_allocated_data {
+ char *proxyuserpwd;
+ char *uagent;
+ char *accept_encoding;
+ char *userpwd;
+ char *rangeline;
+ char *ref;
+ char *host;
+ char *cookiehost;
+ char *rtsp_transport;
+ char *te; /* TE: request header */
+ } aptr;
+
#ifdef CURLDEBUG
- BIT(conncache_lock);
+ BIT(conncache_lock);
#endif
/* when curl_easy_perform() is called, the multi handle is "owned" by
the easy handle so curl_easy_cleanup() on such an easy handle will
also close the multi handle! */
- BIT(multi_owned_by_easy);
+ BIT(multi_owned_by_easy);
- BIT(this_is_a_follow); /* this is a followed Location: request */
- BIT(refused_stream); /* this was refused, try again */
- BIT(errorbuf); /* Set to TRUE if the error buffer is already filled in.
+ BIT(this_is_a_follow); /* this is a followed Location: request */
+ BIT(refused_stream); /* this was refused, try again */
+ BIT(errorbuf); /* Set to TRUE if the error buffer is already filled in.
This must be set to FALSE every time _easy_perform() is
called. */
- BIT(allow_port); /* Is set.use_port allowed to take effect or not. This
+ BIT(allow_port); /* Is set.use_port allowed to take effect or not. This
is always set TRUE when curl_easy_perform() is called. */
- BIT(authproblem); /* TRUE if there's some problem authenticating */
+ BIT(authproblem); /* TRUE if there's some problem authenticating */
/* set after initial USER failure, to prevent an authentication loop */
- BIT(ftp_trying_alternative);
- BIT(wildcardmatch); /* enable wildcard matching */
- BIT(expect100header); /* TRUE if we added Expect: 100-continue */
- BIT(disableexpect); /* TRUE if Expect: is disabled due to a previous
- 417 response */
- BIT(use_range);
- BIT(rangestringalloc); /* the range string is malloc()'ed */
- BIT(done); /* set to FALSE when Curl_init_do() is called and set to TRUE
+ BIT(ftp_trying_alternative);
+ BIT(wildcardmatch); /* enable wildcard matching */
+ BIT(expect100header); /* TRUE if we added Expect: 100-continue */
+ BIT(disableexpect); /* TRUE if Expect: is disabled due to a previous
+ 417 response */
+ BIT(use_range);
+ BIT(rangestringalloc); /* the range string is malloc()'ed */
+ BIT(done); /* set to FALSE when Curl_init_do() is called and set to TRUE
when multi_done() is called, to prevent multi_done() to get
invoked twice when the multi interface is used. */
- BIT(stream_depends_e); /* set or don't set the Exclusive bit */
- BIT(previouslypending); /* this transfer WAS in the multi->pending queue */
- BIT(cookie_engine);
+ BIT(stream_depends_e); /* set or don't set the Exclusive bit */
+ BIT(previouslypending); /* this transfer WAS in the multi->pending queue */
+ BIT(cookie_engine);
};
@@ -1469,9 +1469,9 @@ struct DynamicStatic {
curl_easy_setopt(COOKIEFILE) calls */
struct curl_slist *resolve; /* set to point to the set.resolve list when
this should be dealt with in pretransfer */
- BIT(url_alloc); /* URL string is malloc()'ed */
- BIT(referer_alloc); /* referer string is malloc()ed */
- BIT(wildcard_resolve); /* Set to true if any resolve change is a
+ BIT(url_alloc); /* URL string is malloc()'ed */
+ BIT(referer_alloc); /* referer string is malloc()ed */
+ BIT(wildcard_resolve); /* Set to true if any resolve change is a
wildcard */
};
@@ -1486,14 +1486,14 @@ struct DynamicStatic {
struct Curl_multi; /* declared and used only in multi.c */
-/*
- * This enumeration MUST not use conditional directives (#ifdefs), new
- * null terminated strings MUST be added to the enumeration immediately
- * before STRING_LASTZEROTERMINATED, binary fields immediately before
- * STRING_LAST. When doing so, ensure that the packages/OS400/chkstring.c
- * test is updated and applicable changes for EBCDIC to ASCII conversion
- * are catered for in curl_easy_setopt_ccsid()
- */
+/*
+ * This enumeration MUST not use conditional directives (#ifdefs), new
+ * null terminated strings MUST be added to the enumeration immediately
+ * before STRING_LASTZEROTERMINATED, binary fields immediately before
+ * STRING_LAST. When doing so, ensure that the packages/OS400/chkstring.c
+ * test is updated and applicable changes for EBCDIC to ASCII conversion
+ * are catered for in curl_easy_setopt_ccsid()
+ */
enum dupstring {
STRING_CERT_ORIG, /* client certificate file name */
STRING_CERT_PROXY, /* client certificate file name */
@@ -1567,37 +1567,37 @@ enum dupstring {
STRING_TARGET, /* CURLOPT_REQUEST_TARGET */
STRING_DOH, /* CURLOPT_DOH_URL */
STRING_ALTSVC, /* CURLOPT_ALTSVC */
- STRING_HSTS, /* CURLOPT_HSTS */
+ STRING_HSTS, /* CURLOPT_HSTS */
STRING_SASL_AUTHZID, /* CURLOPT_SASL_AUTHZID */
STRING_TEMP_URL, /* temp URL storage for proxy use */
- STRING_DNS_SERVERS,
- STRING_DNS_INTERFACE,
- STRING_DNS_LOCAL_IP4,
- STRING_DNS_LOCAL_IP6,
- STRING_SSL_EC_CURVES,
-
- /* -- end of null-terminated strings -- */
-
+ STRING_DNS_SERVERS,
+ STRING_DNS_INTERFACE,
+ STRING_DNS_LOCAL_IP4,
+ STRING_DNS_LOCAL_IP6,
+ STRING_SSL_EC_CURVES,
+
+ /* -- end of null-terminated strings -- */
+
STRING_LASTZEROTERMINATED,
/* -- below this are pointers to binary data that cannot be strdup'ed. --- */
STRING_COPYPOSTFIELDS, /* if POST, set the fields' values here */
-
+
STRING_LAST /* not used, just an end-of-list marker */
};
-enum dupblob {
- BLOB_CERT_ORIG,
- BLOB_CERT_PROXY,
- BLOB_KEY_ORIG,
- BLOB_KEY_PROXY,
- BLOB_SSL_ISSUERCERT_ORIG,
- BLOB_SSL_ISSUERCERT_PROXY,
- BLOB_LAST
-};
-
+enum dupblob {
+ BLOB_CERT_ORIG,
+ BLOB_CERT_PROXY,
+ BLOB_KEY_ORIG,
+ BLOB_KEY_PROXY,
+ BLOB_SSL_ISSUERCERT_ORIG,
+ BLOB_SSL_ISSUERCERT_PROXY,
+ BLOB_LAST
+};
+
/* callback that gets called when this easy handle is completed within a multi
handle. Only used for internally created transfers, like for example
DoH. */
@@ -1658,12 +1658,12 @@ struct UserDefined {
curl_conv_callback convtonetwork;
/* function to convert from UTF-8 encoding: */
curl_conv_callback convfromutf8;
-#ifdef USE_HSTS
- curl_hstsread_callback hsts_read;
- void *hsts_read_userp;
- curl_hstswrite_callback hsts_write;
- void *hsts_write_userp;
-#endif
+#ifdef USE_HSTS
+ curl_hstsread_callback hsts_read;
+ void *hsts_read_userp;
+ curl_hstswrite_callback hsts_write;
+ void *hsts_write_userp;
+#endif
void *progress_client; /* pointer to pass to the progress callback */
void *ioctl_client; /* pointer to pass to the ioctl callback */
long timeout; /* in milliseconds, 0 means no timeout */
@@ -1700,13 +1700,13 @@ struct UserDefined {
the hostname and port to connect to */
curl_TimeCond timecondition; /* kind of time/date comparison */
time_t timevalue; /* what time to compare with */
- Curl_HttpReq method; /* what kind of HTTP request (if any) is this */
+ Curl_HttpReq method; /* what kind of HTTP request (if any) is this */
long httpversion; /* when non-zero, a specific HTTP version requested to
be used in the library's request(s) */
struct ssl_config_data ssl; /* user defined SSL stuff */
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
struct ssl_config_data proxy_ssl; /* user defined SSL stuff for proxy */
-#endif
+#endif
struct ssl_general_config general_ssl; /* general user defined SSL stuff */
curl_proxytype proxytype; /* what kind of proxy that is in use */
long dns_cache_timeout; /* DNS cache timeout */
@@ -1736,7 +1736,7 @@ struct UserDefined {
long new_directory_perms; /* Permissions to use when creating remote dirs */
long ssh_auth_types; /* allowed SSH auth types */
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
- struct curl_blob *blobs[BLOB_LAST];
+ struct curl_blob *blobs[BLOB_LAST];
unsigned int scope_id; /* Scope id for IPv6 */
long allowed_protocols;
long redir_protocols;
@@ -1774,88 +1774,88 @@ struct UserDefined {
CURLU *uh; /* URL handle for the current parsed URL */
void *trailer_data; /* pointer to pass to trailer data callback */
curl_trailer_callback trailer_callback; /* trailing data callback */
- BIT(is_fread_set); /* has read callback been set to non-NULL? */
- BIT(is_fwrite_set); /* has write callback been set to non-NULL? */
- BIT(free_referer); /* set TRUE if 'referer' points to a string we
+ BIT(is_fread_set); /* has read callback been set to non-NULL? */
+ BIT(is_fwrite_set); /* has write callback been set to non-NULL? */
+ BIT(free_referer); /* set TRUE if 'referer' points to a string we
allocated */
- BIT(tftp_no_options); /* do not send TFTP options requests */
- BIT(sep_headers); /* handle host and proxy headers separately */
- BIT(cookiesession); /* new cookie session? */
- BIT(crlf); /* convert crlf on ftp upload(?) */
- BIT(strip_path_slash); /* strip off initial slash from path */
- BIT(ssh_compression); /* enable SSH compression */
+ BIT(tftp_no_options); /* do not send TFTP options requests */
+ BIT(sep_headers); /* handle host and proxy headers separately */
+ BIT(cookiesession); /* new cookie session? */
+ BIT(crlf); /* convert crlf on ftp upload(?) */
+ BIT(strip_path_slash); /* strip off initial slash from path */
+ BIT(ssh_compression); /* enable SSH compression */
/* Here follows boolean settings that define how to behave during
this session. They are STATIC, set by libcurl users or at least initially
and they don't change during operations. */
- BIT(get_filetime); /* get the time and get of the remote file */
- BIT(tunnel_thru_httpproxy); /* use CONNECT through a HTTP proxy */
- BIT(prefer_ascii); /* ASCII rather than binary */
- BIT(ftp_append); /* append, not overwrite, on upload */
- BIT(ftp_list_only); /* switch FTP command for listing directories */
+ BIT(get_filetime); /* get the time and get of the remote file */
+ BIT(tunnel_thru_httpproxy); /* use CONNECT through a HTTP proxy */
+ BIT(prefer_ascii); /* ASCII rather than binary */
+ BIT(ftp_append); /* append, not overwrite, on upload */
+ BIT(ftp_list_only); /* switch FTP command for listing directories */
#ifndef CURL_DISABLE_FTP
- BIT(ftp_use_port); /* use the FTP PORT command */
- BIT(ftp_use_epsv); /* if EPSV is to be attempted or not */
- BIT(ftp_use_eprt); /* if EPRT is to be attempted or not */
- BIT(ftp_use_pret); /* if PRET is to be used before PASV or not */
- BIT(ftp_skip_ip); /* skip the IP address the FTP server passes on to
+ BIT(ftp_use_port); /* use the FTP PORT command */
+ BIT(ftp_use_epsv); /* if EPSV is to be attempted or not */
+ BIT(ftp_use_eprt); /* if EPRT is to be attempted or not */
+ BIT(ftp_use_pret); /* if PRET is to be used before PASV or not */
+ BIT(ftp_skip_ip); /* skip the IP address the FTP server passes on to
us */
#endif
- BIT(hide_progress); /* don't use the progress meter */
- BIT(http_fail_on_error); /* fail on HTTP error codes >= 400 */
- BIT(http_keep_sending_on_error); /* for HTTP status codes >= 300 */
- BIT(http_follow_location); /* follow HTTP redirects */
- BIT(http_transfer_encoding); /* request compressed HTTP transfer-encoding */
- BIT(allow_auth_to_other_hosts);
- BIT(include_header); /* include received protocol headers in data output */
- BIT(http_set_referer); /* is a custom referer used */
- BIT(http_auto_referer); /* set "correct" referer when following
- location: */
- BIT(opt_no_body); /* as set with CURLOPT_NOBODY */
- BIT(upload); /* upload request */
- BIT(verbose); /* output verbosity */
- BIT(krb); /* Kerberos connection requested */
- BIT(reuse_forbid); /* forbidden to be reused, close after use */
- BIT(reuse_fresh); /* do not re-use an existing connection */
- BIT(no_signal); /* do not use any signal/alarm handler */
- BIT(tcp_nodelay); /* whether to enable TCP_NODELAY or not */
- BIT(ignorecl); /* ignore content length */
- BIT(connect_only); /* make connection, let application use the socket */
- BIT(http_te_skip); /* pass the raw body data to the user, even when
- transfer-encoded (chunked, compressed) */
- BIT(http_ce_skip); /* pass the raw body data to the user, even when
- content-encoded (chunked, compressed) */
- BIT(proxy_transfer_mode); /* set transfer mode (;type=<a|i>) when doing
- FTP via an HTTP proxy */
+ BIT(hide_progress); /* don't use the progress meter */
+ BIT(http_fail_on_error); /* fail on HTTP error codes >= 400 */
+ BIT(http_keep_sending_on_error); /* for HTTP status codes >= 300 */
+ BIT(http_follow_location); /* follow HTTP redirects */
+ BIT(http_transfer_encoding); /* request compressed HTTP transfer-encoding */
+ BIT(allow_auth_to_other_hosts);
+ BIT(include_header); /* include received protocol headers in data output */
+ BIT(http_set_referer); /* is a custom referer used */
+ BIT(http_auto_referer); /* set "correct" referer when following
+ location: */
+ BIT(opt_no_body); /* as set with CURLOPT_NOBODY */
+ BIT(upload); /* upload request */
+ BIT(verbose); /* output verbosity */
+ BIT(krb); /* Kerberos connection requested */
+ BIT(reuse_forbid); /* forbidden to be reused, close after use */
+ BIT(reuse_fresh); /* do not re-use an existing connection */
+ BIT(no_signal); /* do not use any signal/alarm handler */
+ BIT(tcp_nodelay); /* whether to enable TCP_NODELAY or not */
+ BIT(ignorecl); /* ignore content length */
+ BIT(connect_only); /* make connection, let application use the socket */
+ BIT(http_te_skip); /* pass the raw body data to the user, even when
+ transfer-encoded (chunked, compressed) */
+ BIT(http_ce_skip); /* pass the raw body data to the user, even when
+ content-encoded (chunked, compressed) */
+ BIT(proxy_transfer_mode); /* set transfer mode (;type=<a|i>) when doing
+ FTP via an HTTP proxy */
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
- BIT(socks5_gssapi_nec); /* Flag to support NEC SOCKS5 server */
+ BIT(socks5_gssapi_nec); /* Flag to support NEC SOCKS5 server */
#endif
- BIT(sasl_ir); /* Enable/disable SASL initial response */
- BIT(wildcard_enabled); /* enable wildcard matching */
- BIT(tcp_keepalive); /* use TCP keepalives */
- BIT(tcp_fastopen); /* use TCP Fast Open */
- BIT(ssl_enable_npn); /* TLS NPN extension? */
- BIT(ssl_enable_alpn);/* TLS ALPN extension? */
- BIT(path_as_is); /* allow dotdots? */
- BIT(pipewait); /* wait for multiplex status before starting a new
- connection */
- BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers
- from user callbacks */
- BIT(dns_shuffle_addresses); /* whether to shuffle addresses before use */
- BIT(stream_depends_e); /* set or don't set the Exclusive bit */
- BIT(haproxyprotocol); /* whether to send HAProxy PROXY protocol v1
- header */
- BIT(abstract_unix_socket);
- BIT(disallow_username_in_url); /* disallow username in url */
- BIT(doh); /* DNS-over-HTTPS enabled */
- BIT(doh_get); /* use GET for DoH requests, instead of POST */
- BIT(http09_allowed); /* allow HTTP/0.9 responses */
- BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some
- recipients */
+ BIT(sasl_ir); /* Enable/disable SASL initial response */
+ BIT(wildcard_enabled); /* enable wildcard matching */
+ BIT(tcp_keepalive); /* use TCP keepalives */
+ BIT(tcp_fastopen); /* use TCP Fast Open */
+ BIT(ssl_enable_npn); /* TLS NPN extension? */
+ BIT(ssl_enable_alpn);/* TLS ALPN extension? */
+ BIT(path_as_is); /* allow dotdots? */
+ BIT(pipewait); /* wait for multiplex status before starting a new
+ connection */
+ BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers
+ from user callbacks */
+ BIT(dns_shuffle_addresses); /* whether to shuffle addresses before use */
+ BIT(stream_depends_e); /* set or don't set the Exclusive bit */
+ BIT(haproxyprotocol); /* whether to send HAProxy PROXY protocol v1
+ header */
+ BIT(abstract_unix_socket);
+ BIT(disallow_username_in_url); /* disallow username in url */
+ BIT(doh); /* DNS-over-HTTPS enabled */
+ BIT(doh_get); /* use GET for DoH requests, instead of POST */
+ BIT(http09_allowed); /* allow HTTP/0.9 responses */
+ BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some
+ recipients */
};
struct Names {
- struct Curl_hash *hostcache;
+ struct Curl_hash *hostcache;
enum {
HCACHE_NONE, /* not pointing to anything */
HCACHE_MULTI, /* points to a shared one in the multi handle */
@@ -1879,8 +1879,8 @@ struct Curl_easy {
struct Curl_easy *prev;
struct connectdata *conn;
- struct Curl_llist_element connect_queue;
- struct Curl_llist_element conn_queue; /* list per connectdata */
+ struct Curl_llist_element connect_queue;
+ struct Curl_llist_element conn_queue; /* list per connectdata */
CURLMstate mstate; /* the handle's state */
CURLcode result; /* previous result */
@@ -1914,10 +1914,10 @@ struct Curl_easy {
NOTE that the 'cookie' field in the
UserDefined struct defines if the "engine"
is to be used or not. */
-#ifdef USE_HSTS
- struct hsts *hsts;
-#endif
-#ifndef CURL_DISABLE_ALTSVC
+#ifdef USE_HSTS
+ struct hsts *hsts;
+#endif
+#ifndef CURL_DISABLE_ALTSVC
struct altsvcinfo *asi; /* the alt-svc cache */
#endif
struct Progress progress; /* for all the progress meter data */
diff --git a/contrib/libs/curl/lib/vauth/cleartext.c b/contrib/libs/curl/lib/vauth/cleartext.c
index e56e46c1f4..620dba03ef 100644
--- a/contrib/libs/curl/lib/vauth/cleartext.c
+++ b/contrib/libs/curl/lib/vauth/cleartext.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -81,8 +81,8 @@ CURLcode Curl_auth_create_plain_message(struct Curl_easy *data,
plen = strlen(passwd);
/* Compute binary message length. Check for overflows. */
- if((zlen > SIZE_T_MAX/4) || (clen > SIZE_T_MAX/4) ||
- (plen > (SIZE_T_MAX/2 - 2)))
+ if((zlen > SIZE_T_MAX/4) || (clen > SIZE_T_MAX/4) ||
+ (plen > (SIZE_T_MAX/2 - 2)))
return CURLE_OUT_OF_MEMORY;
plainlen = zlen + clen + plen + 2;
diff --git a/contrib/libs/curl/lib/vauth/cram.c b/contrib/libs/curl/lib/vauth/cram.c
index 4c31eb5f0f..1a376259a8 100644
--- a/contrib/libs/curl/lib/vauth/cram.c
+++ b/contrib/libs/curl/lib/vauth/cram.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -96,7 +96,7 @@ CURLcode Curl_auth_create_cram_md5_message(struct Curl_easy *data,
{
CURLcode result = CURLE_OK;
size_t chlglen = 0;
- struct HMAC_context *ctxt;
+ struct HMAC_context *ctxt;
unsigned char digest[MD5_DIGEST_LEN];
char *response;
diff --git a/contrib/libs/curl/lib/vauth/digest.c b/contrib/libs/curl/lib/vauth/digest.c
index 92fd182274..5fc9285263 100644
--- a/contrib/libs/curl/lib/vauth/digest.c
+++ b/contrib/libs/curl/lib/vauth/digest.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -62,7 +62,7 @@
what ultimately goes over the network.
*/
#define CURL_OUTPUT_DIGEST_CONV(a, b) \
- result = Curl_convert_to_network(a, b, strlen(b)); \
+ result = Curl_convert_to_network(a, b, strlen(b)); \
if(result) { \
free(b); \
return result; \
@@ -358,7 +358,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
char **outptr, size_t *outlen)
{
size_t i;
- struct MD5_context *ctxt;
+ struct MD5_context *ctxt;
char *response = NULL;
unsigned char digest[MD5_DIGEST_LEN];
char HA1_hex[2 * MD5_DIGEST_LEN + 1];
@@ -660,7 +660,7 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
}
/*
- * auth_create_digest_http_message()
+ * auth_create_digest_http_message()
*
* This is used to generate a HTTP DIGEST response message ready for sending
* to the recipient.
@@ -679,7 +679,7 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
*
* Returns CURLE_OK on success.
*/
-static CURLcode auth_create_digest_http_message(
+static CURLcode auth_create_digest_http_message(
struct Curl_easy *data,
const char *userp,
const char *passwdp,
@@ -688,8 +688,8 @@ static CURLcode auth_create_digest_http_message(
struct digestdata *digest,
char **outptr, size_t *outlen,
void (*convert_to_ascii)(unsigned char *, unsigned char *),
- void (*hash)(unsigned char *, const unsigned char *,
- const size_t))
+ void (*hash)(unsigned char *, const unsigned char *,
+ const size_t))
{
CURLcode result;
unsigned char hashbuf[32]; /* 32 bytes/256 bits */
@@ -701,7 +701,7 @@ static CURLcode auth_create_digest_http_message(
size_t cnonce_sz = 0;
char *userp_quoted;
char *response = NULL;
- char *hashthis = NULL;
+ char *hashthis = NULL;
char *tmp = NULL;
if(!digest->nc)
@@ -723,12 +723,12 @@ static CURLcode auth_create_digest_http_message(
}
if(digest->userhash) {
- hashthis = aprintf("%s:%s", userp, digest->realm);
+ hashthis = aprintf("%s:%s", userp, digest->realm);
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
CURL_OUTPUT_DIGEST_CONV(data, hashthis);
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
convert_to_ascii(hashbuf, (unsigned char *)userh);
}
@@ -744,13 +744,13 @@ static CURLcode auth_create_digest_http_message(
unq(nonce-value) ":" unq(cnonce-value)
*/
- hashthis = aprintf("%s:%s:%s", digest->userhash ? userh : userp,
- digest->realm, passwdp);
+ hashthis = aprintf("%s:%s:%s", digest->userhash ? userh : userp,
+ digest->realm, passwdp);
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
CURL_OUTPUT_DIGEST_CONV(data, hashthis); /* convert on non-ASCII machines */
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
convert_to_ascii(hashbuf, ha1);
@@ -763,7 +763,7 @@ static CURLcode auth_create_digest_http_message(
return CURLE_OUT_OF_MEMORY;
CURL_OUTPUT_DIGEST_CONV(data, tmp); /* Convert on non-ASCII machines */
- hash(hashbuf, (unsigned char *) tmp, strlen(tmp));
+ hash(hashbuf, (unsigned char *) tmp, strlen(tmp));
free(tmp);
convert_to_ascii(hashbuf, ha1);
}
@@ -781,19 +781,19 @@ static CURLcode auth_create_digest_http_message(
5.1.1 of RFC 2616)
*/
- hashthis = aprintf("%s:%s", request, uripath);
+ hashthis = aprintf("%s:%s", request, uripath);
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
if(digest->qop && strcasecompare(digest->qop, "auth-int")) {
/* We don't support auth-int for PUT or POST */
char hashed[65];
- char *hashthis2;
+ char *hashthis2;
- hash(hashbuf, (const unsigned char *)"", 0);
+ hash(hashbuf, (const unsigned char *)"", 0);
convert_to_ascii(hashbuf, (unsigned char *)hashed);
- hashthis2 = aprintf("%s:%s", hashthis, hashed);
+ hashthis2 = aprintf("%s:%s", hashthis, hashed);
free(hashthis);
hashthis = hashthis2;
}
@@ -802,23 +802,23 @@ static CURLcode auth_create_digest_http_message(
return CURLE_OUT_OF_MEMORY;
CURL_OUTPUT_DIGEST_CONV(data, hashthis); /* convert on non-ASCII machines */
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
convert_to_ascii(hashbuf, ha2);
if(digest->qop) {
- hashthis = aprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce, digest->nc,
- digest->cnonce, digest->qop, ha2);
+ hashthis = aprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce, digest->nc,
+ digest->cnonce, digest->qop, ha2);
}
else {
- hashthis = aprintf("%s:%s:%s", ha1, digest->nonce, ha2);
+ hashthis = aprintf("%s:%s:%s", ha1, digest->nonce, ha2);
}
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
CURL_OUTPUT_DIGEST_CONV(data, hashthis); /* convert on non-ASCII machines */
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
convert_to_ascii(hashbuf, request_digest);
@@ -891,7 +891,7 @@ static CURLcode auth_create_digest_http_message(
if(digest->algorithm) {
/* Append the algorithm */
- tmp = aprintf("%s, algorithm=%s", response, digest->algorithm);
+ tmp = aprintf("%s, algorithm=%s", response, digest->algorithm);
free(response);
if(!tmp)
return CURLE_OUT_OF_MEMORY;
@@ -947,21 +947,21 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
switch(digest->algo) {
case CURLDIGESTALGO_MD5:
case CURLDIGESTALGO_MD5SESS:
- return auth_create_digest_http_message(data, userp, passwdp,
- request, uripath, digest,
- outptr, outlen,
- auth_digest_md5_to_ascii,
- Curl_md5it);
+ return auth_create_digest_http_message(data, userp, passwdp,
+ request, uripath, digest,
+ outptr, outlen,
+ auth_digest_md5_to_ascii,
+ Curl_md5it);
case CURLDIGESTALGO_SHA256:
case CURLDIGESTALGO_SHA256SESS:
case CURLDIGESTALGO_SHA512_256:
case CURLDIGESTALGO_SHA512_256SESS:
- return auth_create_digest_http_message(data, userp, passwdp,
- request, uripath, digest,
- outptr, outlen,
- auth_digest_sha256_to_ascii,
- Curl_sha256it);
+ return auth_create_digest_http_message(data, userp, passwdp,
+ request, uripath, digest,
+ outptr, outlen,
+ auth_digest_sha256_to_ascii,
+ Curl_sha256it);
default:
return CURLE_UNSUPPORTED_PROTOCOL;
diff --git a/contrib/libs/curl/lib/vauth/digest.h b/contrib/libs/curl/lib/vauth/digest.h
index d502de9e6d..ee373cd82e 100644
--- a/contrib/libs/curl/lib/vauth/digest.h
+++ b/contrib/libs/curl/lib/vauth/digest.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vauth/digest_sspi.c b/contrib/libs/curl/lib/vauth/digest_sspi.c
index 1bc0d8e05b..91d18c992b 100644
--- a/contrib/libs/curl/lib/vauth/digest_sspi.c
+++ b/contrib/libs/curl/lib/vauth/digest_sspi.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2014 - 2016, Steve Holme, <steve_holme@hotmail.com>.
- * Copyright (C) 2015 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2015 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -134,8 +134,8 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
if(status != SEC_E_OK) {
free(input_token);
- failf(data, "SSPI: couldn't get auth info\n");
- return CURLE_AUTH_ERROR;
+ failf(data, "SSPI: couldn't get auth info\n");
+ return CURLE_AUTH_ERROR;
}
token_max = SecurityPackage->cbMaxToken;
@@ -289,13 +289,13 @@ CURLcode Curl_override_sspi_http_realm(const char *chlg,
if(strcasecompare(value, "realm")) {
/* Setup identity's domain and length */
- domain.tchar_ptr = curlx_convert_UTF8_to_tchar((char *) content);
+ domain.tchar_ptr = curlx_convert_UTF8_to_tchar((char *) content);
if(!domain.tchar_ptr)
return CURLE_OUT_OF_MEMORY;
dup_domain.tchar_ptr = _tcsdup(domain.tchar_ptr);
if(!dup_domain.tchar_ptr) {
- curlx_unicodefree(domain.tchar_ptr);
+ curlx_unicodefree(domain.tchar_ptr);
return CURLE_OUT_OF_MEMORY;
}
@@ -304,7 +304,7 @@ CURLcode Curl_override_sspi_http_realm(const char *chlg,
identity->DomainLength = curlx_uztoul(_tcslen(dup_domain.tchar_ptr));
dup_domain.tchar_ptr = NULL;
- curlx_unicodefree(domain.tchar_ptr);
+ curlx_unicodefree(domain.tchar_ptr);
}
else {
/* Unknown specifier, ignore it! */
@@ -432,10 +432,10 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
/* Query the security package for DigestSSP */
status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_DIGEST),
&SecurityPackage);
- if(status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
- return CURLE_AUTH_ERROR;
- }
+ if(status != SEC_E_OK) {
+ failf(data, "SSPI: couldn't get auth info\n");
+ return CURLE_AUTH_ERROR;
+ }
token_max = SecurityPackage->cbMaxToken;
@@ -583,7 +583,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
resp_buf.pvBuffer = output_token;
resp_buf.cbBuffer = curlx_uztoul(token_max);
- spn = curlx_convert_UTF8_to_tchar((char *) uripath);
+ spn = curlx_convert_UTF8_to_tchar((char *) uripath);
if(!spn) {
s_pSecFn->FreeCredentialsHandle(&credentials);
@@ -605,7 +605,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
&chlg_desc, 0,
digest->http_context,
&resp_desc, &attrs, &expiry);
- curlx_unicodefree(spn);
+ curlx_unicodefree(spn);
if(status == SEC_I_COMPLETE_NEEDED ||
status == SEC_I_COMPLETE_AND_CONTINUE)
diff --git a/contrib/libs/curl/lib/vauth/krb5_gssapi.c b/contrib/libs/curl/lib/vauth/krb5_gssapi.c
index a5eb39c4a7..0412815e93 100644
--- a/contrib/libs/curl/lib/vauth/krb5_gssapi.c
+++ b/contrib/libs/curl/lib/vauth/krb5_gssapi.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2014 - 2019, Steve Holme, <steve_holme@hotmail.com>.
- * Copyright (C) 2015 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2015 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vauth/krb5_sspi.c b/contrib/libs/curl/lib/vauth/krb5_sspi.c
index c4c5f8d29c..8e56a82409 100644
--- a/contrib/libs/curl/lib/vauth/krb5_sspi.c
+++ b/contrib/libs/curl/lib/vauth/krb5_sspi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2014 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2014 - 2020, Steve Holme, <steve_holme@hotmail.com>.
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -125,8 +125,8 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
TEXT(SP_NAME_KERBEROS),
&SecurityPackage);
if(status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
- return CURLE_AUTH_ERROR;
+ failf(data, "SSPI: couldn't get auth info\n");
+ return CURLE_AUTH_ERROR;
}
krb5->token_max = SecurityPackage->cbMaxToken;
@@ -396,7 +396,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
return CURLE_OUT_OF_MEMORY;
/* Convert the user name to UTF8 when operating with Unicode */
- user_name = curlx_convert_tchar_to_UTF8(names.sUserName);
+ user_name = curlx_convert_tchar_to_UTF8(names.sUserName);
if(!user_name) {
free(trailer);
@@ -408,7 +408,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
message = malloc(messagelen);
if(!message) {
free(trailer);
- curlx_unicodefree(user_name);
+ curlx_unicodefree(user_name);
return CURLE_OUT_OF_MEMORY;
}
@@ -421,7 +421,7 @@ CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
outdata = htonl(max_size) | sec_layer;
memcpy(message, &outdata, sizeof(outdata));
strcpy((char *) message + sizeof(outdata), user_name);
- curlx_unicodefree(user_name);
+ curlx_unicodefree(user_name);
/* Allocate the padding */
padding = malloc(sizes.cbBlockSize);
diff --git a/contrib/libs/curl/lib/vauth/ntlm.c b/contrib/libs/curl/lib/vauth/ntlm.c
index 93396a30cb..a3117f3fee 100644
--- a/contrib/libs/curl/lib/vauth/ntlm.c
+++ b/contrib/libs/curl/lib/vauth/ntlm.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -40,7 +40,7 @@
#include "curl_ntlm_core.h"
#include "curl_gethostname.h"
#include "curl_multibyte.h"
-#include "curl_md5.h"
+#include "curl_md5.h"
#include "warnless.h"
#include "rand.h"
#include "vtls/vtls.h"
@@ -191,7 +191,7 @@ static CURLcode ntlm_decode_type2_target(struct Curl_easy *data,
return CURLE_BAD_CONTENT_ENCODING;
}
- free(ntlm->target_info); /* replace any previous data */
+ free(ntlm->target_info); /* replace any previous data */
ntlm->target_info = malloc(target_info_len);
if(!ntlm->target_info)
return CURLE_OUT_OF_MEMORY;
@@ -600,14 +600,14 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
#endif
#if defined(USE_NTRESPONSES) && defined(USE_NTLM2SESSION)
-
-#define CURL_MD5_DIGEST_LENGTH 16 /* fixed size */
-
+
+#define CURL_MD5_DIGEST_LENGTH 16 /* fixed size */
+
/* We don't support NTLM2 if we don't have USE_NTRESPONSES */
if(ntlm->flags & NTLMFLAG_NEGOTIATE_NTLM_KEY) {
unsigned char ntbuffer[0x18];
unsigned char tmp[0x18];
- unsigned char md5sum[CURL_MD5_DIGEST_LENGTH];
+ unsigned char md5sum[CURL_MD5_DIGEST_LENGTH];
unsigned char entropy[8];
/* Need to create 8 bytes random data */
@@ -625,11 +625,11 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
memcpy(tmp, &ntlm->nonce[0], 8);
memcpy(tmp + 8, entropy, 8);
- Curl_md5it(md5sum, tmp, 16);
-
- /* We shall only use the first 8 bytes of md5sum, but the des code in
- Curl_ntlm_core_lm_resp only encrypt the first 8 bytes */
- result = Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer);
+ Curl_md5it(md5sum, tmp, 16);
+
+ /* We shall only use the first 8 bytes of md5sum, but the des code in
+ Curl_ntlm_core_lm_resp only encrypt the first 8 bytes */
+ result = Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer);
if(result)
return result;
diff --git a/contrib/libs/curl/lib/vauth/ntlm.h b/contrib/libs/curl/lib/vauth/ntlm.h
index 9beb089ba9..8ec23ad4f5 100644
--- a/contrib/libs/curl/lib/vauth/ntlm.h
+++ b/contrib/libs/curl/lib/vauth/ntlm.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vauth/ntlm_sspi.c b/contrib/libs/curl/lib/vauth/ntlm_sspi.c
index 2e5d2e5c48..28bc3efdaa 100644
--- a/contrib/libs/curl/lib/vauth/ntlm_sspi.c
+++ b/contrib/libs/curl/lib/vauth/ntlm_sspi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -105,10 +105,10 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
/* Query the security package for NTLM */
status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_NTLM),
&SecurityPackage);
- if(status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
- return CURLE_AUTH_ERROR;
- }
+ if(status != SEC_E_OK) {
+ failf(data, "SSPI: couldn't get auth info\n");
+ return CURLE_AUTH_ERROR;
+ }
ntlm->token_max = SecurityPackage->cbMaxToken;
diff --git a/contrib/libs/curl/lib/vauth/oauth2.c b/contrib/libs/curl/lib/vauth/oauth2.c
index fb723edca7..ca5842a7c0 100644
--- a/contrib/libs/curl/lib/vauth/oauth2.c
+++ b/contrib/libs/curl/lib/vauth/oauth2.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vauth/spnego_gssapi.c b/contrib/libs/curl/lib/vauth/spnego_gssapi.c
index 7f663c2725..120925ff33 100644
--- a/contrib/libs/curl/lib/vauth/spnego_gssapi.c
+++ b/contrib/libs/curl/lib/vauth/spnego_gssapi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vauth/spnego_sspi.c b/contrib/libs/curl/lib/vauth/spnego_sspi.c
index 8f8c69acfa..e7482a43e2 100644
--- a/contrib/libs/curl/lib/vauth/spnego_sspi.c
+++ b/contrib/libs/curl/lib/vauth/spnego_sspi.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -129,10 +129,10 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
nego->status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *)
TEXT(SP_NAME_NEGOTIATE),
&SecurityPackage);
- if(nego->status != SEC_E_OK) {
- failf(data, "SSPI: couldn't get auth info\n");
- return CURLE_AUTH_ERROR;
- }
+ if(nego->status != SEC_E_OK) {
+ failf(data, "SSPI: couldn't get auth info\n");
+ return CURLE_AUTH_ERROR;
+ }
nego->token_max = SecurityPackage->cbMaxToken;
diff --git a/contrib/libs/curl/lib/vauth/vauth.c b/contrib/libs/curl/lib/vauth/vauth.c
index d35ef808be..129b8f8b57 100644
--- a/contrib/libs/curl/lib/vauth/vauth.c
+++ b/contrib/libs/curl/lib/vauth/vauth.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2014 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2014 - 2020, Steve Holme, <steve_holme@hotmail.com>.
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -89,7 +89,7 @@ TCHAR *Curl_auth_build_spn(const char *service, const char *host,
}
/* Allocate our TCHAR based SPN */
- tchar_spn = curlx_convert_UTF8_to_tchar(utf8_spn);
+ tchar_spn = curlx_convert_UTF8_to_tchar(utf8_spn);
if(!tchar_spn) {
free(utf8_spn);
@@ -97,7 +97,7 @@ TCHAR *Curl_auth_build_spn(const char *service, const char *host,
}
/* Release the UTF8 variant when operating with Unicode */
- curlx_unicodefree(utf8_spn);
+ curlx_unicodefree(utf8_spn);
/* Return our newly allocated SPN */
return tchar_spn;
diff --git a/contrib/libs/curl/lib/vauth/vauth.h b/contrib/libs/curl/lib/vauth/vauth.h
index c756139a92..f25cfc329f 100644
--- a/contrib/libs/curl/lib/vauth/vauth.h
+++ b/contrib/libs/curl/lib/vauth/vauth.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2014 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2014 - 2020, Steve Holme, <steve_holme@hotmail.com>.
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -43,7 +43,7 @@ struct negotiatedata;
#endif
#if defined(USE_WINDOWS_SSPI)
-#define GSS_ERROR(status) ((status) & 0x80000000)
+#define GSS_ERROR(status) ((status) & 0x80000000)
#endif
/* This is used to build a SPN string */
diff --git a/contrib/libs/curl/lib/version.c b/contrib/libs/curl/lib/version.c
index 3f3aa05ec3..5e8512ef05 100644
--- a/contrib/libs/curl/lib/version.c
+++ b/contrib/libs/curl/lib/version.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,13 +26,13 @@
#include "urldata.h"
#include "vtls/vtls.h"
#include "http2.h"
-#include "vssh/ssh.h"
+#include "vssh/ssh.h"
#include "quic.h"
#include "curl_printf.h"
#ifdef USE_ARES
-# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
- defined(WIN32)
+# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
+ defined(WIN32)
# define CARES_STATICLIB
# endif
# include <ares.h>
@@ -62,9 +62,9 @@
#error #include <brotli/decode.h>
#endif
-#ifdef HAVE_ZSTD
-#error #include <zstd.h>
-#endif
+#ifdef HAVE_ZSTD
+#error #include <zstd.h>
+#endif
#ifdef HAVE_BROTLI
static size_t brotli_version(char *buf, size_t bufsz)
@@ -78,139 +78,139 @@ static size_t brotli_version(char *buf, size_t bufsz)
}
#endif
-#ifdef HAVE_ZSTD
-static size_t zstd_version(char *buf, size_t bufsz)
+#ifdef HAVE_ZSTD
+static size_t zstd_version(char *buf, size_t bufsz)
{
- unsigned long zstd_version = (unsigned long)ZSTD_versionNumber();
- unsigned int major = (unsigned int)(zstd_version / (100 * 100));
- unsigned int minor = (unsigned int)((zstd_version -
- (major * 100 * 100)) / 100);
- unsigned int patch = (unsigned int)(zstd_version -
- (major * 100 * 100) - (minor * 100));
-
- return msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
-}
-#endif
-
-/*
- * curl_version() returns a pointer to a static buffer.
- *
- * It is implemented to work multi-threaded by making sure repeated invokes
- * generate the exact same string and never write any temporary data like
- * zeros in the data.
- */
-
-#define VERSION_PARTS 14 /* number of substrings we can concatenate */
-
-char *curl_version(void)
-{
- static char out[300];
- char *outp;
- size_t outlen;
- const char *src[VERSION_PARTS];
-#ifdef USE_SSL
- char ssl_version[200];
-#endif
-#ifdef HAVE_LIBZ
- char z_version[40];
-#endif
-#ifdef HAVE_BROTLI
- char br_version[40] = "brotli/";
-#endif
-#ifdef HAVE_ZSTD
- char zst_version[40] = "zstd/";
-#endif
-#ifdef USE_ARES
- char cares_version[40];
-#endif
-#if defined(USE_LIBIDN2)
- char idn_version[40];
-#endif
-#ifdef USE_LIBPSL
- char psl_version[40];
-#endif
-#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
- char iconv_version[40]="iconv";
-#endif
-#ifdef USE_SSH
- char ssh_version[40];
-#endif
-#ifdef USE_NGHTTP2
- char h2_version[40];
-#endif
-#ifdef ENABLE_QUIC
- char h3_version[40];
-#endif
-#ifdef USE_LIBRTMP
- char rtmp_version[40];
-#endif
- int i = 0;
- int j;
-
-#ifdef DEBUGBUILD
- /* Override version string when environment variable CURL_VERSION is set */
- const char *debugversion = getenv("CURL_VERSION");
- if(debugversion) {
- strncpy(out, debugversion, sizeof(out)-1);
- out[sizeof(out)-1] = '\0';
- return out;
+ unsigned long zstd_version = (unsigned long)ZSTD_versionNumber();
+ unsigned int major = (unsigned int)(zstd_version / (100 * 100));
+ unsigned int minor = (unsigned int)((zstd_version -
+ (major * 100 * 100)) / 100);
+ unsigned int patch = (unsigned int)(zstd_version -
+ (major * 100 * 100) - (minor * 100));
+
+ return msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
+}
+#endif
+
+/*
+ * curl_version() returns a pointer to a static buffer.
+ *
+ * It is implemented to work multi-threaded by making sure repeated invokes
+ * generate the exact same string and never write any temporary data like
+ * zeros in the data.
+ */
+
+#define VERSION_PARTS 14 /* number of substrings we can concatenate */
+
+char *curl_version(void)
+{
+ static char out[300];
+ char *outp;
+ size_t outlen;
+ const char *src[VERSION_PARTS];
+#ifdef USE_SSL
+ char ssl_version[200];
+#endif
+#ifdef HAVE_LIBZ
+ char z_version[40];
+#endif
+#ifdef HAVE_BROTLI
+ char br_version[40] = "brotli/";
+#endif
+#ifdef HAVE_ZSTD
+ char zst_version[40] = "zstd/";
+#endif
+#ifdef USE_ARES
+ char cares_version[40];
+#endif
+#if defined(USE_LIBIDN2)
+ char idn_version[40];
+#endif
+#ifdef USE_LIBPSL
+ char psl_version[40];
+#endif
+#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
+ char iconv_version[40]="iconv";
+#endif
+#ifdef USE_SSH
+ char ssh_version[40];
+#endif
+#ifdef USE_NGHTTP2
+ char h2_version[40];
+#endif
+#ifdef ENABLE_QUIC
+ char h3_version[40];
+#endif
+#ifdef USE_LIBRTMP
+ char rtmp_version[40];
+#endif
+ int i = 0;
+ int j;
+
+#ifdef DEBUGBUILD
+ /* Override version string when environment variable CURL_VERSION is set */
+ const char *debugversion = getenv("CURL_VERSION");
+ if(debugversion) {
+ strncpy(out, debugversion, sizeof(out)-1);
+ out[sizeof(out)-1] = '\0';
+ return out;
}
-#endif
+#endif
- src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION;
-#ifdef USE_SSL
- Curl_ssl_version(ssl_version, sizeof(ssl_version));
- src[i++] = ssl_version;
-#endif
+ src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION;
+#ifdef USE_SSL
+ Curl_ssl_version(ssl_version, sizeof(ssl_version));
+ src[i++] = ssl_version;
+#endif
#ifdef HAVE_LIBZ
- msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
- src[i++] = z_version;
+ msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
+ src[i++] = z_version;
#endif
#ifdef HAVE_BROTLI
- brotli_version(&br_version[7], sizeof(br_version) - 7);
- src[i++] = br_version;
+ brotli_version(&br_version[7], sizeof(br_version) - 7);
+ src[i++] = br_version;
+#endif
+#ifdef HAVE_ZSTD
+ zstd_version(&zst_version[5], sizeof(zst_version) - 5);
+ src[i++] = zst_version;
#endif
-#ifdef HAVE_ZSTD
- zstd_version(&zst_version[5], sizeof(zst_version) - 5);
- src[i++] = zst_version;
-#endif
#ifdef USE_ARES
- msnprintf(cares_version, sizeof(cares_version),
- "c-ares/%s", ares_version(NULL));
- src[i++] = cares_version;
+ msnprintf(cares_version, sizeof(cares_version),
+ "c-ares/%s", ares_version(NULL));
+ src[i++] = cares_version;
#endif
#ifdef USE_LIBIDN2
- msnprintf(idn_version, sizeof(idn_version),
- "libidn2/%s", idn2_check_version(NULL));
- src[i++] = idn_version;
-#elif defined(USE_WIN32_IDN)
- src[i++] = (char *)"WinIDN";
+ msnprintf(idn_version, sizeof(idn_version),
+ "libidn2/%s", idn2_check_version(NULL));
+ src[i++] = idn_version;
+#elif defined(USE_WIN32_IDN)
+ src[i++] = (char *)"WinIDN";
#endif
-
+
#ifdef USE_LIBPSL
- msnprintf(psl_version, sizeof(psl_version), "libpsl/%s", psl_get_version());
- src[i++] = psl_version;
+ msnprintf(psl_version, sizeof(psl_version), "libpsl/%s", psl_get_version());
+ src[i++] = psl_version;
#endif
#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
#ifdef _LIBICONV_VERSION
- msnprintf(iconv_version, sizeof(iconv_version), "iconv/%d.%d",
- _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255);
+ msnprintf(iconv_version, sizeof(iconv_version), "iconv/%d.%d",
+ _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255);
#else
- /* version unknown, let the default stand */
+ /* version unknown, let the default stand */
#endif /* _LIBICONV_VERSION */
- src[i++] = iconv_version;
+ src[i++] = iconv_version;
#endif
#ifdef USE_SSH
- Curl_ssh_version(ssh_version, sizeof(ssh_version));
- src[i++] = ssh_version;
+ Curl_ssh_version(ssh_version, sizeof(ssh_version));
+ src[i++] = ssh_version;
#endif
#ifdef USE_NGHTTP2
- Curl_http2_ver(h2_version, sizeof(h2_version));
- src[i++] = h2_version;
+ Curl_http2_ver(h2_version, sizeof(h2_version));
+ src[i++] = h2_version;
#endif
#ifdef ENABLE_QUIC
- Curl_quic_ver(h3_version, sizeof(h3_version));
- src[i++] = h3_version;
+ Curl_quic_ver(h3_version, sizeof(h3_version));
+ src[i++] = h3_version;
#endif
#ifdef USE_LIBRTMP
{
@@ -222,34 +222,34 @@ char *curl_version(void)
else
suff[0] = '\0';
- msnprintf(rtmp_version, sizeof(rtmp_version), "librtmp/%d.%d%s",
+ msnprintf(rtmp_version, sizeof(rtmp_version), "librtmp/%d.%d%s",
RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
suff);
- src[i++] = rtmp_version;
- }
-#endif
-
- DEBUGASSERT(i <= VERSION_PARTS);
-
- outp = &out[0];
- outlen = sizeof(out);
- for(j = 0; j < i; j++) {
- size_t n = strlen(src[j]);
- /* we need room for a space, the string and the final zero */
- if(outlen <= (n + 2))
- break;
- if(j) {
- /* prepend a space if not the first */
- *outp++ = ' ';
- outlen--;
- }
- memcpy(outp, src[j], n);
- outp += n;
- outlen -= n;
+ src[i++] = rtmp_version;
+ }
+#endif
+
+ DEBUGASSERT(i <= VERSION_PARTS);
+
+ outp = &out[0];
+ outlen = sizeof(out);
+ for(j = 0; j < i; j++) {
+ size_t n = strlen(src[j]);
+ /* we need room for a space, the string and the final zero */
+ if(outlen <= (n + 2))
+ break;
+ if(j) {
+ /* prepend a space if not the first */
+ *outp++ = ' ';
+ outlen--;
+ }
+ memcpy(outp, src[j], n);
+ outp += n;
+ outlen -= n;
}
- *outp = 0;
+ *outp = 0;
- return out;
+ return out;
}
/* data for curl_version_info
@@ -294,9 +294,9 @@ static const char * const protocols[] = {
"ldaps",
#endif
#endif
-#ifndef CURL_DISABLE_MQTT
- "mqtt",
-#endif
+#ifndef CURL_DISABLE_MQTT
+ "mqtt",
+#endif
#ifndef CURL_DISABLE_POP3
"pop3",
#endif
@@ -309,14 +309,14 @@ static const char * const protocols[] = {
#ifndef CURL_DISABLE_RTSP
"rtsp",
#endif
-#if defined(USE_SSH) && !defined(USE_WOLFSSH)
+#if defined(USE_SSH) && !defined(USE_WOLFSSH)
"scp",
-#endif
-#ifdef USE_SSH
+#endif
+#ifdef USE_SSH
"sftp",
#endif
-#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
- (CURL_SIZEOF_CURL_OFF_T > 4)
+#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
+ (CURL_SIZEOF_CURL_OFF_T > 4)
"smb",
# ifdef USE_SSL
"smbs",
@@ -385,9 +385,9 @@ static curl_version_info_data version_info = {
( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) )
| CURL_VERSION_LARGEFILE
#endif
-#if defined(WIN32) && defined(UNICODE) && defined(_UNICODE)
- | CURL_VERSION_UNICODE
-#endif
+#if defined(WIN32) && defined(UNICODE) && defined(_UNICODE)
+ | CURL_VERSION_UNICODE
+#endif
#if defined(CURL_DOES_CONVERSIONS)
| CURL_VERSION_CONV
#endif
@@ -412,15 +412,15 @@ static curl_version_info_data version_info = {
#if defined(HAVE_BROTLI)
| CURL_VERSION_BROTLI
#endif
-#if defined(HAVE_ZSTD)
- | CURL_VERSION_ZSTD
-#endif
-#ifndef CURL_DISABLE_ALTSVC
+#if defined(HAVE_ZSTD)
+ | CURL_VERSION_ZSTD
+#endif
+#ifndef CURL_DISABLE_ALTSVC
| CURL_VERSION_ALTSVC
#endif
-#if defined(USE_HSTS)
- | CURL_VERSION_HSTS
-#endif
+#if defined(USE_HSTS)
+ | CURL_VERSION_HSTS
+#endif
,
NULL, /* ssl_version */
0, /* ssl_version_num, this is kept at zero */
@@ -435,19 +435,19 @@ static curl_version_info_data version_info = {
NULL, /* brotli version */
0, /* nghttp2 version number */
NULL, /* nghttp2 version string */
- NULL, /* quic library string */
-#ifdef CURL_CA_BUNDLE
- CURL_CA_BUNDLE, /* cainfo */
-#else
- NULL,
-#endif
-#ifdef CURL_CA_PATH
- CURL_CA_PATH, /* capath */
-#else
- NULL,
-#endif
- 0, /* zstd_ver_num */
- NULL /* zstd version */
+ NULL, /* quic library string */
+#ifdef CURL_CA_BUNDLE
+ CURL_CA_BUNDLE, /* cainfo */
+#else
+ NULL,
+#endif
+#ifdef CURL_CA_PATH
+ CURL_CA_PATH, /* capath */
+#else
+ NULL,
+#endif
+ 0, /* zstd_ver_num */
+ NULL /* zstd version */
};
curl_version_info_data *curl_version_info(CURLversion stamp)
@@ -465,21 +465,21 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
#ifdef HAVE_BROTLI
static char brotli_buffer[80];
#endif
-#ifdef HAVE_ZSTD
- static char zstd_buffer[80];
-#endif
+#ifdef HAVE_ZSTD
+ static char zstd_buffer[80];
+#endif
#ifdef USE_SSL
Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
version_info.ssl_version = ssl_buffer;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(Curl_ssl->supports & SSLSUPP_HTTPS_PROXY)
version_info.features |= CURL_VERSION_HTTPS_PROXY;
else
version_info.features &= ~CURL_VERSION_HTTPS_PROXY;
#endif
-#endif
+#endif
#ifdef HAVE_LIBZ
version_info.libz_version = zlibVersion();
@@ -522,12 +522,12 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
version_info.brotli_version = brotli_buffer;
#endif
-#ifdef HAVE_ZSTD
- version_info.zstd_ver_num = (unsigned int)ZSTD_versionNumber();
- zstd_version(zstd_buffer, sizeof(zstd_buffer));
- version_info.zstd_version = zstd_buffer;
-#endif
-
+#ifdef HAVE_ZSTD
+ version_info.zstd_ver_num = (unsigned int)ZSTD_versionNumber();
+ zstd_version(zstd_buffer, sizeof(zstd_buffer));
+ version_info.zstd_version = zstd_buffer;
+#endif
+
#ifdef USE_NGHTTP2
{
nghttp2_info *h2 = nghttp2_version(0);
diff --git a/contrib/libs/curl/lib/version_win32.c b/contrib/libs/curl/lib/version_win32.c
index e7f67eaf8f..b8157e9893 100644
--- a/contrib/libs/curl/lib/version_win32.c
+++ b/contrib/libs/curl/lib/version_win32.c
@@ -1,226 +1,226 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
- *
- * 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.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"
-
-#if defined(WIN32)
-
-#include <curl/curl.h>
-#include "version_win32.h"
-
-/* The last #include files should be: */
-#include "curl_memory.h"
-#include "memdebug.h"
-
-/*
- * curlx_verify_windows_version()
- *
- * This is used to verify if we are running on a specific windows version.
- *
- * Parameters:
- *
- * majorVersion [in] - The major version number.
- * minorVersion [in] - The minor version number.
- * platform [in] - The optional platform identifier.
- * condition [in] - The test condition used to specifier whether we are
- * checking a version less then, equal to or greater than
- * what is specified in the major and minor version
- * numbers.
- *
- * Returns TRUE if matched; otherwise FALSE.
- */
-bool curlx_verify_windows_version(const unsigned int majorVersion,
- const unsigned int minorVersion,
- const PlatformIdentifier platform,
- const VersionCondition condition)
-{
- bool matched = FALSE;
-
-#if defined(CURL_WINDOWS_APP)
- /* We have no way to determine the Windows version from Windows apps,
- so let's assume we're running on the target Windows version. */
- const WORD fullVersion = MAKEWORD(minorVersion, majorVersion);
- const WORD targetVersion = (WORD)_WIN32_WINNT;
-
- switch(condition) {
- case VERSION_LESS_THAN:
- matched = targetVersion < fullVersion;
- break;
-
- case VERSION_LESS_THAN_EQUAL:
- matched = targetVersion <= fullVersion;
- break;
-
- case VERSION_EQUAL:
- matched = targetVersion == fullVersion;
- break;
-
- case VERSION_GREATER_THAN_EQUAL:
- matched = targetVersion >= fullVersion;
- break;
-
- case VERSION_GREATER_THAN:
- matched = targetVersion > fullVersion;
- break;
- }
-
- if(matched && (platform == PLATFORM_WINDOWS)) {
- /* we're always running on PLATFORM_WINNT */
- matched = FALSE;
- }
-#elif !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
- (_WIN32_WINNT < _WIN32_WINNT_WIN2K)
- OSVERSIONINFO osver;
-
- memset(&osver, 0, sizeof(osver));
- osver.dwOSVersionInfoSize = sizeof(osver);
-
- /* Find out Windows version */
- if(GetVersionEx(&osver)) {
- /* Verify the Operating System version number */
- switch(condition) {
- case VERSION_LESS_THAN:
- if(osver.dwMajorVersion < majorVersion ||
- (osver.dwMajorVersion == majorVersion &&
- osver.dwMinorVersion < minorVersion))
- matched = TRUE;
- break;
-
- case VERSION_LESS_THAN_EQUAL:
- if(osver.dwMajorVersion < majorVersion ||
- (osver.dwMajorVersion == majorVersion &&
- osver.dwMinorVersion <= minorVersion))
- matched = TRUE;
- break;
-
- case VERSION_EQUAL:
- if(osver.dwMajorVersion == majorVersion &&
- osver.dwMinorVersion == minorVersion)
- matched = TRUE;
- break;
-
- case VERSION_GREATER_THAN_EQUAL:
- if(osver.dwMajorVersion > majorVersion ||
- (osver.dwMajorVersion == majorVersion &&
- osver.dwMinorVersion >= minorVersion))
- matched = TRUE;
- break;
-
- case VERSION_GREATER_THAN:
- if(osver.dwMajorVersion > majorVersion ||
- (osver.dwMajorVersion == majorVersion &&
- osver.dwMinorVersion > minorVersion))
- matched = TRUE;
- break;
- }
-
- /* Verify the platform identifier (if necessary) */
- if(matched) {
- switch(platform) {
- case PLATFORM_WINDOWS:
- if(osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS)
- matched = FALSE;
- break;
-
- case PLATFORM_WINNT:
- if(osver.dwPlatformId != VER_PLATFORM_WIN32_NT)
- matched = FALSE;
-
- default: /* like platform == PLATFORM_DONT_CARE */
- break;
- }
- }
- }
-#else
- ULONGLONG cm = 0;
- OSVERSIONINFOEX osver;
- BYTE majorCondition;
- BYTE minorCondition;
- BYTE spMajorCondition;
- BYTE spMinorCondition;
-
- switch(condition) {
- case VERSION_LESS_THAN:
- majorCondition = VER_LESS;
- minorCondition = VER_LESS;
- spMajorCondition = VER_LESS_EQUAL;
- spMinorCondition = VER_LESS_EQUAL;
- break;
-
- case VERSION_LESS_THAN_EQUAL:
- majorCondition = VER_LESS_EQUAL;
- minorCondition = VER_LESS_EQUAL;
- spMajorCondition = VER_LESS_EQUAL;
- spMinorCondition = VER_LESS_EQUAL;
- break;
-
- case VERSION_EQUAL:
- majorCondition = VER_EQUAL;
- minorCondition = VER_EQUAL;
- spMajorCondition = VER_GREATER_EQUAL;
- spMinorCondition = VER_GREATER_EQUAL;
- break;
-
- case VERSION_GREATER_THAN_EQUAL:
- majorCondition = VER_GREATER_EQUAL;
- minorCondition = VER_GREATER_EQUAL;
- spMajorCondition = VER_GREATER_EQUAL;
- spMinorCondition = VER_GREATER_EQUAL;
- break;
-
- case VERSION_GREATER_THAN:
- majorCondition = VER_GREATER;
- minorCondition = VER_GREATER;
- spMajorCondition = VER_GREATER_EQUAL;
- spMinorCondition = VER_GREATER_EQUAL;
- break;
-
- default:
- return FALSE;
- }
-
- memset(&osver, 0, sizeof(osver));
- osver.dwOSVersionInfoSize = sizeof(osver);
- osver.dwMajorVersion = majorVersion;
- osver.dwMinorVersion = minorVersion;
- if(platform == PLATFORM_WINDOWS)
- osver.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
- else if(platform == PLATFORM_WINNT)
- osver.dwPlatformId = VER_PLATFORM_WIN32_NT;
-
- cm = VerSetConditionMask(cm, VER_MAJORVERSION, majorCondition);
- cm = VerSetConditionMask(cm, VER_MINORVERSION, minorCondition);
- cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, spMajorCondition);
- cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, spMinorCondition);
- if(platform != PLATFORM_DONT_CARE)
- cm = VerSetConditionMask(cm, VER_PLATFORMID, VER_EQUAL);
-
- if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION |
- VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
- cm))
- matched = TRUE;
-#endif
-
- return matched;
-}
-
-#endif /* WIN32 */
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ *
+ * 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.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"
+
+#if defined(WIN32)
+
+#include <curl/curl.h>
+#include "version_win32.h"
+
+/* The last #include files should be: */
+#include "curl_memory.h"
+#include "memdebug.h"
+
+/*
+ * curlx_verify_windows_version()
+ *
+ * This is used to verify if we are running on a specific windows version.
+ *
+ * Parameters:
+ *
+ * majorVersion [in] - The major version number.
+ * minorVersion [in] - The minor version number.
+ * platform [in] - The optional platform identifier.
+ * condition [in] - The test condition used to specifier whether we are
+ * checking a version less then, equal to or greater than
+ * what is specified in the major and minor version
+ * numbers.
+ *
+ * Returns TRUE if matched; otherwise FALSE.
+ */
+bool curlx_verify_windows_version(const unsigned int majorVersion,
+ const unsigned int minorVersion,
+ const PlatformIdentifier platform,
+ const VersionCondition condition)
+{
+ bool matched = FALSE;
+
+#if defined(CURL_WINDOWS_APP)
+ /* We have no way to determine the Windows version from Windows apps,
+ so let's assume we're running on the target Windows version. */
+ const WORD fullVersion = MAKEWORD(minorVersion, majorVersion);
+ const WORD targetVersion = (WORD)_WIN32_WINNT;
+
+ switch(condition) {
+ case VERSION_LESS_THAN:
+ matched = targetVersion < fullVersion;
+ break;
+
+ case VERSION_LESS_THAN_EQUAL:
+ matched = targetVersion <= fullVersion;
+ break;
+
+ case VERSION_EQUAL:
+ matched = targetVersion == fullVersion;
+ break;
+
+ case VERSION_GREATER_THAN_EQUAL:
+ matched = targetVersion >= fullVersion;
+ break;
+
+ case VERSION_GREATER_THAN:
+ matched = targetVersion > fullVersion;
+ break;
+ }
+
+ if(matched && (platform == PLATFORM_WINDOWS)) {
+ /* we're always running on PLATFORM_WINNT */
+ matched = FALSE;
+ }
+#elif !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
+ (_WIN32_WINNT < _WIN32_WINNT_WIN2K)
+ OSVERSIONINFO osver;
+
+ memset(&osver, 0, sizeof(osver));
+ osver.dwOSVersionInfoSize = sizeof(osver);
+
+ /* Find out Windows version */
+ if(GetVersionEx(&osver)) {
+ /* Verify the Operating System version number */
+ switch(condition) {
+ case VERSION_LESS_THAN:
+ if(osver.dwMajorVersion < majorVersion ||
+ (osver.dwMajorVersion == majorVersion &&
+ osver.dwMinorVersion < minorVersion))
+ matched = TRUE;
+ break;
+
+ case VERSION_LESS_THAN_EQUAL:
+ if(osver.dwMajorVersion < majorVersion ||
+ (osver.dwMajorVersion == majorVersion &&
+ osver.dwMinorVersion <= minorVersion))
+ matched = TRUE;
+ break;
+
+ case VERSION_EQUAL:
+ if(osver.dwMajorVersion == majorVersion &&
+ osver.dwMinorVersion == minorVersion)
+ matched = TRUE;
+ break;
+
+ case VERSION_GREATER_THAN_EQUAL:
+ if(osver.dwMajorVersion > majorVersion ||
+ (osver.dwMajorVersion == majorVersion &&
+ osver.dwMinorVersion >= minorVersion))
+ matched = TRUE;
+ break;
+
+ case VERSION_GREATER_THAN:
+ if(osver.dwMajorVersion > majorVersion ||
+ (osver.dwMajorVersion == majorVersion &&
+ osver.dwMinorVersion > minorVersion))
+ matched = TRUE;
+ break;
+ }
+
+ /* Verify the platform identifier (if necessary) */
+ if(matched) {
+ switch(platform) {
+ case PLATFORM_WINDOWS:
+ if(osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS)
+ matched = FALSE;
+ break;
+
+ case PLATFORM_WINNT:
+ if(osver.dwPlatformId != VER_PLATFORM_WIN32_NT)
+ matched = FALSE;
+
+ default: /* like platform == PLATFORM_DONT_CARE */
+ break;
+ }
+ }
+ }
+#else
+ ULONGLONG cm = 0;
+ OSVERSIONINFOEX osver;
+ BYTE majorCondition;
+ BYTE minorCondition;
+ BYTE spMajorCondition;
+ BYTE spMinorCondition;
+
+ switch(condition) {
+ case VERSION_LESS_THAN:
+ majorCondition = VER_LESS;
+ minorCondition = VER_LESS;
+ spMajorCondition = VER_LESS_EQUAL;
+ spMinorCondition = VER_LESS_EQUAL;
+ break;
+
+ case VERSION_LESS_THAN_EQUAL:
+ majorCondition = VER_LESS_EQUAL;
+ minorCondition = VER_LESS_EQUAL;
+ spMajorCondition = VER_LESS_EQUAL;
+ spMinorCondition = VER_LESS_EQUAL;
+ break;
+
+ case VERSION_EQUAL:
+ majorCondition = VER_EQUAL;
+ minorCondition = VER_EQUAL;
+ spMajorCondition = VER_GREATER_EQUAL;
+ spMinorCondition = VER_GREATER_EQUAL;
+ break;
+
+ case VERSION_GREATER_THAN_EQUAL:
+ majorCondition = VER_GREATER_EQUAL;
+ minorCondition = VER_GREATER_EQUAL;
+ spMajorCondition = VER_GREATER_EQUAL;
+ spMinorCondition = VER_GREATER_EQUAL;
+ break;
+
+ case VERSION_GREATER_THAN:
+ majorCondition = VER_GREATER;
+ minorCondition = VER_GREATER;
+ spMajorCondition = VER_GREATER_EQUAL;
+ spMinorCondition = VER_GREATER_EQUAL;
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ memset(&osver, 0, sizeof(osver));
+ osver.dwOSVersionInfoSize = sizeof(osver);
+ osver.dwMajorVersion = majorVersion;
+ osver.dwMinorVersion = minorVersion;
+ if(platform == PLATFORM_WINDOWS)
+ osver.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
+ else if(platform == PLATFORM_WINNT)
+ osver.dwPlatformId = VER_PLATFORM_WIN32_NT;
+
+ cm = VerSetConditionMask(cm, VER_MAJORVERSION, majorCondition);
+ cm = VerSetConditionMask(cm, VER_MINORVERSION, minorCondition);
+ cm = VerSetConditionMask(cm, VER_SERVICEPACKMAJOR, spMajorCondition);
+ cm = VerSetConditionMask(cm, VER_SERVICEPACKMINOR, spMinorCondition);
+ if(platform != PLATFORM_DONT_CARE)
+ cm = VerSetConditionMask(cm, VER_PLATFORMID, VER_EQUAL);
+
+ if(VerifyVersionInfo(&osver, (VER_MAJORVERSION | VER_MINORVERSION |
+ VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR),
+ cm))
+ matched = TRUE;
+#endif
+
+ return matched;
+}
+
+#endif /* WIN32 */
diff --git a/contrib/libs/curl/lib/version_win32.h b/contrib/libs/curl/lib/version_win32.h
index 45e87ee101..9b1bd88874 100644
--- a/contrib/libs/curl/lib/version_win32.h
+++ b/contrib/libs/curl/lib/version_win32.h
@@ -1,53 +1,53 @@
-#ifndef HEADER_CURL_VERSION_WIN32_H
-#define HEADER_CURL_VERSION_WIN32_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
- *
- * 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.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"
-
-#if defined(WIN32)
-
-/* Version condition */
-typedef enum {
- VERSION_LESS_THAN,
- VERSION_LESS_THAN_EQUAL,
- VERSION_EQUAL,
- VERSION_GREATER_THAN_EQUAL,
- VERSION_GREATER_THAN
-} VersionCondition;
-
-/* Platform identifier */
-typedef enum {
- PLATFORM_DONT_CARE,
- PLATFORM_WINDOWS,
- PLATFORM_WINNT
-} PlatformIdentifier;
-
-/* This is used to verify if we are running on a specific windows version */
-bool curlx_verify_windows_version(const unsigned int majorVersion,
- const unsigned int minorVersion,
- const PlatformIdentifier platform,
- const VersionCondition condition);
-
-#endif /* WIN32 */
-
-#endif /* HEADER_CURL_VERSION_WIN32_H */
+#ifndef HEADER_CURL_VERSION_WIN32_H
+#define HEADER_CURL_VERSION_WIN32_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ *
+ * 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.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"
+
+#if defined(WIN32)
+
+/* Version condition */
+typedef enum {
+ VERSION_LESS_THAN,
+ VERSION_LESS_THAN_EQUAL,
+ VERSION_EQUAL,
+ VERSION_GREATER_THAN_EQUAL,
+ VERSION_GREATER_THAN
+} VersionCondition;
+
+/* Platform identifier */
+typedef enum {
+ PLATFORM_DONT_CARE,
+ PLATFORM_WINDOWS,
+ PLATFORM_WINNT
+} PlatformIdentifier;
+
+/* This is used to verify if we are running on a specific windows version */
+bool curlx_verify_windows_version(const unsigned int majorVersion,
+ const unsigned int minorVersion,
+ const PlatformIdentifier platform,
+ const VersionCondition condition);
+
+#endif /* WIN32 */
+
+#endif /* HEADER_CURL_VERSION_WIN32_H */
diff --git a/contrib/libs/curl/lib/vquic/ngtcp2.c b/contrib/libs/curl/lib/vquic/ngtcp2.c
index 1df4366dc0..17c419d3e4 100644
--- a/contrib/libs/curl/lib/vquic/ngtcp2.c
+++ b/contrib/libs/curl/lib/vquic/ngtcp2.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,9 +26,9 @@
#error #include <ngtcp2/ngtcp2.h>
#error #include <ngtcp2/ngtcp2_crypto.h>
#error #include <nghttp3/nghttp3.h>
-#ifdef USE_OPENSSL
+#ifdef USE_OPENSSL
#include <openssl/err.h>
-#endif
+#endif
#include "urldata.h"
#include "sendf.h"
#include "strdup.h"
@@ -38,9 +38,9 @@
#include "strcase.h"
#include "connect.h"
#include "strerror.h"
-#include "dynbuf.h"
-#error #include "vquic.h"
-#include "vtls/keylog.h"
+#include "dynbuf.h"
+#error #include "vquic.h"
+#include "vtls/keylog.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -48,13 +48,13 @@
#include "memdebug.h"
/* #define DEBUG_NGTCP2 */
-#ifdef CURLDEBUG
+#ifdef CURLDEBUG
#define DEBUG_HTTP3
-#endif
+#endif
#ifdef DEBUG_HTTP3
#define H3BUGF(x) x
#else
-#define H3BUGF(x) do { } while(0)
+#define H3BUGF(x) do { } while(0)
#endif
/*
@@ -74,18 +74,18 @@ struct h3out {
#define QUIC_MAX_STREAMS (256*1024)
#define QUIC_MAX_DATA (1*1024*1024)
#define QUIC_IDLE_TIMEOUT 60000 /* milliseconds */
-
-#ifdef USE_OPENSSL
+
+#ifdef USE_OPENSSL
#define QUIC_CIPHERS \
"TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_" \
"POLY1305_SHA256:TLS_AES_128_CCM_SHA256"
#define QUIC_GROUPS "P-256:X25519:P-384:P-521"
-#elif defined(USE_GNUTLS)
-#define QUIC_PRIORITY \
- "NORMAL:-VERS-ALL:+VERS-TLS1.3:-CIPHER-ALL:+AES-128-GCM:+AES-256-GCM:" \
- "+CHACHA20-POLY1305:+AES-128-CCM:-GROUP-ALL:+GROUP-SECP256R1:" \
- "+GROUP-X25519:+GROUP-SECP384R1:+GROUP-SECP521R1"
-#endif
+#elif defined(USE_GNUTLS)
+#define QUIC_PRIORITY \
+ "NORMAL:-VERS-ALL:+VERS-TLS1.3:-CIPHER-ALL:+AES-128-GCM:+AES-256-GCM:" \
+ "+CHACHA20-POLY1305:+AES-128-CCM:-GROUP-ALL:+GROUP-SECP256R1:" \
+ "+GROUP-X25519:+GROUP-SECP384R1:+GROUP-SECP521R1"
+#endif
static CURLcode ng_process_ingress(struct connectdata *conn,
curl_socket_t sockfd,
@@ -114,7 +114,7 @@ static void quic_printf(void *user_data, const char *fmt, ...)
}
#endif
-#ifdef USE_OPENSSL
+#ifdef USE_OPENSSL
static ngtcp2_crypto_level
quic_from_ossl_level(OSSL_ENCRYPTION_LEVEL ossl_level)
{
@@ -126,50 +126,50 @@ quic_from_ossl_level(OSSL_ENCRYPTION_LEVEL ossl_level)
case ssl_encryption_handshake:
return NGTCP2_CRYPTO_LEVEL_HANDSHAKE;
case ssl_encryption_application:
- return NGTCP2_CRYPTO_LEVEL_APPLICATION;
+ return NGTCP2_CRYPTO_LEVEL_APPLICATION;
+ default:
+ assert(0);
+ }
+}
+#elif defined(USE_GNUTLS)
+static ngtcp2_crypto_level
+quic_from_gtls_level(gnutls_record_encryption_level_t gtls_level)
+{
+ switch(gtls_level) {
+ case GNUTLS_ENCRYPTION_LEVEL_INITIAL:
+ return NGTCP2_CRYPTO_LEVEL_INITIAL;
+ case GNUTLS_ENCRYPTION_LEVEL_EARLY:
+ return NGTCP2_CRYPTO_LEVEL_EARLY;
+ case GNUTLS_ENCRYPTION_LEVEL_HANDSHAKE:
+ return NGTCP2_CRYPTO_LEVEL_HANDSHAKE;
+ case GNUTLS_ENCRYPTION_LEVEL_APPLICATION:
+ return NGTCP2_CRYPTO_LEVEL_APPLICATION;
default:
assert(0);
}
}
-#elif defined(USE_GNUTLS)
-static ngtcp2_crypto_level
-quic_from_gtls_level(gnutls_record_encryption_level_t gtls_level)
-{
- switch(gtls_level) {
- case GNUTLS_ENCRYPTION_LEVEL_INITIAL:
- return NGTCP2_CRYPTO_LEVEL_INITIAL;
- case GNUTLS_ENCRYPTION_LEVEL_EARLY:
- return NGTCP2_CRYPTO_LEVEL_EARLY;
- case GNUTLS_ENCRYPTION_LEVEL_HANDSHAKE:
- return NGTCP2_CRYPTO_LEVEL_HANDSHAKE;
- case GNUTLS_ENCRYPTION_LEVEL_APPLICATION:
- return NGTCP2_CRYPTO_LEVEL_APPLICATION;
- default:
- assert(0);
- }
-}
-#endif
-
-static void qlog_callback(void *user_data, uint32_t flags,
- const void *data, size_t datalen)
+#endif
+
+static void qlog_callback(void *user_data, uint32_t flags,
+ const void *data, size_t datalen)
{
- struct quicsocket *qs = (struct quicsocket *)user_data;
- (void)flags;
- if(qs->qlogfd != -1) {
- ssize_t rc = write(qs->qlogfd, data, datalen);
- if(rc == -1) {
- /* on write error, stop further write attempts */
- close(qs->qlogfd);
- qs->qlogfd = -1;
- }
- }
+ struct quicsocket *qs = (struct quicsocket *)user_data;
+ (void)flags;
+ if(qs->qlogfd != -1) {
+ ssize_t rc = write(qs->qlogfd, data, datalen);
+ if(rc == -1) {
+ /* on write error, stop further write attempts */
+ close(qs->qlogfd);
+ qs->qlogfd = -1;
+ }
+ }
}
-static void quic_settings(struct quicsocket *qs,
+static void quic_settings(struct quicsocket *qs,
uint64_t stream_buffer_size)
{
- ngtcp2_settings *s = &qs->settings;
+ ngtcp2_settings *s = &qs->settings;
ngtcp2_settings_default(s);
#ifdef DEBUG_NGTCP2
s->log_printf = quic_printf;
@@ -177,55 +177,55 @@ static void quic_settings(struct quicsocket *qs,
s->log_printf = NULL;
#endif
s->initial_ts = timestamp();
- s->transport_params.initial_max_stream_data_bidi_local = stream_buffer_size;
- s->transport_params.initial_max_stream_data_bidi_remote = QUIC_MAX_STREAMS;
- s->transport_params.initial_max_stream_data_uni = QUIC_MAX_STREAMS;
- s->transport_params.initial_max_data = QUIC_MAX_DATA;
- s->transport_params.initial_max_streams_bidi = 1;
- s->transport_params.initial_max_streams_uni = 3;
- s->transport_params.max_idle_timeout = QUIC_IDLE_TIMEOUT;
- if(qs->qlogfd != -1) {
- s->qlog.write = qlog_callback;
- }
+ s->transport_params.initial_max_stream_data_bidi_local = stream_buffer_size;
+ s->transport_params.initial_max_stream_data_bidi_remote = QUIC_MAX_STREAMS;
+ s->transport_params.initial_max_stream_data_uni = QUIC_MAX_STREAMS;
+ s->transport_params.initial_max_data = QUIC_MAX_DATA;
+ s->transport_params.initial_max_streams_bidi = 1;
+ s->transport_params.initial_max_streams_uni = 3;
+ s->transport_params.max_idle_timeout = QUIC_IDLE_TIMEOUT;
+ if(qs->qlogfd != -1) {
+ s->qlog.write = qlog_callback;
+ }
}
-#ifdef USE_OPENSSL
+#ifdef USE_OPENSSL
static void keylog_callback(const SSL *ssl, const char *line)
{
(void)ssl;
- Curl_tls_keylog_write_line(line);
+ Curl_tls_keylog_write_line(line);
}
-#elif defined(USE_GNUTLS)
-static int keylog_callback(gnutls_session_t session, const char *label,
- const gnutls_datum_t *secret)
+#elif defined(USE_GNUTLS)
+static int keylog_callback(gnutls_session_t session, const char *label,
+ const gnutls_datum_t *secret)
{
- gnutls_datum_t crandom;
- gnutls_datum_t srandom;
+ gnutls_datum_t crandom;
+ gnutls_datum_t srandom;
- gnutls_session_get_random(session, &crandom, &srandom);
- if(crandom.size != 32) {
- return -1;
- }
+ gnutls_session_get_random(session, &crandom, &srandom);
+ if(crandom.size != 32) {
+ return -1;
+ }
- Curl_tls_keylog_write(label, crandom.data, secret->data, secret->size);
- return 0;
+ Curl_tls_keylog_write(label, crandom.data, secret->data, secret->size);
+ return 0;
}
-#endif
+#endif
-static int init_ngh3_conn(struct quicsocket *qs);
-
-static int write_client_handshake(struct quicsocket *qs,
- ngtcp2_crypto_level level,
- const uint8_t *data, size_t len)
+static int init_ngh3_conn(struct quicsocket *qs);
+
+static int write_client_handshake(struct quicsocket *qs,
+ ngtcp2_crypto_level level,
+ const uint8_t *data, size_t len)
{
struct quic_handshake *crypto_data;
int rv;
- crypto_data = &qs->crypto_data[level];
+ crypto_data = &qs->crypto_data[level];
if(crypto_data->buf == NULL) {
crypto_data->buf = malloc(4096);
- if(!crypto_data->buf)
- return 0;
+ if(!crypto_data->buf)
+ return 0;
crypto_data->alloclen = 4096;
}
@@ -237,51 +237,51 @@ static int write_client_handshake(struct quicsocket *qs,
crypto_data->len += len;
rv = ngtcp2_conn_submit_crypto_data(
- qs->qconn, level, (uint8_t *)(&crypto_data->buf[crypto_data->len] - len),
- len);
+ qs->qconn, level, (uint8_t *)(&crypto_data->buf[crypto_data->len] - len),
+ len);
if(rv) {
- H3BUGF(fprintf(stderr, "write_client_handshake failed\n"));
+ H3BUGF(fprintf(stderr, "write_client_handshake failed\n"));
}
assert(0 == rv);
return 1;
}
-#ifdef USE_OPENSSL
-static int quic_set_encryption_secrets(SSL *ssl,
- OSSL_ENCRYPTION_LEVEL ossl_level,
- const uint8_t *rx_secret,
- const uint8_t *tx_secret,
- size_t secretlen)
-{
- struct quicsocket *qs = (struct quicsocket *)SSL_get_app_data(ssl);
- int level = quic_from_ossl_level(ossl_level);
-
- if(ngtcp2_crypto_derive_and_install_rx_key(
- qs->qconn, NULL, NULL, NULL, level, rx_secret, secretlen) != 0)
- return 0;
-
- if(ngtcp2_crypto_derive_and_install_tx_key(
- qs->qconn, NULL, NULL, NULL, level, tx_secret, secretlen) != 0)
- return 0;
-
- if(level == NGTCP2_CRYPTO_LEVEL_APPLICATION) {
- if(init_ngh3_conn(qs) != CURLE_OK)
- return 0;
- }
-
- return 1;
-}
-
-static int quic_add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
- const uint8_t *data, size_t len)
-{
- struct quicsocket *qs = (struct quicsocket *)SSL_get_app_data(ssl);
- ngtcp2_crypto_level level = quic_from_ossl_level(ossl_level);
-
- return write_client_handshake(qs, level, data, len);
-}
-
+#ifdef USE_OPENSSL
+static int quic_set_encryption_secrets(SSL *ssl,
+ OSSL_ENCRYPTION_LEVEL ossl_level,
+ const uint8_t *rx_secret,
+ const uint8_t *tx_secret,
+ size_t secretlen)
+{
+ struct quicsocket *qs = (struct quicsocket *)SSL_get_app_data(ssl);
+ int level = quic_from_ossl_level(ossl_level);
+
+ if(ngtcp2_crypto_derive_and_install_rx_key(
+ qs->qconn, NULL, NULL, NULL, level, rx_secret, secretlen) != 0)
+ return 0;
+
+ if(ngtcp2_crypto_derive_and_install_tx_key(
+ qs->qconn, NULL, NULL, NULL, level, tx_secret, secretlen) != 0)
+ return 0;
+
+ if(level == NGTCP2_CRYPTO_LEVEL_APPLICATION) {
+ if(init_ngh3_conn(qs) != CURLE_OK)
+ return 0;
+ }
+
+ return 1;
+}
+
+static int quic_add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level,
+ const uint8_t *data, size_t len)
+{
+ struct quicsocket *qs = (struct quicsocket *)SSL_get_app_data(ssl);
+ ngtcp2_crypto_level level = quic_from_ossl_level(ossl_level);
+
+ return write_client_handshake(qs, level, data, len);
+}
+
static int quic_flush_flight(SSL *ssl)
{
(void)ssl;
@@ -312,9 +312,9 @@ static SSL_CTX *quic_ssl_ctx(struct Curl_easy *data)
SSL_CTX_set_default_verify_paths(ssl_ctx);
if(SSL_CTX_set_ciphersuites(ssl_ctx, QUIC_CIPHERS) != 1) {
- char error_buffer[256];
- ERR_error_string_n(ERR_get_error(), error_buffer, sizeof(error_buffer));
- failf(data, "SSL_CTX_set_ciphersuites: %s", error_buffer);
+ char error_buffer[256];
+ ERR_error_string_n(ERR_get_error(), error_buffer, sizeof(error_buffer));
+ failf(data, "SSL_CTX_set_ciphersuites: %s", error_buffer);
return NULL;
}
@@ -325,10 +325,10 @@ static SSL_CTX *quic_ssl_ctx(struct Curl_easy *data)
SSL_CTX_set_quic_method(ssl_ctx, &quic_method);
- /* Open the file if a TLS or QUIC backend has not done this before. */
- Curl_tls_keylog_open();
- if(Curl_tls_keylog_enabled()) {
- SSL_CTX_set_keylog_callback(ssl_ctx, keylog_callback);
+ /* Open the file if a TLS or QUIC backend has not done this before. */
+ Curl_tls_keylog_open();
+ if(Curl_tls_keylog_enabled()) {
+ SSL_CTX_set_keylog_callback(ssl_ctx, keylog_callback);
}
return ssl_ctx;
@@ -343,14 +343,14 @@ static int quic_init_ssl(struct quicsocket *qs)
/* this will need some attention when HTTPS proxy over QUIC get fixed */
const char * const hostname = qs->conn->host.name;
- DEBUGASSERT(!qs->ssl);
+ DEBUGASSERT(!qs->ssl);
qs->ssl = SSL_new(qs->sslctx);
SSL_set_app_data(qs->ssl, qs);
SSL_set_connect_state(qs->ssl);
- alpn = (const uint8_t *)NGHTTP3_ALPN_H3;
- alpnlen = sizeof(NGHTTP3_ALPN_H3) - 1;
+ alpn = (const uint8_t *)NGHTTP3_ALPN_H3;
+ alpnlen = sizeof(NGHTTP3_ALPN_H3) - 1;
if(alpn)
SSL_set_alpn_protos(qs->ssl, alpn, (int)alpnlen);
@@ -358,186 +358,186 @@ static int quic_init_ssl(struct quicsocket *qs)
SSL_set_tlsext_host_name(qs->ssl, hostname);
return 0;
}
-#elif defined(USE_GNUTLS)
-static int secret_func(gnutls_session_t ssl,
- gnutls_record_encryption_level_t gtls_level,
- const void *rx_secret,
- const void *tx_secret, size_t secretlen)
-{
- struct quicsocket *qs = gnutls_session_get_ptr(ssl);
- int level = quic_from_gtls_level(gtls_level);
-
- if(level != NGTCP2_CRYPTO_LEVEL_EARLY &&
- ngtcp2_crypto_derive_and_install_rx_key(
- qs->qconn, NULL, NULL, NULL, level, rx_secret, secretlen) != 0)
- return 0;
-
- if(ngtcp2_crypto_derive_and_install_tx_key(
- qs->qconn, NULL, NULL, NULL, level, tx_secret, secretlen) != 0)
- return 0;
-
- if(level == NGTCP2_CRYPTO_LEVEL_APPLICATION) {
- if(init_ngh3_conn(qs) != CURLE_OK)
- return -1;
- }
-
- return 0;
-}
-
-static int read_func(gnutls_session_t ssl,
- gnutls_record_encryption_level_t gtls_level,
- gnutls_handshake_description_t htype, const void *data,
- size_t len)
+#elif defined(USE_GNUTLS)
+static int secret_func(gnutls_session_t ssl,
+ gnutls_record_encryption_level_t gtls_level,
+ const void *rx_secret,
+ const void *tx_secret, size_t secretlen)
{
- struct quicsocket *qs = gnutls_session_get_ptr(ssl);
- ngtcp2_crypto_level level = quic_from_gtls_level(gtls_level);
- int rv;
+ struct quicsocket *qs = gnutls_session_get_ptr(ssl);
+ int level = quic_from_gtls_level(gtls_level);
- if(htype == GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC)
- return 0;
+ if(level != NGTCP2_CRYPTO_LEVEL_EARLY &&
+ ngtcp2_crypto_derive_and_install_rx_key(
+ qs->qconn, NULL, NULL, NULL, level, rx_secret, secretlen) != 0)
+ return 0;
+
+ if(ngtcp2_crypto_derive_and_install_tx_key(
+ qs->qconn, NULL, NULL, NULL, level, tx_secret, secretlen) != 0)
+ return 0;
+
+ if(level == NGTCP2_CRYPTO_LEVEL_APPLICATION) {
+ if(init_ngh3_conn(qs) != CURLE_OK)
+ return -1;
+ }
- rv = write_client_handshake(qs, level, data, len);
- if(rv == 0)
- return -1;
-
return 0;
}
-static int alert_read_func(gnutls_session_t ssl,
- gnutls_record_encryption_level_t gtls_level,
- gnutls_alert_level_t alert_level,
- gnutls_alert_description_t alert_desc)
-{
- struct quicsocket *qs = gnutls_session_get_ptr(ssl);
- (void)gtls_level;
- (void)alert_level;
-
- qs->tls_alert = alert_desc;
- return 1;
-}
-
-static int tp_recv_func(gnutls_session_t ssl, const uint8_t *data,
- size_t data_size)
-{
- struct quicsocket *qs = gnutls_session_get_ptr(ssl);
- ngtcp2_transport_params params;
-
- if(ngtcp2_decode_transport_params(
- &params, NGTCP2_TRANSPORT_PARAMS_TYPE_ENCRYPTED_EXTENSIONS,
- data, data_size) != 0)
- return -1;
-
- if(ngtcp2_conn_set_remote_transport_params(qs->qconn, &params) != 0)
- return -1;
-
- return 0;
-}
-
-static int tp_send_func(gnutls_session_t ssl, gnutls_buffer_t extdata)
-{
- struct quicsocket *qs = gnutls_session_get_ptr(ssl);
- uint8_t paramsbuf[64];
- ngtcp2_transport_params params;
- ssize_t nwrite;
- int rc;
-
- ngtcp2_conn_get_local_transport_params(qs->qconn, &params);
- nwrite = ngtcp2_encode_transport_params(
- paramsbuf, sizeof(paramsbuf), NGTCP2_TRANSPORT_PARAMS_TYPE_CLIENT_HELLO,
- &params);
- if(nwrite < 0) {
- H3BUGF(fprintf(stderr, "ngtcp2_encode_transport_params: %s\n",
- ngtcp2_strerror((int)nwrite)));
- return -1;
- }
-
- rc = gnutls_buffer_append_data(extdata, paramsbuf, nwrite);
- if(rc < 0)
- return rc;
-
- return (int)nwrite;
-}
-
-static int quic_init_ssl(struct quicsocket *qs)
-{
- gnutls_datum_t alpn = {NULL, 0};
- /* this will need some attention when HTTPS proxy over QUIC get fixed */
- const char * const hostname = qs->conn->host.name;
- int rc;
-
- DEBUGASSERT(!qs->ssl);
-
- gnutls_init(&qs->ssl, GNUTLS_CLIENT);
- gnutls_session_set_ptr(qs->ssl, qs);
-
- rc = gnutls_priority_set_direct(qs->ssl, QUIC_PRIORITY, NULL);
- if(rc < 0) {
- H3BUGF(fprintf(stderr, "gnutls_priority_set_direct failed: %s\n",
- gnutls_strerror(rc)));
- return 1;
- }
-
- gnutls_handshake_set_secret_function(qs->ssl, secret_func);
- gnutls_handshake_set_read_function(qs->ssl, read_func);
- gnutls_alert_set_read_function(qs->ssl, alert_read_func);
-
- rc = gnutls_session_ext_register(qs->ssl, "QUIC Transport Parameters",
- 0xffa5, GNUTLS_EXT_TLS,
- tp_recv_func, tp_send_func,
- NULL, NULL, NULL,
- GNUTLS_EXT_FLAG_TLS |
- GNUTLS_EXT_FLAG_CLIENT_HELLO |
- GNUTLS_EXT_FLAG_EE);
- if(rc < 0) {
- H3BUGF(fprintf(stderr, "gnutls_session_ext_register failed: %s\n",
- gnutls_strerror(rc)));
- return 1;
- }
-
- /* Open the file if a TLS or QUIC backend has not done this before. */
- Curl_tls_keylog_open();
- if(Curl_tls_keylog_enabled()) {
- gnutls_session_set_keylog_function(qs->ssl, keylog_callback);
- }
-
- if(qs->cred)
- gnutls_certificate_free_credentials(qs->cred);
-
- rc = gnutls_certificate_allocate_credentials(&qs->cred);
- if(rc < 0) {
- H3BUGF(fprintf(stderr,
- "gnutls_certificate_allocate_credentials failed: %s\n",
- gnutls_strerror(rc)));
- return 1;
- }
-
- rc = gnutls_certificate_set_x509_system_trust(qs->cred);
- if(rc < 0) {
- H3BUGF(fprintf(stderr,
- "gnutls_certificate_set_x509_system_trust failed: %s\n",
- gnutls_strerror(rc)));
- return 1;
- }
-
- rc = gnutls_credentials_set(qs->ssl, GNUTLS_CRD_CERTIFICATE, qs->cred);
- if(rc < 0) {
- H3BUGF(fprintf(stderr, "gnutls_credentials_set failed: %s\n",
- gnutls_strerror(rc)));
- return 1;
- }
-
- /* strip the first byte (the length) from NGHTTP3_ALPN_H3 */
- alpn.data = (unsigned char *)NGHTTP3_ALPN_H3 + 1;
- alpn.size = sizeof(NGHTTP3_ALPN_H3) - 2;
- if(alpn.data)
- gnutls_alpn_set_protocols(qs->ssl, &alpn, 1, 0);
-
- /* set SNI */
- gnutls_server_name_set(qs->ssl, GNUTLS_NAME_DNS, hostname, strlen(hostname));
- return 0;
-}
-#endif
-
+static int read_func(gnutls_session_t ssl,
+ gnutls_record_encryption_level_t gtls_level,
+ gnutls_handshake_description_t htype, const void *data,
+ size_t len)
+{
+ struct quicsocket *qs = gnutls_session_get_ptr(ssl);
+ ngtcp2_crypto_level level = quic_from_gtls_level(gtls_level);
+ int rv;
+
+ if(htype == GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC)
+ return 0;
+
+ rv = write_client_handshake(qs, level, data, len);
+ if(rv == 0)
+ return -1;
+
+ return 0;
+}
+
+static int alert_read_func(gnutls_session_t ssl,
+ gnutls_record_encryption_level_t gtls_level,
+ gnutls_alert_level_t alert_level,
+ gnutls_alert_description_t alert_desc)
+{
+ struct quicsocket *qs = gnutls_session_get_ptr(ssl);
+ (void)gtls_level;
+ (void)alert_level;
+
+ qs->tls_alert = alert_desc;
+ return 1;
+}
+
+static int tp_recv_func(gnutls_session_t ssl, const uint8_t *data,
+ size_t data_size)
+{
+ struct quicsocket *qs = gnutls_session_get_ptr(ssl);
+ ngtcp2_transport_params params;
+
+ if(ngtcp2_decode_transport_params(
+ &params, NGTCP2_TRANSPORT_PARAMS_TYPE_ENCRYPTED_EXTENSIONS,
+ data, data_size) != 0)
+ return -1;
+
+ if(ngtcp2_conn_set_remote_transport_params(qs->qconn, &params) != 0)
+ return -1;
+
+ return 0;
+}
+
+static int tp_send_func(gnutls_session_t ssl, gnutls_buffer_t extdata)
+{
+ struct quicsocket *qs = gnutls_session_get_ptr(ssl);
+ uint8_t paramsbuf[64];
+ ngtcp2_transport_params params;
+ ssize_t nwrite;
+ int rc;
+
+ ngtcp2_conn_get_local_transport_params(qs->qconn, &params);
+ nwrite = ngtcp2_encode_transport_params(
+ paramsbuf, sizeof(paramsbuf), NGTCP2_TRANSPORT_PARAMS_TYPE_CLIENT_HELLO,
+ &params);
+ if(nwrite < 0) {
+ H3BUGF(fprintf(stderr, "ngtcp2_encode_transport_params: %s\n",
+ ngtcp2_strerror((int)nwrite)));
+ return -1;
+ }
+
+ rc = gnutls_buffer_append_data(extdata, paramsbuf, nwrite);
+ if(rc < 0)
+ return rc;
+
+ return (int)nwrite;
+}
+
+static int quic_init_ssl(struct quicsocket *qs)
+{
+ gnutls_datum_t alpn = {NULL, 0};
+ /* this will need some attention when HTTPS proxy over QUIC get fixed */
+ const char * const hostname = qs->conn->host.name;
+ int rc;
+
+ DEBUGASSERT(!qs->ssl);
+
+ gnutls_init(&qs->ssl, GNUTLS_CLIENT);
+ gnutls_session_set_ptr(qs->ssl, qs);
+
+ rc = gnutls_priority_set_direct(qs->ssl, QUIC_PRIORITY, NULL);
+ if(rc < 0) {
+ H3BUGF(fprintf(stderr, "gnutls_priority_set_direct failed: %s\n",
+ gnutls_strerror(rc)));
+ return 1;
+ }
+
+ gnutls_handshake_set_secret_function(qs->ssl, secret_func);
+ gnutls_handshake_set_read_function(qs->ssl, read_func);
+ gnutls_alert_set_read_function(qs->ssl, alert_read_func);
+
+ rc = gnutls_session_ext_register(qs->ssl, "QUIC Transport Parameters",
+ 0xffa5, GNUTLS_EXT_TLS,
+ tp_recv_func, tp_send_func,
+ NULL, NULL, NULL,
+ GNUTLS_EXT_FLAG_TLS |
+ GNUTLS_EXT_FLAG_CLIENT_HELLO |
+ GNUTLS_EXT_FLAG_EE);
+ if(rc < 0) {
+ H3BUGF(fprintf(stderr, "gnutls_session_ext_register failed: %s\n",
+ gnutls_strerror(rc)));
+ return 1;
+ }
+
+ /* Open the file if a TLS or QUIC backend has not done this before. */
+ Curl_tls_keylog_open();
+ if(Curl_tls_keylog_enabled()) {
+ gnutls_session_set_keylog_function(qs->ssl, keylog_callback);
+ }
+
+ if(qs->cred)
+ gnutls_certificate_free_credentials(qs->cred);
+
+ rc = gnutls_certificate_allocate_credentials(&qs->cred);
+ if(rc < 0) {
+ H3BUGF(fprintf(stderr,
+ "gnutls_certificate_allocate_credentials failed: %s\n",
+ gnutls_strerror(rc)));
+ return 1;
+ }
+
+ rc = gnutls_certificate_set_x509_system_trust(qs->cred);
+ if(rc < 0) {
+ H3BUGF(fprintf(stderr,
+ "gnutls_certificate_set_x509_system_trust failed: %s\n",
+ gnutls_strerror(rc)));
+ return 1;
+ }
+
+ rc = gnutls_credentials_set(qs->ssl, GNUTLS_CRD_CERTIFICATE, qs->cred);
+ if(rc < 0) {
+ H3BUGF(fprintf(stderr, "gnutls_credentials_set failed: %s\n",
+ gnutls_strerror(rc)));
+ return 1;
+ }
+
+ /* strip the first byte (the length) from NGHTTP3_ALPN_H3 */
+ alpn.data = (unsigned char *)NGHTTP3_ALPN_H3 + 1;
+ alpn.size = sizeof(NGHTTP3_ALPN_H3) - 2;
+ if(alpn.data)
+ gnutls_alpn_set_protocols(qs->ssl, &alpn, 1, 0);
+
+ /* set SNI */
+ gnutls_server_name_set(qs->ssl, GNUTLS_NAME_DNS, hostname, strlen(hostname));
+ return 0;
+}
+#endif
+
static int
cb_recv_crypto_data(ngtcp2_conn *tconn, ngtcp2_crypto_level crypto_level,
uint64_t offset,
@@ -545,9 +545,9 @@ cb_recv_crypto_data(ngtcp2_conn *tconn, ngtcp2_crypto_level crypto_level,
void *user_data)
{
(void)offset;
- (void)user_data;
+ (void)user_data;
- if(ngtcp2_crypto_read_write_crypto_data(tconn, crypto_level, data,
+ if(ngtcp2_crypto_read_write_crypto_data(tconn, crypto_level, data,
datalen) != 0)
return NGTCP2_ERR_CRYPTO;
@@ -563,24 +563,24 @@ static int cb_handshake_completed(ngtcp2_conn *tconn, void *user_data)
return 0;
}
-static void extend_stream_window(ngtcp2_conn *tconn,
- struct HTTP *stream)
-{
- size_t thismuch = stream->unacked_window;
- ngtcp2_conn_extend_max_stream_offset(tconn, stream->stream3_id, thismuch);
- ngtcp2_conn_extend_max_offset(tconn, thismuch);
- stream->unacked_window = 0;
-}
-
-
-static int cb_recv_stream_data(ngtcp2_conn *tconn, uint32_t flags,
- int64_t stream_id, uint64_t offset,
+static void extend_stream_window(ngtcp2_conn *tconn,
+ struct HTTP *stream)
+{
+ size_t thismuch = stream->unacked_window;
+ ngtcp2_conn_extend_max_stream_offset(tconn, stream->stream3_id, thismuch);
+ ngtcp2_conn_extend_max_offset(tconn, thismuch);
+ stream->unacked_window = 0;
+}
+
+
+static int cb_recv_stream_data(ngtcp2_conn *tconn, uint32_t flags,
+ int64_t stream_id, uint64_t offset,
const uint8_t *buf, size_t buflen,
void *user_data, void *stream_user_data)
{
struct quicsocket *qs = (struct quicsocket *)user_data;
ssize_t nconsumed;
- int fin = flags & NGTCP2_STREAM_DATA_FLAG_FIN ? 1 : 0;
+ int fin = flags & NGTCP2_STREAM_DATA_FLAG_FIN ? 1 : 0;
(void)offset;
(void)stream_user_data;
@@ -592,9 +592,9 @@ static int cb_recv_stream_data(ngtcp2_conn *tconn, uint32_t flags,
return NGTCP2_ERR_CALLBACK_FAILURE;
}
- /* number of bytes inside buflen which consists of framing overhead
- * including QPACK HEADERS. In other words, it does not consume payload of
- * DATA frame. */
+ /* number of bytes inside buflen which consists of framing overhead
+ * including QPACK HEADERS. In other words, it does not consume payload of
+ * DATA frame. */
ngtcp2_conn_extend_max_stream_offset(tconn, stream_id, nconsumed);
ngtcp2_conn_extend_max_offset(tconn, nconsumed);
@@ -718,7 +718,7 @@ static int cb_get_new_connection_id(ngtcp2_conn *tconn, ngtcp2_cid *cid,
}
static ngtcp2_conn_callbacks ng_callbacks = {
- ngtcp2_crypto_client_initial_cb,
+ ngtcp2_crypto_client_initial_cb,
NULL, /* recv_client_initial */
cb_recv_crypto_data,
cb_handshake_completed,
@@ -732,24 +732,24 @@ static ngtcp2_conn_callbacks ng_callbacks = {
NULL, /* stream_open */
cb_stream_close,
NULL, /* recv_stateless_reset */
- ngtcp2_crypto_recv_retry_cb,
+ ngtcp2_crypto_recv_retry_cb,
cb_extend_max_local_streams_bidi,
NULL, /* extend_max_local_streams_uni */
NULL, /* rand */
cb_get_new_connection_id,
NULL, /* remove_connection_id */
- ngtcp2_crypto_update_key_cb, /* update_key */
+ ngtcp2_crypto_update_key_cb, /* update_key */
NULL, /* path_validation */
NULL, /* select_preferred_addr */
cb_stream_reset,
NULL, /* extend_max_remote_streams_bidi */
NULL, /* extend_max_remote_streams_uni */
cb_extend_max_stream_data,
- NULL, /* dcid_status */
- NULL, /* handshake_confirmed */
- NULL, /* recv_new_token */
- ngtcp2_crypto_delete_crypto_aead_ctx_cb,
- ngtcp2_crypto_delete_crypto_cipher_ctx_cb
+ NULL, /* dcid_status */
+ NULL, /* handshake_confirmed */
+ NULL, /* recv_new_token */
+ ngtcp2_crypto_delete_crypto_aead_ctx_cb,
+ ngtcp2_crypto_delete_crypto_cipher_ctx_cb
};
/*
@@ -769,32 +769,32 @@ CURLcode Curl_quic_connect(struct connectdata *conn,
struct quicsocket *qs = &conn->hequic[sockindex];
char ipbuf[40];
long port;
- int qfd;
+ int qfd;
- if(qs->conn)
- Curl_quic_disconnect(conn, sockindex);
+ if(qs->conn)
+ Curl_quic_disconnect(conn, sockindex);
qs->conn = conn;
/* extract the used address as a string */
if(!Curl_addr2string((struct sockaddr*)addr, addrlen, ipbuf, &port)) {
char buffer[STRERROR_LEN];
failf(data, "ssrem inet_ntop() failed with errno %d: %s",
- SOCKERRNO, Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
+ SOCKERRNO, Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
return CURLE_BAD_FUNCTION_ARGUMENT;
}
infof(data, "Connect socket %d over QUIC to %s:%ld\n",
sockfd, ipbuf, port);
- qs->version = NGTCP2_PROTO_VER_MAX;
-#ifdef USE_OPENSSL
+ qs->version = NGTCP2_PROTO_VER_MAX;
+#ifdef USE_OPENSSL
qs->sslctx = quic_ssl_ctx(data);
if(!qs->sslctx)
- return CURLE_QUIC_CONNECT_ERROR;
-#endif
+ return CURLE_QUIC_CONNECT_ERROR;
+#endif
if(quic_init_ssl(qs))
- return CURLE_QUIC_CONNECT_ERROR;
+ return CURLE_QUIC_CONNECT_ERROR;
qs->dcid.datalen = NGTCP2_MAX_CIDLEN;
result = Curl_rand(data, qs->dcid.data, NGTCP2_MAX_CIDLEN);
@@ -806,27 +806,27 @@ CURLcode Curl_quic_connect(struct connectdata *conn,
if(result)
return result;
- (void)Curl_qlogdir(data, qs->scid.data, NGTCP2_MAX_CIDLEN, &qfd);
- qs->qlogfd = qfd; /* -1 if failure above */
- quic_settings(qs, data->set.buffer_size);
+ (void)Curl_qlogdir(data, qs->scid.data, NGTCP2_MAX_CIDLEN, &qfd);
+ qs->qlogfd = qfd; /* -1 if failure above */
+ quic_settings(qs, data->set.buffer_size);
qs->local_addrlen = sizeof(qs->local_addr);
rv = getsockname(sockfd, (struct sockaddr *)&qs->local_addr,
&qs->local_addrlen);
if(rv == -1)
- return CURLE_QUIC_CONNECT_ERROR;
+ return CURLE_QUIC_CONNECT_ERROR;
- ngtcp2_addr_init(&path.local, (struct sockaddr *)&qs->local_addr,
- qs->local_addrlen, NULL);
- ngtcp2_addr_init(&path.remote, addr, addrlen, NULL);
+ ngtcp2_addr_init(&path.local, (struct sockaddr *)&qs->local_addr,
+ qs->local_addrlen, NULL);
+ ngtcp2_addr_init(&path.remote, addr, addrlen, NULL);
- rc = ngtcp2_conn_client_new(&qs->qconn, &qs->dcid, &qs->scid, &path,
- NGTCP2_PROTO_VER_MIN, &ng_callbacks,
- &qs->settings, NULL, qs);
+ rc = ngtcp2_conn_client_new(&qs->qconn, &qs->dcid, &qs->scid, &path,
+ NGTCP2_PROTO_VER_MIN, &ng_callbacks,
+ &qs->settings, NULL, qs);
if(rc)
- return CURLE_QUIC_CONNECT_ERROR;
+ return CURLE_QUIC_CONNECT_ERROR;
- ngtcp2_conn_set_tls_native_handle(qs->qconn, qs->ssl);
+ ngtcp2_conn_set_tls_native_handle(qs->qconn, qs->ssl);
return CURLE_OK;
}
@@ -839,7 +839,7 @@ int Curl_quic_ver(char *p, size_t len)
{
ngtcp2_info *ng2 = ngtcp2_version(0);
nghttp3_info *ht3 = nghttp3_version(0);
- return msnprintf(p, len, "ngtcp2/%s nghttp3/%s",
+ return msnprintf(p, len, "ngtcp2/%s nghttp3/%s",
ng2->version_str, ht3->version_str);
}
@@ -867,49 +867,49 @@ static int ng_perform_getsock(const struct connectdata *conn,
return ng_getsock((struct connectdata *)conn, socks);
}
-static void qs_disconnect(struct quicsocket *qs)
-{
- int i;
- if(!qs->conn) /* already closed */
- return;
- qs->conn = NULL;
- if(qs->qlogfd != -1) {
- close(qs->qlogfd);
- qs->qlogfd = -1;
- }
- if(qs->ssl)
-#ifdef USE_OPENSSL
- SSL_free(qs->ssl);
-#elif defined(USE_GNUTLS)
- gnutls_deinit(qs->ssl);
-#endif
- qs->ssl = NULL;
-#ifdef USE_GNUTLS
- if(qs->cred)
- gnutls_certificate_free_credentials(qs->cred);
-#endif
- for(i = 0; i < 3; i++)
- Curl_safefree(qs->crypto_data[i].buf);
- nghttp3_conn_del(qs->h3conn);
- ngtcp2_conn_del(qs->qconn);
-#ifdef USE_OPENSSL
- SSL_CTX_free(qs->sslctx);
-#endif
-}
-
-void Curl_quic_disconnect(struct connectdata *conn,
- int tempindex)
-{
- if(conn->transport == TRNSPRT_QUIC)
- qs_disconnect(&conn->hequic[tempindex]);
-}
-
+static void qs_disconnect(struct quicsocket *qs)
+{
+ int i;
+ if(!qs->conn) /* already closed */
+ return;
+ qs->conn = NULL;
+ if(qs->qlogfd != -1) {
+ close(qs->qlogfd);
+ qs->qlogfd = -1;
+ }
+ if(qs->ssl)
+#ifdef USE_OPENSSL
+ SSL_free(qs->ssl);
+#elif defined(USE_GNUTLS)
+ gnutls_deinit(qs->ssl);
+#endif
+ qs->ssl = NULL;
+#ifdef USE_GNUTLS
+ if(qs->cred)
+ gnutls_certificate_free_credentials(qs->cred);
+#endif
+ for(i = 0; i < 3; i++)
+ Curl_safefree(qs->crypto_data[i].buf);
+ nghttp3_conn_del(qs->h3conn);
+ ngtcp2_conn_del(qs->qconn);
+#ifdef USE_OPENSSL
+ SSL_CTX_free(qs->sslctx);
+#endif
+}
+
+void Curl_quic_disconnect(struct connectdata *conn,
+ int tempindex)
+{
+ if(conn->transport == TRNSPRT_QUIC)
+ qs_disconnect(&conn->hequic[tempindex]);
+}
+
static CURLcode ng_disconnect(struct connectdata *conn,
bool dead_connection)
{
(void)dead_connection;
- Curl_quic_disconnect(conn, 0);
- Curl_quic_disconnect(conn, 1);
+ Curl_quic_disconnect(conn, 0);
+ Curl_quic_disconnect(conn, 1);
return CURLE_OK;
}
@@ -939,7 +939,7 @@ static const struct Curl_handler Curl_handler_http3 = {
ng_conncheck, /* connection_check */
PORT_HTTP, /* defport */
CURLPROTO_HTTPS, /* protocol */
- CURLPROTO_HTTP, /* family */
+ CURLPROTO_HTTP, /* family */
PROTOPT_SSL | PROTOPT_STREAM /* flags */
};
@@ -948,63 +948,63 @@ static int cb_h3_stream_close(nghttp3_conn *conn, int64_t stream_id,
void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.p.http;
+ struct HTTP *stream = data->req.p.http;
(void)conn;
(void)stream_id;
(void)app_error_code;
(void)user_data;
- H3BUGF(infof(data, "cb_h3_stream_close CALLED\n"));
+ H3BUGF(infof(data, "cb_h3_stream_close CALLED\n"));
stream->closed = TRUE;
Curl_expire(data, 0, EXPIRE_QUIC);
- /* make sure that ngh3_stream_recv is called again to complete the transfer
- even if there are no more packets to be received from the server. */
- data->state.drain = 1;
+ /* make sure that ngh3_stream_recv is called again to complete the transfer
+ even if there are no more packets to be received from the server. */
+ data->state.drain = 1;
return 0;
}
-/*
- * write_data() copies data to the stream's receive buffer. If not enough
- * space is available in the receive buffer, it copies the rest to the
- * stream's overflow buffer.
- */
-static CURLcode write_data(struct HTTP *stream, const void *mem, size_t memlen)
-{
- CURLcode result = CURLE_OK;
- const char *buf = mem;
- size_t ncopy = memlen;
- /* copy as much as possible to the receive buffer */
- if(stream->len) {
- size_t len = CURLMIN(ncopy, stream->len);
- memcpy(stream->mem, buf, len);
- stream->len -= len;
- stream->memlen += len;
- stream->mem += len;
- buf += len;
- ncopy -= len;
- }
- /* copy the rest to the overflow buffer */
- if(ncopy)
- result = Curl_dyn_addn(&stream->overflow, buf, ncopy);
- return result;
-}
-
+/*
+ * write_data() copies data to the stream's receive buffer. If not enough
+ * space is available in the receive buffer, it copies the rest to the
+ * stream's overflow buffer.
+ */
+static CURLcode write_data(struct HTTP *stream, const void *mem, size_t memlen)
+{
+ CURLcode result = CURLE_OK;
+ const char *buf = mem;
+ size_t ncopy = memlen;
+ /* copy as much as possible to the receive buffer */
+ if(stream->len) {
+ size_t len = CURLMIN(ncopy, stream->len);
+ memcpy(stream->mem, buf, len);
+ stream->len -= len;
+ stream->memlen += len;
+ stream->mem += len;
+ buf += len;
+ ncopy -= len;
+ }
+ /* copy the rest to the overflow buffer */
+ if(ncopy)
+ result = Curl_dyn_addn(&stream->overflow, buf, ncopy);
+ return result;
+}
+
static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream_id,
const uint8_t *buf, size_t buflen,
void *user_data, void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.p.http;
- CURLcode result = CURLE_OK;
+ struct HTTP *stream = data->req.p.http;
+ CURLcode result = CURLE_OK;
(void)conn;
- result = write_data(stream, buf, buflen);
- if(result) {
- return -1;
+ result = write_data(stream, buf, buflen);
+ if(result) {
+ return -1;
}
- stream->unacked_window += buflen;
- (void)stream_id;
- (void)user_data;
+ stream->unacked_window += buflen;
+ (void)stream_id;
+ (void)user_data;
return 0;
}
@@ -1015,7 +1015,7 @@ static int cb_h3_deferred_consume(nghttp3_conn *conn, int64_t stream_id,
struct quicsocket *qs = user_data;
(void)conn;
(void)stream_user_data;
- (void)stream_id;
+ (void)stream_id;
ngtcp2_conn_extend_max_stream_offset(qs->qconn, stream_id, consumed);
ngtcp2_conn_extend_max_offset(qs->qconn, consumed);
@@ -1053,18 +1053,18 @@ static int cb_h3_end_headers(nghttp3_conn *conn, int64_t stream_id,
void *user_data, void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.p.http;
- CURLcode result = CURLE_OK;
+ struct HTTP *stream = data->req.p.http;
+ CURLcode result = CURLE_OK;
(void)conn;
(void)stream_id;
(void)user_data;
- /* add a CRLF only if we've received some headers */
- if(stream->firstheader) {
- result = write_data(stream, "\r\n", 2);
- if(result) {
- return -1;
- }
+ /* add a CRLF only if we've received some headers */
+ if(stream->firstheader) {
+ result = write_data(stream, "\r\n", 2);
+ if(result) {
+ return -1;
+ }
}
return 0;
}
@@ -1077,8 +1077,8 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
nghttp3_vec h3name = nghttp3_rcbuf_get_buf(name);
nghttp3_vec h3val = nghttp3_rcbuf_get_buf(value);
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.p.http;
- CURLcode result = CURLE_OK;
+ struct HTTP *stream = data->req.p.http;
+ CURLcode result = CURLE_OK;
(void)conn;
(void)stream_id;
(void)token;
@@ -1087,37 +1087,37 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
if(h3name.len == sizeof(":status") - 1 &&
!memcmp(":status", h3name.base, h3name.len)) {
- char line[14]; /* status line is always 13 characters long */
- size_t ncopy;
+ char line[14]; /* status line is always 13 characters long */
+ size_t ncopy;
int status = decode_status_code(h3val.base, h3val.len);
DEBUGASSERT(status != -1);
- ncopy = msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n", status);
- result = write_data(stream, line, ncopy);
- if(result) {
- return -1;
- }
+ ncopy = msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n", status);
+ result = write_data(stream, line, ncopy);
+ if(result) {
+ return -1;
+ }
}
else {
/* store as a HTTP1-style header */
- result = write_data(stream, h3name.base, h3name.len);
- if(result) {
- return -1;
- }
- result = write_data(stream, ": ", 2);
- if(result) {
- return -1;
- }
- result = write_data(stream, h3val.base, h3val.len);
- if(result) {
- return -1;
- }
- result = write_data(stream, "\r\n", 2);
- if(result) {
- return -1;
- }
- }
-
- stream->firstheader = TRUE;
+ result = write_data(stream, h3name.base, h3name.len);
+ if(result) {
+ return -1;
+ }
+ result = write_data(stream, ": ", 2);
+ if(result) {
+ return -1;
+ }
+ result = write_data(stream, h3val.base, h3val.len);
+ if(result) {
+ return -1;
+ }
+ result = write_data(stream, "\r\n", 2);
+ if(result) {
+ return -1;
+ }
+ }
+
+ stream->firstheader = TRUE;
return 0;
}
@@ -1152,7 +1152,7 @@ static nghttp3_conn_callbacks ngh3_callbacks = {
cb_h3_send_stop_sending,
NULL, /* push_stream */
NULL, /* end_stream */
- NULL, /* reset_stream */
+ NULL, /* reset_stream */
};
static int init_ngh3_conn(struct quicsocket *qs)
@@ -1163,7 +1163,7 @@ static int init_ngh3_conn(struct quicsocket *qs)
if(ngtcp2_conn_get_max_local_streams_uni(qs->qconn) < 3) {
failf(qs->conn->data, "too few available QUIC streams");
- return CURLE_QUIC_CONNECT_ERROR;
+ return CURLE_QUIC_CONNECT_ERROR;
}
nghttp3_conn_settings_default(&qs->h3settings);
@@ -1180,32 +1180,32 @@ static int init_ngh3_conn(struct quicsocket *qs)
rc = ngtcp2_conn_open_uni_stream(qs->qconn, &ctrl_stream_id, NULL);
if(rc) {
- result = CURLE_QUIC_CONNECT_ERROR;
+ result = CURLE_QUIC_CONNECT_ERROR;
goto fail;
}
rc = nghttp3_conn_bind_control_stream(qs->h3conn, ctrl_stream_id);
if(rc) {
- result = CURLE_QUIC_CONNECT_ERROR;
+ result = CURLE_QUIC_CONNECT_ERROR;
goto fail;
}
rc = ngtcp2_conn_open_uni_stream(qs->qconn, &qpack_enc_stream_id, NULL);
if(rc) {
- result = CURLE_QUIC_CONNECT_ERROR;
+ result = CURLE_QUIC_CONNECT_ERROR;
goto fail;
}
rc = ngtcp2_conn_open_uni_stream(qs->qconn, &qpack_dec_stream_id, NULL);
if(rc) {
- result = CURLE_QUIC_CONNECT_ERROR;
+ result = CURLE_QUIC_CONNECT_ERROR;
goto fail;
}
rc = nghttp3_conn_bind_qpack_streams(qs->h3conn, qpack_enc_stream_id,
qpack_dec_stream_id);
if(rc) {
- result = CURLE_QUIC_CONNECT_ERROR;
+ result = CURLE_QUIC_CONNECT_ERROR;
goto fail;
}
@@ -1218,22 +1218,22 @@ static int init_ngh3_conn(struct quicsocket *qs)
static Curl_recv ngh3_stream_recv;
static Curl_send ngh3_stream_send;
-static size_t drain_overflow_buffer(struct HTTP *stream)
-{
- size_t overlen = Curl_dyn_len(&stream->overflow);
- size_t ncopy = CURLMIN(overlen, stream->len);
- if(ncopy > 0) {
- memcpy(stream->mem, Curl_dyn_ptr(&stream->overflow), ncopy);
- stream->len -= ncopy;
- stream->mem += ncopy;
- stream->memlen += ncopy;
- if(ncopy != overlen)
- /* make the buffer only keep the tail */
- (void)Curl_dyn_tail(&stream->overflow, overlen - ncopy);
- }
- return ncopy;
-}
-
+static size_t drain_overflow_buffer(struct HTTP *stream)
+{
+ size_t overlen = Curl_dyn_len(&stream->overflow);
+ size_t ncopy = CURLMIN(overlen, stream->len);
+ if(ncopy > 0) {
+ memcpy(stream->mem, Curl_dyn_ptr(&stream->overflow), ncopy);
+ stream->len -= ncopy;
+ stream->mem += ncopy;
+ stream->memlen += ncopy;
+ if(ncopy != overlen)
+ /* make the buffer only keep the tail */
+ (void)Curl_dyn_tail(&stream->overflow, overlen - ncopy);
+ }
+ return ncopy;
+}
+
/* incoming data frames on the h3 stream */
static ssize_t ngh3_stream_recv(struct connectdata *conn,
int sockindex,
@@ -1242,7 +1242,7 @@ static ssize_t ngh3_stream_recv(struct connectdata *conn,
CURLcode *curlcode)
{
curl_socket_t sockfd = conn->sock[sockindex];
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
struct quicsocket *qs = conn->quic;
if(!stream->memlen) {
@@ -1253,10 +1253,10 @@ static ssize_t ngh3_stream_recv(struct connectdata *conn,
}
/* else, there's data in the buffer already */
- /* if there's data in the overflow buffer from a previous call, copy as much
- as possible to the receive buffer before receiving more */
- drain_overflow_buffer(stream);
-
+ /* if there's data in the overflow buffer from a previous call, copy as much
+ as possible to the receive buffer before receiving more */
+ drain_overflow_buffer(stream);
+
if(ng_process_ingress(conn, sockfd, qs)) {
*curlcode = CURLE_RECV_ERROR;
return -1;
@@ -1274,13 +1274,13 @@ static ssize_t ngh3_stream_recv(struct connectdata *conn,
stream->memlen = 0;
stream->mem = buf;
stream->len = buffersize;
- /* extend the stream window with the data we're consuming and send out
- any additional packets to tell the server that we can receive more */
- extend_stream_window(qs->qconn, stream);
- if(ng_flush_egress(conn, sockfd, qs)) {
- *curlcode = CURLE_SEND_ERROR;
- return -1;
- }
+ /* extend the stream window with the data we're consuming and send out
+ any additional packets to tell the server that we can receive more */
+ extend_stream_window(qs->qconn, stream);
+ if(ng_flush_egress(conn, sockfd, qs)) {
+ *curlcode = CURLE_SEND_ERROR;
+ return -1;
+ }
return memlen;
}
@@ -1300,39 +1300,39 @@ static int cb_h3_acked_stream_data(nghttp3_conn *conn, int64_t stream_id,
void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.p.http;
+ struct HTTP *stream = data->req.p.http;
(void)conn;
(void)stream_id;
(void)user_data;
if(!data->set.postfields) {
stream->h3out->used -= datalen;
- H3BUGF(infof(data,
- "cb_h3_acked_stream_data, %zd bytes, %zd left unacked\n",
- datalen, stream->h3out->used));
+ H3BUGF(infof(data,
+ "cb_h3_acked_stream_data, %zd bytes, %zd left unacked\n",
+ datalen, stream->h3out->used));
DEBUGASSERT(stream->h3out->used < H3_SEND_SIZE);
}
return 0;
}
-static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
- nghttp3_vec *vec, size_t veccnt,
- uint32_t *pflags, void *user_data,
- void *stream_user_data)
+static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
+ nghttp3_vec *vec, size_t veccnt,
+ uint32_t *pflags, void *user_data,
+ void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
size_t nread;
- struct HTTP *stream = data->req.p.http;
+ struct HTTP *stream = data->req.p.http;
(void)conn;
(void)stream_id;
(void)user_data;
- (void)veccnt;
+ (void)veccnt;
if(data->set.postfields) {
- vec[0].base = data->set.postfields;
- vec[0].len = data->state.infilesize;
+ vec[0].base = data->set.postfields;
+ vec[0].len = data->state.infilesize;
*pflags = NGHTTP3_DATA_FLAG_EOF;
- return 1;
+ return 1;
}
nread = CURLMIN(stream->upload_len, H3_SEND_SIZE - stream->h3out->used);
@@ -1350,8 +1350,8 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
out->used += nread;
/* that's the chunk we return to nghttp3 */
- vec[0].base = &out->buf[out->windex];
- vec[0].len = nread;
+ vec[0].base = &out->buf[out->windex];
+ vec[0].len = nread;
if(out->windex == H3_SEND_SIZE)
out->windex = 0; /* wrap */
@@ -1362,20 +1362,20 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
if(!stream->upload_left)
*pflags = NGHTTP3_DATA_FLAG_EOF;
}
- H3BUGF(infof(data, "cb_h3_readfunction %zd bytes%s (at %zd unacked)\n",
- nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
- out->used));
+ H3BUGF(infof(data, "cb_h3_readfunction %zd bytes%s (at %zd unacked)\n",
+ nread, *pflags == NGHTTP3_DATA_FLAG_EOF?" EOF":"",
+ out->used));
}
if(stream->upload_done && !stream->upload_len &&
(stream->upload_left <= 0)) {
H3BUGF(infof(data, "!!!!!!!!! cb_h3_readfunction sets EOF\n"));
*pflags = NGHTTP3_DATA_FLAG_EOF;
- return 0;
+ return 0;
}
else if(!nread) {
return NGHTTP3_ERR_WOULDBLOCK;
}
- return 1;
+ return 1;
}
/* Index where :authority header field will appear in request header
@@ -1385,7 +1385,7 @@ static ssize_t cb_h3_readfunction(nghttp3_conn *conn, int64_t stream_id,
static CURLcode http_request(struct connectdata *conn, const void *mem,
size_t len)
{
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
size_t nheader;
size_t i;
size_t authority_idx;
@@ -1408,7 +1408,7 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
stream->stream3_id = stream3_id;
stream->h3req = TRUE; /* senf off! */
- Curl_dyn_init(&stream->overflow, CURL_MAX_READ_SIZE);
+ Curl_dyn_init(&stream->overflow, CURL_MAX_READ_SIZE);
/* Calculate number of headers contained in [mem, mem + len). Assumes a
correctly generated HTTP header field block. */
@@ -1507,9 +1507,9 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
nva[i].namelen = strlen((char *)nva[i].name);
}
else {
- nva[i].namelen = (size_t)(end - hdbuf);
- /* Lower case the header name for HTTP/3 */
- Curl_strntolower((char *)hdbuf, hdbuf, nva[i].namelen);
+ nva[i].namelen = (size_t)(end - hdbuf);
+ /* Lower case the header name for HTTP/3 */
+ Curl_strntolower((char *)hdbuf, hdbuf, nva[i].namelen);
nva[i].name = (unsigned char *)hdbuf;
}
nva[i].flags = NGHTTP3_NV_FLAG_NONE;
@@ -1560,12 +1560,12 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
if(acc > MAX_ACC) {
infof(data, "http_request: Warning: The cumulative length of all "
- "headers exceeds %d bytes and that could cause the "
+ "headers exceeds %d bytes and that could cause the "
"stream to be rejected.\n", MAX_ACC);
}
}
- switch(data->state.httpreq) {
+ switch(data->state.httpreq) {
case HTTPREQ_POST:
case HTTPREQ_POST_FORM:
case HTTPREQ_POST_MIME:
@@ -1628,7 +1628,7 @@ static ssize_t ngh3_stream_send(struct connectdata *conn,
ssize_t sent;
struct quicsocket *qs = conn->quic;
curl_socket_t sockfd = conn->sock[sockindex];
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
if(!stream->h3req) {
CURLcode result = http_request(conn, mem, len);
@@ -1639,8 +1639,8 @@ static ssize_t ngh3_stream_send(struct connectdata *conn,
sent = len;
}
else {
- H3BUGF(infof(conn->data, "ngh3_stream_send() wants to send %zd bytes\n",
- len));
+ H3BUGF(infof(conn->data, "ngh3_stream_send() wants to send %zd bytes\n",
+ len));
if(!stream->upload_len) {
stream->upload_mem = mem;
stream->upload_len = len;
@@ -1687,11 +1687,11 @@ CURLcode Curl_quic_is_connected(struct connectdata *conn,
result = ng_process_ingress(conn, sockfd, qs);
if(result)
- goto error;
+ goto error;
result = ng_flush_egress(conn, sockfd, qs);
if(result)
- goto error;
+ goto error;
if(ngtcp2_conn_get_handshake_completed(qs->qconn)) {
*done = TRUE;
@@ -1699,14 +1699,14 @@ CURLcode Curl_quic_is_connected(struct connectdata *conn,
}
return result;
- error:
- (void)qs_disconnect(qs);
- return result;
-
+ error:
+ (void)qs_disconnect(qs);
+ return result;
+
}
-static CURLcode ng_process_ingress(struct connectdata *conn,
- curl_socket_t sockfd,
+static CURLcode ng_process_ingress(struct connectdata *conn,
+ curl_socket_t sockfd,
struct quicsocket *qs)
{
ssize_t recvd;
@@ -1717,29 +1717,29 @@ static CURLcode ng_process_ingress(struct connectdata *conn,
socklen_t remote_addrlen;
ngtcp2_path path;
ngtcp2_tstamp ts = timestamp();
- ngtcp2_pkt_info pi = { 0 };
+ ngtcp2_pkt_info pi = { 0 };
for(;;) {
remote_addrlen = sizeof(remote_addr);
- while((recvd = recvfrom(sockfd, (char *)buf, bufsize, 0,
+ while((recvd = recvfrom(sockfd, (char *)buf, bufsize, 0,
(struct sockaddr *)&remote_addr,
&remote_addrlen)) == -1 &&
- SOCKERRNO == EINTR)
+ SOCKERRNO == EINTR)
;
if(recvd == -1) {
- if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK)
+ if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK)
break;
- failf(conn->data, "ngtcp2: recvfrom() unexpectedly returned %zd", recvd);
+ failf(conn->data, "ngtcp2: recvfrom() unexpectedly returned %zd", recvd);
return CURLE_RECV_ERROR;
}
- ngtcp2_addr_init(&path.local, (struct sockaddr *)&qs->local_addr,
+ ngtcp2_addr_init(&path.local, (struct sockaddr *)&qs->local_addr,
qs->local_addrlen, NULL);
- ngtcp2_addr_init(&path.remote, (struct sockaddr *)&remote_addr,
- remote_addrlen, NULL);
+ ngtcp2_addr_init(&path.remote, (struct sockaddr *)&remote_addr,
+ remote_addrlen, NULL);
- rv = ngtcp2_conn_read_pkt(qs->qconn, &path, &pi, buf, recvd, ts);
+ rv = ngtcp2_conn_read_pkt(qs->qconn, &path, &pi, buf, recvd, ts);
if(rv != 0) {
/* TODO Send CONNECTION_CLOSE if possible */
return CURLE_RECV_ERROR;
@@ -1772,11 +1772,11 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
case AF_INET:
pktlen = NGTCP2_MAX_PKTLEN_IPV4;
break;
-#ifdef ENABLE_IPV6
+#ifdef ENABLE_IPV6
case AF_INET6:
pktlen = NGTCP2_MAX_PKTLEN_IPV6;
break;
-#endif
+#endif
default:
assert(0);
}
@@ -1801,12 +1801,12 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
return CURLE_SEND_ERROR;
}
else if(veccnt > 0) {
- uint32_t flags = NGTCP2_WRITE_STREAM_FLAG_MORE |
- (fin ? NGTCP2_WRITE_STREAM_FLAG_FIN : 0);
+ uint32_t flags = NGTCP2_WRITE_STREAM_FLAG_MORE |
+ (fin ? NGTCP2_WRITE_STREAM_FLAG_FIN : 0);
outlen =
- ngtcp2_conn_writev_stream(qs->qconn, &ps.path, NULL,
+ ngtcp2_conn_writev_stream(qs->qconn, &ps.path, NULL,
out, pktlen, &ndatalen,
- flags, stream_id,
+ flags, stream_id,
(const ngtcp2_vec *)vec, veccnt, ts);
if(outlen == 0) {
break;
@@ -1814,7 +1814,7 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
if(outlen < 0) {
if(outlen == NGTCP2_ERR_STREAM_DATA_BLOCKED ||
outlen == NGTCP2_ERR_STREAM_SHUT_WR) {
- assert(ndatalen == -1);
+ assert(ndatalen == -1);
rv = nghttp3_conn_block_stream(qs->h3conn, stream_id);
if(rv != 0) {
failf(conn->data,
@@ -1824,7 +1824,7 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
}
continue;
}
- else if(outlen == NGTCP2_ERR_WRITE_MORE) {
+ else if(outlen == NGTCP2_ERR_WRITE_MORE) {
assert(ndatalen > 0);
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id,
ndatalen);
@@ -1837,20 +1837,20 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
continue;
}
else {
- assert(ndatalen == -1);
+ assert(ndatalen == -1);
failf(conn->data, "ngtcp2_conn_writev_stream returned error: %s\n",
ngtcp2_strerror((int)outlen));
return CURLE_SEND_ERROR;
}
}
- else {
- assert(ndatalen == -1);
+ else {
+ assert(ndatalen == -1);
}
}
}
if(outlen < 0) {
- outlen = ngtcp2_conn_write_pkt(qs->qconn, &ps.path, NULL,
- out, pktlen, ts);
+ outlen = ngtcp2_conn_write_pkt(qs->qconn, &ps.path, NULL,
+ out, pktlen, ts);
if(outlen < 0) {
failf(conn->data, "ngtcp2_conn_write_pkt returned error: %s\n",
ngtcp2_strerror((int)outlen));
@@ -1861,17 +1861,17 @@ static CURLcode ng_flush_egress(struct connectdata *conn, int sockfd,
}
memcpy(&remote_addr, ps.path.remote.addr, ps.path.remote.addrlen);
- while((sent = send(sockfd, (const char *)out, outlen, 0)) == -1 &&
- SOCKERRNO == EINTR)
+ while((sent = send(sockfd, (const char *)out, outlen, 0)) == -1 &&
+ SOCKERRNO == EINTR)
;
if(sent == -1) {
- if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK) {
+ if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK) {
/* TODO Cache packet */
break;
}
else {
- failf(conn->data, "send() returned %zd (errno %d)\n", sent,
+ failf(conn->data, "send() returned %zd (errno %d)\n", sent,
SOCKERRNO);
return CURLE_SEND_ERROR;
}
@@ -1899,7 +1899,7 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
{
if(conn->handler == &Curl_handler_http3) {
/* only for HTTP/3 transfers */
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
struct quicsocket *qs = conn->quic;
stream->upload_done = TRUE;
(void)nghttp3_conn_resume_stream(qs->h3conn, stream->stream3_id);
@@ -1907,32 +1907,32 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
return CURLE_OK;
}
-
-/*
- * Called from http.c:Curl_http_done when a request completes.
- */
-void Curl_quic_done(struct Curl_easy *data, bool premature)
-{
- (void)premature;
- if(data->conn->handler == &Curl_handler_http3) {
- /* only for HTTP/3 transfers */
- struct HTTP *stream = data->req.p.http;
- Curl_dyn_free(&stream->overflow);
- }
-}
-
-/*
- * Called from transfer.c:data_pending to know if we should keep looping
- * to receive more data from the connection.
- */
-bool Curl_quic_data_pending(const struct Curl_easy *data)
-{
- /* We may have received more data than we're able to hold in the receive
- buffer and allocated an overflow buffer. Since it's possible that
- there's no more data coming on the socket, we need to keep reading
- until the overflow buffer is empty. */
- const struct HTTP *stream = data->req.p.http;
- return Curl_dyn_len(&stream->overflow) > 0;
-}
-
+
+/*
+ * Called from http.c:Curl_http_done when a request completes.
+ */
+void Curl_quic_done(struct Curl_easy *data, bool premature)
+{
+ (void)premature;
+ if(data->conn->handler == &Curl_handler_http3) {
+ /* only for HTTP/3 transfers */
+ struct HTTP *stream = data->req.p.http;
+ Curl_dyn_free(&stream->overflow);
+ }
+}
+
+/*
+ * Called from transfer.c:data_pending to know if we should keep looping
+ * to receive more data from the connection.
+ */
+bool Curl_quic_data_pending(const struct Curl_easy *data)
+{
+ /* We may have received more data than we're able to hold in the receive
+ buffer and allocated an overflow buffer. Since it's possible that
+ there's no more data coming on the socket, we need to keep reading
+ until the overflow buffer is empty. */
+ const struct HTTP *stream = data->req.p.http;
+ return Curl_dyn_len(&stream->overflow) > 0;
+}
+
#endif
diff --git a/contrib/libs/curl/lib/vquic/quiche.c b/contrib/libs/curl/lib/vquic/quiche.c
index 6b3eaf470e..c50cccd4b3 100644
--- a/contrib/libs/curl/lib/vquic/quiche.c
+++ b/contrib/libs/curl/lib/vquic/quiche.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -34,7 +34,7 @@
#include "multiif.h"
#include "connect.h"
#include "strerror.h"
-#error #include "vquic.h"
+#error #include "vquic.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -46,12 +46,12 @@
#ifdef DEBUG_HTTP3
#define H3BUGF(x) x
#else
-#define H3BUGF(x) do { } while(0)
+#define H3BUGF(x) do { } while(0)
#endif
#define QUIC_MAX_STREAMS (256*1024)
#define QUIC_MAX_DATA (1*1024*1024)
-#define QUIC_IDLE_TIMEOUT (60 * 1000) /* milliseconds */
+#define QUIC_IDLE_TIMEOUT (60 * 1000) /* milliseconds */
static CURLcode process_ingress(struct connectdata *conn,
curl_socket_t sockfd,
@@ -89,43 +89,43 @@ static int quiche_perform_getsock(const struct connectdata *conn,
return quiche_getsock((struct connectdata *)conn, socks);
}
-static CURLcode qs_disconnect(struct connectdata *conn,
- struct quicsocket *qs)
-{
- if(qs->conn) {
- (void)quiche_conn_close(qs->conn, TRUE, 0, NULL, 0);
- /* flushing the egress is not a failsafe way to deliver all the
- outstanding packets, but we also don't want to get stuck here... */
- (void)flush_egress(conn, qs->sockfd, qs);
- quiche_conn_free(qs->conn);
- qs->conn = NULL;
- }
- if(qs->h3config)
- quiche_h3_config_free(qs->h3config);
- if(qs->h3c)
- quiche_h3_conn_free(qs->h3c);
- if(qs->cfg) {
- quiche_config_free(qs->cfg);
- qs->cfg = NULL;
- }
- return CURLE_OK;
-}
-
+static CURLcode qs_disconnect(struct connectdata *conn,
+ struct quicsocket *qs)
+{
+ if(qs->conn) {
+ (void)quiche_conn_close(qs->conn, TRUE, 0, NULL, 0);
+ /* flushing the egress is not a failsafe way to deliver all the
+ outstanding packets, but we also don't want to get stuck here... */
+ (void)flush_egress(conn, qs->sockfd, qs);
+ quiche_conn_free(qs->conn);
+ qs->conn = NULL;
+ }
+ if(qs->h3config)
+ quiche_h3_config_free(qs->h3config);
+ if(qs->h3c)
+ quiche_h3_conn_free(qs->h3c);
+ if(qs->cfg) {
+ quiche_config_free(qs->cfg);
+ qs->cfg = NULL;
+ }
+ return CURLE_OK;
+}
+
static CURLcode quiche_disconnect(struct connectdata *conn,
bool dead_connection)
{
struct quicsocket *qs = conn->quic;
(void)dead_connection;
- return qs_disconnect(conn, qs);
+ return qs_disconnect(conn, qs);
+}
+
+void Curl_quic_disconnect(struct connectdata *conn,
+ int tempindex)
+{
+ if(conn->transport == TRNSPRT_QUIC)
+ qs_disconnect(conn, &conn->hequic[tempindex]);
}
-void Curl_quic_disconnect(struct connectdata *conn,
- int tempindex)
-{
- if(conn->transport == TRNSPRT_QUIC)
- qs_disconnect(conn, &conn->hequic[tempindex]);
-}
-
static unsigned int quiche_conncheck(struct connectdata *conn,
unsigned int checks_to_perform)
{
@@ -136,7 +136,7 @@ static unsigned int quiche_conncheck(struct connectdata *conn,
static CURLcode quiche_do(struct connectdata *conn, bool *done)
{
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
stream->h3req = FALSE; /* not sent */
return Curl_http(conn, done);
}
@@ -159,7 +159,7 @@ static const struct Curl_handler Curl_handler_http3 = {
quiche_conncheck, /* connection_check */
PORT_HTTP, /* defport */
CURLPROTO_HTTPS, /* protocol */
- CURLPROTO_HTTP, /* family */
+ CURLPROTO_HTTP, /* family */
PROTOPT_SSL | PROTOPT_STREAM /* flags */
};
@@ -178,7 +178,7 @@ CURLcode Curl_quic_connect(struct connectdata *conn, curl_socket_t sockfd,
CURLcode result;
struct quicsocket *qs = &conn->hequic[sockindex];
struct Curl_easy *data = conn->data;
- char *keylog_file = NULL;
+ char *keylog_file = NULL;
#ifdef DEBUG_QUICHE
/* initialize debug log callback only once */
@@ -192,14 +192,14 @@ CURLcode Curl_quic_connect(struct connectdata *conn, curl_socket_t sockfd,
(void)addr;
(void)addrlen;
- qs->sockfd = sockfd;
+ qs->sockfd = sockfd;
qs->cfg = quiche_config_new(QUICHE_PROTOCOL_VERSION);
if(!qs->cfg) {
failf(data, "can't create quiche config");
return CURLE_FAILED_INIT;
}
- quiche_config_set_max_idle_timeout(qs->cfg, QUIC_IDLE_TIMEOUT);
+ quiche_config_set_max_idle_timeout(qs->cfg, QUIC_IDLE_TIMEOUT);
quiche_config_set_initial_max_data(qs->cfg, QUIC_MAX_DATA);
quiche_config_set_initial_max_stream_data_bidi_local(qs->cfg, QUIC_MAX_DATA);
quiche_config_set_initial_max_stream_data_bidi_remote(qs->cfg,
@@ -217,9 +217,9 @@ CURLcode Curl_quic_connect(struct connectdata *conn, curl_socket_t sockfd,
if(result)
return result;
- keylog_file = getenv("SSLKEYLOGFILE");
-
- if(keylog_file)
+ keylog_file = getenv("SSLKEYLOGFILE");
+
+ if(keylog_file)
quiche_config_log_keys(qs->cfg);
qs->conn = quiche_connect(conn->host.name, (const uint8_t *) qs->scid,
@@ -229,53 +229,53 @@ CURLcode Curl_quic_connect(struct connectdata *conn, curl_socket_t sockfd,
return CURLE_OUT_OF_MEMORY;
}
- if(keylog_file)
- quiche_conn_set_keylog_path(qs->conn, keylog_file);
-
- /* Known to not work on Windows */
-#if !defined(WIN32) && defined(HAVE_QUICHE_CONN_SET_QLOG_FD)
- {
- int qfd;
- (void)Curl_qlogdir(data, qs->scid, sizeof(qs->scid), &qfd);
- if(qfd != -1)
- quiche_conn_set_qlog_fd(qs->conn, qfd,
- "qlog title", "curl qlog");
- }
-#endif
-
+ if(keylog_file)
+ quiche_conn_set_keylog_path(qs->conn, keylog_file);
+
+ /* Known to not work on Windows */
+#if !defined(WIN32) && defined(HAVE_QUICHE_CONN_SET_QLOG_FD)
+ {
+ int qfd;
+ (void)Curl_qlogdir(data, qs->scid, sizeof(qs->scid), &qfd);
+ if(qfd != -1)
+ quiche_conn_set_qlog_fd(qs->conn, qfd,
+ "qlog title", "curl qlog");
+ }
+#endif
+
result = flush_egress(conn, sockfd, qs);
if(result)
return result;
/* store the used address as a string */
- if(!Curl_addr2string((struct sockaddr*)addr, addrlen,
+ if(!Curl_addr2string((struct sockaddr*)addr, addrlen,
conn->primary_ip, &conn->primary_port)) {
char buffer[STRERROR_LEN];
failf(data, "ssrem inet_ntop() failed with errno %d: %s",
- SOCKERRNO, Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
+ SOCKERRNO, Curl_strerror(SOCKERRNO, buffer, sizeof(buffer)));
return CURLE_BAD_FUNCTION_ARGUMENT;
}
memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);
- Curl_persistconninfo(conn);
-
+ Curl_persistconninfo(conn);
+
/* for connection reuse purposes: */
conn->ssl[FIRSTSOCKET].state = ssl_connection_complete;
- {
- unsigned char alpn_protocols[] = QUICHE_H3_APPLICATION_PROTOCOL;
- unsigned alpn_len, offset = 0;
-
- /* Replace each ALPN length prefix by a comma. */
- while(offset < sizeof(alpn_protocols) - 1) {
- alpn_len = alpn_protocols[offset];
- alpn_protocols[offset] = ',';
- offset += 1 + alpn_len;
- }
-
- infof(data, "Sent QUIC client Initial, ALPN: %s\n",
- alpn_protocols + 1);
- }
-
+ {
+ unsigned char alpn_protocols[] = QUICHE_H3_APPLICATION_PROTOCOL;
+ unsigned alpn_len, offset = 0;
+
+ /* Replace each ALPN length prefix by a comma. */
+ while(offset < sizeof(alpn_protocols) - 1) {
+ alpn_len = alpn_protocols[offset];
+ alpn_protocols[offset] = ',';
+ offset += 1 + alpn_len;
+ }
+
+ infof(data, "Sent QUIC client Initial, ALPN: %s\n",
+ alpn_protocols + 1);
+ }
+
return CURLE_OK;
}
@@ -293,7 +293,7 @@ static CURLcode quiche_has_connected(struct connectdata *conn,
conn->httpversion = 30;
conn->bundle->multiuse = BUNDLE_MULTIPLEX;
- qs->h3config = quiche_h3_config_new();
+ qs->h3config = quiche_h3_config_new();
if(!qs->h3config)
return CURLE_OUT_OF_MEMORY;
@@ -329,11 +329,11 @@ CURLcode Curl_quic_is_connected(struct connectdata *conn, int sockindex,
result = process_ingress(conn, sockfd, qs);
if(result)
- goto error;
+ goto error;
result = flush_egress(conn, sockfd, qs);
if(result)
- goto error;
+ goto error;
if(quiche_conn_is_established(qs->conn)) {
*done = TRUE;
@@ -342,9 +342,9 @@ CURLcode Curl_quic_is_connected(struct connectdata *conn, int sockindex,
}
return result;
- error:
- qs_disconnect(conn, qs);
- return result;
+ error:
+ qs_disconnect(conn, qs);
+ return result;
}
static CURLcode process_ingress(struct connectdata *conn, int sockfd,
@@ -360,11 +360,11 @@ static CURLcode process_ingress(struct connectdata *conn, int sockfd,
do {
recvd = recv(sockfd, buf, bufsize, 0);
- if((recvd < 0) && ((SOCKERRNO == EAGAIN) || (SOCKERRNO == EWOULDBLOCK)))
+ if((recvd < 0) && ((SOCKERRNO == EAGAIN) || (SOCKERRNO == EWOULDBLOCK)))
break;
if(recvd < 0) {
- failf(conn->data, "quiche: recv() unexpectedly returned %zd "
+ failf(conn->data, "quiche: recv() unexpectedly returned %zd "
"(errno: %d, socket %d)", recvd, SOCKERRNO, sockfd);
return CURLE_RECV_ERROR;
}
@@ -374,7 +374,7 @@ static CURLcode process_ingress(struct connectdata *conn, int sockfd,
break;
if(recvd < 0) {
- failf(conn->data, "quiche_conn_recv() == %zd", recvd);
+ failf(conn->data, "quiche_conn_recv() == %zd", recvd);
return CURLE_RECV_ERROR;
}
} while(1);
@@ -390,7 +390,7 @@ static CURLcode flush_egress(struct connectdata *conn, int sockfd,
struct quicsocket *qs)
{
ssize_t sent;
- uint8_t out[1200];
+ uint8_t out[1200];
int64_t timeout_ns;
do {
@@ -438,9 +438,9 @@ static int cb_each_header(uint8_t *name, size_t name_len,
headers->destlen, "HTTP/3 %.*s\n",
(int) value_len, value);
}
- else if(!headers->nlen) {
- return CURLE_HTTP3;
- }
+ else if(!headers->nlen) {
+ return CURLE_HTTP3;
+ }
else {
msnprintf(headers->dest,
headers->destlen, "%.*s: %.*s\n",
@@ -466,14 +466,14 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
quiche_h3_event *ev;
int rc;
struct h3h1header headers;
- struct Curl_easy *data = conn->data;
- struct HTTP *stream = data->req.p.http;
+ struct Curl_easy *data = conn->data;
+ struct HTTP *stream = data->req.p.http;
headers.dest = buf;
headers.destlen = buffersize;
headers.nlen = 0;
if(process_ingress(conn, sockfd, qs)) {
- infof(data, "h3_stream_recv returns on ingress\n");
+ infof(data, "h3_stream_recv returns on ingress\n");
*curlcode = CURLE_RECV_ERROR;
return -1;
}
@@ -486,7 +486,7 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
if(s != stream->stream3_id) {
/* another transfer, ignore for now */
- infof(data, "Got h3 for stream %u, expects %u\n",
+ infof(data, "Got h3 for stream %u, expects %u\n",
s, stream->stream3_id);
continue;
}
@@ -495,9 +495,9 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
case QUICHE_H3_EVENT_HEADERS:
rc = quiche_h3_event_for_each_header(ev, cb_each_header, &headers);
if(rc) {
- *curlcode = rc;
- failf(data, "Error in HTTP/3 response header");
- break;
+ *curlcode = rc;
+ failf(data, "Error in HTTP/3 response header");
+ break;
}
recvd = headers.nlen;
break;
@@ -523,7 +523,7 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
break;
case QUICHE_H3_EVENT_FINISHED:
- streamclose(conn, "End of stream");
+ streamclose(conn, "End of stream");
recvd = 0; /* end of stream */
break;
default:
@@ -540,9 +540,9 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
*curlcode = (-1 == recvd)? CURLE_AGAIN : CURLE_OK;
if(recvd >= 0)
/* Get this called again to drain the event queue */
- Curl_expire(data, 0, EXPIRE_QUIC);
-
- data->state.drain = (recvd >= 0) ? 1 : 0;
+ Curl_expire(data, 0, EXPIRE_QUIC);
+
+ data->state.drain = (recvd >= 0) ? 1 : 0;
return recvd;
}
@@ -555,7 +555,7 @@ static ssize_t h3_stream_send(struct connectdata *conn,
ssize_t sent;
struct quicsocket *qs = conn->quic;
curl_socket_t sockfd = conn->sock[sockindex];
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
if(!stream->h3req) {
CURLcode result = http_request(conn, mem, len);
@@ -591,7 +591,7 @@ static ssize_t h3_stream_send(struct connectdata *conn,
*/
int Curl_quic_ver(char *p, size_t len)
{
- return msnprintf(p, len, "quiche/%s", quiche_version());
+ return msnprintf(p, len, "quiche/%s", quiche_version());
}
/* Index where :authority header field will appear in request header
@@ -603,7 +603,7 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
{
/*
*/
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
size_t nheader;
size_t i;
size_t authority_idx;
@@ -711,9 +711,9 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
nva[i].name_len = strlen((char *)nva[i].name);
}
else {
- nva[i].name_len = (size_t)(end - hdbuf);
- /* Lower case the header name for HTTP/3 */
- Curl_strntolower((char *)hdbuf, hdbuf, nva[i].name_len);
+ nva[i].name_len = (size_t)(end - hdbuf);
+ /* Lower case the header name for HTTP/3 */
+ Curl_strntolower((char *)hdbuf, hdbuf, nva[i].name_len);
nva[i].name = (unsigned char *)hdbuf;
}
hdbuf = end + 1;
@@ -768,12 +768,12 @@ static CURLcode http_request(struct connectdata *conn, const void *mem,
if(acc > MAX_ACC) {
infof(data, "http_request: Warning: The cumulative length of all "
- "headers exceeds %d bytes and that could cause the "
+ "headers exceeds %d bytes and that could cause the "
"stream to be rejected.\n", MAX_ACC);
}
}
- switch(data->state.httpreq) {
+ switch(data->state.httpreq) {
case HTTPREQ_POST:
case HTTPREQ_POST_FORM:
case HTTPREQ_POST_MIME:
@@ -831,7 +831,7 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
if(conn->handler == &Curl_handler_http3) {
/* only for HTTP/3 transfers */
ssize_t sent;
- struct HTTP *stream = conn->data->req.p.http;
+ struct HTTP *stream = conn->data->req.p.http;
struct quicsocket *qs = conn->quic;
fprintf(stderr, "!!! Curl_quic_done_sending\n");
stream->upload_done = TRUE;
@@ -844,23 +844,23 @@ CURLcode Curl_quic_done_sending(struct connectdata *conn)
return CURLE_OK;
}
-/*
- * Called from http.c:Curl_http_done when a request completes.
- */
-void Curl_quic_done(struct Curl_easy *data, bool premature)
-{
- (void)data;
- (void)premature;
-}
-
-/*
- * Called from transfer.c:data_pending to know if we should keep looping
- * to receive more data from the connection.
- */
-bool Curl_quic_data_pending(const struct Curl_easy *data)
-{
- (void)data;
- return FALSE;
-}
-
+/*
+ * Called from http.c:Curl_http_done when a request completes.
+ */
+void Curl_quic_done(struct Curl_easy *data, bool premature)
+{
+ (void)data;
+ (void)premature;
+}
+
+/*
+ * Called from transfer.c:data_pending to know if we should keep looping
+ * to receive more data from the connection.
+ */
+bool Curl_quic_data_pending(const struct Curl_easy *data)
+{
+ (void)data;
+ return FALSE;
+}
+
#endif
diff --git a/contrib/libs/curl/lib/vquic/vquic.c b/contrib/libs/curl/lib/vquic/vquic.c
index 6a435f68dc..e01e575834 100644
--- a/contrib/libs/curl/lib/vquic/vquic.c
+++ b/contrib/libs/curl/lib/vquic/vquic.c
@@ -1,85 +1,85 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
-
-#ifdef ENABLE_QUIC
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include "urldata.h"
-#include "dynbuf.h"
-#include "curl_printf.h"
-#error #include "vquic.h"
-
-#ifdef O_BINARY
-#define QLOGMODE O_WRONLY|O_CREAT|O_BINARY
-#else
-#define QLOGMODE O_WRONLY|O_CREAT
-#endif
-
-/*
- * If the QLOGDIR environment variable is set, open and return a file
- * descriptor to write the log to.
- *
- * This function returns error if something failed outside of failing to
- * create the file. Open file success is deemed by seeing if the returned fd
- * is != -1.
- */
-CURLcode Curl_qlogdir(struct Curl_easy *data,
- unsigned char *scid,
- size_t scidlen,
- int *qlogfdp)
-{
- const char *qlog_dir = getenv("QLOGDIR");
- *qlogfdp = -1;
- if(qlog_dir) {
- struct dynbuf fname;
- CURLcode result;
- unsigned int i;
- Curl_dyn_init(&fname, DYN_QLOG_NAME);
- result = Curl_dyn_add(&fname, qlog_dir);
- if(!result)
- result = Curl_dyn_add(&fname, "/");
- for(i = 0; (i < scidlen) && !result; i++) {
- char hex[3];
- msnprintf(hex, 3, "%02x", scid[i]);
- result = Curl_dyn_add(&fname, hex);
- }
- if(!result)
- result = Curl_dyn_add(&fname, ".qlog");
-
- if(!result) {
- int qlogfd = open(Curl_dyn_ptr(&fname), QLOGMODE,
- data->set.new_file_perms);
- if(qlogfd != -1)
- *qlogfdp = qlogfd;
- }
- Curl_dyn_free(&fname);
- if(result)
- return result;
- }
-
- return CURLE_OK;
-}
-#endif
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
+
+#ifdef ENABLE_QUIC
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include "urldata.h"
+#include "dynbuf.h"
+#include "curl_printf.h"
+#error #include "vquic.h"
+
+#ifdef O_BINARY
+#define QLOGMODE O_WRONLY|O_CREAT|O_BINARY
+#else
+#define QLOGMODE O_WRONLY|O_CREAT
+#endif
+
+/*
+ * If the QLOGDIR environment variable is set, open and return a file
+ * descriptor to write the log to.
+ *
+ * This function returns error if something failed outside of failing to
+ * create the file. Open file success is deemed by seeing if the returned fd
+ * is != -1.
+ */
+CURLcode Curl_qlogdir(struct Curl_easy *data,
+ unsigned char *scid,
+ size_t scidlen,
+ int *qlogfdp)
+{
+ const char *qlog_dir = getenv("QLOGDIR");
+ *qlogfdp = -1;
+ if(qlog_dir) {
+ struct dynbuf fname;
+ CURLcode result;
+ unsigned int i;
+ Curl_dyn_init(&fname, DYN_QLOG_NAME);
+ result = Curl_dyn_add(&fname, qlog_dir);
+ if(!result)
+ result = Curl_dyn_add(&fname, "/");
+ for(i = 0; (i < scidlen) && !result; i++) {
+ char hex[3];
+ msnprintf(hex, 3, "%02x", scid[i]);
+ result = Curl_dyn_add(&fname, hex);
+ }
+ if(!result)
+ result = Curl_dyn_add(&fname, ".qlog");
+
+ if(!result) {
+ int qlogfd = open(Curl_dyn_ptr(&fname), QLOGMODE,
+ data->set.new_file_perms);
+ if(qlogfd != -1)
+ *qlogfdp = qlogfd;
+ }
+ Curl_dyn_free(&fname);
+ if(result)
+ return result;
+ }
+
+ return CURLE_OK;
+}
+#endif
diff --git a/contrib/libs/curl/lib/vssh/libssh.c b/contrib/libs/curl/lib/vssh/libssh.c
index bb54204263..87d6187544 100644
--- a/contrib/libs/curl/lib/vssh/libssh.c
+++ b/contrib/libs/curl/lib/vssh/libssh.c
@@ -5,14 +5,14 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2017 - 2020 Red Hat, Inc.
+ * Copyright (C) 2017 - 2020 Red Hat, Inc.
*
* Authors: Nikos Mavrogiannopoulos, Tomas Mraz, Stanislav Zidek,
* Robert Kolcun, Andreas Schneider
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -97,13 +97,13 @@
/* A recent macro provided by libssh. Or make our own. */
#ifndef SSH_STRING_FREE_CHAR
-#define SSH_STRING_FREE_CHAR(x) \
- do { \
- if(x) { \
- ssh_string_free_char(x); \
- x = NULL; \
- } \
- } while(0)
+#define SSH_STRING_FREE_CHAR(x) \
+ do { \
+ if(x) { \
+ ssh_string_free_char(x); \
+ x = NULL; \
+ } \
+ } while(0)
#endif
/* Local functions: */
@@ -158,7 +158,7 @@ const struct Curl_handler Curl_handler_scp = {
ZERO_NULL, /* connection_check */
PORT_SSH, /* defport */
CURLPROTO_SCP, /* protocol */
- CURLPROTO_SCP, /* family */
+ CURLPROTO_SCP, /* family */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY /* flags */
};
@@ -184,7 +184,7 @@ const struct Curl_handler Curl_handler_sftp = {
ZERO_NULL, /* connection_check */
PORT_SSH, /* defport */
CURLPROTO_SFTP, /* protocol */
- CURLPROTO_SFTP, /* family */
+ CURLPROTO_SFTP, /* family */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
| PROTOPT_NOURLQUERY /* flags */
};
@@ -324,50 +324,50 @@ static int myssh_is_known(struct connectdata *conn)
ssh_key pubkey;
size_t hlen;
unsigned char *hash = NULL;
- char *found_base64 = NULL;
- char *known_base64 = NULL;
+ char *found_base64 = NULL;
+ char *known_base64 = NULL;
int vstate;
enum curl_khmatch keymatch;
struct curl_khkey foundkey;
- struct curl_khkey *knownkeyp = NULL;
+ struct curl_khkey *knownkeyp = NULL;
curl_sshkeycallback func =
data->set.ssh_keyfunc;
-#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
- struct ssh_knownhosts_entry *knownhostsentry = NULL;
- struct curl_khkey knownkey;
-#endif
-
-#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,8,0)
- rc = ssh_get_server_publickey(sshc->ssh_session, &pubkey);
-#else
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
+ struct ssh_knownhosts_entry *knownhostsentry = NULL;
+ struct curl_khkey knownkey;
+#endif
+
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,8,0)
+ rc = ssh_get_server_publickey(sshc->ssh_session, &pubkey);
+#else
rc = ssh_get_publickey(sshc->ssh_session, &pubkey);
-#endif
+#endif
if(rc != SSH_OK)
return rc;
if(data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5]) {
- int i;
- char md5buffer[33];
- const char *pubkey_md5 = data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5];
-
+ int i;
+ char md5buffer[33];
+ const char *pubkey_md5 = data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5];
+
rc = ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_MD5,
&hash, &hlen);
- if(rc != SSH_OK || hlen != 16) {
- failf(data,
- "Denied establishing ssh session: md5 fingerprint not available");
+ if(rc != SSH_OK || hlen != 16) {
+ failf(data,
+ "Denied establishing ssh session: md5 fingerprint not available");
goto cleanup;
- }
-
- for(i = 0; i < 16; i++)
- msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
-
- infof(data, "SSH MD5 fingerprint: %s\n", md5buffer);
-
- if(!strcasecompare(md5buffer, pubkey_md5)) {
- failf(data,
- "Denied establishing ssh session: mismatch md5 fingerprint. "
- "Remote %s is not equal to %s", md5buffer, pubkey_md5);
+ }
+
+ for(i = 0; i < 16; i++)
+ msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
+
+ infof(data, "SSH MD5 fingerprint: %s\n", md5buffer);
+
+ if(!strcasecompare(md5buffer, pubkey_md5)) {
+ failf(data,
+ "Denied establishing ssh session: mismatch md5 fingerprint. "
+ "Remote %s is not equal to %s", md5buffer, pubkey_md5);
rc = SSH_ERROR;
goto cleanup;
}
@@ -381,68 +381,68 @@ static int myssh_is_known(struct connectdata *conn)
goto cleanup;
}
-#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
- /* Get the known_key from the known hosts file */
- vstate = ssh_session_get_known_hosts_entry(sshc->ssh_session,
- &knownhostsentry);
-
- /* Case an entry was found in a known hosts file */
- if(knownhostsentry) {
- if(knownhostsentry->publickey) {
- rc = ssh_pki_export_pubkey_base64(knownhostsentry->publickey,
- &known_base64);
- if(rc != SSH_OK) {
- goto cleanup;
- }
- knownkey.key = known_base64;
- knownkey.len = strlen(known_base64);
-
- switch(ssh_key_type(knownhostsentry->publickey)) {
- case SSH_KEYTYPE_RSA:
- knownkey.keytype = CURLKHTYPE_RSA;
- break;
- case SSH_KEYTYPE_RSA1:
- knownkey.keytype = CURLKHTYPE_RSA1;
- break;
- case SSH_KEYTYPE_ECDSA:
- case SSH_KEYTYPE_ECDSA_P256:
- case SSH_KEYTYPE_ECDSA_P384:
- case SSH_KEYTYPE_ECDSA_P521:
- knownkey.keytype = CURLKHTYPE_ECDSA;
- break;
- case SSH_KEYTYPE_ED25519:
- knownkey.keytype = CURLKHTYPE_ED25519;
- break;
- case SSH_KEYTYPE_DSS:
- knownkey.keytype = CURLKHTYPE_DSS;
- break;
- default:
- rc = SSH_ERROR;
- goto cleanup;
- }
- knownkeyp = &knownkey;
- }
- }
-
- switch(vstate) {
- case SSH_KNOWN_HOSTS_OK:
- keymatch = CURLKHMATCH_OK;
- break;
- case SSH_KNOWN_HOSTS_OTHER:
- /* fallthrough */
- case SSH_KNOWN_HOSTS_NOT_FOUND:
- /* fallthrough */
- case SSH_KNOWN_HOSTS_UNKNOWN:
- /* fallthrough */
- case SSH_KNOWN_HOSTS_ERROR:
- keymatch = CURLKHMATCH_MISSING;
- break;
- default:
- keymatch = CURLKHMATCH_MISMATCH;
- break;
- }
-
-#else
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
+ /* Get the known_key from the known hosts file */
+ vstate = ssh_session_get_known_hosts_entry(sshc->ssh_session,
+ &knownhostsentry);
+
+ /* Case an entry was found in a known hosts file */
+ if(knownhostsentry) {
+ if(knownhostsentry->publickey) {
+ rc = ssh_pki_export_pubkey_base64(knownhostsentry->publickey,
+ &known_base64);
+ if(rc != SSH_OK) {
+ goto cleanup;
+ }
+ knownkey.key = known_base64;
+ knownkey.len = strlen(known_base64);
+
+ switch(ssh_key_type(knownhostsentry->publickey)) {
+ case SSH_KEYTYPE_RSA:
+ knownkey.keytype = CURLKHTYPE_RSA;
+ break;
+ case SSH_KEYTYPE_RSA1:
+ knownkey.keytype = CURLKHTYPE_RSA1;
+ break;
+ case SSH_KEYTYPE_ECDSA:
+ case SSH_KEYTYPE_ECDSA_P256:
+ case SSH_KEYTYPE_ECDSA_P384:
+ case SSH_KEYTYPE_ECDSA_P521:
+ knownkey.keytype = CURLKHTYPE_ECDSA;
+ break;
+ case SSH_KEYTYPE_ED25519:
+ knownkey.keytype = CURLKHTYPE_ED25519;
+ break;
+ case SSH_KEYTYPE_DSS:
+ knownkey.keytype = CURLKHTYPE_DSS;
+ break;
+ default:
+ rc = SSH_ERROR;
+ goto cleanup;
+ }
+ knownkeyp = &knownkey;
+ }
+ }
+
+ switch(vstate) {
+ case SSH_KNOWN_HOSTS_OK:
+ keymatch = CURLKHMATCH_OK;
+ break;
+ case SSH_KNOWN_HOSTS_OTHER:
+ /* fallthrough */
+ case SSH_KNOWN_HOSTS_NOT_FOUND:
+ /* fallthrough */
+ case SSH_KNOWN_HOSTS_UNKNOWN:
+ /* fallthrough */
+ case SSH_KNOWN_HOSTS_ERROR:
+ keymatch = CURLKHMATCH_MISSING;
+ break;
+ default:
+ keymatch = CURLKHMATCH_MISMATCH;
+ break;
+ }
+
+#else
vstate = ssh_is_server_known(sshc->ssh_session);
switch(vstate) {
case SSH_SERVER_KNOWN_OK:
@@ -457,15 +457,15 @@ static int myssh_is_known(struct connectdata *conn)
keymatch = CURLKHMATCH_MISMATCH;
break;
}
-#endif
+#endif
if(func) { /* use callback to determine action */
- rc = ssh_pki_export_pubkey_base64(pubkey, &found_base64);
+ rc = ssh_pki_export_pubkey_base64(pubkey, &found_base64);
if(rc != SSH_OK)
goto cleanup;
- foundkey.key = found_base64;
- foundkey.len = strlen(found_base64);
+ foundkey.key = found_base64;
+ foundkey.len = strlen(found_base64);
switch(ssh_key_type(pubkey)) {
case SSH_KEYTYPE_RSA:
@@ -475,11 +475,11 @@ static int myssh_is_known(struct connectdata *conn)
foundkey.keytype = CURLKHTYPE_RSA1;
break;
case SSH_KEYTYPE_ECDSA:
-#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
- case SSH_KEYTYPE_ECDSA_P256:
- case SSH_KEYTYPE_ECDSA_P384:
- case SSH_KEYTYPE_ECDSA_P521:
-#endif
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
+ case SSH_KEYTYPE_ECDSA_P256:
+ case SSH_KEYTYPE_ECDSA_P384:
+ case SSH_KEYTYPE_ECDSA_P521:
+#endif
foundkey.keytype = CURLKHTYPE_ECDSA;
break;
#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,7,0)
@@ -496,18 +496,18 @@ static int myssh_is_known(struct connectdata *conn)
}
Curl_set_in_callback(data, true);
- rc = func(data, knownkeyp, /* from the knownhosts file */
- &foundkey, /* from the remote host */
+ 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);
switch(rc) {
case CURLKHSTAT_FINE_ADD_TO_FILE:
-#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,8,0)
- rc = ssh_session_update_known_hosts(sshc->ssh_session);
-#else
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,8,0)
+ rc = ssh_session_update_known_hosts(sshc->ssh_session);
+#else
rc = ssh_write_knownhost(sshc->ssh_session);
-#endif
+#endif
if(rc != SSH_OK) {
goto cleanup;
}
@@ -528,20 +528,20 @@ static int myssh_is_known(struct connectdata *conn)
rc = SSH_OK;
cleanup:
- if(found_base64) {
- free(found_base64);
- }
- if(known_base64) {
- free(known_base64);
- }
+ if(found_base64) {
+ free(found_base64);
+ }
+ if(known_base64) {
+ free(known_base64);
+ }
if(hash)
ssh_clean_pubkey_hash(&hash);
ssh_key_free(pubkey);
-#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
- if(knownhostsentry) {
- ssh_knownhosts_entry_free(knownhostsentry);
- }
-#endif
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,9,0)
+ if(knownhostsentry) {
+ ssh_knownhosts_entry_free(knownhostsentry);
+ }
+#endif
return rc;
}
@@ -607,7 +607,7 @@ restart:
return SSH_ERROR;
nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session);
- if(nprompts != 1)
+ if(nprompts != 1)
return SSH_ERROR;
rc = ssh_userauth_kbdint_setanswer(sshc->ssh_session, 0, conn->passwd);
@@ -664,7 +664,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SSHPROTO *protop = data->req.p.ssh;
+ struct SSHPROTO *protop = data->req.p.ssh;
struct ssh_conn *sshc = &conn->proto.sshc;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
int rc = SSH_NO_ERROR, err;
@@ -1432,8 +1432,8 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
data->req.bytecount += sshc->readdir_len + 1;
/* output debug output if that is requested */
- Curl_debug(data, CURLINFO_DATA_OUT, (char *)sshc->readdir_filename,
- sshc->readdir_len);
+ Curl_debug(data, CURLINFO_DATA_OUT, (char *)sshc->readdir_filename,
+ sshc->readdir_len);
}
else {
sshc->readdir_currLen = strlen(sshc->readdir_longentry);
@@ -1467,7 +1467,7 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
}
- else if(sftp_dir_eof(sshc->sftp_dir)) {
+ else if(sftp_dir_eof(sshc->sftp_dir)) {
state(conn, SSH_SFTP_READDIR_DONE);
break;
}
@@ -1546,8 +1546,8 @@ static CURLcode myssh_statemach_act(struct connectdata *conn, bool *block)
if(!result) {
/* output debug output if that is requested */
- Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line,
- sshc->readdir_currLen);
+ Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line,
+ sshc->readdir_currLen);
data->req.bytecount += sshc->readdir_currLen;
}
Curl_safefree(sshc->readdir_line);
@@ -2106,7 +2106,7 @@ static CURLcode myssh_block_statemach(struct connectdata *conn,
}
}
- if(block) {
+ if(block) {
curl_socket_t fd_read = conn->sock[FIRSTSOCKET];
/* wait for the socket to become ready */
(void) Curl_socket_check(fd_read, CURL_SOCKET_BAD,
@@ -2125,7 +2125,7 @@ static CURLcode myssh_setup_connection(struct connectdata *conn)
{
struct SSHPROTO *ssh;
- conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
if(!ssh)
return CURLE_OUT_OF_MEMORY;
@@ -2145,10 +2145,10 @@ static CURLcode myssh_connect(struct connectdata *conn, bool *done)
CURLcode result;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
struct Curl_easy *data = conn->data;
- int rc;
+ int rc;
/* initialize per-handle data if not already */
- if(!data->req.p.ssh)
+ if(!data->req.p.ssh)
myssh_setup_connection(conn);
/* We default to persistent connections. We set this already in this connect
@@ -2172,70 +2172,70 @@ static CURLcode myssh_connect(struct connectdata *conn, bool *done)
return CURLE_FAILED_INIT;
}
- rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, conn->host.name);
- if(rc != SSH_OK) {
- failf(data, "Could not set remote host");
- return CURLE_FAILED_INIT;
- }
-
- rc = ssh_options_parse_config(ssh->ssh_session, NULL);
- if(rc != SSH_OK) {
- infof(data, "Could not parse SSH configuration files");
- /* ignore */
- }
-
- rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_FD, &sock);
- if(rc != SSH_OK) {
- failf(data, "Could not set socket");
- return CURLE_FAILED_INIT;
- }
-
- if(conn->user && conn->user[0] != '\0') {
+ rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_HOST, conn->host.name);
+ if(rc != SSH_OK) {
+ failf(data, "Could not set remote host");
+ return CURLE_FAILED_INIT;
+ }
+
+ rc = ssh_options_parse_config(ssh->ssh_session, NULL);
+ if(rc != SSH_OK) {
+ infof(data, "Could not parse SSH configuration files");
+ /* ignore */
+ }
+
+ rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_FD, &sock);
+ if(rc != SSH_OK) {
+ failf(data, "Could not set socket");
+ return CURLE_FAILED_INIT;
+ }
+
+ if(conn->user && conn->user[0] != '\0') {
infof(data, "User: %s\n", conn->user);
- rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_USER, conn->user);
- if(rc != SSH_OK) {
- failf(data, "Could not set user");
- return CURLE_FAILED_INIT;
- }
+ rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_USER, conn->user);
+ if(rc != SSH_OK) {
+ failf(data, "Could not set user");
+ return CURLE_FAILED_INIT;
+ }
}
if(data->set.str[STRING_SSH_KNOWNHOSTS]) {
infof(data, "Known hosts: %s\n", data->set.str[STRING_SSH_KNOWNHOSTS]);
- rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_KNOWNHOSTS,
- data->set.str[STRING_SSH_KNOWNHOSTS]);
- if(rc != SSH_OK) {
- failf(data, "Could not set known hosts file path");
- return CURLE_FAILED_INIT;
- }
+ rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_KNOWNHOSTS,
+ data->set.str[STRING_SSH_KNOWNHOSTS]);
+ if(rc != SSH_OK) {
+ failf(data, "Could not set known hosts file path");
+ return CURLE_FAILED_INIT;
+ }
}
- if(conn->remote_port) {
- rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_PORT,
- &conn->remote_port);
- if(rc != SSH_OK) {
- failf(data, "Could not set remote port");
- return CURLE_FAILED_INIT;
- }
- }
+ if(conn->remote_port) {
+ rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_PORT,
+ &conn->remote_port);
+ if(rc != SSH_OK) {
+ failf(data, "Could not set remote port");
+ return CURLE_FAILED_INIT;
+ }
+ }
if(data->set.ssh_compression) {
- rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_COMPRESSION,
- "zlib,zlib@openssh.com,none");
- if(rc != SSH_OK) {
- failf(data, "Could not set compression");
- return CURLE_FAILED_INIT;
- }
+ rc = ssh_options_set(ssh->ssh_session, SSH_OPTIONS_COMPRESSION,
+ "zlib,zlib@openssh.com,none");
+ if(rc != SSH_OK) {
+ failf(data, "Could not set compression");
+ return CURLE_FAILED_INIT;
+ }
}
ssh->privkey = NULL;
ssh->pubkey = NULL;
if(data->set.str[STRING_SSH_PUBLIC_KEY]) {
- rc = ssh_pki_import_pubkey_file(data->set.str[STRING_SSH_PUBLIC_KEY],
- &ssh->pubkey);
+ rc = ssh_pki_import_pubkey_file(data->set.str[STRING_SSH_PUBLIC_KEY],
+ &ssh->pubkey);
if(rc != SSH_OK) {
failf(data, "Could not load public key file");
- return CURLE_FAILED_INIT;
+ return CURLE_FAILED_INIT;
}
}
@@ -2349,7 +2349,7 @@ static CURLcode scp_disconnect(struct connectdata *conn,
static CURLcode myssh_done(struct connectdata *conn, CURLcode status)
{
CURLcode result = CURLE_OK;
- struct SSHPROTO *protop = conn->data->req.p.ssh;
+ struct SSHPROTO *protop = conn->data->req.p.ssh;
if(!status) {
/* run the state-machine */
@@ -2602,7 +2602,7 @@ static void sftp_quote(struct connectdata *conn)
{
const char *cp;
struct Curl_easy *data = conn->data;
- struct SSHPROTO *protop = data->req.p.ssh;
+ struct SSHPROTO *protop = data->req.p.ssh;
struct ssh_conn *sshc = &conn->proto.sshc;
CURLcode result;
@@ -2632,9 +2632,9 @@ static void sftp_quote(struct connectdata *conn)
sshc->nextstate = SSH_NO_STATE;
return;
}
- Curl_debug(data, CURLINFO_HEADER_OUT, (char *) "PWD\n", 4);
- Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
-
+ Curl_debug(data, CURLINFO_HEADER_OUT, (char *) "PWD\n", 4);
+ Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
+
/* this sends an FTP-like "header" to the header callback so that the
current directory can be read very similar to how it is read when
using ordinary FTP. */
@@ -2687,9 +2687,9 @@ static void sftp_quote(struct connectdata *conn)
*/
if(strncasecompare(cmd, "chgrp ", 6) ||
strncasecompare(cmd, "chmod ", 6) ||
- strncasecompare(cmd, "chown ", 6) ||
- strncasecompare(cmd, "atime ", 6) ||
- strncasecompare(cmd, "mtime ", 6)) {
+ strncasecompare(cmd, "chown ", 6) ||
+ strncasecompare(cmd, "atime ", 6) ||
+ strncasecompare(cmd, "mtime ", 6)) {
/* attribute change */
/* sshc->quote_path1 contains the mode to set */
@@ -2699,7 +2699,7 @@ static void sftp_quote(struct connectdata *conn)
if(result == CURLE_OUT_OF_MEMORY)
failf(data, "Out of memory");
else
- failf(data, "Syntax error in chgrp/chmod/chown/atime/mtime: "
+ failf(data, "Syntax error in chgrp/chmod/chown/atime/mtime: "
"Bad second parameter");
Curl_safefree(sshc->quote_path1);
state(conn, SSH_SFTP_CLOSE);
@@ -2860,34 +2860,34 @@ static void sftp_quote_stat(struct connectdata *conn)
}
sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID;
}
- else if(strncasecompare(cmd, "atime", 5)) {
- time_t date = Curl_getdate_capped(sshc->quote_path1);
- if(date == -1) {
- Curl_safefree(sshc->quote_path1);
- Curl_safefree(sshc->quote_path2);
- failf(data, "Syntax error: incorrect access date format");
- state(conn, SSH_SFTP_CLOSE);
- sshc->nextstate = SSH_NO_STATE;
- sshc->actualcode = CURLE_QUOTE_ERROR;
- return;
- }
- sshc->quote_attrs->atime = (uint32_t)date;
- sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
- }
- else if(strncasecompare(cmd, "mtime", 5)) {
- time_t date = Curl_getdate_capped(sshc->quote_path1);
- if(date == -1) {
- Curl_safefree(sshc->quote_path1);
- Curl_safefree(sshc->quote_path2);
- failf(data, "Syntax error: incorrect modification date format");
- state(conn, SSH_SFTP_CLOSE);
- sshc->nextstate = SSH_NO_STATE;
- sshc->actualcode = CURLE_QUOTE_ERROR;
- return;
- }
- sshc->quote_attrs->mtime = (uint32_t)date;
- sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
- }
+ else if(strncasecompare(cmd, "atime", 5)) {
+ time_t date = Curl_getdate_capped(sshc->quote_path1);
+ if(date == -1) {
+ Curl_safefree(sshc->quote_path1);
+ Curl_safefree(sshc->quote_path2);
+ failf(data, "Syntax error: incorrect access date format");
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->nextstate = SSH_NO_STATE;
+ sshc->actualcode = CURLE_QUOTE_ERROR;
+ return;
+ }
+ sshc->quote_attrs->atime = (uint32_t)date;
+ sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
+ }
+ else if(strncasecompare(cmd, "mtime", 5)) {
+ time_t date = Curl_getdate_capped(sshc->quote_path1);
+ if(date == -1) {
+ Curl_safefree(sshc->quote_path1);
+ Curl_safefree(sshc->quote_path2);
+ failf(data, "Syntax error: incorrect modification date format");
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->nextstate = SSH_NO_STATE;
+ sshc->actualcode = CURLE_QUOTE_ERROR;
+ return;
+ }
+ sshc->quote_attrs->mtime = (uint32_t)date;
+ sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
+ }
/* Now send the completed structure... */
state(conn, SSH_SFTP_QUOTE_SETSTAT);
diff --git a/contrib/libs/curl/lib/vssh/libssh2.c b/contrib/libs/curl/lib/vssh/libssh2.c
index 90fe770559..b282bf23f4 100644
--- a/contrib/libs/curl/lib/vssh/libssh2.c
+++ b/contrib/libs/curl/lib/vssh/libssh2.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -93,17 +93,17 @@
#define HAS_STATVFS_SUPPORT 1
#endif
-#define sftp_libssh2_realpath(s,p,t,m) \
- libssh2_sftp_symlink_ex((s), (p), curlx_uztoui(strlen(p)), \
- (t), (m), LIBSSH2_SFTP_REALPATH)
+#define sftp_libssh2_realpath(s,p,t,m) \
+ libssh2_sftp_symlink_ex((s), (p), curlx_uztoui(strlen(p)), \
+ (t), (m), LIBSSH2_SFTP_REALPATH)
/* Local functions: */
-static const char *sftp_libssh2_strerror(unsigned long err);
+static const char *sftp_libssh2_strerror(unsigned long err);
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc);
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc);
static LIBSSH2_FREE_FUNC(my_libssh2_free);
-static CURLcode ssh_force_knownhost_key_type(struct connectdata *conn);
+static CURLcode ssh_force_knownhost_key_type(struct connectdata *conn);
static CURLcode ssh_connect(struct connectdata *conn, bool *done);
static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done);
static CURLcode ssh_do(struct connectdata *conn, bool *done);
@@ -150,7 +150,7 @@ const struct Curl_handler Curl_handler_scp = {
ZERO_NULL, /* connection_check */
PORT_SSH, /* defport */
CURLPROTO_SCP, /* protocol */
- CURLPROTO_SCP, /* family */
+ CURLPROTO_SCP, /* family */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
| PROTOPT_NOURLQUERY /* flags */
};
@@ -178,7 +178,7 @@ const struct Curl_handler Curl_handler_sftp = {
ZERO_NULL, /* connection_check */
PORT_SSH, /* defport */
CURLPROTO_SFTP, /* protocol */
- CURLPROTO_SFTP, /* family */
+ CURLPROTO_SFTP, /* family */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
| PROTOPT_NOURLQUERY /* flags */
};
@@ -212,7 +212,7 @@ kbd_callback(const char *name, int name_len, const char *instruction,
(void)abstract;
} /* kbd_callback */
-static CURLcode sftp_libssh2_error_to_CURLE(unsigned long err)
+static CURLcode sftp_libssh2_error_to_CURLE(unsigned long err)
{
switch(err) {
case LIBSSH2_FX_OK:
@@ -444,7 +444,7 @@ static CURLcode ssh_knownhost(struct connectdata *conn)
if(data->set.str[STRING_SSH_KNOWNHOSTS]) {
/* we're asked to verify the host against a file */
struct ssh_conn *sshc = &conn->proto.sshc;
- struct libssh2_knownhost *host = NULL;
+ struct libssh2_knownhost *host = NULL;
int rc;
int keytype;
size_t keylen;
@@ -466,95 +466,95 @@ static CURLcode ssh_knownhost(struct connectdata *conn)
struct curl_khkey *knownkeyp = NULL;
struct curl_khkey foundkey;
- switch(keytype) {
- case LIBSSH2_HOSTKEY_TYPE_RSA:
- keybit = LIBSSH2_KNOWNHOST_KEY_SSHRSA;
- break;
- case LIBSSH2_HOSTKEY_TYPE_DSS:
- keybit = LIBSSH2_KNOWNHOST_KEY_SSHDSS;
- break;
-#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_256
- case LIBSSH2_HOSTKEY_TYPE_ECDSA_256:
- keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_256;
- break;
-#endif
-#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_384
- case LIBSSH2_HOSTKEY_TYPE_ECDSA_384:
- keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_384;
- break;
-#endif
-#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_521
- case LIBSSH2_HOSTKEY_TYPE_ECDSA_521:
- keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_521;
- break;
-#endif
-#ifdef LIBSSH2_HOSTKEY_TYPE_ED25519
- case LIBSSH2_HOSTKEY_TYPE_ED25519:
- keybit = LIBSSH2_KNOWNHOST_KEY_ED25519;
- break;
-#endif
- default:
- infof(data, "unsupported key type, can't check knownhosts!\n");
- keybit = 0;
- break;
- }
- if(!keybit)
- /* no check means failure! */
- rc = CURLKHSTAT_REJECT;
- else {
+ switch(keytype) {
+ case LIBSSH2_HOSTKEY_TYPE_RSA:
+ keybit = LIBSSH2_KNOWNHOST_KEY_SSHRSA;
+ break;
+ case LIBSSH2_HOSTKEY_TYPE_DSS:
+ keybit = LIBSSH2_KNOWNHOST_KEY_SSHDSS;
+ break;
+#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_256
+ case LIBSSH2_HOSTKEY_TYPE_ECDSA_256:
+ keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_256;
+ break;
+#endif
+#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_384
+ case LIBSSH2_HOSTKEY_TYPE_ECDSA_384:
+ keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_384;
+ break;
+#endif
+#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_521
+ case LIBSSH2_HOSTKEY_TYPE_ECDSA_521:
+ keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_521;
+ break;
+#endif
+#ifdef LIBSSH2_HOSTKEY_TYPE_ED25519
+ case LIBSSH2_HOSTKEY_TYPE_ED25519:
+ keybit = LIBSSH2_KNOWNHOST_KEY_ED25519;
+ break;
+#endif
+ default:
+ infof(data, "unsupported key type, can't check knownhosts!\n");
+ keybit = 0;
+ break;
+ }
+ if(!keybit)
+ /* no check means failure! */
+ rc = CURLKHSTAT_REJECT;
+ else {
#ifdef HAVE_LIBSSH2_KNOWNHOST_CHECKP
- keycheck = libssh2_knownhost_checkp(sshc->kh,
- conn->host.name,
- (conn->remote_port != PORT_SSH)?
- conn->remote_port:-1,
- remotekey, keylen,
- LIBSSH2_KNOWNHOST_TYPE_PLAIN|
- LIBSSH2_KNOWNHOST_KEYENC_RAW|
- keybit,
- &host);
+ keycheck = libssh2_knownhost_checkp(sshc->kh,
+ conn->host.name,
+ (conn->remote_port != PORT_SSH)?
+ conn->remote_port:-1,
+ remotekey, keylen,
+ LIBSSH2_KNOWNHOST_TYPE_PLAIN|
+ LIBSSH2_KNOWNHOST_KEYENC_RAW|
+ keybit,
+ &host);
#else
- keycheck = libssh2_knownhost_check(sshc->kh,
- conn->host.name,
- remotekey, keylen,
- LIBSSH2_KNOWNHOST_TYPE_PLAIN|
- LIBSSH2_KNOWNHOST_KEYENC_RAW|
- keybit,
- &host);
+ keycheck = libssh2_knownhost_check(sshc->kh,
+ conn->host.name,
+ remotekey, keylen,
+ LIBSSH2_KNOWNHOST_TYPE_PLAIN|
+ LIBSSH2_KNOWNHOST_KEYENC_RAW|
+ keybit,
+ &host);
#endif
- infof(data, "SSH host check: %d, key: %s\n", keycheck,
- (keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
- host->key:"<none>");
-
- /* setup 'knownkey' */
- if(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH) {
- knownkey.key = host->key;
- knownkey.len = 0;
- knownkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?
- CURLKHTYPE_RSA : CURLKHTYPE_DSS;
- knownkeyp = &knownkey;
- }
-
- /* setup 'foundkey' */
- foundkey.key = remotekey;
- foundkey.len = keylen;
- foundkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?
+ infof(data, "SSH host check: %d, key: %s\n", keycheck,
+ (keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH)?
+ host->key:"<none>");
+
+ /* setup 'knownkey' */
+ if(keycheck <= LIBSSH2_KNOWNHOST_CHECK_MISMATCH) {
+ knownkey.key = host->key;
+ knownkey.len = 0;
+ knownkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?
+ CURLKHTYPE_RSA : CURLKHTYPE_DSS;
+ knownkeyp = &knownkey;
+ }
+
+ /* setup 'foundkey' */
+ foundkey.key = remotekey;
+ foundkey.len = keylen;
+ foundkey.keytype = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?
CURLKHTYPE_RSA : CURLKHTYPE_DSS;
- /*
- * if any of the LIBSSH2_KNOWNHOST_CHECK_* defines and the
- * curl_khmatch enum are ever modified, we need to introduce a
- * translation table here!
- */
- 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);
- }
+ /*
+ * if any of the LIBSSH2_KNOWNHOST_CHECK_* defines and the
+ * curl_khmatch enum are ever modified, we need to introduce a
+ * translation table here!
+ */
+ 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! */
@@ -570,13 +570,13 @@ static CURLcode ssh_knownhost(struct connectdata *conn)
/* DEFER means bail out but keep the SSH_HOSTKEY state */
result = sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
break;
- case CURLKHSTAT_FINE_REPLACE:
- /* remove old host+key that doesn't match */
- if(host)
- libssh2_knownhost_del(sshc->kh, host);
- /*FALLTHROUGH*/
+ case CURLKHSTAT_FINE_REPLACE:
+ /* remove old host+key that doesn't match */
+ if(host)
+ libssh2_knownhost_del(sshc->kh, host);
+ /*FALLTHROUGH*/
case CURLKHSTAT_FINE:
- /*FALLTHROUGH*/
+ /*FALLTHROUGH*/
case CURLKHSTAT_FINE_ADD_TO_FILE:
/* proceed */
if(keycheck != LIBSSH2_KNOWNHOST_CHECK_MATCH) {
@@ -591,8 +591,8 @@ static CURLcode ssh_knownhost(struct connectdata *conn)
if(addrc)
infof(data, "Warning adding the known host %s failed!\n",
conn->host.name);
- else if(rc == CURLKHSTAT_FINE_ADD_TO_FILE ||
- rc == CURLKHSTAT_FINE_REPLACE) {
+ else if(rc == CURLKHSTAT_FINE_ADD_TO_FILE ||
+ rc == CURLKHSTAT_FINE_REPLACE) {
/* now we write the entire in-memory list of known hosts to the
known_hosts file */
int wrc =
@@ -656,138 +656,138 @@ static CURLcode ssh_check_fingerprint(struct connectdata *conn)
}
/*
- * ssh_force_knownhost_key_type() will check the known hosts file and try to
- * force a specific public key type from the server if an entry is found.
- */
-static CURLcode ssh_force_knownhost_key_type(struct connectdata *conn)
-{
- CURLcode result = CURLE_OK;
-
-#ifdef HAVE_LIBSSH2_KNOWNHOST_API
-
-#ifdef LIBSSH2_KNOWNHOST_KEY_ED25519
- static const char * const hostkey_method_ssh_ed25519
- = "ssh-ed25519";
-#endif
-#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_521
- static const char * const hostkey_method_ssh_ecdsa_521
- = "ecdsa-sha2-nistp521";
-#endif
-#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_384
- static const char * const hostkey_method_ssh_ecdsa_384
- = "ecdsa-sha2-nistp384";
-#endif
-#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_256
- static const char * const hostkey_method_ssh_ecdsa_256
- = "ecdsa-sha2-nistp256";
-#endif
- static const char * const hostkey_method_ssh_rsa
- = "ssh-rsa";
- static const char * const hostkey_method_ssh_dss
- = "ssh-dss";
-
- const char *hostkey_method = NULL;
- struct ssh_conn *sshc = &conn->proto.sshc;
- struct Curl_easy *data = conn->data;
- struct libssh2_knownhost* store = NULL;
- const char *kh_name_end = NULL;
- size_t kh_name_size = 0;
- int port = 0;
- bool found = false;
-
- if(sshc->kh && !data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5]) {
- /* lets try to find our host in the known hosts file */
- while(!libssh2_knownhost_get(sshc->kh, &store, store)) {
- /* For non-standard ports, the name will be enclosed in */
- /* square brackets, followed by a colon and the port */
- if(store) {
- if(store->name) {
- if(store->name[0] == '[') {
- kh_name_end = strstr(store->name, "]:");
- if(!kh_name_end) {
- infof(data, "Invalid host pattern %s in %s\n",
- store->name, data->set.str[STRING_SSH_KNOWNHOSTS]);
- continue;
- }
- port = atoi(kh_name_end + 2);
- if(kh_name_end && (port == conn->remote_port)) {
- kh_name_size = strlen(store->name) - 1 - strlen(kh_name_end);
- if(strncmp(store->name + 1,
- conn->host.name, kh_name_size) == 0) {
- found = true;
- break;
- }
- }
- }
- else if(strcmp(store->name, conn->host.name) == 0) {
- found = true;
- break;
- }
- }
- else {
- found = true;
- break;
- }
- }
- }
-
- if(found) {
- infof(data, "Found host %s in %s\n",
- conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
-
- switch(store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) {
-#ifdef LIBSSH2_KNOWNHOST_KEY_ED25519
- case LIBSSH2_KNOWNHOST_KEY_ED25519:
- hostkey_method = hostkey_method_ssh_ed25519;
- break;
-#endif
-#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_521
- case LIBSSH2_KNOWNHOST_KEY_ECDSA_521:
- hostkey_method = hostkey_method_ssh_ecdsa_521;
- break;
-#endif
-#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_384
- case LIBSSH2_KNOWNHOST_KEY_ECDSA_384:
- hostkey_method = hostkey_method_ssh_ecdsa_384;
- break;
-#endif
-#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_256
- case LIBSSH2_KNOWNHOST_KEY_ECDSA_256:
- hostkey_method = hostkey_method_ssh_ecdsa_256;
- break;
-#endif
- case LIBSSH2_KNOWNHOST_KEY_SSHRSA:
- hostkey_method = hostkey_method_ssh_rsa;
- break;
- case LIBSSH2_KNOWNHOST_KEY_SSHDSS:
- hostkey_method = hostkey_method_ssh_dss;
- break;
- case LIBSSH2_KNOWNHOST_KEY_RSA1:
- failf(data, "Found host key type RSA1 which is not supported\n");
- return CURLE_SSH;
- default:
- failf(data, "Unknown host key type: %i\n",
- (store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK));
- return CURLE_SSH;
- }
-
- infof(data, "Set \"%s\" as SSH hostkey type\n", hostkey_method);
- result = libssh2_session_error_to_CURLE(
- libssh2_session_method_pref(
- sshc->ssh_session, LIBSSH2_METHOD_HOSTKEY, hostkey_method));
- }
- else {
- infof(data, "Did not find host %s in %s\n",
- conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
- }
- }
-
-#endif /* HAVE_LIBSSH2_KNOWNHOST_API */
-
- return result;
-}
-
-/*
+ * ssh_force_knownhost_key_type() will check the known hosts file and try to
+ * force a specific public key type from the server if an entry is found.
+ */
+static CURLcode ssh_force_knownhost_key_type(struct connectdata *conn)
+{
+ CURLcode result = CURLE_OK;
+
+#ifdef HAVE_LIBSSH2_KNOWNHOST_API
+
+#ifdef LIBSSH2_KNOWNHOST_KEY_ED25519
+ static const char * const hostkey_method_ssh_ed25519
+ = "ssh-ed25519";
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_521
+ static const char * const hostkey_method_ssh_ecdsa_521
+ = "ecdsa-sha2-nistp521";
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_384
+ static const char * const hostkey_method_ssh_ecdsa_384
+ = "ecdsa-sha2-nistp384";
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_256
+ static const char * const hostkey_method_ssh_ecdsa_256
+ = "ecdsa-sha2-nistp256";
+#endif
+ static const char * const hostkey_method_ssh_rsa
+ = "ssh-rsa";
+ static const char * const hostkey_method_ssh_dss
+ = "ssh-dss";
+
+ const char *hostkey_method = NULL;
+ struct ssh_conn *sshc = &conn->proto.sshc;
+ struct Curl_easy *data = conn->data;
+ struct libssh2_knownhost* store = NULL;
+ const char *kh_name_end = NULL;
+ size_t kh_name_size = 0;
+ int port = 0;
+ bool found = false;
+
+ if(sshc->kh && !data->set.str[STRING_SSH_HOST_PUBLIC_KEY_MD5]) {
+ /* lets try to find our host in the known hosts file */
+ while(!libssh2_knownhost_get(sshc->kh, &store, store)) {
+ /* For non-standard ports, the name will be enclosed in */
+ /* square brackets, followed by a colon and the port */
+ if(store) {
+ if(store->name) {
+ if(store->name[0] == '[') {
+ kh_name_end = strstr(store->name, "]:");
+ if(!kh_name_end) {
+ infof(data, "Invalid host pattern %s in %s\n",
+ store->name, data->set.str[STRING_SSH_KNOWNHOSTS]);
+ continue;
+ }
+ port = atoi(kh_name_end + 2);
+ if(kh_name_end && (port == conn->remote_port)) {
+ kh_name_size = strlen(store->name) - 1 - strlen(kh_name_end);
+ if(strncmp(store->name + 1,
+ conn->host.name, kh_name_size) == 0) {
+ found = true;
+ break;
+ }
+ }
+ }
+ else if(strcmp(store->name, conn->host.name) == 0) {
+ found = true;
+ break;
+ }
+ }
+ else {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if(found) {
+ infof(data, "Found host %s in %s\n",
+ conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
+
+ switch(store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) {
+#ifdef LIBSSH2_KNOWNHOST_KEY_ED25519
+ case LIBSSH2_KNOWNHOST_KEY_ED25519:
+ hostkey_method = hostkey_method_ssh_ed25519;
+ break;
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_521
+ case LIBSSH2_KNOWNHOST_KEY_ECDSA_521:
+ hostkey_method = hostkey_method_ssh_ecdsa_521;
+ break;
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_384
+ case LIBSSH2_KNOWNHOST_KEY_ECDSA_384:
+ hostkey_method = hostkey_method_ssh_ecdsa_384;
+ break;
+#endif
+#ifdef LIBSSH2_KNOWNHOST_KEY_ECDSA_256
+ case LIBSSH2_KNOWNHOST_KEY_ECDSA_256:
+ hostkey_method = hostkey_method_ssh_ecdsa_256;
+ break;
+#endif
+ case LIBSSH2_KNOWNHOST_KEY_SSHRSA:
+ hostkey_method = hostkey_method_ssh_rsa;
+ break;
+ case LIBSSH2_KNOWNHOST_KEY_SSHDSS:
+ hostkey_method = hostkey_method_ssh_dss;
+ break;
+ case LIBSSH2_KNOWNHOST_KEY_RSA1:
+ failf(data, "Found host key type RSA1 which is not supported\n");
+ return CURLE_SSH;
+ default:
+ failf(data, "Unknown host key type: %i\n",
+ (store->typemask & LIBSSH2_KNOWNHOST_KEY_MASK));
+ return CURLE_SSH;
+ }
+
+ infof(data, "Set \"%s\" as SSH hostkey type\n", hostkey_method);
+ result = libssh2_session_error_to_CURLE(
+ libssh2_session_method_pref(
+ sshc->ssh_session, LIBSSH2_METHOD_HOSTKEY, hostkey_method));
+ }
+ else {
+ infof(data, "Did not find host %s in %s\n",
+ conn->host.name, data->set.str[STRING_SSH_KNOWNHOSTS]);
+ }
+ }
+
+#endif /* HAVE_LIBSSH2_KNOWNHOST_API */
+
+ return result;
+}
+
+/*
* ssh_statemach_act() runs the SSH state machine as far as it can without
* blocking and without reaching the end. The data the pointer 'block' points
* to will be set to TRUE if the libssh2 function returns LIBSSH2_ERROR_EAGAIN
@@ -798,14 +798,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SSHPROTO *sftp_scp = data->req.p.ssh;
+ struct SSHPROTO *sftp_scp = data->req.p.ssh;
struct ssh_conn *sshc = &conn->proto.sshc;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
int rc = LIBSSH2_ERROR_NONE;
- int ssherr;
- unsigned long sftperr;
+ int ssherr;
+ unsigned long sftperr;
int seekerr = CURL_SEEKFUNC_OK;
- size_t readdir_len;
+ size_t readdir_len;
*block = 0; /* we're not blocking by default */
do {
@@ -820,13 +820,13 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
non-blocking */
libssh2_session_set_blocking(sshc->ssh_session, 0);
- result = ssh_force_knownhost_key_type(conn);
- if(result) {
- state(conn, SSH_SESSION_FREE);
- sshc->actualcode = result;
- break;
- }
-
+ result = ssh_force_knownhost_key_type(conn);
+ if(result) {
+ state(conn, SSH_SESSION_FREE);
+ sshc->actualcode = result;
+ break;
+ }
+
state(conn, SSH_S_STARTUP);
/* FALLTHROUGH */
@@ -882,12 +882,12 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_AUTH_DONE);
break;
}
- ssherr = libssh2_session_last_errno(sshc->ssh_session);
- if(ssherr == LIBSSH2_ERROR_EAGAIN)
+ ssherr = libssh2_session_last_errno(sshc->ssh_session);
+ if(ssherr == LIBSSH2_ERROR_EAGAIN)
rc = LIBSSH2_ERROR_EAGAIN;
else {
state(conn, SSH_SESSION_FREE);
- sshc->actualcode = libssh2_session_error_to_CURLE(ssherr);
+ sshc->actualcode = libssh2_session_error_to_CURLE(ssherr);
}
break;
}
@@ -1257,16 +1257,16 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
else {
/* Return the error type */
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
- if(sftperr)
- result = sftp_libssh2_error_to_CURLE(sftperr);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ if(sftperr)
+ result = sftp_libssh2_error_to_CURLE(sftperr);
else
/* in this case, the error wasn't in the SFTP level but for example
a time-out or similar */
result = CURLE_SSH;
sshc->actualcode = result;
- DEBUGF(infof(data, "error = %lu makes libcurl = %d\n",
- sftperr, (int)result));
+ DEBUGF(infof(data, "error = %lu makes libcurl = %d\n",
+ sftperr, (int)result));
state(conn, SSH_STOP);
break;
}
@@ -1343,9 +1343,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->nextstate = SSH_NO_STATE;
break;
}
- Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"PWD\n", 4);
- Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
-
+ Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"PWD\n", 4);
+ Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp));
+
/* this sends an FTP-like "header" to the header callback so that the
current directory can be read very similar to how it is read when
using ordinary FTP. */
@@ -1367,8 +1367,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
cp = strchr(cmd, ' ');
if(cp == NULL) {
- failf(data, "Syntax error command '%s'. Missing parameter!",
- cmd);
+ failf(data, "Syntax error command '%s'. Missing parameter!",
+ cmd);
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1384,7 +1384,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(result == CURLE_OUT_OF_MEMORY)
failf(data, "Out of memory");
else
- failf(data, "Syntax error: Bad first parameter to '%s'", cmd);
+ failf(data, "Syntax error: Bad first parameter to '%s'", cmd);
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = result;
@@ -1399,9 +1399,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
if(strncasecompare(cmd, "chgrp ", 6) ||
strncasecompare(cmd, "chmod ", 6) ||
- strncasecompare(cmd, "chown ", 6) ||
- strncasecompare(cmd, "atime ", 6) ||
- strncasecompare(cmd, "mtime ", 6)) {
+ strncasecompare(cmd, "chown ", 6) ||
+ strncasecompare(cmd, "atime ", 6) ||
+ strncasecompare(cmd, "mtime ", 6)) {
/* attribute change */
/* sshc->quote_path1 contains the mode to set */
@@ -1411,7 +1411,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(result == CURLE_OUT_OF_MEMORY)
failf(data, "Out of memory");
else
- failf(data, "Syntax error in %s: Bad second parameter", cmd);
+ failf(data, "Syntax error in %s: Bad second parameter", cmd);
Curl_safefree(sshc->quote_path1);
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
@@ -1542,11 +1542,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
failf(data, "Attempt to get SFTP stats failed: %s",
- sftp_libssh2_strerror(sftperr));
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1598,34 +1598,34 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
}
- else if(strncasecompare(cmd, "atime", 5)) {
- time_t date = Curl_getdate_capped(sshc->quote_path1);
- if(date == -1) {
- Curl_safefree(sshc->quote_path1);
- Curl_safefree(sshc->quote_path2);
- failf(data, "Syntax error: incorrect access date format");
- state(conn, SSH_SFTP_CLOSE);
- sshc->nextstate = SSH_NO_STATE;
- sshc->actualcode = CURLE_QUOTE_ERROR;
- break;
- }
- sshc->quote_attrs.atime = (unsigned long)date;
- sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
- }
- else if(strncasecompare(cmd, "mtime", 5)) {
- time_t date = Curl_getdate_capped(sshc->quote_path1);
- if(date == -1) {
- Curl_safefree(sshc->quote_path1);
- Curl_safefree(sshc->quote_path2);
- failf(data, "Syntax error: incorrect modification date format");
- state(conn, SSH_SFTP_CLOSE);
- sshc->nextstate = SSH_NO_STATE;
- sshc->actualcode = CURLE_QUOTE_ERROR;
- break;
- }
- sshc->quote_attrs.mtime = (unsigned long)date;
- sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
- }
+ else if(strncasecompare(cmd, "atime", 5)) {
+ time_t date = Curl_getdate_capped(sshc->quote_path1);
+ if(date == -1) {
+ Curl_safefree(sshc->quote_path1);
+ Curl_safefree(sshc->quote_path2);
+ failf(data, "Syntax error: incorrect access date format");
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->nextstate = SSH_NO_STATE;
+ sshc->actualcode = CURLE_QUOTE_ERROR;
+ break;
+ }
+ sshc->quote_attrs.atime = (unsigned long)date;
+ sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
+ }
+ else if(strncasecompare(cmd, "mtime", 5)) {
+ time_t date = Curl_getdate_capped(sshc->quote_path1);
+ if(date == -1) {
+ Curl_safefree(sshc->quote_path1);
+ Curl_safefree(sshc->quote_path2);
+ failf(data, "Syntax error: incorrect modification date format");
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->nextstate = SSH_NO_STATE;
+ sshc->actualcode = CURLE_QUOTE_ERROR;
+ break;
+ }
+ sshc->quote_attrs.mtime = (unsigned long)date;
+ sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
+ }
/* Now send the completed structure... */
state(conn, SSH_SFTP_QUOTE_SETSTAT);
@@ -1641,11 +1641,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
failf(data, "Attempt to set SFTP stats failed: %s",
- sftp_libssh2_strerror(sftperr));
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1664,11 +1664,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
failf(data, "symlink command failed: %s",
- sftp_libssh2_strerror(sftperr));
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1685,10 +1685,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
- failf(data, "mkdir command failed: %s",
- sftp_libssh2_strerror(sftperr));
+ failf(data, "mkdir command failed: %s",
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1710,11 +1710,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
- failf(data, "rename command failed: %s",
- sftp_libssh2_strerror(sftperr));
+ failf(data, "rename command failed: %s",
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1730,10 +1730,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
- failf(data, "rmdir command failed: %s",
- sftp_libssh2_strerror(sftperr));
+ failf(data, "rmdir command failed: %s",
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1749,9 +1749,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
- failf(data, "rm command failed: %s", sftp_libssh2_strerror(sftperr));
+ failf(data, "rm command failed: %s", sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1772,10 +1772,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc != 0 && !sshc->acceptfail) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
- failf(data, "statvfs command failed: %s",
- sftp_libssh2_strerror(sftperr));
+ failf(data, "statvfs command failed: %s",
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR;
@@ -1912,21 +1912,21 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc)
/* only when there was an SFTP protocol error can we extract
the sftp error! */
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
else
- sftperr = LIBSSH2_FX_OK; /* not an sftp error at all */
+ sftperr = LIBSSH2_FX_OK; /* not an sftp error at all */
if(sshc->secondCreateDirs) {
state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = sftperr != LIBSSH2_FX_OK ?
- sftp_libssh2_error_to_CURLE(sftperr):CURLE_SSH;
+ sshc->actualcode = sftperr != LIBSSH2_FX_OK ?
+ sftp_libssh2_error_to_CURLE(sftperr):CURLE_SSH;
failf(data, "Creating the dir/file failed: %s",
- sftp_libssh2_strerror(sftperr));
+ sftp_libssh2_strerror(sftperr));
break;
}
- if(((sftperr == LIBSSH2_FX_NO_SUCH_FILE) ||
- (sftperr == LIBSSH2_FX_FAILURE) ||
- (sftperr == LIBSSH2_FX_NO_SUCH_PATH)) &&
+ if(((sftperr == LIBSSH2_FX_NO_SUCH_FILE) ||
+ (sftperr == LIBSSH2_FX_FAILURE) ||
+ (sftperr == LIBSSH2_FX_NO_SUCH_PATH)) &&
(data->set.ftp_create_missing_dirs &&
(strlen(sftp_scp->path) > 1))) {
/* try to create the path remotely */
@@ -1936,19 +1936,19 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = sftperr != LIBSSH2_FX_OK ?
- sftp_libssh2_error_to_CURLE(sftperr):CURLE_SSH;
+ sshc->actualcode = sftperr != LIBSSH2_FX_OK ?
+ sftp_libssh2_error_to_CURLE(sftperr):CURLE_SSH;
if(!sshc->actualcode) {
- /* Sometimes, for some reason libssh2_sftp_last_error() returns zero
- even though libssh2_sftp_open() failed previously! We need to
- work around that! */
+ /* Sometimes, for some reason libssh2_sftp_last_error() returns zero
+ even though libssh2_sftp_open() failed previously! We need to
+ work around that! */
sshc->actualcode = CURLE_SSH;
- sftperr = LIBSSH2_FX_OK;
+ sftperr = LIBSSH2_FX_OK;
}
- failf(data, "Upload failed: %s (%lu/%d)",
- sftperr != LIBSSH2_FX_OK ?
- sftp_libssh2_strerror(sftperr):"ssh error",
- sftperr, rc);
+ failf(data, "Upload failed: %s (%lu/%d)",
+ sftperr != LIBSSH2_FX_OK ?
+ sftp_libssh2_strerror(sftperr):"ssh error",
+ sftperr, rc);
break;
}
@@ -2075,11 +2075,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
* permission was denied (creation might succeed further down the
* path) - retry on unspecific FAILURE also
*/
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
- if((sftperr != LIBSSH2_FX_FILE_ALREADY_EXISTS) &&
- (sftperr != LIBSSH2_FX_FAILURE) &&
- (sftperr != LIBSSH2_FX_PERMISSION_DENIED)) {
- result = sftp_libssh2_error_to_CURLE(sftperr);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ if((sftperr != LIBSSH2_FX_FILE_ALREADY_EXISTS) &&
+ (sftperr != LIBSSH2_FX_FAILURE) &&
+ (sftperr != LIBSSH2_FX_PERMISSION_DENIED)) {
+ result = sftp_libssh2_error_to_CURLE(sftperr);
state(conn, SSH_SFTP_CLOSE);
sshc->actualcode = result?result:CURLE_SSH;
break;
@@ -2111,11 +2111,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
failf(data, "Could not open directory for reading: %s",
- sftp_libssh2_strerror(sftperr));
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
- result = sftp_libssh2_error_to_CURLE(sftperr);
+ result = sftp_libssh2_error_to_CURLE(sftperr);
sshc->actualcode = result?result:CURLE_SSH;
break;
}
@@ -2132,7 +2132,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = CURLE_OUT_OF_MEMORY;
break;
}
- Curl_dyn_init(&sshc->readdir, PATH_MAX * 2);
+ Curl_dyn_init(&sshc->readdir, PATH_MAX * 2);
state(conn, SSH_SFTP_READDIR);
break;
@@ -2147,49 +2147,49 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc > 0) {
- readdir_len = (size_t) rc;
- sshc->readdir_filename[readdir_len] = '\0';
+ readdir_len = (size_t) rc;
+ sshc->readdir_filename[readdir_len] = '\0';
if(data->set.ftp_list_only) {
result = Curl_client_write(conn, CLIENTWRITE_BODY,
- sshc->readdir_filename,
- readdir_len);
- if(!result)
- result = Curl_client_write(conn, CLIENTWRITE_BODY,
- (char *)"\n", 1);
+ sshc->readdir_filename,
+ readdir_len);
+ if(!result)
+ result = Curl_client_write(conn, CLIENTWRITE_BODY,
+ (char *)"\n", 1);
if(result) {
state(conn, SSH_STOP);
break;
}
/* since this counts what we send to the client, we include the
newline in this counter */
- data->req.bytecount += readdir_len + 1;
+ data->req.bytecount += readdir_len + 1;
/* output debug output if that is requested */
- Curl_debug(data, CURLINFO_DATA_IN, sshc->readdir_filename,
- readdir_len);
- Curl_debug(data, CURLINFO_DATA_IN, (char *)"\n", 1);
+ Curl_debug(data, CURLINFO_DATA_IN, sshc->readdir_filename,
+ readdir_len);
+ Curl_debug(data, CURLINFO_DATA_IN, (char *)"\n", 1);
}
else {
- result = Curl_dyn_add(&sshc->readdir, sshc->readdir_longentry);
-
- if(!result) {
- if((sshc->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) &&
- ((sshc->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) ==
- LIBSSH2_SFTP_S_IFLNK)) {
- Curl_dyn_init(&sshc->readdir_link, PATH_MAX);
- result = Curl_dyn_add(&sshc->readdir_link, sftp_scp->path);
- state(conn, SSH_SFTP_READDIR_LINK);
- if(!result)
- break;
- }
- else {
- state(conn, SSH_SFTP_READDIR_BOTTOM);
+ result = Curl_dyn_add(&sshc->readdir, sshc->readdir_longentry);
+
+ if(!result) {
+ if((sshc->readdir_attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) &&
+ ((sshc->readdir_attrs.permissions & LIBSSH2_SFTP_S_IFMT) ==
+ LIBSSH2_SFTP_S_IFLNK)) {
+ Curl_dyn_init(&sshc->readdir_link, PATH_MAX);
+ result = Curl_dyn_add(&sshc->readdir_link, sftp_scp->path);
+ state(conn, SSH_SFTP_READDIR_LINK);
+ if(!result)
+ break;
+ }
+ else {
+ state(conn, SSH_SFTP_READDIR_BOTTOM);
break;
}
}
- sshc->actualcode = result;
- state(conn, SSH_SFTP_CLOSE);
+ sshc->actualcode = result;
+ state(conn, SSH_SFTP_CLOSE);
break;
}
}
@@ -2200,11 +2200,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
else if(rc < 0) {
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
- result = sftp_libssh2_error_to_CURLE(sftperr);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ result = sftp_libssh2_error_to_CURLE(sftperr);
sshc->actualcode = result?result:CURLE_SSH;
failf(data, "Could not open remote file for reading: %s :: %d",
- sftp_libssh2_strerror(sftperr),
+ sftp_libssh2_strerror(sftperr),
libssh2_session_last_errno(sshc->ssh_session));
Curl_safefree(sshc->readdir_filename);
Curl_safefree(sshc->readdir_longentry);
@@ -2216,25 +2216,25 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
case SSH_SFTP_READDIR_LINK:
rc =
libssh2_sftp_symlink_ex(sshc->sftp_session,
- Curl_dyn_ptr(&sshc->readdir_link),
- (int)Curl_dyn_len(&sshc->readdir_link),
+ Curl_dyn_ptr(&sshc->readdir_link),
+ (int)Curl_dyn_len(&sshc->readdir_link),
sshc->readdir_filename,
PATH_MAX, LIBSSH2_SFTP_READLINK);
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- readdir_len = (size_t) rc;
- Curl_dyn_free(&sshc->readdir_link);
+ readdir_len = (size_t) rc;
+ Curl_dyn_free(&sshc->readdir_link);
- /* append filename and extra output */
- result = Curl_dyn_addf(&sshc->readdir, " -> %s", sshc->readdir_filename);
-
- if(result) {
+ /* append filename and extra output */
+ result = Curl_dyn_addf(&sshc->readdir, " -> %s", sshc->readdir_filename);
+
+ if(result) {
sshc->readdir_line = NULL;
Curl_safefree(sshc->readdir_filename);
Curl_safefree(sshc->readdir_longentry);
state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = result;
+ sshc->actualcode = result;
break;
}
@@ -2242,27 +2242,27 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
case SSH_SFTP_READDIR_BOTTOM:
- result = Curl_dyn_addn(&sshc->readdir, "\n", 1);
- if(!result)
- result = Curl_client_write(conn, CLIENTWRITE_BODY,
- Curl_dyn_ptr(&sshc->readdir),
- Curl_dyn_len(&sshc->readdir));
+ result = Curl_dyn_addn(&sshc->readdir, "\n", 1);
+ if(!result)
+ result = Curl_client_write(conn, CLIENTWRITE_BODY,
+ Curl_dyn_ptr(&sshc->readdir),
+ Curl_dyn_len(&sshc->readdir));
if(!result) {
/* output debug output if that is requested */
- Curl_debug(data, CURLINFO_DATA_IN,
- Curl_dyn_ptr(&sshc->readdir),
- Curl_dyn_len(&sshc->readdir));
- data->req.bytecount += Curl_dyn_len(&sshc->readdir);
+ Curl_debug(data, CURLINFO_DATA_IN,
+ Curl_dyn_ptr(&sshc->readdir),
+ Curl_dyn_len(&sshc->readdir));
+ data->req.bytecount += Curl_dyn_len(&sshc->readdir);
}
if(result) {
- Curl_dyn_free(&sshc->readdir);
+ Curl_dyn_free(&sshc->readdir);
state(conn, SSH_STOP);
}
- else {
- Curl_dyn_reset(&sshc->readdir);
+ else {
+ Curl_dyn_reset(&sshc->readdir);
state(conn, SSH_SFTP_READDIR);
- }
+ }
break;
case SSH_SFTP_READDIR_DONE:
@@ -2295,11 +2295,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
- sftperr = libssh2_sftp_last_error(sshc->sftp_session);
+ sftperr = libssh2_sftp_last_error(sshc->sftp_session);
failf(data, "Could not open remote file for reading: %s",
- sftp_libssh2_strerror(sftperr));
+ sftp_libssh2_strerror(sftperr));
state(conn, SSH_SFTP_CLOSE);
- result = sftp_libssh2_error_to_CURLE(sftperr);
+ result = sftp_libssh2_error_to_CURLE(sftperr);
sshc->actualcode = result?result:CURLE_SSH;
break;
}
@@ -2564,9 +2564,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
/* upload data */
- data->req.size = data->state.infilesize;
- Curl_pgrsSetUploadSize(data, data->state.infilesize);
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ data->req.size = data->state.infilesize;
+ Curl_pgrsSetUploadSize(data, data->state.infilesize);
+ Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
/* not set by Curl_setup_transfer to preserve keepon bits */
conn->sockfd = conn->writesockfd;
@@ -2636,7 +2636,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* download data */
bytecount = (curl_off_t)sb.st_size;
- data->req.maxdownload = (curl_off_t)sb.st_size;
+ data->req.maxdownload = (curl_off_t)sb.st_size;
Curl_setup_transfer(data, FIRSTSOCKET, bytecount, FALSE, -1);
/* not set by Curl_setup_transfer to preserve keepon bits */
@@ -2843,7 +2843,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
Curl_safefree(sshc->readdir_filename);
Curl_safefree(sshc->readdir_longentry);
Curl_safefree(sshc->readdir_line);
- Curl_dyn_free(&sshc->readdir);
+ Curl_dyn_free(&sshc->readdir);
/* the code we are about to return */
result = sshc->actualcode;
@@ -2948,7 +2948,7 @@ static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done)
}
static CURLcode ssh_block_statemach(struct connectdata *conn,
- bool duringconnect)
+ bool duringconnect)
{
struct ssh_conn *sshc = &conn->proto.sshc;
CURLcode result = CURLE_OK;
@@ -2963,20 +2963,20 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
if(result)
break;
- if(Curl_pgrsUpdate(conn))
- return CURLE_ABORTED_BY_CALLBACK;
+ if(Curl_pgrsUpdate(conn))
+ return CURLE_ABORTED_BY_CALLBACK;
- result = Curl_speedcheck(data, now);
- if(result)
- break;
+ result = Curl_speedcheck(data, now);
+ if(result)
+ break;
- left = Curl_timeleft(data, NULL, duringconnect);
- if(left < 0) {
- failf(data, "Operation timed out");
- return CURLE_OPERATION_TIMEDOUT;
+ left = Curl_timeleft(data, NULL, duringconnect);
+ if(left < 0) {
+ failf(data, "Operation timed out");
+ return CURLE_OPERATION_TIMEDOUT;
}
- if(block) {
+ if(block) {
int dir = libssh2_session_block_directions(sshc->ssh_session);
curl_socket_t sock = conn->sock[FIRSTSOCKET];
curl_socket_t fd_read = CURL_SOCKET_BAD;
@@ -2987,7 +2987,7 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
fd_write = sock;
/* wait for the socket to become ready */
(void)Curl_socket_check(fd_read, CURL_SOCKET_BAD, fd_write,
- left>1000?1000:left);
+ left>1000?1000:left);
}
}
@@ -3001,7 +3001,7 @@ static CURLcode ssh_setup_connection(struct connectdata *conn)
{
struct SSHPROTO *ssh;
- conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
if(!ssh)
return CURLE_OUT_OF_MEMORY;
@@ -3011,54 +3011,54 @@ static CURLcode ssh_setup_connection(struct connectdata *conn)
static Curl_recv scp_recv, sftp_recv;
static Curl_send scp_send, sftp_send;
-#ifndef CURL_DISABLE_PROXY
-static ssize_t ssh_tls_recv(libssh2_socket_t sock, void *buffer,
- size_t length, int flags, void **abstract)
-{
- struct connectdata *conn = (struct connectdata *)*abstract;
- ssize_t nread;
- CURLcode result;
- Curl_recv *backup = conn->recv[0];
- struct ssh_conn *ssh = &conn->proto.sshc;
- (void)flags;
-
- /* swap in the TLS reader function for this call only, and then swap back
- the SSH one again */
- conn->recv[0] = ssh->tls_recv;
- result = Curl_read(conn, sock, buffer, length, &nread);
- conn->recv[0] = backup;
- if(result == CURLE_AGAIN)
- return -EAGAIN; /* magic return code for libssh2 */
- else if(result)
- return -1; /* generic error */
- Curl_debug(conn->data, CURLINFO_DATA_IN, (char *)buffer, (size_t)nread);
- return nread;
-}
-
-static ssize_t ssh_tls_send(libssh2_socket_t sock, const void *buffer,
- size_t length, int flags, void **abstract)
-{
- struct connectdata *conn = (struct connectdata *)*abstract;
- ssize_t nwrite;
- CURLcode result;
- Curl_send *backup = conn->send[0];
- struct ssh_conn *ssh = &conn->proto.sshc;
- (void)flags;
-
- /* swap in the TLS writer function for this call only, and then swap back
- the SSH one again */
- conn->send[0] = ssh->tls_send;
- result = Curl_write(conn, sock, buffer, length, &nwrite);
- conn->send[0] = backup;
- if(result == CURLE_AGAIN)
- return -EAGAIN; /* magic return code for libssh2 */
- else if(result)
- return -1; /* error */
- Curl_debug(conn->data, CURLINFO_DATA_OUT, (char *)buffer, (size_t)nwrite);
- return nwrite;
-}
-#endif
-
+#ifndef CURL_DISABLE_PROXY
+static ssize_t ssh_tls_recv(libssh2_socket_t sock, void *buffer,
+ size_t length, int flags, void **abstract)
+{
+ struct connectdata *conn = (struct connectdata *)*abstract;
+ ssize_t nread;
+ CURLcode result;
+ Curl_recv *backup = conn->recv[0];
+ struct ssh_conn *ssh = &conn->proto.sshc;
+ (void)flags;
+
+ /* swap in the TLS reader function for this call only, and then swap back
+ the SSH one again */
+ conn->recv[0] = ssh->tls_recv;
+ result = Curl_read(conn, sock, buffer, length, &nread);
+ conn->recv[0] = backup;
+ if(result == CURLE_AGAIN)
+ return -EAGAIN; /* magic return code for libssh2 */
+ else if(result)
+ return -1; /* generic error */
+ Curl_debug(conn->data, CURLINFO_DATA_IN, (char *)buffer, (size_t)nread);
+ return nread;
+}
+
+static ssize_t ssh_tls_send(libssh2_socket_t sock, const void *buffer,
+ size_t length, int flags, void **abstract)
+{
+ struct connectdata *conn = (struct connectdata *)*abstract;
+ ssize_t nwrite;
+ CURLcode result;
+ Curl_send *backup = conn->send[0];
+ struct ssh_conn *ssh = &conn->proto.sshc;
+ (void)flags;
+
+ /* swap in the TLS writer function for this call only, and then swap back
+ the SSH one again */
+ conn->send[0] = ssh->tls_send;
+ result = Curl_write(conn, sock, buffer, length, &nwrite);
+ conn->send[0] = backup;
+ if(result == CURLE_AGAIN)
+ return -EAGAIN; /* magic return code for libssh2 */
+ else if(result)
+ return -1; /* error */
+ Curl_debug(conn->data, CURLINFO_DATA_OUT, (char *)buffer, (size_t)nwrite);
+ return nwrite;
+}
+#endif
+
/*
* Curl_ssh_connect() gets called from Curl_protocol_connect() to allow us to
* do protocol-specific actions at connect-time.
@@ -3073,7 +3073,7 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
struct Curl_easy *data = conn->data;
/* initialize per-handle data if not already */
- if(!data->req.p.ssh)
+ if(!data->req.p.ssh)
ssh_setup_connection(conn);
/* We default to persistent connections. We set this already in this connect
@@ -3100,61 +3100,61 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
return CURLE_FAILED_INIT;
}
-#ifndef CURL_DISABLE_PROXY
- if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) {
- /*
- * This crazy union dance is here to avoid assigning a void pointer a
- * function pointer as it is invalid C. The problem is of course that
- * libssh2 has such an API...
- */
- union receive {
- void *recvp;
- ssize_t (*recvptr)(libssh2_socket_t, void *, size_t, int, void **);
- };
- union transfer {
- void *sendp;
- ssize_t (*sendptr)(libssh2_socket_t, const void *, size_t, int, void **);
- };
- union receive sshrecv;
- union transfer sshsend;
-
- sshrecv.recvptr = ssh_tls_recv;
- sshsend.sendptr = ssh_tls_send;
-
- infof(data, "Uses HTTPS proxy!\n");
- /*
- Setup libssh2 callbacks to make it read/write TLS from the socket.
-
- ssize_t
- recvcb(libssh2_socket_t sock, void *buffer, size_t length,
- int flags, void **abstract);
-
- ssize_t
- sendcb(libssh2_socket_t sock, const void *buffer, size_t length,
- int flags, void **abstract);
-
- */
- libssh2_session_callback_set(ssh->ssh_session,
- LIBSSH2_CALLBACK_RECV, sshrecv.recvp);
- libssh2_session_callback_set(ssh->ssh_session,
- LIBSSH2_CALLBACK_SEND, sshsend.sendp);
-
- /* Store the underlying TLS recv/send function pointers to be used when
- reading from the proxy */
- ssh->tls_recv = conn->recv[FIRSTSOCKET];
- ssh->tls_send = conn->send[FIRSTSOCKET];
- }
-
-#endif /* CURL_DISABLE_PROXY */
- if(conn->handler->protocol & CURLPROTO_SCP) {
- conn->recv[FIRSTSOCKET] = scp_recv;
- conn->send[FIRSTSOCKET] = scp_send;
- }
- else {
- conn->recv[FIRSTSOCKET] = sftp_recv;
- conn->send[FIRSTSOCKET] = sftp_send;
- }
-
+#ifndef CURL_DISABLE_PROXY
+ if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) {
+ /*
+ * This crazy union dance is here to avoid assigning a void pointer a
+ * function pointer as it is invalid C. The problem is of course that
+ * libssh2 has such an API...
+ */
+ union receive {
+ void *recvp;
+ ssize_t (*recvptr)(libssh2_socket_t, void *, size_t, int, void **);
+ };
+ union transfer {
+ void *sendp;
+ ssize_t (*sendptr)(libssh2_socket_t, const void *, size_t, int, void **);
+ };
+ union receive sshrecv;
+ union transfer sshsend;
+
+ sshrecv.recvptr = ssh_tls_recv;
+ sshsend.sendptr = ssh_tls_send;
+
+ infof(data, "Uses HTTPS proxy!\n");
+ /*
+ Setup libssh2 callbacks to make it read/write TLS from the socket.
+
+ ssize_t
+ recvcb(libssh2_socket_t sock, void *buffer, size_t length,
+ int flags, void **abstract);
+
+ ssize_t
+ sendcb(libssh2_socket_t sock, const void *buffer, size_t length,
+ int flags, void **abstract);
+
+ */
+ libssh2_session_callback_set(ssh->ssh_session,
+ LIBSSH2_CALLBACK_RECV, sshrecv.recvp);
+ libssh2_session_callback_set(ssh->ssh_session,
+ LIBSSH2_CALLBACK_SEND, sshsend.sendp);
+
+ /* Store the underlying TLS recv/send function pointers to be used when
+ reading from the proxy */
+ ssh->tls_recv = conn->recv[FIRSTSOCKET];
+ ssh->tls_send = conn->send[FIRSTSOCKET];
+ }
+
+#endif /* CURL_DISABLE_PROXY */
+ if(conn->handler->protocol & CURLPROTO_SCP) {
+ conn->recv[FIRSTSOCKET] = scp_recv;
+ conn->send[FIRSTSOCKET] = scp_send;
+ }
+ else {
+ conn->recv[FIRSTSOCKET] = sftp_recv;
+ conn->send[FIRSTSOCKET] = sftp_send;
+ }
+
if(data->set.ssh_compression) {
#if LIBSSH2_VERSION_NUM >= 0x010208
if(libssh2_session_flag(ssh->ssh_session, LIBSSH2_FLAG_COMPRESS, 1) < 0)
@@ -3288,7 +3288,7 @@ static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection)
state(conn, SSH_SESSION_DISCONNECT);
- result = ssh_block_statemach(conn, FALSE);
+ result = ssh_block_statemach(conn, FALSE);
}
return result;
@@ -3299,7 +3299,7 @@ static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection)
static CURLcode ssh_done(struct connectdata *conn, CURLcode status)
{
CURLcode result = CURLE_OK;
- struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
+ struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
if(!status) {
/* run the state-machine */
@@ -3437,7 +3437,7 @@ static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection)
if(conn->proto.sshc.ssh_session) {
/* only if there's a session still around to use! */
state(conn, SSH_SFTP_SHUTDOWN);
- result = ssh_block_statemach(conn, FALSE);
+ result = ssh_block_statemach(conn, FALSE);
}
DEBUGF(infof(conn->data, "SSH DISCONNECT is done\n"));
@@ -3512,7 +3512,7 @@ static ssize_t sftp_recv(struct connectdata *conn, int sockindex,
return nread;
}
-static const char *sftp_libssh2_strerror(unsigned long err)
+static const char *sftp_libssh2_strerror(unsigned long err)
{
switch(err) {
case LIBSSH2_FX_NO_SUCH_FILE:
diff --git a/contrib/libs/curl/lib/vssh/ssh.h b/contrib/libs/curl/lib/vssh/ssh.h
index ead9d65a07..00a70bac27 100644
--- a/contrib/libs/curl/lib/vssh/ssh.h
+++ b/contrib/libs/curl/lib/vssh/ssh.h
@@ -1,270 +1,270 @@
-#ifndef HEADER_CURL_SSH_H
-#define HEADER_CURL_SSH_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
-
-#if defined(HAVE_LIBSSH2_H)
-#error #include <libssh2.h>
-#error #include <libssh2_sftp.h>
-#elif defined(HAVE_LIBSSH_LIBSSH_H)
-#error #include <libssh/libssh.h>
-#error #include <libssh/sftp.h>
-#elif defined(USE_WOLFSSH)
-#error #include <wolfssh/ssh.h>
-#error #include <wolfssh/wolfsftp.h>
-#endif
-
-/****************************************************************************
- * SSH unique setup
- ***************************************************************************/
-typedef enum {
- SSH_NO_STATE = -1, /* Used for "nextState" so say there is none */
- SSH_STOP = 0, /* do nothing state, stops the state machine */
-
- SSH_INIT, /* First state in SSH-CONNECT */
- SSH_S_STARTUP, /* Session startup */
- SSH_HOSTKEY, /* verify hostkey */
- SSH_AUTHLIST,
- SSH_AUTH_PKEY_INIT,
- SSH_AUTH_PKEY,
- SSH_AUTH_PASS_INIT,
- SSH_AUTH_PASS,
- SSH_AUTH_AGENT_INIT, /* initialize then wait for connection to agent */
- SSH_AUTH_AGENT_LIST, /* ask for list then wait for entire list to come */
- SSH_AUTH_AGENT, /* attempt one key at a time */
- SSH_AUTH_HOST_INIT,
- SSH_AUTH_HOST,
- SSH_AUTH_KEY_INIT,
- SSH_AUTH_KEY,
- SSH_AUTH_GSSAPI,
- SSH_AUTH_DONE,
- SSH_SFTP_INIT,
- SSH_SFTP_REALPATH, /* Last state in SSH-CONNECT */
-
- SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */
- SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */
- SSH_SFTP_QUOTE,
- SSH_SFTP_NEXT_QUOTE,
- SSH_SFTP_QUOTE_STAT,
- SSH_SFTP_QUOTE_SETSTAT,
- SSH_SFTP_QUOTE_SYMLINK,
- SSH_SFTP_QUOTE_MKDIR,
- SSH_SFTP_QUOTE_RENAME,
- SSH_SFTP_QUOTE_RMDIR,
- SSH_SFTP_QUOTE_UNLINK,
- SSH_SFTP_QUOTE_STATVFS,
- SSH_SFTP_GETINFO,
- SSH_SFTP_FILETIME,
- SSH_SFTP_TRANS_INIT,
- SSH_SFTP_UPLOAD_INIT,
- SSH_SFTP_CREATE_DIRS_INIT,
- SSH_SFTP_CREATE_DIRS,
- SSH_SFTP_CREATE_DIRS_MKDIR,
- SSH_SFTP_READDIR_INIT,
- SSH_SFTP_READDIR,
- SSH_SFTP_READDIR_LINK,
- SSH_SFTP_READDIR_BOTTOM,
- SSH_SFTP_READDIR_DONE,
- SSH_SFTP_DOWNLOAD_INIT,
- SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */
- SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */
- SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */
- SSH_SCP_TRANS_INIT, /* First state in SCP-DO */
- SSH_SCP_UPLOAD_INIT,
- SSH_SCP_DOWNLOAD_INIT,
- SSH_SCP_DOWNLOAD,
- SSH_SCP_DONE,
- SSH_SCP_SEND_EOF,
- SSH_SCP_WAIT_EOF,
- SSH_SCP_WAIT_CLOSE,
- SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */
- SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */
- SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */
- SSH_QUIT,
- SSH_LAST /* never used */
-} sshstate;
-
-/* this struct is used in the HandleData struct which is part of the
- Curl_easy, which means this is used on a per-easy handle basis.
- Everything that is strictly related to a connection is banned from this
- struct. */
-struct SSHPROTO {
- char *path; /* the path we operate on */
-};
-
-/* ssh_conn is used for struct connection-oriented data in the connectdata
- struct */
-struct ssh_conn {
- const char *authlist; /* List of auth. methods, managed by libssh2 */
-
- /* common */
- const char *passphrase; /* pass-phrase to use */
- char *rsa_pub; /* path name */
- char *rsa; /* path name */
- bool authed; /* the connection has been authenticated fine */
- sshstate state; /* always use ssh.c:state() to change state! */
- sshstate nextstate; /* the state to goto after stopping */
- CURLcode actualcode; /* the actual error code */
- struct curl_slist *quote_item; /* for the quote option */
- char *quote_path1; /* two generic pointers for the QUOTE stuff */
- char *quote_path2;
-
- bool acceptfail; /* used by the SFTP_QUOTE (continue if
- quote command fails) */
- char *homedir; /* when doing SFTP we figure out home dir in the
- connect phase */
- char *readdir_line;
- /* end of READDIR stuff */
-
- int secondCreateDirs; /* counter use by the code to see if the
- second attempt has been made to change
- to/create a directory */
- char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
-
- int orig_waitfor; /* default READ/WRITE bits wait for */
-
-#if defined(USE_LIBSSH)
- char *readdir_linkPath;
- size_t readdir_len, readdir_totalLen, readdir_currLen;
-/* our variables */
- unsigned kbd_state; /* 0 or 1 */
- ssh_key privkey;
- ssh_key pubkey;
- int auth_methods;
- ssh_session ssh_session;
- ssh_scp scp_session;
- sftp_session sftp_session;
- sftp_file sftp_file;
- sftp_dir sftp_dir;
-
- unsigned sftp_recv_state; /* 0 or 1 */
- int sftp_file_index; /* for async read */
- sftp_attributes readdir_attrs; /* used by the SFTP readdir actions */
- sftp_attributes readdir_link_attrs; /* used by the SFTP readdir actions */
- sftp_attributes quote_attrs; /* used by the SFTP_QUOTE state */
-
- const char *readdir_filename; /* points within readdir_attrs */
- const char *readdir_longentry;
- char *readdir_tmp;
-#elif defined(USE_LIBSSH2)
- struct dynbuf readdir_link;
- struct dynbuf readdir;
- char *readdir_filename;
- char *readdir_longentry;
-
- LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */
-
- /* Here's a set of struct members used by the SFTP_READDIR state */
- LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;
- LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
- LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
- LIBSSH2_SFTP *sftp_session; /* SFTP handle */
- LIBSSH2_SFTP_HANDLE *sftp_handle;
-
-#ifndef CURL_DISABLE_PROXY
- /* for HTTPS proxy storage */
- Curl_recv *tls_recv;
- Curl_send *tls_send;
-#endif
-
-#ifdef HAVE_LIBSSH2_AGENT_API
- LIBSSH2_AGENT *ssh_agent; /* proxy to ssh-agent/pageant */
- struct libssh2_agent_publickey *sshagent_identity,
- *sshagent_prev_identity;
-#endif
-
- /* note that HAVE_LIBSSH2_KNOWNHOST_API is a define set in the libssh2.h
- header */
-#ifdef HAVE_LIBSSH2_KNOWNHOST_API
- LIBSSH2_KNOWNHOSTS *kh;
-#endif
-#elif defined(USE_WOLFSSH)
- WOLFSSH *ssh_session;
- WOLFSSH_CTX *ctx;
- word32 handleSz;
- byte handle[WOLFSSH_MAX_HANDLE];
- curl_off_t offset;
-#endif /* USE_LIBSSH */
-};
-
-#if defined(USE_LIBSSH)
-
-#define CURL_LIBSSH_VERSION ssh_version(0)
-
-#elif defined(USE_LIBSSH2)
-
-/* Feature detection based on version numbers to better work with
- non-configure platforms */
-
-#if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000)
-# error "SCP/SFTP protocols require libssh2 0.16 or later"
-#endif
-
-#if LIBSSH2_VERSION_NUM >= 0x010000
-#define HAVE_LIBSSH2_SFTP_SEEK64 1
-#endif
-
-#if LIBSSH2_VERSION_NUM >= 0x010100
-#define HAVE_LIBSSH2_VERSION 1
-#endif
-
-#if LIBSSH2_VERSION_NUM >= 0x010205
-#define HAVE_LIBSSH2_INIT 1
-#define HAVE_LIBSSH2_EXIT 1
-#endif
-
-#if LIBSSH2_VERSION_NUM >= 0x010206
-#define HAVE_LIBSSH2_KNOWNHOST_CHECKP 1
-#define HAVE_LIBSSH2_SCP_SEND64 1
-#endif
-
-#if LIBSSH2_VERSION_NUM >= 0x010208
-#define HAVE_LIBSSH2_SESSION_HANDSHAKE 1
-#endif
-
-#ifdef HAVE_LIBSSH2_VERSION
-/* get it run-time if possible */
-#define CURL_LIBSSH2_VERSION libssh2_version(0)
-#else
-/* use build-time if run-time not possible */
-#define CURL_LIBSSH2_VERSION LIBSSH2_VERSION
-#endif
-
-#endif /* USE_LIBSSH2 */
-
-#ifdef USE_SSH
-
-extern const struct Curl_handler Curl_handler_scp;
-extern const struct Curl_handler Curl_handler_sftp;
-
-/* generic SSH backend functions */
-CURLcode Curl_ssh_init(void);
-void Curl_ssh_cleanup(void);
-size_t Curl_ssh_version(char *buffer, size_t buflen);
-#else
-/* for non-SSH builds */
-#define Curl_ssh_cleanup()
-#endif
-
-#endif /* HEADER_CURL_SSH_H */
+#ifndef HEADER_CURL_SSH_H
+#define HEADER_CURL_SSH_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
+
+#if defined(HAVE_LIBSSH2_H)
+#error #include <libssh2.h>
+#error #include <libssh2_sftp.h>
+#elif defined(HAVE_LIBSSH_LIBSSH_H)
+#error #include <libssh/libssh.h>
+#error #include <libssh/sftp.h>
+#elif defined(USE_WOLFSSH)
+#error #include <wolfssh/ssh.h>
+#error #include <wolfssh/wolfsftp.h>
+#endif
+
+/****************************************************************************
+ * SSH unique setup
+ ***************************************************************************/
+typedef enum {
+ SSH_NO_STATE = -1, /* Used for "nextState" so say there is none */
+ SSH_STOP = 0, /* do nothing state, stops the state machine */
+
+ SSH_INIT, /* First state in SSH-CONNECT */
+ SSH_S_STARTUP, /* Session startup */
+ SSH_HOSTKEY, /* verify hostkey */
+ SSH_AUTHLIST,
+ SSH_AUTH_PKEY_INIT,
+ SSH_AUTH_PKEY,
+ SSH_AUTH_PASS_INIT,
+ SSH_AUTH_PASS,
+ SSH_AUTH_AGENT_INIT, /* initialize then wait for connection to agent */
+ SSH_AUTH_AGENT_LIST, /* ask for list then wait for entire list to come */
+ SSH_AUTH_AGENT, /* attempt one key at a time */
+ SSH_AUTH_HOST_INIT,
+ SSH_AUTH_HOST,
+ SSH_AUTH_KEY_INIT,
+ SSH_AUTH_KEY,
+ SSH_AUTH_GSSAPI,
+ SSH_AUTH_DONE,
+ SSH_SFTP_INIT,
+ SSH_SFTP_REALPATH, /* Last state in SSH-CONNECT */
+
+ SSH_SFTP_QUOTE_INIT, /* First state in SFTP-DO */
+ SSH_SFTP_POSTQUOTE_INIT, /* (Possibly) First state in SFTP-DONE */
+ SSH_SFTP_QUOTE,
+ SSH_SFTP_NEXT_QUOTE,
+ SSH_SFTP_QUOTE_STAT,
+ SSH_SFTP_QUOTE_SETSTAT,
+ SSH_SFTP_QUOTE_SYMLINK,
+ SSH_SFTP_QUOTE_MKDIR,
+ SSH_SFTP_QUOTE_RENAME,
+ SSH_SFTP_QUOTE_RMDIR,
+ SSH_SFTP_QUOTE_UNLINK,
+ SSH_SFTP_QUOTE_STATVFS,
+ SSH_SFTP_GETINFO,
+ SSH_SFTP_FILETIME,
+ SSH_SFTP_TRANS_INIT,
+ SSH_SFTP_UPLOAD_INIT,
+ SSH_SFTP_CREATE_DIRS_INIT,
+ SSH_SFTP_CREATE_DIRS,
+ SSH_SFTP_CREATE_DIRS_MKDIR,
+ SSH_SFTP_READDIR_INIT,
+ SSH_SFTP_READDIR,
+ SSH_SFTP_READDIR_LINK,
+ SSH_SFTP_READDIR_BOTTOM,
+ SSH_SFTP_READDIR_DONE,
+ SSH_SFTP_DOWNLOAD_INIT,
+ SSH_SFTP_DOWNLOAD_STAT, /* Last state in SFTP-DO */
+ SSH_SFTP_CLOSE, /* Last state in SFTP-DONE */
+ SSH_SFTP_SHUTDOWN, /* First state in SFTP-DISCONNECT */
+ SSH_SCP_TRANS_INIT, /* First state in SCP-DO */
+ SSH_SCP_UPLOAD_INIT,
+ SSH_SCP_DOWNLOAD_INIT,
+ SSH_SCP_DOWNLOAD,
+ SSH_SCP_DONE,
+ SSH_SCP_SEND_EOF,
+ SSH_SCP_WAIT_EOF,
+ SSH_SCP_WAIT_CLOSE,
+ SSH_SCP_CHANNEL_FREE, /* Last state in SCP-DONE */
+ SSH_SESSION_DISCONNECT, /* First state in SCP-DISCONNECT */
+ SSH_SESSION_FREE, /* Last state in SCP/SFTP-DISCONNECT */
+ SSH_QUIT,
+ SSH_LAST /* never used */
+} sshstate;
+
+/* this struct is used in the HandleData struct which is part of the
+ Curl_easy, which means this is used on a per-easy handle basis.
+ Everything that is strictly related to a connection is banned from this
+ struct. */
+struct SSHPROTO {
+ char *path; /* the path we operate on */
+};
+
+/* ssh_conn is used for struct connection-oriented data in the connectdata
+ struct */
+struct ssh_conn {
+ const char *authlist; /* List of auth. methods, managed by libssh2 */
+
+ /* common */
+ const char *passphrase; /* pass-phrase to use */
+ char *rsa_pub; /* path name */
+ char *rsa; /* path name */
+ bool authed; /* the connection has been authenticated fine */
+ sshstate state; /* always use ssh.c:state() to change state! */
+ sshstate nextstate; /* the state to goto after stopping */
+ CURLcode actualcode; /* the actual error code */
+ struct curl_slist *quote_item; /* for the quote option */
+ char *quote_path1; /* two generic pointers for the QUOTE stuff */
+ char *quote_path2;
+
+ bool acceptfail; /* used by the SFTP_QUOTE (continue if
+ quote command fails) */
+ char *homedir; /* when doing SFTP we figure out home dir in the
+ connect phase */
+ char *readdir_line;
+ /* end of READDIR stuff */
+
+ int secondCreateDirs; /* counter use by the code to see if the
+ second attempt has been made to change
+ to/create a directory */
+ char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
+
+ int orig_waitfor; /* default READ/WRITE bits wait for */
+
+#if defined(USE_LIBSSH)
+ char *readdir_linkPath;
+ size_t readdir_len, readdir_totalLen, readdir_currLen;
+/* our variables */
+ unsigned kbd_state; /* 0 or 1 */
+ ssh_key privkey;
+ ssh_key pubkey;
+ int auth_methods;
+ ssh_session ssh_session;
+ ssh_scp scp_session;
+ sftp_session sftp_session;
+ sftp_file sftp_file;
+ sftp_dir sftp_dir;
+
+ unsigned sftp_recv_state; /* 0 or 1 */
+ int sftp_file_index; /* for async read */
+ sftp_attributes readdir_attrs; /* used by the SFTP readdir actions */
+ sftp_attributes readdir_link_attrs; /* used by the SFTP readdir actions */
+ sftp_attributes quote_attrs; /* used by the SFTP_QUOTE state */
+
+ const char *readdir_filename; /* points within readdir_attrs */
+ const char *readdir_longentry;
+ char *readdir_tmp;
+#elif defined(USE_LIBSSH2)
+ struct dynbuf readdir_link;
+ struct dynbuf readdir;
+ char *readdir_filename;
+ char *readdir_longentry;
+
+ LIBSSH2_SFTP_ATTRIBUTES quote_attrs; /* used by the SFTP_QUOTE state */
+
+ /* Here's a set of struct members used by the SFTP_READDIR state */
+ LIBSSH2_SFTP_ATTRIBUTES readdir_attrs;
+ LIBSSH2_SESSION *ssh_session; /* Secure Shell session */
+ LIBSSH2_CHANNEL *ssh_channel; /* Secure Shell channel handle */
+ LIBSSH2_SFTP *sftp_session; /* SFTP handle */
+ LIBSSH2_SFTP_HANDLE *sftp_handle;
+
+#ifndef CURL_DISABLE_PROXY
+ /* for HTTPS proxy storage */
+ Curl_recv *tls_recv;
+ Curl_send *tls_send;
+#endif
+
+#ifdef HAVE_LIBSSH2_AGENT_API
+ LIBSSH2_AGENT *ssh_agent; /* proxy to ssh-agent/pageant */
+ struct libssh2_agent_publickey *sshagent_identity,
+ *sshagent_prev_identity;
+#endif
+
+ /* note that HAVE_LIBSSH2_KNOWNHOST_API is a define set in the libssh2.h
+ header */
+#ifdef HAVE_LIBSSH2_KNOWNHOST_API
+ LIBSSH2_KNOWNHOSTS *kh;
+#endif
+#elif defined(USE_WOLFSSH)
+ WOLFSSH *ssh_session;
+ WOLFSSH_CTX *ctx;
+ word32 handleSz;
+ byte handle[WOLFSSH_MAX_HANDLE];
+ curl_off_t offset;
+#endif /* USE_LIBSSH */
+};
+
+#if defined(USE_LIBSSH)
+
+#define CURL_LIBSSH_VERSION ssh_version(0)
+
+#elif defined(USE_LIBSSH2)
+
+/* Feature detection based on version numbers to better work with
+ non-configure platforms */
+
+#if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000)
+# error "SCP/SFTP protocols require libssh2 0.16 or later"
+#endif
+
+#if LIBSSH2_VERSION_NUM >= 0x010000
+#define HAVE_LIBSSH2_SFTP_SEEK64 1
+#endif
+
+#if LIBSSH2_VERSION_NUM >= 0x010100
+#define HAVE_LIBSSH2_VERSION 1
+#endif
+
+#if LIBSSH2_VERSION_NUM >= 0x010205
+#define HAVE_LIBSSH2_INIT 1
+#define HAVE_LIBSSH2_EXIT 1
+#endif
+
+#if LIBSSH2_VERSION_NUM >= 0x010206
+#define HAVE_LIBSSH2_KNOWNHOST_CHECKP 1
+#define HAVE_LIBSSH2_SCP_SEND64 1
+#endif
+
+#if LIBSSH2_VERSION_NUM >= 0x010208
+#define HAVE_LIBSSH2_SESSION_HANDSHAKE 1
+#endif
+
+#ifdef HAVE_LIBSSH2_VERSION
+/* get it run-time if possible */
+#define CURL_LIBSSH2_VERSION libssh2_version(0)
+#else
+/* use build-time if run-time not possible */
+#define CURL_LIBSSH2_VERSION LIBSSH2_VERSION
+#endif
+
+#endif /* USE_LIBSSH2 */
+
+#ifdef USE_SSH
+
+extern const struct Curl_handler Curl_handler_scp;
+extern const struct Curl_handler Curl_handler_sftp;
+
+/* generic SSH backend functions */
+CURLcode Curl_ssh_init(void);
+void Curl_ssh_cleanup(void);
+size_t Curl_ssh_version(char *buffer, size_t buflen);
+#else
+/* for non-SSH builds */
+#define Curl_ssh_cleanup()
+#endif
+
+#endif /* HEADER_CURL_SSH_H */
diff --git a/contrib/libs/curl/lib/vssh/wolfssh.c b/contrib/libs/curl/lib/vssh/wolfssh.c
index d0cb5ed360..d2bd77b513 100644
--- a/contrib/libs/curl/lib/vssh/wolfssh.c
+++ b/contrib/libs/curl/lib/vssh/wolfssh.c
@@ -1,1156 +1,1156 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
-
-#ifdef USE_WOLFSSH
-
-#include <limits.h>
-
-#error #include <wolfssh/ssh.h>
-#error #include <wolfssh/wolfsftp.h>
-#include "urldata.h"
-#include "connect.h"
-#include "sendf.h"
-#include "progress.h"
-#include "curl_path.h"
-#include "strtoofft.h"
-#include "transfer.h"
-#include "speedcheck.h"
-#include "select.h"
-#include "multiif.h"
-#include "warnless.h"
-
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
-#include "curl_memory.h"
-#include "memdebug.h"
-
-static CURLcode wssh_connect(struct connectdata *conn, bool *done);
-static CURLcode wssh_multi_statemach(struct connectdata *conn, bool *done);
-static CURLcode wssh_do(struct connectdata *conn, bool *done);
-#if 0
-static CURLcode wscp_done(struct connectdata *conn,
- CURLcode, bool premature);
-static CURLcode wscp_doing(struct connectdata *conn,
- bool *dophase_done);
-static CURLcode wscp_disconnect(struct connectdata *conn,
- bool dead_connection);
-#endif
-static CURLcode wsftp_done(struct connectdata *conn,
- CURLcode, bool premature);
-static CURLcode wsftp_doing(struct connectdata *conn,
- bool *dophase_done);
-static CURLcode wsftp_disconnect(struct connectdata *conn, bool dead);
-static int wssh_getsock(struct connectdata *conn,
- curl_socket_t *sock);
-static int wssh_perform_getsock(const struct connectdata *conn,
- curl_socket_t *sock);
-static CURLcode wssh_setup_connection(struct connectdata *conn);
-
-#if 0
-/*
- * SCP protocol handler.
- */
-
-const struct Curl_handler Curl_handler_scp = {
- "SCP", /* scheme */
- wssh_setup_connection, /* setup_connection */
- wssh_do, /* do_it */
- wscp_done, /* done */
- ZERO_NULL, /* do_more */
- wssh_connect, /* connect_it */
- wssh_multi_statemach, /* connecting */
- wscp_doing, /* doing */
- wssh_getsock, /* proto_getsock */
- wssh_getsock, /* doing_getsock */
- ZERO_NULL, /* domore_getsock */
- wssh_perform_getsock, /* perform_getsock */
- wscp_disconnect, /* disconnect */
- ZERO_NULL, /* readwrite */
- ZERO_NULL, /* connection_check */
- PORT_SSH, /* defport */
- CURLPROTO_SCP, /* protocol */
- PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
- | PROTOPT_NOURLQUERY /* flags */
-};
-
-#endif
-
-/*
- * SFTP protocol handler.
- */
-
-const struct Curl_handler Curl_handler_sftp = {
- "SFTP", /* scheme */
- wssh_setup_connection, /* setup_connection */
- wssh_do, /* do_it */
- wsftp_done, /* done */
- ZERO_NULL, /* do_more */
- wssh_connect, /* connect_it */
- wssh_multi_statemach, /* connecting */
- wsftp_doing, /* doing */
- wssh_getsock, /* proto_getsock */
- wssh_getsock, /* doing_getsock */
- ZERO_NULL, /* domore_getsock */
- wssh_perform_getsock, /* perform_getsock */
- wsftp_disconnect, /* disconnect */
- ZERO_NULL, /* readwrite */
- ZERO_NULL, /* connection_check */
- PORT_SSH, /* defport */
- CURLPROTO_SFTP, /* protocol */
- PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
- | PROTOPT_NOURLQUERY /* flags */
-};
-
-/*
- * SSH State machine related code
- */
-/* This is the ONLY way to change SSH state! */
-static void state(struct connectdata *conn, sshstate nowstate)
-{
- struct ssh_conn *sshc = &conn->proto.sshc;
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
- /* for debug purposes */
- static const char * const names[] = {
- "SSH_STOP",
- "SSH_INIT",
- "SSH_S_STARTUP",
- "SSH_HOSTKEY",
- "SSH_AUTHLIST",
- "SSH_AUTH_PKEY_INIT",
- "SSH_AUTH_PKEY",
- "SSH_AUTH_PASS_INIT",
- "SSH_AUTH_PASS",
- "SSH_AUTH_AGENT_INIT",
- "SSH_AUTH_AGENT_LIST",
- "SSH_AUTH_AGENT",
- "SSH_AUTH_HOST_INIT",
- "SSH_AUTH_HOST",
- "SSH_AUTH_KEY_INIT",
- "SSH_AUTH_KEY",
- "SSH_AUTH_GSSAPI",
- "SSH_AUTH_DONE",
- "SSH_SFTP_INIT",
- "SSH_SFTP_REALPATH",
- "SSH_SFTP_QUOTE_INIT",
- "SSH_SFTP_POSTQUOTE_INIT",
- "SSH_SFTP_QUOTE",
- "SSH_SFTP_NEXT_QUOTE",
- "SSH_SFTP_QUOTE_STAT",
- "SSH_SFTP_QUOTE_SETSTAT",
- "SSH_SFTP_QUOTE_SYMLINK",
- "SSH_SFTP_QUOTE_MKDIR",
- "SSH_SFTP_QUOTE_RENAME",
- "SSH_SFTP_QUOTE_RMDIR",
- "SSH_SFTP_QUOTE_UNLINK",
- "SSH_SFTP_QUOTE_STATVFS",
- "SSH_SFTP_GETINFO",
- "SSH_SFTP_FILETIME",
- "SSH_SFTP_TRANS_INIT",
- "SSH_SFTP_UPLOAD_INIT",
- "SSH_SFTP_CREATE_DIRS_INIT",
- "SSH_SFTP_CREATE_DIRS",
- "SSH_SFTP_CREATE_DIRS_MKDIR",
- "SSH_SFTP_READDIR_INIT",
- "SSH_SFTP_READDIR",
- "SSH_SFTP_READDIR_LINK",
- "SSH_SFTP_READDIR_BOTTOM",
- "SSH_SFTP_READDIR_DONE",
- "SSH_SFTP_DOWNLOAD_INIT",
- "SSH_SFTP_DOWNLOAD_STAT",
- "SSH_SFTP_CLOSE",
- "SSH_SFTP_SHUTDOWN",
- "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",
- "SSH_SCP_WAIT_CLOSE",
- "SSH_SCP_CHANNEL_FREE",
- "SSH_SESSION_DISCONNECT",
- "SSH_SESSION_FREE",
- "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, "wolfssh %p state change from %s to %s\n",
- (void *)sshc, names[sshc->state], names[nowstate]);
- }
-#endif
-
- sshc->state = nowstate;
-}
-
-static ssize_t wscp_send(struct connectdata *conn, int sockindex,
- const void *mem, size_t len, CURLcode *err)
-{
- ssize_t nwrite = 0;
- (void)conn;
- (void)sockindex; /* we only support SCP on the fixed known primary socket */
- (void)mem;
- (void)len;
- (void)err;
-
- return nwrite;
-}
-
-static ssize_t wscp_recv(struct connectdata *conn, int sockindex,
- char *mem, size_t len, CURLcode *err)
-{
- ssize_t nread = 0;
- (void)conn;
- (void)sockindex; /* we only support SCP on the fixed known primary socket */
- (void)mem;
- (void)len;
- (void)err;
-
- return nread;
-}
-
-/* return number of sent bytes */
-static ssize_t wsftp_send(struct connectdata *conn, int sockindex,
- const void *mem, size_t len, CURLcode *err)
-{
- struct ssh_conn *sshc = &conn->proto.sshc;
- word32 offset[2];
- int rc;
- (void)sockindex;
-
- offset[0] = (word32)sshc->offset&0xFFFFFFFF;
- offset[1] = (word32)(sshc->offset>>32)&0xFFFFFFFF;
-
- rc = wolfSSH_SFTP_SendWritePacket(sshc->ssh_session, sshc->handle,
- sshc->handleSz,
- &offset[0],
- (byte *)mem, (word32)len);
-
- if(rc == WS_FATAL_ERROR)
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- conn->waitfor = KEEP_RECV;
- *err = CURLE_AGAIN;
- return -1;
- }
- else if(rc == WS_WANT_WRITE) {
- conn->waitfor = KEEP_SEND;
- *err = CURLE_AGAIN;
- return -1;
- }
- if(rc < 0) {
- failf(conn->data, "wolfSSH_SFTP_SendWritePacket returned %d\n", rc);
- return -1;
- }
- DEBUGASSERT(rc == (int)len);
- infof(conn->data, "sent %zd bytes SFTP from offset %zd\n",
- len, sshc->offset);
- sshc->offset += len;
- return (ssize_t)rc;
-}
-
-/*
- * Return number of received (decrypted) bytes
- * or <0 on error
- */
-static ssize_t wsftp_recv(struct connectdata *conn, int sockindex,
- char *mem, size_t len, CURLcode *err)
-{
- int rc;
- struct ssh_conn *sshc = &conn->proto.sshc;
- word32 offset[2];
- (void)sockindex;
-
- offset[0] = (word32)sshc->offset&0xFFFFFFFF;
- offset[1] = (word32)(sshc->offset>>32)&0xFFFFFFFF;
-
- rc = wolfSSH_SFTP_SendReadPacket(sshc->ssh_session, sshc->handle,
- sshc->handleSz,
- &offset[0],
- (byte *)mem, (word32)len);
- if(rc == WS_FATAL_ERROR)
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- conn->waitfor = KEEP_RECV;
- *err = CURLE_AGAIN;
- return -1;
- }
- else if(rc == WS_WANT_WRITE) {
- conn->waitfor = KEEP_SEND;
- *err = CURLE_AGAIN;
- return -1;
- }
-
- DEBUGASSERT(rc <= (int)len);
-
- if(rc < 0) {
- failf(conn->data, "wolfSSH_SFTP_SendReadPacket returned %d\n", rc);
- return -1;
- }
- sshc->offset += len;
-
- return (ssize_t)rc;
-}
-
-/*
- * SSH setup and connection
- */
-static CURLcode wssh_setup_connection(struct connectdata *conn)
-{
- struct SSHPROTO *ssh;
-
- conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
- if(!ssh)
- return CURLE_OUT_OF_MEMORY;
-
- return CURLE_OK;
-}
-
-static Curl_recv wscp_recv, wsftp_recv;
-static Curl_send wscp_send, wsftp_send;
-
-static int userauth(byte authtype,
- WS_UserAuthData* authdata,
- void *ctx)
-{
- struct connectdata *conn = ctx;
- DEBUGF(infof(conn->data, "wolfssh callback: type %s\n",
- authtype == WOLFSSH_USERAUTH_PASSWORD ? "PASSWORD" :
- "PUBLICCKEY"));
- if(authtype == WOLFSSH_USERAUTH_PASSWORD) {
- authdata->sf.password.password = (byte *)conn->passwd;
- authdata->sf.password.passwordSz = (word32) strlen(conn->passwd);
- }
-
- return 0;
-}
-
-static CURLcode wssh_connect(struct connectdata *conn, bool *done)
-{
- struct Curl_easy *data = conn->data;
- struct ssh_conn *sshc;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
- int rc;
-
- /* initialize per-handle data if not already */
- if(!data->req.p.ssh)
- wssh_setup_connection(conn);
-
- /* We default to persistent connections. We set this already in this connect
- function to make the re-use checks properly be able to check this bit. */
- connkeep(conn, "SSH default");
-
- if(conn->handler->protocol & CURLPROTO_SCP) {
- conn->recv[FIRSTSOCKET] = wscp_recv;
- conn->send[FIRSTSOCKET] = wscp_send;
- }
- else {
- conn->recv[FIRSTSOCKET] = wsftp_recv;
- conn->send[FIRSTSOCKET] = wsftp_send;
- }
- sshc = &conn->proto.sshc;
- sshc->ctx = wolfSSH_CTX_new(WOLFSSH_ENDPOINT_CLIENT, NULL);
- if(!sshc->ctx) {
- failf(data, "No wolfSSH context");
- goto error;
- }
-
- sshc->ssh_session = wolfSSH_new(sshc->ctx);
- if(sshc->ssh_session == NULL) {
- failf(data, "No wolfSSH session");
- goto error;
- }
-
- rc = wolfSSH_SetUsername(sshc->ssh_session, conn->user);
- if(rc != WS_SUCCESS) {
- failf(data, "wolfSSH failed to set user name");
- goto error;
- }
-
- /* set callback for authentication */
- wolfSSH_SetUserAuth(sshc->ctx, userauth);
- wolfSSH_SetUserAuthCtx(sshc->ssh_session, conn);
-
- rc = wolfSSH_set_fd(sshc->ssh_session, (int)sock);
- if(rc) {
- failf(data, "wolfSSH failed to set socket");
- goto error;
- }
-
-#if 0
- wolfSSH_Debugging_ON();
-#endif
-
- *done = TRUE;
- if(conn->handler->protocol & CURLPROTO_SCP)
- state(conn, SSH_INIT);
- else
- state(conn, SSH_SFTP_INIT);
-
- return wssh_multi_statemach(conn, done);
- error:
- wolfSSH_free(sshc->ssh_session);
- wolfSSH_CTX_free(sshc->ctx);
- return CURLE_FAILED_INIT;
-}
-
-/*
- * wssh_statemach_act() runs the SSH state machine as far as it can without
- * blocking and without reaching the end. The data the pointer 'block' points
- * to will be set to TRUE if the wolfssh function returns EAGAIN meaning it
- * wants to be called again when the socket is ready
- */
-
-static CURLcode wssh_statemach_act(struct connectdata *conn, bool *block)
-{
- CURLcode result = CURLE_OK;
- struct ssh_conn *sshc = &conn->proto.sshc;
- struct Curl_easy *data = conn->data;
- struct SSHPROTO *sftp_scp = data->req.p.ssh;
- WS_SFTPNAME *name;
- int rc = 0;
- *block = FALSE; /* we're not blocking by default */
-
- do {
- switch(sshc->state) {
- case SSH_INIT:
- state(conn, SSH_S_STARTUP);
- /* FALLTHROUGH */
- case SSH_S_STARTUP:
- rc = wolfSSH_connect(sshc->ssh_session);
- if(rc != WS_SUCCESS)
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(rc != WS_SUCCESS) {
- state(conn, SSH_STOP);
- return CURLE_SSH;
- }
- infof(data, "wolfssh connected!\n");
- state(conn, SSH_STOP);
- break;
- case SSH_STOP:
- break;
-
- case SSH_SFTP_INIT:
- rc = wolfSSH_SFTP_connect(sshc->ssh_session);
- if(rc != WS_SUCCESS)
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(rc == WS_SUCCESS) {
- infof(data, "wolfssh SFTP connected!\n");
- state(conn, SSH_SFTP_REALPATH);
- }
- else {
- failf(data, "wolfssh SFTP connect error %d", rc);
- return CURLE_SSH;
- }
- break;
- case SSH_SFTP_REALPATH:
- name = wolfSSH_SFTP_RealPath(sshc->ssh_session, (char *)".");
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(name && (rc == WS_SUCCESS)) {
- sshc->homedir = malloc(name->fSz + 1);
- if(!sshc->homedir) {
- sshc->actualcode = CURLE_OUT_OF_MEMORY;
- }
- else {
- memcpy(sshc->homedir, name->fName, name->fSz);
- sshc->homedir[name->fSz] = 0;
- infof(data, "wolfssh SFTP realpath succeeded!\n");
- }
- wolfSSH_SFTPNAME_list_free(name);
- state(conn, SSH_STOP);
- return CURLE_OK;
- }
- failf(data, "wolfssh SFTP realpath %d", rc);
- return CURLE_SSH;
-
- case SSH_SFTP_QUOTE_INIT:
- result = Curl_getworkingpath(conn, sshc->homedir, &sftp_scp->path);
- if(result) {
- sshc->actualcode = result;
- state(conn, SSH_STOP);
- break;
- }
-
- if(data->set.quote) {
- infof(data, "Sending quote commands\n");
- sshc->quote_item = data->set.quote;
- state(conn, SSH_SFTP_QUOTE);
- }
- else {
- state(conn, SSH_SFTP_GETINFO);
- }
- break;
- case SSH_SFTP_GETINFO:
- if(data->set.get_filetime) {
- state(conn, SSH_SFTP_FILETIME);
- }
- else {
- state(conn, SSH_SFTP_TRANS_INIT);
- }
- break;
- case SSH_SFTP_TRANS_INIT:
- if(data->set.upload)
- state(conn, SSH_SFTP_UPLOAD_INIT);
- else {
- if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/')
- state(conn, SSH_SFTP_READDIR_INIT);
- else
- state(conn, SSH_SFTP_DOWNLOAD_INIT);
- }
- break;
- case SSH_SFTP_UPLOAD_INIT: {
- word32 flags;
- WS_SFTP_FILEATRB createattrs;
- if(data->state.resume_from) {
- WS_SFTP_FILEATRB attrs;
- if(data->state.resume_from < 0) {
- rc = wolfSSH_SFTP_STAT(sshc->ssh_session, sftp_scp->path,
- &attrs);
- if(rc != WS_SUCCESS)
- break;
-
- if(rc) {
- data->state.resume_from = 0;
- }
- else {
- curl_off_t size = ((curl_off_t)attrs.sz[1] << 32) | attrs.sz[0];
- if(size < 0) {
- failf(data, "Bad file size (%" CURL_FORMAT_CURL_OFF_T ")", size);
- return CURLE_BAD_DOWNLOAD_RESUME;
- }
- data->state.resume_from = size;
- }
- }
- }
-
- if(data->set.ftp_append)
- /* Try to open for append, but create if nonexisting */
- flags = WOLFSSH_FXF_WRITE|WOLFSSH_FXF_CREAT|WOLFSSH_FXF_APPEND;
- else if(data->state.resume_from > 0)
- /* If we have restart position then open for append */
- flags = WOLFSSH_FXF_WRITE|WOLFSSH_FXF_APPEND;
- else
- /* Clear file before writing (normal behaviour) */
- flags = WOLFSSH_FXF_WRITE|WOLFSSH_FXF_CREAT|WOLFSSH_FXF_TRUNC;
-
- memset(&createattrs, 0, sizeof(createattrs));
- createattrs.per = (word32)data->set.new_file_perms;
- sshc->handleSz = sizeof(sshc->handle);
- rc = wolfSSH_SFTP_Open(sshc->ssh_session, sftp_scp->path,
- flags, &createattrs,
- sshc->handle, &sshc->handleSz);
- if(rc == WS_FATAL_ERROR)
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(rc == WS_SUCCESS) {
- infof(data, "wolfssh SFTP open succeeded!\n");
- }
- else {
- failf(data, "wolfssh SFTP upload open failed: %d", rc);
- return CURLE_SSH;
- }
- state(conn, SSH_SFTP_DOWNLOAD_STAT);
-
- /* If we have a restart point then we need to seek to the correct
- position. */
- if(data->state.resume_from > 0) {
- /* Let's read off the proper amount of bytes from the input. */
- int seekerr = CURL_SEEKFUNC_OK;
- 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) {
- curl_off_t passed = 0;
-
- if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
- failf(data, "Could not seek stream");
- return CURLE_FTP_COULDNT_USE_REST;
- }
- /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
- do {
- size_t readthisamountnow =
- (data->state.resume_from - passed > data->set.buffer_size) ?
- (size_t)data->set.buffer_size :
- curlx_sotouz(data->state.resume_from - passed);
-
- 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)) {
- /* this checks for greater-than only to make sure that the
- CURL_READFUNC_ABORT return code still aborts */
- failf(data, "Failed to read data");
- return CURLE_FTP_COULDNT_USE_REST;
- }
- } while(passed < data->state.resume_from);
- }
-
- /* now, decrease the size of the read */
- if(data->state.infilesize > 0) {
- data->state.infilesize -= data->state.resume_from;
- data->req.size = data->state.infilesize;
- Curl_pgrsSetUploadSize(data, data->state.infilesize);
- }
-
- sshc->offset += data->state.resume_from;
- }
- if(data->state.infilesize > 0) {
- data->req.size = data->state.infilesize;
- Curl_pgrsSetUploadSize(data, data->state.infilesize);
- }
- /* upload data */
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
-
- /* not set by Curl_setup_transfer to preserve keepon bits */
- conn->sockfd = conn->writesockfd;
-
- if(result) {
- state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = result;
- }
- else {
- /* store this original bitmask setup to use later on if we can't
- figure out a "real" bitmask */
- sshc->orig_waitfor = data->req.keepon;
-
- /* we want to use the _sending_ function even when the socket turns
- out readable as the underlying libssh2 sftp send function will deal
- with both accordingly */
- conn->cselect_bits = CURL_CSELECT_OUT;
-
- /* since we don't really wait for anything at this point, we want the
- state machine to move on as soon as possible so we set a very short
- timeout here */
- Curl_expire(data, 0, EXPIRE_RUN_NOW);
-
- state(conn, SSH_STOP);
- }
- break;
- }
- case SSH_SFTP_DOWNLOAD_INIT:
- sshc->handleSz = sizeof(sshc->handle);
- rc = wolfSSH_SFTP_Open(sshc->ssh_session, sftp_scp->path,
- WOLFSSH_FXF_READ, NULL,
- sshc->handle, &sshc->handleSz);
- if(rc == WS_FATAL_ERROR)
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(rc == WS_SUCCESS) {
- infof(data, "wolfssh SFTP open succeeded!\n");
- state(conn, SSH_SFTP_DOWNLOAD_STAT);
- return CURLE_OK;
- }
-
- failf(data, "wolfssh SFTP open failed: %d", rc);
- return CURLE_SSH;
-
- case SSH_SFTP_DOWNLOAD_STAT: {
- WS_SFTP_FILEATRB attrs;
- curl_off_t size;
-
- rc = wolfSSH_SFTP_STAT(sshc->ssh_session, sftp_scp->path, &attrs);
- if(rc == WS_FATAL_ERROR)
- rc = wolfSSH_get_error(sshc->ssh_session);
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(rc == WS_SUCCESS) {
- infof(data, "wolfssh STAT succeeded!\n");
- }
- else {
- failf(data, "wolfssh SFTP open failed: %d", rc);
- data->req.size = -1;
- data->req.maxdownload = -1;
- Curl_pgrsSetDownloadSize(data, -1);
- return CURLE_SSH;
- }
-
- size = ((curl_off_t)attrs.sz[1] <<32) | attrs.sz[0];
-
- data->req.size = size;
- data->req.maxdownload = size;
- Curl_pgrsSetDownloadSize(data, size);
-
- infof(data, "SFTP download %" CURL_FORMAT_CURL_OFF_T " bytes\n", size);
-
- /* We cannot seek with wolfSSH so resuming and range requests are not
- possible */
- if(conn->data->state.use_range || data->state.resume_from) {
- infof(data, "wolfSSH cannot do range/seek on SFTP\n");
- return CURLE_BAD_DOWNLOAD_RESUME;
- }
-
- /* Setup the actual download */
- if(data->req.size == 0) {
- /* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
- infof(data, "File already completely downloaded\n");
- state(conn, SSH_STOP);
- break;
- }
- Curl_setup_transfer(data, FIRSTSOCKET, data->req.size, FALSE, -1);
-
- /* not set by Curl_setup_transfer to preserve keepon bits */
- conn->writesockfd = conn->sockfd;
-
- /* we want to use the _receiving_ function even when the socket turns
- out writableable as the underlying libssh2 recv function will deal
- with both accordingly */
- conn->cselect_bits = CURL_CSELECT_IN;
-
- if(result) {
- /* this should never occur; the close state should be entered
- at the time the error occurs */
- state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = result;
- }
- else {
- state(conn, SSH_STOP);
- }
- break;
- }
- case SSH_SFTP_CLOSE:
- if(sshc->handleSz)
- rc = wolfSSH_SFTP_Close(sshc->ssh_session, sshc->handle,
- sshc->handleSz);
- else
- rc = WS_SUCCESS; /* directory listing */
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(rc == WS_SUCCESS) {
- state(conn, SSH_STOP);
- return CURLE_OK;
- }
-
- failf(data, "wolfssh SFTP CLOSE failed: %d", rc);
- return CURLE_SSH;
-
- case SSH_SFTP_READDIR_INIT:
- Curl_pgrsSetDownloadSize(data, -1);
- if(data->set.opt_no_body) {
- state(conn, SSH_STOP);
- break;
- }
- state(conn, SSH_SFTP_READDIR);
- /* FALLTHROUGH */
- case SSH_SFTP_READDIR:
- name = wolfSSH_SFTP_LS(sshc->ssh_session, sftp_scp->path);
- if(!name)
- rc = wolfSSH_get_error(sshc->ssh_session);
- else
- rc = WS_SUCCESS;
-
- if(rc == WS_WANT_READ) {
- *block = TRUE;
- conn->waitfor = KEEP_RECV;
- return CURLE_OK;
- }
- else if(rc == WS_WANT_WRITE) {
- *block = TRUE;
- conn->waitfor = KEEP_SEND;
- return CURLE_OK;
- }
- else if(name && (rc == WS_SUCCESS)) {
- WS_SFTPNAME *origname = name;
- result = CURLE_OK;
- while(name) {
- char *line = aprintf("%s\n",
- data->set.ftp_list_only ?
- name->fName : name->lName);
- if(line == NULL) {
- state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = CURLE_OUT_OF_MEMORY;
- break;
- }
- result = Curl_client_write(conn, CLIENTWRITE_BODY,
- line, strlen(line));
- free(line);
- if(result) {
- sshc->actualcode = result;
- break;
- }
- name = name->next;
- }
- wolfSSH_SFTPNAME_list_free(origname);
- state(conn, SSH_STOP);
- return result;
- }
- failf(data, "wolfssh SFTP ls failed: %d", rc);
- return CURLE_SSH;
-
- case SSH_SFTP_SHUTDOWN:
- Curl_safefree(sshc->homedir);
- wolfSSH_free(sshc->ssh_session);
- wolfSSH_CTX_free(sshc->ctx);
- state(conn, SSH_STOP);
- return CURLE_OK;
- default:
- break;
- }
- } while(!rc && (sshc->state != SSH_STOP));
- return result;
-}
-
-/* called repeatedly until done from multi.c */
-static CURLcode wssh_multi_statemach(struct connectdata *conn, bool *done)
-{
- struct ssh_conn *sshc = &conn->proto.sshc;
- CURLcode result = CURLE_OK;
- bool block; /* we store the status and use that to provide a ssh_getsock()
- implementation */
- do {
- result = wssh_statemach_act(conn, &block);
- *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
- /* if there's no error, it isn't done and it didn't EWOULDBLOCK, then
- try again */
- if(*done) {
- DEBUGF(infof(conn->data, "wssh_statemach_act says DONE\n"));
- }
- } while(!result && !*done && !block);
-
- return result;
-}
-
-static
-CURLcode wscp_perform(struct connectdata *conn,
- bool *connected,
- bool *dophase_done)
-{
- (void)conn;
- (void)connected;
- (void)dophase_done;
- return CURLE_OK;
-}
-
-static
-CURLcode wsftp_perform(struct connectdata *conn,
- bool *connected,
- bool *dophase_done)
-{
- CURLcode result = CURLE_OK;
-
- DEBUGF(infof(conn->data, "DO phase starts\n"));
-
- *dophase_done = FALSE; /* not done yet */
-
- /* start the first command in the DO phase */
- state(conn, SSH_SFTP_QUOTE_INIT);
-
- /* run the state-machine */
- result = wssh_multi_statemach(conn, dophase_done);
-
- *connected = conn->bits.tcpconnect[FIRSTSOCKET];
-
- if(*dophase_done) {
- DEBUGF(infof(conn->data, "DO phase is complete\n"));
- }
-
- return result;
-}
-
-/*
- * The DO function is generic for both protocols.
- */
-static CURLcode wssh_do(struct connectdata *conn, bool *done)
-{
- CURLcode result;
- bool connected = 0;
- struct Curl_easy *data = conn->data;
- struct ssh_conn *sshc = &conn->proto.sshc;
-
- *done = FALSE; /* default to false */
- data->req.size = -1; /* make sure this is unknown at this point */
- sshc->actualcode = CURLE_OK; /* reset error code */
- sshc->secondCreateDirs = 0; /* reset the create dir attempt state
- variable */
-
- Curl_pgrsSetUploadCounter(data, 0);
- Curl_pgrsSetDownloadCounter(data, 0);
- Curl_pgrsSetUploadSize(data, -1);
- Curl_pgrsSetDownloadSize(data, -1);
-
- if(conn->handler->protocol & CURLPROTO_SCP)
- result = wscp_perform(conn, &connected, done);
- else
- result = wsftp_perform(conn, &connected, done);
-
- return result;
-}
-
-static CURLcode wssh_block_statemach(struct connectdata *conn,
- bool disconnect)
-{
- struct ssh_conn *sshc = &conn->proto.sshc;
- CURLcode result = CURLE_OK;
- struct Curl_easy *data = conn->data;
-
- while((sshc->state != SSH_STOP) && !result) {
- bool block;
- timediff_t left = 1000;
- struct curltime now = Curl_now();
-
- result = wssh_statemach_act(conn, &block);
- if(result)
- break;
-
- if(!disconnect) {
- if(Curl_pgrsUpdate(conn))
- return CURLE_ABORTED_BY_CALLBACK;
-
- result = Curl_speedcheck(data, now);
- if(result)
- break;
-
- left = Curl_timeleft(data, NULL, FALSE);
- if(left < 0) {
- failf(data, "Operation timed out");
- return CURLE_OPERATION_TIMEDOUT;
- }
- }
-
- if(!result) {
- int dir = conn->waitfor;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
- curl_socket_t fd_read = CURL_SOCKET_BAD;
- curl_socket_t fd_write = CURL_SOCKET_BAD;
- if(dir == KEEP_RECV)
- fd_read = sock;
- else if(dir == KEEP_SEND)
- fd_write = sock;
-
- /* wait for the socket to become ready */
- (void)Curl_socket_check(fd_read, CURL_SOCKET_BAD, fd_write,
- left>1000?1000:left); /* ignore result */
- }
- }
-
- return result;
-}
-
-/* generic done function for both SCP and SFTP called from their specific
- done functions */
-static CURLcode wssh_done(struct connectdata *conn, CURLcode status)
-{
- CURLcode result = CURLE_OK;
- struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
-
- if(!status) {
- /* run the state-machine */
- result = wssh_block_statemach(conn, FALSE);
- }
- else
- result = status;
-
- if(sftp_scp)
- Curl_safefree(sftp_scp->path);
- if(Curl_pgrsDone(conn))
- return CURLE_ABORTED_BY_CALLBACK;
-
- conn->data->req.keepon = 0; /* clear all bits */
- return result;
-}
-
-#if 0
-static CURLcode wscp_done(struct connectdata *conn,
- CURLcode code, bool premature)
-{
- CURLcode result = CURLE_OK;
- (void)conn;
- (void)code;
- (void)premature;
-
- return result;
-}
-
-static CURLcode wscp_doing(struct connectdata *conn,
- bool *dophase_done)
-{
- CURLcode result = CURLE_OK;
- (void)conn;
- (void)dophase_done;
-
- return result;
-}
-
-static CURLcode wscp_disconnect(struct connectdata *conn, bool dead_connection)
-{
- CURLcode result = CURLE_OK;
- (void)conn;
- (void)dead_connection;
-
- return result;
-}
-#endif
-
-static CURLcode wsftp_done(struct connectdata *conn,
- CURLcode code, bool premature)
-{
- (void)premature;
- state(conn, SSH_SFTP_CLOSE);
-
- return wssh_done(conn, code);
-}
-
-static CURLcode wsftp_doing(struct connectdata *conn,
- bool *dophase_done)
-{
- CURLcode result = wssh_multi_statemach(conn, dophase_done);
-
- if(*dophase_done) {
- DEBUGF(infof(conn->data, "DO phase is complete\n"));
- }
- return result;
-}
-
-static CURLcode wsftp_disconnect(struct connectdata *conn, bool dead)
-{
- CURLcode result = CURLE_OK;
- (void)dead;
-
- DEBUGF(infof(conn->data, "SSH DISCONNECT starts now\n"));
-
- if(conn->proto.sshc.ssh_session) {
- /* only if there's a session still around to use! */
- state(conn, SSH_SFTP_SHUTDOWN);
- result = wssh_block_statemach(conn, TRUE);
- }
-
- DEBUGF(infof(conn->data, "SSH DISCONNECT is done\n"));
- return result;
-}
-
-static int wssh_getsock(struct connectdata *conn,
- curl_socket_t *sock)
-{
- return wssh_perform_getsock(conn, sock);
-}
-
-static int wssh_perform_getsock(const struct connectdata *conn,
- curl_socket_t *sock)
-{
- int bitmap = GETSOCK_BLANK;
- int dir = conn->waitfor;
- sock[0] = conn->sock[FIRSTSOCKET];
-
- if(dir == KEEP_RECV)
- bitmap |= GETSOCK_READSOCK(FIRSTSOCKET);
- else if(dir == KEEP_SEND)
- bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET);
-
- return bitmap;
-}
-
-size_t Curl_ssh_version(char *buffer, size_t buflen)
-{
- return msnprintf(buffer, buflen, "wolfssh/%s", LIBWOLFSSH_VERSION_STRING);
-}
-
-CURLcode Curl_ssh_init(void)
-{
- if(WS_SUCCESS != wolfSSH_Init()) {
- DEBUGF(fprintf(stderr, "Error: wolfSSH_Init failed\n"));
- return CURLE_FAILED_INIT;
- }
-
- return CURLE_OK;
-}
-void Curl_ssh_cleanup(void)
-{
-}
-
-#endif /* USE_WOLFSSH */
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2019 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
+
+#ifdef USE_WOLFSSH
+
+#include <limits.h>
+
+#error #include <wolfssh/ssh.h>
+#error #include <wolfssh/wolfsftp.h>
+#include "urldata.h"
+#include "connect.h"
+#include "sendf.h"
+#include "progress.h"
+#include "curl_path.h"
+#include "strtoofft.h"
+#include "transfer.h"
+#include "speedcheck.h"
+#include "select.h"
+#include "multiif.h"
+#include "warnless.h"
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "memdebug.h"
+
+static CURLcode wssh_connect(struct connectdata *conn, bool *done);
+static CURLcode wssh_multi_statemach(struct connectdata *conn, bool *done);
+static CURLcode wssh_do(struct connectdata *conn, bool *done);
+#if 0
+static CURLcode wscp_done(struct connectdata *conn,
+ CURLcode, bool premature);
+static CURLcode wscp_doing(struct connectdata *conn,
+ bool *dophase_done);
+static CURLcode wscp_disconnect(struct connectdata *conn,
+ bool dead_connection);
+#endif
+static CURLcode wsftp_done(struct connectdata *conn,
+ CURLcode, bool premature);
+static CURLcode wsftp_doing(struct connectdata *conn,
+ bool *dophase_done);
+static CURLcode wsftp_disconnect(struct connectdata *conn, bool dead);
+static int wssh_getsock(struct connectdata *conn,
+ curl_socket_t *sock);
+static int wssh_perform_getsock(const struct connectdata *conn,
+ curl_socket_t *sock);
+static CURLcode wssh_setup_connection(struct connectdata *conn);
+
+#if 0
+/*
+ * SCP protocol handler.
+ */
+
+const struct Curl_handler Curl_handler_scp = {
+ "SCP", /* scheme */
+ wssh_setup_connection, /* setup_connection */
+ wssh_do, /* do_it */
+ wscp_done, /* done */
+ ZERO_NULL, /* do_more */
+ wssh_connect, /* connect_it */
+ wssh_multi_statemach, /* connecting */
+ wscp_doing, /* doing */
+ wssh_getsock, /* proto_getsock */
+ wssh_getsock, /* doing_getsock */
+ ZERO_NULL, /* domore_getsock */
+ wssh_perform_getsock, /* perform_getsock */
+ wscp_disconnect, /* disconnect */
+ ZERO_NULL, /* readwrite */
+ ZERO_NULL, /* connection_check */
+ PORT_SSH, /* defport */
+ CURLPROTO_SCP, /* protocol */
+ PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
+ | PROTOPT_NOURLQUERY /* flags */
+};
+
+#endif
+
+/*
+ * SFTP protocol handler.
+ */
+
+const struct Curl_handler Curl_handler_sftp = {
+ "SFTP", /* scheme */
+ wssh_setup_connection, /* setup_connection */
+ wssh_do, /* do_it */
+ wsftp_done, /* done */
+ ZERO_NULL, /* do_more */
+ wssh_connect, /* connect_it */
+ wssh_multi_statemach, /* connecting */
+ wsftp_doing, /* doing */
+ wssh_getsock, /* proto_getsock */
+ wssh_getsock, /* doing_getsock */
+ ZERO_NULL, /* domore_getsock */
+ wssh_perform_getsock, /* perform_getsock */
+ wsftp_disconnect, /* disconnect */
+ ZERO_NULL, /* readwrite */
+ ZERO_NULL, /* connection_check */
+ PORT_SSH, /* defport */
+ CURLPROTO_SFTP, /* protocol */
+ PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION
+ | PROTOPT_NOURLQUERY /* flags */
+};
+
+/*
+ * SSH State machine related code
+ */
+/* This is the ONLY way to change SSH state! */
+static void state(struct connectdata *conn, sshstate nowstate)
+{
+ struct ssh_conn *sshc = &conn->proto.sshc;
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+ /* for debug purposes */
+ static const char * const names[] = {
+ "SSH_STOP",
+ "SSH_INIT",
+ "SSH_S_STARTUP",
+ "SSH_HOSTKEY",
+ "SSH_AUTHLIST",
+ "SSH_AUTH_PKEY_INIT",
+ "SSH_AUTH_PKEY",
+ "SSH_AUTH_PASS_INIT",
+ "SSH_AUTH_PASS",
+ "SSH_AUTH_AGENT_INIT",
+ "SSH_AUTH_AGENT_LIST",
+ "SSH_AUTH_AGENT",
+ "SSH_AUTH_HOST_INIT",
+ "SSH_AUTH_HOST",
+ "SSH_AUTH_KEY_INIT",
+ "SSH_AUTH_KEY",
+ "SSH_AUTH_GSSAPI",
+ "SSH_AUTH_DONE",
+ "SSH_SFTP_INIT",
+ "SSH_SFTP_REALPATH",
+ "SSH_SFTP_QUOTE_INIT",
+ "SSH_SFTP_POSTQUOTE_INIT",
+ "SSH_SFTP_QUOTE",
+ "SSH_SFTP_NEXT_QUOTE",
+ "SSH_SFTP_QUOTE_STAT",
+ "SSH_SFTP_QUOTE_SETSTAT",
+ "SSH_SFTP_QUOTE_SYMLINK",
+ "SSH_SFTP_QUOTE_MKDIR",
+ "SSH_SFTP_QUOTE_RENAME",
+ "SSH_SFTP_QUOTE_RMDIR",
+ "SSH_SFTP_QUOTE_UNLINK",
+ "SSH_SFTP_QUOTE_STATVFS",
+ "SSH_SFTP_GETINFO",
+ "SSH_SFTP_FILETIME",
+ "SSH_SFTP_TRANS_INIT",
+ "SSH_SFTP_UPLOAD_INIT",
+ "SSH_SFTP_CREATE_DIRS_INIT",
+ "SSH_SFTP_CREATE_DIRS",
+ "SSH_SFTP_CREATE_DIRS_MKDIR",
+ "SSH_SFTP_READDIR_INIT",
+ "SSH_SFTP_READDIR",
+ "SSH_SFTP_READDIR_LINK",
+ "SSH_SFTP_READDIR_BOTTOM",
+ "SSH_SFTP_READDIR_DONE",
+ "SSH_SFTP_DOWNLOAD_INIT",
+ "SSH_SFTP_DOWNLOAD_STAT",
+ "SSH_SFTP_CLOSE",
+ "SSH_SFTP_SHUTDOWN",
+ "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",
+ "SSH_SCP_WAIT_CLOSE",
+ "SSH_SCP_CHANNEL_FREE",
+ "SSH_SESSION_DISCONNECT",
+ "SSH_SESSION_FREE",
+ "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, "wolfssh %p state change from %s to %s\n",
+ (void *)sshc, names[sshc->state], names[nowstate]);
+ }
+#endif
+
+ sshc->state = nowstate;
+}
+
+static ssize_t wscp_send(struct connectdata *conn, int sockindex,
+ const void *mem, size_t len, CURLcode *err)
+{
+ ssize_t nwrite = 0;
+ (void)conn;
+ (void)sockindex; /* we only support SCP on the fixed known primary socket */
+ (void)mem;
+ (void)len;
+ (void)err;
+
+ return nwrite;
+}
+
+static ssize_t wscp_recv(struct connectdata *conn, int sockindex,
+ char *mem, size_t len, CURLcode *err)
+{
+ ssize_t nread = 0;
+ (void)conn;
+ (void)sockindex; /* we only support SCP on the fixed known primary socket */
+ (void)mem;
+ (void)len;
+ (void)err;
+
+ return nread;
+}
+
+/* return number of sent bytes */
+static ssize_t wsftp_send(struct connectdata *conn, int sockindex,
+ const void *mem, size_t len, CURLcode *err)
+{
+ struct ssh_conn *sshc = &conn->proto.sshc;
+ word32 offset[2];
+ int rc;
+ (void)sockindex;
+
+ offset[0] = (word32)sshc->offset&0xFFFFFFFF;
+ offset[1] = (word32)(sshc->offset>>32)&0xFFFFFFFF;
+
+ rc = wolfSSH_SFTP_SendWritePacket(sshc->ssh_session, sshc->handle,
+ sshc->handleSz,
+ &offset[0],
+ (byte *)mem, (word32)len);
+
+ if(rc == WS_FATAL_ERROR)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ conn->waitfor = KEEP_RECV;
+ *err = CURLE_AGAIN;
+ return -1;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ conn->waitfor = KEEP_SEND;
+ *err = CURLE_AGAIN;
+ return -1;
+ }
+ if(rc < 0) {
+ failf(conn->data, "wolfSSH_SFTP_SendWritePacket returned %d\n", rc);
+ return -1;
+ }
+ DEBUGASSERT(rc == (int)len);
+ infof(conn->data, "sent %zd bytes SFTP from offset %zd\n",
+ len, sshc->offset);
+ sshc->offset += len;
+ return (ssize_t)rc;
+}
+
+/*
+ * Return number of received (decrypted) bytes
+ * or <0 on error
+ */
+static ssize_t wsftp_recv(struct connectdata *conn, int sockindex,
+ char *mem, size_t len, CURLcode *err)
+{
+ int rc;
+ struct ssh_conn *sshc = &conn->proto.sshc;
+ word32 offset[2];
+ (void)sockindex;
+
+ offset[0] = (word32)sshc->offset&0xFFFFFFFF;
+ offset[1] = (word32)(sshc->offset>>32)&0xFFFFFFFF;
+
+ rc = wolfSSH_SFTP_SendReadPacket(sshc->ssh_session, sshc->handle,
+ sshc->handleSz,
+ &offset[0],
+ (byte *)mem, (word32)len);
+ if(rc == WS_FATAL_ERROR)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ conn->waitfor = KEEP_RECV;
+ *err = CURLE_AGAIN;
+ return -1;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ conn->waitfor = KEEP_SEND;
+ *err = CURLE_AGAIN;
+ return -1;
+ }
+
+ DEBUGASSERT(rc <= (int)len);
+
+ if(rc < 0) {
+ failf(conn->data, "wolfSSH_SFTP_SendReadPacket returned %d\n", rc);
+ return -1;
+ }
+ sshc->offset += len;
+
+ return (ssize_t)rc;
+}
+
+/*
+ * SSH setup and connection
+ */
+static CURLcode wssh_setup_connection(struct connectdata *conn)
+{
+ struct SSHPROTO *ssh;
+
+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
+ if(!ssh)
+ return CURLE_OUT_OF_MEMORY;
+
+ return CURLE_OK;
+}
+
+static Curl_recv wscp_recv, wsftp_recv;
+static Curl_send wscp_send, wsftp_send;
+
+static int userauth(byte authtype,
+ WS_UserAuthData* authdata,
+ void *ctx)
+{
+ struct connectdata *conn = ctx;
+ DEBUGF(infof(conn->data, "wolfssh callback: type %s\n",
+ authtype == WOLFSSH_USERAUTH_PASSWORD ? "PASSWORD" :
+ "PUBLICCKEY"));
+ if(authtype == WOLFSSH_USERAUTH_PASSWORD) {
+ authdata->sf.password.password = (byte *)conn->passwd;
+ authdata->sf.password.passwordSz = (word32) strlen(conn->passwd);
+ }
+
+ return 0;
+}
+
+static CURLcode wssh_connect(struct connectdata *conn, bool *done)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssh_conn *sshc;
+ curl_socket_t sock = conn->sock[FIRSTSOCKET];
+ int rc;
+
+ /* initialize per-handle data if not already */
+ if(!data->req.p.ssh)
+ wssh_setup_connection(conn);
+
+ /* We default to persistent connections. We set this already in this connect
+ function to make the re-use checks properly be able to check this bit. */
+ connkeep(conn, "SSH default");
+
+ if(conn->handler->protocol & CURLPROTO_SCP) {
+ conn->recv[FIRSTSOCKET] = wscp_recv;
+ conn->send[FIRSTSOCKET] = wscp_send;
+ }
+ else {
+ conn->recv[FIRSTSOCKET] = wsftp_recv;
+ conn->send[FIRSTSOCKET] = wsftp_send;
+ }
+ sshc = &conn->proto.sshc;
+ sshc->ctx = wolfSSH_CTX_new(WOLFSSH_ENDPOINT_CLIENT, NULL);
+ if(!sshc->ctx) {
+ failf(data, "No wolfSSH context");
+ goto error;
+ }
+
+ sshc->ssh_session = wolfSSH_new(sshc->ctx);
+ if(sshc->ssh_session == NULL) {
+ failf(data, "No wolfSSH session");
+ goto error;
+ }
+
+ rc = wolfSSH_SetUsername(sshc->ssh_session, conn->user);
+ if(rc != WS_SUCCESS) {
+ failf(data, "wolfSSH failed to set user name");
+ goto error;
+ }
+
+ /* set callback for authentication */
+ wolfSSH_SetUserAuth(sshc->ctx, userauth);
+ wolfSSH_SetUserAuthCtx(sshc->ssh_session, conn);
+
+ rc = wolfSSH_set_fd(sshc->ssh_session, (int)sock);
+ if(rc) {
+ failf(data, "wolfSSH failed to set socket");
+ goto error;
+ }
+
+#if 0
+ wolfSSH_Debugging_ON();
+#endif
+
+ *done = TRUE;
+ if(conn->handler->protocol & CURLPROTO_SCP)
+ state(conn, SSH_INIT);
+ else
+ state(conn, SSH_SFTP_INIT);
+
+ return wssh_multi_statemach(conn, done);
+ error:
+ wolfSSH_free(sshc->ssh_session);
+ wolfSSH_CTX_free(sshc->ctx);
+ return CURLE_FAILED_INIT;
+}
+
+/*
+ * wssh_statemach_act() runs the SSH state machine as far as it can without
+ * blocking and without reaching the end. The data the pointer 'block' points
+ * to will be set to TRUE if the wolfssh function returns EAGAIN meaning it
+ * wants to be called again when the socket is ready
+ */
+
+static CURLcode wssh_statemach_act(struct connectdata *conn, bool *block)
+{
+ CURLcode result = CURLE_OK;
+ struct ssh_conn *sshc = &conn->proto.sshc;
+ struct Curl_easy *data = conn->data;
+ struct SSHPROTO *sftp_scp = data->req.p.ssh;
+ WS_SFTPNAME *name;
+ int rc = 0;
+ *block = FALSE; /* we're not blocking by default */
+
+ do {
+ switch(sshc->state) {
+ case SSH_INIT:
+ state(conn, SSH_S_STARTUP);
+ /* FALLTHROUGH */
+ case SSH_S_STARTUP:
+ rc = wolfSSH_connect(sshc->ssh_session);
+ if(rc != WS_SUCCESS)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(rc != WS_SUCCESS) {
+ state(conn, SSH_STOP);
+ return CURLE_SSH;
+ }
+ infof(data, "wolfssh connected!\n");
+ state(conn, SSH_STOP);
+ break;
+ case SSH_STOP:
+ break;
+
+ case SSH_SFTP_INIT:
+ rc = wolfSSH_SFTP_connect(sshc->ssh_session);
+ if(rc != WS_SUCCESS)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(rc == WS_SUCCESS) {
+ infof(data, "wolfssh SFTP connected!\n");
+ state(conn, SSH_SFTP_REALPATH);
+ }
+ else {
+ failf(data, "wolfssh SFTP connect error %d", rc);
+ return CURLE_SSH;
+ }
+ break;
+ case SSH_SFTP_REALPATH:
+ name = wolfSSH_SFTP_RealPath(sshc->ssh_session, (char *)".");
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(name && (rc == WS_SUCCESS)) {
+ sshc->homedir = malloc(name->fSz + 1);
+ if(!sshc->homedir) {
+ sshc->actualcode = CURLE_OUT_OF_MEMORY;
+ }
+ else {
+ memcpy(sshc->homedir, name->fName, name->fSz);
+ sshc->homedir[name->fSz] = 0;
+ infof(data, "wolfssh SFTP realpath succeeded!\n");
+ }
+ wolfSSH_SFTPNAME_list_free(name);
+ state(conn, SSH_STOP);
+ return CURLE_OK;
+ }
+ failf(data, "wolfssh SFTP realpath %d", rc);
+ return CURLE_SSH;
+
+ case SSH_SFTP_QUOTE_INIT:
+ result = Curl_getworkingpath(conn, sshc->homedir, &sftp_scp->path);
+ if(result) {
+ sshc->actualcode = result;
+ state(conn, SSH_STOP);
+ break;
+ }
+
+ if(data->set.quote) {
+ infof(data, "Sending quote commands\n");
+ sshc->quote_item = data->set.quote;
+ state(conn, SSH_SFTP_QUOTE);
+ }
+ else {
+ state(conn, SSH_SFTP_GETINFO);
+ }
+ break;
+ case SSH_SFTP_GETINFO:
+ if(data->set.get_filetime) {
+ state(conn, SSH_SFTP_FILETIME);
+ }
+ else {
+ state(conn, SSH_SFTP_TRANS_INIT);
+ }
+ break;
+ case SSH_SFTP_TRANS_INIT:
+ if(data->set.upload)
+ state(conn, SSH_SFTP_UPLOAD_INIT);
+ else {
+ if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/')
+ state(conn, SSH_SFTP_READDIR_INIT);
+ else
+ state(conn, SSH_SFTP_DOWNLOAD_INIT);
+ }
+ break;
+ case SSH_SFTP_UPLOAD_INIT: {
+ word32 flags;
+ WS_SFTP_FILEATRB createattrs;
+ if(data->state.resume_from) {
+ WS_SFTP_FILEATRB attrs;
+ if(data->state.resume_from < 0) {
+ rc = wolfSSH_SFTP_STAT(sshc->ssh_session, sftp_scp->path,
+ &attrs);
+ if(rc != WS_SUCCESS)
+ break;
+
+ if(rc) {
+ data->state.resume_from = 0;
+ }
+ else {
+ curl_off_t size = ((curl_off_t)attrs.sz[1] << 32) | attrs.sz[0];
+ if(size < 0) {
+ failf(data, "Bad file size (%" CURL_FORMAT_CURL_OFF_T ")", size);
+ return CURLE_BAD_DOWNLOAD_RESUME;
+ }
+ data->state.resume_from = size;
+ }
+ }
+ }
+
+ if(data->set.ftp_append)
+ /* Try to open for append, but create if nonexisting */
+ flags = WOLFSSH_FXF_WRITE|WOLFSSH_FXF_CREAT|WOLFSSH_FXF_APPEND;
+ else if(data->state.resume_from > 0)
+ /* If we have restart position then open for append */
+ flags = WOLFSSH_FXF_WRITE|WOLFSSH_FXF_APPEND;
+ else
+ /* Clear file before writing (normal behaviour) */
+ flags = WOLFSSH_FXF_WRITE|WOLFSSH_FXF_CREAT|WOLFSSH_FXF_TRUNC;
+
+ memset(&createattrs, 0, sizeof(createattrs));
+ createattrs.per = (word32)data->set.new_file_perms;
+ sshc->handleSz = sizeof(sshc->handle);
+ rc = wolfSSH_SFTP_Open(sshc->ssh_session, sftp_scp->path,
+ flags, &createattrs,
+ sshc->handle, &sshc->handleSz);
+ if(rc == WS_FATAL_ERROR)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(rc == WS_SUCCESS) {
+ infof(data, "wolfssh SFTP open succeeded!\n");
+ }
+ else {
+ failf(data, "wolfssh SFTP upload open failed: %d", rc);
+ return CURLE_SSH;
+ }
+ state(conn, SSH_SFTP_DOWNLOAD_STAT);
+
+ /* If we have a restart point then we need to seek to the correct
+ position. */
+ if(data->state.resume_from > 0) {
+ /* Let's read off the proper amount of bytes from the input. */
+ int seekerr = CURL_SEEKFUNC_OK;
+ 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) {
+ curl_off_t passed = 0;
+
+ if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
+ failf(data, "Could not seek stream");
+ return CURLE_FTP_COULDNT_USE_REST;
+ }
+ /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
+ do {
+ size_t readthisamountnow =
+ (data->state.resume_from - passed > data->set.buffer_size) ?
+ (size_t)data->set.buffer_size :
+ curlx_sotouz(data->state.resume_from - passed);
+
+ 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)) {
+ /* this checks for greater-than only to make sure that the
+ CURL_READFUNC_ABORT return code still aborts */
+ failf(data, "Failed to read data");
+ return CURLE_FTP_COULDNT_USE_REST;
+ }
+ } while(passed < data->state.resume_from);
+ }
+
+ /* now, decrease the size of the read */
+ if(data->state.infilesize > 0) {
+ data->state.infilesize -= data->state.resume_from;
+ data->req.size = data->state.infilesize;
+ Curl_pgrsSetUploadSize(data, data->state.infilesize);
+ }
+
+ sshc->offset += data->state.resume_from;
+ }
+ if(data->state.infilesize > 0) {
+ data->req.size = data->state.infilesize;
+ Curl_pgrsSetUploadSize(data, data->state.infilesize);
+ }
+ /* upload data */
+ Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+
+ /* not set by Curl_setup_transfer to preserve keepon bits */
+ conn->sockfd = conn->writesockfd;
+
+ if(result) {
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->actualcode = result;
+ }
+ else {
+ /* store this original bitmask setup to use later on if we can't
+ figure out a "real" bitmask */
+ sshc->orig_waitfor = data->req.keepon;
+
+ /* we want to use the _sending_ function even when the socket turns
+ out readable as the underlying libssh2 sftp send function will deal
+ with both accordingly */
+ conn->cselect_bits = CURL_CSELECT_OUT;
+
+ /* since we don't really wait for anything at this point, we want the
+ state machine to move on as soon as possible so we set a very short
+ timeout here */
+ Curl_expire(data, 0, EXPIRE_RUN_NOW);
+
+ state(conn, SSH_STOP);
+ }
+ break;
+ }
+ case SSH_SFTP_DOWNLOAD_INIT:
+ sshc->handleSz = sizeof(sshc->handle);
+ rc = wolfSSH_SFTP_Open(sshc->ssh_session, sftp_scp->path,
+ WOLFSSH_FXF_READ, NULL,
+ sshc->handle, &sshc->handleSz);
+ if(rc == WS_FATAL_ERROR)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(rc == WS_SUCCESS) {
+ infof(data, "wolfssh SFTP open succeeded!\n");
+ state(conn, SSH_SFTP_DOWNLOAD_STAT);
+ return CURLE_OK;
+ }
+
+ failf(data, "wolfssh SFTP open failed: %d", rc);
+ return CURLE_SSH;
+
+ case SSH_SFTP_DOWNLOAD_STAT: {
+ WS_SFTP_FILEATRB attrs;
+ curl_off_t size;
+
+ rc = wolfSSH_SFTP_STAT(sshc->ssh_session, sftp_scp->path, &attrs);
+ if(rc == WS_FATAL_ERROR)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(rc == WS_SUCCESS) {
+ infof(data, "wolfssh STAT succeeded!\n");
+ }
+ else {
+ failf(data, "wolfssh SFTP open failed: %d", rc);
+ data->req.size = -1;
+ data->req.maxdownload = -1;
+ Curl_pgrsSetDownloadSize(data, -1);
+ return CURLE_SSH;
+ }
+
+ size = ((curl_off_t)attrs.sz[1] <<32) | attrs.sz[0];
+
+ data->req.size = size;
+ data->req.maxdownload = size;
+ Curl_pgrsSetDownloadSize(data, size);
+
+ infof(data, "SFTP download %" CURL_FORMAT_CURL_OFF_T " bytes\n", size);
+
+ /* We cannot seek with wolfSSH so resuming and range requests are not
+ possible */
+ if(conn->data->state.use_range || data->state.resume_from) {
+ infof(data, "wolfSSH cannot do range/seek on SFTP\n");
+ return CURLE_BAD_DOWNLOAD_RESUME;
+ }
+
+ /* Setup the actual download */
+ if(data->req.size == 0) {
+ /* no data to transfer */
+ Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ infof(data, "File already completely downloaded\n");
+ state(conn, SSH_STOP);
+ break;
+ }
+ Curl_setup_transfer(data, FIRSTSOCKET, data->req.size, FALSE, -1);
+
+ /* not set by Curl_setup_transfer to preserve keepon bits */
+ conn->writesockfd = conn->sockfd;
+
+ /* we want to use the _receiving_ function even when the socket turns
+ out writableable as the underlying libssh2 recv function will deal
+ with both accordingly */
+ conn->cselect_bits = CURL_CSELECT_IN;
+
+ if(result) {
+ /* this should never occur; the close state should be entered
+ at the time the error occurs */
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->actualcode = result;
+ }
+ else {
+ state(conn, SSH_STOP);
+ }
+ break;
+ }
+ case SSH_SFTP_CLOSE:
+ if(sshc->handleSz)
+ rc = wolfSSH_SFTP_Close(sshc->ssh_session, sshc->handle,
+ sshc->handleSz);
+ else
+ rc = WS_SUCCESS; /* directory listing */
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(rc == WS_SUCCESS) {
+ state(conn, SSH_STOP);
+ return CURLE_OK;
+ }
+
+ failf(data, "wolfssh SFTP CLOSE failed: %d", rc);
+ return CURLE_SSH;
+
+ case SSH_SFTP_READDIR_INIT:
+ Curl_pgrsSetDownloadSize(data, -1);
+ if(data->set.opt_no_body) {
+ state(conn, SSH_STOP);
+ break;
+ }
+ state(conn, SSH_SFTP_READDIR);
+ /* FALLTHROUGH */
+ case SSH_SFTP_READDIR:
+ name = wolfSSH_SFTP_LS(sshc->ssh_session, sftp_scp->path);
+ if(!name)
+ rc = wolfSSH_get_error(sshc->ssh_session);
+ else
+ rc = WS_SUCCESS;
+
+ if(rc == WS_WANT_READ) {
+ *block = TRUE;
+ conn->waitfor = KEEP_RECV;
+ return CURLE_OK;
+ }
+ else if(rc == WS_WANT_WRITE) {
+ *block = TRUE;
+ conn->waitfor = KEEP_SEND;
+ return CURLE_OK;
+ }
+ else if(name && (rc == WS_SUCCESS)) {
+ WS_SFTPNAME *origname = name;
+ result = CURLE_OK;
+ while(name) {
+ char *line = aprintf("%s\n",
+ data->set.ftp_list_only ?
+ name->fName : name->lName);
+ if(line == NULL) {
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->actualcode = CURLE_OUT_OF_MEMORY;
+ break;
+ }
+ result = Curl_client_write(conn, CLIENTWRITE_BODY,
+ line, strlen(line));
+ free(line);
+ if(result) {
+ sshc->actualcode = result;
+ break;
+ }
+ name = name->next;
+ }
+ wolfSSH_SFTPNAME_list_free(origname);
+ state(conn, SSH_STOP);
+ return result;
+ }
+ failf(data, "wolfssh SFTP ls failed: %d", rc);
+ return CURLE_SSH;
+
+ case SSH_SFTP_SHUTDOWN:
+ Curl_safefree(sshc->homedir);
+ wolfSSH_free(sshc->ssh_session);
+ wolfSSH_CTX_free(sshc->ctx);
+ state(conn, SSH_STOP);
+ return CURLE_OK;
+ default:
+ break;
+ }
+ } while(!rc && (sshc->state != SSH_STOP));
+ return result;
+}
+
+/* called repeatedly until done from multi.c */
+static CURLcode wssh_multi_statemach(struct connectdata *conn, bool *done)
+{
+ struct ssh_conn *sshc = &conn->proto.sshc;
+ CURLcode result = CURLE_OK;
+ bool block; /* we store the status and use that to provide a ssh_getsock()
+ implementation */
+ do {
+ result = wssh_statemach_act(conn, &block);
+ *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
+ /* if there's no error, it isn't done and it didn't EWOULDBLOCK, then
+ try again */
+ if(*done) {
+ DEBUGF(infof(conn->data, "wssh_statemach_act says DONE\n"));
+ }
+ } while(!result && !*done && !block);
+
+ return result;
+}
+
+static
+CURLcode wscp_perform(struct connectdata *conn,
+ bool *connected,
+ bool *dophase_done)
+{
+ (void)conn;
+ (void)connected;
+ (void)dophase_done;
+ return CURLE_OK;
+}
+
+static
+CURLcode wsftp_perform(struct connectdata *conn,
+ bool *connected,
+ bool *dophase_done)
+{
+ CURLcode result = CURLE_OK;
+
+ DEBUGF(infof(conn->data, "DO phase starts\n"));
+
+ *dophase_done = FALSE; /* not done yet */
+
+ /* start the first command in the DO phase */
+ state(conn, SSH_SFTP_QUOTE_INIT);
+
+ /* run the state-machine */
+ result = wssh_multi_statemach(conn, dophase_done);
+
+ *connected = conn->bits.tcpconnect[FIRSTSOCKET];
+
+ if(*dophase_done) {
+ DEBUGF(infof(conn->data, "DO phase is complete\n"));
+ }
+
+ return result;
+}
+
+/*
+ * The DO function is generic for both protocols.
+ */
+static CURLcode wssh_do(struct connectdata *conn, bool *done)
+{
+ CURLcode result;
+ bool connected = 0;
+ struct Curl_easy *data = conn->data;
+ struct ssh_conn *sshc = &conn->proto.sshc;
+
+ *done = FALSE; /* default to false */
+ data->req.size = -1; /* make sure this is unknown at this point */
+ sshc->actualcode = CURLE_OK; /* reset error code */
+ sshc->secondCreateDirs = 0; /* reset the create dir attempt state
+ variable */
+
+ Curl_pgrsSetUploadCounter(data, 0);
+ Curl_pgrsSetDownloadCounter(data, 0);
+ Curl_pgrsSetUploadSize(data, -1);
+ Curl_pgrsSetDownloadSize(data, -1);
+
+ if(conn->handler->protocol & CURLPROTO_SCP)
+ result = wscp_perform(conn, &connected, done);
+ else
+ result = wsftp_perform(conn, &connected, done);
+
+ return result;
+}
+
+static CURLcode wssh_block_statemach(struct connectdata *conn,
+ bool disconnect)
+{
+ struct ssh_conn *sshc = &conn->proto.sshc;
+ CURLcode result = CURLE_OK;
+ struct Curl_easy *data = conn->data;
+
+ while((sshc->state != SSH_STOP) && !result) {
+ bool block;
+ timediff_t left = 1000;
+ struct curltime now = Curl_now();
+
+ result = wssh_statemach_act(conn, &block);
+ if(result)
+ break;
+
+ if(!disconnect) {
+ if(Curl_pgrsUpdate(conn))
+ return CURLE_ABORTED_BY_CALLBACK;
+
+ result = Curl_speedcheck(data, now);
+ if(result)
+ break;
+
+ left = Curl_timeleft(data, NULL, FALSE);
+ if(left < 0) {
+ failf(data, "Operation timed out");
+ return CURLE_OPERATION_TIMEDOUT;
+ }
+ }
+
+ if(!result) {
+ int dir = conn->waitfor;
+ curl_socket_t sock = conn->sock[FIRSTSOCKET];
+ curl_socket_t fd_read = CURL_SOCKET_BAD;
+ curl_socket_t fd_write = CURL_SOCKET_BAD;
+ if(dir == KEEP_RECV)
+ fd_read = sock;
+ else if(dir == KEEP_SEND)
+ fd_write = sock;
+
+ /* wait for the socket to become ready */
+ (void)Curl_socket_check(fd_read, CURL_SOCKET_BAD, fd_write,
+ left>1000?1000:left); /* ignore result */
+ }
+ }
+
+ return result;
+}
+
+/* generic done function for both SCP and SFTP called from their specific
+ done functions */
+static CURLcode wssh_done(struct connectdata *conn, CURLcode status)
+{
+ CURLcode result = CURLE_OK;
+ struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
+
+ if(!status) {
+ /* run the state-machine */
+ result = wssh_block_statemach(conn, FALSE);
+ }
+ else
+ result = status;
+
+ if(sftp_scp)
+ Curl_safefree(sftp_scp->path);
+ if(Curl_pgrsDone(conn))
+ return CURLE_ABORTED_BY_CALLBACK;
+
+ conn->data->req.keepon = 0; /* clear all bits */
+ return result;
+}
+
+#if 0
+static CURLcode wscp_done(struct connectdata *conn,
+ CURLcode code, bool premature)
+{
+ CURLcode result = CURLE_OK;
+ (void)conn;
+ (void)code;
+ (void)premature;
+
+ return result;
+}
+
+static CURLcode wscp_doing(struct connectdata *conn,
+ bool *dophase_done)
+{
+ CURLcode result = CURLE_OK;
+ (void)conn;
+ (void)dophase_done;
+
+ return result;
+}
+
+static CURLcode wscp_disconnect(struct connectdata *conn, bool dead_connection)
+{
+ CURLcode result = CURLE_OK;
+ (void)conn;
+ (void)dead_connection;
+
+ return result;
+}
+#endif
+
+static CURLcode wsftp_done(struct connectdata *conn,
+ CURLcode code, bool premature)
+{
+ (void)premature;
+ state(conn, SSH_SFTP_CLOSE);
+
+ return wssh_done(conn, code);
+}
+
+static CURLcode wsftp_doing(struct connectdata *conn,
+ bool *dophase_done)
+{
+ CURLcode result = wssh_multi_statemach(conn, dophase_done);
+
+ if(*dophase_done) {
+ DEBUGF(infof(conn->data, "DO phase is complete\n"));
+ }
+ return result;
+}
+
+static CURLcode wsftp_disconnect(struct connectdata *conn, bool dead)
+{
+ CURLcode result = CURLE_OK;
+ (void)dead;
+
+ DEBUGF(infof(conn->data, "SSH DISCONNECT starts now\n"));
+
+ if(conn->proto.sshc.ssh_session) {
+ /* only if there's a session still around to use! */
+ state(conn, SSH_SFTP_SHUTDOWN);
+ result = wssh_block_statemach(conn, TRUE);
+ }
+
+ DEBUGF(infof(conn->data, "SSH DISCONNECT is done\n"));
+ return result;
+}
+
+static int wssh_getsock(struct connectdata *conn,
+ curl_socket_t *sock)
+{
+ return wssh_perform_getsock(conn, sock);
+}
+
+static int wssh_perform_getsock(const struct connectdata *conn,
+ curl_socket_t *sock)
+{
+ int bitmap = GETSOCK_BLANK;
+ int dir = conn->waitfor;
+ sock[0] = conn->sock[FIRSTSOCKET];
+
+ if(dir == KEEP_RECV)
+ bitmap |= GETSOCK_READSOCK(FIRSTSOCKET);
+ else if(dir == KEEP_SEND)
+ bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET);
+
+ return bitmap;
+}
+
+size_t Curl_ssh_version(char *buffer, size_t buflen)
+{
+ return msnprintf(buffer, buflen, "wolfssh/%s", LIBWOLFSSH_VERSION_STRING);
+}
+
+CURLcode Curl_ssh_init(void)
+{
+ if(WS_SUCCESS != wolfSSH_Init()) {
+ DEBUGF(fprintf(stderr, "Error: wolfSSH_Init failed\n"));
+ return CURLE_FAILED_INIT;
+ }
+
+ return CURLE_OK;
+}
+void Curl_ssh_cleanup(void)
+{
+}
+
+#endif /* USE_WOLFSSH */
diff --git a/contrib/libs/curl/lib/vtls/bearssl.c b/contrib/libs/curl/lib/vtls/bearssl.c
index 8599844c1d..b0c3dc2f07 100644
--- a/contrib/libs/curl/lib/vtls/bearssl.c
+++ b/contrib/libs/curl/lib/vtls/bearssl.c
@@ -1,877 +1,877 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2019 - 2020, Michael Forney, <mforney@mforney.org>
- *
- * 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.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"
-
-#ifdef USE_BEARSSL
-
-#include <bearssl.h>
-
-#include "bearssl.h"
-#include "urldata.h"
-#include "sendf.h"
-#include "inet_pton.h"
-#include "vtls.h"
-#include "connect.h"
-#include "select.h"
-#include "multiif.h"
-#include "curl_printf.h"
-#include "curl_memory.h"
-
-struct x509_context {
- const br_x509_class *vtable;
- br_x509_minimal_context minimal;
- bool verifyhost;
- bool verifypeer;
-};
-
-struct ssl_backend_data {
- br_ssl_client_context ctx;
- struct x509_context x509;
- unsigned char buf[BR_SSL_BUFSIZE_BIDI];
- br_x509_trust_anchor *anchors;
- size_t anchors_len;
- const char *protocols[2];
- /* SSL client context is active */
- bool active;
- /* size of pending write, yet to be flushed */
- size_t pending_write;
-};
-
-struct cafile_parser {
- CURLcode err;
- bool in_cert;
- br_x509_decoder_context xc;
- /* array of trust anchors loaded from CAfile */
- br_x509_trust_anchor *anchors;
- size_t anchors_len;
- /* buffer for DN data */
- unsigned char dn[1024];
- size_t dn_len;
-};
-
-static void append_dn(void *ctx, const void *buf, size_t len)
-{
- struct cafile_parser *ca = ctx;
-
- if(ca->err != CURLE_OK || !ca->in_cert)
- return;
- if(sizeof(ca->dn) - ca->dn_len < len) {
- ca->err = CURLE_FAILED_INIT;
- return;
- }
- memcpy(ca->dn + ca->dn_len, buf, len);
- ca->dn_len += len;
-}
-
-static void x509_push(void *ctx, const void *buf, size_t len)
-{
- struct cafile_parser *ca = ctx;
-
- if(ca->in_cert)
- br_x509_decoder_push(&ca->xc, buf, len);
-}
-
-static CURLcode load_cafile(const char *path, br_x509_trust_anchor **anchors,
- size_t *anchors_len)
-{
- struct cafile_parser ca;
- br_pem_decoder_context pc;
- br_x509_trust_anchor *ta;
- size_t ta_size;
- br_x509_trust_anchor *new_anchors;
- size_t new_anchors_len;
- br_x509_pkey *pkey;
- FILE *fp;
- unsigned char buf[BUFSIZ], *p;
- const char *name;
- size_t n, i, pushed;
-
- fp = fopen(path, "rb");
- if(!fp)
- return CURLE_SSL_CACERT_BADFILE;
-
- ca.err = CURLE_OK;
- ca.in_cert = FALSE;
- ca.anchors = NULL;
- ca.anchors_len = 0;
- br_pem_decoder_init(&pc);
- br_pem_decoder_setdest(&pc, x509_push, &ca);
- for(;;) {
- n = fread(buf, 1, sizeof(buf), fp);
- if(n == 0)
- break;
- p = buf;
- while(n) {
- pushed = br_pem_decoder_push(&pc, p, n);
- if(ca.err)
- goto fail;
- p += pushed;
- n -= pushed;
-
- switch(br_pem_decoder_event(&pc)) {
- case 0:
- break;
- case BR_PEM_BEGIN_OBJ:
- name = br_pem_decoder_name(&pc);
- if(strcmp(name, "CERTIFICATE") && strcmp(name, "X509 CERTIFICATE"))
- break;
- br_x509_decoder_init(&ca.xc, append_dn, &ca);
- if(ca.anchors_len == SIZE_MAX / sizeof(ca.anchors[0])) {
- ca.err = CURLE_OUT_OF_MEMORY;
- goto fail;
- }
- new_anchors_len = ca.anchors_len + 1;
- new_anchors = realloc(ca.anchors,
- new_anchors_len * sizeof(ca.anchors[0]));
- if(!new_anchors) {
- ca.err = CURLE_OUT_OF_MEMORY;
- goto fail;
- }
- ca.anchors = new_anchors;
- ca.anchors_len = new_anchors_len;
- ca.in_cert = TRUE;
- ca.dn_len = 0;
- ta = &ca.anchors[ca.anchors_len - 1];
- ta->dn.data = NULL;
- break;
- case BR_PEM_END_OBJ:
- if(!ca.in_cert)
- break;
- ca.in_cert = FALSE;
- if(br_x509_decoder_last_error(&ca.xc)) {
- ca.err = CURLE_SSL_CACERT_BADFILE;
- goto fail;
- }
- ta->flags = 0;
- if(br_x509_decoder_isCA(&ca.xc))
- ta->flags |= BR_X509_TA_CA;
- pkey = br_x509_decoder_get_pkey(&ca.xc);
- if(!pkey) {
- ca.err = CURLE_SSL_CACERT_BADFILE;
- goto fail;
- }
- ta->pkey = *pkey;
-
- /* calculate space needed for trust anchor data */
- ta_size = ca.dn_len;
- switch(pkey->key_type) {
- case BR_KEYTYPE_RSA:
- ta_size += pkey->key.rsa.nlen + pkey->key.rsa.elen;
- break;
- case BR_KEYTYPE_EC:
- ta_size += pkey->key.ec.qlen;
- break;
- default:
- ca.err = CURLE_FAILED_INIT;
- goto fail;
- }
-
- /* fill in trust anchor DN and public key data */
- ta->dn.data = malloc(ta_size);
- if(!ta->dn.data) {
- ca.err = CURLE_OUT_OF_MEMORY;
- goto fail;
- }
- memcpy(ta->dn.data, ca.dn, ca.dn_len);
- ta->dn.len = ca.dn_len;
- switch(pkey->key_type) {
- case BR_KEYTYPE_RSA:
- ta->pkey.key.rsa.n = ta->dn.data + ta->dn.len;
- memcpy(ta->pkey.key.rsa.n, pkey->key.rsa.n, pkey->key.rsa.nlen);
- ta->pkey.key.rsa.e = ta->pkey.key.rsa.n + ta->pkey.key.rsa.nlen;
- memcpy(ta->pkey.key.rsa.e, pkey->key.rsa.e, pkey->key.rsa.elen);
- break;
- case BR_KEYTYPE_EC:
- ta->pkey.key.ec.q = ta->dn.data + ta->dn.len;
- memcpy(ta->pkey.key.ec.q, pkey->key.ec.q, pkey->key.ec.qlen);
- break;
- }
- break;
- default:
- ca.err = CURLE_SSL_CACERT_BADFILE;
- goto fail;
- }
- }
- }
- if(ferror(fp))
- ca.err = CURLE_READ_ERROR;
-
-fail:
- fclose(fp);
- if(ca.err == CURLE_OK) {
- *anchors = ca.anchors;
- *anchors_len = ca.anchors_len;
- }
- else {
- for(i = 0; i < ca.anchors_len; ++i)
- free(ca.anchors[i].dn.data);
- free(ca.anchors);
- }
-
- return ca.err;
-}
-
-static void x509_start_chain(const br_x509_class **ctx,
- const char *server_name)
-{
- struct x509_context *x509 = (struct x509_context *)ctx;
-
- if(!x509->verifyhost)
- server_name = NULL;
- x509->minimal.vtable->start_chain(&x509->minimal.vtable, server_name);
-}
-
-static void x509_start_cert(const br_x509_class **ctx, uint32_t length)
-{
- struct x509_context *x509 = (struct x509_context *)ctx;
-
- x509->minimal.vtable->start_cert(&x509->minimal.vtable, length);
-}
-
-static void x509_append(const br_x509_class **ctx, const unsigned char *buf,
- size_t len)
-{
- struct x509_context *x509 = (struct x509_context *)ctx;
-
- x509->minimal.vtable->append(&x509->minimal.vtable, buf, len);
-}
-
-static void x509_end_cert(const br_x509_class **ctx)
-{
- struct x509_context *x509 = (struct x509_context *)ctx;
-
- x509->minimal.vtable->end_cert(&x509->minimal.vtable);
-}
-
-static unsigned x509_end_chain(const br_x509_class **ctx)
-{
- struct x509_context *x509 = (struct x509_context *)ctx;
- unsigned err;
-
- err = x509->minimal.vtable->end_chain(&x509->minimal.vtable);
- if(err && !x509->verifypeer) {
- /* ignore any X.509 errors */
- err = BR_ERR_OK;
- }
-
- return err;
-}
-
-static const br_x509_pkey *x509_get_pkey(const br_x509_class *const *ctx,
- unsigned *usages)
-{
- struct x509_context *x509 = (struct x509_context *)ctx;
-
- return x509->minimal.vtable->get_pkey(&x509->minimal.vtable, usages);
-}
-
-static const br_x509_class x509_vtable = {
- sizeof(struct x509_context),
- x509_start_chain,
- x509_start_cert,
- x509_append,
- x509_end_cert,
- x509_end_chain,
- x509_get_pkey
-};
-
-static CURLcode bearssl_connect_step1(struct connectdata *conn, int sockindex)
-{
- struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
-#ifndef CURL_DISABLE_PROXY
- const char *hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
- conn->host.name;
-#else
- const char *hostname = conn->host.name;
-#endif
- const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
- const bool verifyhost = SSL_CONN_CONFIG(verifyhost);
- CURLcode ret;
- unsigned version_min, version_max;
-#ifdef ENABLE_IPV6
- struct in6_addr addr;
-#else
- struct in_addr addr;
-#endif
-
- switch(SSL_CONN_CONFIG(version)) {
- case CURL_SSLVERSION_SSLv2:
- failf(data, "BearSSL does not support SSLv2");
- return CURLE_SSL_CONNECT_ERROR;
- case CURL_SSLVERSION_SSLv3:
- failf(data, "BearSSL does not support SSLv3");
- return CURLE_SSL_CONNECT_ERROR;
- case CURL_SSLVERSION_TLSv1_0:
- version_min = BR_TLS10;
- version_max = BR_TLS10;
- break;
- case CURL_SSLVERSION_TLSv1_1:
- version_min = BR_TLS11;
- version_max = BR_TLS11;
- break;
- case CURL_SSLVERSION_TLSv1_2:
- version_min = BR_TLS12;
- version_max = BR_TLS12;
- break;
- case CURL_SSLVERSION_DEFAULT:
- case CURL_SSLVERSION_TLSv1:
- version_min = BR_TLS10;
- version_max = BR_TLS12;
- break;
- default:
- failf(data, "BearSSL: unknown CURLOPT_SSLVERSION");
- return CURLE_SSL_CONNECT_ERROR;
- }
-
- if(ssl_cafile) {
- ret = load_cafile(ssl_cafile, &backend->anchors, &backend->anchors_len);
- if(ret != CURLE_OK) {
- if(verifypeer) {
- failf(data, "error setting certificate verify locations:\n"
- " CAfile: %s\n", ssl_cafile);
- return ret;
- }
- infof(data, "error setting certificate verify locations,"
- " continuing anyway:\n");
- }
- }
-
- /* initialize SSL context */
- br_ssl_client_init_full(&backend->ctx, &backend->x509.minimal,
- backend->anchors, backend->anchors_len);
- br_ssl_engine_set_versions(&backend->ctx.eng, version_min, version_max);
- br_ssl_engine_set_buffer(&backend->ctx.eng, backend->buf,
- sizeof(backend->buf), 1);
-
- /* initialize X.509 context */
- backend->x509.vtable = &x509_vtable;
- backend->x509.verifypeer = verifypeer;
- backend->x509.verifyhost = verifyhost;
- br_ssl_engine_set_x509(&backend->ctx.eng, &backend->x509.vtable);
-
- if(SSL_SET_OPTION(primary.sessionid)) {
- void *session;
-
- Curl_ssl_sessionid_lock(conn);
- if(!Curl_ssl_getsessionid(conn, &session, NULL, sockindex)) {
- br_ssl_engine_set_session_parameters(&backend->ctx.eng, session);
- infof(data, "BearSSL: re-using session ID\n");
- }
- Curl_ssl_sessionid_unlock(conn);
- }
-
- if(conn->bits.tls_enable_alpn) {
- int cur = 0;
-
- /* NOTE: when adding more protocols here, increase the size of the
- * protocols array in `struct ssl_backend_data`.
- */
-
-#ifdef USE_NGHTTP2
- if(data->set.httpversion >= CURL_HTTP_VERSION_2
-#ifndef CURL_DISABLE_PROXY
- && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
-#endif
- ) {
- backend->protocols[cur++] = NGHTTP2_PROTO_VERSION_ID;
- infof(data, "ALPN, offering %s\n", NGHTTP2_PROTO_VERSION_ID);
- }
-#endif
-
- backend->protocols[cur++] = ALPN_HTTP_1_1;
- infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1);
-
- br_ssl_engine_set_protocol_names(&backend->ctx.eng,
- backend->protocols, cur);
- }
-
- if((1 == Curl_inet_pton(AF_INET, hostname, &addr))
-#ifdef ENABLE_IPV6
- || (1 == Curl_inet_pton(AF_INET6, hostname, &addr))
-#endif
- ) {
- if(verifyhost) {
- failf(data, "BearSSL: "
- "host verification of IP address is not supported");
- return CURLE_PEER_FAILED_VERIFICATION;
- }
- hostname = NULL;
- }
-
- if(!br_ssl_client_reset(&backend->ctx, hostname, 0))
- return CURLE_FAILED_INIT;
- backend->active = TRUE;
-
- connssl->connecting_state = ssl_connect_2;
-
- return CURLE_OK;
-}
-
-static CURLcode bearssl_run_until(struct connectdata *conn, int sockindex,
- unsigned target)
-{
- struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- curl_socket_t sockfd = conn->sock[sockindex];
- unsigned state;
- unsigned char *buf;
- size_t len;
- ssize_t ret;
- int err;
-
- for(;;) {
- state = br_ssl_engine_current_state(&backend->ctx.eng);
- if(state & BR_SSL_CLOSED) {
- err = br_ssl_engine_last_error(&backend->ctx.eng);
- switch(err) {
- case BR_ERR_OK:
- /* TLS close notify */
- if(connssl->state != ssl_connection_complete) {
- failf(data, "SSL: connection closed during handshake");
- return CURLE_SSL_CONNECT_ERROR;
- }
- return CURLE_OK;
- case BR_ERR_X509_EXPIRED:
- failf(data, "SSL: X.509 verification: "
- "certificate is expired or not yet valid");
- return CURLE_PEER_FAILED_VERIFICATION;
- case BR_ERR_X509_BAD_SERVER_NAME:
- failf(data, "SSL: X.509 verification: "
- "expected server name was not found in the chain");
- return CURLE_PEER_FAILED_VERIFICATION;
- case BR_ERR_X509_NOT_TRUSTED:
- failf(data, "SSL: X.509 verification: "
- "chain could not be linked to a trust anchor");
- return CURLE_PEER_FAILED_VERIFICATION;
- }
- /* X.509 errors are documented to have the range 32..63 */
- if(err >= 32 && err < 64)
- return CURLE_PEER_FAILED_VERIFICATION;
- return CURLE_SSL_CONNECT_ERROR;
- }
- if(state & target)
- return CURLE_OK;
- if(state & BR_SSL_SENDREC) {
- buf = br_ssl_engine_sendrec_buf(&backend->ctx.eng, &len);
- ret = swrite(sockfd, buf, len);
- if(ret == -1) {
- if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK) {
- if(connssl->state != ssl_connection_complete)
- connssl->connecting_state = ssl_connect_2_writing;
- return CURLE_AGAIN;
- }
- return CURLE_WRITE_ERROR;
- }
- br_ssl_engine_sendrec_ack(&backend->ctx.eng, ret);
- }
- else if(state & BR_SSL_RECVREC) {
- buf = br_ssl_engine_recvrec_buf(&backend->ctx.eng, &len);
- ret = sread(sockfd, buf, len);
- if(ret == 0) {
- failf(data, "SSL: EOF without close notify");
- return CURLE_READ_ERROR;
- }
- if(ret == -1) {
- if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK) {
- if(connssl->state != ssl_connection_complete)
- connssl->connecting_state = ssl_connect_2_reading;
- return CURLE_AGAIN;
- }
- return CURLE_READ_ERROR;
- }
- br_ssl_engine_recvrec_ack(&backend->ctx.eng, ret);
- }
- }
-}
-
-static CURLcode bearssl_connect_step2(struct connectdata *conn, int sockindex)
-{
- struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- CURLcode ret;
-
- ret = bearssl_run_until(conn, sockindex, BR_SSL_SENDAPP | BR_SSL_RECVAPP);
- if(ret == CURLE_AGAIN)
- return CURLE_OK;
- if(ret == CURLE_OK) {
- if(br_ssl_engine_current_state(&backend->ctx.eng) == BR_SSL_CLOSED) {
- failf(data, "SSL: connection closed during handshake");
- return CURLE_SSL_CONNECT_ERROR;
- }
- connssl->connecting_state = ssl_connect_3;
- }
- return ret;
-}
-
-static CURLcode bearssl_connect_step3(struct connectdata *conn, int sockindex)
-{
- struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- CURLcode ret;
-
- DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
-
- if(conn->bits.tls_enable_alpn) {
- const char *protocol;
-
- protocol = br_ssl_engine_get_selected_protocol(&backend->ctx.eng);
- if(protocol) {
- infof(data, "ALPN, server accepted to use %s\n", protocol);
-
-#ifdef USE_NGHTTP2
- if(!strcmp(protocol, NGHTTP2_PROTO_VERSION_ID))
- conn->negnpn = CURL_HTTP_VERSION_2;
- else
-#endif
- if(!strcmp(protocol, ALPN_HTTP_1_1))
- conn->negnpn = CURL_HTTP_VERSION_1_1;
- else
- infof(data, "ALPN, unrecognized protocol %s\n", protocol);
- Curl_multiuse_state(conn, conn->negnpn == CURL_HTTP_VERSION_2 ?
- BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
- }
- else
- infof(data, "ALPN, server did not agree to a protocol\n");
- }
-
- if(SSL_SET_OPTION(primary.sessionid)) {
- bool incache;
- void *oldsession;
- br_ssl_session_parameters *session;
-
- session = malloc(sizeof(*session));
- if(!session)
- return CURLE_OUT_OF_MEMORY;
- br_ssl_engine_get_session_parameters(&backend->ctx.eng, session);
- Curl_ssl_sessionid_lock(conn);
- incache = !(Curl_ssl_getsessionid(conn, &oldsession, NULL, sockindex));
- if(incache)
- Curl_ssl_delsessionid(conn, oldsession);
- ret = Curl_ssl_addsessionid(conn, session, 0, sockindex);
- Curl_ssl_sessionid_unlock(conn);
- if(ret) {
- free(session);
- return CURLE_OUT_OF_MEMORY;
- }
- }
-
- connssl->connecting_state = ssl_connect_done;
-
- return CURLE_OK;
-}
-
-static ssize_t bearssl_send(struct connectdata *conn, int sockindex,
- const void *buf, size_t len, CURLcode *err)
-{
- struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- unsigned char *app;
- size_t applen;
-
- for(;;) {
- *err = bearssl_run_until(conn, sockindex, BR_SSL_SENDAPP);
- if (*err != CURLE_OK)
- return -1;
- app = br_ssl_engine_sendapp_buf(&backend->ctx.eng, &applen);
- if(!app) {
- failf(data, "SSL: connection closed during write");
- *err = CURLE_SEND_ERROR;
- return -1;
- }
- if(backend->pending_write) {
- applen = backend->pending_write;
- backend->pending_write = 0;
- return applen;
- }
- if(applen > len)
- applen = len;
- memcpy(app, buf, applen);
- br_ssl_engine_sendapp_ack(&backend->ctx.eng, applen);
- br_ssl_engine_flush(&backend->ctx.eng, 0);
- backend->pending_write = applen;
- }
-}
-
-static ssize_t bearssl_recv(struct connectdata *conn, int sockindex,
- char *buf, size_t len, CURLcode *err)
-{
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- unsigned char *app;
- size_t applen;
-
- *err = bearssl_run_until(conn, sockindex, BR_SSL_RECVAPP);
- if(*err != CURLE_OK)
- return -1;
- app = br_ssl_engine_recvapp_buf(&backend->ctx.eng, &applen);
- if(!app)
- return 0;
- if(applen > len)
- applen = len;
- memcpy(buf, app, applen);
- br_ssl_engine_recvapp_ack(&backend->ctx.eng, applen);
-
- return applen;
-}
-
-static CURLcode bearssl_connect_common(struct connectdata *conn,
- int sockindex,
- bool nonblocking,
- bool *done)
-{
- CURLcode ret;
- struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- curl_socket_t sockfd = conn->sock[sockindex];
- timediff_t timeout_ms;
- int what;
-
- /* check if the connection has already been established */
- if(ssl_connection_complete == connssl->state) {
- *done = TRUE;
- return CURLE_OK;
- }
-
- if(ssl_connect_1 == connssl->connecting_state) {
- ret = bearssl_connect_step1(conn, sockindex);
- if(ret)
- return ret;
- }
-
- while(ssl_connect_2 == connssl->connecting_state ||
- ssl_connect_2_reading == connssl->connecting_state ||
- ssl_connect_2_writing == connssl->connecting_state) {
- /* check allowed time left */
- timeout_ms = Curl_timeleft(data, NULL, TRUE);
-
- if(timeout_ms < 0) {
- /* no need to continue if time already is up */
- failf(data, "SSL connection timeout");
- return CURLE_OPERATION_TIMEDOUT;
- }
-
- /* if ssl is expecting something, check if it's available. */
- if(ssl_connect_2_reading == connssl->connecting_state ||
- ssl_connect_2_writing == connssl->connecting_state) {
-
- curl_socket_t writefd = ssl_connect_2_writing ==
- connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
- curl_socket_t readfd = ssl_connect_2_reading ==
- connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
-
- what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
- nonblocking?0:timeout_ms);
- if(what < 0) {
- /* fatal error */
- failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
- return CURLE_SSL_CONNECT_ERROR;
- }
- else if(0 == what) {
- if(nonblocking) {
- *done = FALSE;
- return CURLE_OK;
- }
- else {
- /* timeout */
- failf(data, "SSL connection timeout");
- return CURLE_OPERATION_TIMEDOUT;
- }
- }
- /* socket is readable or writable */
- }
-
- /* Run transaction, and return to the caller if it failed or if this
- * connection is done nonblocking and this loop would execute again. This
- * permits the owner of a multi handle to abort a connection attempt
- * before step2 has completed while ensuring that a client using select()
- * or epoll() will always have a valid fdset to wait on.
- */
- ret = bearssl_connect_step2(conn, sockindex);
- if(ret || (nonblocking &&
- (ssl_connect_2 == connssl->connecting_state ||
- ssl_connect_2_reading == connssl->connecting_state ||
- ssl_connect_2_writing == connssl->connecting_state)))
- return ret;
- }
-
- if(ssl_connect_3 == connssl->connecting_state) {
- ret = bearssl_connect_step3(conn, sockindex);
- if(ret)
- return ret;
- }
-
- if(ssl_connect_done == connssl->connecting_state) {
- connssl->state = ssl_connection_complete;
- conn->recv[sockindex] = bearssl_recv;
- conn->send[sockindex] = bearssl_send;
- *done = TRUE;
- }
- else
- *done = FALSE;
-
- /* Reset our connect state machine */
- connssl->connecting_state = ssl_connect_1;
-
- return CURLE_OK;
-}
-
-static size_t Curl_bearssl_version(char *buffer, size_t size)
-{
- return msnprintf(buffer, size, "BearSSL");
-}
-
-static bool Curl_bearssl_data_pending(const struct connectdata *conn,
- int connindex)
-{
- const struct ssl_connect_data *connssl = &conn->ssl[connindex];
- struct ssl_backend_data *backend = connssl->backend;
- return br_ssl_engine_current_state(&backend->ctx.eng) & BR_SSL_RECVAPP;
-}
-
-static CURLcode Curl_bearssl_random(struct Curl_easy *data UNUSED_PARAM,
- unsigned char *entropy, size_t length)
-{
- static br_hmac_drbg_context ctx;
- static bool seeded = FALSE;
-
- if(!seeded) {
- br_prng_seeder seeder;
-
- br_hmac_drbg_init(&ctx, &br_sha256_vtable, NULL, 0);
- seeder = br_prng_seeder_system(NULL);
- if(!seeder || !seeder(&ctx.vtable))
- return CURLE_FAILED_INIT;
- seeded = TRUE;
- }
- br_hmac_drbg_generate(&ctx, entropy, length);
-
- return CURLE_OK;
-}
-
-static CURLcode Curl_bearssl_connect(struct connectdata *conn, int sockindex)
-{
- CURLcode ret;
- bool done = FALSE;
-
- ret = bearssl_connect_common(conn, sockindex, FALSE, &done);
- if(ret)
- return ret;
-
- DEBUGASSERT(done);
-
- return CURLE_OK;
-}
-
-static CURLcode Curl_bearssl_connect_nonblocking(struct connectdata *conn,
- int sockindex, bool *done)
-{
- return bearssl_connect_common(conn, sockindex, TRUE, done);
-}
-
-static void *Curl_bearssl_get_internals(struct ssl_connect_data *connssl,
- CURLINFO info UNUSED_PARAM)
-{
- struct ssl_backend_data *backend = connssl->backend;
- return &backend->ctx;
-}
-
-static void Curl_bearssl_close(struct connectdata *conn, int sockindex)
-{
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- size_t i;
-
- if(backend->active) {
- br_ssl_engine_close(&backend->ctx.eng);
- (void)bearssl_run_until(conn, sockindex, BR_SSL_CLOSED);
- }
- for(i = 0; i < backend->anchors_len; ++i)
- free(backend->anchors[i].dn.data);
- free(backend->anchors);
-}
-
-static void Curl_bearssl_session_free(void *ptr)
-{
- free(ptr);
-}
-
-static CURLcode Curl_bearssl_md5sum(unsigned char *input,
- size_t inputlen,
- unsigned char *md5sum,
- size_t md5len UNUSED_PARAM)
-{
- br_md5_context ctx;
-
- br_md5_init(&ctx);
- br_md5_update(&ctx, input, inputlen);
- br_md5_out(&ctx, md5sum);
- return CURLE_OK;
-}
-
-static CURLcode Curl_bearssl_sha256sum(const unsigned char *input,
- size_t inputlen,
- unsigned char *sha256sum,
- size_t sha256len UNUSED_PARAM)
-{
- br_sha256_context ctx;
-
- br_sha256_init(&ctx);
- br_sha256_update(&ctx, input, inputlen);
- br_sha256_out(&ctx, sha256sum);
- return CURLE_OK;
-}
-
-const struct Curl_ssl Curl_ssl_bearssl = {
- { CURLSSLBACKEND_BEARSSL, "bearssl" },
- 0,
- sizeof(struct ssl_backend_data),
-
- Curl_none_init,
- Curl_none_cleanup,
- Curl_bearssl_version,
- Curl_none_check_cxn,
- Curl_none_shutdown,
- Curl_bearssl_data_pending,
- Curl_bearssl_random,
- Curl_none_cert_status_request,
- Curl_bearssl_connect,
- Curl_bearssl_connect_nonblocking,
- Curl_bearssl_get_internals,
- Curl_bearssl_close,
- Curl_none_close_all,
- Curl_bearssl_session_free,
- Curl_none_set_engine,
- Curl_none_set_engine_default,
- Curl_none_engines_list,
- Curl_none_false_start,
- Curl_bearssl_md5sum,
- Curl_bearssl_sha256sum
-};
-
-#endif /* USE_BEARSSL */
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2019 - 2020, Michael Forney, <mforney@mforney.org>
+ *
+ * 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.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"
+
+#ifdef USE_BEARSSL
+
+#include <bearssl.h>
+
+#include "bearssl.h"
+#include "urldata.h"
+#include "sendf.h"
+#include "inet_pton.h"
+#include "vtls.h"
+#include "connect.h"
+#include "select.h"
+#include "multiif.h"
+#include "curl_printf.h"
+#include "curl_memory.h"
+
+struct x509_context {
+ const br_x509_class *vtable;
+ br_x509_minimal_context minimal;
+ bool verifyhost;
+ bool verifypeer;
+};
+
+struct ssl_backend_data {
+ br_ssl_client_context ctx;
+ struct x509_context x509;
+ unsigned char buf[BR_SSL_BUFSIZE_BIDI];
+ br_x509_trust_anchor *anchors;
+ size_t anchors_len;
+ const char *protocols[2];
+ /* SSL client context is active */
+ bool active;
+ /* size of pending write, yet to be flushed */
+ size_t pending_write;
+};
+
+struct cafile_parser {
+ CURLcode err;
+ bool in_cert;
+ br_x509_decoder_context xc;
+ /* array of trust anchors loaded from CAfile */
+ br_x509_trust_anchor *anchors;
+ size_t anchors_len;
+ /* buffer for DN data */
+ unsigned char dn[1024];
+ size_t dn_len;
+};
+
+static void append_dn(void *ctx, const void *buf, size_t len)
+{
+ struct cafile_parser *ca = ctx;
+
+ if(ca->err != CURLE_OK || !ca->in_cert)
+ return;
+ if(sizeof(ca->dn) - ca->dn_len < len) {
+ ca->err = CURLE_FAILED_INIT;
+ return;
+ }
+ memcpy(ca->dn + ca->dn_len, buf, len);
+ ca->dn_len += len;
+}
+
+static void x509_push(void *ctx, const void *buf, size_t len)
+{
+ struct cafile_parser *ca = ctx;
+
+ if(ca->in_cert)
+ br_x509_decoder_push(&ca->xc, buf, len);
+}
+
+static CURLcode load_cafile(const char *path, br_x509_trust_anchor **anchors,
+ size_t *anchors_len)
+{
+ struct cafile_parser ca;
+ br_pem_decoder_context pc;
+ br_x509_trust_anchor *ta;
+ size_t ta_size;
+ br_x509_trust_anchor *new_anchors;
+ size_t new_anchors_len;
+ br_x509_pkey *pkey;
+ FILE *fp;
+ unsigned char buf[BUFSIZ], *p;
+ const char *name;
+ size_t n, i, pushed;
+
+ fp = fopen(path, "rb");
+ if(!fp)
+ return CURLE_SSL_CACERT_BADFILE;
+
+ ca.err = CURLE_OK;
+ ca.in_cert = FALSE;
+ ca.anchors = NULL;
+ ca.anchors_len = 0;
+ br_pem_decoder_init(&pc);
+ br_pem_decoder_setdest(&pc, x509_push, &ca);
+ for(;;) {
+ n = fread(buf, 1, sizeof(buf), fp);
+ if(n == 0)
+ break;
+ p = buf;
+ while(n) {
+ pushed = br_pem_decoder_push(&pc, p, n);
+ if(ca.err)
+ goto fail;
+ p += pushed;
+ n -= pushed;
+
+ switch(br_pem_decoder_event(&pc)) {
+ case 0:
+ break;
+ case BR_PEM_BEGIN_OBJ:
+ name = br_pem_decoder_name(&pc);
+ if(strcmp(name, "CERTIFICATE") && strcmp(name, "X509 CERTIFICATE"))
+ break;
+ br_x509_decoder_init(&ca.xc, append_dn, &ca);
+ if(ca.anchors_len == SIZE_MAX / sizeof(ca.anchors[0])) {
+ ca.err = CURLE_OUT_OF_MEMORY;
+ goto fail;
+ }
+ new_anchors_len = ca.anchors_len + 1;
+ new_anchors = realloc(ca.anchors,
+ new_anchors_len * sizeof(ca.anchors[0]));
+ if(!new_anchors) {
+ ca.err = CURLE_OUT_OF_MEMORY;
+ goto fail;
+ }
+ ca.anchors = new_anchors;
+ ca.anchors_len = new_anchors_len;
+ ca.in_cert = TRUE;
+ ca.dn_len = 0;
+ ta = &ca.anchors[ca.anchors_len - 1];
+ ta->dn.data = NULL;
+ break;
+ case BR_PEM_END_OBJ:
+ if(!ca.in_cert)
+ break;
+ ca.in_cert = FALSE;
+ if(br_x509_decoder_last_error(&ca.xc)) {
+ ca.err = CURLE_SSL_CACERT_BADFILE;
+ goto fail;
+ }
+ ta->flags = 0;
+ if(br_x509_decoder_isCA(&ca.xc))
+ ta->flags |= BR_X509_TA_CA;
+ pkey = br_x509_decoder_get_pkey(&ca.xc);
+ if(!pkey) {
+ ca.err = CURLE_SSL_CACERT_BADFILE;
+ goto fail;
+ }
+ ta->pkey = *pkey;
+
+ /* calculate space needed for trust anchor data */
+ ta_size = ca.dn_len;
+ switch(pkey->key_type) {
+ case BR_KEYTYPE_RSA:
+ ta_size += pkey->key.rsa.nlen + pkey->key.rsa.elen;
+ break;
+ case BR_KEYTYPE_EC:
+ ta_size += pkey->key.ec.qlen;
+ break;
+ default:
+ ca.err = CURLE_FAILED_INIT;
+ goto fail;
+ }
+
+ /* fill in trust anchor DN and public key data */
+ ta->dn.data = malloc(ta_size);
+ if(!ta->dn.data) {
+ ca.err = CURLE_OUT_OF_MEMORY;
+ goto fail;
+ }
+ memcpy(ta->dn.data, ca.dn, ca.dn_len);
+ ta->dn.len = ca.dn_len;
+ switch(pkey->key_type) {
+ case BR_KEYTYPE_RSA:
+ ta->pkey.key.rsa.n = ta->dn.data + ta->dn.len;
+ memcpy(ta->pkey.key.rsa.n, pkey->key.rsa.n, pkey->key.rsa.nlen);
+ ta->pkey.key.rsa.e = ta->pkey.key.rsa.n + ta->pkey.key.rsa.nlen;
+ memcpy(ta->pkey.key.rsa.e, pkey->key.rsa.e, pkey->key.rsa.elen);
+ break;
+ case BR_KEYTYPE_EC:
+ ta->pkey.key.ec.q = ta->dn.data + ta->dn.len;
+ memcpy(ta->pkey.key.ec.q, pkey->key.ec.q, pkey->key.ec.qlen);
+ break;
+ }
+ break;
+ default:
+ ca.err = CURLE_SSL_CACERT_BADFILE;
+ goto fail;
+ }
+ }
+ }
+ if(ferror(fp))
+ ca.err = CURLE_READ_ERROR;
+
+fail:
+ fclose(fp);
+ if(ca.err == CURLE_OK) {
+ *anchors = ca.anchors;
+ *anchors_len = ca.anchors_len;
+ }
+ else {
+ for(i = 0; i < ca.anchors_len; ++i)
+ free(ca.anchors[i].dn.data);
+ free(ca.anchors);
+ }
+
+ return ca.err;
+}
+
+static void x509_start_chain(const br_x509_class **ctx,
+ const char *server_name)
+{
+ struct x509_context *x509 = (struct x509_context *)ctx;
+
+ if(!x509->verifyhost)
+ server_name = NULL;
+ x509->minimal.vtable->start_chain(&x509->minimal.vtable, server_name);
+}
+
+static void x509_start_cert(const br_x509_class **ctx, uint32_t length)
+{
+ struct x509_context *x509 = (struct x509_context *)ctx;
+
+ x509->minimal.vtable->start_cert(&x509->minimal.vtable, length);
+}
+
+static void x509_append(const br_x509_class **ctx, const unsigned char *buf,
+ size_t len)
+{
+ struct x509_context *x509 = (struct x509_context *)ctx;
+
+ x509->minimal.vtable->append(&x509->minimal.vtable, buf, len);
+}
+
+static void x509_end_cert(const br_x509_class **ctx)
+{
+ struct x509_context *x509 = (struct x509_context *)ctx;
+
+ x509->minimal.vtable->end_cert(&x509->minimal.vtable);
+}
+
+static unsigned x509_end_chain(const br_x509_class **ctx)
+{
+ struct x509_context *x509 = (struct x509_context *)ctx;
+ unsigned err;
+
+ err = x509->minimal.vtable->end_chain(&x509->minimal.vtable);
+ if(err && !x509->verifypeer) {
+ /* ignore any X.509 errors */
+ err = BR_ERR_OK;
+ }
+
+ return err;
+}
+
+static const br_x509_pkey *x509_get_pkey(const br_x509_class *const *ctx,
+ unsigned *usages)
+{
+ struct x509_context *x509 = (struct x509_context *)ctx;
+
+ return x509->minimal.vtable->get_pkey(&x509->minimal.vtable, usages);
+}
+
+static const br_x509_class x509_vtable = {
+ sizeof(struct x509_context),
+ x509_start_chain,
+ x509_start_cert,
+ x509_append,
+ x509_end_cert,
+ x509_end_chain,
+ x509_get_pkey
+};
+
+static CURLcode bearssl_connect_step1(struct connectdata *conn, int sockindex)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
+#ifndef CURL_DISABLE_PROXY
+ const char *hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
+ conn->host.name;
+#else
+ const char *hostname = conn->host.name;
+#endif
+ const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
+ const bool verifyhost = SSL_CONN_CONFIG(verifyhost);
+ CURLcode ret;
+ unsigned version_min, version_max;
+#ifdef ENABLE_IPV6
+ struct in6_addr addr;
+#else
+ struct in_addr addr;
+#endif
+
+ switch(SSL_CONN_CONFIG(version)) {
+ case CURL_SSLVERSION_SSLv2:
+ failf(data, "BearSSL does not support SSLv2");
+ return CURLE_SSL_CONNECT_ERROR;
+ case CURL_SSLVERSION_SSLv3:
+ failf(data, "BearSSL does not support SSLv3");
+ return CURLE_SSL_CONNECT_ERROR;
+ case CURL_SSLVERSION_TLSv1_0:
+ version_min = BR_TLS10;
+ version_max = BR_TLS10;
+ break;
+ case CURL_SSLVERSION_TLSv1_1:
+ version_min = BR_TLS11;
+ version_max = BR_TLS11;
+ break;
+ case CURL_SSLVERSION_TLSv1_2:
+ version_min = BR_TLS12;
+ version_max = BR_TLS12;
+ break;
+ case CURL_SSLVERSION_DEFAULT:
+ case CURL_SSLVERSION_TLSv1:
+ version_min = BR_TLS10;
+ version_max = BR_TLS12;
+ break;
+ default:
+ failf(data, "BearSSL: unknown CURLOPT_SSLVERSION");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+
+ if(ssl_cafile) {
+ ret = load_cafile(ssl_cafile, &backend->anchors, &backend->anchors_len);
+ if(ret != CURLE_OK) {
+ if(verifypeer) {
+ failf(data, "error setting certificate verify locations:\n"
+ " CAfile: %s\n", ssl_cafile);
+ return ret;
+ }
+ infof(data, "error setting certificate verify locations,"
+ " continuing anyway:\n");
+ }
+ }
+
+ /* initialize SSL context */
+ br_ssl_client_init_full(&backend->ctx, &backend->x509.minimal,
+ backend->anchors, backend->anchors_len);
+ br_ssl_engine_set_versions(&backend->ctx.eng, version_min, version_max);
+ br_ssl_engine_set_buffer(&backend->ctx.eng, backend->buf,
+ sizeof(backend->buf), 1);
+
+ /* initialize X.509 context */
+ backend->x509.vtable = &x509_vtable;
+ backend->x509.verifypeer = verifypeer;
+ backend->x509.verifyhost = verifyhost;
+ br_ssl_engine_set_x509(&backend->ctx.eng, &backend->x509.vtable);
+
+ if(SSL_SET_OPTION(primary.sessionid)) {
+ void *session;
+
+ Curl_ssl_sessionid_lock(conn);
+ if(!Curl_ssl_getsessionid(conn, &session, NULL, sockindex)) {
+ br_ssl_engine_set_session_parameters(&backend->ctx.eng, session);
+ infof(data, "BearSSL: re-using session ID\n");
+ }
+ Curl_ssl_sessionid_unlock(conn);
+ }
+
+ if(conn->bits.tls_enable_alpn) {
+ int cur = 0;
+
+ /* NOTE: when adding more protocols here, increase the size of the
+ * protocols array in `struct ssl_backend_data`.
+ */
+
+#ifdef USE_NGHTTP2
+ if(data->set.httpversion >= CURL_HTTP_VERSION_2
+#ifndef CURL_DISABLE_PROXY
+ && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
+#endif
+ ) {
+ backend->protocols[cur++] = NGHTTP2_PROTO_VERSION_ID;
+ infof(data, "ALPN, offering %s\n", NGHTTP2_PROTO_VERSION_ID);
+ }
+#endif
+
+ backend->protocols[cur++] = ALPN_HTTP_1_1;
+ infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1);
+
+ br_ssl_engine_set_protocol_names(&backend->ctx.eng,
+ backend->protocols, cur);
+ }
+
+ if((1 == Curl_inet_pton(AF_INET, hostname, &addr))
+#ifdef ENABLE_IPV6
+ || (1 == Curl_inet_pton(AF_INET6, hostname, &addr))
+#endif
+ ) {
+ if(verifyhost) {
+ failf(data, "BearSSL: "
+ "host verification of IP address is not supported");
+ return CURLE_PEER_FAILED_VERIFICATION;
+ }
+ hostname = NULL;
+ }
+
+ if(!br_ssl_client_reset(&backend->ctx, hostname, 0))
+ return CURLE_FAILED_INIT;
+ backend->active = TRUE;
+
+ connssl->connecting_state = ssl_connect_2;
+
+ return CURLE_OK;
+}
+
+static CURLcode bearssl_run_until(struct connectdata *conn, int sockindex,
+ unsigned target)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ curl_socket_t sockfd = conn->sock[sockindex];
+ unsigned state;
+ unsigned char *buf;
+ size_t len;
+ ssize_t ret;
+ int err;
+
+ for(;;) {
+ state = br_ssl_engine_current_state(&backend->ctx.eng);
+ if(state & BR_SSL_CLOSED) {
+ err = br_ssl_engine_last_error(&backend->ctx.eng);
+ switch(err) {
+ case BR_ERR_OK:
+ /* TLS close notify */
+ if(connssl->state != ssl_connection_complete) {
+ failf(data, "SSL: connection closed during handshake");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ return CURLE_OK;
+ case BR_ERR_X509_EXPIRED:
+ failf(data, "SSL: X.509 verification: "
+ "certificate is expired or not yet valid");
+ return CURLE_PEER_FAILED_VERIFICATION;
+ case BR_ERR_X509_BAD_SERVER_NAME:
+ failf(data, "SSL: X.509 verification: "
+ "expected server name was not found in the chain");
+ return CURLE_PEER_FAILED_VERIFICATION;
+ case BR_ERR_X509_NOT_TRUSTED:
+ failf(data, "SSL: X.509 verification: "
+ "chain could not be linked to a trust anchor");
+ return CURLE_PEER_FAILED_VERIFICATION;
+ }
+ /* X.509 errors are documented to have the range 32..63 */
+ if(err >= 32 && err < 64)
+ return CURLE_PEER_FAILED_VERIFICATION;
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ if(state & target)
+ return CURLE_OK;
+ if(state & BR_SSL_SENDREC) {
+ buf = br_ssl_engine_sendrec_buf(&backend->ctx.eng, &len);
+ ret = swrite(sockfd, buf, len);
+ if(ret == -1) {
+ if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK) {
+ if(connssl->state != ssl_connection_complete)
+ connssl->connecting_state = ssl_connect_2_writing;
+ return CURLE_AGAIN;
+ }
+ return CURLE_WRITE_ERROR;
+ }
+ br_ssl_engine_sendrec_ack(&backend->ctx.eng, ret);
+ }
+ else if(state & BR_SSL_RECVREC) {
+ buf = br_ssl_engine_recvrec_buf(&backend->ctx.eng, &len);
+ ret = sread(sockfd, buf, len);
+ if(ret == 0) {
+ failf(data, "SSL: EOF without close notify");
+ return CURLE_READ_ERROR;
+ }
+ if(ret == -1) {
+ if(SOCKERRNO == EAGAIN || SOCKERRNO == EWOULDBLOCK) {
+ if(connssl->state != ssl_connection_complete)
+ connssl->connecting_state = ssl_connect_2_reading;
+ return CURLE_AGAIN;
+ }
+ return CURLE_READ_ERROR;
+ }
+ br_ssl_engine_recvrec_ack(&backend->ctx.eng, ret);
+ }
+ }
+}
+
+static CURLcode bearssl_connect_step2(struct connectdata *conn, int sockindex)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ CURLcode ret;
+
+ ret = bearssl_run_until(conn, sockindex, BR_SSL_SENDAPP | BR_SSL_RECVAPP);
+ if(ret == CURLE_AGAIN)
+ return CURLE_OK;
+ if(ret == CURLE_OK) {
+ if(br_ssl_engine_current_state(&backend->ctx.eng) == BR_SSL_CLOSED) {
+ failf(data, "SSL: connection closed during handshake");
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ connssl->connecting_state = ssl_connect_3;
+ }
+ return ret;
+}
+
+static CURLcode bearssl_connect_step3(struct connectdata *conn, int sockindex)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ CURLcode ret;
+
+ DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
+
+ if(conn->bits.tls_enable_alpn) {
+ const char *protocol;
+
+ protocol = br_ssl_engine_get_selected_protocol(&backend->ctx.eng);
+ if(protocol) {
+ infof(data, "ALPN, server accepted to use %s\n", protocol);
+
+#ifdef USE_NGHTTP2
+ if(!strcmp(protocol, NGHTTP2_PROTO_VERSION_ID))
+ conn->negnpn = CURL_HTTP_VERSION_2;
+ else
+#endif
+ if(!strcmp(protocol, ALPN_HTTP_1_1))
+ conn->negnpn = CURL_HTTP_VERSION_1_1;
+ else
+ infof(data, "ALPN, unrecognized protocol %s\n", protocol);
+ Curl_multiuse_state(conn, conn->negnpn == CURL_HTTP_VERSION_2 ?
+ BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
+ }
+ else
+ infof(data, "ALPN, server did not agree to a protocol\n");
+ }
+
+ if(SSL_SET_OPTION(primary.sessionid)) {
+ bool incache;
+ void *oldsession;
+ br_ssl_session_parameters *session;
+
+ session = malloc(sizeof(*session));
+ if(!session)
+ return CURLE_OUT_OF_MEMORY;
+ br_ssl_engine_get_session_parameters(&backend->ctx.eng, session);
+ Curl_ssl_sessionid_lock(conn);
+ incache = !(Curl_ssl_getsessionid(conn, &oldsession, NULL, sockindex));
+ if(incache)
+ Curl_ssl_delsessionid(conn, oldsession);
+ ret = Curl_ssl_addsessionid(conn, session, 0, sockindex);
+ Curl_ssl_sessionid_unlock(conn);
+ if(ret) {
+ free(session);
+ return CURLE_OUT_OF_MEMORY;
+ }
+ }
+
+ connssl->connecting_state = ssl_connect_done;
+
+ return CURLE_OK;
+}
+
+static ssize_t bearssl_send(struct connectdata *conn, int sockindex,
+ const void *buf, size_t len, CURLcode *err)
+{
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ unsigned char *app;
+ size_t applen;
+
+ for(;;) {
+ *err = bearssl_run_until(conn, sockindex, BR_SSL_SENDAPP);
+ if (*err != CURLE_OK)
+ return -1;
+ app = br_ssl_engine_sendapp_buf(&backend->ctx.eng, &applen);
+ if(!app) {
+ failf(data, "SSL: connection closed during write");
+ *err = CURLE_SEND_ERROR;
+ return -1;
+ }
+ if(backend->pending_write) {
+ applen = backend->pending_write;
+ backend->pending_write = 0;
+ return applen;
+ }
+ if(applen > len)
+ applen = len;
+ memcpy(app, buf, applen);
+ br_ssl_engine_sendapp_ack(&backend->ctx.eng, applen);
+ br_ssl_engine_flush(&backend->ctx.eng, 0);
+ backend->pending_write = applen;
+ }
+}
+
+static ssize_t bearssl_recv(struct connectdata *conn, int sockindex,
+ char *buf, size_t len, CURLcode *err)
+{
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ unsigned char *app;
+ size_t applen;
+
+ *err = bearssl_run_until(conn, sockindex, BR_SSL_RECVAPP);
+ if(*err != CURLE_OK)
+ return -1;
+ app = br_ssl_engine_recvapp_buf(&backend->ctx.eng, &applen);
+ if(!app)
+ return 0;
+ if(applen > len)
+ applen = len;
+ memcpy(buf, app, applen);
+ br_ssl_engine_recvapp_ack(&backend->ctx.eng, applen);
+
+ return applen;
+}
+
+static CURLcode bearssl_connect_common(struct connectdata *conn,
+ int sockindex,
+ bool nonblocking,
+ bool *done)
+{
+ CURLcode ret;
+ struct Curl_easy *data = conn->data;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ curl_socket_t sockfd = conn->sock[sockindex];
+ timediff_t timeout_ms;
+ int what;
+
+ /* check if the connection has already been established */
+ if(ssl_connection_complete == connssl->state) {
+ *done = TRUE;
+ return CURLE_OK;
+ }
+
+ if(ssl_connect_1 == connssl->connecting_state) {
+ ret = bearssl_connect_step1(conn, sockindex);
+ if(ret)
+ return ret;
+ }
+
+ while(ssl_connect_2 == connssl->connecting_state ||
+ ssl_connect_2_reading == connssl->connecting_state ||
+ ssl_connect_2_writing == connssl->connecting_state) {
+ /* check allowed time left */
+ timeout_ms = Curl_timeleft(data, NULL, TRUE);
+
+ if(timeout_ms < 0) {
+ /* no need to continue if time already is up */
+ failf(data, "SSL connection timeout");
+ return CURLE_OPERATION_TIMEDOUT;
+ }
+
+ /* if ssl is expecting something, check if it's available. */
+ if(ssl_connect_2_reading == connssl->connecting_state ||
+ ssl_connect_2_writing == connssl->connecting_state) {
+
+ curl_socket_t writefd = ssl_connect_2_writing ==
+ connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
+ curl_socket_t readfd = ssl_connect_2_reading ==
+ connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
+
+ what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
+ nonblocking?0:timeout_ms);
+ if(what < 0) {
+ /* fatal error */
+ failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ else if(0 == what) {
+ if(nonblocking) {
+ *done = FALSE;
+ return CURLE_OK;
+ }
+ else {
+ /* timeout */
+ failf(data, "SSL connection timeout");
+ return CURLE_OPERATION_TIMEDOUT;
+ }
+ }
+ /* socket is readable or writable */
+ }
+
+ /* Run transaction, and return to the caller if it failed or if this
+ * connection is done nonblocking and this loop would execute again. This
+ * permits the owner of a multi handle to abort a connection attempt
+ * before step2 has completed while ensuring that a client using select()
+ * or epoll() will always have a valid fdset to wait on.
+ */
+ ret = bearssl_connect_step2(conn, sockindex);
+ if(ret || (nonblocking &&
+ (ssl_connect_2 == connssl->connecting_state ||
+ ssl_connect_2_reading == connssl->connecting_state ||
+ ssl_connect_2_writing == connssl->connecting_state)))
+ return ret;
+ }
+
+ if(ssl_connect_3 == connssl->connecting_state) {
+ ret = bearssl_connect_step3(conn, sockindex);
+ if(ret)
+ return ret;
+ }
+
+ if(ssl_connect_done == connssl->connecting_state) {
+ connssl->state = ssl_connection_complete;
+ conn->recv[sockindex] = bearssl_recv;
+ conn->send[sockindex] = bearssl_send;
+ *done = TRUE;
+ }
+ else
+ *done = FALSE;
+
+ /* Reset our connect state machine */
+ connssl->connecting_state = ssl_connect_1;
+
+ return CURLE_OK;
+}
+
+static size_t Curl_bearssl_version(char *buffer, size_t size)
+{
+ return msnprintf(buffer, size, "BearSSL");
+}
+
+static bool Curl_bearssl_data_pending(const struct connectdata *conn,
+ int connindex)
+{
+ const struct ssl_connect_data *connssl = &conn->ssl[connindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ return br_ssl_engine_current_state(&backend->ctx.eng) & BR_SSL_RECVAPP;
+}
+
+static CURLcode Curl_bearssl_random(struct Curl_easy *data UNUSED_PARAM,
+ unsigned char *entropy, size_t length)
+{
+ static br_hmac_drbg_context ctx;
+ static bool seeded = FALSE;
+
+ if(!seeded) {
+ br_prng_seeder seeder;
+
+ br_hmac_drbg_init(&ctx, &br_sha256_vtable, NULL, 0);
+ seeder = br_prng_seeder_system(NULL);
+ if(!seeder || !seeder(&ctx.vtable))
+ return CURLE_FAILED_INIT;
+ seeded = TRUE;
+ }
+ br_hmac_drbg_generate(&ctx, entropy, length);
+
+ return CURLE_OK;
+}
+
+static CURLcode Curl_bearssl_connect(struct connectdata *conn, int sockindex)
+{
+ CURLcode ret;
+ bool done = FALSE;
+
+ ret = bearssl_connect_common(conn, sockindex, FALSE, &done);
+ if(ret)
+ return ret;
+
+ DEBUGASSERT(done);
+
+ return CURLE_OK;
+}
+
+static CURLcode Curl_bearssl_connect_nonblocking(struct connectdata *conn,
+ int sockindex, bool *done)
+{
+ return bearssl_connect_common(conn, sockindex, TRUE, done);
+}
+
+static void *Curl_bearssl_get_internals(struct ssl_connect_data *connssl,
+ CURLINFO info UNUSED_PARAM)
+{
+ struct ssl_backend_data *backend = connssl->backend;
+ return &backend->ctx;
+}
+
+static void Curl_bearssl_close(struct connectdata *conn, int sockindex)
+{
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+ size_t i;
+
+ if(backend->active) {
+ br_ssl_engine_close(&backend->ctx.eng);
+ (void)bearssl_run_until(conn, sockindex, BR_SSL_CLOSED);
+ }
+ for(i = 0; i < backend->anchors_len; ++i)
+ free(backend->anchors[i].dn.data);
+ free(backend->anchors);
+}
+
+static void Curl_bearssl_session_free(void *ptr)
+{
+ free(ptr);
+}
+
+static CURLcode Curl_bearssl_md5sum(unsigned char *input,
+ size_t inputlen,
+ unsigned char *md5sum,
+ size_t md5len UNUSED_PARAM)
+{
+ br_md5_context ctx;
+
+ br_md5_init(&ctx);
+ br_md5_update(&ctx, input, inputlen);
+ br_md5_out(&ctx, md5sum);
+ return CURLE_OK;
+}
+
+static CURLcode Curl_bearssl_sha256sum(const unsigned char *input,
+ size_t inputlen,
+ unsigned char *sha256sum,
+ size_t sha256len UNUSED_PARAM)
+{
+ br_sha256_context ctx;
+
+ br_sha256_init(&ctx);
+ br_sha256_update(&ctx, input, inputlen);
+ br_sha256_out(&ctx, sha256sum);
+ return CURLE_OK;
+}
+
+const struct Curl_ssl Curl_ssl_bearssl = {
+ { CURLSSLBACKEND_BEARSSL, "bearssl" },
+ 0,
+ sizeof(struct ssl_backend_data),
+
+ Curl_none_init,
+ Curl_none_cleanup,
+ Curl_bearssl_version,
+ Curl_none_check_cxn,
+ Curl_none_shutdown,
+ Curl_bearssl_data_pending,
+ Curl_bearssl_random,
+ Curl_none_cert_status_request,
+ Curl_bearssl_connect,
+ Curl_bearssl_connect_nonblocking,
+ Curl_bearssl_get_internals,
+ Curl_bearssl_close,
+ Curl_none_close_all,
+ Curl_bearssl_session_free,
+ Curl_none_set_engine,
+ Curl_none_set_engine_default,
+ Curl_none_engines_list,
+ Curl_none_false_start,
+ Curl_bearssl_md5sum,
+ Curl_bearssl_sha256sum
+};
+
+#endif /* USE_BEARSSL */
diff --git a/contrib/libs/curl/lib/vtls/bearssl.h b/contrib/libs/curl/lib/vtls/bearssl.h
index 182c13d73f..d72b7d0e26 100644
--- a/contrib/libs/curl/lib/vtls/bearssl.h
+++ b/contrib/libs/curl/lib/vtls/bearssl.h
@@ -1,32 +1,32 @@
-#ifndef HEADER_CURL_BEARSSL_H
-#define HEADER_CURL_BEARSSL_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2019 - 2020, Michael Forney, <mforney@mforney.org>
- *
- * 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.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"
-
-#ifdef USE_BEARSSL
-
-extern const struct Curl_ssl Curl_ssl_bearssl;
-
-#endif /* USE_BEARSSL */
-#endif /* HEADER_CURL_BEARSSL_H */
+#ifndef HEADER_CURL_BEARSSL_H
+#define HEADER_CURL_BEARSSL_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2019 - 2020, Michael Forney, <mforney@mforney.org>
+ *
+ * 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.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"
+
+#ifdef USE_BEARSSL
+
+extern const struct Curl_ssl Curl_ssl_bearssl;
+
+#endif /* USE_BEARSSL */
+#endif /* HEADER_CURL_BEARSSL_H */
diff --git a/contrib/libs/curl/lib/vtls/gskit.c b/contrib/libs/curl/lib/vtls/gskit.c
index e8b53d7e41..17584c750f 100644
--- a/contrib/libs/curl/lib/vtls/gskit.c
+++ b/contrib/libs/curl/lib/vtls/gskit.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -26,8 +26,8 @@
#include <gskssl.h>
#include <qsoasync.h>
-#undef HAVE_SOCKETPAIR /* because the native one isn't good enough */
-#include "socketpair.h"
+#undef HAVE_SOCKETPAIR /* because the native one isn't good enough */
+#include "socketpair.h"
/* Some symbols are undefined/unsupported on OS400 versions < V7R1. */
#ifndef GSK_SSL_EXTN_SERVERNAME_REQUEST
@@ -108,13 +108,13 @@ struct ssl_backend_data {
#define BACKEND connssl->backend
/* Supported ciphers. */
-struct gskit_cipher {
+struct gskit_cipher {
const char *name; /* Cipher name. */
const char *gsktoken; /* Corresponding token for GSKit String. */
unsigned int versions; /* SSL version flags. */
-};
+};
-static const struct gskit_cipher ciphertable[] = {
+static const struct gskit_cipher ciphertable[] = {
{ "null-md5", "01",
CURL_GSKPROTO_SSLV3_MASK | CURL_GSKPROTO_TLSV10_MASK |
CURL_GSKPROTO_TLSV11_MASK | CURL_GSKPROTO_TLSV12_MASK },
@@ -307,7 +307,7 @@ static CURLcode set_ciphers(struct connectdata *conn,
struct Curl_easy *data = conn->data;
const char *cipherlist = SSL_CONN_CONFIG(cipher_list);
const char *clp;
- const struct gskit_cipher *ctp;
+ const struct gskit_cipher *ctp;
int i;
int l;
bool unsupported;
@@ -543,7 +543,7 @@ static int pipe_ssloverssl(struct connectdata *conn, int sockindex,
if(n < conn->sock[sockindex])
n = conn->sock[sockindex];
}
- i = Curl_select(n + 1, &fds_read, &fds_write, NULL, 0);
+ i = Curl_select(n + 1, &fds_read, &fds_write, NULL, 0);
if(i < 0)
return -1; /* Select error. */
@@ -705,7 +705,7 @@ static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
int rc;
const char * const keyringfile = SSL_CONN_CONFIG(CAfile);
const char * const keyringpwd = SSL_SET_OPTION(key_passwd);
- const char * const keyringlabel = SSL_SET_OPTION(primary.clientcert);
+ const char * const keyringlabel = SSL_SET_OPTION(primary.clientcert);
const long int ssl_version = SSL_CONN_CONFIG(version);
const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
const char * const hostname = SSL_IS_PROXY()? conn->http_proxy.host.name:
@@ -762,7 +762,7 @@ static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
/* Establish a pipelining socket pair for SSL over SSL. */
if(conn->proxy_ssl[sockindex].use) {
- if(Curl_socketpair(0, 0, 0, sockpair))
+ if(Curl_socketpair(0, 0, 0, sockpair))
return CURLE_SSL_CONNECT_ERROR;
BACKEND->localfd = sockpair[0];
BACKEND->remotefd = sockpair[1];
@@ -819,7 +819,7 @@ static CURLcode gskit_connect_step1(struct connectdata *conn, int sockindex)
if(!result) {
/* Compute the handshake timeout. Since GSKit granularity is 1 second,
we round up the required value. */
- timediff_t timeout = Curl_timeleft(data, NULL, TRUE);
+ timediff_t timeout = Curl_timeleft(data, NULL, TRUE);
if(timeout < 0)
result = CURLE_OPERATION_TIMEDOUT;
else
@@ -932,7 +932,7 @@ static CURLcode gskit_connect_step2(struct connectdata *conn, int sockindex,
/* Poll or wait for end of SSL asynchronous handshake. */
for(;;) {
- timediff_t timeout_ms = nonblocking? 0: Curl_timeleft(data, NULL, TRUE);
+ timediff_t timeout_ms = nonblocking? 0: Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0)
timeout_ms = 0;
stmv.tv_sec = timeout_ms / 1000;
@@ -1064,7 +1064,7 @@ static CURLcode gskit_connect_common(struct connectdata *conn, int sockindex,
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- timediff_t timeout_ms;
+ timediff_t timeout_ms;
CURLcode result = CURLE_OK;
*done = connssl->state == ssl_connection_complete;
diff --git a/contrib/libs/curl/lib/vtls/gskit.h b/contrib/libs/curl/lib/vtls/gskit.h
index 4d0dc01c2b..202df7e07c 100644
--- a/contrib/libs/curl/lib/vtls/gskit.h
+++ b/contrib/libs/curl/lib/vtls/gskit.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vtls/gtls.c b/contrib/libs/curl/lib/vtls/gtls.c
index c8465ce5b5..e848c3f05a 100644
--- a/contrib/libs/curl/lib/vtls/gtls.c
+++ b/contrib/libs/curl/lib/vtls/gtls.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -72,8 +72,8 @@ static void tls_log_func(int level, const char *str)
#endif
static bool gtls_inited = FALSE;
-#if !defined(GNUTLS_VERSION_NUMBER) || (GNUTLS_VERSION_NUMBER < 0x03010a)
-#error "too old GnuTLS version"
+#if !defined(GNUTLS_VERSION_NUMBER) || (GNUTLS_VERSION_NUMBER < 0x03010a)
+#error "too old GnuTLS version"
#endif
# include <gnutls/ocsp.h>
@@ -81,7 +81,7 @@ static bool gtls_inited = FALSE;
struct ssl_backend_data {
gnutls_session_t session;
gnutls_certificate_credentials_t cred;
-#ifdef HAVE_GNUTLS_SRP
+#ifdef HAVE_GNUTLS_SRP
gnutls_srp_client_credentials_t srp_client_cred;
#endif
};
@@ -207,12 +207,12 @@ static CURLcode handshake(struct connectdata *conn,
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- gnutls_session_t session = backend->session;
+ struct ssl_backend_data *backend = connssl->backend;
+ gnutls_session_t session = backend->session;
curl_socket_t sockfd = conn->sock[sockindex];
for(;;) {
- timediff_t timeout_ms;
+ timediff_t timeout_ms;
int rc;
/* check allowed time left */
@@ -304,7 +304,7 @@ static gnutls_x509_crt_fmt_t do_file_type(const char *type)
return GNUTLS_X509_FMT_PEM;
if(strcasecompare(type, "DER"))
return GNUTLS_X509_FMT_DER;
- return GNUTLS_X509_FMT_PEM; /* default to PEM */
+ return GNUTLS_X509_FMT_PEM; /* default to PEM */
}
#define GNUTLS_CIPHERS "NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509"
@@ -324,54 +324,54 @@ set_ssl_version_min_max(const char **prioritylist, struct connectdata *conn)
ssl_version_max = CURL_SSLVERSION_MAX_DEFAULT;
}
switch(ssl_version | ssl_version_max) {
- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_0:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.0";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_1:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.0:+VERS-TLS1.1";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_2:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_1:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.1";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_2:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.1:+VERS-TLS1.2";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_2:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.2";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_3 | CURL_SSLVERSION_MAX_TLSv1_3:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.3";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_DEFAULT:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2"
- ":+VERS-TLS1.3";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_DEFAULT:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.1:+VERS-TLS1.2"
- ":+VERS-TLS1.3";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.2"
- ":+VERS-TLS1.3";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_3 | CURL_SSLVERSION_MAX_DEFAULT:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.2"
- ":+VERS-TLS1.3";
- return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_0:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.0";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_1:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.0:+VERS-TLS1.1";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_2:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_1:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.1";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_2:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.1:+VERS-TLS1.2";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_2:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.2";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_3 | CURL_SSLVERSION_MAX_TLSv1_3:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.3";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_DEFAULT:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2"
+ ":+VERS-TLS1.3";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_DEFAULT:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.1:+VERS-TLS1.2"
+ ":+VERS-TLS1.3";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.2"
+ ":+VERS-TLS1.3";
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_3 | CURL_SSLVERSION_MAX_DEFAULT:
+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
+ "+VERS-TLS1.2"
+ ":+VERS-TLS1.3";
+ return CURLE_OK;
}
failf(data, "GnuTLS: cannot set ssl protocol");
@@ -384,7 +384,7 @@ gtls_connect_step1(struct connectdata *conn,
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
unsigned int init_flags;
gnutls_session_t session;
int rc;
@@ -399,8 +399,8 @@ gtls_connect_step1(struct connectdata *conn,
#endif
const char *prioritylist;
const char *err = NULL;
- const char * const hostname = SSL_HOST_NAME();
- long * const certverifyresult = &SSL_SET_OPTION_LVALUE(certverifyresult);
+ const char * const hostname = SSL_HOST_NAME();
+ long * const certverifyresult = &SSL_SET_OPTION_LVALUE(certverifyresult);
if(connssl->state == ssl_connection_complete)
/* to make us tolerant against being called more than once for the
@@ -410,9 +410,9 @@ gtls_connect_step1(struct connectdata *conn,
if(!gtls_inited)
Curl_gtls_init();
- /* Initialize certverifyresult to OK */
- *certverifyresult = 0;
-
+ /* Initialize certverifyresult to OK */
+ *certverifyresult = 0;
+
if(SSL_CONN_CONFIG(version) == CURL_SSLVERSION_SSLv2) {
failf(data, "GnuTLS does not support SSLv2");
return CURLE_SSL_CONNECT_ERROR;
@@ -421,25 +421,25 @@ gtls_connect_step1(struct connectdata *conn,
sni = FALSE; /* SSLv3 has no SNI */
/* allocate a cred struct */
- rc = gnutls_certificate_allocate_credentials(&backend->cred);
+ rc = gnutls_certificate_allocate_credentials(&backend->cred);
if(rc != GNUTLS_E_SUCCESS) {
failf(data, "gnutls_cert_all_cred() failed: %s", gnutls_strerror(rc));
return CURLE_SSL_CONNECT_ERROR;
}
-#ifdef HAVE_GNUTLS_SRP
+#ifdef HAVE_GNUTLS_SRP
if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username));
rc = gnutls_srp_allocate_client_credentials(
- &backend->srp_client_cred);
+ &backend->srp_client_cred);
if(rc != GNUTLS_E_SUCCESS) {
failf(data, "gnutls_srp_allocate_client_cred() failed: %s",
gnutls_strerror(rc));
return CURLE_OUT_OF_MEMORY;
}
- rc = gnutls_srp_set_client_credentials(backend->srp_client_cred,
+ rc = gnutls_srp_set_client_credentials(backend->srp_client_cred,
SSL_SET_OPTION(username),
SSL_SET_OPTION(password));
if(rc != GNUTLS_E_SUCCESS) {
@@ -452,19 +452,19 @@ gtls_connect_step1(struct connectdata *conn,
if(SSL_CONN_CONFIG(CAfile)) {
/* set the trusted CA cert bundle file */
- gnutls_certificate_set_verify_flags(backend->cred,
+ gnutls_certificate_set_verify_flags(backend->cred,
GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT);
- rc = gnutls_certificate_set_x509_trust_file(backend->cred,
+ rc = gnutls_certificate_set_x509_trust_file(backend->cred,
SSL_CONN_CONFIG(CAfile),
GNUTLS_X509_FMT_PEM);
if(rc < 0) {
infof(data, "error reading ca cert file %s (%s)\n",
SSL_CONN_CONFIG(CAfile), gnutls_strerror(rc));
- if(SSL_CONN_CONFIG(verifypeer)) {
- *certverifyresult = rc;
+ if(SSL_CONN_CONFIG(verifypeer)) {
+ *certverifyresult = rc;
return CURLE_SSL_CACERT_BADFILE;
- }
+ }
}
else
infof(data, "found %d certificates in %s\n", rc,
@@ -473,16 +473,16 @@ gtls_connect_step1(struct connectdata *conn,
if(SSL_CONN_CONFIG(CApath)) {
/* set the trusted CA cert directory */
- rc = gnutls_certificate_set_x509_trust_dir(backend->cred,
+ rc = gnutls_certificate_set_x509_trust_dir(backend->cred,
SSL_CONN_CONFIG(CApath),
GNUTLS_X509_FMT_PEM);
if(rc < 0) {
infof(data, "error reading ca cert file %s (%s)\n",
SSL_CONN_CONFIG(CApath), gnutls_strerror(rc));
- if(SSL_CONN_CONFIG(verifypeer)) {
- *certverifyresult = rc;
+ if(SSL_CONN_CONFIG(verifypeer)) {
+ *certverifyresult = rc;
return CURLE_SSL_CACERT_BADFILE;
- }
+ }
}
else
infof(data, "found %d certificates in %s\n",
@@ -493,13 +493,13 @@ gtls_connect_step1(struct connectdata *conn,
/* use system ca certificate store as fallback */
if(SSL_CONN_CONFIG(verifypeer) &&
!(SSL_CONN_CONFIG(CAfile) || SSL_CONN_CONFIG(CApath))) {
- gnutls_certificate_set_x509_system_trust(backend->cred);
+ gnutls_certificate_set_x509_system_trust(backend->cred);
}
#endif
if(SSL_SET_OPTION(CRLfile)) {
/* set the CRL list file */
- rc = gnutls_certificate_set_x509_crl_file(backend->cred,
+ rc = gnutls_certificate_set_x509_crl_file(backend->cred,
SSL_SET_OPTION(CRLfile),
GNUTLS_X509_FMT_PEM);
if(rc < 0) {
@@ -515,23 +515,23 @@ gtls_connect_step1(struct connectdata *conn,
/* Initialize TLS session as a client */
init_flags = GNUTLS_CLIENT;
-#if defined(GNUTLS_FORCE_CLIENT_CERT)
- init_flags |= GNUTLS_FORCE_CLIENT_CERT;
-#endif
-
+#if defined(GNUTLS_FORCE_CLIENT_CERT)
+ init_flags |= GNUTLS_FORCE_CLIENT_CERT;
+#endif
+
#if defined(GNUTLS_NO_TICKETS)
/* Disable TLS session tickets */
init_flags |= GNUTLS_NO_TICKETS;
#endif
- rc = gnutls_init(&backend->session, init_flags);
+ rc = gnutls_init(&backend->session, init_flags);
if(rc != GNUTLS_E_SUCCESS) {
failf(data, "gnutls_init() failed: %d", rc);
return CURLE_SSL_CONNECT_ERROR;
}
/* convenient assign */
- session = backend->session;
+ session = backend->session;
if((0 == Curl_inet_pton(AF_INET, hostname, &addr)) &&
#ifdef ENABLE_IPV6
@@ -557,11 +557,11 @@ gtls_connect_step1(struct connectdata *conn,
break;
case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
- prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0"
+ prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0"
#ifdef HAS_TLS13
- ":+VERS-TLS1.3"
+ ":+VERS-TLS1.3"
#endif
- ;
+ ;
break;
case CURL_SSLVERSION_TLSv1_0:
case CURL_SSLVERSION_TLSv1_1:
@@ -581,32 +581,32 @@ gtls_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR;
}
-#ifdef HAVE_GNUTLS_SRP
- /* Only add SRP to the cipher list if SRP is requested. Otherwise
- * GnuTLS will disable TLS 1.3 support. */
- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
- size_t len = strlen(prioritylist);
-
- char *prioritysrp = malloc(len + sizeof(GNUTLS_SRP) + 1);
- if(!prioritysrp)
- return CURLE_OUT_OF_MEMORY;
- strcpy(prioritysrp, prioritylist);
- strcpy(prioritysrp + len, ":" GNUTLS_SRP);
-
- rc = gnutls_priority_set_direct(session, prioritysrp, &err);
- free(prioritysrp);
-
- if((rc == GNUTLS_E_INVALID_REQUEST) && err) {
+#ifdef HAVE_GNUTLS_SRP
+ /* Only add SRP to the cipher list if SRP is requested. Otherwise
+ * GnuTLS will disable TLS 1.3 support. */
+ if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
+ size_t len = strlen(prioritylist);
+
+ char *prioritysrp = malloc(len + sizeof(GNUTLS_SRP) + 1);
+ if(!prioritysrp)
+ return CURLE_OUT_OF_MEMORY;
+ strcpy(prioritysrp, prioritylist);
+ strcpy(prioritysrp + len, ":" GNUTLS_SRP);
+
+ rc = gnutls_priority_set_direct(session, prioritysrp, &err);
+ free(prioritysrp);
+
+ if((rc == GNUTLS_E_INVALID_REQUEST) && err) {
infof(data, "This GnuTLS does not support SRP\n");
}
}
- else {
-#endif
- rc = gnutls_priority_set_direct(session, prioritylist, &err);
-#ifdef HAVE_GNUTLS_SRP
- }
-#endif
-
+ else {
+#endif
+ rc = gnutls_priority_set_direct(session, prioritylist, &err);
+#ifdef HAVE_GNUTLS_SRP
+ }
+#endif
+
if(rc != GNUTLS_E_SUCCESS) {
failf(data, "Error %d setting GnuTLS cipher list starting with %s",
rc, err);
@@ -618,11 +618,11 @@ gtls_connect_step1(struct connectdata *conn,
gnutls_datum_t protocols[2];
#ifdef USE_NGHTTP2
- if(data->set.httpversion >= CURL_HTTP_VERSION_2
-#ifndef CURL_DISABLE_PROXY
- && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
-#endif
- ) {
+ if(data->set.httpversion >= CURL_HTTP_VERSION_2
+#ifndef CURL_DISABLE_PROXY
+ && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
+#endif
+ ) {
protocols[cur].data = (unsigned char *)NGHTTP2_PROTO_VERSION_ID;
protocols[cur].size = NGHTTP2_PROTO_VERSION_ID_LEN;
cur++;
@@ -638,7 +638,7 @@ gtls_connect_step1(struct connectdata *conn,
gnutls_alpn_set_protocols(session, protocols, cur, 0);
}
- if(SSL_SET_OPTION(primary.clientcert)) {
+ if(SSL_SET_OPTION(primary.clientcert)) {
if(SSL_SET_OPTION(key_passwd)) {
const unsigned int supported_key_encryption_algorithms =
GNUTLS_PKCS_USE_PKCS12_3DES | GNUTLS_PKCS_USE_PKCS12_ARCFOUR |
@@ -646,10 +646,10 @@ gtls_connect_step1(struct connectdata *conn,
GNUTLS_PKCS_USE_PBES2_AES_128 | GNUTLS_PKCS_USE_PBES2_AES_192 |
GNUTLS_PKCS_USE_PBES2_AES_256;
rc = gnutls_certificate_set_x509_key_file2(
- backend->cred,
- SSL_SET_OPTION(primary.clientcert),
+ backend->cred,
+ SSL_SET_OPTION(primary.clientcert),
SSL_SET_OPTION(key) ?
- SSL_SET_OPTION(key) : SSL_SET_OPTION(primary.clientcert),
+ SSL_SET_OPTION(key) : SSL_SET_OPTION(primary.clientcert),
do_file_type(SSL_SET_OPTION(cert_type)),
SSL_SET_OPTION(key_passwd),
supported_key_encryption_algorithms);
@@ -662,10 +662,10 @@ gtls_connect_step1(struct connectdata *conn,
}
else {
if(gnutls_certificate_set_x509_key_file(
- backend->cred,
- SSL_SET_OPTION(primary.clientcert),
+ backend->cred,
+ SSL_SET_OPTION(primary.clientcert),
SSL_SET_OPTION(key) ?
- SSL_SET_OPTION(key) : SSL_SET_OPTION(primary.clientcert),
+ SSL_SET_OPTION(key) : SSL_SET_OPTION(primary.clientcert),
do_file_type(SSL_SET_OPTION(cert_type)) ) !=
GNUTLS_E_SUCCESS) {
failf(data, "error reading X.509 key or certificate file");
@@ -674,11 +674,11 @@ gtls_connect_step1(struct connectdata *conn,
}
}
-#ifdef HAVE_GNUTLS_SRP
+#ifdef HAVE_GNUTLS_SRP
/* put the credentials to the current session */
if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
rc = gnutls_credentials_set(session, GNUTLS_CRD_SRP,
- backend->srp_client_cred);
+ backend->srp_client_cred);
if(rc != GNUTLS_E_SUCCESS) {
failf(data, "gnutls_credentials_set() failed: %s", gnutls_strerror(rc));
return CURLE_SSL_CONNECT_ERROR;
@@ -688,22 +688,22 @@ gtls_connect_step1(struct connectdata *conn,
#endif
{
rc = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,
- backend->cred);
+ backend->cred);
if(rc != GNUTLS_E_SUCCESS) {
failf(data, "gnutls_credentials_set() failed: %s", gnutls_strerror(rc));
return CURLE_SSL_CONNECT_ERROR;
}
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->proxy_ssl[sockindex].use) {
transport_ptr = conn->proxy_ssl[sockindex].backend->session;
gnutls_transport_push = Curl_gtls_push_ssl;
gnutls_transport_pull = Curl_gtls_pull_ssl;
}
- else
-#endif
- {
+ else
+#endif
+ {
/* file descriptor for the socket */
transport_ptr = &conn->sock[sockindex];
gnutls_transport_push = Curl_gtls_push;
@@ -815,15 +815,15 @@ gtls_connect_step3(struct connectdata *conn,
unsigned int verify_status = 0;
gnutls_x509_crt_t x509_cert, x509_issuer;
gnutls_datum_t issuerp;
- gnutls_datum_t certfields;
- char certname[65] = ""; /* limited to 64 chars by ASN.1 */
+ gnutls_datum_t certfields;
+ char certname[65] = ""; /* limited to 64 chars by ASN.1 */
size_t size;
time_t certclock;
const char *ptr;
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- gnutls_session_t session = backend->session;
+ struct ssl_backend_data *backend = connssl->backend;
+ gnutls_session_t session = backend->session;
int rc;
gnutls_datum_t proto;
CURLcode result = CURLE_OK;
@@ -832,8 +832,8 @@ gtls_connect_step3(struct connectdata *conn,
unsigned int bits;
gnutls_protocol_t version = gnutls_protocol_get_version(session);
#endif
- const char * const hostname = SSL_HOST_NAME();
- long * const certverifyresult = &SSL_SET_OPTION_LVALUE(certverifyresult);
+ const char * const hostname = SSL_HOST_NAME();
+ long * const certverifyresult = &SSL_SET_OPTION_LVALUE(certverifyresult);
/* the name of the cipher suite used, e.g. ECDHE_RSA_AES_256_GCM_SHA384. */
ptr = gnutls_cipher_suite_get_name(gnutls_kx_get(session),
@@ -854,7 +854,7 @@ gtls_connect_step3(struct connectdata *conn,
if(SSL_CONN_CONFIG(verifypeer) ||
SSL_CONN_CONFIG(verifyhost) ||
SSL_SET_OPTION(issuercert)) {
-#ifdef HAVE_GNUTLS_SRP
+#ifdef HAVE_GNUTLS_SRP
if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP
&& SSL_SET_OPTION(username) != NULL
&& !SSL_CONN_CONFIG(verifypeer)
@@ -865,9 +865,9 @@ gtls_connect_step3(struct connectdata *conn,
else {
#endif
failf(data, "failed to get server cert");
- *certverifyresult = GNUTLS_E_NO_CERTIFICATE_FOUND;
+ *certverifyresult = GNUTLS_E_NO_CERTIFICATE_FOUND;
return CURLE_PEER_FAILED_VERIFICATION;
-#ifdef HAVE_GNUTLS_SRP
+#ifdef HAVE_GNUTLS_SRP
}
#endif
}
@@ -902,12 +902,12 @@ gtls_connect_step3(struct connectdata *conn,
rc = gnutls_certificate_verify_peers2(session, &verify_status);
if(rc < 0) {
failf(data, "server cert verify failed: %d", rc);
- *certverifyresult = rc;
+ *certverifyresult = rc;
return CURLE_SSL_CONNECT_ERROR;
}
- *certverifyresult = verify_status;
-
+ *certverifyresult = verify_status;
+
/* verify_status is a bitmask of gnutls_certificate_status bits */
if(verify_status & GNUTLS_CERT_INVALID) {
if(SSL_CONN_CONFIG(verifypeer)) {
@@ -1054,11 +1054,11 @@ gtls_connect_step3(struct connectdata *conn,
SSL_SET_OPTION(issuercert)?SSL_SET_OPTION(issuercert):"none");
}
- size = sizeof(certname);
+ size = sizeof(certname);
rc = gnutls_x509_crt_get_dn_by_oid(x509_cert, GNUTLS_OID_X520_COMMON_NAME,
0, /* the first and only one */
FALSE,
- certname,
+ certname,
&size);
if(rc) {
infof(data, "error fetching CN from cert:%s\n",
@@ -1116,16 +1116,16 @@ gtls_connect_step3(struct connectdata *conn,
if(!rc) {
if(SSL_CONN_CONFIG(verifyhost)) {
failf(data, "SSL: certificate subject name (%s) does not match "
- "target host name '%s'", certname, SSL_HOST_DISPNAME());
+ "target host name '%s'", certname, SSL_HOST_DISPNAME());
gnutls_x509_crt_deinit(x509_cert);
return CURLE_PEER_FAILED_VERIFICATION;
}
else
infof(data, "\t common name: %s (does not match '%s')\n",
- certname, SSL_HOST_DISPNAME());
+ certname, SSL_HOST_DISPNAME());
}
else
- infof(data, "\t common name: %s (matched)\n", certname);
+ infof(data, "\t common name: %s (matched)\n", certname);
/* Check for time-based validity */
certclock = gnutls_x509_crt_get_expiration_time(x509_cert);
@@ -1133,7 +1133,7 @@ gtls_connect_step3(struct connectdata *conn,
if(certclock == (time_t)-1) {
if(SSL_CONN_CONFIG(verifypeer)) {
failf(data, "server cert expiration date verify failed");
- *certverifyresult = GNUTLS_CERT_EXPIRED;
+ *certverifyresult = GNUTLS_CERT_EXPIRED;
gnutls_x509_crt_deinit(x509_cert);
return CURLE_SSL_CONNECT_ERROR;
}
@@ -1144,7 +1144,7 @@ gtls_connect_step3(struct connectdata *conn,
if(certclock < time(NULL)) {
if(SSL_CONN_CONFIG(verifypeer)) {
failf(data, "server certificate expiration date has passed.");
- *certverifyresult = GNUTLS_CERT_EXPIRED;
+ *certverifyresult = GNUTLS_CERT_EXPIRED;
gnutls_x509_crt_deinit(x509_cert);
return CURLE_PEER_FAILED_VERIFICATION;
}
@@ -1160,7 +1160,7 @@ gtls_connect_step3(struct connectdata *conn,
if(certclock == (time_t)-1) {
if(SSL_CONN_CONFIG(verifypeer)) {
failf(data, "server cert activation date verify failed");
- *certverifyresult = GNUTLS_CERT_NOT_ACTIVATED;
+ *certverifyresult = GNUTLS_CERT_NOT_ACTIVATED;
gnutls_x509_crt_deinit(x509_cert);
return CURLE_SSL_CONNECT_ERROR;
}
@@ -1171,7 +1171,7 @@ gtls_connect_step3(struct connectdata *conn,
if(certclock > time(NULL)) {
if(SSL_CONN_CONFIG(verifypeer)) {
failf(data, "server certificate not activated yet.");
- *certverifyresult = GNUTLS_CERT_NOT_ACTIVATED;
+ *certverifyresult = GNUTLS_CERT_NOT_ACTIVATED;
gnutls_x509_crt_deinit(x509_cert);
return CURLE_PEER_FAILED_VERIFICATION;
}
@@ -1214,29 +1214,29 @@ gtls_connect_step3(struct connectdata *conn,
gnutls_x509_crt_get_version(x509_cert));
- rc = gnutls_x509_crt_get_dn2(x509_cert, &certfields);
- if(rc)
- infof(data, "Failed to get certificate name\n");
- else {
- infof(data, "\t subject: %s\n", certfields.data);
-
- certclock = gnutls_x509_crt_get_activation_time(x509_cert);
- showtime(data, "start date", certclock);
-
- certclock = gnutls_x509_crt_get_expiration_time(x509_cert);
- showtime(data, "expire date", certclock);
-
- gnutls_free(certfields.data);
- }
-
- rc = gnutls_x509_crt_get_issuer_dn2(x509_cert, &certfields);
- if(rc)
- infof(data, "Failed to get certificate issuer\n");
- else {
- infof(data, "\t issuer: %s\n", certfields.data);
-
- gnutls_free(certfields.data);
- }
+ rc = gnutls_x509_crt_get_dn2(x509_cert, &certfields);
+ if(rc)
+ infof(data, "Failed to get certificate name\n");
+ else {
+ infof(data, "\t subject: %s\n", certfields.data);
+
+ certclock = gnutls_x509_crt_get_activation_time(x509_cert);
+ showtime(data, "start date", certclock);
+
+ certclock = gnutls_x509_crt_get_expiration_time(x509_cert);
+ showtime(data, "expire date", certclock);
+
+ gnutls_free(certfields.data);
+ }
+
+ rc = gnutls_x509_crt_get_issuer_dn2(x509_cert, &certfields);
+ if(rc)
+ infof(data, "Failed to get certificate issuer\n");
+ else {
+ infof(data, "\t issuer: %s\n", certfields.data);
+
+ gnutls_free(certfields.data);
+ }
#endif
gnutls_x509_crt_deinit(x509_cert);
@@ -1383,18 +1383,18 @@ static bool Curl_gtls_data_pending(const struct connectdata *conn,
{
const struct ssl_connect_data *connssl = &conn->ssl[connindex];
bool res = FALSE;
- struct ssl_backend_data *backend = connssl->backend;
- if(backend->session &&
- 0 != gnutls_record_check_pending(backend->session))
+ struct ssl_backend_data *backend = connssl->backend;
+ if(backend->session &&
+ 0 != gnutls_record_check_pending(backend->session))
res = TRUE;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
connssl = &conn->proxy_ssl[connindex];
- backend = connssl->backend;
- if(backend->session &&
- 0 != gnutls_record_check_pending(backend->session))
+ backend = connssl->backend;
+ if(backend->session &&
+ 0 != gnutls_record_check_pending(backend->session))
res = TRUE;
-#endif
+#endif
return res;
}
@@ -1406,8 +1406,8 @@ static ssize_t gtls_send(struct connectdata *conn,
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- ssize_t rc = gnutls_record_send(backend->session, mem, len);
+ struct ssl_backend_data *backend = connssl->backend;
+ ssize_t rc = gnutls_record_send(backend->session, mem, len);
if(rc < 0) {
*curlcode = (rc == GNUTLS_E_AGAIN)
@@ -1422,20 +1422,20 @@ static ssize_t gtls_send(struct connectdata *conn,
static void close_one(struct ssl_connect_data *connssl)
{
- struct ssl_backend_data *backend = connssl->backend;
- if(backend->session) {
- gnutls_bye(backend->session, GNUTLS_SHUT_WR);
- gnutls_deinit(backend->session);
- backend->session = NULL;
+ struct ssl_backend_data *backend = connssl->backend;
+ if(backend->session) {
+ gnutls_bye(backend->session, GNUTLS_SHUT_WR);
+ gnutls_deinit(backend->session);
+ backend->session = NULL;
}
- if(backend->cred) {
- gnutls_certificate_free_credentials(backend->cred);
- backend->cred = NULL;
+ if(backend->cred) {
+ gnutls_certificate_free_credentials(backend->cred);
+ backend->cred = NULL;
}
-#ifdef HAVE_GNUTLS_SRP
- if(backend->srp_client_cred) {
- gnutls_srp_free_client_credentials(backend->srp_client_cred);
- backend->srp_client_cred = NULL;
+#ifdef HAVE_GNUTLS_SRP
+ if(backend->srp_client_cred) {
+ gnutls_srp_free_client_credentials(backend->srp_client_cred);
+ backend->srp_client_cred = NULL;
}
#endif
}
@@ -1443,9 +1443,9 @@ static void close_one(struct ssl_connect_data *connssl)
static void Curl_gtls_close(struct connectdata *conn, int sockindex)
{
close_one(&conn->ssl[sockindex]);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
close_one(&conn->proxy_ssl[sockindex]);
-#endif
+#endif
}
/*
@@ -1455,7 +1455,7 @@ static void Curl_gtls_close(struct connectdata *conn, int sockindex)
static int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
int retval = 0;
struct Curl_easy *data = conn->data;
@@ -1466,10 +1466,10 @@ static int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
we do not send one. Let's hope other servers do the same... */
if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE)
- gnutls_bye(backend->session, GNUTLS_SHUT_WR);
+ gnutls_bye(backend->session, GNUTLS_SHUT_WR);
#endif
- if(backend->session) {
+ if(backend->session) {
ssize_t result;
bool done = FALSE;
char buf[120];
@@ -1480,7 +1480,7 @@ static int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
if(what > 0) {
/* Something to read, let's do it and hope that it is the close
notify alert from the server */
- result = gnutls_record_recv(backend->session,
+ result = gnutls_record_recv(backend->session,
buf, sizeof(buf));
switch(result) {
case 0:
@@ -1510,18 +1510,18 @@ static int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
done = TRUE;
}
}
- gnutls_deinit(backend->session);
+ gnutls_deinit(backend->session);
}
- gnutls_certificate_free_credentials(backend->cred);
+ gnutls_certificate_free_credentials(backend->cred);
-#ifdef HAVE_GNUTLS_SRP
+#ifdef HAVE_GNUTLS_SRP
if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP
&& SSL_SET_OPTION(username) != NULL)
- gnutls_srp_free_client_credentials(backend->srp_client_cred);
+ gnutls_srp_free_client_credentials(backend->srp_client_cred);
#endif
- backend->cred = NULL;
- backend->session = NULL;
+ backend->cred = NULL;
+ backend->session = NULL;
return retval;
}
@@ -1533,10 +1533,10 @@ static ssize_t gtls_recv(struct connectdata *conn, /* connection data */
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[num];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
ssize_t ret;
- ret = gnutls_record_recv(backend->session, buf, buffersize);
+ ret = gnutls_record_recv(backend->session, buf, buffersize);
if((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED)) {
*curlcode = CURLE_AGAIN;
return -1;
@@ -1658,9 +1658,9 @@ static bool Curl_gtls_cert_status_request(void)
static void *Curl_gtls_get_internals(struct ssl_connect_data *connssl,
CURLINFO info UNUSED_PARAM)
{
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
(void)info;
- return backend->session;
+ return backend->session;
}
const struct Curl_ssl Curl_ssl_gnutls = {
diff --git a/contrib/libs/curl/lib/vtls/gtls.h b/contrib/libs/curl/lib/vtls/gtls.h
index 6eb03d45b3..1a146a3a93 100644
--- a/contrib/libs/curl/lib/vtls/gtls.h
+++ b/contrib/libs/curl/lib/vtls/gtls.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vtls/keylog.c b/contrib/libs/curl/lib/vtls/keylog.c
index d23ca68998..a45945f8f5 100644
--- a/contrib/libs/curl/lib/vtls/keylog.c
+++ b/contrib/libs/curl/lib/vtls/keylog.c
@@ -1,156 +1,156 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "keylog.h"
-
-/* The last #include files should be: */
-#include "curl_memory.h"
-#include "memdebug.h"
-
-#define KEYLOG_LABEL_MAXLEN (sizeof("CLIENT_HANDSHAKE_TRAFFIC_SECRET") - 1)
-
-#define CLIENT_RANDOM_SIZE 32
-
-/*
- * The master secret in TLS 1.2 and before is always 48 bytes. In TLS 1.3, the
- * secret size depends on the cipher suite's hash function which is 32 bytes
- * for SHA-256 and 48 bytes for SHA-384.
- */
-#define SECRET_MAXLEN 48
-
-
-/* The fp for the open SSLKEYLOGFILE, or NULL if not open */
-static FILE *keylog_file_fp;
-
-void
-Curl_tls_keylog_open(void)
-{
- char *keylog_file_name;
-
- if(!keylog_file_fp) {
- keylog_file_name = curl_getenv("SSLKEYLOGFILE");
- if(keylog_file_name) {
- keylog_file_fp = fopen(keylog_file_name, FOPEN_APPENDTEXT);
- if(keylog_file_fp) {
-#ifdef WIN32
- if(setvbuf(keylog_file_fp, NULL, _IONBF, 0))
-#else
- if(setvbuf(keylog_file_fp, NULL, _IOLBF, 4096))
-#endif
- {
- fclose(keylog_file_fp);
- keylog_file_fp = NULL;
- }
- }
- Curl_safefree(keylog_file_name);
- }
- }
-}
-
-void
-Curl_tls_keylog_close(void)
-{
- if(keylog_file_fp) {
- fclose(keylog_file_fp);
- keylog_file_fp = NULL;
- }
-}
-
-bool
-Curl_tls_keylog_enabled(void)
-{
- return keylog_file_fp != NULL;
-}
-
-bool
-Curl_tls_keylog_write_line(const char *line)
-{
- /* The current maximum valid keylog line length LF and NUL is 195. */
- size_t linelen;
- char buf[256];
-
- if(!keylog_file_fp || !line) {
- return false;
- }
-
- linelen = strlen(line);
- if(linelen == 0 || linelen > sizeof(buf) - 2) {
- /* Empty line or too big to fit in a LF and NUL. */
- return false;
- }
-
- memcpy(buf, line, linelen);
- if(line[linelen - 1] != '\n') {
- buf[linelen++] = '\n';
- }
- buf[linelen] = '\0';
-
- /* Using fputs here instead of fprintf since libcurl's fprintf replacement
- may not be thread-safe. */
- fputs(buf, keylog_file_fp);
- return true;
-}
-
-bool
-Curl_tls_keylog_write(const char *label,
- const unsigned char client_random[CLIENT_RANDOM_SIZE],
- const unsigned char *secret, size_t secretlen)
-{
- const char *hex = "0123456789ABCDEF";
- size_t pos, i;
- char line[KEYLOG_LABEL_MAXLEN + 1 + 2 * CLIENT_RANDOM_SIZE + 1 +
- 2 * SECRET_MAXLEN + 1 + 1];
-
- if(!keylog_file_fp) {
- return false;
- }
-
- pos = strlen(label);
- if(pos > KEYLOG_LABEL_MAXLEN || !secretlen || secretlen > SECRET_MAXLEN) {
- /* Should never happen - sanity check anyway. */
- return false;
- }
-
- memcpy(line, label, pos);
- line[pos++] = ' ';
-
- /* Client Random */
- for(i = 0; i < CLIENT_RANDOM_SIZE; i++) {
- line[pos++] = hex[client_random[i] >> 4];
- line[pos++] = hex[client_random[i] & 0xF];
- }
- line[pos++] = ' ';
-
- /* Secret */
- for(i = 0; i < secretlen; i++) {
- line[pos++] = hex[secret[i] >> 4];
- line[pos++] = hex[secret[i] & 0xF];
- }
- line[pos++] = '\n';
- line[pos] = '\0';
-
- /* Using fputs here instead of fprintf since libcurl's fprintf replacement
- may not be thread-safe. */
- fputs(line, keylog_file_fp);
- return true;
-}
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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 "keylog.h"
+
+/* The last #include files should be: */
+#include "curl_memory.h"
+#include "memdebug.h"
+
+#define KEYLOG_LABEL_MAXLEN (sizeof("CLIENT_HANDSHAKE_TRAFFIC_SECRET") - 1)
+
+#define CLIENT_RANDOM_SIZE 32
+
+/*
+ * The master secret in TLS 1.2 and before is always 48 bytes. In TLS 1.3, the
+ * secret size depends on the cipher suite's hash function which is 32 bytes
+ * for SHA-256 and 48 bytes for SHA-384.
+ */
+#define SECRET_MAXLEN 48
+
+
+/* The fp for the open SSLKEYLOGFILE, or NULL if not open */
+static FILE *keylog_file_fp;
+
+void
+Curl_tls_keylog_open(void)
+{
+ char *keylog_file_name;
+
+ if(!keylog_file_fp) {
+ keylog_file_name = curl_getenv("SSLKEYLOGFILE");
+ if(keylog_file_name) {
+ keylog_file_fp = fopen(keylog_file_name, FOPEN_APPENDTEXT);
+ if(keylog_file_fp) {
+#ifdef WIN32
+ if(setvbuf(keylog_file_fp, NULL, _IONBF, 0))
+#else
+ if(setvbuf(keylog_file_fp, NULL, _IOLBF, 4096))
+#endif
+ {
+ fclose(keylog_file_fp);
+ keylog_file_fp = NULL;
+ }
+ }
+ Curl_safefree(keylog_file_name);
+ }
+ }
+}
+
+void
+Curl_tls_keylog_close(void)
+{
+ if(keylog_file_fp) {
+ fclose(keylog_file_fp);
+ keylog_file_fp = NULL;
+ }
+}
+
+bool
+Curl_tls_keylog_enabled(void)
+{
+ return keylog_file_fp != NULL;
+}
+
+bool
+Curl_tls_keylog_write_line(const char *line)
+{
+ /* The current maximum valid keylog line length LF and NUL is 195. */
+ size_t linelen;
+ char buf[256];
+
+ if(!keylog_file_fp || !line) {
+ return false;
+ }
+
+ linelen = strlen(line);
+ if(linelen == 0 || linelen > sizeof(buf) - 2) {
+ /* Empty line or too big to fit in a LF and NUL. */
+ return false;
+ }
+
+ memcpy(buf, line, linelen);
+ if(line[linelen - 1] != '\n') {
+ buf[linelen++] = '\n';
+ }
+ buf[linelen] = '\0';
+
+ /* Using fputs here instead of fprintf since libcurl's fprintf replacement
+ may not be thread-safe. */
+ fputs(buf, keylog_file_fp);
+ return true;
+}
+
+bool
+Curl_tls_keylog_write(const char *label,
+ const unsigned char client_random[CLIENT_RANDOM_SIZE],
+ const unsigned char *secret, size_t secretlen)
+{
+ const char *hex = "0123456789ABCDEF";
+ size_t pos, i;
+ char line[KEYLOG_LABEL_MAXLEN + 1 + 2 * CLIENT_RANDOM_SIZE + 1 +
+ 2 * SECRET_MAXLEN + 1 + 1];
+
+ if(!keylog_file_fp) {
+ return false;
+ }
+
+ pos = strlen(label);
+ if(pos > KEYLOG_LABEL_MAXLEN || !secretlen || secretlen > SECRET_MAXLEN) {
+ /* Should never happen - sanity check anyway. */
+ return false;
+ }
+
+ memcpy(line, label, pos);
+ line[pos++] = ' ';
+
+ /* Client Random */
+ for(i = 0; i < CLIENT_RANDOM_SIZE; i++) {
+ line[pos++] = hex[client_random[i] >> 4];
+ line[pos++] = hex[client_random[i] & 0xF];
+ }
+ line[pos++] = ' ';
+
+ /* Secret */
+ for(i = 0; i < secretlen; i++) {
+ line[pos++] = hex[secret[i] >> 4];
+ line[pos++] = hex[secret[i] & 0xF];
+ }
+ line[pos++] = '\n';
+ line[pos] = '\0';
+
+ /* Using fputs here instead of fprintf since libcurl's fprintf replacement
+ may not be thread-safe. */
+ fputs(line, keylog_file_fp);
+ return true;
+}
diff --git a/contrib/libs/curl/lib/vtls/keylog.h b/contrib/libs/curl/lib/vtls/keylog.h
index 858ddbb9f1..63626da90a 100644
--- a/contrib/libs/curl/lib/vtls/keylog.h
+++ b/contrib/libs/curl/lib/vtls/keylog.h
@@ -1,56 +1,56 @@
-#ifndef HEADER_CURL_KEYLOG_H
-#define HEADER_CURL_KEYLOG_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
-
-/*
- * Opens the TLS key log file if requested by the user. The SSLKEYLOGFILE
- * environment variable specifies the output file.
- */
-void Curl_tls_keylog_open(void);
-
-/*
- * Closes the TLS key log file if not already.
- */
-void Curl_tls_keylog_close(void);
-
-/*
- * Returns true if the user successfully enabled the TLS key log file.
- */
-bool Curl_tls_keylog_enabled(void);
-
-/*
- * Appends a key log file entry.
- * Returns true iff the key log file is open and a valid entry was provided.
- */
-bool Curl_tls_keylog_write(const char *label,
- const unsigned char client_random[32],
- const unsigned char *secret, size_t secretlen);
-
-/*
- * Appends a line to the key log file, ensure it is terminated by a LF.
- * Returns true iff the key log file is open and a valid line was provided.
- */
-bool Curl_tls_keylog_write_line(const char *line);
-
-#endif /* HEADER_CURL_KEYLOG_H */
+#ifndef HEADER_CURL_KEYLOG_H
+#define HEADER_CURL_KEYLOG_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.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"
+
+/*
+ * Opens the TLS key log file if requested by the user. The SSLKEYLOGFILE
+ * environment variable specifies the output file.
+ */
+void Curl_tls_keylog_open(void);
+
+/*
+ * Closes the TLS key log file if not already.
+ */
+void Curl_tls_keylog_close(void);
+
+/*
+ * Returns true if the user successfully enabled the TLS key log file.
+ */
+bool Curl_tls_keylog_enabled(void);
+
+/*
+ * Appends a key log file entry.
+ * Returns true iff the key log file is open and a valid entry was provided.
+ */
+bool Curl_tls_keylog_write(const char *label,
+ const unsigned char client_random[32],
+ const unsigned char *secret, size_t secretlen);
+
+/*
+ * Appends a line to the key log file, ensure it is terminated by a LF.
+ * Returns true iff the key log file is open and a valid line was provided.
+ */
+bool Curl_tls_keylog_write_line(const char *line);
+
+#endif /* HEADER_CURL_KEYLOG_H */
diff --git a/contrib/libs/curl/lib/vtls/mbedtls.c b/contrib/libs/curl/lib/vtls/mbedtls.c
index ef85bc0944..e30f660fbb 100644
--- a/contrib/libs/curl/lib/vtls/mbedtls.c
+++ b/contrib/libs/curl/lib/vtls/mbedtls.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010 - 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -31,9 +31,9 @@
#ifdef USE_MBEDTLS
-/* Define this to enable lots of debugging for mbedTLS */
-/* #define MBEDTLS_DEBUG */
-
+/* Define this to enable lots of debugging for mbedTLS */
+/* #define MBEDTLS_DEBUG */
+
#error #include <mbedtls/version.h>
#if MBEDTLS_VERSION_NUMBER >= 0x02040000
#error #include <mbedtls/net_sockets.h>
@@ -49,12 +49,12 @@
#error #include <mbedtls/ctr_drbg.h>
#error #include <mbedtls/sha256.h>
-#if MBEDTLS_VERSION_MAJOR >= 2
-# ifdef MBEDTLS_DEBUG
-# error #include <mbedtls/debug.h>
-# endif
-#endif
-
+#if MBEDTLS_VERSION_MAJOR >= 2
+# ifdef MBEDTLS_DEBUG
+# error #include <mbedtls/debug.h>
+# endif
+#endif
+
#include "urldata.h"
#include "sendf.h"
#include "inet_pton.h"
@@ -64,7 +64,7 @@
#include "connect.h" /* for the connect timeout */
#include "select.h"
#include "multiif.h"
-#error #include "mbedtls_threadlock.h"
+#error #include "mbedtls_threadlock.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -98,12 +98,12 @@ static int entropy_init_initialized = 0;
static void entropy_init_mutex(mbedtls_entropy_context *ctx)
{
/* lock 0 = entropy_init_mutex() */
- Curl_mbedtlsthreadlock_lock_function(0);
+ Curl_mbedtlsthreadlock_lock_function(0);
if(entropy_init_initialized == 0) {
mbedtls_entropy_init(ctx);
entropy_init_initialized = 1;
}
- Curl_mbedtlsthreadlock_unlock_function(0);
+ Curl_mbedtlsthreadlock_unlock_function(0);
}
/* end of entropy_init_mutex() */
@@ -112,9 +112,9 @@ static int entropy_func_mutex(void *data, unsigned char *output, size_t len)
{
int ret;
/* lock 1 = entropy_func_mutex() */
- Curl_mbedtlsthreadlock_lock_function(1);
+ Curl_mbedtlsthreadlock_lock_function(1);
ret = mbedtls_entropy_func(data, output, len);
- Curl_mbedtlsthreadlock_unlock_function(1);
+ Curl_mbedtlsthreadlock_unlock_function(1);
return ret;
}
@@ -200,7 +200,7 @@ set_ssl_version_min_max(struct connectdata *conn, int sockindex)
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
int mbedtls_ver_min = MBEDTLS_SSL_MINOR_VERSION_1;
int mbedtls_ver_max = MBEDTLS_SSL_MINOR_VERSION_1;
long ssl_version = SSL_CONN_CONFIG(version);
@@ -232,9 +232,9 @@ set_ssl_version_min_max(struct connectdata *conn, int sockindex)
return result;
}
- mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
+ mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
mbedtls_ver_min);
- mbedtls_ssl_conf_max_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
+ mbedtls_ssl_conf_max_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
mbedtls_ver_max);
return result;
@@ -245,21 +245,21 @@ mbed_connect_step1(struct connectdata *conn,
int sockindex)
{
struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
const char * const ssl_capath = SSL_CONN_CONFIG(CApath);
- char * const ssl_cert = SSL_SET_OPTION(primary.clientcert);
+ char * const ssl_cert = SSL_SET_OPTION(primary.clientcert);
const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
-#else
- const char * const hostname = conn->host.name;
- const long int port = conn->remote_port;
-#endif
+#else
+ const char * const hostname = conn->host.name;
+ const long int port = conn->remote_port;
+#endif
int ret = -1;
char errorbuf[128];
errorbuf[0] = 0;
@@ -272,9 +272,9 @@ mbed_connect_step1(struct connectdata *conn,
#ifdef THREADING_SUPPORT
entropy_init_mutex(&ts_entropy);
- mbedtls_ctr_drbg_init(&backend->ctr_drbg);
+ mbedtls_ctr_drbg_init(&backend->ctr_drbg);
- ret = mbedtls_ctr_drbg_seed(&backend->ctr_drbg, entropy_func_mutex,
+ ret = mbedtls_ctr_drbg_seed(&backend->ctr_drbg, entropy_func_mutex,
&ts_entropy, NULL, 0);
if(ret) {
#ifdef MBEDTLS_ERROR_C
@@ -284,11 +284,11 @@ mbed_connect_step1(struct connectdata *conn,
-ret, errorbuf);
}
#else
- mbedtls_entropy_init(&backend->entropy);
- mbedtls_ctr_drbg_init(&backend->ctr_drbg);
+ mbedtls_entropy_init(&backend->entropy);
+ mbedtls_ctr_drbg_init(&backend->ctr_drbg);
- ret = mbedtls_ctr_drbg_seed(&backend->ctr_drbg, mbedtls_entropy_func,
- &backend->entropy, NULL, 0);
+ ret = mbedtls_ctr_drbg_seed(&backend->ctr_drbg, mbedtls_entropy_func,
+ &backend->entropy, NULL, 0);
if(ret) {
#ifdef MBEDTLS_ERROR_C
mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
@@ -299,10 +299,10 @@ mbed_connect_step1(struct connectdata *conn,
#endif /* THREADING_SUPPORT */
/* Load the trusted CA */
- mbedtls_x509_crt_init(&backend->cacert);
+ mbedtls_x509_crt_init(&backend->cacert);
if(ssl_cafile) {
- ret = mbedtls_x509_crt_parse_file(&backend->cacert, ssl_cafile);
+ ret = mbedtls_x509_crt_parse_file(&backend->cacert, ssl_cafile);
if(ret<0) {
#ifdef MBEDTLS_ERROR_C
@@ -317,7 +317,7 @@ mbed_connect_step1(struct connectdata *conn,
}
if(ssl_capath) {
- ret = mbedtls_x509_crt_parse_path(&backend->cacert, ssl_capath);
+ ret = mbedtls_x509_crt_parse_path(&backend->cacert, ssl_capath);
if(ret<0) {
#ifdef MBEDTLS_ERROR_C
@@ -332,10 +332,10 @@ mbed_connect_step1(struct connectdata *conn,
}
/* Load the client certificate */
- mbedtls_x509_crt_init(&backend->clicert);
+ mbedtls_x509_crt_init(&backend->clicert);
if(ssl_cert) {
- ret = mbedtls_x509_crt_parse_file(&backend->clicert, ssl_cert);
+ ret = mbedtls_x509_crt_parse_file(&backend->clicert, ssl_cert);
if(ret) {
#ifdef MBEDTLS_ERROR_C
@@ -349,13 +349,13 @@ mbed_connect_step1(struct connectdata *conn,
}
/* Load the client private key */
- mbedtls_pk_init(&backend->pk);
+ mbedtls_pk_init(&backend->pk);
if(SSL_SET_OPTION(key)) {
- ret = mbedtls_pk_parse_keyfile(&backend->pk, SSL_SET_OPTION(key),
+ ret = mbedtls_pk_parse_keyfile(&backend->pk, SSL_SET_OPTION(key),
SSL_SET_OPTION(key_passwd));
- if(ret == 0 && !(mbedtls_pk_can_do(&backend->pk, MBEDTLS_PK_RSA) ||
- mbedtls_pk_can_do(&backend->pk, MBEDTLS_PK_ECKEY)))
+ if(ret == 0 && !(mbedtls_pk_can_do(&backend->pk, MBEDTLS_PK_RSA) ||
+ mbedtls_pk_can_do(&backend->pk, MBEDTLS_PK_ECKEY)))
ret = MBEDTLS_ERR_PK_TYPE_MISMATCH;
if(ret) {
@@ -370,10 +370,10 @@ mbed_connect_step1(struct connectdata *conn,
}
/* Load the CRL */
- mbedtls_x509_crl_init(&backend->crl);
+ mbedtls_x509_crl_init(&backend->crl);
if(ssl_crlfile) {
- ret = mbedtls_x509_crl_parse_file(&backend->crl, ssl_crlfile);
+ ret = mbedtls_x509_crl_parse_file(&backend->crl, ssl_crlfile);
if(ret) {
#ifdef MBEDTLS_ERROR_C
@@ -388,14 +388,14 @@ mbed_connect_step1(struct connectdata *conn,
infof(data, "mbedTLS: Connecting to %s:%ld\n", hostname, port);
- mbedtls_ssl_config_init(&backend->config);
+ mbedtls_ssl_config_init(&backend->config);
- mbedtls_ssl_init(&backend->ssl);
- if(mbedtls_ssl_setup(&backend->ssl, &backend->config)) {
+ mbedtls_ssl_init(&backend->ssl);
+ if(mbedtls_ssl_setup(&backend->ssl, &backend->config)) {
failf(data, "mbedTLS: ssl_init failed");
return CURLE_SSL_CONNECT_ERROR;
}
- ret = mbedtls_ssl_config_defaults(&backend->config,
+ ret = mbedtls_ssl_config_defaults(&backend->config,
MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT);
@@ -405,20 +405,20 @@ mbed_connect_step1(struct connectdata *conn,
}
/* new profile with RSA min key len = 1024 ... */
- mbedtls_ssl_conf_cert_profile(&backend->config,
+ mbedtls_ssl_conf_cert_profile(&backend->config,
&mbedtls_x509_crt_profile_fr);
switch(SSL_CONN_CONFIG(version)) {
case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
- mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
+ mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
MBEDTLS_SSL_MINOR_VERSION_1);
infof(data, "mbedTLS: Set min SSL version to TLS 1.0\n");
break;
case CURL_SSLVERSION_SSLv3:
- mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
+ mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
MBEDTLS_SSL_MINOR_VERSION_0);
- mbedtls_ssl_conf_max_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
+ mbedtls_ssl_conf_max_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
MBEDTLS_SSL_MINOR_VERSION_0);
infof(data, "mbedTLS: Set SSL version to SSLv3\n");
break;
@@ -437,25 +437,25 @@ mbed_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR;
}
- mbedtls_ssl_conf_authmode(&backend->config, MBEDTLS_SSL_VERIFY_OPTIONAL);
+ mbedtls_ssl_conf_authmode(&backend->config, MBEDTLS_SSL_VERIFY_OPTIONAL);
- mbedtls_ssl_conf_rng(&backend->config, mbedtls_ctr_drbg_random,
- &backend->ctr_drbg);
- mbedtls_ssl_set_bio(&backend->ssl, &conn->sock[sockindex],
+ mbedtls_ssl_conf_rng(&backend->config, mbedtls_ctr_drbg_random,
+ &backend->ctr_drbg);
+ mbedtls_ssl_set_bio(&backend->ssl, &conn->sock[sockindex],
mbedtls_net_send,
mbedtls_net_recv,
NULL /* rev_timeout() */);
- mbedtls_ssl_conf_ciphersuites(&backend->config,
+ mbedtls_ssl_conf_ciphersuites(&backend->config,
mbedtls_ssl_list_ciphersuites());
#if defined(MBEDTLS_SSL_RENEGOTIATION)
- mbedtls_ssl_conf_renegotiation(&backend->config,
+ mbedtls_ssl_conf_renegotiation(&backend->config,
MBEDTLS_SSL_RENEGOTIATION_ENABLED);
#endif
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
- mbedtls_ssl_conf_session_tickets(&backend->config,
+ mbedtls_ssl_conf_session_tickets(&backend->config,
MBEDTLS_SSL_SESSION_TICKETS_DISABLED);
#endif
@@ -465,7 +465,7 @@ mbed_connect_step1(struct connectdata *conn,
Curl_ssl_sessionid_lock(conn);
if(!Curl_ssl_getsessionid(conn, &old_session, NULL, sockindex)) {
- ret = mbedtls_ssl_set_session(&backend->ssl, old_session);
+ ret = mbedtls_ssl_set_session(&backend->ssl, old_session);
if(ret) {
Curl_ssl_sessionid_unlock(conn);
failf(data, "mbedtls_ssl_set_session returned -0x%x", -ret);
@@ -476,15 +476,15 @@ mbed_connect_step1(struct connectdata *conn,
Curl_ssl_sessionid_unlock(conn);
}
- mbedtls_ssl_conf_ca_chain(&backend->config,
- &backend->cacert,
- &backend->crl);
+ mbedtls_ssl_conf_ca_chain(&backend->config,
+ &backend->cacert,
+ &backend->crl);
if(SSL_SET_OPTION(key)) {
- mbedtls_ssl_conf_own_cert(&backend->config,
- &backend->clicert, &backend->pk);
+ mbedtls_ssl_conf_own_cert(&backend->config,
+ &backend->clicert, &backend->pk);
}
- if(mbedtls_ssl_set_hostname(&backend->ssl, hostname)) {
+ if(mbedtls_ssl_set_hostname(&backend->ssl, hostname)) {
/* mbedtls_ssl_set_hostname() sets the name to use in CN/SAN checks *and*
the name to set in the SNI extension. So even if curl connects to a
host specified as an IP address, this function must be used. */
@@ -494,7 +494,7 @@ mbed_connect_step1(struct connectdata *conn,
#ifdef HAS_ALPN
if(conn->bits.tls_enable_alpn) {
- const char **p = &backend->protocols[0];
+ const char **p = &backend->protocols[0];
#ifdef USE_NGHTTP2
if(data->set.httpversion >= CURL_HTTP_VERSION_2)
*p++ = NGHTTP2_PROTO_VERSION_ID;
@@ -503,19 +503,19 @@ mbed_connect_step1(struct connectdata *conn,
*p = NULL;
/* this function doesn't clone the protocols array, which is why we need
to keep it around */
- if(mbedtls_ssl_conf_alpn_protocols(&backend->config,
- &backend->protocols[0])) {
+ if(mbedtls_ssl_conf_alpn_protocols(&backend->config,
+ &backend->protocols[0])) {
failf(data, "Failed setting ALPN protocols");
return CURLE_SSL_CONNECT_ERROR;
}
- for(p = &backend->protocols[0]; *p; ++p)
+ for(p = &backend->protocols[0]; *p; ++p)
infof(data, "ALPN, offering %s\n", *p);
}
#endif
#ifdef MBEDTLS_DEBUG
/* In order to make that work in mbedtls MBEDTLS_DEBUG_C must be defined. */
- mbedtls_ssl_conf_dbg(&backend->config, mbed_debug, data);
+ mbedtls_ssl_conf_dbg(&backend->config, mbed_debug, data);
/* - 0 No debug
* - 1 Error
* - 2 State change
@@ -527,7 +527,7 @@ mbed_connect_step1(struct connectdata *conn,
/* give application a chance to interfere with mbedTLS set up. */
if(data->set.ssl.fsslctx) {
- ret = (*data->set.ssl.fsslctx)(data, &backend->config,
+ ret = (*data->set.ssl.fsslctx)(data, &backend->config,
data->set.ssl.fsslctxp);
if(ret) {
failf(data, "error signaled by ssl ctx callback");
@@ -546,22 +546,22 @@ mbed_connect_step2(struct connectdata *conn,
{
int ret;
struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
const mbedtls_x509_crt *peercert;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const char * const pinnedpubkey = SSL_IS_PROXY() ?
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
-#else
- const char * const pinnedpubkey =
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
-#endif
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
+#else
+ const char * const pinnedpubkey =
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
+#endif
conn->recv[sockindex] = mbed_recv;
conn->send[sockindex] = mbed_send;
- ret = mbedtls_ssl_handshake(&backend->ssl);
+ ret = mbedtls_ssl_handshake(&backend->ssl);
if(ret == MBEDTLS_ERR_SSL_WANT_READ) {
connssl->connecting_state = ssl_connect_2_reading;
@@ -583,10 +583,10 @@ mbed_connect_step2(struct connectdata *conn,
}
infof(data, "mbedTLS: Handshake complete, cipher is %s\n",
- mbedtls_ssl_get_ciphersuite(&backend->ssl)
+ mbedtls_ssl_get_ciphersuite(&backend->ssl)
);
- ret = mbedtls_ssl_get_verify_result(&backend->ssl);
+ ret = mbedtls_ssl_get_verify_result(&backend->ssl);
if(!SSL_CONN_CONFIG(verifyhost))
/* Ignore hostname errors if verifyhost is disabled */
@@ -605,13 +605,13 @@ mbed_connect_step2(struct connectdata *conn,
else if(ret & MBEDTLS_X509_BADCERT_NOT_TRUSTED)
failf(data, "Cert verify failed: BADCERT_NOT_TRUSTED");
- else if(ret & MBEDTLS_X509_BADCERT_FUTURE)
- failf(data, "Cert verify failed: BADCERT_FUTURE");
-
+ else if(ret & MBEDTLS_X509_BADCERT_FUTURE)
+ failf(data, "Cert verify failed: BADCERT_FUTURE");
+
return CURLE_PEER_FAILED_VERIFICATION;
}
- peercert = mbedtls_ssl_get_peer_cert(&backend->ssl);
+ peercert = mbedtls_ssl_get_peer_cert(&backend->ssl);
if(peercert && data->set.verbose) {
const size_t bufsize = 16384;
@@ -681,7 +681,7 @@ mbed_connect_step2(struct connectdata *conn,
#ifdef HAS_ALPN
if(conn->bits.tls_enable_alpn) {
- const char *next_protocol = mbedtls_ssl_get_alpn_protocol(&backend->ssl);
+ const char *next_protocol = mbedtls_ssl_get_alpn_protocol(&backend->ssl);
if(next_protocol) {
infof(data, "ALPN, server accepted to use %s\n", next_protocol);
@@ -718,7 +718,7 @@ mbed_connect_step3(struct connectdata *conn,
{
CURLcode retcode = CURLE_OK;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
struct Curl_easy *data = conn->data;
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
@@ -734,7 +734,7 @@ mbed_connect_step3(struct connectdata *conn,
mbedtls_ssl_session_init(our_ssl_sessionid);
- ret = mbedtls_ssl_get_session(&backend->ssl, our_ssl_sessionid);
+ ret = mbedtls_ssl_get_session(&backend->ssl, our_ssl_sessionid);
if(ret) {
if(ret != MBEDTLS_ERR_SSL_ALLOC_FAILED)
mbedtls_ssl_session_free(our_ssl_sessionid);
@@ -768,10 +768,10 @@ static ssize_t mbed_send(struct connectdata *conn, int sockindex,
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
int ret = -1;
- ret = mbedtls_ssl_write(&backend->ssl,
+ ret = mbedtls_ssl_write(&backend->ssl,
(unsigned char *)mem, len);
if(ret < 0) {
@@ -791,16 +791,16 @@ static void Curl_mbedtls_close_all(struct Curl_easy *data)
static void Curl_mbedtls_close(struct connectdata *conn, int sockindex)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- mbedtls_pk_free(&backend->pk);
- mbedtls_x509_crt_free(&backend->clicert);
- mbedtls_x509_crt_free(&backend->cacert);
- mbedtls_x509_crl_free(&backend->crl);
- mbedtls_ssl_config_free(&backend->config);
- mbedtls_ssl_free(&backend->ssl);
- mbedtls_ctr_drbg_free(&backend->ctr_drbg);
+ struct ssl_backend_data *backend = connssl->backend;
+ mbedtls_pk_free(&backend->pk);
+ mbedtls_x509_crt_free(&backend->clicert);
+ mbedtls_x509_crt_free(&backend->cacert);
+ mbedtls_x509_crl_free(&backend->crl);
+ mbedtls_ssl_config_free(&backend->config);
+ mbedtls_ssl_free(&backend->ssl);
+ mbedtls_ctr_drbg_free(&backend->ctr_drbg);
#ifndef THREADING_SUPPORT
- mbedtls_entropy_free(&backend->entropy);
+ mbedtls_entropy_free(&backend->entropy);
#endif /* THREADING_SUPPORT */
}
@@ -809,12 +809,12 @@ static ssize_t mbed_recv(struct connectdata *conn, int num,
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[num];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
int ret = -1;
ssize_t len = -1;
memset(buf, 0, buffersize);
- ret = mbedtls_ssl_read(&backend->ssl, (unsigned char *)buf,
+ ret = mbedtls_ssl_read(&backend->ssl, (unsigned char *)buf,
buffersize);
if(ret <= 0) {
@@ -908,7 +908,7 @@ mbed_connect_common(struct connectdata *conn,
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
curl_socket_t sockfd = conn->sock[sockindex];
- timediff_t timeout_ms;
+ timediff_t timeout_ms;
int what;
/* check if the connection has already been established */
@@ -1038,20 +1038,20 @@ static CURLcode Curl_mbedtls_connect(struct connectdata *conn, int sockindex)
*/
static int Curl_mbedtls_init(void)
{
- return Curl_mbedtlsthreadlock_thread_setup();
+ return Curl_mbedtlsthreadlock_thread_setup();
}
static void Curl_mbedtls_cleanup(void)
{
- (void)Curl_mbedtlsthreadlock_thread_cleanup();
+ (void)Curl_mbedtlsthreadlock_thread_cleanup();
}
static bool Curl_mbedtls_data_pending(const struct connectdata *conn,
int sockindex)
{
const struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
- return mbedtls_ssl_get_bytes_avail(&backend->ssl) != 0;
+ struct ssl_backend_data *backend = connssl->backend;
+ return mbedtls_ssl_get_bytes_avail(&backend->ssl) != 0;
}
static CURLcode Curl_mbedtls_sha256sum(const unsigned char *input,
@@ -1073,9 +1073,9 @@ static CURLcode Curl_mbedtls_sha256sum(const unsigned char *input,
static void *Curl_mbedtls_get_internals(struct ssl_connect_data *connssl,
CURLINFO info UNUSED_PARAM)
{
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
(void)info;
- return &backend->ssl;
+ return &backend->ssl;
}
const struct Curl_ssl Curl_ssl_mbedtls = {
diff --git a/contrib/libs/curl/lib/vtls/mbedtls.h b/contrib/libs/curl/lib/vtls/mbedtls.h
index b263d67318..1abd331ea9 100644
--- a/contrib/libs/curl/lib/vtls/mbedtls.h
+++ b/contrib/libs/curl/lib/vtls/mbedtls.h
@@ -7,12 +7,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2010, Hoi-Ho Chan, <hoiho.chan@gmail.com>
*
* 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vtls/mbedtls_threadlock.c b/contrib/libs/curl/lib/vtls/mbedtls_threadlock.c
index 3216118500..d3c4698131 100644
--- a/contrib/libs/curl/lib/vtls/mbedtls_threadlock.c
+++ b/contrib/libs/curl/lib/vtls/mbedtls_threadlock.c
@@ -1,144 +1,144 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 2013 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
- * Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>
- *
- * 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.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"
-
-#if defined(USE_MBEDTLS) && \
- ((defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)) || \
- (defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)))
-
-#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
-# include <pthread.h>
-# define MBEDTLS_MUTEX_T pthread_mutex_t
-#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
-# include <process.h>
-# define MBEDTLS_MUTEX_T HANDLE
-#endif
-
-#error #include "mbedtls_threadlock.h"
-#include "curl_printf.h"
-#include "curl_memory.h"
-/* The last #include file should be: */
-#include "memdebug.h"
-
-/* number of thread locks */
-#define NUMT 2
-
-/* This array will store all of the mutexes available to Mbedtls. */
-static MBEDTLS_MUTEX_T *mutex_buf = NULL;
-
-int Curl_mbedtlsthreadlock_thread_setup(void)
-{
- int i;
-
- mutex_buf = calloc(NUMT * sizeof(MBEDTLS_MUTEX_T), 1);
- if(!mutex_buf)
- return 0; /* error, no number of threads defined */
-
- for(i = 0; i < NUMT; i++) {
- int ret;
-#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
- ret = pthread_mutex_init(&mutex_buf[i], NULL);
- if(ret)
- return 0; /* pthread_mutex_init failed */
-#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
- mutex_buf[i] = CreateMutex(0, FALSE, 0);
- if(mutex_buf[i] == 0)
- return 0; /* CreateMutex failed */
-#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
- }
-
- return 1; /* OK */
-}
-
-int Curl_mbedtlsthreadlock_thread_cleanup(void)
-{
- int i;
-
- if(!mutex_buf)
- return 0; /* error, no threads locks defined */
-
- for(i = 0; i < NUMT; i++) {
- int ret;
-#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
- ret = pthread_mutex_destroy(&mutex_buf[i]);
- if(ret)
- return 0; /* pthread_mutex_destroy failed */
-#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
- ret = CloseHandle(mutex_buf[i]);
- if(!ret)
- return 0; /* CloseHandle failed */
-#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
- }
- free(mutex_buf);
- mutex_buf = NULL;
-
- return 1; /* OK */
-}
-
-int Curl_mbedtlsthreadlock_lock_function(int n)
-{
- if(n < NUMT) {
- int ret;
-#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
- ret = pthread_mutex_lock(&mutex_buf[n]);
- if(ret) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_lock_function failed\n"));
- return 0; /* pthread_mutex_lock failed */
- }
-#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
- ret = (WaitForSingleObject(mutex_buf[n], INFINITE) == WAIT_FAILED?1:0);
- if(ret) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_lock_function failed\n"));
- return 0; /* pthread_mutex_lock failed */
- }
-#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
- }
- return 1; /* OK */
-}
-
-int Curl_mbedtlsthreadlock_unlock_function(int n)
-{
- if(n < NUMT) {
- int ret;
-#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
- ret = pthread_mutex_unlock(&mutex_buf[n]);
- if(ret) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_unlock_function failed\n"));
- return 0; /* pthread_mutex_unlock failed */
- }
-#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
- ret = ReleaseMutex(mutex_buf[n]);
- if(!ret) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_unlock_function failed\n"));
- return 0; /* pthread_mutex_lock failed */
- }
-#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
- }
- return 1; /* OK */
-}
-
-#endif /* USE_MBEDTLS */
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 2013 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2010, 2011, Hoi-Ho Chan, <hoiho.chan@gmail.com>
+ *
+ * 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.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"
+
+#if defined(USE_MBEDTLS) && \
+ ((defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)) || \
+ (defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)))
+
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+# include <pthread.h>
+# define MBEDTLS_MUTEX_T pthread_mutex_t
+#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
+# include <process.h>
+# define MBEDTLS_MUTEX_T HANDLE
+#endif
+
+#error #include "mbedtls_threadlock.h"
+#include "curl_printf.h"
+#include "curl_memory.h"
+/* The last #include file should be: */
+#include "memdebug.h"
+
+/* number of thread locks */
+#define NUMT 2
+
+/* This array will store all of the mutexes available to Mbedtls. */
+static MBEDTLS_MUTEX_T *mutex_buf = NULL;
+
+int Curl_mbedtlsthreadlock_thread_setup(void)
+{
+ int i;
+
+ mutex_buf = calloc(NUMT * sizeof(MBEDTLS_MUTEX_T), 1);
+ if(!mutex_buf)
+ return 0; /* error, no number of threads defined */
+
+ for(i = 0; i < NUMT; i++) {
+ int ret;
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+ ret = pthread_mutex_init(&mutex_buf[i], NULL);
+ if(ret)
+ return 0; /* pthread_mutex_init failed */
+#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
+ mutex_buf[i] = CreateMutex(0, FALSE, 0);
+ if(mutex_buf[i] == 0)
+ return 0; /* CreateMutex failed */
+#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
+ }
+
+ return 1; /* OK */
+}
+
+int Curl_mbedtlsthreadlock_thread_cleanup(void)
+{
+ int i;
+
+ if(!mutex_buf)
+ return 0; /* error, no threads locks defined */
+
+ for(i = 0; i < NUMT; i++) {
+ int ret;
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+ ret = pthread_mutex_destroy(&mutex_buf[i]);
+ if(ret)
+ return 0; /* pthread_mutex_destroy failed */
+#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
+ ret = CloseHandle(mutex_buf[i]);
+ if(!ret)
+ return 0; /* CloseHandle failed */
+#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
+ }
+ free(mutex_buf);
+ mutex_buf = NULL;
+
+ return 1; /* OK */
+}
+
+int Curl_mbedtlsthreadlock_lock_function(int n)
+{
+ if(n < NUMT) {
+ int ret;
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+ ret = pthread_mutex_lock(&mutex_buf[n]);
+ if(ret) {
+ DEBUGF(fprintf(stderr,
+ "Error: mbedtlsthreadlock_lock_function failed\n"));
+ return 0; /* pthread_mutex_lock failed */
+ }
+#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
+ ret = (WaitForSingleObject(mutex_buf[n], INFINITE) == WAIT_FAILED?1:0);
+ if(ret) {
+ DEBUGF(fprintf(stderr,
+ "Error: mbedtlsthreadlock_lock_function failed\n"));
+ return 0; /* pthread_mutex_lock failed */
+ }
+#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
+ }
+ return 1; /* OK */
+}
+
+int Curl_mbedtlsthreadlock_unlock_function(int n)
+{
+ if(n < NUMT) {
+ int ret;
+#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
+ ret = pthread_mutex_unlock(&mutex_buf[n]);
+ if(ret) {
+ DEBUGF(fprintf(stderr,
+ "Error: mbedtlsthreadlock_unlock_function failed\n"));
+ return 0; /* pthread_mutex_unlock failed */
+ }
+#elif defined(USE_THREADS_WIN32) && defined(HAVE_PROCESS_H)
+ ret = ReleaseMutex(mutex_buf[n]);
+ if(!ret) {
+ DEBUGF(fprintf(stderr,
+ "Error: mbedtlsthreadlock_unlock_function failed\n"));
+ return 0; /* pthread_mutex_lock failed */
+ }
+#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
+ }
+ return 1; /* OK */
+}
+
+#endif /* USE_MBEDTLS */
diff --git a/contrib/libs/curl/lib/vtls/mesalink.c b/contrib/libs/curl/lib/vtls/mesalink.c
index 4b57a78b8f..309786cf83 100644
--- a/contrib/libs/curl/lib/vtls/mesalink.c
+++ b/contrib/libs/curl/lib/vtls/mesalink.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2017 - 2018, Yiming Jing, <jingyiming@baidu.com>
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -158,8 +158,8 @@ mesalink_connect_step1(struct connectdata *conn, int sockindex)
SSL_CONN_CONFIG(CApath))) {
if(SSL_CONN_CONFIG(verifypeer)) {
failf(data,
- "error setting certificate verify locations: "
- " CAfile: %s CApath: %s",
+ "error setting certificate verify locations: "
+ " CAfile: %s CApath: %s",
SSL_CONN_CONFIG(CAfile) ?
SSL_CONN_CONFIG(CAfile) : "none",
SSL_CONN_CONFIG(CApath) ?
@@ -173,18 +173,18 @@ mesalink_connect_step1(struct connectdata *conn, int sockindex)
else {
infof(data, "successfully set certificate verify locations:\n");
}
- infof(data, " CAfile: %s\n",
- SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile): "none");
- infof(data, " CApath: %s\n",
- SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath): "none");
+ infof(data, " CAfile: %s\n",
+ SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile): "none");
+ infof(data, " CApath: %s\n",
+ SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath): "none");
}
- if(SSL_SET_OPTION(primary.clientcert) && SSL_SET_OPTION(key)) {
+ if(SSL_SET_OPTION(primary.clientcert) && SSL_SET_OPTION(key)) {
int file_type = do_file_type(SSL_SET_OPTION(cert_type));
- if(SSL_CTX_use_certificate_chain_file(BACKEND->ctx,
- SSL_SET_OPTION(primary.clientcert),
- file_type) != 1) {
+ if(SSL_CTX_use_certificate_chain_file(BACKEND->ctx,
+ SSL_SET_OPTION(primary.clientcert),
+ file_type) != 1) {
failf(data, "unable to use client certificate (no key or wrong pass"
" phrase?)");
return CURLE_SSL_CONNECT_ERROR;
@@ -492,7 +492,7 @@ mesalink_connect_common(struct connectdata *conn, int sockindex,
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
curl_socket_t sockfd = conn->sock[sockindex];
- timediff_t timeout_ms;
+ timediff_t timeout_ms;
int what;
/* check if the connection has already been established */
@@ -540,8 +540,8 @@ mesalink_connect_common(struct connectdata *conn, int sockindex,
? sockfd
: CURL_SOCKET_BAD;
- what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
- nonblocking ? 0 : timeout_ms);
+ what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
+ nonblocking ? 0 : timeout_ms);
if(what < 0) {
/* fatal error */
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
diff --git a/contrib/libs/curl/lib/vtls/mesalink.h b/contrib/libs/curl/lib/vtls/mesalink.h
index 58cc3321cc..03f520c1dc 100644
--- a/contrib/libs/curl/lib/vtls/mesalink.h
+++ b/contrib/libs/curl/lib/vtls/mesalink.h
@@ -7,12 +7,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2017 - 2018, Yiming Jing, <jingyiming@baidu.com>
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2017 - 2018, Yiming Jing, <jingyiming@baidu.com>
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vtls/nss.c b/contrib/libs/curl/lib/vtls/nss.c
index c979d7cc72..59649ccc3a 100644
--- a/contrib/libs/curl/lib/vtls/nss.c
+++ b/contrib/libs/curl/lib/vtls/nss.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -83,7 +83,7 @@ struct ssl_backend_data {
PRFileDesc *handle;
char *client_nickname;
struct Curl_easy *data;
- struct Curl_llist obj_list;
+ struct Curl_llist obj_list;
PK11GenericObject *obj_clicert;
};
@@ -91,32 +91,32 @@ static PRLock *nss_initlock = NULL;
static PRLock *nss_crllock = NULL;
static PRLock *nss_findslot_lock = NULL;
static PRLock *nss_trustload_lock = NULL;
-static struct Curl_llist nss_crl_list;
+static struct Curl_llist nss_crl_list;
static NSSInitContext *nss_context = NULL;
static volatile int initialized = 0;
/* type used to wrap pointers as list nodes */
struct ptr_list_wrap {
void *ptr;
- struct Curl_llist_element node;
+ struct Curl_llist_element node;
};
-struct cipher_s {
+struct cipher_s {
const char *name;
int num;
-};
+};
#define PK11_SETATTRS(_attr, _idx, _type, _val, _len) do { \
CK_ATTRIBUTE *ptr = (_attr) + ((_idx)++); \
ptr->type = (_type); \
ptr->pValue = (_val); \
ptr->ulValueLen = (_len); \
-} while(0)
+} while(0)
#define CERT_NewTempCertificate __CERT_NewTempCertificate
#define NUM_OF_CIPHERS sizeof(cipherlist)/sizeof(cipherlist[0])
-static const struct cipher_s cipherlist[] = {
+static const struct cipher_s cipherlist[] = {
/* SSL2 cipher suites */
{"rc4", SSL_EN_RC4_128_WITH_MD5},
{"rc4-md5", SSL_EN_RC4_128_WITH_MD5},
@@ -430,7 +430,7 @@ static PK11SlotInfo* nss_find_slot_by_name(const char *slot_name)
}
/* wrap 'ptr' as list node and tail-insert into 'list' */
-static CURLcode insert_wrapped_ptr(struct Curl_llist *list, void *ptr)
+static CURLcode insert_wrapped_ptr(struct Curl_llist *list, void *ptr)
{
struct ptr_list_wrap *wrap = malloc(sizeof(*wrap));
if(!wrap)
@@ -460,7 +460,7 @@ static CURLcode nss_create_object(struct ssl_connect_data *connssl,
const int slot_id = (cacert) ? 0 : 1;
char *slot_name = aprintf("PEM Token #%d", slot_id);
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
if(!slot_name)
return CURLE_OUT_OF_MEMORY;
@@ -494,14 +494,14 @@ static CURLcode nss_create_object(struct ssl_connect_data *connssl,
if(!obj)
return result;
- if(insert_wrapped_ptr(&backend->obj_list, obj) != CURLE_OK) {
+ if(insert_wrapped_ptr(&backend->obj_list, obj) != CURLE_OK) {
PK11_DestroyGenericObject(obj);
return CURLE_OUT_OF_MEMORY;
}
if(!cacert && CKO_CERTIFICATE == obj_class)
/* store reference to a client certificate */
- backend->obj_clicert = obj;
+ backend->obj_clicert = obj;
return CURLE_OK;
}
@@ -1027,7 +1027,7 @@ static SECStatus BadCertHandler(void *arg, PRFileDesc *sock)
CERTCertificate *cert;
/* remember the cert verification result */
- SSL_SET_OPTION_LVALUE(certverifyresult) = err;
+ SSL_SET_OPTION_LVALUE(certverifyresult) = err;
if(err == SSL_ERROR_BAD_CERT_DOMAIN && !SSL_CONN_CONFIG(verifyhost))
/* we are asked not to verify the host name */
@@ -1080,8 +1080,8 @@ static CURLcode cmp_peer_pubkey(struct ssl_connect_data *connssl,
const char *pinnedpubkey)
{
CURLcode result = CURLE_SSL_PINNEDPUBKEYNOTMATCH;
- struct ssl_backend_data *backend = connssl->backend;
- struct Curl_easy *data = backend->data;
+ struct ssl_backend_data *backend = connssl->backend;
+ struct Curl_easy *data = backend->data;
CERTCertificate *cert;
if(!pinnedpubkey)
@@ -1089,7 +1089,7 @@ static CURLcode cmp_peer_pubkey(struct ssl_connect_data *connssl,
return CURLE_OK;
/* get peer certificate */
- cert = SSL_PeerCertificate(backend->handle);
+ cert = SSL_PeerCertificate(backend->handle);
if(cert) {
/* extract public key from peer certificate */
SECKEYPublicKey *pubkey = CERT_ExtractPublicKey(cert);
@@ -1133,12 +1133,12 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
struct SECKEYPrivateKeyStr **pRetKey)
{
struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg;
- struct ssl_backend_data *backend = connssl->backend;
- struct Curl_easy *data = backend->data;
- const char *nickname = backend->client_nickname;
+ struct ssl_backend_data *backend = connssl->backend;
+ struct Curl_easy *data = backend->data;
+ const char *nickname = backend->client_nickname;
static const char pem_slotname[] = "PEM Token #1";
- if(backend->obj_clicert) {
+ if(backend->obj_clicert) {
/* use the cert/key provided by PEM reader */
SECItem cert_der = { 0, NULL, 0 };
void *proto_win = SSL_RevealPinArg(sock);
@@ -1151,7 +1151,7 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
return SECFailure;
}
- if(PK11_ReadRawAttribute(PK11_TypeGeneric, backend->obj_clicert, CKA_VALUE,
+ if(PK11_ReadRawAttribute(PK11_TypeGeneric, backend->obj_clicert, CKA_VALUE,
&cert_der) != SECSuccess) {
failf(data, "NSS: CKA_VALUE not found in PK11 generic object");
PK11_FreeSlot(slot);
@@ -1501,12 +1501,12 @@ static void Curl_nss_cleanup(void)
static int Curl_nss_check_cxn(struct connectdata *conn)
{
struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
int rc;
char buf;
rc =
- PR_Recv(backend->handle, (void *)&buf, 1, PR_MSG_PEEK,
+ PR_Recv(backend->handle, (void *)&buf, 1, PR_MSG_PEEK,
PR_SecondsToInterval(1));
if(rc > 0)
return 1; /* connection still in place */
@@ -1520,27 +1520,27 @@ static int Curl_nss_check_cxn(struct connectdata *conn)
static void nss_close(struct ssl_connect_data *connssl)
{
/* before the cleanup, check whether we are using a client certificate */
- struct ssl_backend_data *backend = connssl->backend;
- const bool client_cert = (backend->client_nickname != NULL)
- || (backend->obj_clicert != NULL);
+ struct ssl_backend_data *backend = connssl->backend;
+ const bool client_cert = (backend->client_nickname != NULL)
+ || (backend->obj_clicert != NULL);
- free(backend->client_nickname);
- backend->client_nickname = NULL;
+ free(backend->client_nickname);
+ backend->client_nickname = NULL;
/* destroy all NSS objects in order to avoid failure of NSS shutdown */
- Curl_llist_destroy(&backend->obj_list, NULL);
- backend->obj_clicert = NULL;
+ Curl_llist_destroy(&backend->obj_list, NULL);
+ backend->obj_clicert = NULL;
- if(backend->handle) {
+ if(backend->handle) {
if(client_cert)
/* A server might require different authentication based on the
* particular path being requested by the client. To support this
* scenario, we must ensure that a connection will never reuse the
* authentication data from a previous connection. */
- SSL_InvalidateSession(backend->handle);
+ SSL_InvalidateSession(backend->handle);
- PR_Close(backend->handle);
- backend->handle = NULL;
+ PR_Close(backend->handle);
+ backend->handle = NULL;
}
}
@@ -1550,31 +1550,31 @@ static void nss_close(struct ssl_connect_data *connssl)
static void Curl_nss_close(struct connectdata *conn, int sockindex)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
struct ssl_connect_data *connssl_proxy = &conn->proxy_ssl[sockindex];
-#endif
- struct ssl_backend_data *backend = connssl->backend;
-
- if(backend->handle
-#ifndef CURL_DISABLE_PROXY
- || connssl_proxy->backend->handle
-#endif
- ) {
+#endif
+ struct ssl_backend_data *backend = connssl->backend;
+
+ if(backend->handle
+#ifndef CURL_DISABLE_PROXY
+ || connssl_proxy->backend->handle
+#endif
+ ) {
/* NSS closes the socket we previously handed to it, so we must mark it
as closed to avoid double close */
fake_sclose(conn->sock[sockindex]);
conn->sock[sockindex] = CURL_SOCKET_BAD;
}
-#ifndef CURL_DISABLE_PROXY
- if(backend->handle)
+#ifndef CURL_DISABLE_PROXY
+ if(backend->handle)
/* nss_close(connssl) will transitively close also
connssl_proxy->backend->handle if both are used. Clear it to avoid
a double close leading to crash. */
connssl_proxy->backend->handle = NULL;
- nss_close(connssl_proxy);
-#endif
+ nss_close(connssl_proxy);
+#endif
nss_close(connssl);
}
@@ -1626,8 +1626,8 @@ static CURLcode nss_load_ca_certificates(struct connectdata *conn,
if(capath && !capath[0])
capath = NULL;
- infof(data, " CAfile: %s\n", cafile ? cafile : "none");
- infof(data, " CApath: %s\n", capath ? capath : "none");
+ infof(data, " CAfile: %s\n", cafile ? cafile : "none");
+ infof(data, " CApath: %s\n", capath ? capath : "none");
/* load libnssckbi.so if no other trust roots were specified */
use_trust_module = !cafile && !capath;
@@ -1667,8 +1667,8 @@ static CURLcode nss_load_ca_certificates(struct connectdata *conn,
if(!dir)
return CURLE_SSL_CACERT_BADFILE;
- while((entry =
- PR_ReadDir(dir, (PRDirFlags)(PR_SKIP_BOTH | PR_SKIP_HIDDEN)))) {
+ while((entry =
+ PR_ReadDir(dir, (PRDirFlags)(PR_SKIP_BOTH | PR_SKIP_HIDDEN)))) {
char *fullpath = aprintf("%s/%s", capath, entry->name);
if(!fullpath) {
PR_CloseDir(dir);
@@ -1782,7 +1782,7 @@ static CURLcode nss_fail_connect(struct ssl_connect_data *connssl,
CURLcode curlerr)
{
PRErrorCode err = 0;
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
if(is_nss_error(curlerr)) {
/* read NSPR error code */
@@ -1798,7 +1798,7 @@ static CURLcode nss_fail_connect(struct ssl_connect_data *connssl,
}
/* cleanup on connection failure */
- Curl_llist_destroy(&backend->obj_list, NULL);
+ Curl_llist_destroy(&backend->obj_list, NULL);
return curlerr;
}
@@ -1809,11 +1809,11 @@ static CURLcode nss_set_blocking(struct ssl_connect_data *connssl,
bool blocking)
{
static PRSocketOptionData sock_opt;
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
sock_opt.option = PR_SockOpt_Nonblocking;
sock_opt.value.non_blocking = !blocking;
- if(PR_SetSocketOption(backend->handle, &sock_opt) != PR_SUCCESS)
+ if(PR_SetSocketOption(backend->handle, &sock_opt) != PR_SUCCESS)
return nss_fail_connect(connssl, data, CURLE_SSL_CONNECT_ERROR);
return CURLE_OK;
@@ -1829,7 +1829,7 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
struct Curl_easy *data = conn->data;
curl_socket_t sockfd = conn->sock[sockindex];
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
CURLcode result;
bool second_layer = FALSE;
SSLVersionRange sslver_supported;
@@ -1847,10 +1847,10 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
#endif
};
- backend->data = data;
+ backend->data = data;
/* list of all NSS objects we need to destroy in Curl_nss_close() */
- Curl_llist_init(&backend->obj_list, nss_destroy_object);
+ Curl_llist_init(&backend->obj_list, nss_destroy_object);
PR_Lock(nss_initlock);
result = nss_init(conn->data);
@@ -1937,7 +1937,7 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
goto error;
/* not checked yet */
- SSL_SET_OPTION_LVALUE(certverifyresult) = 0;
+ SSL_SET_OPTION_LVALUE(certverifyresult) = 0;
if(SSL_BadCertHook(model, BadCertHandler, conn) != SECSuccess)
goto error;
@@ -1965,15 +1965,15 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
infof(data, " CRLfile: %s\n", SSL_SET_OPTION(CRLfile));
}
- if(SSL_SET_OPTION(primary.clientcert)) {
- char *nickname = dup_nickname(data, SSL_SET_OPTION(primary.clientcert));
+ if(SSL_SET_OPTION(primary.clientcert)) {
+ char *nickname = dup_nickname(data, SSL_SET_OPTION(primary.clientcert));
if(nickname) {
/* we are not going to use libnsspem.so to read the client cert */
- backend->obj_clicert = NULL;
+ backend->obj_clicert = NULL;
}
else {
- CURLcode rv = cert_stuff(conn, sockindex,
- SSL_SET_OPTION(primary.clientcert),
+ CURLcode rv = cert_stuff(conn, sockindex,
+ SSL_SET_OPTION(primary.clientcert),
SSL_SET_OPTION(key));
if(rv) {
/* failf() is already done in cert_stuff() */
@@ -1983,10 +1983,10 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
}
/* store the nickname for SelectClientCert() called during handshake */
- backend->client_nickname = nickname;
+ backend->client_nickname = nickname;
}
else
- backend->client_nickname = NULL;
+ backend->client_nickname = NULL;
if(SSL_GetClientAuthDataHook(model, SelectClientCert,
(void *)connssl) != SECSuccess) {
@@ -1994,14 +1994,14 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
goto error;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->proxy_ssl[sockindex].use) {
DEBUGASSERT(ssl_connection_complete == conn->proxy_ssl[sockindex].state);
DEBUGASSERT(conn->proxy_ssl[sockindex].backend->handle != NULL);
nspr_io = conn->proxy_ssl[sockindex].backend->handle;
second_layer = TRUE;
}
-#endif
+#endif
else {
/* wrap OS file descriptor by NSPR's file descriptor abstraction */
nspr_io = PR_ImportTCPSocket(sockfd);
@@ -2029,8 +2029,8 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
}
/* import our model socket onto the current I/O stack */
- backend->handle = SSL_ImportFD(model, nspr_io);
- if(!backend->handle) {
+ backend->handle = SSL_ImportFD(model, nspr_io);
+ if(!backend->handle) {
if(!second_layer)
PR_Close(nspr_io);
goto error;
@@ -2041,36 +2041,36 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
/* This is the password associated with the cert that we're using */
if(SSL_SET_OPTION(key_passwd)) {
- SSL_SetPKCS11PinArg(backend->handle, SSL_SET_OPTION(key_passwd));
+ SSL_SetPKCS11PinArg(backend->handle, SSL_SET_OPTION(key_passwd));
}
#ifdef SSL_ENABLE_OCSP_STAPLING
if(SSL_CONN_CONFIG(verifystatus)) {
- if(SSL_OptionSet(backend->handle, SSL_ENABLE_OCSP_STAPLING, PR_TRUE)
+ if(SSL_OptionSet(backend->handle, SSL_ENABLE_OCSP_STAPLING, PR_TRUE)
!= SECSuccess)
goto error;
}
#endif
#ifdef SSL_ENABLE_NPN
- if(SSL_OptionSet(backend->handle, SSL_ENABLE_NPN, conn->bits.tls_enable_npn
+ if(SSL_OptionSet(backend->handle, SSL_ENABLE_NPN, conn->bits.tls_enable_npn
? PR_TRUE : PR_FALSE) != SECSuccess)
goto error;
#endif
#ifdef SSL_ENABLE_ALPN
- if(SSL_OptionSet(backend->handle, SSL_ENABLE_ALPN, conn->bits.tls_enable_alpn
+ if(SSL_OptionSet(backend->handle, SSL_ENABLE_ALPN, conn->bits.tls_enable_alpn
? PR_TRUE : PR_FALSE) != SECSuccess)
goto error;
#endif
#if NSSVERNUM >= 0x030f04 /* 3.15.4 */
if(data->set.ssl.falsestart) {
- if(SSL_OptionSet(backend->handle, SSL_ENABLE_FALSE_START, PR_TRUE)
+ if(SSL_OptionSet(backend->handle, SSL_ENABLE_FALSE_START, PR_TRUE)
!= SECSuccess)
goto error;
- if(SSL_SetCanFalseStartCallback(backend->handle, CanFalseStartCallback,
+ if(SSL_SetCanFalseStartCallback(backend->handle, CanFalseStartCallback,
conn) != SECSuccess)
goto error;
}
@@ -2082,11 +2082,11 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
unsigned char protocols[128];
#ifdef USE_NGHTTP2
- if(data->set.httpversion >= CURL_HTTP_VERSION_2
-#ifndef CURL_DISABLE_PROXY
- && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
-#endif
- ) {
+ if(data->set.httpversion >= CURL_HTTP_VERSION_2
+#ifndef CURL_DISABLE_PROXY
+ && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
+#endif
+ ) {
protocols[cur++] = NGHTTP2_PROTO_VERSION_ID_LEN;
memcpy(&protocols[cur], NGHTTP2_PROTO_VERSION_ID,
NGHTTP2_PROTO_VERSION_ID_LEN);
@@ -2097,23 +2097,23 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
memcpy(&protocols[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH);
cur += ALPN_HTTP_1_1_LENGTH;
- if(SSL_SetNextProtoNego(backend->handle, protocols, cur) != SECSuccess)
+ if(SSL_SetNextProtoNego(backend->handle, protocols, cur) != SECSuccess)
goto error;
}
#endif
/* Force handshake on next I/O */
- if(SSL_ResetHandshake(backend->handle, /* asServer */ PR_FALSE)
+ if(SSL_ResetHandshake(backend->handle, /* asServer */ PR_FALSE)
!= SECSuccess)
goto error;
/* propagate hostname to the TLS layer */
- if(SSL_SetURL(backend->handle, SSL_HOST_NAME()) != SECSuccess)
+ if(SSL_SetURL(backend->handle, SSL_HOST_NAME()) != SECSuccess)
goto error;
/* prevent NSS from re-using the session for a different hostname */
- if(SSL_SetSockPeerID(backend->handle, SSL_HOST_NAME()) != SECSuccess)
+ if(SSL_SetSockPeerID(backend->handle, SSL_HOST_NAME()) != SECSuccess)
goto error;
return CURLE_OK;
@@ -2128,13 +2128,13 @@ error:
static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
struct Curl_easy *data = conn->data;
CURLcode result = CURLE_SSL_CONNECT_ERROR;
PRUint32 timeout;
/* check timeout situation */
- const timediff_t time_left = Curl_timeleft(data, NULL, TRUE);
+ const timediff_t time_left = Curl_timeleft(data, NULL, TRUE);
if(time_left < 0) {
failf(data, "timed out before SSL handshake");
result = CURLE_OPERATION_TIMEDOUT;
@@ -2143,18 +2143,18 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
/* Force the handshake now */
timeout = PR_MillisecondsToInterval((PRUint32) time_left);
- if(SSL_ForceHandshakeWithTimeout(backend->handle, timeout) != SECSuccess) {
+ if(SSL_ForceHandshakeWithTimeout(backend->handle, timeout) != SECSuccess) {
if(PR_GetError() == PR_WOULD_BLOCK_ERROR)
/* blocking direction is updated by nss_update_connecting_state() */
return CURLE_AGAIN;
- else if(SSL_SET_OPTION(certverifyresult) == SSL_ERROR_BAD_CERT_DOMAIN)
+ else if(SSL_SET_OPTION(certverifyresult) == SSL_ERROR_BAD_CERT_DOMAIN)
result = CURLE_PEER_FAILED_VERIFICATION;
- else if(SSL_SET_OPTION(certverifyresult) != 0)
+ else if(SSL_SET_OPTION(certverifyresult) != 0)
result = CURLE_PEER_FAILED_VERIFICATION;
goto error;
}
- result = display_conn_info(conn, backend->handle);
+ result = display_conn_info(conn, backend->handle);
if(result)
goto error;
@@ -2163,7 +2163,7 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
char *nickname = dup_nickname(data, SSL_SET_OPTION(issuercert));
if(nickname) {
/* we support only nicknames in case of issuercert for now */
- ret = check_issuer_cert(backend->handle, nickname);
+ ret = check_issuer_cert(backend->handle, nickname);
free(nickname);
}
@@ -2177,7 +2177,7 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
}
}
- result = cmp_peer_pubkey(connssl, SSL_PINNED_PUB_KEY());
+ result = cmp_peer_pubkey(connssl, SSL_PINNED_PUB_KEY());
if(result)
/* status already printed */
goto error;
@@ -2267,14 +2267,14 @@ static ssize_t nss_send(struct connectdata *conn, /* connection data */
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
ssize_t rc;
/* The SelectClientCert() hook uses this for infof() and failf() but the
handle stored in nss_setup_connect() could have already been freed. */
- backend->data = conn->data;
+ backend->data = conn->data;
- rc = PR_Send(backend->handle, mem, (int)len, 0, PR_INTERVAL_NO_WAIT);
+ rc = PR_Send(backend->handle, mem, (int)len, 0, PR_INTERVAL_NO_WAIT);
if(rc < 0) {
PRInt32 err = PR_GetError();
if(err == PR_WOULD_BLOCK_ERROR)
@@ -2305,14 +2305,14 @@ static ssize_t nss_recv(struct connectdata *conn, /* connection data */
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
ssize_t nread;
/* The SelectClientCert() hook uses this for infof() and failf() but the
handle stored in nss_setup_connect() could have already been freed. */
- backend->data = conn->data;
+ backend->data = conn->data;
- nread = PR_Recv(backend->handle, buf, (int)buffersize, 0,
+ nread = PR_Recv(backend->handle, buf, (int)buffersize, 0,
PR_INTERVAL_NO_WAIT);
if(nread < 0) {
/* failed SSL read */
@@ -2373,9 +2373,9 @@ static CURLcode Curl_nss_md5sum(unsigned char *tmp, /* input */
PK11Context *MD5pw = PK11_CreateDigestContext(SEC_OID_MD5);
unsigned int MD5out;
- if(!MD5pw)
- return CURLE_NOT_BUILT_IN;
-
+ if(!MD5pw)
+ return CURLE_NOT_BUILT_IN;
+
PK11_DigestOp(MD5pw, tmp, curlx_uztoui(tmplen));
PK11_DigestFinal(MD5pw, md5sum, &MD5out, curlx_uztoui(md5len));
PK11_DestroyContext(MD5pw, PR_TRUE);
@@ -2391,9 +2391,9 @@ static CURLcode Curl_nss_sha256sum(const unsigned char *tmp, /* input */
PK11Context *SHA256pw = PK11_CreateDigestContext(SEC_OID_SHA256);
unsigned int SHA256out;
- if(!SHA256pw)
- return CURLE_NOT_BUILT_IN;
-
+ if(!SHA256pw)
+ return CURLE_NOT_BUILT_IN;
+
PK11_DigestOp(SHA256pw, tmp, curlx_uztoui(tmplen));
PK11_DigestFinal(SHA256pw, sha256sum, &SHA256out, curlx_uztoui(sha256len));
PK11_DestroyContext(SHA256pw, PR_TRUE);
@@ -2422,9 +2422,9 @@ static bool Curl_nss_false_start(void)
static void *Curl_nss_get_internals(struct ssl_connect_data *connssl,
CURLINFO info UNUSED_PARAM)
{
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
(void)info;
- return backend->handle;
+ return backend->handle;
}
const struct Curl_ssl Curl_ssl_nss = {
diff --git a/contrib/libs/curl/lib/vtls/nssg.h b/contrib/libs/curl/lib/vtls/nssg.h
index 63a607bec0..37b364647b 100644
--- a/contrib/libs/curl/lib/vtls/nssg.h
+++ b/contrib/libs/curl/lib/vtls/nssg.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vtls/openssl.c b/contrib/libs/curl/lib/vtls/openssl.c
index 3dd9d62ca5..e9c535f8f4 100644
--- a/contrib/libs/curl/lib/vtls/openssl.c
+++ b/contrib/libs/curl/lib/vtls/openssl.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -31,18 +31,18 @@
#include <limits.h>
-/* Wincrypt must be included before anything that could include OpenSSL. */
-#if defined(USE_WIN32_CRYPTO)
-#include <wincrypt.h>
-/* Undefine wincrypt conflicting symbols for BoringSSL. */
-#undef X509_NAME
-#undef X509_EXTENSIONS
-#undef PKCS7_ISSUER_AND_SERIAL
-#undef PKCS7_SIGNER_INFO
-#undef OCSP_REQUEST
-#undef OCSP_RESPONSE
-#endif
-
+/* Wincrypt must be included before anything that could include OpenSSL. */
+#if defined(USE_WIN32_CRYPTO)
+#include <wincrypt.h>
+/* Undefine wincrypt conflicting symbols for BoringSSL. */
+#undef X509_NAME
+#undef X509_EXTENSIONS
+#undef PKCS7_ISSUER_AND_SERIAL
+#undef PKCS7_SIGNER_INFO
+#undef OCSP_REQUEST
+#undef OCSP_RESPONSE
+#endif
+
#include "urldata.h"
#include "sendf.h"
#include "formdata.h" /* for the boundary function */
@@ -53,13 +53,13 @@
#include "slist.h"
#include "select.h"
#include "vtls.h"
-#include "keylog.h"
+#include "keylog.h"
#include "strcase.h"
#include "hostcheck.h"
#include "multiif.h"
-#include "strerror.h"
+#include "strerror.h"
#include "curl_printf.h"
-
+
#include <openssl/ssl.h>
#include <openssl/rand.h>
#include <openssl/x509v3.h>
@@ -200,10 +200,10 @@
!defined(OPENSSL_IS_BORINGSSL))
#define HAVE_SSL_CTX_SET_CIPHERSUITES
#define HAVE_SSL_CTX_SET_POST_HANDSHAKE_AUTH
-/* SET_EC_CURVES available under the same preconditions: see
- * https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set1_groups.html
- */
-#define HAVE_SSL_CTX_SET_EC_CURVES
+/* SET_EC_CURVES available under the same preconditions: see
+ * https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set1_groups.html
+ */
+#define HAVE_SSL_CTX_SET_EC_CURVES
#endif
#if defined(LIBRESSL_VERSION_NUMBER)
@@ -225,22 +225,22 @@
"ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH"
#endif
-#ifdef HAVE_OPENSSL_SRP
-/* the function exists */
-#ifdef USE_TLS_SRP
-/* the functionality is not disabled */
-#define USE_OPENSSL_SRP
-#endif
-#endif
+#ifdef HAVE_OPENSSL_SRP
+/* the function exists */
+#ifdef USE_TLS_SRP
+/* the functionality is not disabled */
+#define USE_OPENSSL_SRP
+#endif
+#endif
struct ssl_backend_data {
/* these ones requires specific SSL-types */
SSL_CTX* ctx;
SSL* handle;
X509* server_cert;
-#ifndef HAVE_KEYLOG_CALLBACK
- /* Set to true once a valid keylog entry has been created to avoid dupes. */
- bool keylog_done;
+#ifndef HAVE_KEYLOG_CALLBACK
+ /* Set to true once a valid keylog entry has been created to avoid dupes. */
+ bool keylog_done;
#endif
};
@@ -257,22 +257,22 @@ static void ossl_keylog_callback(const SSL *ssl, const char *line)
{
(void)ssl;
- Curl_tls_keylog_write_line(line);
+ Curl_tls_keylog_write_line(line);
}
#else
/*
- * ossl_log_tls12_secret is called by libcurl to make the CLIENT_RANDOMs if the
- * OpenSSL being used doesn't have native support for doing that.
+ * ossl_log_tls12_secret is called by libcurl to make the CLIENT_RANDOMs if the
+ * OpenSSL being used doesn't have native support for doing that.
*/
-static void
-ossl_log_tls12_secret(const SSL *ssl, bool *keylog_done)
+static void
+ossl_log_tls12_secret(const SSL *ssl, bool *keylog_done)
{
const SSL_SESSION *session = SSL_get_session(ssl);
unsigned char client_random[SSL3_RANDOM_SIZE];
unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
int master_key_length = 0;
- if(!session || *keylog_done)
+ if(!session || *keylog_done)
return;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \
@@ -291,15 +291,15 @@ ossl_log_tls12_secret(const SSL *ssl, bool *keylog_done)
}
#endif
- /* The handshake has not progressed sufficiently yet, or this is a TLS 1.3
- * session (when curl was built with older OpenSSL headers and running with
- * newer OpenSSL runtime libraries). */
+ /* The handshake has not progressed sufficiently yet, or this is a TLS 1.3
+ * session (when curl was built with older OpenSSL headers and running with
+ * newer OpenSSL runtime libraries). */
if(master_key_length <= 0)
return;
- *keylog_done = true;
- Curl_tls_keylog_write("CLIENT_RANDOM", client_random,
- master_key, master_key_length);
+ *keylog_done = true;
+ Curl_tls_keylog_write("CLIENT_RANDOM", client_random,
+ master_key, master_key_length);
}
#endif /* !HAVE_KEYLOG_CALLBACK */
@@ -345,20 +345,20 @@ static const char *SSL_ERROR_to_str(int err)
*/
static char *ossl_strerror(unsigned long error, char *buf, size_t size)
{
- if(size)
- *buf = '\0';
-
+ if(size)
+ *buf = '\0';
+
#ifdef OPENSSL_IS_BORINGSSL
ERR_error_string_n((uint32_t)error, buf, size);
#else
ERR_error_string_n(error, buf, size);
#endif
-
- if(size > 1 && !*buf) {
- strncpy(buf, (error ? "Unknown error" : "No error"), size);
- buf[size - 1] = '\0';
- }
-
+
+ if(size > 1 && !*buf) {
+ strncpy(buf, (error ? "Unknown error" : "No error"), size);
+ buf[size - 1] = '\0';
+ }
+
return buf;
}
@@ -575,138 +575,138 @@ static bool is_pkcs11_uri(const char *string)
static CURLcode Curl_ossl_set_engine(struct Curl_easy *data,
const char *engine);
-static int
-SSL_CTX_use_certificate_bio(SSL_CTX *ctx, BIO *in, int type,
- const char *key_passwd)
-{
- int ret = 0;
- X509 *x = NULL;
-
- if(type == SSL_FILETYPE_ASN1) {
- /* j = ERR_R_ASN1_LIB; */
- x = d2i_X509_bio(in, NULL);
- }
- else if(type == SSL_FILETYPE_PEM) {
- /* ERR_R_PEM_LIB; */
- x = PEM_read_bio_X509(in, NULL,
- passwd_callback, (void *)key_passwd);
- }
- else {
- ret = 0;
- goto end;
- }
-
- if(x == NULL) {
- ret = 0;
- goto end;
- }
-
- ret = SSL_CTX_use_certificate(ctx, x);
- end:
- X509_free(x);
- return ret;
-}
-
-static int
-SSL_CTX_use_PrivateKey_bio(SSL_CTX *ctx, BIO* in, int type,
- const char *key_passwd)
-{
- int ret = 0;
- EVP_PKEY *pkey = NULL;
-
- if(type == SSL_FILETYPE_PEM)
- pkey = PEM_read_bio_PrivateKey(in, NULL, passwd_callback,
- (void *)key_passwd);
- else if(type == SSL_FILETYPE_ASN1)
- pkey = d2i_PrivateKey_bio(in, NULL);
- else {
- ret = 0;
- goto end;
- }
- if(pkey == NULL) {
- ret = 0;
- goto end;
- }
- ret = SSL_CTX_use_PrivateKey(ctx, pkey);
- EVP_PKEY_free(pkey);
- end:
- return ret;
-}
-
-static int
-SSL_CTX_use_certificate_chain_bio(SSL_CTX *ctx, BIO* in,
- const char *key_passwd)
-{
-/* SSL_CTX_add1_chain_cert introduced in OpenSSL 1.0.2 */
-#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* OpenSSL 1.0.2 or later */ \
- !(defined(LIBRESSL_VERSION_NUMBER) && \
- (LIBRESSL_VERSION_NUMBER < 0x2090100fL)) /* LibreSSL 2.9.1 or later */
- int ret = 0;
- X509 *x = NULL;
- void *passwd_callback_userdata = (void *)key_passwd;
-
- ERR_clear_error();
-
- x = PEM_read_bio_X509_AUX(in, NULL,
- passwd_callback, (void *)key_passwd);
-
- if(x == NULL) {
- ret = 0;
- goto end;
- }
-
- ret = SSL_CTX_use_certificate(ctx, x);
-
- if(ERR_peek_error() != 0)
- ret = 0;
-
- if(ret) {
- X509 *ca;
- unsigned long err;
-
- if(!SSL_CTX_clear_chain_certs(ctx)) {
- ret = 0;
- goto end;
- }
-
- while((ca = PEM_read_bio_X509(in, NULL, passwd_callback,
- passwd_callback_userdata))
- != NULL) {
-
- if(!SSL_CTX_add0_chain_cert(ctx, ca)) {
- X509_free(ca);
- ret = 0;
- goto end;
- }
- }
-
- err = ERR_peek_last_error();
- if((ERR_GET_LIB(err) == ERR_LIB_PEM) &&
- (ERR_GET_REASON(err) == PEM_R_NO_START_LINE))
- ERR_clear_error();
- else
- ret = 0;
- }
-
- end:
- X509_free(x);
- return ret;
-#else
- (void)ctx; /* unused */
- (void)in; /* unused */
- (void)key_passwd; /* unused */
- return 0;
-#endif
-}
-
+static int
+SSL_CTX_use_certificate_bio(SSL_CTX *ctx, BIO *in, int type,
+ const char *key_passwd)
+{
+ int ret = 0;
+ X509 *x = NULL;
+
+ if(type == SSL_FILETYPE_ASN1) {
+ /* j = ERR_R_ASN1_LIB; */
+ x = d2i_X509_bio(in, NULL);
+ }
+ else if(type == SSL_FILETYPE_PEM) {
+ /* ERR_R_PEM_LIB; */
+ x = PEM_read_bio_X509(in, NULL,
+ passwd_callback, (void *)key_passwd);
+ }
+ else {
+ ret = 0;
+ goto end;
+ }
+
+ if(x == NULL) {
+ ret = 0;
+ goto end;
+ }
+
+ ret = SSL_CTX_use_certificate(ctx, x);
+ end:
+ X509_free(x);
+ return ret;
+}
+
+static int
+SSL_CTX_use_PrivateKey_bio(SSL_CTX *ctx, BIO* in, int type,
+ const char *key_passwd)
+{
+ int ret = 0;
+ EVP_PKEY *pkey = NULL;
+
+ if(type == SSL_FILETYPE_PEM)
+ pkey = PEM_read_bio_PrivateKey(in, NULL, passwd_callback,
+ (void *)key_passwd);
+ else if(type == SSL_FILETYPE_ASN1)
+ pkey = d2i_PrivateKey_bio(in, NULL);
+ else {
+ ret = 0;
+ goto end;
+ }
+ if(pkey == NULL) {
+ ret = 0;
+ goto end;
+ }
+ ret = SSL_CTX_use_PrivateKey(ctx, pkey);
+ EVP_PKEY_free(pkey);
+ end:
+ return ret;
+}
+
+static int
+SSL_CTX_use_certificate_chain_bio(SSL_CTX *ctx, BIO* in,
+ const char *key_passwd)
+{
+/* SSL_CTX_add1_chain_cert introduced in OpenSSL 1.0.2 */
+#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* OpenSSL 1.0.2 or later */ \
+ !(defined(LIBRESSL_VERSION_NUMBER) && \
+ (LIBRESSL_VERSION_NUMBER < 0x2090100fL)) /* LibreSSL 2.9.1 or later */
+ int ret = 0;
+ X509 *x = NULL;
+ void *passwd_callback_userdata = (void *)key_passwd;
+
+ ERR_clear_error();
+
+ x = PEM_read_bio_X509_AUX(in, NULL,
+ passwd_callback, (void *)key_passwd);
+
+ if(x == NULL) {
+ ret = 0;
+ goto end;
+ }
+
+ ret = SSL_CTX_use_certificate(ctx, x);
+
+ if(ERR_peek_error() != 0)
+ ret = 0;
+
+ if(ret) {
+ X509 *ca;
+ unsigned long err;
+
+ if(!SSL_CTX_clear_chain_certs(ctx)) {
+ ret = 0;
+ goto end;
+ }
+
+ while((ca = PEM_read_bio_X509(in, NULL, passwd_callback,
+ passwd_callback_userdata))
+ != NULL) {
+
+ if(!SSL_CTX_add0_chain_cert(ctx, ca)) {
+ X509_free(ca);
+ ret = 0;
+ goto end;
+ }
+ }
+
+ err = ERR_peek_last_error();
+ if((ERR_GET_LIB(err) == ERR_LIB_PEM) &&
+ (ERR_GET_REASON(err) == PEM_R_NO_START_LINE))
+ ERR_clear_error();
+ else
+ ret = 0;
+ }
+
+ end:
+ X509_free(x);
+ return ret;
+#else
+ (void)ctx; /* unused */
+ (void)in; /* unused */
+ (void)key_passwd; /* unused */
+ return 0;
+#endif
+}
+
static
int cert_stuff(struct connectdata *conn,
SSL_CTX* ctx,
char *cert_file,
- BIO *cert_bio,
+ BIO *cert_bio,
const char *cert_type,
char *key_file,
- BIO* key_bio,
+ BIO* key_bio,
const char *key_type,
char *key_passwd)
{
@@ -716,11 +716,11 @@ int cert_stuff(struct connectdata *conn,
int file_type = do_file_type(cert_type);
- if(cert_file || cert_bio || (file_type == SSL_FILETYPE_ENGINE)) {
+ if(cert_file || cert_bio || (file_type == SSL_FILETYPE_ENGINE)) {
SSL *ssl;
X509 *x509;
int cert_done = 0;
- int cert_use_result;
+ int cert_use_result;
if(key_passwd) {
/* set the password in the callback userdata */
@@ -733,10 +733,10 @@ int cert_stuff(struct connectdata *conn,
switch(file_type) {
case SSL_FILETYPE_PEM:
/* SSL_CTX_use_certificate_chain_file() only works on PEM files */
- cert_use_result = cert_bio ?
- SSL_CTX_use_certificate_chain_bio(ctx, cert_bio, key_passwd) :
- SSL_CTX_use_certificate_chain_file(ctx, cert_file);
- if(cert_use_result != 1) {
+ cert_use_result = cert_bio ?
+ SSL_CTX_use_certificate_chain_bio(ctx, cert_bio, key_passwd) :
+ SSL_CTX_use_certificate_chain_file(ctx, cert_file);
+ if(cert_use_result != 1) {
failf(data,
"could not load PEM client certificate, " OSSL_PACKAGE
" error %s, "
@@ -751,12 +751,12 @@ int cert_stuff(struct connectdata *conn,
/* SSL_CTX_use_certificate_file() works with either PEM or ASN1, but
we use the case above for PEM so this can only be performed with
ASN1 files. */
-
- cert_use_result = cert_bio ?
- SSL_CTX_use_certificate_bio(ctx, cert_bio,
- file_type, key_passwd) :
- SSL_CTX_use_certificate_file(ctx, cert_file, file_type);
- if(cert_use_result != 1) {
+
+ cert_use_result = cert_bio ?
+ SSL_CTX_use_certificate_bio(ctx, cert_bio,
+ file_type, key_passwd) :
+ SSL_CTX_use_certificate_file(ctx, cert_file, file_type);
+ if(cert_use_result != 1) {
failf(data,
"could not load ASN1 client certificate, " OSSL_PACKAGE
" error %s, "
@@ -836,31 +836,31 @@ int cert_stuff(struct connectdata *conn,
PKCS12 *p12 = NULL;
EVP_PKEY *pri;
STACK_OF(X509) *ca = NULL;
- if(!cert_bio) {
- fp = BIO_new(BIO_s_file());
- if(fp == NULL) {
- failf(data,
- "BIO_new return NULL, " OSSL_PACKAGE
- " error %s",
- ossl_strerror(ERR_get_error(), error_buffer,
- sizeof(error_buffer)) );
- return 0;
- }
-
- if(BIO_read_filename(fp, cert_file) <= 0) {
- failf(data, "could not open PKCS12 file '%s'", cert_file);
- BIO_free(fp);
- return 0;
- }
+ if(!cert_bio) {
+ fp = BIO_new(BIO_s_file());
+ if(fp == NULL) {
+ failf(data,
+ "BIO_new return NULL, " OSSL_PACKAGE
+ " error %s",
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)) );
+ return 0;
+ }
+
+ if(BIO_read_filename(fp, cert_file) <= 0) {
+ failf(data, "could not open PKCS12 file '%s'", cert_file);
+ BIO_free(fp);
+ return 0;
+ }
}
- p12 = d2i_PKCS12_bio(cert_bio ? cert_bio : fp, NULL);
- if(fp)
+ p12 = d2i_PKCS12_bio(cert_bio ? cert_bio : fp, NULL);
+ if(fp)
BIO_free(fp);
if(!p12) {
- failf(data, "error reading PKCS12 file '%s'",
- cert_bio ? "(memory blob)" : cert_file);
+ failf(data, "error reading PKCS12 file '%s'",
+ cert_bio ? "(memory blob)" : cert_file);
return 0;
}
@@ -941,10 +941,10 @@ int cert_stuff(struct connectdata *conn,
return 0;
}
- if((!key_file) && (!key_bio)) {
+ if((!key_file) && (!key_bio)) {
key_file = cert_file;
- key_bio = cert_bio;
- }
+ key_bio = cert_bio;
+ }
else
file_type = do_file_type(key_type);
@@ -954,12 +954,12 @@ int cert_stuff(struct connectdata *conn,
break;
/* FALLTHROUGH */
case SSL_FILETYPE_ASN1:
- cert_use_result = key_bio ?
- SSL_CTX_use_PrivateKey_bio(ctx, key_bio, file_type, key_passwd) :
- SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type);
- if(cert_use_result != 1) {
+ cert_use_result = key_bio ?
+ SSL_CTX_use_PrivateKey_bio(ctx, key_bio, file_type, key_passwd) :
+ SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type);
+ if(cert_use_result != 1) {
failf(data, "unable to set private key file: '%s' type %s",
- key_file?key_file:"(memory blob)", key_type?key_type:"PEM");
+ key_file?key_file:"(memory blob)", key_type?key_type:"PEM");
return 0;
}
break;
@@ -1115,21 +1115,21 @@ static int x509_name_oneline(X509_NAME *a, char *buf, size_t size)
*/
static int Curl_ossl_init(void)
{
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
- !defined(LIBRESSL_VERSION_NUMBER)
- const uint64_t flags =
-#ifdef OPENSSL_INIT_ENGINE_ALL_BUILTIN
- /* not present in BoringSSL */
- OPENSSL_INIT_ENGINE_ALL_BUILTIN |
-#endif
-#ifdef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
- OPENSSL_INIT_NO_LOAD_CONFIG |
-#else
- OPENSSL_INIT_LOAD_CONFIG |
-#endif
- 0;
- OPENSSL_init_ssl(flags, NULL);
-#else
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
+ !defined(LIBRESSL_VERSION_NUMBER)
+ const uint64_t flags =
+#ifdef OPENSSL_INIT_ENGINE_ALL_BUILTIN
+ /* not present in BoringSSL */
+ OPENSSL_INIT_ENGINE_ALL_BUILTIN |
+#endif
+#ifdef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
+ OPENSSL_INIT_NO_LOAD_CONFIG |
+#else
+ OPENSSL_INIT_LOAD_CONFIG |
+#endif
+ 0;
+ OPENSSL_init_ssl(flags, NULL);
+#else
OPENSSL_load_builtin_modules();
#ifdef USE_OPENSSL_ENGINE
@@ -1158,7 +1158,7 @@ static int Curl_ossl_init(void)
OpenSSL_add_all_algorithms();
#endif
- Curl_tls_keylog_open();
+ Curl_tls_keylog_open();
/* Initialize the extra data indexes */
if(ossl_get_ssl_conn_index() < 0 || ossl_get_ssl_sockindex_index() < 0)
@@ -1201,7 +1201,7 @@ static void Curl_ossl_cleanup(void)
#endif
#endif
- Curl_tls_keylog_close();
+ Curl_tls_keylog_close();
}
/*
@@ -1348,17 +1348,17 @@ static struct curl_slist *Curl_ossl_engines_list(struct Curl_easy *data)
static void ossl_close(struct ssl_connect_data *connssl)
{
- struct ssl_backend_data *backend = connssl->backend;
- if(backend->handle) {
- (void)SSL_shutdown(backend->handle);
- SSL_set_connect_state(backend->handle);
+ struct ssl_backend_data *backend = connssl->backend;
+ if(backend->handle) {
+ (void)SSL_shutdown(backend->handle);
+ SSL_set_connect_state(backend->handle);
- SSL_free(backend->handle);
- backend->handle = NULL;
+ SSL_free(backend->handle);
+ backend->handle = NULL;
}
- if(backend->ctx) {
- SSL_CTX_free(backend->ctx);
- backend->ctx = NULL;
+ if(backend->ctx) {
+ SSL_CTX_free(backend->ctx);
+ backend->ctx = NULL;
}
}
@@ -1368,9 +1368,9 @@ static void ossl_close(struct ssl_connect_data *connssl)
static void Curl_ossl_close(struct connectdata *conn, int sockindex)
{
ossl_close(&conn->ssl[sockindex]);
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
ossl_close(&conn->proxy_ssl[sockindex]);
-#endif
+#endif
}
/*
@@ -1389,7 +1389,7 @@ static int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
int buffsize;
int err;
bool done = FALSE;
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
#ifndef CURL_DISABLE_FTP
/* This has only been tested on the proftpd server, and the mod_tls code
@@ -1398,10 +1398,10 @@ static int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
we do not send one. Let's hope other servers do the same... */
if(data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE)
- (void)SSL_shutdown(backend->handle);
+ (void)SSL_shutdown(backend->handle);
#endif
- if(backend->handle) {
+ if(backend->handle) {
buffsize = (int)sizeof(buf);
while(!done) {
int what = SOCKET_READABLE(conn->sock[sockindex],
@@ -1411,8 +1411,8 @@ static int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
/* Something to read, let's do it and hope that it is the close
notify alert from the server */
- nread = (ssize_t)SSL_read(backend->handle, buf, buffsize);
- err = SSL_get_error(backend->handle, (int)nread);
+ nread = (ssize_t)SSL_read(backend->handle, buf, buffsize);
+ err = SSL_get_error(backend->handle, (int)nread);
switch(err) {
case SSL_ERROR_NONE: /* this is not an error */
@@ -1457,7 +1457,7 @@ static int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
if(data->set.verbose) {
#ifdef HAVE_SSL_GET_SHUTDOWN
- switch(SSL_get_shutdown(backend->handle)) {
+ switch(SSL_get_shutdown(backend->handle)) {
case SSL_SENT_SHUTDOWN:
infof(data, "SSL_get_shutdown() returned SSL_SENT_SHUTDOWN\n");
break;
@@ -1472,8 +1472,8 @@ static int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
#endif
}
- SSL_free(backend->handle);
- backend->handle = NULL;
+ SSL_free(backend->handle);
+ backend->handle = NULL;
}
return retval;
}
@@ -1597,8 +1597,8 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert)
CURLcode result = CURLE_OK;
bool dNSName = FALSE; /* if a dNSName field exists in the cert */
bool iPAddress = FALSE; /* if a iPAddress field exists in the cert */
- const char * const hostname = SSL_HOST_NAME();
- const char * const dispname = SSL_HOST_DISPNAME();
+ const char * const hostname = SSL_HOST_NAME();
+ const char * const dispname = SSL_HOST_DISPNAME();
#ifdef ENABLE_IPV6
if(conn->bits.ipv6_ip &&
@@ -1656,7 +1656,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert)
type itself: for example for an IA5String the data will be ASCII"
It has been however verified that in 0.9.6 and 0.9.7, IA5String
- is always null-terminated.
+ is always null-terminated.
*/
if((altlen == strlen(altptr)) &&
/* if this isn't true, there was an embedded zero in the name
@@ -1794,14 +1794,14 @@ static CURLcode verifystatus(struct connectdata *conn,
OCSP_BASICRESP *br = NULL;
X509_STORE *st = NULL;
STACK_OF(X509) *ch = NULL;
- struct ssl_backend_data *backend = connssl->backend;
- X509 *cert;
- OCSP_CERTID *id = NULL;
- int cert_status, crl_reason;
- ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
- int ret;
+ struct ssl_backend_data *backend = connssl->backend;
+ X509 *cert;
+ OCSP_CERTID *id = NULL;
+ int cert_status, crl_reason;
+ ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
+ int ret;
- long len = SSL_get_tlsext_status_ocsp_resp(backend->handle, &status);
+ long len = SSL_get_tlsext_status_ocsp_resp(backend->handle, &status);
if(!status) {
failf(data, "No OCSP response received");
@@ -1831,8 +1831,8 @@ static CURLcode verifystatus(struct connectdata *conn,
goto end;
}
- ch = SSL_get_peer_cert_chain(backend->handle);
- st = SSL_CTX_get_cert_store(backend->ctx);
+ ch = SSL_get_peer_cert_chain(backend->handle);
+ st = SSL_CTX_get_cert_store(backend->ctx);
#if ((OPENSSL_VERSION_NUMBER <= 0x1000201fL) /* Fixed after 1.0.2a */ || \
(defined(LIBRESSL_VERSION_NUMBER) && \
@@ -1868,68 +1868,68 @@ static CURLcode verifystatus(struct connectdata *conn,
goto end;
}
- /* Compute the certificate's ID */
- cert = SSL_get_peer_certificate(backend->handle);
- if(!cert) {
- failf(data, "Error getting peer certficate");
- result = CURLE_SSL_INVALIDCERTSTATUS;
- goto end;
- }
-
- for(i = 0; i < sk_X509_num(ch); i++) {
- X509 *issuer = sk_X509_value(ch, i);
- if(X509_check_issued(issuer, cert) == X509_V_OK) {
- id = OCSP_cert_to_id(EVP_sha1(), cert, issuer);
- break;
- }
- }
- X509_free(cert);
-
- if(!id) {
- failf(data, "Error computing OCSP ID");
- result = CURLE_SSL_INVALIDCERTSTATUS;
- goto end;
- }
-
- /* Find the single OCSP response corresponding to the certificate ID */
- ret = OCSP_resp_find_status(br, id, &cert_status, &crl_reason, &rev,
- &thisupd, &nextupd);
- OCSP_CERTID_free(id);
- if(ret != 1) {
- failf(data, "Could not find certificate ID in OCSP response");
- result = CURLE_SSL_INVALIDCERTSTATUS;
- goto end;
- }
-
- /* Validate the corresponding single OCSP response */
- if(!OCSP_check_validity(thisupd, nextupd, 300L, -1L)) {
- failf(data, "OCSP response has expired");
- result = CURLE_SSL_INVALIDCERTSTATUS;
- goto end;
- }
-
- infof(data, "SSL certificate status: %s (%d)\n",
- OCSP_cert_status_str(cert_status), cert_status);
-
- switch(cert_status) {
- case V_OCSP_CERTSTATUS_GOOD:
- break;
-
- case V_OCSP_CERTSTATUS_REVOKED:
- result = CURLE_SSL_INVALIDCERTSTATUS;
- failf(data, "SSL certificate revocation reason: %s (%d)",
- OCSP_crl_reason_str(crl_reason), crl_reason);
- goto end;
-
- case V_OCSP_CERTSTATUS_UNKNOWN:
- default:
- result = CURLE_SSL_INVALIDCERTSTATUS;
- goto end;
+ /* Compute the certificate's ID */
+ cert = SSL_get_peer_certificate(backend->handle);
+ if(!cert) {
+ failf(data, "Error getting peer certficate");
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+ goto end;
+ }
+
+ for(i = 0; i < sk_X509_num(ch); i++) {
+ X509 *issuer = sk_X509_value(ch, i);
+ if(X509_check_issued(issuer, cert) == X509_V_OK) {
+ id = OCSP_cert_to_id(EVP_sha1(), cert, issuer);
+ break;
+ }
+ }
+ X509_free(cert);
+
+ if(!id) {
+ failf(data, "Error computing OCSP ID");
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+ goto end;
+ }
+
+ /* Find the single OCSP response corresponding to the certificate ID */
+ ret = OCSP_resp_find_status(br, id, &cert_status, &crl_reason, &rev,
+ &thisupd, &nextupd);
+ OCSP_CERTID_free(id);
+ if(ret != 1) {
+ failf(data, "Could not find certificate ID in OCSP response");
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+ goto end;
+ }
+
+ /* Validate the corresponding single OCSP response */
+ if(!OCSP_check_validity(thisupd, nextupd, 300L, -1L)) {
+ failf(data, "OCSP response has expired");
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+ goto end;
+ }
+
+ infof(data, "SSL certificate status: %s (%d)\n",
+ OCSP_cert_status_str(cert_status), cert_status);
+
+ switch(cert_status) {
+ case V_OCSP_CERTSTATUS_GOOD:
+ break;
+
+ case V_OCSP_CERTSTATUS_REVOKED:
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+ failf(data, "SSL certificate revocation reason: %s (%d)",
+ OCSP_crl_reason_str(crl_reason), crl_reason);
+ goto end;
+
+ case V_OCSP_CERTSTATUS_UNKNOWN:
+ default:
+ result = CURLE_SSL_INVALIDCERTSTATUS;
+ goto end;
}
end:
- if(br)
- OCSP_BASICRESP_free(br);
+ if(br)
+ OCSP_BASICRESP_free(br);
OCSP_RESPONSE_free(rsp);
return result;
@@ -2275,13 +2275,13 @@ set_ssl_version_min_max(SSL_CTX *ctx, struct connectdata *conn)
long curl_ssl_version_max;
/* convert cURL min SSL version option to OpenSSL constant */
-#if defined(OPENSSL_IS_BORINGSSL) || defined(LIBRESSL_VERSION_NUMBER)
- uint16_t ossl_ssl_version_min = 0;
- uint16_t ossl_ssl_version_max = 0;
-#else
+#if defined(OPENSSL_IS_BORINGSSL) || defined(LIBRESSL_VERSION_NUMBER)
+ uint16_t ossl_ssl_version_min = 0;
+ uint16_t ossl_ssl_version_max = 0;
+#else
long ossl_ssl_version_min = 0;
long ossl_ssl_version_max = 0;
-#endif
+#endif
switch(curl_ssl_version_min) {
case CURL_SSLVERSION_TLSv1: /* TLS 1.x */
case CURL_SSLVERSION_TLSv1_0:
@@ -2301,10 +2301,10 @@ set_ssl_version_min_max(SSL_CTX *ctx, struct connectdata *conn)
}
/* CURL_SSLVERSION_DEFAULT means that no option was selected.
- We don't want to pass 0 to SSL_CTX_set_min_proto_version as
- it would enable all versions down to the lowest supported by
- the library.
- So we skip this, and stay with the OS default
+ We don't want to pass 0 to SSL_CTX_set_min_proto_version as
+ it would enable all versions down to the lowest supported by
+ the library.
+ So we skip this, and stay with the OS default
*/
if(curl_ssl_version_min != CURL_SSLVERSION_DEFAULT) {
if(!SSL_CTX_set_min_proto_version(ctx, ossl_ssl_version_min)) {
@@ -2374,7 +2374,7 @@ set_ssl_version_min_max_legacy(ctx_option_t *ctx_options,
#ifdef TLS1_3_VERSION
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- SSL_CTX_set_max_proto_version(backend->ctx, TLS1_3_VERSION);
+ SSL_CTX_set_max_proto_version(backend->ctx, TLS1_3_VERSION);
*ctx_options |= SSL_OP_NO_TLSv1_2;
}
#else
@@ -2502,8 +2502,8 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
bool sni;
- const char * const hostname = SSL_HOST_NAME();
-
+ const char * const hostname = SSL_HOST_NAME();
+
#ifdef ENABLE_IPV6
struct in6_addr addr;
#else
@@ -2511,19 +2511,19 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
#endif
#endif
const long int ssl_version = SSL_CONN_CONFIG(version);
-#ifdef USE_OPENSSL_SRP
+#ifdef USE_OPENSSL_SRP
const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(authtype);
#endif
- char * const ssl_cert = SSL_SET_OPTION(primary.clientcert);
- const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob);
+ char * const ssl_cert = SSL_SET_OPTION(primary.clientcert);
+ const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob);
const char * const ssl_cert_type = SSL_SET_OPTION(cert_type);
const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
const char * const ssl_capath = SSL_CONN_CONFIG(CApath);
const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
char error_buffer[256];
- struct ssl_backend_data *backend = connssl->backend;
- bool imported_native_ca = false;
+ struct ssl_backend_data *backend = connssl->backend;
+ bool imported_native_ca = false;
DEBUGASSERT(ssl_connect_1 == connssl->connecting_state);
@@ -2532,7 +2532,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
if(result)
return result;
- SSL_SET_OPTION_LVALUE(certverifyresult) = !X509_V_OK;
+ SSL_SET_OPTION_LVALUE(certverifyresult) = !X509_V_OK;
/* check to see if we've been told to use an explicit SSL/TLS version */
@@ -2556,7 +2556,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
failf(data, OSSL_PACKAGE " was built without SSLv2 support");
return CURLE_NOT_BUILT_IN;
#else
-#ifdef USE_OPENSSL_SRP
+#ifdef USE_OPENSSL_SRP
if(ssl_authtype == CURL_TLSAUTH_SRP)
return CURLE_SSL_CONNECT_ERROR;
#endif
@@ -2569,7 +2569,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
failf(data, OSSL_PACKAGE " was built without SSLv3 support");
return CURLE_NOT_BUILT_IN;
#else
-#ifdef USE_OPENSSL_SRP
+#ifdef USE_OPENSSL_SRP
if(ssl_authtype == CURL_TLSAUTH_SRP)
return CURLE_SSL_CONNECT_ERROR;
#endif
@@ -2582,25 +2582,25 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
return CURLE_SSL_CONNECT_ERROR;
}
- if(backend->ctx)
- SSL_CTX_free(backend->ctx);
- backend->ctx = SSL_CTX_new(req_method);
+ if(backend->ctx)
+ SSL_CTX_free(backend->ctx);
+ backend->ctx = SSL_CTX_new(req_method);
- if(!backend->ctx) {
+ if(!backend->ctx) {
failf(data, "SSL: couldn't create a context: %s",
ossl_strerror(ERR_peek_error(), error_buffer, sizeof(error_buffer)));
return CURLE_OUT_OF_MEMORY;
}
#ifdef SSL_MODE_RELEASE_BUFFERS
- SSL_CTX_set_mode(backend->ctx, SSL_MODE_RELEASE_BUFFERS);
+ SSL_CTX_set_mode(backend->ctx, SSL_MODE_RELEASE_BUFFERS);
#endif
#ifdef SSL_CTRL_SET_MSG_CALLBACK
if(data->set.fdebug && data->set.verbose) {
/* the SSL trace callback is only used for verbose logging */
- SSL_CTX_set_msg_callback(backend->ctx, ssl_tls_trace);
- SSL_CTX_set_msg_callback_arg(backend->ctx, conn);
+ SSL_CTX_set_msg_callback(backend->ctx, ssl_tls_trace);
+ SSL_CTX_set_msg_callback_arg(backend->ctx, conn);
}
#endif
@@ -2666,8 +2666,8 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
/* "--sslv2" option means SSLv2 only, disable all others */
case CURL_SSLVERSION_SSLv2:
#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* 1.1.0 */
- SSL_CTX_set_min_proto_version(backend->ctx, SSL2_VERSION);
- SSL_CTX_set_max_proto_version(backend->ctx, SSL2_VERSION);
+ SSL_CTX_set_min_proto_version(backend->ctx, SSL2_VERSION);
+ SSL_CTX_set_max_proto_version(backend->ctx, SSL2_VERSION);
#else
ctx_options |= SSL_OP_NO_SSLv3;
ctx_options |= SSL_OP_NO_TLSv1;
@@ -2684,8 +2684,8 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
/* "--sslv3" option means SSLv3 only, disable all others */
case CURL_SSLVERSION_SSLv3:
#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* 1.1.0 */
- SSL_CTX_set_min_proto_version(backend->ctx, SSL3_VERSION);
- SSL_CTX_set_max_proto_version(backend->ctx, SSL3_VERSION);
+ SSL_CTX_set_min_proto_version(backend->ctx, SSL3_VERSION);
+ SSL_CTX_set_max_proto_version(backend->ctx, SSL3_VERSION);
#else
ctx_options |= SSL_OP_NO_SSLv2;
ctx_options |= SSL_OP_NO_TLSv1;
@@ -2712,7 +2712,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
ctx_options |= SSL_OP_NO_SSLv3;
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) /* 1.1.0 */
- result = set_ssl_version_min_max(backend->ctx, conn);
+ result = set_ssl_version_min_max(backend->ctx, conn);
#else
result = set_ssl_version_min_max_legacy(&ctx_options, conn, sockindex);
#endif
@@ -2725,11 +2725,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
return CURLE_SSL_CONNECT_ERROR;
}
- SSL_CTX_set_options(backend->ctx, ctx_options);
+ SSL_CTX_set_options(backend->ctx, ctx_options);
#ifdef HAS_NPN
if(conn->bits.tls_enable_npn)
- SSL_CTX_set_next_proto_select_cb(backend->ctx, select_next_proto_cb, conn);
+ SSL_CTX_set_next_proto_select_cb(backend->ctx, select_next_proto_cb, conn);
#endif
#ifdef HAS_ALPN
@@ -2738,11 +2738,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
unsigned char protocols[128];
#ifdef USE_NGHTTP2
- if(data->set.httpversion >= CURL_HTTP_VERSION_2
-#ifndef CURL_DISABLE_PROXY
- && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
-#endif
- ) {
+ if(data->set.httpversion >= CURL_HTTP_VERSION_2
+#ifndef CURL_DISABLE_PROXY
+ && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
+#endif
+ ) {
protocols[cur++] = NGHTTP2_PROTO_VERSION_ID_LEN;
memcpy(&protocols[cur], NGHTTP2_PROTO_VERSION_ID,
@@ -2760,47 +2760,47 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
/* expects length prefixed preference ordered list of protocols in wire
* format
*/
- SSL_CTX_set_alpn_protos(backend->ctx, protocols, cur);
+ SSL_CTX_set_alpn_protos(backend->ctx, protocols, cur);
}
#endif
- if(ssl_cert || ssl_cert_blob || ssl_cert_type) {
- BIO *ssl_cert_bio = NULL;
- BIO *ssl_key_bio = NULL;
- if(ssl_cert_blob) {
- /* the typecast of blob->len is fine since it is guaranteed to never be
- larger than CURL_MAX_INPUT_LENGTH */
- ssl_cert_bio = BIO_new_mem_buf(ssl_cert_blob->data,
- (int)ssl_cert_blob->len);
- if(!ssl_cert_bio)
- result = CURLE_OUT_OF_MEMORY;
- }
- if(!result && SSL_SET_OPTION(key_blob)) {
- ssl_key_bio = BIO_new_mem_buf(SSL_SET_OPTION(key_blob)->data,
- (int)SSL_SET_OPTION(key_blob)->len);
- if(!ssl_key_bio)
- result = CURLE_OUT_OF_MEMORY;
- }
- if(!result &&
- !cert_stuff(conn, backend->ctx,
- ssl_cert, ssl_cert_bio, ssl_cert_type,
- SSL_SET_OPTION(key), ssl_key_bio,
- SSL_SET_OPTION(key_type), SSL_SET_OPTION(key_passwd)))
- result = CURLE_SSL_CERTPROBLEM;
- if(ssl_cert_bio)
- BIO_free(ssl_cert_bio);
- if(ssl_key_bio)
- BIO_free(ssl_key_bio);
- if(result)
+ if(ssl_cert || ssl_cert_blob || ssl_cert_type) {
+ BIO *ssl_cert_bio = NULL;
+ BIO *ssl_key_bio = NULL;
+ if(ssl_cert_blob) {
+ /* the typecast of blob->len is fine since it is guaranteed to never be
+ larger than CURL_MAX_INPUT_LENGTH */
+ ssl_cert_bio = BIO_new_mem_buf(ssl_cert_blob->data,
+ (int)ssl_cert_blob->len);
+ if(!ssl_cert_bio)
+ result = CURLE_OUT_OF_MEMORY;
+ }
+ if(!result && SSL_SET_OPTION(key_blob)) {
+ ssl_key_bio = BIO_new_mem_buf(SSL_SET_OPTION(key_blob)->data,
+ (int)SSL_SET_OPTION(key_blob)->len);
+ if(!ssl_key_bio)
+ result = CURLE_OUT_OF_MEMORY;
+ }
+ if(!result &&
+ !cert_stuff(conn, backend->ctx,
+ ssl_cert, ssl_cert_bio, ssl_cert_type,
+ SSL_SET_OPTION(key), ssl_key_bio,
+ SSL_SET_OPTION(key_type), SSL_SET_OPTION(key_passwd)))
+ result = CURLE_SSL_CERTPROBLEM;
+ if(ssl_cert_bio)
+ BIO_free(ssl_cert_bio);
+ if(ssl_key_bio)
+ BIO_free(ssl_key_bio);
+ if(result)
/* failf() is already done in cert_stuff() */
- return result;
+ return result;
}
ciphers = SSL_CONN_CONFIG(cipher_list);
if(!ciphers)
ciphers = (char *)DEFAULT_CIPHER_SELECTION;
if(ciphers) {
- if(!SSL_CTX_set_cipher_list(backend->ctx, ciphers)) {
+ if(!SSL_CTX_set_cipher_list(backend->ctx, ciphers)) {
failf(data, "failed setting cipher list: %s", ciphers);
return CURLE_SSL_CIPHER;
}
@@ -2811,7 +2811,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
{
char *ciphers13 = SSL_CONN_CONFIG(cipher_list13);
if(ciphers13) {
- if(!SSL_CTX_set_ciphersuites(backend->ctx, ciphers13)) {
+ if(!SSL_CTX_set_ciphersuites(backend->ctx, ciphers13)) {
failf(data, "failed setting TLS 1.3 cipher suite: %s", ciphers13);
return CURLE_SSL_CIPHER;
}
@@ -2822,39 +2822,39 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
#ifdef HAVE_SSL_CTX_SET_POST_HANDSHAKE_AUTH
/* OpenSSL 1.1.1 requires clients to opt-in for PHA */
- SSL_CTX_set_post_handshake_auth(backend->ctx, 1);
-#endif
-
-#ifdef HAVE_SSL_CTX_SET_EC_CURVES
- {
- char *curves = SSL_CONN_CONFIG(curves);
- if(curves) {
- if(!SSL_CTX_set1_curves_list(backend->ctx, curves)) {
- failf(data, "failed setting curves list: '%s'", curves);
- return CURLE_SSL_CIPHER;
- }
- }
- }
-#endif
-
-#ifdef USE_OPENSSL_SRP
+ SSL_CTX_set_post_handshake_auth(backend->ctx, 1);
+#endif
+
+#ifdef HAVE_SSL_CTX_SET_EC_CURVES
+ {
+ char *curves = SSL_CONN_CONFIG(curves);
+ if(curves) {
+ if(!SSL_CTX_set1_curves_list(backend->ctx, curves)) {
+ failf(data, "failed setting curves list: '%s'", curves);
+ return CURLE_SSL_CIPHER;
+ }
+ }
+ }
+#endif
+
+#ifdef USE_OPENSSL_SRP
if(ssl_authtype == CURL_TLSAUTH_SRP) {
char * const ssl_username = SSL_SET_OPTION(username);
infof(data, "Using TLS-SRP username: %s\n", ssl_username);
- if(!SSL_CTX_set_srp_username(backend->ctx, ssl_username)) {
+ if(!SSL_CTX_set_srp_username(backend->ctx, ssl_username)) {
failf(data, "Unable to set SRP user name");
return CURLE_BAD_FUNCTION_ARGUMENT;
}
- if(!SSL_CTX_set_srp_password(backend->ctx, SSL_SET_OPTION(password))) {
+ if(!SSL_CTX_set_srp_password(backend->ctx, SSL_SET_OPTION(password))) {
failf(data, "failed setting SRP password");
return CURLE_BAD_FUNCTION_ARGUMENT;
}
if(!SSL_CONN_CONFIG(cipher_list)) {
infof(data, "Setting cipher list SRP\n");
- if(!SSL_CTX_set_cipher_list(backend->ctx, "SRP")) {
+ if(!SSL_CTX_set_cipher_list(backend->ctx, "SRP")) {
failf(data, "failed setting SRP cipher list");
return CURLE_SSL_CIPHER;
}
@@ -2862,195 +2862,195 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
}
#endif
-
-#if defined(USE_WIN32_CRYPTO)
- /* Import certificates from the Windows root certificate store if requested.
- https://stackoverflow.com/questions/9507184/
- https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L1037
- https://tools.ietf.org/html/rfc5280 */
- if((SSL_CONN_CONFIG(verifypeer) || SSL_CONN_CONFIG(verifyhost)) &&
- (SSL_SET_OPTION(native_ca_store))) {
- X509_STORE *store = SSL_CTX_get_cert_store(backend->ctx);
- HCERTSTORE hStore = CertOpenSystemStore((HCRYPTPROV_LEGACY)NULL,
- TEXT("ROOT"));
-
- if(hStore) {
- PCCERT_CONTEXT pContext = NULL;
- /* The array of enhanced key usage OIDs will vary per certificate and is
- declared outside of the loop so that rather than malloc/free each
- iteration we can grow it with realloc, when necessary. */
- CERT_ENHKEY_USAGE *enhkey_usage = NULL;
- DWORD enhkey_usage_size = 0;
-
- /* This loop makes a best effort to import all valid certificates from
- the MS root store. If a certificate cannot be imported it is skipped.
- 'result' is used to store only hard-fail conditions (such as out of
- memory) that cause an early break. */
- result = CURLE_OK;
- for(;;) {
- X509 *x509;
- FILETIME now;
- BYTE key_usage[2];
- DWORD req_size;
- const unsigned char *encoded_cert;
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
- char cert_name[256];
-#endif
-
- pContext = CertEnumCertificatesInStore(hStore, pContext);
- if(!pContext)
- break;
-
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
- if(!CertGetNameStringA(pContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0,
- NULL, cert_name, sizeof(cert_name))) {
- strcpy(cert_name, "Unknown");
- }
- infof(data, "SSL: Checking cert \"%s\"\n", cert_name);
-#endif
-
- encoded_cert = (const unsigned char *)pContext->pbCertEncoded;
- if(!encoded_cert)
- continue;
-
- GetSystemTimeAsFileTime(&now);
- if(CompareFileTime(&pContext->pCertInfo->NotBefore, &now) > 0 ||
- CompareFileTime(&now, &pContext->pCertInfo->NotAfter) > 0)
- continue;
-
- /* If key usage exists check for signing attribute */
- if(CertGetIntendedKeyUsage(pContext->dwCertEncodingType,
- pContext->pCertInfo,
- key_usage, sizeof(key_usage))) {
- if(!(key_usage[0] & CERT_KEY_CERT_SIGN_KEY_USAGE))
- continue;
- }
- else if(GetLastError())
- continue;
-
- /* If enhanced key usage exists check for server auth attribute.
- *
- * Note "In a Microsoft environment, a certificate might also have EKU
- * extended properties that specify valid uses for the certificate."
- * The call below checks both, and behavior varies depending on what is
- * found. For more details see CertGetEnhancedKeyUsage doc.
- */
- if(CertGetEnhancedKeyUsage(pContext, 0, NULL, &req_size)) {
- if(req_size && req_size > enhkey_usage_size) {
- void *tmp = realloc(enhkey_usage, req_size);
-
- if(!tmp) {
- failf(data, "SSL: Out of memory allocating for OID list");
- result = CURLE_OUT_OF_MEMORY;
- break;
- }
-
- enhkey_usage = (CERT_ENHKEY_USAGE *)tmp;
- enhkey_usage_size = req_size;
- }
-
- if(CertGetEnhancedKeyUsage(pContext, 0, enhkey_usage, &req_size)) {
- if(!enhkey_usage->cUsageIdentifier) {
- /* "If GetLastError returns CRYPT_E_NOT_FOUND, the certificate is
- good for all uses. If it returns zero, the certificate has no
- valid uses." */
- if((HRESULT)GetLastError() != CRYPT_E_NOT_FOUND)
- continue;
- }
- else {
- DWORD i;
- bool found = false;
-
- for(i = 0; i < enhkey_usage->cUsageIdentifier; ++i) {
- if(!strcmp("1.3.6.1.5.5.7.3.1" /* OID server auth */,
- enhkey_usage->rgpszUsageIdentifier[i])) {
- found = true;
- break;
- }
- }
-
- if(!found)
- continue;
- }
- }
- else
- continue;
- }
- else
- continue;
-
- x509 = d2i_X509(NULL, &encoded_cert, pContext->cbCertEncoded);
- if(!x509)
- continue;
-
- /* Try to import the certificate. This may fail for legitimate reasons
- such as duplicate certificate, which is allowed by MS but not
- OpenSSL. */
- if(X509_STORE_add_cert(store, x509) == 1) {
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
- infof(data, "SSL: Imported cert \"%s\"\n", cert_name);
-#endif
- imported_native_ca = true;
- }
- X509_free(x509);
- }
-
- free(enhkey_usage);
- CertFreeCertificateContext(pContext);
- CertCloseStore(hStore, 0);
-
- if(result)
- return result;
- }
- if(imported_native_ca)
- infof(data, "successfully imported windows ca store\n");
- else
- infof(data, "error importing windows ca store, continuing anyway\n");
- }
-#endif
-
-#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
- /* OpenSSL 3.0.0 has deprecated SSL_CTX_load_verify_locations */
- {
- if(ssl_cafile) {
- if(!SSL_CTX_load_verify_file(backend->ctx, ssl_cafile)) {
- if(verifypeer && !imported_native_ca) {
- /* Fail if we insist on successfully verifying the server. */
- failf(data, "error setting certificate file: %s", ssl_cafile);
- return CURLE_SSL_CACERT_BADFILE;
- }
- /* Continue with a warning if no certificate verif is required. */
- infof(data, "error setting certificate file, continuing anyway\n");
- }
- infof(data, " CAfile: %s\n", ssl_cafile);
- }
- if(ssl_capath) {
- if(!SSL_CTX_load_verify_dir(backend->ctx, ssl_capath)) {
- if(verifypeer && !imported_native_ca) {
- /* Fail if we insist on successfully verifying the server. */
- failf(data, "error setting certificate path: %s", ssl_capath);
- return CURLE_SSL_CACERT_BADFILE;
- }
- /* Continue with a warning if no certificate verif is required. */
- infof(data, "error setting certificate path, continuing anyway\n");
- }
- infof(data, " CApath: %s\n", ssl_capath);
- }
- }
-#else
+
+#if defined(USE_WIN32_CRYPTO)
+ /* Import certificates from the Windows root certificate store if requested.
+ https://stackoverflow.com/questions/9507184/
+ https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L1037
+ https://tools.ietf.org/html/rfc5280 */
+ if((SSL_CONN_CONFIG(verifypeer) || SSL_CONN_CONFIG(verifyhost)) &&
+ (SSL_SET_OPTION(native_ca_store))) {
+ X509_STORE *store = SSL_CTX_get_cert_store(backend->ctx);
+ HCERTSTORE hStore = CertOpenSystemStore((HCRYPTPROV_LEGACY)NULL,
+ TEXT("ROOT"));
+
+ if(hStore) {
+ PCCERT_CONTEXT pContext = NULL;
+ /* The array of enhanced key usage OIDs will vary per certificate and is
+ declared outside of the loop so that rather than malloc/free each
+ iteration we can grow it with realloc, when necessary. */
+ CERT_ENHKEY_USAGE *enhkey_usage = NULL;
+ DWORD enhkey_usage_size = 0;
+
+ /* This loop makes a best effort to import all valid certificates from
+ the MS root store. If a certificate cannot be imported it is skipped.
+ 'result' is used to store only hard-fail conditions (such as out of
+ memory) that cause an early break. */
+ result = CURLE_OK;
+ for(;;) {
+ X509 *x509;
+ FILETIME now;
+ BYTE key_usage[2];
+ DWORD req_size;
+ const unsigned char *encoded_cert;
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+ char cert_name[256];
+#endif
+
+ pContext = CertEnumCertificatesInStore(hStore, pContext);
+ if(!pContext)
+ break;
+
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+ if(!CertGetNameStringA(pContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0,
+ NULL, cert_name, sizeof(cert_name))) {
+ strcpy(cert_name, "Unknown");
+ }
+ infof(data, "SSL: Checking cert \"%s\"\n", cert_name);
+#endif
+
+ encoded_cert = (const unsigned char *)pContext->pbCertEncoded;
+ if(!encoded_cert)
+ continue;
+
+ GetSystemTimeAsFileTime(&now);
+ if(CompareFileTime(&pContext->pCertInfo->NotBefore, &now) > 0 ||
+ CompareFileTime(&now, &pContext->pCertInfo->NotAfter) > 0)
+ continue;
+
+ /* If key usage exists check for signing attribute */
+ if(CertGetIntendedKeyUsage(pContext->dwCertEncodingType,
+ pContext->pCertInfo,
+ key_usage, sizeof(key_usage))) {
+ if(!(key_usage[0] & CERT_KEY_CERT_SIGN_KEY_USAGE))
+ continue;
+ }
+ else if(GetLastError())
+ continue;
+
+ /* If enhanced key usage exists check for server auth attribute.
+ *
+ * Note "In a Microsoft environment, a certificate might also have EKU
+ * extended properties that specify valid uses for the certificate."
+ * The call below checks both, and behavior varies depending on what is
+ * found. For more details see CertGetEnhancedKeyUsage doc.
+ */
+ if(CertGetEnhancedKeyUsage(pContext, 0, NULL, &req_size)) {
+ if(req_size && req_size > enhkey_usage_size) {
+ void *tmp = realloc(enhkey_usage, req_size);
+
+ if(!tmp) {
+ failf(data, "SSL: Out of memory allocating for OID list");
+ result = CURLE_OUT_OF_MEMORY;
+ break;
+ }
+
+ enhkey_usage = (CERT_ENHKEY_USAGE *)tmp;
+ enhkey_usage_size = req_size;
+ }
+
+ if(CertGetEnhancedKeyUsage(pContext, 0, enhkey_usage, &req_size)) {
+ if(!enhkey_usage->cUsageIdentifier) {
+ /* "If GetLastError returns CRYPT_E_NOT_FOUND, the certificate is
+ good for all uses. If it returns zero, the certificate has no
+ valid uses." */
+ if((HRESULT)GetLastError() != CRYPT_E_NOT_FOUND)
+ continue;
+ }
+ else {
+ DWORD i;
+ bool found = false;
+
+ for(i = 0; i < enhkey_usage->cUsageIdentifier; ++i) {
+ if(!strcmp("1.3.6.1.5.5.7.3.1" /* OID server auth */,
+ enhkey_usage->rgpszUsageIdentifier[i])) {
+ found = true;
+ break;
+ }
+ }
+
+ if(!found)
+ continue;
+ }
+ }
+ else
+ continue;
+ }
+ else
+ continue;
+
+ x509 = d2i_X509(NULL, &encoded_cert, pContext->cbCertEncoded);
+ if(!x509)
+ continue;
+
+ /* Try to import the certificate. This may fail for legitimate reasons
+ such as duplicate certificate, which is allowed by MS but not
+ OpenSSL. */
+ if(X509_STORE_add_cert(store, x509) == 1) {
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+ infof(data, "SSL: Imported cert \"%s\"\n", cert_name);
+#endif
+ imported_native_ca = true;
+ }
+ X509_free(x509);
+ }
+
+ free(enhkey_usage);
+ CertFreeCertificateContext(pContext);
+ CertCloseStore(hStore, 0);
+
+ if(result)
+ return result;
+ }
+ if(imported_native_ca)
+ infof(data, "successfully imported windows ca store\n");
+ else
+ infof(data, "error importing windows ca store, continuing anyway\n");
+ }
+#endif
+
+#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
+ /* OpenSSL 3.0.0 has deprecated SSL_CTX_load_verify_locations */
+ {
+ if(ssl_cafile) {
+ if(!SSL_CTX_load_verify_file(backend->ctx, ssl_cafile)) {
+ if(verifypeer && !imported_native_ca) {
+ /* Fail if we insist on successfully verifying the server. */
+ failf(data, "error setting certificate file: %s", ssl_cafile);
+ return CURLE_SSL_CACERT_BADFILE;
+ }
+ /* Continue with a warning if no certificate verif is required. */
+ infof(data, "error setting certificate file, continuing anyway\n");
+ }
+ infof(data, " CAfile: %s\n", ssl_cafile);
+ }
+ if(ssl_capath) {
+ if(!SSL_CTX_load_verify_dir(backend->ctx, ssl_capath)) {
+ if(verifypeer && !imported_native_ca) {
+ /* Fail if we insist on successfully verifying the server. */
+ failf(data, "error setting certificate path: %s", ssl_capath);
+ return CURLE_SSL_CACERT_BADFILE;
+ }
+ /* Continue with a warning if no certificate verif is required. */
+ infof(data, "error setting certificate path, continuing anyway\n");
+ }
+ infof(data, " CApath: %s\n", ssl_capath);
+ }
+ }
+#else
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 && !imported_native_ca) {
+ if(!SSL_CTX_load_verify_locations(backend->ctx, ssl_cafile, ssl_capath)) {
+ if(verifypeer && !imported_native_ca) {
/* Fail if we insist on successfully verifying the server. */
- failf(data, "error setting certificate verify locations:"
- " CAfile: %s CApath: %s",
+ failf(data, "error setting certificate verify locations:"
+ " CAfile: %s CApath: %s",
ssl_cafile ? ssl_cafile : "none",
ssl_capath ? ssl_capath : "none");
return CURLE_SSL_CACERT_BADFILE;
}
- /* Just continue with a warning if no strict certificate verification
+ /* Just continue with a warning if no strict certificate verification
is required. */
infof(data, "error setting certificate verify locations,"
" continuing anyway:\n");
@@ -3059,23 +3059,23 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
/* Everything is fine. */
infof(data, "successfully set certificate verify locations:\n");
}
- infof(data, " CAfile: %s\n", ssl_cafile ? ssl_cafile : "none");
- infof(data, " CApath: %s\n", ssl_capath ? ssl_capath : "none");
+ infof(data, " CAfile: %s\n", ssl_cafile ? ssl_cafile : "none");
+ infof(data, " CApath: %s\n", ssl_capath ? ssl_capath : "none");
}
-#endif
-
+#endif
+
#ifdef CURL_CA_FALLBACK
- if(verifypeer && !ssl_cafile && !ssl_capath && !imported_native_ca) {
+ if(verifypeer && !ssl_cafile && !ssl_capath && !imported_native_ca) {
/* verifying the peer without any CA certificates won't
work so use openssl's built in default as fallback */
- SSL_CTX_set_default_verify_paths(backend->ctx);
+ SSL_CTX_set_default_verify_paths(backend->ctx);
}
#endif
if(ssl_crlfile) {
/* tell SSL where to find CRL file that is used to check certificate
* revocation */
- lookup = X509_STORE_add_lookup(SSL_CTX_get_cert_store(backend->ctx),
+ lookup = X509_STORE_add_lookup(SSL_CTX_get_cert_store(backend->ctx),
X509_LOOKUP_file());
if(!lookup ||
(!X509_load_crl_file(lookup, ssl_crlfile, X509_FILETYPE_PEM)) ) {
@@ -3084,50 +3084,50 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
}
/* Everything is fine. */
infof(data, "successfully load CRL file:\n");
- X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx),
+ X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx),
X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
infof(data, " CRLfile: %s\n", ssl_crlfile);
}
if(verifypeer) {
- /* Try building a chain using issuers in the trusted store first to avoid
- problems with server-sent legacy intermediates. Newer versions of
- OpenSSL do alternate chain checking by default but we do not know how to
- determine that in a reliable manner.
- https://rt.openssl.org/Ticket/Display.html?id=3621&user=guest&pass=guest
- */
-#if defined(X509_V_FLAG_TRUSTED_FIRST)
- X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx),
+ /* Try building a chain using issuers in the trusted store first to avoid
+ problems with server-sent legacy intermediates. Newer versions of
+ OpenSSL do alternate chain checking by default but we do not know how to
+ determine that in a reliable manner.
+ https://rt.openssl.org/Ticket/Display.html?id=3621&user=guest&pass=guest
+ */
+#if defined(X509_V_FLAG_TRUSTED_FIRST)
+ X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx),
X509_V_FLAG_TRUSTED_FIRST);
#endif
-#ifdef X509_V_FLAG_PARTIAL_CHAIN
- if(!SSL_SET_OPTION(no_partialchain) && !ssl_crlfile) {
- /* Have intermediate certificates in the trust store be treated as
- trust-anchors, in the same way as self-signed root CA certificates
- are. This allows users to verify servers using the intermediate cert
- only, instead of needing the whole chain.
-
- Due to OpenSSL bug https://github.com/openssl/openssl/issues/5081 we
- cannot do partial chains with CRL check.
- */
- X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx),
- X509_V_FLAG_PARTIAL_CHAIN);
- }
-#endif
- }
-
+#ifdef X509_V_FLAG_PARTIAL_CHAIN
+ if(!SSL_SET_OPTION(no_partialchain) && !ssl_crlfile) {
+ /* Have intermediate certificates in the trust store be treated as
+ trust-anchors, in the same way as self-signed root CA certificates
+ are. This allows users to verify servers using the intermediate cert
+ only, instead of needing the whole chain.
+
+ Due to OpenSSL bug https://github.com/openssl/openssl/issues/5081 we
+ cannot do partial chains with CRL check.
+ */
+ X509_STORE_set_flags(SSL_CTX_get_cert_store(backend->ctx),
+ X509_V_FLAG_PARTIAL_CHAIN);
+ }
+#endif
+ }
+
/* SSL always tries to verify the peer, this only says whether it should
* fail to connect if the verification fails, or if it should continue
* anyway. In the latter case the result of the verification is checked with
* SSL_get_verify_result() below. */
- SSL_CTX_set_verify(backend->ctx,
+ SSL_CTX_set_verify(backend->ctx,
verifypeer ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, NULL);
/* Enable logging of secrets to the file specified in env SSLKEYLOGFILE. */
-#ifdef HAVE_KEYLOG_CALLBACK
- if(Curl_tls_keylog_enabled()) {
- SSL_CTX_set_keylog_callback(backend->ctx, ossl_keylog_callback);
+#ifdef HAVE_KEYLOG_CALLBACK
+ if(Curl_tls_keylog_enabled()) {
+ SSL_CTX_set_keylog_callback(backend->ctx, ossl_keylog_callback);
}
#endif
@@ -3135,16 +3135,16 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
* callback. Use the "external storage" mode to avoid that OpenSSL creates
* an internal session cache.
*/
- SSL_CTX_set_session_cache_mode(backend->ctx,
+ SSL_CTX_set_session_cache_mode(backend->ctx,
SSL_SESS_CACHE_CLIENT | SSL_SESS_CACHE_NO_INTERNAL);
- SSL_CTX_sess_set_new_cb(backend->ctx, ossl_new_session_cb);
+ SSL_CTX_sess_set_new_cb(backend->ctx, ossl_new_session_cb);
/* give application a chance to interfere with SSL set up. */
if(data->set.ssl.fsslctx) {
- Curl_set_in_callback(data, true);
- result = (*data->set.ssl.fsslctx)(data, backend->ctx,
+ Curl_set_in_callback(data, true);
+ result = (*data->set.ssl.fsslctx)(data, backend->ctx,
data->set.ssl.fsslctxp);
- Curl_set_in_callback(data, false);
+ Curl_set_in_callback(data, false);
if(result) {
failf(data, "error signaled by ssl ctx callback");
return result;
@@ -3152,10 +3152,10 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
}
/* Lets make an SSL structure */
- if(backend->handle)
- SSL_free(backend->handle);
- backend->handle = SSL_new(backend->ctx);
- if(!backend->handle) {
+ if(backend->handle)
+ SSL_free(backend->handle);
+ backend->handle = SSL_new(backend->ctx);
+ if(!backend->handle) {
failf(data, "SSL: couldn't create a context (handle)!");
return CURLE_OUT_OF_MEMORY;
}
@@ -3163,23 +3163,23 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
#if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \
!defined(OPENSSL_NO_OCSP)
if(SSL_CONN_CONFIG(verifystatus))
- SSL_set_tlsext_status_type(backend->handle, TLSEXT_STATUSTYPE_ocsp);
+ SSL_set_tlsext_status_type(backend->handle, TLSEXT_STATUSTYPE_ocsp);
#endif
#if defined(OPENSSL_IS_BORINGSSL) && defined(ALLOW_RENEG)
- SSL_set_renegotiate_mode(backend->handle, ssl_renegotiate_freely);
+ SSL_set_renegotiate_mode(backend->handle, ssl_renegotiate_freely);
#endif
- SSL_set_connect_state(backend->handle);
+ SSL_set_connect_state(backend->handle);
- backend->server_cert = 0x0;
+ backend->server_cert = 0x0;
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
if((0 == Curl_inet_pton(AF_INET, hostname, &addr)) &&
#ifdef ENABLE_IPV6
(0 == Curl_inet_pton(AF_INET6, hostname, &addr)) &&
#endif
sni &&
- !SSL_set_tlsext_host_name(backend->handle, hostname))
+ !SSL_set_tlsext_host_name(backend->handle, hostname))
infof(data, "WARNING: failed to configure server name indication (SNI) "
"TLS extension\n");
#endif
@@ -3193,14 +3193,14 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
if(connectdata_idx >= 0 && sockindex_idx >= 0) {
/* Store the data needed for the "new session" callback.
* The sockindex is stored as a pointer to an array element. */
- SSL_set_ex_data(backend->handle, connectdata_idx, conn);
- SSL_set_ex_data(backend->handle, sockindex_idx, conn->sock + sockindex);
+ SSL_set_ex_data(backend->handle, connectdata_idx, conn);
+ SSL_set_ex_data(backend->handle, sockindex_idx, conn->sock + sockindex);
}
Curl_ssl_sessionid_lock(conn);
if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL, sockindex)) {
/* we got a session id, use it! */
- if(!SSL_set_session(backend->handle, ssl_sessionid)) {
+ if(!SSL_set_session(backend->handle, ssl_sessionid)) {
Curl_ssl_sessionid_unlock(conn);
failf(data, "SSL: SSL_set_session failed: %s",
ossl_strerror(ERR_get_error(), error_buffer,
@@ -3213,7 +3213,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
Curl_ssl_sessionid_unlock(conn);
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->proxy_ssl[sockindex].use) {
BIO *const bio = BIO_new(BIO_f_ssl());
SSL *handle = conn->proxy_ssl[sockindex].backend->handle;
@@ -3221,11 +3221,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
DEBUGASSERT(handle != NULL);
DEBUGASSERT(bio != NULL);
BIO_set_ssl(bio, handle, FALSE);
- SSL_set_bio(backend->handle, bio, bio);
+ SSL_set_bio(backend->handle, bio, bio);
}
- else
-#endif
- if(!SSL_set_fd(backend->handle, (int)sockfd)) {
+ else
+#endif
+ if(!SSL_set_fd(backend->handle, (int)sockfd)) {
/* pass the raw socket into the SSL layers */
failf(data, "SSL: SSL_set_fd failed: %s",
ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)));
@@ -3242,28 +3242,28 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
struct Curl_easy *data = conn->data;
int err;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
DEBUGASSERT(ssl_connect_2 == connssl->connecting_state
|| ssl_connect_2_reading == connssl->connecting_state
|| ssl_connect_2_writing == connssl->connecting_state);
ERR_clear_error();
- err = SSL_connect(backend->handle);
-#ifndef HAVE_KEYLOG_CALLBACK
- if(Curl_tls_keylog_enabled()) {
- /* If key logging is enabled, wait for the handshake to complete and then
- * proceed with logging secrets (for TLS 1.2 or older).
- */
- ossl_log_tls12_secret(backend->handle, &backend->keylog_done);
- }
+ err = SSL_connect(backend->handle);
+#ifndef HAVE_KEYLOG_CALLBACK
+ if(Curl_tls_keylog_enabled()) {
+ /* If key logging is enabled, wait for the handshake to complete and then
+ * proceed with logging secrets (for TLS 1.2 or older).
+ */
+ ossl_log_tls12_secret(backend->handle, &backend->keylog_done);
+ }
#endif
/* 1 is fine
0 is "not successful but was shut down controlled"
<0 is "handshake was not successful, because a fatal error occurred" */
if(1 != err) {
- int detail = SSL_get_error(backend->handle, err);
+ int detail = SSL_get_error(backend->handle, err);
if(SSL_ERROR_WANT_READ == detail) {
connssl->connecting_state = ssl_connect_2_reading;
@@ -3300,13 +3300,13 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
reason = ERR_GET_REASON(errdetail);
if((lib == ERR_LIB_SSL) &&
- ((reason == SSL_R_CERTIFICATE_VERIFY_FAILED) ||
- (reason == SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED))) {
+ ((reason == SSL_R_CERTIFICATE_VERIFY_FAILED) ||
+ (reason == SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED))) {
result = CURLE_PEER_FAILED_VERIFICATION;
- lerr = SSL_get_verify_result(backend->handle);
+ lerr = SSL_get_verify_result(backend->handle);
if(lerr != X509_V_OK) {
- SSL_SET_OPTION_LVALUE(certverifyresult) = lerr;
+ SSL_SET_OPTION_LVALUE(certverifyresult) = lerr;
msnprintf(error_buffer, sizeof(error_buffer),
"SSL certificate problem: %s",
X509_verify_cert_error_string(lerr));
@@ -3328,19 +3328,19 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
* the SO_ERROR is also lost.
*/
if(CURLE_SSL_CONNECT_ERROR == result && errdetail == 0) {
- const char * const hostname = SSL_HOST_NAME();
-#ifndef CURL_DISABLE_PROXY
+ const char * const hostname = SSL_HOST_NAME();
+#ifndef CURL_DISABLE_PROXY
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
-#else
- const long int port = conn->remote_port;
-#endif
- char extramsg[80]="";
- int sockerr = SOCKERRNO;
- if(sockerr && detail == SSL_ERROR_SYSCALL)
- Curl_strerror(sockerr, extramsg, sizeof(extramsg));
+#else
+ const long int port = conn->remote_port;
+#endif
+ char extramsg[80]="";
+ int sockerr = SOCKERRNO;
+ if(sockerr && detail == SSL_ERROR_SYSCALL)
+ Curl_strerror(sockerr, extramsg, sizeof(extramsg));
failf(data, OSSL_PACKAGE " SSL_connect: %s in connection to %s:%ld ",
- extramsg[0] ? extramsg : SSL_ERROR_to_str(detail),
- hostname, port);
+ extramsg[0] ? extramsg : SSL_ERROR_to_str(detail),
+ hostname, port);
return result;
}
@@ -3356,8 +3356,8 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
/* Informational message */
infof(data, "SSL connection using %s / %s\n",
- get_ssl_version_txt(backend->handle),
- SSL_get_cipher(backend->handle));
+ get_ssl_version_txt(backend->handle),
+ SSL_get_cipher(backend->handle));
#ifdef HAS_ALPN
/* Sets data and len to negotiated protocol, len is 0 if no protocol was
@@ -3366,7 +3366,7 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
if(conn->bits.tls_enable_alpn) {
const unsigned char *neg_protocol;
unsigned int len;
- SSL_get0_alpn_selected(backend->handle, &neg_protocol, &len);
+ SSL_get0_alpn_selected(backend->handle, &neg_protocol, &len);
if(len != 0) {
infof(data, "ALPN, server accepted to use %.*s\n", len, neg_protocol);
@@ -3416,7 +3416,7 @@ do { \
Curl_ssl_push_certinfo_len(data, _num, _label, ptr, info_len); \
if(1 != BIO_reset(mem)) \
break; \
-} while(0)
+} while(0)
static void pubkey_show(struct Curl_easy *data,
BIO *mem,
@@ -3448,10 +3448,10 @@ do { \
if(_type->_name) { \
pubkey_show(data, mem, _num, #_type, #_name, _type->_name); \
} \
-} while(0)
+} while(0)
#endif
-static void X509V3_ext(struct Curl_easy *data,
+static void X509V3_ext(struct Curl_easy *data,
int certnum,
CONST_EXTS STACK_OF(X509_EXTENSION) *exts)
{
@@ -3459,7 +3459,7 @@ static void X509V3_ext(struct Curl_easy *data,
if((int)sk_X509_EXTENSION_num(exts) <= 0)
/* no extensions, bail out */
- return;
+ return;
for(i = 0; i < (int)sk_X509_EXTENSION_num(exts); i++) {
ASN1_OBJECT *obj;
@@ -3469,7 +3469,7 @@ static void X509V3_ext(struct Curl_easy *data,
BIO *bio_out = BIO_new(BIO_s_mem());
if(!bio_out)
- return;
+ return;
obj = X509_EXTENSION_get_object(ext);
@@ -3479,8 +3479,8 @@ static void X509V3_ext(struct Curl_easy *data,
ASN1_STRING_print(bio_out, (ASN1_STRING *)X509_EXTENSION_get_data(ext));
BIO_get_mem_ptr(bio_out, &biomem);
- Curl_ssl_push_certinfo_len(data, certnum, namebuf, biomem->data,
- biomem->length);
+ Curl_ssl_push_certinfo_len(data, certnum, namebuf, biomem->data,
+ biomem->length);
BIO_free(bio_out);
}
}
@@ -3500,9 +3500,9 @@ static CURLcode get_cert_chain(struct connectdata *conn,
struct Curl_easy *data = conn->data;
numcert_t numcerts;
BIO *mem;
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
- sk = SSL_get_peer_cert_chain(backend->handle);
+ sk = SSL_get_peer_cert_chain(backend->handle);
if(!sk) {
return CURLE_OUT_OF_MEMORY;
}
@@ -3786,14 +3786,14 @@ static CURLcode servercert(struct connectdata *conn,
char buffer[2048];
const char *ptr;
BIO *mem = BIO_new(BIO_s_mem());
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
if(data->set.ssl.certinfo)
/* we've been asked to gather certificate info! */
(void)get_cert_chain(conn, connssl);
- backend->server_cert = SSL_get_peer_certificate(backend->handle);
- if(!backend->server_cert) {
+ backend->server_cert = SSL_get_peer_certificate(backend->handle);
+ if(!backend->server_cert) {
BIO_free(mem);
if(!strict)
return CURLE_OK;
@@ -3804,19 +3804,19 @@ static CURLcode servercert(struct connectdata *conn,
infof(data, "%s certificate:\n", SSL_IS_PROXY() ? "Proxy" : "Server");
- rc = x509_name_oneline(X509_get_subject_name(backend->server_cert),
+ rc = x509_name_oneline(X509_get_subject_name(backend->server_cert),
buffer, sizeof(buffer));
infof(data, " subject: %s\n", rc?"[NONE]":buffer);
#ifndef CURL_DISABLE_VERBOSE_STRINGS
{
long len;
- ASN1_TIME_print(mem, X509_get0_notBefore(backend->server_cert));
+ ASN1_TIME_print(mem, X509_get0_notBefore(backend->server_cert));
len = BIO_get_mem_data(mem, (char **) &ptr);
infof(data, " start date: %.*s\n", len, ptr);
(void)BIO_reset(mem);
- ASN1_TIME_print(mem, X509_get0_notAfter(backend->server_cert));
+ ASN1_TIME_print(mem, X509_get0_notAfter(backend->server_cert));
len = BIO_get_mem_data(mem, (char **) &ptr);
infof(data, " expire date: %.*s\n", len, ptr);
(void)BIO_reset(mem);
@@ -3826,15 +3826,15 @@ static CURLcode servercert(struct connectdata *conn,
BIO_free(mem);
if(SSL_CONN_CONFIG(verifyhost)) {
- result = verifyhost(conn, backend->server_cert);
+ result = verifyhost(conn, backend->server_cert);
if(result) {
- X509_free(backend->server_cert);
- backend->server_cert = NULL;
+ X509_free(backend->server_cert);
+ backend->server_cert = NULL;
return result;
}
}
- rc = x509_name_oneline(X509_get_issuer_name(backend->server_cert),
+ rc = x509_name_oneline(X509_get_issuer_name(backend->server_cert),
buffer, sizeof(buffer));
if(rc) {
if(strict)
@@ -3848,32 +3848,32 @@ static CURLcode servercert(struct connectdata *conn,
deallocating the certificate. */
/* e.g. match issuer name with provided issuer certificate */
- if(SSL_SET_OPTION(issuercert) || SSL_SET_OPTION(issuercert_blob)) {
- if(SSL_SET_OPTION(issuercert_blob))
- fp = BIO_new_mem_buf(SSL_SET_OPTION(issuercert_blob)->data,
- (int)SSL_SET_OPTION(issuercert_blob)->len);
- else {
- fp = BIO_new(BIO_s_file());
- if(fp == NULL) {
- failf(data,
- "BIO_new return NULL, " OSSL_PACKAGE
- " error %s",
- ossl_strerror(ERR_get_error(), error_buffer,
- sizeof(error_buffer)) );
- X509_free(backend->server_cert);
- backend->server_cert = NULL;
- return CURLE_OUT_OF_MEMORY;
- }
-
- if(BIO_read_filename(fp, SSL_SET_OPTION(issuercert)) <= 0) {
- if(strict)
- failf(data, "SSL: Unable to open issuer cert (%s)",
- SSL_SET_OPTION(issuercert));
- BIO_free(fp);
- X509_free(backend->server_cert);
- backend->server_cert = NULL;
- return CURLE_SSL_ISSUER_ERROR;
- }
+ if(SSL_SET_OPTION(issuercert) || SSL_SET_OPTION(issuercert_blob)) {
+ if(SSL_SET_OPTION(issuercert_blob))
+ fp = BIO_new_mem_buf(SSL_SET_OPTION(issuercert_blob)->data,
+ (int)SSL_SET_OPTION(issuercert_blob)->len);
+ else {
+ fp = BIO_new(BIO_s_file());
+ if(fp == NULL) {
+ failf(data,
+ "BIO_new return NULL, " OSSL_PACKAGE
+ " error %s",
+ ossl_strerror(ERR_get_error(), error_buffer,
+ sizeof(error_buffer)) );
+ X509_free(backend->server_cert);
+ backend->server_cert = NULL;
+ return CURLE_OUT_OF_MEMORY;
+ }
+
+ if(BIO_read_filename(fp, SSL_SET_OPTION(issuercert)) <= 0) {
+ if(strict)
+ failf(data, "SSL: Unable to open issuer cert (%s)",
+ SSL_SET_OPTION(issuercert));
+ BIO_free(fp);
+ X509_free(backend->server_cert);
+ backend->server_cert = NULL;
+ return CURLE_SSL_ISSUER_ERROR;
+ }
}
issuer = PEM_read_bio_X509(fp, NULL, ZERO_NULL, NULL);
@@ -3883,19 +3883,19 @@ static CURLcode servercert(struct connectdata *conn,
SSL_SET_OPTION(issuercert));
BIO_free(fp);
X509_free(issuer);
- X509_free(backend->server_cert);
- backend->server_cert = NULL;
+ X509_free(backend->server_cert);
+ backend->server_cert = NULL;
return CURLE_SSL_ISSUER_ERROR;
}
- if(X509_check_issued(issuer, backend->server_cert) != X509_V_OK) {
+ if(X509_check_issued(issuer, backend->server_cert) != X509_V_OK) {
if(strict)
failf(data, "SSL: Certificate issuer check failed (%s)",
SSL_SET_OPTION(issuercert));
BIO_free(fp);
X509_free(issuer);
- X509_free(backend->server_cert);
- backend->server_cert = NULL;
+ X509_free(backend->server_cert);
+ backend->server_cert = NULL;
return CURLE_SSL_ISSUER_ERROR;
}
@@ -3905,9 +3905,9 @@ static CURLcode servercert(struct connectdata *conn,
X509_free(issuer);
}
- lerr = SSL_get_verify_result(backend->handle);
- SSL_SET_OPTION_LVALUE(certverifyresult) = lerr;
- if(lerr != X509_V_OK) {
+ lerr = SSL_get_verify_result(backend->handle);
+ SSL_SET_OPTION_LVALUE(certverifyresult) = lerr;
+ if(lerr != X509_V_OK) {
if(SSL_CONN_CONFIG(verifypeer)) {
/* We probably never reach this, because SSL_connect() will fail
and we return earlier if verifypeer is set? */
@@ -3930,8 +3930,8 @@ static CURLcode servercert(struct connectdata *conn,
if(SSL_CONN_CONFIG(verifystatus)) {
result = verifystatus(conn, connssl);
if(result) {
- X509_free(backend->server_cert);
- backend->server_cert = NULL;
+ X509_free(backend->server_cert);
+ backend->server_cert = NULL;
return result;
}
}
@@ -3944,13 +3944,13 @@ static CURLcode servercert(struct connectdata *conn,
ptr = SSL_IS_PROXY() ? data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
if(!result && ptr) {
- result = pkp_pin_peer_pubkey(data, backend->server_cert, ptr);
+ result = pkp_pin_peer_pubkey(data, backend->server_cert, ptr);
if(result)
failf(data, "SSL: public key does not match pinned public key!");
}
- X509_free(backend->server_cert);
- backend->server_cert = NULL;
+ X509_free(backend->server_cert);
+ backend->server_cert = NULL;
connssl->connecting_state = ssl_connect_done;
return result;
@@ -4001,7 +4001,7 @@ static CURLcode ossl_connect_common(struct connectdata *conn,
if(ssl_connect_1 == connssl->connecting_state) {
/* Find out how much more time we're allowed */
- const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
@@ -4019,7 +4019,7 @@ static CURLcode ossl_connect_common(struct connectdata *conn,
ssl_connect_2_writing == connssl->connecting_state) {
/* check allowed time left */
- const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
@@ -4118,13 +4118,13 @@ static bool Curl_ossl_data_pending(const struct connectdata *conn,
const struct ssl_connect_data *connssl = &conn->ssl[connindex];
if(connssl->backend->handle && SSL_pending(connssl->backend->handle))
return TRUE;
-#ifndef CURL_DISABLE_PROXY
- {
- const struct ssl_connect_data *proxyssl = &conn->proxy_ssl[connindex];
- if(proxyssl->backend->handle && SSL_pending(proxyssl->backend->handle))
- return TRUE;
- }
-#endif
+#ifndef CURL_DISABLE_PROXY
+ {
+ const struct ssl_connect_data *proxyssl = &conn->proxy_ssl[connindex];
+ if(proxyssl->backend->handle && SSL_pending(proxyssl->backend->handle))
+ return TRUE;
+ }
+#endif
return FALSE;
}
@@ -4144,15 +4144,15 @@ static ssize_t ossl_send(struct connectdata *conn,
int memlen;
int rc;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
ERR_clear_error();
memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len;
- rc = SSL_write(backend->handle, mem, memlen);
+ rc = SSL_write(backend->handle, mem, memlen);
if(rc <= 0) {
- err = SSL_get_error(backend->handle, rc);
+ err = SSL_get_error(backend->handle, rc);
switch(err) {
case SSL_ERROR_WANT_READ:
@@ -4163,33 +4163,33 @@ static ssize_t ossl_send(struct connectdata *conn,
*curlcode = CURLE_AGAIN;
return -1;
case SSL_ERROR_SYSCALL:
- {
- int sockerr = SOCKERRNO;
- sslerror = ERR_get_error();
- if(sslerror)
- ossl_strerror(sslerror, error_buffer, sizeof(error_buffer));
- else if(sockerr)
- Curl_strerror(sockerr, error_buffer, sizeof(error_buffer));
- else {
- strncpy(error_buffer, SSL_ERROR_to_str(err), sizeof(error_buffer));
- error_buffer[sizeof(error_buffer) - 1] = '\0';
- }
- failf(conn->data, OSSL_PACKAGE " SSL_write: %s, errno %d",
- error_buffer, sockerr);
- *curlcode = CURLE_SEND_ERROR;
- return -1;
- }
+ {
+ int sockerr = SOCKERRNO;
+ sslerror = ERR_get_error();
+ if(sslerror)
+ ossl_strerror(sslerror, error_buffer, sizeof(error_buffer));
+ else if(sockerr)
+ Curl_strerror(sockerr, error_buffer, sizeof(error_buffer));
+ else {
+ strncpy(error_buffer, SSL_ERROR_to_str(err), sizeof(error_buffer));
+ error_buffer[sizeof(error_buffer) - 1] = '\0';
+ }
+ failf(conn->data, OSSL_PACKAGE " SSL_write: %s, errno %d",
+ error_buffer, sockerr);
+ *curlcode = CURLE_SEND_ERROR;
+ return -1;
+ }
case SSL_ERROR_SSL:
/* A failure in the SSL library occurred, usually a protocol error.
The OpenSSL error queue contains more information on the error. */
sslerror = ERR_get_error();
if(ERR_GET_LIB(sslerror) == ERR_LIB_SSL &&
ERR_GET_REASON(sslerror) == SSL_R_BIO_NOT_SET &&
- conn->ssl[sockindex].state == ssl_connection_complete
-#ifndef CURL_DISABLE_PROXY
- && conn->proxy_ssl[sockindex].state == ssl_connection_complete
-#endif
- ) {
+ conn->ssl[sockindex].state == ssl_connection_complete
+#ifndef CURL_DISABLE_PROXY
+ && conn->proxy_ssl[sockindex].state == ssl_connection_complete
+#endif
+ ) {
char ver[120];
Curl_ossl_version(ver, 120);
failf(conn->data, "Error: %s does not support double SSL tunneling.",
@@ -4222,25 +4222,25 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
ssize_t nread;
int buffsize;
struct ssl_connect_data *connssl = &conn->ssl[num];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
ERR_clear_error();
buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;
- nread = (ssize_t)SSL_read(backend->handle, buf, buffsize);
+ nread = (ssize_t)SSL_read(backend->handle, buf, buffsize);
if(nread <= 0) {
/* failed SSL_read */
- int err = SSL_get_error(backend->handle, (int)nread);
+ int err = SSL_get_error(backend->handle, (int)nread);
switch(err) {
case SSL_ERROR_NONE: /* this is not an error */
break;
case SSL_ERROR_ZERO_RETURN: /* no more data */
/* close_notify alert */
- if(num == FIRSTSOCKET)
- /* mark the connection for close if it is indeed the control
- connection */
- connclose(conn, "TLS close_notify");
+ if(num == FIRSTSOCKET)
+ /* mark the connection for close if it is indeed the control
+ connection */
+ connclose(conn, "TLS close_notify");
break;
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
@@ -4255,44 +4255,44 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
if((nread < 0) || sslerror) {
/* If the return code was negative or there actually is an error in the
queue */
- int sockerr = SOCKERRNO;
- if(sslerror)
- ossl_strerror(sslerror, error_buffer, sizeof(error_buffer));
- else if(sockerr && err == SSL_ERROR_SYSCALL)
- Curl_strerror(sockerr, error_buffer, sizeof(error_buffer));
- else {
- strncpy(error_buffer, SSL_ERROR_to_str(err), sizeof(error_buffer));
- error_buffer[sizeof(error_buffer) - 1] = '\0';
- }
+ int sockerr = SOCKERRNO;
+ if(sslerror)
+ ossl_strerror(sslerror, error_buffer, sizeof(error_buffer));
+ else if(sockerr && err == SSL_ERROR_SYSCALL)
+ Curl_strerror(sockerr, error_buffer, sizeof(error_buffer));
+ else {
+ strncpy(error_buffer, SSL_ERROR_to_str(err), sizeof(error_buffer));
+ error_buffer[sizeof(error_buffer) - 1] = '\0';
+ }
failf(conn->data, OSSL_PACKAGE " SSL_read: %s, errno %d",
- error_buffer, sockerr);
+ error_buffer, sockerr);
*curlcode = CURLE_RECV_ERROR;
return -1;
}
- /* For debug builds be a little stricter and error on any
- SSL_ERROR_SYSCALL. For example a server may have closed the connection
- abruptly without a close_notify alert. For compatibility with older
- peers we don't do this by default. #4624
-
- We can use this to gauge how many users may be affected, and
- if it goes ok eventually transition to allow in dev and release with
- the newest OpenSSL: #if (OPENSSL_VERSION_NUMBER >= 0x10101000L) */
-#ifdef DEBUGBUILD
- if(err == SSL_ERROR_SYSCALL) {
- int sockerr = SOCKERRNO;
- if(sockerr)
- Curl_strerror(sockerr, error_buffer, sizeof(error_buffer));
- else {
- msnprintf(error_buffer, sizeof(error_buffer),
- "Connection closed abruptly");
- }
- failf(conn->data, OSSL_PACKAGE " SSL_read: %s, errno %d"
- " (Fatal because this is a curl debug build)",
- error_buffer, sockerr);
- *curlcode = CURLE_RECV_ERROR;
- return -1;
- }
-#endif
+ /* For debug builds be a little stricter and error on any
+ SSL_ERROR_SYSCALL. For example a server may have closed the connection
+ abruptly without a close_notify alert. For compatibility with older
+ peers we don't do this by default. #4624
+
+ We can use this to gauge how many users may be affected, and
+ if it goes ok eventually transition to allow in dev and release with
+ the newest OpenSSL: #if (OPENSSL_VERSION_NUMBER >= 0x10101000L) */
+#ifdef DEBUGBUILD
+ if(err == SSL_ERROR_SYSCALL) {
+ int sockerr = SOCKERRNO;
+ if(sockerr)
+ Curl_strerror(sockerr, error_buffer, sizeof(error_buffer));
+ else {
+ msnprintf(error_buffer, sizeof(error_buffer),
+ "Connection closed abruptly");
+ }
+ failf(conn->data, OSSL_PACKAGE " SSL_read: %s, errno %d"
+ " (Fatal because this is a curl debug build)",
+ error_buffer, sockerr);
+ *curlcode = CURLE_RECV_ERROR;
+ return -1;
+ }
+#endif
}
}
return nread;
@@ -4300,35 +4300,35 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
static size_t Curl_ossl_version(char *buffer, size_t size)
{
-#ifdef LIBRESSL_VERSION_NUMBER
-#if LIBRESSL_VERSION_NUMBER < 0x2070100fL
- return msnprintf(buffer, size, "%s/%lx.%lx.%lx",
- OSSL_PACKAGE,
- (LIBRESSL_VERSION_NUMBER>>28)&0xf,
- (LIBRESSL_VERSION_NUMBER>>20)&0xff,
- (LIBRESSL_VERSION_NUMBER>>12)&0xff);
-#else /* OpenSSL_version() first appeared in LibreSSL 2.7.1 */
- char *p;
- int count;
- const char *ver = OpenSSL_version(OPENSSL_VERSION);
- const char expected[] = OSSL_PACKAGE " "; /* ie "LibreSSL " */
- if(Curl_strncasecompare(ver, expected, sizeof(expected) - 1)) {
- ver += sizeof(expected) - 1;
- }
- count = msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver);
- for(p = buffer; *p; ++p) {
- if(ISSPACE(*p))
- *p = '_';
- }
- return count;
-#endif
-#elif defined(OPENSSL_IS_BORINGSSL)
+#ifdef LIBRESSL_VERSION_NUMBER
+#if LIBRESSL_VERSION_NUMBER < 0x2070100fL
+ return msnprintf(buffer, size, "%s/%lx.%lx.%lx",
+ OSSL_PACKAGE,
+ (LIBRESSL_VERSION_NUMBER>>28)&0xf,
+ (LIBRESSL_VERSION_NUMBER>>20)&0xff,
+ (LIBRESSL_VERSION_NUMBER>>12)&0xff);
+#else /* OpenSSL_version() first appeared in LibreSSL 2.7.1 */
+ char *p;
+ int count;
+ const char *ver = OpenSSL_version(OPENSSL_VERSION);
+ const char expected[] = OSSL_PACKAGE " "; /* ie "LibreSSL " */
+ if(Curl_strncasecompare(ver, expected, sizeof(expected) - 1)) {
+ ver += sizeof(expected) - 1;
+ }
+ count = msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver);
+ for(p = buffer; *p; ++p) {
+ if(ISSPACE(*p))
+ *p = '_';
+ }
+ return count;
+#endif
+#elif defined(OPENSSL_IS_BORINGSSL)
return msnprintf(buffer, size, OSSL_PACKAGE);
#elif defined(HAVE_OPENSSL_VERSION) && defined(OPENSSL_VERSION_STRING)
return msnprintf(buffer, size, "%s/%s",
OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING));
#else
- /* not LibreSSL, BoringSSL and not using OpenSSL_version */
+ /* not LibreSSL, BoringSSL and not using OpenSSL_version */
char sub[3];
unsigned long ssleay_value;
@@ -4396,9 +4396,9 @@ static CURLcode Curl_ossl_md5sum(unsigned char *tmp, /* input */
(void) unused;
mdctx = EVP_MD_CTX_create();
- if(!mdctx)
- return CURLE_OUT_OF_MEMORY;
- EVP_DigestInit(mdctx, EVP_md5());
+ if(!mdctx)
+ return CURLE_OUT_OF_MEMORY;
+ EVP_DigestInit(mdctx, EVP_md5());
EVP_DigestUpdate(mdctx, tmp, tmplen);
EVP_DigestFinal_ex(mdctx, md5sum, &len);
EVP_MD_CTX_destroy(mdctx);
@@ -4415,10 +4415,10 @@ static CURLcode Curl_ossl_sha256sum(const unsigned char *tmp, /* input */
unsigned int len = 0;
(void) unused;
- mdctx = EVP_MD_CTX_create();
- if(!mdctx)
- return CURLE_OUT_OF_MEMORY;
- EVP_DigestInit(mdctx, EVP_sha256());
+ mdctx = EVP_MD_CTX_create();
+ if(!mdctx)
+ return CURLE_OUT_OF_MEMORY;
+ EVP_DigestInit(mdctx, EVP_sha256());
EVP_DigestUpdate(mdctx, tmp, tmplen);
EVP_DigestFinal_ex(mdctx, sha256sum, &len);
EVP_MD_CTX_destroy(mdctx);
@@ -4440,9 +4440,9 @@ static void *Curl_ossl_get_internals(struct ssl_connect_data *connssl,
CURLINFO info)
{
/* Legacy: CURLINFO_TLS_SESSION must return an SSL_CTX pointer. */
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
return info == CURLINFO_TLS_SESSION ?
- (void *)backend->ctx : (void *)backend->handle;
+ (void *)backend->ctx : (void *)backend->handle;
}
const struct Curl_ssl Curl_ssl_openssl = {
diff --git a/contrib/libs/curl/lib/vtls/openssl.h b/contrib/libs/curl/lib/vtls/openssl.h
index 1a1b638c62..2f6e1b2db8 100644
--- a/contrib/libs/curl/lib/vtls/openssl.h
+++ b/contrib/libs/curl/lib/vtls/openssl.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vtls/schannel.c b/contrib/libs/curl/lib/vtls/schannel.c
index 2bc1d7f839..d7bc38917f 100644
--- a/contrib/libs/curl/lib/vtls/schannel.c
+++ b/contrib/libs/curl/lib/vtls/schannel.c
@@ -7,11 +7,11 @@
*
* Copyright (C) 2012 - 2016, Marc Hoersken, <info@marc-hoersken.de>
* Copyright (C) 2012, Mark Salisbury, <mark.salisbury@hp.com>
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -39,20 +39,20 @@
#include "schannel.h"
#include "vtls.h"
-#include "strcase.h"
+#include "strcase.h"
#include "sendf.h"
#include "connect.h" /* for the connect timeout */
#include "strerror.h"
-#include "select.h" /* for the socket readiness */
+#include "select.h" /* for the socket readiness */
#include "inet_pton.h" /* for IP addr SNI check */
#include "curl_multibyte.h"
#include "warnless.h"
#include "x509asn1.h"
#include "curl_printf.h"
#include "multiif.h"
-#include "version_win32.h"
+#include "version_win32.h"
-/* The last #include file should be: */
+/* The last #include file should be: */
#include "curl_memory.h"
#include "memdebug.h"
@@ -170,25 +170,25 @@ set_ssl_version_min_max(SCHANNEL_CRED *schannel_cred, struct connectdata *conn)
long i = ssl_version;
switch(ssl_version_max) {
- case CURL_SSLVERSION_MAX_NONE:
- case CURL_SSLVERSION_MAX_DEFAULT:
- ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
- break;
+ case CURL_SSLVERSION_MAX_NONE:
+ case CURL_SSLVERSION_MAX_DEFAULT:
+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
+ break;
}
for(; i <= (ssl_version_max >> 16); ++i) {
switch(i) {
- case CURL_SSLVERSION_TLSv1_0:
- schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_0_CLIENT;
- break;
- case CURL_SSLVERSION_TLSv1_1:
- schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_1_CLIENT;
- break;
- case CURL_SSLVERSION_TLSv1_2:
- schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_2_CLIENT;
- break;
- case CURL_SSLVERSION_TLSv1_3:
- failf(data, "schannel: TLS 1.3 is not yet supported");
- return CURLE_SSL_CONNECT_ERROR;
+ case CURL_SSLVERSION_TLSv1_0:
+ schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_0_CLIENT;
+ break;
+ case CURL_SSLVERSION_TLSv1_1:
+ schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_1_CLIENT;
+ break;
+ case CURL_SSLVERSION_TLSv1_2:
+ schannel_cred->grbitEnabledProtocols |= SP_PROT_TLS1_2_CLIENT;
+ break;
+ case CURL_SSLVERSION_TLSv1_3:
+ failf(data, "schannel: TLS 1.3 is not yet supported");
+ return CURLE_SSL_CONNECT_ERROR;
}
}
return CURLE_OK;
@@ -196,9 +196,9 @@ set_ssl_version_min_max(SCHANNEL_CRED *schannel_cred, struct connectdata *conn)
/*longest is 26, buffer is slightly bigger*/
#define LONGEST_ALG_ID 32
-#define CIPHEROPTION(X) \
- if(strcmp(#X, tmp) == 0) \
- return X
+#define CIPHEROPTION(X) \
+ if(strcmp(#X, tmp) == 0) \
+ return X
static int
get_alg_id_by_name(char *name)
@@ -274,11 +274,11 @@ get_alg_id_by_name(char *name)
#ifdef CALG_HMAC
CIPHEROPTION(CALG_HMAC);
#endif
-#if !defined(__W32API_MAJOR_VERSION) || \
- !defined(__W32API_MINOR_VERSION) || \
- defined(__MINGW64_VERSION_MAJOR) || \
- (__W32API_MAJOR_VERSION > 5) || \
- ((__W32API_MAJOR_VERSION == 5) && (__W32API_MINOR_VERSION > 0))
+#if !defined(__W32API_MAJOR_VERSION) || \
+ !defined(__W32API_MINOR_VERSION) || \
+ defined(__MINGW64_VERSION_MAJOR) || \
+ (__W32API_MAJOR_VERSION > 5) || \
+ ((__W32API_MAJOR_VERSION == 5) && (__W32API_MINOR_VERSION > 0))
/* CALG_TLS1PRF has a syntax error in MinGW's w32api up to version 5.0,
see https://osdn.net/projects/mingw/ticket/38391 */
CIPHEROPTION(CALG_TLS1PRF);
@@ -340,14 +340,14 @@ set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers)
if(startCur)
startCur++;
}
- schannel_cred->palgSupportedAlgs = algIds;
+ schannel_cred->palgSupportedAlgs = algIds;
schannel_cred->cSupportedAlgs = algCount;
return CURLE_OK;
}
#ifdef HAS_CLIENT_CERT_PATH
-
-/* Function allocates memory for store_path only if CURLE_OK is returned */
+
+/* Function allocates memory for store_path only if CURLE_OK is returned */
static CURLcode
get_cert_location(TCHAR *path, DWORD *store_name, TCHAR **store_path,
TCHAR **thumbprint)
@@ -390,10 +390,10 @@ get_cert_location(TCHAR *path, DWORD *store_name, TCHAR **store_path,
if(sep == NULL)
return CURLE_SSL_CERTPROBLEM;
- *thumbprint = sep + 1;
- if(_tcslen(*thumbprint) != CERT_THUMBPRINT_STR_LEN)
- return CURLE_SSL_CERTPROBLEM;
-
+ *thumbprint = sep + 1;
+ if(_tcslen(*thumbprint) != CERT_THUMBPRINT_STR_LEN)
+ return CURLE_SSL_CERTPROBLEM;
+
*sep = TEXT('\0');
*store_path = _tcsdup(store_path_start);
*sep = TEXT('\\');
@@ -420,40 +420,40 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
SCHANNEL_CRED schannel_cred;
PCCERT_CONTEXT client_certs[1] = { NULL };
SECURITY_STATUS sspi_status = SEC_E_OK;
- struct Curl_schannel_cred *old_cred = NULL;
+ struct Curl_schannel_cred *old_cred = NULL;
struct in_addr addr;
#ifdef ENABLE_IPV6
struct in6_addr addr6;
#endif
TCHAR *host_name;
CURLcode result;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
-#else
- char * const hostname = conn->host.name;
-#endif
+#else
+ char * const hostname = conn->host.name;
+#endif
DEBUGF(infof(data,
"schannel: SSL/TLS connection with %s port %hu (step 1/3)\n",
hostname, conn->remote_port));
- if(curlx_verify_windows_version(5, 1, PLATFORM_WINNT,
- VERSION_LESS_THAN_EQUAL)) {
- /* Schannel in Windows XP (OS version 5.1) uses legacy handshakes and
- algorithms that may not be supported by all servers. */
- infof(data, "schannel: Windows version is old and may not be able to "
- "connect to some servers due to lack of SNI, algorithms, etc.\n");
+ if(curlx_verify_windows_version(5, 1, PLATFORM_WINNT,
+ VERSION_LESS_THAN_EQUAL)) {
+ /* Schannel in Windows XP (OS version 5.1) uses legacy handshakes and
+ algorithms that may not be supported by all servers. */
+ infof(data, "schannel: Windows version is old and may not be able to "
+ "connect to some servers due to lack of SNI, algorithms, etc.\n");
}
#ifdef HAS_ALPN
/* ALPN is only supported on Windows 8.1 / Server 2012 R2 and above.
Also it doesn't seem to be supported for Wine, see curl bug #983. */
BACKEND->use_alpn = conn->bits.tls_enable_alpn &&
- !GetProcAddress(GetModuleHandle(TEXT("ntdll")),
- "wine_get_version") &&
- curlx_verify_windows_version(6, 3, PLATFORM_WINNT,
- VERSION_GREATER_THAN_EQUAL);
+ !GetProcAddress(GetModuleHandle(TEXT("ntdll")),
+ "wine_get_version") &&
+ curlx_verify_windows_version(6, 3, PLATFORM_WINNT,
+ VERSION_GREATER_THAN_EQUAL);
#else
BACKEND->use_alpn = false;
#endif
@@ -469,8 +469,8 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
#else
#ifdef HAS_MANUAL_VERIFY_API
if(SSL_CONN_CONFIG(CAfile)) {
- if(curlx_verify_windows_version(6, 1, PLATFORM_WINNT,
- VERSION_GREATER_THAN_EQUAL)) {
+ if(curlx_verify_windows_version(6, 1, PLATFORM_WINNT,
+ VERSION_GREATER_THAN_EQUAL)) {
BACKEND->use_manual_cred_validation = true;
}
else {
@@ -527,15 +527,15 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
DEBUGF(infof(data, "schannel: disabled server certificate revocation "
"checks\n"));
}
- else if(data->set.ssl.revoke_best_effort) {
- schannel_cred.dwFlags |= SCH_CRED_IGNORE_NO_REVOCATION_CHECK |
- SCH_CRED_IGNORE_REVOCATION_OFFLINE | SCH_CRED_REVOCATION_CHECK_CHAIN;
-
- DEBUGF(infof(data, "schannel: ignore revocation offline errors"));
- }
+ else if(data->set.ssl.revoke_best_effort) {
+ schannel_cred.dwFlags |= SCH_CRED_IGNORE_NO_REVOCATION_CHECK |
+ SCH_CRED_IGNORE_REVOCATION_OFFLINE | SCH_CRED_REVOCATION_CHECK_CHAIN;
+
+ DEBUGF(infof(data, "schannel: ignore revocation offline errors"));
+ }
else {
schannel_cred.dwFlags |= SCH_CRED_REVOCATION_CHECK_CHAIN;
-
+
DEBUGF(infof(data,
"schannel: checking server certificate revocation\n"));
}
@@ -562,12 +562,12 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
case CURL_SSLVERSION_TLSv1_1:
case CURL_SSLVERSION_TLSv1_2:
case CURL_SSLVERSION_TLSv1_3:
- {
- result = set_ssl_version_min_max(&schannel_cred, conn);
- if(result != CURLE_OK)
- return result;
- break;
- }
+ {
+ result = set_ssl_version_min_max(&schannel_cred, conn);
+ if(result != CURLE_OK)
+ return result;
+ break;
+ }
case CURL_SSLVERSION_SSLv3:
schannel_cred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT;
break;
@@ -590,199 +590,199 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
#ifdef HAS_CLIENT_CERT_PATH
/* client certificate */
- if(data->set.ssl.primary.clientcert || data->set.ssl.primary.cert_blob) {
- DWORD cert_store_name = 0;
- TCHAR *cert_store_path = NULL;
- TCHAR *cert_thumbprint_str = NULL;
+ if(data->set.ssl.primary.clientcert || data->set.ssl.primary.cert_blob) {
+ DWORD cert_store_name = 0;
+ TCHAR *cert_store_path = NULL;
+ TCHAR *cert_thumbprint_str = NULL;
CRYPT_HASH_BLOB cert_thumbprint;
BYTE cert_thumbprint_data[CERT_THUMBPRINT_DATA_LEN];
- HCERTSTORE cert_store = NULL;
- FILE *fInCert = NULL;
- void *certdata = NULL;
- size_t certsize = 0;
- bool blob = data->set.ssl.primary.cert_blob != NULL;
- TCHAR *cert_path = NULL;
- if(blob) {
- certdata = data->set.ssl.primary.cert_blob->data;
- certsize = data->set.ssl.primary.cert_blob->len;
- }
- else {
- cert_path = curlx_convert_UTF8_to_tchar(
- data->set.ssl.primary.clientcert);
- if(!cert_path)
- return CURLE_OUT_OF_MEMORY;
-
- result = get_cert_location(cert_path, &cert_store_name,
- &cert_store_path, &cert_thumbprint_str);
-
- if(result && (data->set.ssl.primary.clientcert[0]!='\0'))
- fInCert = fopen(data->set.ssl.primary.clientcert, "rb");
-
- if(result && !fInCert) {
- failf(data, "schannel: Failed to get certificate location"
- " or file for %s",
- data->set.ssl.primary.clientcert);
- curlx_unicodefree(cert_path);
- return result;
- }
+ HCERTSTORE cert_store = NULL;
+ FILE *fInCert = NULL;
+ void *certdata = NULL;
+ size_t certsize = 0;
+ bool blob = data->set.ssl.primary.cert_blob != NULL;
+ TCHAR *cert_path = NULL;
+ if(blob) {
+ certdata = data->set.ssl.primary.cert_blob->data;
+ certsize = data->set.ssl.primary.cert_blob->len;
+ }
+ else {
+ cert_path = curlx_convert_UTF8_to_tchar(
+ data->set.ssl.primary.clientcert);
+ if(!cert_path)
+ return CURLE_OUT_OF_MEMORY;
+
+ result = get_cert_location(cert_path, &cert_store_name,
+ &cert_store_path, &cert_thumbprint_str);
+
+ if(result && (data->set.ssl.primary.clientcert[0]!='\0'))
+ fInCert = fopen(data->set.ssl.primary.clientcert, "rb");
+
+ if(result && !fInCert) {
+ failf(data, "schannel: Failed to get certificate location"
+ " or file for %s",
+ data->set.ssl.primary.clientcert);
+ curlx_unicodefree(cert_path);
+ return result;
+ }
}
- if((fInCert || blob) && (data->set.ssl.cert_type) &&
- (!strcasecompare(data->set.ssl.cert_type, "P12"))) {
- failf(data, "schannel: certificate format compatibility error "
- " for %s",
- blob ? "(memory blob)" : data->set.ssl.primary.clientcert);
- curlx_unicodefree(cert_path);
+ if((fInCert || blob) && (data->set.ssl.cert_type) &&
+ (!strcasecompare(data->set.ssl.cert_type, "P12"))) {
+ failf(data, "schannel: certificate format compatibility error "
+ " for %s",
+ blob ? "(memory blob)" : data->set.ssl.primary.clientcert);
+ curlx_unicodefree(cert_path);
return CURLE_SSL_CERTPROBLEM;
}
- if(fInCert || blob) {
- /* Reading a .P12 or .pfx file, like the example at bottom of
- https://social.msdn.microsoft.com/Forums/windowsdesktop/
- en-US/3e7bc95f-b21a-4bcd-bd2c-7f996718cae5
- */
- CRYPT_DATA_BLOB datablob;
- WCHAR* pszPassword;
- size_t pwd_len = 0;
- int str_w_len = 0;
- const char *cert_showfilename_error = blob ?
- "(memory blob)" : data->set.ssl.primary.clientcert;
- curlx_unicodefree(cert_path);
- if(fInCert) {
- long cert_tell = 0;
- bool continue_reading = fseek(fInCert, 0, SEEK_END) == 0;
- if(continue_reading)
- cert_tell = ftell(fInCert);
- if(cert_tell < 0)
- continue_reading = FALSE;
- else
- certsize = (size_t)cert_tell;
- if(continue_reading)
- continue_reading = fseek(fInCert, 0, SEEK_SET) == 0;
- if(continue_reading)
- certdata = malloc(certsize + 1);
- if((!certdata) ||
- ((int) fread(certdata, certsize, 1, fInCert) != 1))
- continue_reading = FALSE;
- fclose(fInCert);
- if(!continue_reading) {
- failf(data, "schannel: Failed to read cert file %s",
- data->set.ssl.primary.clientcert);
- free(certdata);
- return CURLE_SSL_CERTPROBLEM;
- }
- }
-
- /* Convert key-pair data to the in-memory certificate store */
- datablob.pbData = (BYTE*)certdata;
- datablob.cbData = (DWORD)certsize;
-
- if(data->set.ssl.key_passwd != NULL)
- pwd_len = strlen(data->set.ssl.key_passwd);
- pszPassword = (WCHAR*)malloc(sizeof(WCHAR)*(pwd_len + 1));
- if(pszPassword) {
- if(pwd_len > 0)
- str_w_len = MultiByteToWideChar(CP_UTF8,
- MB_ERR_INVALID_CHARS,
- data->set.ssl.key_passwd, (int)pwd_len,
- pszPassword, (int)(pwd_len + 1));
-
- if((str_w_len >= 0) && (str_w_len <= (int)pwd_len))
- pszPassword[str_w_len] = 0;
- else
- pszPassword[0] = 0;
-
- cert_store = PFXImportCertStore(&datablob, pszPassword, 0);
- free(pszPassword);
- }
- if(!blob)
- free(certdata);
- if(cert_store == NULL) {
- DWORD errorcode = GetLastError();
- if(errorcode == ERROR_INVALID_PASSWORD)
- failf(data, "schannel: Failed to import cert file %s, "
- "password is bad",
- cert_showfilename_error);
- else
- failf(data, "schannel: Failed to import cert file %s, "
- "last error is 0x%x",
- cert_showfilename_error, errorcode);
- return CURLE_SSL_CERTPROBLEM;
- }
-
- client_certs[0] = CertFindCertificateInStore(
- cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
- CERT_FIND_ANY, NULL, NULL);
-
- if(client_certs[0] == NULL) {
- failf(data, "schannel: Failed to get certificate from file %s"
- ", last error is 0x%x",
- cert_showfilename_error, GetLastError());
- CertCloseStore(cert_store, 0);
- return CURLE_SSL_CERTPROBLEM;
- }
-
+ if(fInCert || blob) {
+ /* Reading a .P12 or .pfx file, like the example at bottom of
+ https://social.msdn.microsoft.com/Forums/windowsdesktop/
+ en-US/3e7bc95f-b21a-4bcd-bd2c-7f996718cae5
+ */
+ CRYPT_DATA_BLOB datablob;
+ WCHAR* pszPassword;
+ size_t pwd_len = 0;
+ int str_w_len = 0;
+ const char *cert_showfilename_error = blob ?
+ "(memory blob)" : data->set.ssl.primary.clientcert;
+ curlx_unicodefree(cert_path);
+ if(fInCert) {
+ long cert_tell = 0;
+ bool continue_reading = fseek(fInCert, 0, SEEK_END) == 0;
+ if(continue_reading)
+ cert_tell = ftell(fInCert);
+ if(cert_tell < 0)
+ continue_reading = FALSE;
+ else
+ certsize = (size_t)cert_tell;
+ if(continue_reading)
+ continue_reading = fseek(fInCert, 0, SEEK_SET) == 0;
+ if(continue_reading)
+ certdata = malloc(certsize + 1);
+ if((!certdata) ||
+ ((int) fread(certdata, certsize, 1, fInCert) != 1))
+ continue_reading = FALSE;
+ fclose(fInCert);
+ if(!continue_reading) {
+ failf(data, "schannel: Failed to read cert file %s",
+ data->set.ssl.primary.clientcert);
+ free(certdata);
+ return CURLE_SSL_CERTPROBLEM;
+ }
+ }
+
+ /* Convert key-pair data to the in-memory certificate store */
+ datablob.pbData = (BYTE*)certdata;
+ datablob.cbData = (DWORD)certsize;
+
+ if(data->set.ssl.key_passwd != NULL)
+ pwd_len = strlen(data->set.ssl.key_passwd);
+ pszPassword = (WCHAR*)malloc(sizeof(WCHAR)*(pwd_len + 1));
+ if(pszPassword) {
+ if(pwd_len > 0)
+ str_w_len = MultiByteToWideChar(CP_UTF8,
+ MB_ERR_INVALID_CHARS,
+ data->set.ssl.key_passwd, (int)pwd_len,
+ pszPassword, (int)(pwd_len + 1));
+
+ if((str_w_len >= 0) && (str_w_len <= (int)pwd_len))
+ pszPassword[str_w_len] = 0;
+ else
+ pszPassword[0] = 0;
+
+ cert_store = PFXImportCertStore(&datablob, pszPassword, 0);
+ free(pszPassword);
+ }
+ if(!blob)
+ free(certdata);
+ if(cert_store == NULL) {
+ DWORD errorcode = GetLastError();
+ if(errorcode == ERROR_INVALID_PASSWORD)
+ failf(data, "schannel: Failed to import cert file %s, "
+ "password is bad",
+ cert_showfilename_error);
+ else
+ failf(data, "schannel: Failed to import cert file %s, "
+ "last error is 0x%x",
+ cert_showfilename_error, errorcode);
+ return CURLE_SSL_CERTPROBLEM;
+ }
+
+ client_certs[0] = CertFindCertificateInStore(
+ cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
+ CERT_FIND_ANY, NULL, NULL);
+
+ if(client_certs[0] == NULL) {
+ failf(data, "schannel: Failed to get certificate from file %s"
+ ", last error is 0x%x",
+ cert_showfilename_error, GetLastError());
+ CertCloseStore(cert_store, 0);
+ return CURLE_SSL_CERTPROBLEM;
+ }
+
schannel_cred.cCreds = 1;
schannel_cred.paCred = client_certs;
}
else {
- cert_store =
- CertOpenStore(CURL_CERT_STORE_PROV_SYSTEM, 0,
- (HCRYPTPROV)NULL,
- CERT_STORE_OPEN_EXISTING_FLAG | cert_store_name,
- cert_store_path);
- if(!cert_store) {
- failf(data, "schannel: Failed to open cert store %x %s, "
- "last error is 0x%x",
- cert_store_name, cert_store_path, GetLastError());
- free(cert_store_path);
- curlx_unicodefree(cert_path);
- return CURLE_SSL_CERTPROBLEM;
- }
- free(cert_store_path);
-
- cert_thumbprint.pbData = cert_thumbprint_data;
- cert_thumbprint.cbData = CERT_THUMBPRINT_DATA_LEN;
-
- if(!CryptStringToBinary(cert_thumbprint_str,
- CERT_THUMBPRINT_STR_LEN,
- CRYPT_STRING_HEX,
- cert_thumbprint_data,
- &cert_thumbprint.cbData,
- NULL, NULL)) {
- curlx_unicodefree(cert_path);
- CertCloseStore(cert_store, 0);
- return CURLE_SSL_CERTPROBLEM;
- }
-
- client_certs[0] = CertFindCertificateInStore(
- cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
- CERT_FIND_HASH, &cert_thumbprint, NULL);
-
- curlx_unicodefree(cert_path);
-
- if(client_certs[0]) {
- schannel_cred.cCreds = 1;
- schannel_cred.paCred = client_certs;
- }
- else {
- /* CRYPT_E_NOT_FOUND / E_INVALIDARG */
- CertCloseStore(cert_store, 0);
- return CURLE_SSL_CERTPROBLEM;
- }
+ cert_store =
+ CertOpenStore(CURL_CERT_STORE_PROV_SYSTEM, 0,
+ (HCRYPTPROV)NULL,
+ CERT_STORE_OPEN_EXISTING_FLAG | cert_store_name,
+ cert_store_path);
+ if(!cert_store) {
+ failf(data, "schannel: Failed to open cert store %x %s, "
+ "last error is 0x%x",
+ cert_store_name, cert_store_path, GetLastError());
+ free(cert_store_path);
+ curlx_unicodefree(cert_path);
+ return CURLE_SSL_CERTPROBLEM;
+ }
+ free(cert_store_path);
+
+ cert_thumbprint.pbData = cert_thumbprint_data;
+ cert_thumbprint.cbData = CERT_THUMBPRINT_DATA_LEN;
+
+ if(!CryptStringToBinary(cert_thumbprint_str,
+ CERT_THUMBPRINT_STR_LEN,
+ CRYPT_STRING_HEX,
+ cert_thumbprint_data,
+ &cert_thumbprint.cbData,
+ NULL, NULL)) {
+ curlx_unicodefree(cert_path);
+ CertCloseStore(cert_store, 0);
+ return CURLE_SSL_CERTPROBLEM;
+ }
+
+ client_certs[0] = CertFindCertificateInStore(
+ cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
+ CERT_FIND_HASH, &cert_thumbprint, NULL);
+
+ curlx_unicodefree(cert_path);
+
+ if(client_certs[0]) {
+ schannel_cred.cCreds = 1;
+ schannel_cred.paCred = client_certs;
+ }
+ else {
+ /* CRYPT_E_NOT_FOUND / E_INVALIDARG */
+ CertCloseStore(cert_store, 0);
+ return CURLE_SSL_CERTPROBLEM;
+ }
}
CertCloseStore(cert_store, 0);
}
#else
- if(data->set.ssl.primary.clientcert || data->set.ssl.primary.cert_blob) {
+ if(data->set.ssl.primary.clientcert || data->set.ssl.primary.cert_blob) {
failf(data, "schannel: client cert support not built in");
return CURLE_NOT_BUILT_IN;
}
#endif
/* allocate memory for the re-usable credential handle */
- BACKEND->cred = (struct Curl_schannel_cred *)
- calloc(1, sizeof(struct Curl_schannel_cred));
+ BACKEND->cred = (struct Curl_schannel_cred *)
+ calloc(1, sizeof(struct Curl_schannel_cred));
if(!BACKEND->cred) {
failf(data, "schannel: unable to allocate memory");
@@ -794,7 +794,7 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
BACKEND->cred->refcount = 1;
/* https://msdn.microsoft.com/en-us/library/windows/desktop/aa374716.aspx
- */
+ */
sspi_status =
s_pSecFn->AcquireCredentialsHandle(NULL, (TCHAR *)UNISP_NAME,
SECPKG_CRED_OUTBOUND, NULL,
@@ -811,15 +811,15 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
Curl_safefree(BACKEND->cred);
switch(sspi_status) {
- case SEC_E_INSUFFICIENT_MEMORY:
- return CURLE_OUT_OF_MEMORY;
- case SEC_E_NO_CREDENTIALS:
- case SEC_E_SECPKG_NOT_FOUND:
- case SEC_E_NOT_OWNER:
- case SEC_E_UNKNOWN_CREDENTIALS:
- case SEC_E_INTERNAL_ERROR:
- default:
- return CURLE_SSL_CONNECT_ERROR;
+ case SEC_E_INSUFFICIENT_MEMORY:
+ return CURLE_OUT_OF_MEMORY;
+ case SEC_E_NO_CREDENTIALS:
+ case SEC_E_SECPKG_NOT_FOUND:
+ case SEC_E_NOT_OWNER:
+ case SEC_E_UNKNOWN_CREDENTIALS:
+ case SEC_E_INTERNAL_ERROR:
+ default:
+ return CURLE_SSL_CONNECT_ERROR;
}
}
}
@@ -841,7 +841,7 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
unsigned short* list_len = NULL;
/* The first four bytes will be an unsigned int indicating number
- of bytes of data in the rest of the buffer. */
+ of bytes of data in the rest of the buffer. */
extension_len = (unsigned int *)(&alpn_buffer[cur]);
cur += sizeof(unsigned int);
@@ -896,14 +896,14 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
ISC_REQ_STREAM;
/* allocate memory for the security context handle */
- BACKEND->ctxt = (struct Curl_schannel_ctxt *)
- calloc(1, sizeof(struct Curl_schannel_ctxt));
+ BACKEND->ctxt = (struct Curl_schannel_ctxt *)
+ calloc(1, sizeof(struct Curl_schannel_ctxt));
if(!BACKEND->ctxt) {
failf(data, "schannel: unable to allocate memory");
return CURLE_OUT_OF_MEMORY;
}
- host_name = curlx_convert_UTF8_to_tchar(hostname);
+ host_name = curlx_convert_UTF8_to_tchar(hostname);
if(!host_name)
return CURLE_OUT_OF_MEMORY;
@@ -920,35 +920,35 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
0, &BACKEND->ctxt->ctxt_handle,
&outbuf_desc, &BACKEND->ret_flags, &BACKEND->ctxt->time_stamp);
- curlx_unicodefree(host_name);
+ curlx_unicodefree(host_name);
if(sspi_status != SEC_I_CONTINUE_NEEDED) {
char buffer[STRERROR_LEN];
Curl_safefree(BACKEND->ctxt);
switch(sspi_status) {
- case SEC_E_INSUFFICIENT_MEMORY:
- failf(data, "schannel: initial InitializeSecurityContext failed: %s",
- Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
- return CURLE_OUT_OF_MEMORY;
- case SEC_E_WRONG_PRINCIPAL:
- failf(data, "schannel: SNI or certificate check failed: %s",
- Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
- return CURLE_PEER_FAILED_VERIFICATION;
- /*
- case SEC_E_INVALID_HANDLE:
- case SEC_E_INVALID_TOKEN:
- case SEC_E_LOGON_DENIED:
- case SEC_E_TARGET_UNKNOWN:
- case SEC_E_NO_AUTHENTICATING_AUTHORITY:
- case SEC_E_INTERNAL_ERROR:
- case SEC_E_NO_CREDENTIALS:
- case SEC_E_UNSUPPORTED_FUNCTION:
- case SEC_E_APPLICATION_PROTOCOL_MISMATCH:
- */
- default:
- failf(data, "schannel: initial InitializeSecurityContext failed: %s",
- Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
- return CURLE_SSL_CONNECT_ERROR;
+ case SEC_E_INSUFFICIENT_MEMORY:
+ failf(data, "schannel: initial InitializeSecurityContext failed: %s",
+ Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
+ return CURLE_OUT_OF_MEMORY;
+ case SEC_E_WRONG_PRINCIPAL:
+ failf(data, "schannel: SNI or certificate check failed: %s",
+ Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
+ return CURLE_PEER_FAILED_VERIFICATION;
+ /*
+ case SEC_E_INVALID_HANDLE:
+ case SEC_E_INVALID_TOKEN:
+ case SEC_E_LOGON_DENIED:
+ case SEC_E_TARGET_UNKNOWN:
+ case SEC_E_NO_AUTHENTICATING_AUTHORITY:
+ case SEC_E_INTERNAL_ERROR:
+ case SEC_E_NO_CREDENTIALS:
+ case SEC_E_UNSUPPORTED_FUNCTION:
+ case SEC_E_APPLICATION_PROTOCOL_MISMATCH:
+ */
+ default:
+ failf(data, "schannel: initial InitializeSecurityContext failed: %s",
+ Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
+ return CURLE_SSL_CONNECT_ERROR;
}
}
@@ -994,12 +994,12 @@ schannel_connect_step2(struct connectdata *conn, int sockindex)
SECURITY_STATUS sspi_status = SEC_E_OK;
CURLcode result;
bool doread;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
-#else
- char * const hostname = conn->host.name;
-#endif
+#else
+ char * const hostname = conn->host.name;
+#endif
const char *pubkey_ptr;
doread = (connssl->connecting_state != ssl_connect_2_writing) ? TRUE : FALSE;
@@ -1107,18 +1107,18 @@ schannel_connect_step2(struct connectdata *conn, int sockindex)
memcpy(inbuf[0].pvBuffer, BACKEND->encdata_buffer,
BACKEND->encdata_offset);
- host_name = curlx_convert_UTF8_to_tchar(hostname);
+ host_name = curlx_convert_UTF8_to_tchar(hostname);
if(!host_name)
return CURLE_OUT_OF_MEMORY;
/* https://msdn.microsoft.com/en-us/library/windows/desktop/aa375924.aspx
- */
+ */
sspi_status = s_pSecFn->InitializeSecurityContext(
&BACKEND->cred->cred_handle, &BACKEND->ctxt->ctxt_handle,
host_name, BACKEND->req_flags, 0, 0, &inbuf_desc, 0, NULL,
&outbuf_desc, &BACKEND->ret_flags, &BACKEND->ctxt->time_stamp);
- curlx_unicodefree(host_name);
+ curlx_unicodefree(host_name);
/* free buffer for received handshake data */
Curl_safefree(inbuf[0].pvBuffer);
@@ -1173,33 +1173,33 @@ schannel_connect_step2(struct connectdata *conn, int sockindex)
else {
char buffer[STRERROR_LEN];
switch(sspi_status) {
- case SEC_E_INSUFFICIENT_MEMORY:
- failf(data, "schannel: next InitializeSecurityContext failed: %s",
- Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
- return CURLE_OUT_OF_MEMORY;
- case SEC_E_WRONG_PRINCIPAL:
- failf(data, "schannel: SNI or certificate check failed: %s",
- Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
- return CURLE_PEER_FAILED_VERIFICATION;
- case SEC_E_UNTRUSTED_ROOT:
- failf(data, "schannel: %s",
- Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
- return CURLE_PEER_FAILED_VERIFICATION;
- /*
- case SEC_E_INVALID_HANDLE:
- case SEC_E_INVALID_TOKEN:
- case SEC_E_LOGON_DENIED:
- case SEC_E_TARGET_UNKNOWN:
- case SEC_E_NO_AUTHENTICATING_AUTHORITY:
- case SEC_E_INTERNAL_ERROR:
- case SEC_E_NO_CREDENTIALS:
- case SEC_E_UNSUPPORTED_FUNCTION:
- case SEC_E_APPLICATION_PROTOCOL_MISMATCH:
- */
- default:
- failf(data, "schannel: next InitializeSecurityContext failed: %s",
- Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
- return CURLE_SSL_CONNECT_ERROR;
+ case SEC_E_INSUFFICIENT_MEMORY:
+ failf(data, "schannel: next InitializeSecurityContext failed: %s",
+ Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
+ return CURLE_OUT_OF_MEMORY;
+ case SEC_E_WRONG_PRINCIPAL:
+ failf(data, "schannel: SNI or certificate check failed: %s",
+ Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
+ return CURLE_PEER_FAILED_VERIFICATION;
+ case SEC_E_UNTRUSTED_ROOT:
+ failf(data, "schannel: %s",
+ Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
+ return CURLE_PEER_FAILED_VERIFICATION;
+ /*
+ case SEC_E_INVALID_HANDLE:
+ case SEC_E_INVALID_TOKEN:
+ case SEC_E_LOGON_DENIED:
+ case SEC_E_TARGET_UNKNOWN:
+ case SEC_E_NO_AUTHENTICATING_AUTHORITY:
+ case SEC_E_INTERNAL_ERROR:
+ case SEC_E_NO_CREDENTIALS:
+ case SEC_E_UNSUPPORTED_FUNCTION:
+ case SEC_E_APPLICATION_PROTOCOL_MISMATCH:
+ */
+ default:
+ failf(data, "schannel: next InitializeSecurityContext failed: %s",
+ Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
+ return CURLE_SSL_CONNECT_ERROR;
}
}
@@ -1308,7 +1308,7 @@ struct Adder_args
struct connectdata *conn;
CURLcode result;
int idx;
- int certs_count;
+ int certs_count;
};
static bool
@@ -1319,9 +1319,9 @@ add_cert_to_certinfo(const CERT_CONTEXT *ccert_context, void *raw_arg)
if(valid_cert_encoding(ccert_context)) {
const char *beg = (const char *) ccert_context->pbCertEncoded;
const char *end = beg + ccert_context->cbCertEncoded;
- int insert_index = (args->certs_count - 1) - args->idx;
- args->result = Curl_extract_certinfo(args->conn, insert_index, beg, end);
- args->idx++;
+ int insert_index = (args->certs_count - 1) - args->idx;
+ args->result = Curl_extract_certinfo(args->conn, insert_index, beg, end);
+ args->idx++;
}
return args->result == CURLE_OK;
}
@@ -1368,10 +1368,10 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
#ifdef HAS_ALPN
if(BACKEND->use_alpn) {
- sspi_status =
- s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle,
- SECPKG_ATTR_APPLICATION_PROTOCOL,
- &alpn_result);
+ sspi_status =
+ s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle,
+ SECPKG_ATTR_APPLICATION_PROTOCOL,
+ &alpn_result);
if(sspi_status != SEC_E_OK) {
failf(data, "schannel: failed to retrieve ALPN result");
@@ -1382,21 +1382,21 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
SecApplicationProtocolNegotiationStatus_Success) {
infof(data, "schannel: ALPN, server accepted to use %.*s\n",
- alpn_result.ProtocolIdSize, alpn_result.ProtocolId);
+ alpn_result.ProtocolIdSize, alpn_result.ProtocolId);
#ifdef USE_NGHTTP2
if(alpn_result.ProtocolIdSize == NGHTTP2_PROTO_VERSION_ID_LEN &&
!memcmp(NGHTTP2_PROTO_VERSION_ID, alpn_result.ProtocolId,
- NGHTTP2_PROTO_VERSION_ID_LEN)) {
+ NGHTTP2_PROTO_VERSION_ID_LEN)) {
conn->negnpn = CURL_HTTP_VERSION_2;
}
else
#endif
- if(alpn_result.ProtocolIdSize == ALPN_HTTP_1_1_LENGTH &&
- !memcmp(ALPN_HTTP_1_1, alpn_result.ProtocolId,
- ALPN_HTTP_1_1_LENGTH)) {
- conn->negnpn = CURL_HTTP_VERSION_1_1;
- }
+ if(alpn_result.ProtocolIdSize == ALPN_HTTP_1_1_LENGTH &&
+ !memcmp(ALPN_HTTP_1_1, alpn_result.ProtocolId,
+ ALPN_HTTP_1_1_LENGTH)) {
+ conn->negnpn = CURL_HTTP_VERSION_1_1;
+ }
}
else
infof(data, "ALPN, server did not agree to a protocol\n");
@@ -1408,7 +1408,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
/* save the current session data for possible re-use */
if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
- struct Curl_schannel_cred *old_cred = NULL;
+ struct Curl_schannel_cred *old_cred = NULL;
Curl_ssl_sessionid_lock(conn);
incache = !(Curl_ssl_getsessionid(conn, (void **)&old_cred, NULL,
@@ -1424,7 +1424,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
}
if(!incache) {
result = Curl_ssl_addsessionid(conn, (void *)BACKEND->cred,
- sizeof(struct Curl_schannel_cred),
+ sizeof(struct Curl_schannel_cred),
sockindex);
if(result) {
Curl_ssl_sessionid_unlock(conn);
@@ -1443,10 +1443,10 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
if(data->set.ssl.certinfo) {
int certs_count = 0;
- sspi_status =
- s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle,
- SECPKG_ATTR_REMOTE_CERT_CONTEXT,
- &ccert_context);
+ sspi_status =
+ s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle,
+ SECPKG_ATTR_REMOTE_CERT_CONTEXT,
+ &ccert_context);
if((sspi_status != SEC_E_OK) || (ccert_context == NULL)) {
failf(data, "schannel: failed to retrieve remote cert context");
@@ -1460,7 +1460,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
struct Adder_args args;
args.conn = conn;
args.idx = 0;
- args.certs_count = certs_count;
+ args.certs_count = certs_count;
traverse_cert_store(ccert_context, add_cert_to_certinfo, &args);
result = args.result;
}
@@ -1482,7 +1482,7 @@ schannel_connect_common(struct connectdata *conn, int sockindex,
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
curl_socket_t sockfd = conn->sock[sockindex];
- timediff_t timeout_ms;
+ timediff_t timeout_ms;
int what;
/* check if the connection has already been established */
@@ -1678,10 +1678,10 @@ schannel_send(struct connectdata *conn, int sockindex,
/* send entire message or fail */
while(len > (size_t)written) {
- ssize_t this_write = 0;
+ ssize_t this_write = 0;
int what;
- timediff_t timeout_ms = Curl_timeleft(conn->data, NULL, FALSE);
- if(timeout_ms < 0) {
+ timediff_t timeout_ms = Curl_timeleft(conn->data, NULL, FALSE);
+ if(timeout_ms < 0) {
/* we already got the timeout */
failf(conn->data, "schannel: timed out sending data "
"(bytes sent: %zd)", written);
@@ -1689,9 +1689,9 @@ schannel_send(struct connectdata *conn, int sockindex,
written = -1;
break;
}
- else if(!timeout_ms)
- timeout_ms = TIMEDIFF_T_MAX;
- what = SOCKET_WRITABLE(conn->sock[sockindex], timeout_ms);
+ else if(!timeout_ms)
+ timeout_ms = TIMEDIFF_T_MAX;
+ what = SOCKET_WRITABLE(conn->sock[sockindex], timeout_ms);
if(what < 0) {
/* fatal error */
failf(conn->data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
@@ -1785,8 +1785,8 @@ schannel_recv(struct connectdata *conn, int sockindex,
}
else if(!len) {
/* It's debatable what to return when !len. Regardless we can't return
- immediately because there may be data to decrypt (in the case we want to
- decrypt all encrypted cached data) so handle !len later in cleanup.
+ immediately because there may be data to decrypt (in the case we want to
+ decrypt all encrypted cached data) so handle !len later in cleanup.
*/
; /* do nothing */
}
@@ -1796,7 +1796,7 @@ schannel_recv(struct connectdata *conn, int sockindex,
if(size < CURL_SCHANNEL_BUFFER_FREE_SIZE ||
BACKEND->encdata_length < min_encdata_length) {
reallocated_length = BACKEND->encdata_offset +
- CURL_SCHANNEL_BUFFER_FREE_SIZE;
+ CURL_SCHANNEL_BUFFER_FREE_SIZE;
if(reallocated_length < min_encdata_length) {
reallocated_length = min_encdata_length;
}
@@ -1864,7 +1864,7 @@ schannel_recv(struct connectdata *conn, int sockindex,
InitSecBufferDesc(&inbuf_desc, inbuf, 4);
/* https://msdn.microsoft.com/en-us/library/windows/desktop/aa375348.aspx
- */
+ */
sspi_status = s_pSecFn->DecryptMessage(&BACKEND->ctxt->ctxt_handle,
&inbuf_desc, 0, NULL);
@@ -1880,7 +1880,7 @@ schannel_recv(struct connectdata *conn, int sockindex,
/* increase buffer in order to fit the received amount of data */
size = inbuf[1].cbBuffer > CURL_SCHANNEL_BUFFER_FREE_SIZE ?
- inbuf[1].cbBuffer : CURL_SCHANNEL_BUFFER_FREE_SIZE;
+ inbuf[1].cbBuffer : CURL_SCHANNEL_BUFFER_FREE_SIZE;
if(BACKEND->decdata_length - BACKEND->decdata_offset < size ||
BACKEND->decdata_length < len) {
/* increase internal decrypted data buffer */
@@ -1950,7 +1950,7 @@ schannel_recv(struct connectdata *conn, int sockindex,
if(BACKEND->encdata_offset) {
*err = CURLE_RECV_ERROR;
infof(data, "schannel: can't renogotiate, "
- "encrypted data available\n");
+ "encrypted data available\n");
goto cleanup;
}
/* begin renegotiation */
@@ -1987,9 +1987,9 @@ schannel_recv(struct connectdata *conn, int sockindex,
goto cleanup;
}
else {
-#ifndef CURL_DISABLE_VERBOSE_STRINGS
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
char buffer[STRERROR_LEN];
-#endif
+#endif
*err = CURLE_RECV_ERROR;
infof(data, "schannel: failed to read data from server: %s\n",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
@@ -2005,25 +2005,25 @@ schannel_recv(struct connectdata *conn, int sockindex,
"schannel: decrypted data buffer: offset %zu length %zu\n",
BACKEND->decdata_offset, BACKEND->decdata_length));
- cleanup:
+ cleanup:
/* Warning- there is no guarantee the encdata state is valid at this point */
DEBUGF(infof(data, "schannel: schannel_recv cleanup\n"));
/* Error if the connection has closed without a close_notify.
-
- The behavior here is a matter of debate. We don't want to be vulnerable
- to a truncation attack however there's some browser precedent for
- ignoring the close_notify for compatibility reasons.
-
- Additionally, Windows 2000 (v5.0) is a special case since it seems it
- doesn't return close_notify. In that case if the connection was closed we
- assume it was graceful (close_notify) since there doesn't seem to be a
- way to tell.
+
+ The behavior here is a matter of debate. We don't want to be vulnerable
+ to a truncation attack however there's some browser precedent for
+ ignoring the close_notify for compatibility reasons.
+
+ Additionally, Windows 2000 (v5.0) is a special case since it seems it
+ doesn't return close_notify. In that case if the connection was closed we
+ assume it was graceful (close_notify) since there doesn't seem to be a
+ way to tell.
*/
if(len && !BACKEND->decdata_offset && BACKEND->recv_connection_closed &&
!BACKEND->recv_sspi_close_notify) {
- bool isWin2k = curlx_verify_windows_version(5, 0, PLATFORM_WINNT,
- VERSION_EQUAL);
+ bool isWin2k = curlx_verify_windows_version(5, 0, PLATFORM_WINNT,
+ VERSION_EQUAL);
if(isWin2k && sspi_status == SEC_E_OK)
BACKEND->recv_sspi_close_notify = true;
@@ -2035,7 +2035,7 @@ schannel_recv(struct connectdata *conn, int sockindex,
/* Any error other than CURLE_AGAIN is an unrecoverable error. */
if(*err && *err != CURLE_AGAIN)
- BACKEND->recv_unrecoverable_err = *err;
+ BACKEND->recv_unrecoverable_err = *err;
size = len < BACKEND->decdata_offset ? len : BACKEND->decdata_offset;
if(size) {
@@ -2052,11 +2052,11 @@ schannel_recv(struct connectdata *conn, int sockindex,
}
if(!*err && !BACKEND->recv_connection_closed)
- *err = CURLE_AGAIN;
+ *err = CURLE_AGAIN;
- /* It's debatable what to return when !len. We could return whatever error
- we got from decryption but instead we override here so the return is
- consistent.
+ /* It's debatable what to return when !len. We could return whatever error
+ we got from decryption but instead we override here so the return is
+ consistent.
*/
if(!len)
*err = CURLE_OK;
@@ -2106,7 +2106,7 @@ static void Curl_schannel_close(struct connectdata *conn, int sockindex)
static void Curl_schannel_session_free(void *ptr)
{
/* this is expected to be called under sessionid lock */
- struct Curl_schannel_cred *cred = ptr;
+ struct Curl_schannel_cred *cred = ptr;
cred->refcount--;
if(cred->refcount == 0) {
@@ -2122,12 +2122,12 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex)
*/
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
-#else
- char * const hostname = conn->host.name;
-#endif
+#else
+ char * const hostname = conn->host.name;
+#endif
DEBUGASSERT(data);
@@ -2156,7 +2156,7 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex)
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
}
- host_name = curlx_convert_UTF8_to_tchar(hostname);
+ host_name = curlx_convert_UTF8_to_tchar(hostname);
if(!host_name)
return CURLE_OUT_OF_MEMORY;
@@ -2178,7 +2178,7 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex)
&BACKEND->ret_flags,
&BACKEND->ctxt->time_stamp);
- curlx_unicodefree(host_name);
+ curlx_unicodefree(host_name);
if((sspi_status == SEC_E_OK) || (sspi_status == SEC_I_CONTEXT_EXPIRED)) {
/* send close message which is in output buffer */
@@ -2287,8 +2287,8 @@ static CURLcode pkp_pin_peer_pubkey(struct connectdata *conn, int sockindex,
SECURITY_STATUS sspi_status;
const char *x509_der;
DWORD x509_der_len;
- struct Curl_X509certificate x509_parsed;
- struct Curl_asn1Element *pubkey;
+ struct Curl_X509certificate x509_parsed;
+ struct Curl_asn1Element *pubkey;
sspi_status =
s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle,
@@ -2304,7 +2304,7 @@ static CURLcode pkp_pin_peer_pubkey(struct connectdata *conn, int sockindex,
if(!(((pCertContextServer->dwCertEncodingType & X509_ASN_ENCODING) != 0) &&
- (pCertContextServer->cbCertEncoded > 0)))
+ (pCertContextServer->cbCertEncoded > 0)))
break;
x509_der = (const char *)pCertContextServer->pbCertEncoded;
@@ -2353,7 +2353,7 @@ static void Curl_schannel_checksum(const unsigned char *input,
memset(checksum, 0, checksumlen);
if(!CryptAcquireContext(&hProv, NULL, NULL, provType,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
return; /* failed */
do {
@@ -2395,9 +2395,9 @@ static CURLcode Curl_schannel_md5sum(unsigned char *input,
}
static CURLcode Curl_schannel_sha256sum(const unsigned char *input,
- size_t inputlen,
- unsigned char *sha256sum,
- size_t sha256len)
+ size_t inputlen,
+ unsigned char *sha256sum,
+ size_t sha256len)
{
Curl_schannel_checksum(input, inputlen, sha256sum, sha256len,
PROV_RSA_AES, CALG_SHA_256);
diff --git a/contrib/libs/curl/lib/vtls/schannel.h b/contrib/libs/curl/lib/vtls/schannel.h
index a361c4ca5d..085b3f455c 100644
--- a/contrib/libs/curl/lib/vtls/schannel.h
+++ b/contrib/libs/curl/lib/vtls/schannel.h
@@ -8,11 +8,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012, Marc Hoersken, <info@marc-hoersken.de>, et al.
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -70,20 +70,20 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex);
#endif
#endif
-struct Curl_schannel_cred {
+struct Curl_schannel_cred {
CredHandle cred_handle;
TimeStamp time_stamp;
int refcount;
};
-struct Curl_schannel_ctxt {
+struct Curl_schannel_ctxt {
CtxtHandle ctxt_handle;
TimeStamp time_stamp;
};
struct ssl_backend_data {
- struct Curl_schannel_cred *cred;
- struct Curl_schannel_ctxt *ctxt;
+ struct Curl_schannel_cred *cred;
+ struct Curl_schannel_ctxt *ctxt;
SecPkgContext_StreamSizes stream_sizes;
size_t encdata_length, decdata_length;
size_t encdata_offset, decdata_offset;
diff --git a/contrib/libs/curl/lib/vtls/schannel_verify.c b/contrib/libs/curl/lib/vtls/schannel_verify.c
index 94462d1812..31b3b2f02f 100644
--- a/contrib/libs/curl/lib/vtls/schannel_verify.c
+++ b/contrib/libs/curl/lib/vtls/schannel_verify.c
@@ -7,11 +7,11 @@
*
* Copyright (C) 2012 - 2016, Marc Hoersken, <info@marc-hoersken.de>
* Copyright (C) 2012, Mark Salisbury, <mark.salisbury@hp.com>
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -45,7 +45,7 @@
#include "curl_multibyte.h"
#include "curl_printf.h"
#include "hostcheck.h"
-#include "version_win32.h"
+#include "version_win32.h"
/* The last #include file should be: */
#include "curl_memory.h"
@@ -57,7 +57,7 @@
#define BEGIN_CERT "-----BEGIN CERTIFICATE-----"
#define END_CERT "\n-----END CERTIFICATE-----"
-struct cert_chain_engine_config_win7 {
+struct cert_chain_engine_config_win7 {
DWORD cbSize;
HCERTSTORE hRestrictedRoot;
HCERTSTORE hRestrictedTrust;
@@ -70,7 +70,7 @@ struct cert_chain_engine_config_win7 {
DWORD CycleDetectionModulus;
HCERTSTORE hExclusiveRoot;
HCERTSTORE hExclusiveTrustedPeople;
-};
+};
static int is_cr_or_lf(char c)
{
@@ -94,13 +94,13 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
int num_certs = 0;
size_t END_CERT_LEN;
- ca_file_tstr = curlx_convert_UTF8_to_tchar((char *)ca_file);
+ ca_file_tstr = curlx_convert_UTF8_to_tchar((char *)ca_file);
if(!ca_file_tstr) {
char buffer[STRERROR_LEN];
failf(data,
"schannel: invalid path name for CA file '%s': %s",
- ca_file,
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ ca_file,
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
goto cleanup;
}
@@ -112,7 +112,7 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
*/
ca_file_handle = CreateFile(ca_file_tstr,
GENERIC_READ,
- FILE_SHARE_READ,
+ FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
@@ -121,8 +121,8 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
char buffer[STRERROR_LEN];
failf(data,
"schannel: failed to open CA file '%s': %s",
- ca_file,
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ ca_file,
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
goto cleanup;
}
@@ -131,8 +131,8 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
char buffer[STRERROR_LEN];
failf(data,
"schannel: failed to determine size of CA file '%s': %s",
- ca_file,
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ ca_file,
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
goto cleanup;
}
@@ -162,8 +162,8 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
char buffer[STRERROR_LEN];
failf(data,
"schannel: failed to read from CA file '%s': %s",
- ca_file,
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ ca_file,
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
goto cleanup;
}
@@ -227,7 +227,7 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
"schannel: failed to extract certificate from CA file "
"'%s': %s",
ca_file,
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
more_certs = 0;
}
@@ -256,8 +256,8 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
"schannel: failed to add certificate from CA file '%s' "
"to certificate store: %s",
ca_file,
- Curl_winapi_strerror(GetLastError(), buffer,
- sizeof(buffer)));
+ Curl_winapi_strerror(GetLastError(), buffer,
+ sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
more_certs = 0;
}
@@ -288,138 +288,138 @@ cleanup:
CloseHandle(ca_file_handle);
}
Curl_safefree(ca_file_buffer);
- curlx_unicodefree(ca_file_tstr);
+ curlx_unicodefree(ca_file_tstr);
return result;
}
-/*
- * Returns the number of characters necessary to populate all the host_names.
- * If host_names is not NULL, populate it with all the host names. Each string
- * in the host_names is null-terminated and the last string is double
- * null-terminated. If no DNS names are found, a single null-terminated empty
- * string is returned.
- */
-static DWORD cert_get_name_string(struct Curl_easy *data,
- CERT_CONTEXT *cert_context,
- LPTSTR host_names,
- DWORD length)
-{
- DWORD actual_length = 0;
- BOOL compute_content = FALSE;
- CERT_INFO *cert_info = NULL;
- CERT_EXTENSION *extension = NULL;
- CRYPT_DECODE_PARA decode_para = {0, 0, 0};
- CERT_ALT_NAME_INFO *alt_name_info = NULL;
- DWORD alt_name_info_size = 0;
- BOOL ret_val = FALSE;
- LPTSTR current_pos = NULL;
- DWORD i;
-
- /* CERT_NAME_SEARCH_ALL_NAMES_FLAG is available from Windows 8 onwards. */
- if(curlx_verify_windows_version(6, 2, PLATFORM_WINNT,
- VERSION_GREATER_THAN_EQUAL)) {
-#ifdef CERT_NAME_SEARCH_ALL_NAMES_FLAG
- /* CertGetNameString will provide the 8-bit character string without
- * any decoding */
- DWORD name_flags =
- CERT_NAME_DISABLE_IE4_UTF8_FLAG | CERT_NAME_SEARCH_ALL_NAMES_FLAG;
- actual_length = CertGetNameString(cert_context,
- CERT_NAME_DNS_TYPE,
- name_flags,
- NULL,
- host_names,
- length);
- return actual_length;
-#endif
- }
-
- compute_content = host_names != NULL && length != 0;
-
- /* Initialize default return values. */
- actual_length = 1;
- if(compute_content) {
- *host_names = '\0';
- }
-
- if(!cert_context) {
- failf(data, "schannel: Null certificate context.");
- return actual_length;
- }
-
- cert_info = cert_context->pCertInfo;
- if(!cert_info) {
- failf(data, "schannel: Null certificate info.");
- return actual_length;
- }
-
- extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2,
- cert_info->cExtension,
- cert_info->rgExtension);
- if(!extension) {
- failf(data, "schannel: CertFindExtension() returned no extension.");
- return actual_length;
- }
-
- decode_para.cbSize = sizeof(CRYPT_DECODE_PARA);
-
- ret_val =
- CryptDecodeObjectEx(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- szOID_SUBJECT_ALT_NAME2,
- extension->Value.pbData,
- extension->Value.cbData,
- CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG,
- &decode_para,
- &alt_name_info,
- &alt_name_info_size);
- if(!ret_val) {
- failf(data,
- "schannel: CryptDecodeObjectEx() returned no alternate name "
- "information.");
- return actual_length;
- }
-
- current_pos = host_names;
-
- /* Iterate over the alternate names and populate host_names. */
- for(i = 0; i < alt_name_info->cAltEntry; i++) {
- const CERT_ALT_NAME_ENTRY *entry = &alt_name_info->rgAltEntry[i];
- wchar_t *dns_w = NULL;
- size_t current_length = 0;
-
- if(entry->dwAltNameChoice != CERT_ALT_NAME_DNS_NAME) {
- continue;
- }
- if(entry->pwszDNSName == NULL) {
- infof(data, "schannel: Empty DNS name.");
- continue;
- }
- current_length = wcslen(entry->pwszDNSName) + 1;
- if(!compute_content) {
- actual_length += (DWORD)current_length;
- continue;
- }
- /* Sanity check to prevent buffer overrun. */
- if((actual_length + current_length) > length) {
- failf(data, "schannel: Not enough memory to list all host names.");
- break;
- }
- dns_w = entry->pwszDNSName;
- /* pwszDNSName is in ia5 string format and hence doesn't contain any
- * non-ascii characters. */
- while(*dns_w != '\0') {
- *current_pos++ = (char)(*dns_w++);
- }
- *current_pos++ = '\0';
- actual_length += (DWORD)current_length;
- }
- if(compute_content) {
- /* Last string has double null-terminator. */
- *current_pos = '\0';
- }
- return actual_length;
-}
-
+/*
+ * Returns the number of characters necessary to populate all the host_names.
+ * If host_names is not NULL, populate it with all the host names. Each string
+ * in the host_names is null-terminated and the last string is double
+ * null-terminated. If no DNS names are found, a single null-terminated empty
+ * string is returned.
+ */
+static DWORD cert_get_name_string(struct Curl_easy *data,
+ CERT_CONTEXT *cert_context,
+ LPTSTR host_names,
+ DWORD length)
+{
+ DWORD actual_length = 0;
+ BOOL compute_content = FALSE;
+ CERT_INFO *cert_info = NULL;
+ CERT_EXTENSION *extension = NULL;
+ CRYPT_DECODE_PARA decode_para = {0, 0, 0};
+ CERT_ALT_NAME_INFO *alt_name_info = NULL;
+ DWORD alt_name_info_size = 0;
+ BOOL ret_val = FALSE;
+ LPTSTR current_pos = NULL;
+ DWORD i;
+
+ /* CERT_NAME_SEARCH_ALL_NAMES_FLAG is available from Windows 8 onwards. */
+ if(curlx_verify_windows_version(6, 2, PLATFORM_WINNT,
+ VERSION_GREATER_THAN_EQUAL)) {
+#ifdef CERT_NAME_SEARCH_ALL_NAMES_FLAG
+ /* CertGetNameString will provide the 8-bit character string without
+ * any decoding */
+ DWORD name_flags =
+ CERT_NAME_DISABLE_IE4_UTF8_FLAG | CERT_NAME_SEARCH_ALL_NAMES_FLAG;
+ actual_length = CertGetNameString(cert_context,
+ CERT_NAME_DNS_TYPE,
+ name_flags,
+ NULL,
+ host_names,
+ length);
+ return actual_length;
+#endif
+ }
+
+ compute_content = host_names != NULL && length != 0;
+
+ /* Initialize default return values. */
+ actual_length = 1;
+ if(compute_content) {
+ *host_names = '\0';
+ }
+
+ if(!cert_context) {
+ failf(data, "schannel: Null certificate context.");
+ return actual_length;
+ }
+
+ cert_info = cert_context->pCertInfo;
+ if(!cert_info) {
+ failf(data, "schannel: Null certificate info.");
+ return actual_length;
+ }
+
+ extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2,
+ cert_info->cExtension,
+ cert_info->rgExtension);
+ if(!extension) {
+ failf(data, "schannel: CertFindExtension() returned no extension.");
+ return actual_length;
+ }
+
+ decode_para.cbSize = sizeof(CRYPT_DECODE_PARA);
+
+ ret_val =
+ CryptDecodeObjectEx(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ szOID_SUBJECT_ALT_NAME2,
+ extension->Value.pbData,
+ extension->Value.cbData,
+ CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG,
+ &decode_para,
+ &alt_name_info,
+ &alt_name_info_size);
+ if(!ret_val) {
+ failf(data,
+ "schannel: CryptDecodeObjectEx() returned no alternate name "
+ "information.");
+ return actual_length;
+ }
+
+ current_pos = host_names;
+
+ /* Iterate over the alternate names and populate host_names. */
+ for(i = 0; i < alt_name_info->cAltEntry; i++) {
+ const CERT_ALT_NAME_ENTRY *entry = &alt_name_info->rgAltEntry[i];
+ wchar_t *dns_w = NULL;
+ size_t current_length = 0;
+
+ if(entry->dwAltNameChoice != CERT_ALT_NAME_DNS_NAME) {
+ continue;
+ }
+ if(entry->pwszDNSName == NULL) {
+ infof(data, "schannel: Empty DNS name.");
+ continue;
+ }
+ current_length = wcslen(entry->pwszDNSName) + 1;
+ if(!compute_content) {
+ actual_length += (DWORD)current_length;
+ continue;
+ }
+ /* Sanity check to prevent buffer overrun. */
+ if((actual_length + current_length) > length) {
+ failf(data, "schannel: Not enough memory to list all host names.");
+ break;
+ }
+ dns_w = entry->pwszDNSName;
+ /* pwszDNSName is in ia5 string format and hence doesn't contain any
+ * non-ascii characters. */
+ while(*dns_w != '\0') {
+ *current_pos++ = (char)(*dns_w++);
+ }
+ *current_pos++ = '\0';
+ actual_length += (DWORD)current_length;
+ }
+ if(compute_content) {
+ /* Last string has double null-terminator. */
+ *current_pos = '\0';
+ }
+ return actual_length;
+}
+
static CURLcode verify_host(struct Curl_easy *data,
CERT_CONTEXT *pCertContextServer,
const char * const conn_hostname)
@@ -431,7 +431,7 @@ static CURLcode verify_host(struct Curl_easy *data,
DWORD actual_len = 0;
/* Determine the size of the string needed for the cert hostname */
- len = cert_get_name_string(data, pCertContextServer, NULL, 0);
+ len = cert_get_name_string(data, pCertContextServer, NULL, 0);
if(len == 0) {
failf(data,
"schannel: CertGetNameString() returned no "
@@ -448,8 +448,8 @@ static CURLcode verify_host(struct Curl_easy *data,
result = CURLE_OUT_OF_MEMORY;
goto cleanup;
}
- actual_len = cert_get_name_string(
- data, pCertContextServer, (LPTSTR)cert_hostname_buff, len);
+ actual_len = cert_get_name_string(
+ data, pCertContextServer, (LPTSTR)cert_hostname_buff, len);
/* Sanity check */
if(actual_len != len) {
@@ -476,7 +476,7 @@ static CURLcode verify_host(struct Curl_easy *data,
* is acceptable since both values are assumed to use ASCII
* (or some equivalent) encoding
*/
- cert_hostname = curlx_convert_tchar_to_UTF8(
+ cert_hostname = curlx_convert_tchar_to_UTF8(
&cert_hostname_buff[cert_hostname_buff_index]);
if(!cert_hostname) {
result = CURLE_OUT_OF_MEMORY;
@@ -508,7 +508,7 @@ static CURLcode verify_host(struct Curl_easy *data,
result = CURLE_PEER_FAILED_VERIFICATION;
}
- curlx_unicodefree(cert_hostname);
+ curlx_unicodefree(cert_hostname);
}
}
@@ -522,7 +522,7 @@ static CURLcode verify_host(struct Curl_easy *data,
failf(data, "schannel: server certificate name verification failed");
cleanup:
- curlx_unicodefree(cert_hostname_buff);
+ curlx_unicodefree(cert_hostname_buff);
return result;
}
@@ -537,13 +537,13 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex)
const CERT_CHAIN_CONTEXT *pChainContext = NULL;
HCERTCHAINENGINE cert_chain_engine = NULL;
HCERTSTORE trust_store = NULL;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const char * const conn_hostname = SSL_IS_PROXY() ?
conn->http_proxy.host.name :
conn->host.name;
-#else
- const char * const conn_hostname = conn->host.name;
-#endif
+#else
+ const char * const conn_hostname = conn->host.name;
+#endif
sspi_status =
s_pSecFn->QueryContextAttributes(&BACKEND->ctxt->ctxt_handle,
@@ -564,7 +564,7 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex)
* trusted certificates. This is only supported on Windows 7+.
*/
- if(curlx_verify_windows_version(6, 1, PLATFORM_WINNT, VERSION_LESS_THAN)) {
+ if(curlx_verify_windows_version(6, 1, PLATFORM_WINNT, VERSION_LESS_THAN)) {
failf(data, "schannel: this version of Windows is too old to support "
"certificate verification via CA bundle file.");
result = CURLE_SSL_CACERT_BADFILE;
@@ -579,7 +579,7 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex)
if(!trust_store) {
char buffer[STRERROR_LEN];
failf(data, "schannel: failed to create certificate store: %s",
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
}
else {
@@ -589,7 +589,7 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex)
}
if(result == CURLE_OK) {
- struct cert_chain_engine_config_win7 engine_config;
+ struct cert_chain_engine_config_win7 engine_config;
BOOL create_engine_result;
memset(&engine_config, 0, sizeof(engine_config));
@@ -608,7 +608,7 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex)
char buffer[STRERROR_LEN];
failf(data,
"schannel: failed to create certificate chain engine: %s",
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
result = CURLE_SSL_CACERT_BADFILE;
}
}
@@ -631,7 +631,7 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex)
&pChainContext)) {
char buffer[STRERROR_LEN];
failf(data, "schannel: CertGetCertificateChain failed: %s",
- Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
+ Curl_winapi_strerror(GetLastError(), buffer, sizeof(buffer)));
pChainContext = NULL;
result = CURLE_PEER_FAILED_VERIFICATION;
}
@@ -640,15 +640,15 @@ CURLcode Curl_verify_certificate(struct connectdata *conn, int sockindex)
CERT_SIMPLE_CHAIN *pSimpleChain = pChainContext->rgpChain[0];
DWORD dwTrustErrorMask = ~(DWORD)(CERT_TRUST_IS_NOT_TIME_NESTED);
dwTrustErrorMask &= pSimpleChain->TrustStatus.dwErrorStatus;
-
- if(data->set.ssl.revoke_best_effort) {
- /* Ignore errors when root certificates are missing the revocation
- * list URL, or when the list could not be downloaded because the
- * server is currently unreachable. */
- dwTrustErrorMask &= ~(DWORD)(CERT_TRUST_REVOCATION_STATUS_UNKNOWN |
- CERT_TRUST_IS_OFFLINE_REVOCATION);
- }
-
+
+ if(data->set.ssl.revoke_best_effort) {
+ /* Ignore errors when root certificates are missing the revocation
+ * list URL, or when the list could not be downloaded because the
+ * server is currently unreachable. */
+ dwTrustErrorMask &= ~(DWORD)(CERT_TRUST_REVOCATION_STATUS_UNKNOWN |
+ CERT_TRUST_IS_OFFLINE_REVOCATION);
+ }
+
if(dwTrustErrorMask) {
if(dwTrustErrorMask & CERT_TRUST_IS_REVOKED)
failf(data, "schannel: CertGetCertificateChain trust error"
diff --git a/contrib/libs/curl/lib/vtls/sectransp.c b/contrib/libs/curl/lib/vtls/sectransp.c
index d2e6eabc33..8ef60cb1f3 100644
--- a/contrib/libs/curl/lib/vtls/sectransp.c
+++ b/contrib/libs/curl/lib/vtls/sectransp.c
@@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2017, Nick Zitzmann, <nickzman@gmail.com>.
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -79,7 +79,7 @@
/* These macros mean "the following code is present to allow runtime backward
compatibility with at least this cat or earlier":
(You set this at build-time using the compiler command line option
- "-mmacosx-version-min.") */
+ "-mmacosx-version-min.") */
#define CURL_SUPPORT_MAC_10_5 MAC_OS_X_VERSION_MIN_REQUIRED <= 1050
#define CURL_SUPPORT_MAC_10_6 MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
#define CURL_SUPPORT_MAC_10_7 MAC_OS_X_VERSION_MIN_REQUIRED <= 1070
@@ -199,8 +199,8 @@ static OSStatus SocketRead(SSLConnectionRef connection,
UInt8 *currData = (UInt8 *)data;
/*int sock = *(int *)connection;*/
struct ssl_connect_data *connssl = (struct ssl_connect_data *)connection;
- struct ssl_backend_data *backend = connssl->backend;
- int sock = backend->ssl_sockfd;
+ struct ssl_backend_data *backend = connssl->backend;
+ int sock = backend->ssl_sockfd;
OSStatus rtn = noErr;
size_t bytesRead;
ssize_t rrtn;
@@ -229,7 +229,7 @@ static OSStatus SocketRead(SSLConnectionRef connection,
break;
case EAGAIN:
rtn = errSSLWouldBlock;
- backend->ssl_direction = false;
+ backend->ssl_direction = false;
break;
default:
rtn = ioErr;
@@ -260,8 +260,8 @@ static OSStatus SocketWrite(SSLConnectionRef connection,
size_t bytesSent = 0;
/*int sock = *(int *)connection;*/
struct ssl_connect_data *connssl = (struct ssl_connect_data *)connection;
- struct ssl_backend_data *backend = connssl->backend;
- int sock = backend->ssl_sockfd;
+ struct ssl_backend_data *backend = connssl->backend;
+ int sock = backend->ssl_sockfd;
ssize_t length;
size_t dataLen = *dataLength;
const UInt8 *dataPtr = (UInt8 *)data;
@@ -281,7 +281,7 @@ static OSStatus SocketWrite(SSLConnectionRef connection,
theErr = errno;
if(theErr == EAGAIN) {
ortn = errSSLWouldBlock;
- backend->ssl_direction = true;
+ backend->ssl_direction = true;
}
else {
ortn = ioErr;
@@ -1126,12 +1126,12 @@ static OSStatus CopyIdentityWithLabel(char *label,
}
static OSStatus CopyIdentityFromPKCS12File(const char *cPath,
- const struct curl_blob *blob,
+ const struct curl_blob *blob,
const char *cPassword,
SecIdentityRef *out_cert_and_key)
{
OSStatus status = errSecItemNotFound;
- CFURLRef pkcs_url = NULL;
+ CFURLRef pkcs_url = NULL;
CFStringRef password = cPassword ? CFStringCreateWithCString(NULL,
cPassword, kCFStringEncodingUTF8) : NULL;
CFDataRef pkcs_data = NULL;
@@ -1140,26 +1140,26 @@ static OSStatus CopyIdentityFromPKCS12File(const char *cPath,
/* These constants are documented as having first appeared in 10.6 but they
raise linker errors when used on that cat for some reason. */
#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS
- bool resource_imported;
-
- if(blob) {
- pkcs_data = CFDataCreate(kCFAllocatorDefault,
- (const unsigned char *)blob->data, blob->len);
- status = (pkcs_data != NULL) ? errSecSuccess : errSecAllocate;
- resource_imported = (pkcs_data != NULL);
- }
- else {
- pkcs_url =
- CFURLCreateFromFileSystemRepresentation(NULL,
- (const UInt8 *)cPath,
- strlen(cPath), false);
- resource_imported =
- CFURLCreateDataAndPropertiesFromResource(NULL,
- pkcs_url, &pkcs_data,
- NULL, NULL, &status);
- }
-
- if(resource_imported) {
+ bool resource_imported;
+
+ if(blob) {
+ pkcs_data = CFDataCreate(kCFAllocatorDefault,
+ (const unsigned char *)blob->data, blob->len);
+ status = (pkcs_data != NULL) ? errSecSuccess : errSecAllocate;
+ resource_imported = (pkcs_data != NULL);
+ }
+ else {
+ pkcs_url =
+ CFURLCreateFromFileSystemRepresentation(NULL,
+ (const UInt8 *)cPath,
+ strlen(cPath), false);
+ resource_imported =
+ CFURLCreateDataAndPropertiesFromResource(NULL,
+ pkcs_url, &pkcs_data,
+ NULL, NULL, &status);
+ }
+
+ if(resource_imported) {
CFArrayRef items = NULL;
/* On iOS SecPKCS12Import will never add the client certificate to the
@@ -1182,7 +1182,7 @@ static OSStatus CopyIdentityFromPKCS12File(const char *cPath,
* the Keychain.
*
* As this doesn't match iOS, and apps may not want to see their client
- * certificate saved in the user's keychain, we use SecItemImport
+ * certificate saved in 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
@@ -1237,8 +1237,8 @@ static OSStatus CopyIdentityFromPKCS12File(const char *cPath,
#endif /* CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS */
if(password)
CFRelease(password);
- if(pkcs_url)
- CFRelease(pkcs_url);
+ if(pkcs_url)
+ CFRelease(pkcs_url);
return status;
}
@@ -1295,7 +1295,7 @@ set_ssl_version_min_max(struct connectdata *conn, int sockindex)
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
long ssl_version = SSL_CONN_CONFIG(version);
long ssl_version_max = SSL_CONN_CONFIG(version_max);
long max_supported_version_by_os;
@@ -1346,30 +1346,30 @@ set_ssl_version_min_max(struct connectdata *conn, int sockindex)
return result;
}
- (void)SSLSetProtocolVersionMin(backend->ssl_ctx, darwin_ver_min);
- (void)SSLSetProtocolVersionMax(backend->ssl_ctx, darwin_ver_max);
+ (void)SSLSetProtocolVersionMin(backend->ssl_ctx, darwin_ver_min);
+ (void)SSLSetProtocolVersionMax(backend->ssl_ctx, darwin_ver_max);
return result;
}
else {
#if CURL_SUPPORT_MAC_10_8
long i = ssl_version;
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kSSLProtocolAll,
false);
for(; i <= (ssl_version_max >> 16); i++) {
switch(i) {
case CURL_SSLVERSION_TLSv1_0:
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kTLSProtocol1,
true);
break;
case CURL_SSLVERSION_TLSv1_1:
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kTLSProtocol11,
true);
break;
case CURL_SSLVERSION_TLSv1_2:
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kTLSProtocol12,
true);
break;
@@ -1393,20 +1393,20 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
struct Curl_easy *data = conn->data;
curl_socket_t sockfd = conn->sock[sockindex];
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
- const struct curl_blob *ssl_cablob = NULL;
+ const struct curl_blob *ssl_cablob = NULL;
const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
- char * const ssl_cert = SSL_SET_OPTION(primary.clientcert);
- const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob);
-#ifndef CURL_DISABLE_PROXY
+ char * const ssl_cert = SSL_SET_OPTION(primary.clientcert);
+ const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob);
+#ifndef CURL_DISABLE_PROXY
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
-#else
- const char * const hostname = conn->host.name;
- const long int port = conn->remote_port;
-#endif
+#else
+ const char * const hostname = conn->host.name;
+ const long int port = conn->remote_port;
+#endif
#ifdef ENABLE_IPV6
struct in6_addr addr;
#else
@@ -1423,10 +1423,10 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS
if(SSLCreateContext != NULL) { /* use the newer API if available */
- if(backend->ssl_ctx)
- CFRelease(backend->ssl_ctx);
- backend->ssl_ctx = SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType);
- if(!backend->ssl_ctx) {
+ if(backend->ssl_ctx)
+ CFRelease(backend->ssl_ctx);
+ backend->ssl_ctx = SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType);
+ if(!backend->ssl_ctx) {
failf(data, "SSL: couldn't create a context!");
return CURLE_OUT_OF_MEMORY;
}
@@ -1434,9 +1434,9 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
else {
/* The old ST API does not exist under iOS, so don't compile it: */
#if CURL_SUPPORT_MAC_10_8
- if(backend->ssl_ctx)
- (void)SSLDisposeContext(backend->ssl_ctx);
- err = SSLNewContext(false, &(backend->ssl_ctx));
+ if(backend->ssl_ctx)
+ (void)SSLDisposeContext(backend->ssl_ctx);
+ err = SSLNewContext(false, &(backend->ssl_ctx));
if(err != noErr) {
failf(data, "SSL: couldn't create a context: OSStatus %d", err);
return CURLE_OUT_OF_MEMORY;
@@ -1444,31 +1444,31 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
#endif /* CURL_SUPPORT_MAC_10_8 */
}
#else
- if(backend->ssl_ctx)
- (void)SSLDisposeContext(backend->ssl_ctx);
- err = SSLNewContext(false, &(backend->ssl_ctx));
+ if(backend->ssl_ctx)
+ (void)SSLDisposeContext(backend->ssl_ctx);
+ err = SSLNewContext(false, &(backend->ssl_ctx));
if(err != noErr) {
failf(data, "SSL: couldn't create a context: OSStatus %d", err);
return CURLE_OUT_OF_MEMORY;
}
#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */
- backend->ssl_write_buffered_length = 0UL; /* reset buffered write length */
+ backend->ssl_write_buffered_length = 0UL; /* reset buffered write length */
/* check to see if we've been told to use an explicit SSL/TLS version */
#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS
if(SSLSetProtocolVersionMax != NULL) {
switch(conn->ssl_config.version) {
case CURL_SSLVERSION_TLSv1:
- (void)SSLSetProtocolVersionMin(backend->ssl_ctx, kTLSProtocol1);
+ (void)SSLSetProtocolVersionMin(backend->ssl_ctx, kTLSProtocol1);
#if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1
if(__builtin_available(macOS 10.13, iOS 11.0, *)) {
- (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kTLSProtocol13);
+ (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kTLSProtocol13);
}
else {
- (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kTLSProtocol12);
+ (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kTLSProtocol12);
}
#else
- (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kTLSProtocol12);
+ (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kTLSProtocol12);
#endif /* (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) &&
HAVE_BUILTIN_AVAILABLE == 1 */
break;
@@ -1484,20 +1484,20 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
break;
}
case CURL_SSLVERSION_SSLv3:
- err = SSLSetProtocolVersionMin(backend->ssl_ctx, kSSLProtocol3);
+ err = SSLSetProtocolVersionMin(backend->ssl_ctx, kSSLProtocol3);
if(err != noErr) {
failf(data, "Your version of the OS does not support SSLv3");
return CURLE_SSL_CONNECT_ERROR;
}
- (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kSSLProtocol3);
+ (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kSSLProtocol3);
break;
case CURL_SSLVERSION_SSLv2:
- err = SSLSetProtocolVersionMin(backend->ssl_ctx, kSSLProtocol2);
+ err = SSLSetProtocolVersionMin(backend->ssl_ctx, kSSLProtocol2);
if(err != noErr) {
failf(data, "Your version of the OS does not support SSLv2");
return CURLE_SSL_CONNECT_ERROR;
}
- (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kSSLProtocol2);
+ (void)SSLSetProtocolVersionMax(backend->ssl_ctx, kSSLProtocol2);
break;
default:
failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION");
@@ -1506,19 +1506,19 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
}
else {
#if CURL_SUPPORT_MAC_10_8
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kSSLProtocolAll,
false);
switch(conn->ssl_config.version) {
case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kTLSProtocol1,
true);
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kTLSProtocol11,
true);
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kTLSProtocol12,
true);
break;
@@ -1533,7 +1533,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
break;
}
case CURL_SSLVERSION_SSLv3:
- err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kSSLProtocol3,
true);
if(err != noErr) {
@@ -1542,7 +1542,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
}
break;
case CURL_SSLVERSION_SSLv2:
- err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kSSLProtocol2,
true);
if(err != noErr) {
@@ -1562,12 +1562,12 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
" SSL/TLS version");
return CURLE_SSL_CONNECT_ERROR;
}
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx, kSSLProtocolAll, false);
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx, kSSLProtocolAll, false);
switch(conn->ssl_config.version) {
case CURL_SSLVERSION_DEFAULT:
case CURL_SSLVERSION_TLSv1:
case CURL_SSLVERSION_TLSv1_0:
- (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ (void)SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kTLSProtocol1,
true);
break;
@@ -1581,7 +1581,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
failf(data, "Your version of the OS does not support TLSv1.3");
return CURLE_SSL_CONNECT_ERROR;
case CURL_SSLVERSION_SSLv2:
- err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kSSLProtocol2,
true);
if(err != noErr) {
@@ -1590,7 +1590,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
}
break;
case CURL_SSLVERSION_SSLv3:
- err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
+ err = SSLSetProtocolVersionEnabled(backend->ssl_ctx,
kSSLProtocol3,
true);
if(err != noErr) {
@@ -1611,11 +1611,11 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
&kCFTypeArrayCallBacks);
#ifdef USE_NGHTTP2
- if(data->set.httpversion >= CURL_HTTP_VERSION_2
-#ifndef CURL_DISABLE_PROXY
- && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
-#endif
- ) {
+ if(data->set.httpversion >= CURL_HTTP_VERSION_2
+#ifndef CURL_DISABLE_PROXY
+ && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)
+#endif
+ ) {
CFArrayAppendValue(alpnArr, CFSTR(NGHTTP2_PROTO_VERSION_ID));
infof(data, "ALPN, offering %s\n", NGHTTP2_PROTO_VERSION_ID);
}
@@ -1627,7 +1627,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
/* expects length prefixed preference ordered list of protocols in wire
* format
*/
- err = SSLSetALPNProtocols(backend->ssl_ctx, alpnArr);
+ err = SSLSetALPNProtocols(backend->ssl_ctx, alpnArr);
if(err != noErr)
infof(data, "WARNING: failed to set ALPN protocols; OSStatus %d\n",
err);
@@ -1641,16 +1641,16 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
"Transport. The private key must be in the Keychain.\n");
}
- if(ssl_cert || ssl_cert_blob) {
- bool is_cert_data = ssl_cert_blob != NULL;
- bool is_cert_file = (!is_cert_data) && is_file(ssl_cert);
+ if(ssl_cert || ssl_cert_blob) {
+ bool is_cert_data = ssl_cert_blob != NULL;
+ bool is_cert_file = (!is_cert_data) && is_file(ssl_cert);
SecIdentityRef cert_and_key = NULL;
/* User wants to authenticate with a client cert. Look for it:
If we detect that this is a file on disk, then let's load it.
Otherwise, assume that the user wants to use an identity loaded
from the Keychain. */
- if(is_cert_file || is_cert_data) {
+ if(is_cert_file || is_cert_data) {
if(!SSL_SET_OPTION(cert_type))
infof(data, "WARNING: SSL: Certificate type not set, assuming "
"PKCS#12 format.\n");
@@ -1659,7 +1659,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
infof(data, "WARNING: SSL: The Security framework only supports "
"loading identities that are in PKCS#12 format.\n");
- err = CopyIdentityFromPKCS12File(ssl_cert, ssl_cert_blob,
+ err = CopyIdentityFromPKCS12File(ssl_cert, ssl_cert_blob,
SSL_SET_OPTION(key_passwd), &cert_and_key);
}
else
@@ -1689,7 +1689,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
certs_c[0] = cert_and_key;
certs = CFArrayCreate(NULL, (const void **)certs_c, 1L,
&kCFTypeArrayCallBacks);
- err = SSLSetCertificate(backend->ssl_ctx, certs);
+ err = SSLSetCertificate(backend->ssl_ctx, certs);
if(certs)
CFRelease(certs);
if(err != noErr) {
@@ -1699,30 +1699,30 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
CFRelease(cert_and_key);
}
else {
- const char *cert_showfilename_error =
- is_cert_data ? "(memory blob)" : ssl_cert;
-
+ const char *cert_showfilename_error =
+ is_cert_data ? "(memory blob)" : ssl_cert;
+
switch(err) {
case errSecAuthFailed: case -25264: /* errSecPkcs12VerifyFailure */
failf(data, "SSL: Incorrect password for the certificate \"%s\" "
- "and its private key.", cert_showfilename_error);
+ "and its private key.", cert_showfilename_error);
break;
case -26275: /* errSecDecode */ case -25257: /* errSecUnknownFormat */
failf(data, "SSL: Couldn't make sense of the data in the "
"certificate \"%s\" and its private key.",
- cert_showfilename_error);
+ cert_showfilename_error);
break;
case -25260: /* errSecPassphraseRequired */
failf(data, "SSL The certificate \"%s\" requires a password.",
- cert_showfilename_error);
+ cert_showfilename_error);
break;
case errSecItemNotFound:
failf(data, "SSL: Can't find the certificate \"%s\" and its private "
- "key in the Keychain.", cert_showfilename_error);
+ "key in the Keychain.", cert_showfilename_error);
break;
default:
failf(data, "SSL: Can't load the certificate \"%s\" and its private "
- "key: OSStatus %d", cert_showfilename_error, err);
+ "key: OSStatus %d", cert_showfilename_error, err);
break;
}
return CURLE_SSL_CERTPROBLEM;
@@ -1754,9 +1754,9 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
#else
if(SSLSetSessionOption != NULL) {
#endif /* CURL_BUILD_MAC */
- bool break_on_auth = !conn->ssl_config.verifypeer ||
- ssl_cafile || ssl_cablob;
- err = SSLSetSessionOption(backend->ssl_ctx,
+ bool break_on_auth = !conn->ssl_config.verifypeer ||
+ ssl_cafile || ssl_cablob;
+ err = SSLSetSessionOption(backend->ssl_ctx,
kSSLSessionOptionBreakOnServerAuth,
break_on_auth);
if(err != noErr) {
@@ -1766,7 +1766,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
}
else {
#if CURL_SUPPORT_MAC_10_8
- err = SSLSetEnableCertVerify(backend->ssl_ctx,
+ err = SSLSetEnableCertVerify(backend->ssl_ctx,
conn->ssl_config.verifypeer?true:false);
if(err != noErr) {
failf(data, "SSL: SSLSetEnableCertVerify() failed: OSStatus %d", err);
@@ -1775,7 +1775,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
#endif /* CURL_SUPPORT_MAC_10_8 */
}
#else
- err = SSLSetEnableCertVerify(backend->ssl_ctx,
+ err = SSLSetEnableCertVerify(backend->ssl_ctx,
conn->ssl_config.verifypeer?true:false);
if(err != noErr) {
failf(data, "SSL: SSLSetEnableCertVerify() failed: OSStatus %d", err);
@@ -1783,11 +1783,11 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
}
#endif /* CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS */
- if((ssl_cafile || ssl_cablob) && verifypeer) {
- bool is_cert_data = ssl_cablob != NULL;
- bool is_cert_file = (!is_cert_data) && is_file(ssl_cafile);
+ if((ssl_cafile || ssl_cablob) && verifypeer) {
+ bool is_cert_data = ssl_cablob != NULL;
+ bool is_cert_file = (!is_cert_data) && is_file(ssl_cafile);
- if(!(is_cert_file || is_cert_data)) {
+ if(!(is_cert_file || is_cert_data)) {
failf(data, "SSL: can't load CA certificate file %s", ssl_cafile);
return CURLE_SSL_CACERT_BADFILE;
}
@@ -1797,7 +1797,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
* Both hostname check and SNI require SSLSetPeerDomainName().
* Also: the verifyhost setting influences SNI usage */
if(conn->ssl_config.verifyhost) {
- err = SSLSetPeerDomainName(backend->ssl_ctx, hostname,
+ err = SSLSetPeerDomainName(backend->ssl_ctx, hostname,
strlen(hostname));
if(err != noErr) {
@@ -1823,7 +1823,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
higher priority, but it's probably better that we not connect at all than
to give the user a false sense of security if the server only supports
insecure ciphers. (Note: We don't care about SSLv2-only ciphers.) */
- err = SSLGetNumberSupportedCiphers(backend->ssl_ctx, &all_ciphers_count);
+ err = SSLGetNumberSupportedCiphers(backend->ssl_ctx, &all_ciphers_count);
if(err != noErr) {
failf(data, "SSL: SSLGetNumberSupportedCiphers() failed: OSStatus %d",
err);
@@ -1840,7 +1840,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
failf(data, "SSL: Failed to allocate memory for allowed ciphers");
return CURLE_OUT_OF_MEMORY;
}
- err = SSLGetSupportedCiphers(backend->ssl_ctx, all_ciphers,
+ err = SSLGetSupportedCiphers(backend->ssl_ctx, all_ciphers,
&all_ciphers_count);
if(err != noErr) {
Curl_safefree(all_ciphers);
@@ -1927,7 +1927,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
break;
}
}
- err = SSLSetEnabledCiphers(backend->ssl_ctx, allowed_ciphers,
+ err = SSLSetEnabledCiphers(backend->ssl_ctx, allowed_ciphers,
allowed_ciphers_count);
Curl_safefree(all_ciphers);
Curl_safefree(allowed_ciphers);
@@ -1940,9 +1940,9 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
/* We want to enable 1/n-1 when using a CBC cipher unless the user
specifically doesn't want us doing that: */
if(SSLSetSessionOption != NULL) {
- SSLSetSessionOption(backend->ssl_ctx, kSSLSessionOptionSendOneByteRecord,
+ SSLSetSessionOption(backend->ssl_ctx, kSSLSessionOptionSendOneByteRecord,
!data->set.ssl.enable_beast);
- SSLSetSessionOption(backend->ssl_ctx, kSSLSessionOptionFalseStart,
+ SSLSetSessionOption(backend->ssl_ctx, kSSLSessionOptionFalseStart,
data->set.ssl.falsestart); /* false start support */
}
#endif /* CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 */
@@ -1956,7 +1956,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
if(!Curl_ssl_getsessionid(conn, (void **)&ssl_sessionid,
&ssl_sessionid_len, sockindex)) {
/* we got a session id, use it! */
- err = SSLSetPeerID(backend->ssl_ctx, ssl_sessionid, ssl_sessionid_len);
+ err = SSLSetPeerID(backend->ssl_ctx, ssl_sessionid, ssl_sessionid_len);
Curl_ssl_sessionid_unlock(conn);
if(err != noErr) {
failf(data, "SSL: SSLSetPeerID() failed: OSStatus %d", err);
@@ -1970,11 +1970,11 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
else {
CURLcode result;
ssl_sessionid =
- aprintf("%s:%d:%d:%s:%ld", ssl_cafile,
+ aprintf("%s:%d:%d:%s:%ld", ssl_cafile,
verifypeer, SSL_CONN_CONFIG(verifyhost), hostname, port);
ssl_sessionid_len = strlen(ssl_sessionid);
- err = SSLSetPeerID(backend->ssl_ctx, ssl_sessionid, ssl_sessionid_len);
+ err = SSLSetPeerID(backend->ssl_ctx, ssl_sessionid, ssl_sessionid_len);
if(err != noErr) {
Curl_ssl_sessionid_unlock(conn);
failf(data, "SSL: SSLSetPeerID() failed: OSStatus %d", err);
@@ -1991,7 +1991,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
}
}
- err = SSLSetIOFuncs(backend->ssl_ctx, SocketRead, SocketWrite);
+ err = SSLSetIOFuncs(backend->ssl_ctx, SocketRead, SocketWrite);
if(err != noErr) {
failf(data, "SSL: SSLSetIOFuncs() failed: OSStatus %d", err);
return CURLE_SSL_CONNECT_ERROR;
@@ -2001,8 +2001,8 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
/* We need to store the FD in a constant memory address, because
* SSLSetConnection() will not copy that address. I've found that
* conn->sock[sockindex] may change on its own. */
- backend->ssl_sockfd = sockfd;
- err = SSLSetConnection(backend->ssl_ctx, connssl);
+ backend->ssl_sockfd = sockfd;
+ err = SSLSetConnection(backend->ssl_ctx, connssl);
if(err != noErr) {
failf(data, "SSL: SSLSetConnection() failed: %d", err);
return CURLE_SSL_CONNECT_ERROR;
@@ -2189,7 +2189,7 @@ static CURLcode verify_cert(const char *cafile, struct Curl_easy *data,
if(res < 0) {
free(certbuf);
CFRelease(array);
- failf(data, "SSL: invalid CA certificate #%d (offset %zu) in bundle",
+ failf(data, "SSL: invalid CA certificate #%d (offset %zu) in bundle",
n, offset);
return CURLE_SSL_CACERT_BADFILE;
}
@@ -2383,28 +2383,28 @@ sectransp_connect_step2(struct connectdata *conn, int sockindex)
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
OSStatus err;
SSLCipherSuite cipher;
SSLProtocol protocol = 0;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
-#else
- const char * const hostname = conn->host.name;
-#endif
+#else
+ const char * const hostname = conn->host.name;
+#endif
DEBUGASSERT(ssl_connect_2 == connssl->connecting_state
|| ssl_connect_2_reading == connssl->connecting_state
|| ssl_connect_2_writing == connssl->connecting_state);
/* Here goes nothing: */
- err = SSLHandshake(backend->ssl_ctx);
+ err = SSLHandshake(backend->ssl_ctx);
if(err != noErr) {
switch(err) {
case errSSLWouldBlock: /* they're not done with us yet */
- connssl->connecting_state = backend->ssl_direction ?
+ connssl->connecting_state = backend->ssl_direction ?
ssl_connect_2_writing : ssl_connect_2_reading;
return CURLE_OK;
@@ -2413,7 +2413,7 @@ sectransp_connect_step2(struct connectdata *conn, int sockindex)
case -9841:
if(SSL_CONN_CONFIG(CAfile) && SSL_CONN_CONFIG(verifypeer)) {
CURLcode result = verify_cert(SSL_CONN_CONFIG(CAfile), data,
- backend->ssl_ctx);
+ backend->ssl_ctx);
if(result)
return result;
}
@@ -2622,7 +2622,7 @@ sectransp_connect_step2(struct connectdata *conn, int sockindex)
#ifdef SECTRANSP_PINNEDPUBKEY
if(data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG]) {
- CURLcode result = pkp_pin_peer_pubkey(data, backend->ssl_ctx,
+ CURLcode result = pkp_pin_peer_pubkey(data, backend->ssl_ctx,
data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG]);
if(result) {
failf(data, "SSL: public key does not match pinned public key!");
@@ -2632,8 +2632,8 @@ sectransp_connect_step2(struct connectdata *conn, int sockindex)
#endif /* SECTRANSP_PINNEDPUBKEY */
/* Informational message */
- (void)SSLGetNegotiatedCipher(backend->ssl_ctx, &cipher);
- (void)SSLGetNegotiatedProtocolVersion(backend->ssl_ctx, &protocol);
+ (void)SSLGetNegotiatedCipher(backend->ssl_ctx, &cipher);
+ (void)SSLGetNegotiatedProtocolVersion(backend->ssl_ctx, &protocol);
switch(protocol) {
case kSSLProtocol2:
infof(data, "SSL 2.0 connection using %s\n",
@@ -2673,7 +2673,7 @@ sectransp_connect_step2(struct connectdata *conn, int sockindex)
if(__builtin_available(macOS 10.13.4, iOS 11, tvOS 11, *)) {
CFArrayRef alpnArr = NULL;
CFStringRef chosenProtocol = NULL;
- err = SSLCopyALPNProtocols(backend->ssl_ctx, &alpnArr);
+ err = SSLCopyALPNProtocols(backend->ssl_ctx, &alpnArr);
if(err == noErr && alpnArr && CFArrayGetCount(alpnArr) >= 1)
chosenProtocol = CFArrayGetValueAtIndex(alpnArr, 0);
@@ -2716,20 +2716,20 @@ show_verbose_server_cert(struct connectdata *conn,
{
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
CFArrayRef server_certs = NULL;
SecCertificateRef server_cert;
OSStatus err;
CFIndex i, count;
SecTrustRef trust = NULL;
- if(!backend->ssl_ctx)
+ if(!backend->ssl_ctx)
return;
#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS
#if CURL_BUILD_IOS
#pragma unused(server_certs)
- err = SSLCopyPeerTrust(backend->ssl_ctx, &trust);
+ err = SSLCopyPeerTrust(backend->ssl_ctx, &trust);
/* For some reason, SSLCopyPeerTrust() can return noErr and yet return
a null trust, so be on guard for that: */
if(err == noErr && trust) {
@@ -2755,7 +2755,7 @@ show_verbose_server_cert(struct connectdata *conn,
Lion or later. */
if(SecTrustEvaluateAsync != NULL) {
#pragma unused(server_certs)
- err = SSLCopyPeerTrust(backend->ssl_ctx, &trust);
+ err = SSLCopyPeerTrust(backend->ssl_ctx, &trust);
/* For some reason, SSLCopyPeerTrust() can return noErr and yet return
a null trust, so be on guard for that: */
if(err == noErr && trust) {
@@ -2775,7 +2775,7 @@ show_verbose_server_cert(struct connectdata *conn,
}
else {
#if CURL_SUPPORT_MAC_10_8
- err = SSLCopyPeerCertificates(backend->ssl_ctx, &server_certs);
+ err = SSLCopyPeerCertificates(backend->ssl_ctx, &server_certs);
/* Just in case SSLCopyPeerCertificates() returns null too... */
if(err == noErr && server_certs) {
count = CFArrayGetCount(server_certs);
@@ -2797,7 +2797,7 @@ show_verbose_server_cert(struct connectdata *conn,
#endif /* CURL_BUILD_IOS */
#else
#pragma unused(trust)
- err = SSLCopyPeerCertificates(backend->ssl_ctx, &server_certs);
+ err = SSLCopyPeerCertificates(backend->ssl_ctx, &server_certs);
if(err == noErr) {
count = CFArrayGetCount(server_certs);
for(i = 0L ; i < count ; i++) {
@@ -2858,7 +2858,7 @@ sectransp_connect_common(struct connectdata *conn,
if(ssl_connect_1 == connssl->connecting_state) {
/* Find out how much more time we're allowed */
- const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
@@ -2876,7 +2876,7 @@ sectransp_connect_common(struct connectdata *conn,
ssl_connect_2_writing == connssl->connecting_state) {
/* check allowed time left */
- const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
@@ -2894,7 +2894,7 @@ sectransp_connect_common(struct connectdata *conn,
connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd,
- nonblocking ? 0 : timeout_ms);
+ nonblocking ? 0 : timeout_ms);
if(what < 0) {
/* fatal error */
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
@@ -2975,36 +2975,36 @@ static CURLcode Curl_sectransp_connect(struct connectdata *conn, int sockindex)
static void Curl_sectransp_close(struct connectdata *conn, int sockindex)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
- if(backend->ssl_ctx) {
- (void)SSLClose(backend->ssl_ctx);
+ if(backend->ssl_ctx) {
+ (void)SSLClose(backend->ssl_ctx);
#if CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS
if(SSLCreateContext != NULL)
- CFRelease(backend->ssl_ctx);
+ CFRelease(backend->ssl_ctx);
#if CURL_SUPPORT_MAC_10_8
else
- (void)SSLDisposeContext(backend->ssl_ctx);
+ (void)SSLDisposeContext(backend->ssl_ctx);
#endif /* CURL_SUPPORT_MAC_10_8 */
#else
- (void)SSLDisposeContext(backend->ssl_ctx);
+ (void)SSLDisposeContext(backend->ssl_ctx);
#endif /* CURL_BUILD_MAC_10_8 || CURL_BUILD_IOS */
- backend->ssl_ctx = NULL;
+ backend->ssl_ctx = NULL;
}
- backend->ssl_sockfd = 0;
+ backend->ssl_sockfd = 0;
}
static int Curl_sectransp_shutdown(struct connectdata *conn, int sockindex)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
struct Curl_easy *data = conn->data;
ssize_t nread;
int what;
int rc;
char buf[120];
- if(!backend->ssl_ctx)
+ if(!backend->ssl_ctx)
return 0;
#ifndef CURL_DISABLE_FTP
@@ -3077,12 +3077,12 @@ static size_t Curl_sectransp_version(char *buffer, size_t size)
static int Curl_sectransp_check_cxn(struct connectdata *conn)
{
struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
OSStatus err;
SSLSessionState state;
- if(backend->ssl_ctx) {
- err = SSLGetSessionState(backend->ssl_ctx, &state);
+ if(backend->ssl_ctx) {
+ err = SSLGetSessionState(backend->ssl_ctx, &state);
if(err == noErr)
return state == kSSLConnected || state == kSSLHandshake;
return -1;
@@ -3094,12 +3094,12 @@ static bool Curl_sectransp_data_pending(const struct connectdata *conn,
int connindex)
{
const struct ssl_connect_data *connssl = &conn->ssl[connindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
OSStatus err;
size_t buffer;
- if(backend->ssl_ctx) { /* SSL is in use */
- err = SSLGetBufferedReadSize(backend->ssl_ctx, &buffer);
+ if(backend->ssl_ctx) { /* SSL is in use */
+ err = SSLGetBufferedReadSize(backend->ssl_ctx, &buffer);
if(err == noErr)
return buffer > 0UL;
return false;
@@ -3165,7 +3165,7 @@ static ssize_t sectransp_send(struct connectdata *conn,
{
/*struct Curl_easy *data = conn->data;*/
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
size_t processed = 0UL;
OSStatus err;
@@ -3184,15 +3184,15 @@ static ssize_t sectransp_send(struct connectdata *conn,
over again with no new data until it quits returning errSSLWouldBlock. */
/* Do we have buffered data to write from the last time we were called? */
- if(backend->ssl_write_buffered_length) {
+ if(backend->ssl_write_buffered_length) {
/* Write the buffered data: */
- err = SSLWrite(backend->ssl_ctx, NULL, 0UL, &processed);
+ err = SSLWrite(backend->ssl_ctx, NULL, 0UL, &processed);
switch(err) {
case noErr:
/* processed is always going to be 0 because we didn't write to
the buffer, so return how much was written to the socket */
- processed = backend->ssl_write_buffered_length;
- backend->ssl_write_buffered_length = 0UL;
+ processed = backend->ssl_write_buffered_length;
+ backend->ssl_write_buffered_length = 0UL;
break;
case errSSLWouldBlock: /* argh, try again */
*curlcode = CURLE_AGAIN;
@@ -3205,13 +3205,13 @@ static ssize_t sectransp_send(struct connectdata *conn,
}
else {
/* We've got new data to write: */
- err = SSLWrite(backend->ssl_ctx, mem, len, &processed);
+ err = SSLWrite(backend->ssl_ctx, mem, len, &processed);
if(err != noErr) {
switch(err) {
case errSSLWouldBlock:
/* Data was buffered but not sent, we have to tell the caller
to try sending again, and remember how much was buffered */
- backend->ssl_write_buffered_length = len;
+ backend->ssl_write_buffered_length = len;
*curlcode = CURLE_AGAIN;
return -1L;
default:
@@ -3232,12 +3232,12 @@ static ssize_t sectransp_recv(struct connectdata *conn,
{
/*struct Curl_easy *data = conn->data;*/
struct ssl_connect_data *connssl = &conn->ssl[num];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
size_t processed = 0UL;
OSStatus err;
again:
- err = SSLRead(backend->ssl_ctx, buf, buffersize, &processed);
+ err = SSLRead(backend->ssl_ctx, buf, buffersize, &processed);
if(err != noErr) {
switch(err) {
@@ -3263,7 +3263,7 @@ static ssize_t sectransp_recv(struct connectdata *conn,
case -9841:
if(SSL_CONN_CONFIG(CAfile) && SSL_CONN_CONFIG(verifypeer)) {
CURLcode result = verify_cert(SSL_CONN_CONFIG(CAfile), conn->data,
- backend->ssl_ctx);
+ backend->ssl_ctx);
if(result)
return result;
}
@@ -3281,9 +3281,9 @@ static ssize_t sectransp_recv(struct connectdata *conn,
static void *Curl_sectransp_get_internals(struct ssl_connect_data *connssl,
CURLINFO info UNUSED_PARAM)
{
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
(void)info;
- return backend->ssl_ctx;
+ return backend->ssl_ctx;
}
const struct Curl_ssl Curl_ssl_sectransp = {
diff --git a/contrib/libs/curl/lib/vtls/sectransp.h b/contrib/libs/curl/lib/vtls/sectransp.h
index 6b85a367da..0febd6613a 100644
--- a/contrib/libs/curl/lib/vtls/sectransp.h
+++ b/contrib/libs/curl/lib/vtls/sectransp.h
@@ -8,11 +8,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2014, Nick Zitzmann, <nickzman@gmail.com>.
- * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/vtls/vtls.c b/contrib/libs/curl/lib/vtls/vtls.c
index 5da28209a9..3bd51fdaf2 100644
--- a/contrib/libs/curl/lib/vtls/vtls.c
+++ b/contrib/libs/curl/lib/vtls/vtls.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -63,7 +63,7 @@
#include "warnless.h"
#include "curl_base64.h"
#include "curl_printf.h"
-#include "strdup.h"
+#include "strdup.h"
/* The last #include files should be: */
#include "curl_memory.h"
@@ -83,63 +83,63 @@
else \
dest->var = NULL;
-#define CLONE_BLOB(var) \
- if(blobdup(&dest->var, source->var)) \
- return FALSE;
-
-static CURLcode blobdup(struct curl_blob **dest,
- struct curl_blob *src)
-{
- DEBUGASSERT(dest);
- DEBUGASSERT(!*dest);
- if(src) {
- /* only if there's data to dupe! */
- struct curl_blob *d;
- d = malloc(sizeof(struct curl_blob) + src->len);
- if(!d)
- return CURLE_OUT_OF_MEMORY;
- d->len = src->len;
- /* Always duplicate because the connection may survive longer than the
- handle that passed in the blob. */
- d->flags = CURL_BLOB_COPY;
- d->data = (void *)((char *)d + sizeof(struct curl_blob));
- memcpy(d->data, src->data, src->len);
- *dest = d;
- }
- return CURLE_OK;
-}
-
-/* returns TRUE if the blobs are identical */
-static bool blobcmp(struct curl_blob *first, struct curl_blob *second)
-{
- if(!first && !second) /* both are NULL */
- return TRUE;
- if(!first || !second) /* one is NULL */
- return FALSE;
- if(first->len != second->len) /* different sizes */
- return FALSE;
- return !memcmp(first->data, second->data, first->len); /* same data */
-}
-
+#define CLONE_BLOB(var) \
+ if(blobdup(&dest->var, source->var)) \
+ return FALSE;
+
+static CURLcode blobdup(struct curl_blob **dest,
+ struct curl_blob *src)
+{
+ DEBUGASSERT(dest);
+ DEBUGASSERT(!*dest);
+ if(src) {
+ /* only if there's data to dupe! */
+ struct curl_blob *d;
+ d = malloc(sizeof(struct curl_blob) + src->len);
+ if(!d)
+ return CURLE_OUT_OF_MEMORY;
+ d->len = src->len;
+ /* Always duplicate because the connection may survive longer than the
+ handle that passed in the blob. */
+ d->flags = CURL_BLOB_COPY;
+ d->data = (void *)((char *)d + sizeof(struct curl_blob));
+ memcpy(d->data, src->data, src->len);
+ *dest = d;
+ }
+ return CURLE_OK;
+}
+
+/* returns TRUE if the blobs are identical */
+static bool blobcmp(struct curl_blob *first, struct curl_blob *second)
+{
+ if(!first && !second) /* both are NULL */
+ return TRUE;
+ if(!first || !second) /* one is NULL */
+ return FALSE;
+ if(first->len != second->len) /* different sizes */
+ return FALSE;
+ return !memcmp(first->data, second->data, first->len); /* same data */
+}
+
bool
-Curl_ssl_config_matches(struct ssl_primary_config *data,
- struct ssl_primary_config *needle)
+Curl_ssl_config_matches(struct ssl_primary_config *data,
+ struct ssl_primary_config *needle)
{
if((data->version == needle->version) &&
(data->version_max == needle->version_max) &&
(data->verifypeer == needle->verifypeer) &&
(data->verifyhost == needle->verifyhost) &&
(data->verifystatus == needle->verifystatus) &&
- blobcmp(data->cert_blob, needle->cert_blob) &&
+ blobcmp(data->cert_blob, needle->cert_blob) &&
Curl_safe_strcasecompare(data->CApath, needle->CApath) &&
Curl_safe_strcasecompare(data->CAfile, needle->CAfile) &&
Curl_safe_strcasecompare(data->clientcert, needle->clientcert) &&
Curl_safe_strcasecompare(data->random_file, needle->random_file) &&
Curl_safe_strcasecompare(data->egdsocket, needle->egdsocket) &&
Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) &&
- Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) &&
- Curl_safe_strcasecompare(data->curves, needle->curves) &&
- Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key))
+ Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) &&
+ Curl_safe_strcasecompare(data->curves, needle->curves) &&
+ Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key))
return TRUE;
return FALSE;
@@ -156,7 +156,7 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
dest->verifystatus = source->verifystatus;
dest->sessionid = source->sessionid;
- CLONE_BLOB(cert_blob);
+ CLONE_BLOB(cert_blob);
CLONE_STRING(CApath);
CLONE_STRING(CAfile);
CLONE_STRING(clientcert);
@@ -164,13 +164,13 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
CLONE_STRING(egdsocket);
CLONE_STRING(cipher_list);
CLONE_STRING(cipher_list13);
- CLONE_STRING(pinned_key);
- CLONE_STRING(curves);
+ CLONE_STRING(pinned_key);
+ CLONE_STRING(curves);
return TRUE;
}
-void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc)
+void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc)
{
Curl_safefree(sslc->CApath);
Curl_safefree(sslc->CAfile);
@@ -179,9 +179,9 @@ void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc)
Curl_safefree(sslc->egdsocket);
Curl_safefree(sslc->cipher_list);
Curl_safefree(sslc->cipher_list13);
- Curl_safefree(sslc->pinned_key);
- Curl_safefree(sslc->cert_blob);
- Curl_safefree(sslc->curves);
+ Curl_safefree(sslc->pinned_key);
+ Curl_safefree(sslc->cert_blob);
+ Curl_safefree(sslc->curves);
}
#ifdef USE_SSL
@@ -219,9 +219,9 @@ int Curl_ssl_init(void)
return Curl_ssl->init();
}
-#if defined(CURL_WITH_MULTI_SSL)
-static const struct Curl_ssl Curl_ssl_multi;
-#endif
+#if defined(CURL_WITH_MULTI_SSL)
+static const struct Curl_ssl Curl_ssl_multi;
+#endif
/* Global cleanup */
void Curl_ssl_cleanup(void)
@@ -229,9 +229,9 @@ void Curl_ssl_cleanup(void)
if(init_ssl) {
/* only cleanup if we did a previous init */
Curl_ssl->cleanup();
-#if defined(CURL_WITH_MULTI_SSL)
- Curl_ssl = &Curl_ssl_multi;
-#endif
+#if defined(CURL_WITH_MULTI_SSL)
+ Curl_ssl = &Curl_ssl_multi;
+#endif
init_ssl = FALSE;
}
}
@@ -260,7 +260,7 @@ static bool ssl_prefs_check(struct Curl_easy *data)
return TRUE;
}
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
static CURLcode
ssl_connect_init_proxy(struct connectdata *conn, int sockindex)
{
@@ -284,20 +284,20 @@ ssl_connect_init_proxy(struct connectdata *conn, int sockindex)
}
return CURLE_OK;
}
-#endif
+#endif
CURLcode
Curl_ssl_connect(struct connectdata *conn, int sockindex)
{
CURLcode result;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.proxy_ssl_connected[sockindex]) {
result = ssl_connect_init_proxy(conn, sockindex);
if(result)
return result;
}
-#endif
+#endif
if(!ssl_prefs_check(conn->data))
return CURLE_SSL_CONNECT_ERROR;
@@ -319,13 +319,13 @@ Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex,
bool *done)
{
CURLcode result;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
if(conn->bits.proxy_ssl_connected[sockindex]) {
result = ssl_connect_init_proxy(conn, sockindex);
if(result)
return result;
}
-#endif
+#endif
if(!ssl_prefs_check(conn->data))
return CURLE_SSL_CONNECT_ERROR;
@@ -365,27 +365,27 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
size_t *idsize, /* set 0 if unknown */
int sockindex)
{
- struct Curl_ssl_session *check;
+ struct Curl_ssl_session *check;
struct Curl_easy *data = conn->data;
size_t i;
long *general_age;
bool no_match = TRUE;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const bool isProxy = CONNECT_PROXY_SSL();
struct ssl_primary_config * const ssl_config = isProxy ?
&conn->proxy_ssl_config :
&conn->ssl_config;
- const char * const name = isProxy ?
- conn->http_proxy.host.name : conn->host.name;
+ const char * const name = isProxy ?
+ conn->http_proxy.host.name : conn->host.name;
int port = isProxy ? (int)conn->port : conn->remote_port;
-#else
- /* no proxy support */
- struct ssl_primary_config * const ssl_config = &conn->ssl_config;
- const char * const name = conn->host.name;
- int port = conn->remote_port;
- (void)sockindex;
-#endif
+#else
+ /* no proxy support */
+ struct ssl_primary_config * const ssl_config = &conn->ssl_config;
+ const char * const name = conn->host.name;
+ int port = conn->remote_port;
+ (void)sockindex;
+#endif
*ssl_sessionid = NULL;
DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
@@ -432,7 +432,7 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
/*
* Kill a single session ID entry in the cache.
*/
-void Curl_ssl_kill_session(struct Curl_ssl_session *session)
+void Curl_ssl_kill_session(struct Curl_ssl_session *session)
{
if(session->sessionid) {
/* defensive check */
@@ -459,7 +459,7 @@ void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid)
struct Curl_easy *data = conn->data;
for(i = 0; i < data->set.general_ssl.max_ssl_sessions; i++) {
- struct Curl_ssl_session *check = &data->state.session[i];
+ struct Curl_ssl_session *check = &data->state.session[i];
if(check->sessionid == ssl_sessionid) {
Curl_ssl_kill_session(check);
@@ -481,29 +481,29 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
{
size_t i;
struct Curl_easy *data = conn->data; /* the mother of all structs */
- struct Curl_ssl_session *store = &data->state.session[0];
+ struct Curl_ssl_session *store = &data->state.session[0];
long oldest_age = data->state.session[0].age; /* zero if unused */
char *clone_host;
char *clone_conn_to_host;
int conn_to_port;
long *general_age;
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const bool isProxy = CONNECT_PROXY_SSL();
struct ssl_primary_config * const ssl_config = isProxy ?
&conn->proxy_ssl_config :
&conn->ssl_config;
- const char *hostname = isProxy ? conn->http_proxy.host.name :
- conn->host.name;
-#else
- /* proxy support disabled */
- const bool isProxy = FALSE;
- struct ssl_primary_config * const ssl_config = &conn->ssl_config;
- const char *hostname = conn->host.name;
- (void)sockindex;
-#endif
+ const char *hostname = isProxy ? conn->http_proxy.host.name :
+ conn->host.name;
+#else
+ /* proxy support disabled */
+ const bool isProxy = FALSE;
+ struct ssl_primary_config * const ssl_config = &conn->ssl_config;
+ const char *hostname = conn->host.name;
+ (void)sockindex;
+#endif
DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
- clone_host = strdup(hostname);
+ clone_host = strdup(hostname);
if(!clone_host)
return CURLE_OUT_OF_MEMORY; /* bail out */
@@ -562,7 +562,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
store->scheme = conn->handler->scheme;
if(!Curl_clone_primary_ssl_config(ssl_config, &store->ssl_config)) {
- Curl_free_primary_ssl_config(&store->ssl_config);
+ Curl_free_primary_ssl_config(&store->ssl_config);
store->sessionid = NULL; /* let caller free sessionid */
free(clone_host);
free(clone_conn_to_host);
@@ -590,8 +590,8 @@ void Curl_ssl_close_all(struct Curl_easy *data)
}
#if defined(USE_OPENSSL) || defined(USE_GNUTLS) || defined(USE_SCHANNEL) || \
- defined(USE_SECTRANSP) || defined(USE_NSS) || \
- defined(USE_MBEDTLS) || defined(USE_WOLFSSL) || defined(USE_BEARSSL)
+ defined(USE_SECTRANSP) || defined(USE_NSS) || \
+ defined(USE_MBEDTLS) || defined(USE_WOLFSSL) || defined(USE_BEARSSL)
int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks)
{
struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET];
@@ -624,7 +624,7 @@ void Curl_ssl_close(struct connectdata *conn, int sockindex)
{
DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));
Curl_ssl->close_one(conn, sockindex);
- conn->ssl[sockindex].state = ssl_connection_none;
+ conn->ssl[sockindex].state = ssl_connection_none;
}
CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex)
@@ -667,13 +667,13 @@ struct curl_slist *Curl_ssl_engines_list(struct Curl_easy *data)
*/
CURLcode Curl_ssl_initsessions(struct Curl_easy *data, size_t amount)
{
- struct Curl_ssl_session *session;
+ struct Curl_ssl_session *session;
if(data->state.session)
/* this is just a precaution to prevent multiple inits */
return CURLE_OK;
- session = calloc(amount, sizeof(struct Curl_ssl_session));
+ session = calloc(amount, sizeof(struct Curl_ssl_session));
if(!session)
return CURLE_OUT_OF_MEMORY;
@@ -752,7 +752,7 @@ CURLcode Curl_ssl_init_certinfo(struct Curl_easy *data, int num)
}
/*
- * 'value' is NOT a null-terminated string
+ * 'value' is NOT a null-terminated string
*/
CURLcode Curl_ssl_push_certinfo_len(struct Curl_easy *data,
int certnum,
@@ -774,10 +774,10 @@ CURLcode Curl_ssl_push_certinfo_len(struct Curl_easy *data,
/* sprintf the label and colon */
msnprintf(output, outlen, "%s:", label);
- /* memcpy the value (it might not be null-terminated) */
+ /* memcpy the value (it might not be null-terminated) */
memcpy(&output[labellen + 1], value, valuelen);
- /* null-terminate the output */
+ /* null-terminate the output */
output[labellen + 1 + valuelen] = 0;
nl = Curl_slist_append_nodup(ci->certinfo[certnum], output);
@@ -1152,7 +1152,7 @@ bool Curl_none_false_start(void)
CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen,
unsigned char *md5sum, size_t md5len UNUSED_PARAM)
{
- struct MD5_context *MD5pw;
+ struct MD5_context *MD5pw;
(void)md5len;
@@ -1262,8 +1262,8 @@ const struct Curl_ssl *Curl_ssl =
&Curl_ssl_schannel;
#elif defined(USE_MESALINK)
&Curl_ssl_mesalink;
-#elif defined(USE_BEARSSL)
- &Curl_ssl_bearssl;
+#elif defined(USE_BEARSSL)
+ &Curl_ssl_bearssl;
#else
#error "Missing struct Curl_ssl for selected SSL backend"
#endif
@@ -1296,9 +1296,9 @@ static const struct Curl_ssl *available_backends[] = {
#if defined(USE_MESALINK)
&Curl_ssl_mesalink,
#endif
-#if defined(USE_BEARSSL)
- &Curl_ssl_bearssl,
-#endif
+#if defined(USE_BEARSSL)
+ &Curl_ssl_bearssl,
+#endif
NULL
};
@@ -1306,7 +1306,7 @@ static size_t Curl_multissl_version(char *buffer, size_t size)
{
static const struct Curl_ssl *selected;
static char backends[200];
- static size_t backends_len;
+ static size_t backends_len;
const struct Curl_ssl *current;
current = Curl_ssl == &Curl_ssl_multi ? available_backends[0] : Curl_ssl;
@@ -1318,32 +1318,32 @@ static size_t Curl_multissl_version(char *buffer, size_t size)
selected = current;
- backends[0] = '\0';
-
- for(i = 0; available_backends[i]; ++i) {
- char vb[200];
- bool paren = (selected != available_backends[i]);
-
- if(available_backends[i]->version(vb, sizeof(vb))) {
- p += msnprintf(p, end - p, "%s%s%s%s", (p != backends ? " " : ""),
- (paren ? "(" : ""), vb, (paren ? ")" : ""));
- }
+ backends[0] = '\0';
+
+ for(i = 0; available_backends[i]; ++i) {
+ char vb[200];
+ bool paren = (selected != available_backends[i]);
+
+ if(available_backends[i]->version(vb, sizeof(vb))) {
+ p += msnprintf(p, end - p, "%s%s%s%s", (p != backends ? " " : ""),
+ (paren ? "(" : ""), vb, (paren ? ")" : ""));
+ }
}
-
- backends_len = p - backends;
+
+ backends_len = p - backends;
}
- if(!size)
- return 0;
-
- if(size <= backends_len) {
- strncpy(buffer, backends, size - 1);
+ if(!size)
+ return 0;
+
+ if(size <= backends_len) {
+ strncpy(buffer, backends, size - 1);
buffer[size - 1] = '\0';
- return size - 1;
+ return size - 1;
}
- strcpy(buffer, backends);
- return backends_len;
+ strcpy(buffer, backends);
+ return backends_len;
}
static int multissl_init(const struct Curl_ssl *backend)
diff --git a/contrib/libs/curl/lib/vtls/vtls.h b/contrib/libs/curl/lib/vtls/vtls.h
index aeb1cb6537..f4cab9988f 100644
--- a/contrib/libs/curl/lib/vtls/vtls.h
+++ b/contrib/libs/curl/lib/vtls/vtls.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -107,7 +107,7 @@ CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen,
#include "sectransp.h" /* SecureTransport (Darwin) version */
#include "mbedtls.h" /* mbedTLS versions */
#include "mesalink.h" /* MesaLink versions */
-#include "bearssl.h" /* BearSSL versions */
+#include "bearssl.h" /* BearSSL versions */
#ifndef MAX_PINNED_PUBKEY_SIZE
#define MAX_PINNED_PUBKEY_SIZE 1048576 /* 1MB */
@@ -123,41 +123,41 @@ CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen,
/* set of helper macros for the backends to access the correct fields. For the
proxy or for the remote host - to properly support HTTPS proxy */
-#ifndef CURL_DISABLE_PROXY
-#define SSL_IS_PROXY() \
- (CURLPROXY_HTTPS == conn->http_proxy.proxytype && \
- ssl_connection_complete != \
- conn->proxy_ssl[conn->sock[SECONDARYSOCKET] == \
- CURL_SOCKET_BAD ? FIRSTSOCKET : SECONDARYSOCKET].state)
-#define SSL_SET_OPTION(var) \
- (SSL_IS_PROXY() ? data->set.proxy_ssl.var : data->set.ssl.var)
-#define SSL_SET_OPTION_LVALUE(var) \
- (*(SSL_IS_PROXY() ? &data->set.proxy_ssl.var : &data->set.ssl.var))
-#define SSL_CONN_CONFIG(var) \
- (SSL_IS_PROXY() ? conn->proxy_ssl_config.var : conn->ssl_config.var)
-#define SSL_HOST_NAME() \
- (SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name)
-#define SSL_HOST_DISPNAME() \
- (SSL_IS_PROXY() ? conn->http_proxy.host.dispname : conn->host.dispname)
-#define SSL_PINNED_PUB_KEY() (SSL_IS_PROXY() \
- ? data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] \
- : data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG])
-#else
-#define SSL_IS_PROXY() FALSE
-#define SSL_SET_OPTION(var) data->set.ssl.var
-#define SSL_SET_OPTION_LVALUE(var) data->set.ssl.var
-#define SSL_CONN_CONFIG(var) conn->ssl_config.var
-#define SSL_HOST_NAME() conn->host.name
-#define SSL_HOST_DISPNAME() conn->host.dispname
-#define SSL_PINNED_PUB_KEY() \
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG]
-#endif
-
-bool Curl_ssl_config_matches(struct ssl_primary_config *data,
- struct ssl_primary_config *needle);
+#ifndef CURL_DISABLE_PROXY
+#define SSL_IS_PROXY() \
+ (CURLPROXY_HTTPS == conn->http_proxy.proxytype && \
+ ssl_connection_complete != \
+ conn->proxy_ssl[conn->sock[SECONDARYSOCKET] == \
+ CURL_SOCKET_BAD ? FIRSTSOCKET : SECONDARYSOCKET].state)
+#define SSL_SET_OPTION(var) \
+ (SSL_IS_PROXY() ? data->set.proxy_ssl.var : data->set.ssl.var)
+#define SSL_SET_OPTION_LVALUE(var) \
+ (*(SSL_IS_PROXY() ? &data->set.proxy_ssl.var : &data->set.ssl.var))
+#define SSL_CONN_CONFIG(var) \
+ (SSL_IS_PROXY() ? conn->proxy_ssl_config.var : conn->ssl_config.var)
+#define SSL_HOST_NAME() \
+ (SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name)
+#define SSL_HOST_DISPNAME() \
+ (SSL_IS_PROXY() ? conn->http_proxy.host.dispname : conn->host.dispname)
+#define SSL_PINNED_PUB_KEY() (SSL_IS_PROXY() \
+ ? data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] \
+ : data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG])
+#else
+#define SSL_IS_PROXY() FALSE
+#define SSL_SET_OPTION(var) data->set.ssl.var
+#define SSL_SET_OPTION_LVALUE(var) data->set.ssl.var
+#define SSL_CONN_CONFIG(var) conn->ssl_config.var
+#define SSL_HOST_NAME() conn->host.name
+#define SSL_HOST_DISPNAME() conn->host.dispname
+#define SSL_PINNED_PUB_KEY() \
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG]
+#endif
+
+bool Curl_ssl_config_matches(struct ssl_primary_config *data,
+ struct ssl_primary_config *needle);
bool Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
struct ssl_primary_config *dest);
-void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc);
+void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc);
int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks);
int Curl_ssl_backend(void);
@@ -235,7 +235,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
* take sessionid object ownership from sessionid cache
* (e.g. decrement refcount).
*/
-void Curl_ssl_kill_session(struct Curl_ssl_session *session);
+void Curl_ssl_kill_session(struct Curl_ssl_session *session);
/* delete a session from the cache
* Sessionid mutex must be locked (see Curl_ssl_sessionid_lock).
* This will call engine-specific curlssl_session_free function, which must
diff --git a/contrib/libs/curl/lib/vtls/wolfssl.c b/contrib/libs/curl/lib/vtls/wolfssl.c
index 8b37965f93..ac9818824d 100644
--- a/contrib/libs/curl/lib/vtls/wolfssl.c
+++ b/contrib/libs/curl/lib/vtls/wolfssl.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -63,7 +63,7 @@
#include "sendf.h"
#include "inet_pton.h"
#include "vtls.h"
-#include "keylog.h"
+#include "keylog.h"
#include "parsedate.h"
#include "connect.h" /* for the connect timeout */
#include "select.h"
@@ -100,107 +100,107 @@ struct ssl_backend_data {
static Curl_recv wolfssl_recv;
static Curl_send wolfssl_send;
-#ifdef OPENSSL_EXTRA
-/*
- * Availability note:
- * The TLS 1.3 secret callback (wolfSSL_set_tls13_secret_cb) was added in
- * WolfSSL 4.4.0, but requires the -DHAVE_SECRET_CALLBACK build option. If that
- * option is not set, then TLS 1.3 will not be logged.
- * For TLS 1.2 and before, we use wolfSSL_get_keys().
- * SSL_get_client_random and wolfSSL_get_keys require OPENSSL_EXTRA
- * (--enable-opensslextra or --enable-all).
- */
-#if defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13)
-static int
-wolfssl_tls13_secret_callback(SSL *ssl, int id, const unsigned char *secret,
- int secretSz, void *ctx)
-{
- const char *label;
- unsigned char client_random[SSL3_RANDOM_SIZE];
- (void)ctx;
-
- if(!ssl || !Curl_tls_keylog_enabled()) {
- return 0;
- }
-
- switch(id) {
- case CLIENT_EARLY_TRAFFIC_SECRET:
- label = "CLIENT_EARLY_TRAFFIC_SECRET";
- break;
- case CLIENT_HANDSHAKE_TRAFFIC_SECRET:
- label = "CLIENT_HANDSHAKE_TRAFFIC_SECRET";
- break;
- case SERVER_HANDSHAKE_TRAFFIC_SECRET:
- label = "SERVER_HANDSHAKE_TRAFFIC_SECRET";
- break;
- case CLIENT_TRAFFIC_SECRET:
- label = "CLIENT_TRAFFIC_SECRET_0";
- break;
- case SERVER_TRAFFIC_SECRET:
- label = "SERVER_TRAFFIC_SECRET_0";
- break;
- case EARLY_EXPORTER_SECRET:
- label = "EARLY_EXPORTER_SECRET";
- break;
- case EXPORTER_SECRET:
- label = "EXPORTER_SECRET";
- break;
- default:
- return 0;
- }
-
- if(SSL_get_client_random(ssl, client_random, SSL3_RANDOM_SIZE) == 0) {
- /* Should never happen as wolfSSL_KeepArrays() was called before. */
- return 0;
- }
-
- Curl_tls_keylog_write(label, client_random, secret, secretSz);
- return 0;
-}
-#endif /* defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13) */
-
-static void
-wolfssl_log_tls12_secret(SSL *ssl)
-{
- unsigned char *ms, *sr, *cr;
- unsigned int msLen, srLen, crLen, i, x = 0;
-
-#if LIBWOLFSSL_VERSION_HEX >= 0x0300d000 /* >= 3.13.0 */
- /* wolfSSL_GetVersion is available since 3.13, we use it instead of
- * SSL_version since the latter relies on OPENSSL_ALL (--enable-opensslall or
- * --enable-all). Failing to perform this check could result in an unusable
- * key log line when TLS 1.3 is actually negotiated. */
- switch(wolfSSL_GetVersion(ssl)) {
- case WOLFSSL_SSLV3:
- case WOLFSSL_TLSV1:
- case WOLFSSL_TLSV1_1:
- case WOLFSSL_TLSV1_2:
- break;
- default:
- /* TLS 1.3 does not use this mechanism, the "master secret" returned below
- * is not directly usable. */
- return;
- }
-#endif
-
- if(SSL_get_keys(ssl, &ms, &msLen, &sr, &srLen, &cr, &crLen) != SSL_SUCCESS) {
- return;
- }
-
- /* Check for a missing master secret and skip logging. That can happen if
- * curl rejects the server certificate and aborts the handshake.
- */
- for(i = 0; i < msLen; i++) {
- x |= ms[i];
- }
- if(x == 0) {
- return;
- }
-
- Curl_tls_keylog_write("CLIENT_RANDOM", cr, ms, msLen);
-}
-#endif /* OPENSSL_EXTRA */
-
+#ifdef OPENSSL_EXTRA
+/*
+ * Availability note:
+ * The TLS 1.3 secret callback (wolfSSL_set_tls13_secret_cb) was added in
+ * WolfSSL 4.4.0, but requires the -DHAVE_SECRET_CALLBACK build option. If that
+ * option is not set, then TLS 1.3 will not be logged.
+ * For TLS 1.2 and before, we use wolfSSL_get_keys().
+ * SSL_get_client_random and wolfSSL_get_keys require OPENSSL_EXTRA
+ * (--enable-opensslextra or --enable-all).
+ */
+#if defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13)
+static int
+wolfssl_tls13_secret_callback(SSL *ssl, int id, const unsigned char *secret,
+ int secretSz, void *ctx)
+{
+ const char *label;
+ unsigned char client_random[SSL3_RANDOM_SIZE];
+ (void)ctx;
+
+ if(!ssl || !Curl_tls_keylog_enabled()) {
+ return 0;
+ }
+
+ switch(id) {
+ case CLIENT_EARLY_TRAFFIC_SECRET:
+ label = "CLIENT_EARLY_TRAFFIC_SECRET";
+ break;
+ case CLIENT_HANDSHAKE_TRAFFIC_SECRET:
+ label = "CLIENT_HANDSHAKE_TRAFFIC_SECRET";
+ break;
+ case SERVER_HANDSHAKE_TRAFFIC_SECRET:
+ label = "SERVER_HANDSHAKE_TRAFFIC_SECRET";
+ break;
+ case CLIENT_TRAFFIC_SECRET:
+ label = "CLIENT_TRAFFIC_SECRET_0";
+ break;
+ case SERVER_TRAFFIC_SECRET:
+ label = "SERVER_TRAFFIC_SECRET_0";
+ break;
+ case EARLY_EXPORTER_SECRET:
+ label = "EARLY_EXPORTER_SECRET";
+ break;
+ case EXPORTER_SECRET:
+ label = "EXPORTER_SECRET";
+ break;
+ default:
+ return 0;
+ }
+
+ if(SSL_get_client_random(ssl, client_random, SSL3_RANDOM_SIZE) == 0) {
+ /* Should never happen as wolfSSL_KeepArrays() was called before. */
+ return 0;
+ }
+
+ Curl_tls_keylog_write(label, client_random, secret, secretSz);
+ return 0;
+}
+#endif /* defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13) */
+
+static void
+wolfssl_log_tls12_secret(SSL *ssl)
+{
+ unsigned char *ms, *sr, *cr;
+ unsigned int msLen, srLen, crLen, i, x = 0;
+
+#if LIBWOLFSSL_VERSION_HEX >= 0x0300d000 /* >= 3.13.0 */
+ /* wolfSSL_GetVersion is available since 3.13, we use it instead of
+ * SSL_version since the latter relies on OPENSSL_ALL (--enable-opensslall or
+ * --enable-all). Failing to perform this check could result in an unusable
+ * key log line when TLS 1.3 is actually negotiated. */
+ switch(wolfSSL_GetVersion(ssl)) {
+ case WOLFSSL_SSLV3:
+ case WOLFSSL_TLSV1:
+ case WOLFSSL_TLSV1_1:
+ case WOLFSSL_TLSV1_2:
+ break;
+ default:
+ /* TLS 1.3 does not use this mechanism, the "master secret" returned below
+ * is not directly usable. */
+ return;
+ }
+#endif
+
+ if(SSL_get_keys(ssl, &ms, &msLen, &sr, &srLen, &cr, &crLen) != SSL_SUCCESS) {
+ return;
+ }
+
+ /* Check for a missing master secret and skip logging. That can happen if
+ * curl rejects the server certificate and aborts the handshake.
+ */
+ for(i = 0; i < msLen; i++) {
+ x |= ms[i];
+ }
+ if(x == 0) {
+ return;
+ }
+
+ Curl_tls_keylog_write("CLIENT_RANDOM", cr, ms, msLen);
+}
+#endif /* OPENSSL_EXTRA */
+
static int do_file_type(const char *type)
{
if(!type || !type[0])
@@ -222,8 +222,8 @@ wolfssl_connect_step1(struct connectdata *conn,
{
char *ciphers;
struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
SSL_METHOD* req_method = NULL;
curl_socket_t sockfd = conn->sock[sockindex];
#ifdef HAVE_SNI
@@ -303,11 +303,11 @@ wolfssl_connect_step1(struct connectdata *conn,
return CURLE_OUT_OF_MEMORY;
}
- if(backend->ctx)
- SSL_CTX_free(backend->ctx);
- backend->ctx = SSL_CTX_new(req_method);
+ if(backend->ctx)
+ SSL_CTX_free(backend->ctx);
+ backend->ctx = SSL_CTX_new(req_method);
- if(!backend->ctx) {
+ if(!backend->ctx) {
failf(data, "SSL: couldn't create a context!");
return CURLE_OUT_OF_MEMORY;
}
@@ -322,11 +322,11 @@ wolfssl_connect_step1(struct connectdata *conn,
* defaults to TLS 1.1) so we have this short circuit evaluation to find
* the minimum supported TLS version.
*/
- 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)
+ 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)
#ifdef WOLFSSL_TLS13
- && (wolfSSL_CTX_SetMinVersion(backend->ctx, WOLFSSL_TLSV1_3) != 1)
+ && (wolfSSL_CTX_SetMinVersion(backend->ctx, WOLFSSL_TLSV1_3) != 1)
#endif
) {
failf(data, "SSL: couldn't set the minimum protocol version");
@@ -338,7 +338,7 @@ wolfssl_connect_step1(struct connectdata *conn,
ciphers = SSL_CONN_CONFIG(cipher_list);
if(ciphers) {
- if(!SSL_CTX_set_cipher_list(backend->ctx, ciphers)) {
+ if(!SSL_CTX_set_cipher_list(backend->ctx, ciphers)) {
failf(data, "failed setting cipher list: %s", ciphers);
return CURLE_SSL_CIPHER;
}
@@ -348,13 +348,13 @@ wolfssl_connect_step1(struct connectdata *conn,
#ifndef NO_FILESYSTEM
/* load trusted cacert */
if(SSL_CONN_CONFIG(CAfile)) {
- if(1 != SSL_CTX_load_verify_locations(backend->ctx,
+ if(1 != SSL_CTX_load_verify_locations(backend->ctx,
SSL_CONN_CONFIG(CAfile),
SSL_CONN_CONFIG(CApath))) {
if(SSL_CONN_CONFIG(verifypeer)) {
/* Fail if we insist on successfully verifying the server. */
- failf(data, "error setting certificate verify locations:"
- " CAfile: %s CApath: %s",
+ failf(data, "error setting certificate verify locations:"
+ " CAfile: %s CApath: %s",
SSL_CONN_CONFIG(CAfile)?
SSL_CONN_CONFIG(CAfile): "none",
SSL_CONN_CONFIG(CApath)?
@@ -372,26 +372,26 @@ wolfssl_connect_step1(struct connectdata *conn,
/* Everything is fine. */
infof(data, "successfully set certificate verify locations:\n");
}
- infof(data, " CAfile: %s\n",
- SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile) : "none");
- infof(data, " CApath: %s\n",
- SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath) : "none");
+ infof(data, " CAfile: %s\n",
+ SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile) : "none");
+ infof(data, " CApath: %s\n",
+ SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath) : "none");
}
/* Load the client certificate, and private key */
- if(SSL_SET_OPTION(primary.clientcert) && SSL_SET_OPTION(key)) {
+ if(SSL_SET_OPTION(primary.clientcert) && SSL_SET_OPTION(key)) {
int file_type = do_file_type(SSL_SET_OPTION(cert_type));
- if(SSL_CTX_use_certificate_file(backend->ctx,
- SSL_SET_OPTION(primary.clientcert),
- file_type) != 1) {
+ if(SSL_CTX_use_certificate_file(backend->ctx,
+ SSL_SET_OPTION(primary.clientcert),
+ file_type) != 1) {
failf(data, "unable to use client certificate (no key or wrong pass"
" phrase?)");
return CURLE_SSL_CONNECT_ERROR;
}
file_type = do_file_type(SSL_SET_OPTION(key_type));
- if(SSL_CTX_use_PrivateKey_file(backend->ctx, SSL_SET_OPTION(key),
+ if(SSL_CTX_use_PrivateKey_file(backend->ctx, SSL_SET_OPTION(key),
file_type) != 1) {
failf(data, "unable to set private key");
return CURLE_SSL_CONNECT_ERROR;
@@ -403,7 +403,7 @@ wolfssl_connect_step1(struct connectdata *conn,
* fail to connect if the verification fails, or if it should continue
* anyway. In the latter case the result of the verification is checked with
* SSL_get_verify_result() below. */
- SSL_CTX_set_verify(backend->ctx,
+ SSL_CTX_set_verify(backend->ctx,
SSL_CONN_CONFIG(verifypeer)?SSL_VERIFY_PEER:
SSL_VERIFY_NONE,
NULL);
@@ -414,19 +414,19 @@ wolfssl_connect_step1(struct connectdata *conn,
#ifdef ENABLE_IPV6
struct in6_addr addr6;
#endif
-#ifndef CURL_DISABLE_PROXY
+#ifndef CURL_DISABLE_PROXY
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
-#else
- const char * const hostname = conn->host.name;
-#endif
+#else
+ const char * const hostname = conn->host.name;
+#endif
size_t hostname_len = strlen(hostname);
if((hostname_len < USHRT_MAX) &&
(0 == Curl_inet_pton(AF_INET, hostname, &addr4)) &&
#ifdef ENABLE_IPV6
(0 == Curl_inet_pton(AF_INET6, hostname, &addr6)) &&
#endif
- (wolfSSL_CTX_UseSNI(backend->ctx, WOLFSSL_SNI_HOST_NAME, hostname,
+ (wolfSSL_CTX_UseSNI(backend->ctx, WOLFSSL_SNI_HOST_NAME, hostname,
(unsigned short)hostname_len) != 1)) {
infof(data, "WARNING: failed to configure server name indication (SNI) "
"TLS extension\n");
@@ -436,7 +436,7 @@ wolfssl_connect_step1(struct connectdata *conn,
/* give application a chance to interfere with SSL set up. */
if(data->set.ssl.fsslctx) {
- CURLcode result = (*data->set.ssl.fsslctx)(data, backend->ctx,
+ CURLcode result = (*data->set.ssl.fsslctx)(data, backend->ctx,
data->set.ssl.fsslctxp);
if(result) {
failf(data, "error signaled by ssl ctx callback");
@@ -454,10 +454,10 @@ wolfssl_connect_step1(struct connectdata *conn,
#endif
/* Let's make an SSL structure */
- if(backend->handle)
- SSL_free(backend->handle);
- backend->handle = SSL_new(backend->ctx);
- if(!backend->handle) {
+ if(backend->handle)
+ SSL_free(backend->handle);
+ backend->handle = SSL_new(backend->ctx);
+ if(!backend->handle) {
failf(data, "SSL: couldn't create a context (handle)!");
return CURLE_OUT_OF_MEMORY;
}
@@ -480,7 +480,7 @@ wolfssl_connect_step1(struct connectdata *conn,
strcpy(protocols + strlen(protocols), ALPN_HTTP_1_1);
infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1);
- if(wolfSSL_UseALPN(backend->handle, protocols,
+ if(wolfSSL_UseALPN(backend->handle, protocols,
(unsigned)strlen(protocols),
WOLFSSL_ALPN_CONTINUE_ON_MISMATCH) != SSL_SUCCESS) {
failf(data, "SSL: failed setting ALPN protocols");
@@ -489,17 +489,17 @@ wolfssl_connect_step1(struct connectdata *conn,
}
#endif /* HAVE_ALPN */
-#ifdef OPENSSL_EXTRA
- if(Curl_tls_keylog_enabled()) {
- /* Ensure the Client Random is preserved. */
- wolfSSL_KeepArrays(backend->handle);
-#if defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13)
- wolfSSL_set_tls13_secret_cb(backend->handle,
- wolfssl_tls13_secret_callback, NULL);
-#endif
- }
-#endif /* OPENSSL_EXTRA */
-
+#ifdef OPENSSL_EXTRA
+ if(Curl_tls_keylog_enabled()) {
+ /* Ensure the Client Random is preserved. */
+ wolfSSL_KeepArrays(backend->handle);
+#if defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13)
+ wolfSSL_set_tls13_secret_cb(backend->handle,
+ wolfssl_tls13_secret_callback, NULL);
+#endif
+ }
+#endif /* OPENSSL_EXTRA */
+
/* Check if there's a cached ID we can/should use here! */
if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid = NULL;
@@ -507,11 +507,11 @@ wolfssl_connect_step1(struct connectdata *conn,
Curl_ssl_sessionid_lock(conn);
if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL, sockindex)) {
/* we got a session id, use it! */
- if(!SSL_set_session(backend->handle, ssl_sessionid)) {
+ if(!SSL_set_session(backend->handle, ssl_sessionid)) {
char error_buffer[WOLFSSL_MAX_ERROR_SZ];
Curl_ssl_sessionid_unlock(conn);
failf(data, "SSL: SSL_set_session failed: %s",
- ERR_error_string(SSL_get_error(backend->handle, 0),
+ ERR_error_string(SSL_get_error(backend->handle, 0),
error_buffer));
return CURLE_SSL_CONNECT_ERROR;
}
@@ -522,7 +522,7 @@ wolfssl_connect_step1(struct connectdata *conn,
}
/* pass the raw socket into the SSL layer */
- if(!SSL_set_fd(backend->handle, (int)sockfd)) {
+ if(!SSL_set_fd(backend->handle, (int)sockfd)) {
failf(data, "SSL: SSL_set_fd failed");
return CURLE_SSL_CONNECT_ERROR;
}
@@ -538,62 +538,62 @@ wolfssl_connect_step2(struct connectdata *conn,
{
int ret = -1;
struct Curl_easy *data = conn->data;
- struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
-#ifndef CURL_DISABLE_PROXY
+ struct ssl_connect_data *connssl = &conn->ssl[sockindex];
+ struct ssl_backend_data *backend = connssl->backend;
+#ifndef CURL_DISABLE_PROXY
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const char * const dispname = SSL_IS_PROXY() ?
conn->http_proxy.host.dispname : conn->host.dispname;
const char * const pinnedpubkey = SSL_IS_PROXY() ?
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
-#else
- const char * const hostname = conn->host.name;
- const char * const dispname = conn->host.dispname;
- const char * const pinnedpubkey =
- data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
-#endif
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] :
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
+#else
+ const char * const hostname = conn->host.name;
+ const char * const dispname = conn->host.dispname;
+ const char * const pinnedpubkey =
+ data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG];
+#endif
conn->recv[sockindex] = wolfssl_recv;
conn->send[sockindex] = wolfssl_send;
/* Enable RFC2818 checks */
if(SSL_CONN_CONFIG(verifyhost)) {
- ret = wolfSSL_check_domain_name(backend->handle, hostname);
+ ret = wolfSSL_check_domain_name(backend->handle, hostname);
if(ret == SSL_FAILURE)
return CURLE_OUT_OF_MEMORY;
}
- ret = SSL_connect(backend->handle);
-
-#ifdef OPENSSL_EXTRA
- if(Curl_tls_keylog_enabled()) {
- /* If key logging is enabled, wait for the handshake to complete and then
- * proceed with logging secrets (for TLS 1.2 or older).
- *
- * During the handshake (ret==-1), wolfSSL_want_read() is true as it waits
- * for the server response. At that point the master secret is not yet
- * available, so we must not try to read it.
- * To log the secret on completion with a handshake failure, detect
- * completion via the observation that there is nothing to read or write.
- * Note that OpenSSL SSL_want_read() is always true here. If wolfSSL ever
- * changes, the worst case is that no key is logged on error.
- */
- if(ret == SSL_SUCCESS ||
- (!wolfSSL_want_read(backend->handle) &&
- !wolfSSL_want_write(backend->handle))) {
- wolfssl_log_tls12_secret(backend->handle);
- /* Client Random and master secrets are no longer needed, erase these.
- * Ignored while the handshake is still in progress. */
- wolfSSL_FreeArrays(backend->handle);
- }
- }
-#endif /* OPENSSL_EXTRA */
-
+ ret = SSL_connect(backend->handle);
+
+#ifdef OPENSSL_EXTRA
+ if(Curl_tls_keylog_enabled()) {
+ /* If key logging is enabled, wait for the handshake to complete and then
+ * proceed with logging secrets (for TLS 1.2 or older).
+ *
+ * During the handshake (ret==-1), wolfSSL_want_read() is true as it waits
+ * for the server response. At that point the master secret is not yet
+ * available, so we must not try to read it.
+ * To log the secret on completion with a handshake failure, detect
+ * completion via the observation that there is nothing to read or write.
+ * Note that OpenSSL SSL_want_read() is always true here. If wolfSSL ever
+ * changes, the worst case is that no key is logged on error.
+ */
+ if(ret == SSL_SUCCESS ||
+ (!wolfSSL_want_read(backend->handle) &&
+ !wolfSSL_want_write(backend->handle))) {
+ wolfssl_log_tls12_secret(backend->handle);
+ /* Client Random and master secrets are no longer needed, erase these.
+ * Ignored while the handshake is still in progress. */
+ wolfSSL_FreeArrays(backend->handle);
+ }
+ }
+#endif /* OPENSSL_EXTRA */
+
if(ret != 1) {
char error_buffer[WOLFSSL_MAX_ERROR_SZ];
- int detail = SSL_get_error(backend->handle, ret);
+ int detail = SSL_get_error(backend->handle, ret);
if(SSL_ERROR_WANT_READ == detail) {
connssl->connecting_state = ssl_connect_2_reading;
@@ -658,11 +658,11 @@ wolfssl_connect_step2(struct connectdata *conn,
X509 *x509;
const char *x509_der;
int x509_der_len;
- struct Curl_X509certificate x509_parsed;
- struct Curl_asn1Element *pubkey;
+ struct Curl_X509certificate x509_parsed;
+ struct Curl_asn1Element *pubkey;
CURLcode result;
- x509 = SSL_get_peer_certificate(backend->handle);
+ x509 = SSL_get_peer_certificate(backend->handle);
if(!x509) {
failf(data, "SSL: failed retrieving server certificate");
return CURLE_SSL_PINNEDPUBKEYNOTMATCH;
@@ -704,7 +704,7 @@ wolfssl_connect_step2(struct connectdata *conn,
char *protocol = NULL;
unsigned short protocol_len = 0;
- rc = wolfSSL_ALPN_GetProtocol(backend->handle, &protocol, &protocol_len);
+ rc = wolfSSL_ALPN_GetProtocol(backend->handle, &protocol, &protocol_len);
if(rc == SSL_SUCCESS) {
infof(data, "ALPN, server accepted to use %.*s\n", protocol_len,
@@ -738,8 +738,8 @@ wolfssl_connect_step2(struct connectdata *conn,
connssl->connecting_state = ssl_connect_3;
#if (LIBWOLFSSL_VERSION_HEX >= 0x03009010)
infof(data, "SSL connection using %s / %s\n",
- wolfSSL_get_version(backend->handle),
- wolfSSL_get_cipher_name(backend->handle));
+ wolfSSL_get_version(backend->handle),
+ wolfSSL_get_cipher_name(backend->handle));
#else
infof(data, "SSL connected\n");
#endif
@@ -755,7 +755,7 @@ wolfssl_connect_step3(struct connectdata *conn,
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
@@ -764,7 +764,7 @@ wolfssl_connect_step3(struct connectdata *conn,
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
- our_ssl_sessionid = SSL_get_session(backend->handle);
+ our_ssl_sessionid = SSL_get_session(backend->handle);
Curl_ssl_sessionid_lock(conn);
incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL,
@@ -802,13 +802,13 @@ static ssize_t wolfssl_send(struct connectdata *conn,
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
char error_buffer[WOLFSSL_MAX_ERROR_SZ];
- int memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len;
- int rc = SSL_write(backend->handle, mem, memlen);
+ int memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len;
+ int rc = SSL_write(backend->handle, mem, memlen);
if(rc < 0) {
- int err = SSL_get_error(backend->handle, rc);
+ int err = SSL_get_error(backend->handle, rc);
switch(err) {
case SSL_ERROR_WANT_READ:
@@ -830,33 +830,33 @@ static ssize_t wolfssl_send(struct connectdata *conn,
static void Curl_wolfssl_close(struct connectdata *conn, int sockindex)
{
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
- if(backend->handle) {
- (void)SSL_shutdown(backend->handle);
- SSL_free(backend->handle);
- backend->handle = NULL;
+ if(backend->handle) {
+ (void)SSL_shutdown(backend->handle);
+ SSL_free(backend->handle);
+ backend->handle = NULL;
}
- if(backend->ctx) {
- SSL_CTX_free(backend->ctx);
- backend->ctx = NULL;
+ if(backend->ctx) {
+ SSL_CTX_free(backend->ctx);
+ backend->ctx = NULL;
}
}
static ssize_t wolfssl_recv(struct connectdata *conn,
- int num,
- char *buf,
- size_t buffersize,
- CURLcode *curlcode)
+ int num,
+ char *buf,
+ size_t buffersize,
+ CURLcode *curlcode)
{
struct ssl_connect_data *connssl = &conn->ssl[num];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
char error_buffer[WOLFSSL_MAX_ERROR_SZ];
- int buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;
- int nread = SSL_read(backend->handle, buf, buffsize);
+ int buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;
+ int nread = SSL_read(backend->handle, buf, buffsize);
if(nread < 0) {
- int err = SSL_get_error(backend->handle, nread);
+ int err = SSL_get_error(backend->handle, nread);
switch(err) {
case SSL_ERROR_ZERO_RETURN: /* no more data */
@@ -897,9 +897,9 @@ static size_t Curl_wolfssl_version(char *buffer, size_t size)
static int Curl_wolfssl_init(void)
{
-#ifdef OPENSSL_EXTRA
- Curl_tls_keylog_open();
-#endif
+#ifdef OPENSSL_EXTRA
+ Curl_tls_keylog_open();
+#endif
return (wolfSSL_Init() == SSL_SUCCESS);
}
@@ -907,19 +907,19 @@ static int Curl_wolfssl_init(void)
static void Curl_wolfssl_cleanup(void)
{
wolfSSL_Cleanup();
-#ifdef OPENSSL_EXTRA
- Curl_tls_keylog_close();
-#endif
+#ifdef OPENSSL_EXTRA
+ Curl_tls_keylog_close();
+#endif
}
-static bool Curl_wolfssl_data_pending(const struct connectdata *conn,
- int connindex)
+static bool Curl_wolfssl_data_pending(const struct connectdata *conn,
+ int connindex)
{
const struct ssl_connect_data *connssl = &conn->ssl[connindex];
- struct ssl_backend_data *backend = connssl->backend;
- if(backend->handle) /* SSL is in use */
- return (0 != SSL_pending(backend->handle)) ? TRUE : FALSE;
+ struct ssl_backend_data *backend = connssl->backend;
+ if(backend->handle) /* SSL is in use */
+ return (0 != SSL_pending(backend->handle)) ? TRUE : FALSE;
else
return FALSE;
}
@@ -933,11 +933,11 @@ static int Curl_wolfssl_shutdown(struct connectdata *conn, int sockindex)
{
int retval = 0;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
- if(backend->handle) {
- SSL_free(backend->handle);
- backend->handle = NULL;
+ if(backend->handle) {
+ SSL_free(backend->handle);
+ backend->handle = NULL;
}
return retval;
}
@@ -963,7 +963,7 @@ wolfssl_connect_common(struct connectdata *conn,
if(ssl_connect_1 == connssl->connecting_state) {
/* Find out how much more time we're allowed */
- const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
@@ -981,7 +981,7 @@ wolfssl_connect_common(struct connectdata *conn,
ssl_connect_2_writing == connssl->connecting_state) {
/* check allowed time left */
- const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
+ const timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* no need to continue if time already is up */
@@ -1080,7 +1080,7 @@ static CURLcode Curl_wolfssl_connect(struct connectdata *conn, int sockindex)
static CURLcode Curl_wolfssl_random(struct Curl_easy *data,
unsigned char *entropy, size_t length)
{
- WC_RNG rng;
+ WC_RNG rng;
(void)data;
if(wc_InitRng(&rng))
return CURLE_FAILED_INIT;
@@ -1094,11 +1094,11 @@ static CURLcode Curl_wolfssl_random(struct Curl_easy *data,
}
static CURLcode Curl_wolfssl_sha256sum(const unsigned char *tmp, /* input */
- size_t tmplen,
- unsigned char *sha256sum /* output */,
- size_t unused)
+ size_t tmplen,
+ unsigned char *sha256sum /* output */,
+ size_t unused)
{
- wc_Sha256 SHA256pw;
+ wc_Sha256 SHA256pw;
(void)unused;
wc_InitSha256(&SHA256pw);
wc_Sha256Update(&SHA256pw, tmp, (word32)tmplen);
@@ -1107,11 +1107,11 @@ static CURLcode Curl_wolfssl_sha256sum(const unsigned char *tmp, /* input */
}
static void *Curl_wolfssl_get_internals(struct ssl_connect_data *connssl,
- CURLINFO info UNUSED_PARAM)
+ CURLINFO info UNUSED_PARAM)
{
- struct ssl_backend_data *backend = connssl->backend;
+ struct ssl_backend_data *backend = connssl->backend;
(void)info;
- return backend->handle;
+ return backend->handle;
}
const struct Curl_ssl Curl_ssl_wolfssl = {
diff --git a/contrib/libs/curl/lib/vtls/wolfssl.h b/contrib/libs/curl/lib/vtls/wolfssl.h
index 7c8b9e07dd..d411e6913e 100644
--- a/contrib/libs/curl/lib/vtls/wolfssl.h
+++ b/contrib/libs/curl/lib/vtls/wolfssl.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/warnless.c b/contrib/libs/curl/lib/warnless.c
index bfd7721776..908ee6cb70 100644
--- a/contrib/libs/curl/lib/warnless.c
+++ b/contrib/libs/curl/lib/warnless.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/warnless.h b/contrib/libs/curl/lib/warnless.h
index 81940b718a..ca3737859b 100644
--- a/contrib/libs/curl/lib/warnless.h
+++ b/contrib/libs/curl/lib/warnless.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/wildcard.c b/contrib/libs/curl/lib/wildcard.c
index 5f2a5d0913..105bcce4ed 100644
--- a/contrib/libs/curl/lib/wildcard.c
+++ b/contrib/libs/curl/lib/wildcard.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
diff --git a/contrib/libs/curl/lib/wildcard.h b/contrib/libs/curl/lib/wildcard.h
index 52584f4a6a..081be9ed93 100644
--- a/contrib/libs/curl/lib/wildcard.h
+++ b/contrib/libs/curl/lib/wildcard.h
@@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2010 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2010 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -39,18 +39,18 @@ typedef enum {
CURLWC_ERROR, /* error cases */
CURLWC_DONE /* if is wildcard->state == CURLWC_DONE wildcard loop
will end */
-} wildcard_states;
+} wildcard_states;
-typedef void (*wildcard_dtor)(void *ptr);
+typedef void (*wildcard_dtor)(void *ptr);
/* struct keeping information about wildcard download process */
struct WildcardData {
- wildcard_states state;
+ wildcard_states state;
char *path; /* path to the directory, where we trying wildcard-match */
char *pattern; /* wildcard pattern */
- struct Curl_llist filelist; /* llist with struct Curl_fileinfo */
+ struct Curl_llist filelist; /* llist with struct Curl_fileinfo */
void *protdata; /* pointer to protocol specific temporary data */
- wildcard_dtor dtor;
+ wildcard_dtor dtor;
void *customptr; /* for CURLOPT_CHUNK_DATA pointer */
};
diff --git a/contrib/libs/curl/lib/x509asn1.c b/contrib/libs/curl/lib/x509asn1.c
index f3bf0fd7f6..d7cf9eb2af 100644
--- a/contrib/libs/curl/lib/x509asn1.c
+++ b/contrib/libs/curl/lib/x509asn1.c
@@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -44,7 +44,7 @@
static const char cnOID[] = "2.5.4.3"; /* Common name. */
static const char sanOID[] = "2.5.29.17"; /* Subject alternative name. */
-static const struct Curl_OID OIDtable[] = {
+static const struct Curl_OID OIDtable[] = {
{ "1.2.840.10040.4.1", "dsa" },
{ "1.2.840.10040.4.3", "dsa-with-sha1" },
{ "1.2.840.10045.2.1", "ecPublicKey" },
@@ -103,16 +103,16 @@ static const struct Curl_OID OIDtable[] = {
* Please note there is no pretention here to rewrite a full SSL library.
*/
-static const char *getASN1Element(struct Curl_asn1Element *elem,
+static const char *getASN1Element(struct Curl_asn1Element *elem,
const char *beg, const char *end)
WARN_UNUSED_RESULT;
-static const char *getASN1Element(struct Curl_asn1Element *elem,
+static const char *getASN1Element(struct Curl_asn1Element *elem,
const char *beg, const char *end)
{
unsigned char b;
unsigned long len;
- struct Curl_asn1Element lelem;
+ struct Curl_asn1Element lelem;
/* Get a single ASN.1 element into `elem', parse ASN.1 string at `beg'
ending at `end'.
@@ -176,9 +176,9 @@ static const char *getASN1Element(struct Curl_asn1Element *elem,
* Search the null terminated OID or OID identifier in local table.
* Return the table entry pointer or NULL if not found.
*/
-static const struct Curl_OID *searchOID(const char *oid)
+static const struct Curl_OID *searchOID(const char *oid)
{
- const struct Curl_OID *op;
+ const struct Curl_OID *op;
for(op = OIDtable; op->numoid; op++)
if(!strcmp(op->numoid, oid) || strcasecompare(op->textoid, oid))
return op;
@@ -445,7 +445,7 @@ static const char *OID2str(const char *beg, const char *end, bool symbolic)
buf[buflen] = '\0';
if(symbolic) {
- const struct Curl_OID *op = searchOID(buf);
+ const struct Curl_OID *op = searchOID(buf);
if(op) {
free(buf);
buf = strdup(op->textoid);
@@ -565,7 +565,7 @@ static const char *UTime2str(const char *beg, const char *end)
* Convert an ASN.1 element to a printable string.
* Return the dynamically allocated string, or NULL if an error occurs.
*/
-static const char *ASN1tostr(struct Curl_asn1Element *elem, int type)
+static const char *ASN1tostr(struct Curl_asn1Element *elem, int type)
{
if(elem->constructed)
return NULL; /* No conversion of structured elements. */
@@ -609,12 +609,12 @@ static const char *ASN1tostr(struct Curl_asn1Element *elem, int type)
* ASCII encode distinguished name at `dn' into the `buflen'-sized buffer at
* `buf'. Return the total string length, even if larger than `buflen'.
*/
-static ssize_t encodeDN(char *buf, size_t buflen, struct Curl_asn1Element *dn)
+static ssize_t encodeDN(char *buf, size_t buflen, struct Curl_asn1Element *dn)
{
- struct Curl_asn1Element rdn;
- struct Curl_asn1Element atv;
- struct Curl_asn1Element oid;
- struct Curl_asn1Element value;
+ struct Curl_asn1Element rdn;
+ struct Curl_asn1Element atv;
+ struct Curl_asn1Element oid;
+ struct Curl_asn1Element value;
size_t l = 0;
const char *p1;
const char *p2;
@@ -683,7 +683,7 @@ static ssize_t encodeDN(char *buf, size_t buflen, struct Curl_asn1Element *dn)
* Convert an ASN.1 distinguished name into a printable string.
* Return the dynamically allocated string, or NULL if an error occurs.
*/
-static const char *DNtostr(struct Curl_asn1Element *dn)
+static const char *DNtostr(struct Curl_asn1Element *dn)
{
char *buf = NULL;
ssize_t buflen = encodeDN(NULL, 0, dn);
@@ -703,11 +703,11 @@ static const char *DNtostr(struct Curl_asn1Element *dn)
* Syntax is assumed to have already been checked by the SSL backend.
* See RFC 5280.
*/
-int Curl_parseX509(struct Curl_X509certificate *cert,
+int Curl_parseX509(struct Curl_X509certificate *cert,
const char *beg, const char *end)
{
- struct Curl_asn1Element elem;
- struct Curl_asn1Element tbsCertificate;
+ struct Curl_asn1Element elem;
+ struct Curl_asn1Element tbsCertificate;
const char *ccp;
static const char defaultVersion = 0; /* v1. */
@@ -835,10 +835,10 @@ static size_t copySubstring(char *to, const char *from)
return i;
}
-static const char *dumpAlgo(struct Curl_asn1Element *param,
+static const char *dumpAlgo(struct Curl_asn1Element *param,
const char *beg, const char *end)
{
- struct Curl_asn1Element oid;
+ struct Curl_asn1Element oid;
/* Get algorithm parameters and return algorithm name. */
@@ -855,7 +855,7 @@ static const char *dumpAlgo(struct Curl_asn1Element *param,
}
static void do_pubkey_field(struct Curl_easy *data, int certnum,
- const char *label, struct Curl_asn1Element *elem)
+ const char *label, struct Curl_asn1Element *elem)
{
const char *output;
@@ -872,11 +872,11 @@ static void do_pubkey_field(struct Curl_easy *data, int certnum,
}
static void do_pubkey(struct Curl_easy *data, int certnum,
- const char *algo, struct Curl_asn1Element *param,
- struct Curl_asn1Element *pubkey)
+ const char *algo, struct Curl_asn1Element *param,
+ struct Curl_asn1Element *pubkey)
{
- struct Curl_asn1Element elem;
- struct Curl_asn1Element pk;
+ struct Curl_asn1Element elem;
+ struct Curl_asn1Element pk;
const char *p;
/* Generate all information records for the public key. */
@@ -950,9 +950,9 @@ CURLcode Curl_extract_certinfo(struct connectdata *conn,
const char *beg,
const char *end)
{
- struct Curl_X509certificate cert;
+ struct Curl_X509certificate cert;
struct Curl_easy *data = conn->data;
- struct Curl_asn1Element param;
+ struct Curl_asn1Element param;
const char *ccp;
char *cp1;
size_t cl1;
@@ -1111,7 +1111,7 @@ CURLcode Curl_extract_certinfo(struct connectdata *conn,
static const char *checkOID(const char *beg, const char *end,
const char *oid)
{
- struct Curl_asn1Element e;
+ struct Curl_asn1Element e;
const char *ccp;
const char *p;
bool matched;
@@ -1136,21 +1136,21 @@ CURLcode Curl_verifyhost(struct connectdata *conn,
const char *beg, const char *end)
{
struct Curl_easy *data = conn->data;
- struct Curl_X509certificate cert;
- struct Curl_asn1Element dn;
- struct Curl_asn1Element elem;
- struct Curl_asn1Element ext;
- struct Curl_asn1Element name;
+ struct Curl_X509certificate cert;
+ struct Curl_asn1Element dn;
+ struct Curl_asn1Element elem;
+ struct Curl_asn1Element ext;
+ struct Curl_asn1Element name;
const char *p;
const char *q;
char *dnsname;
int matched = -1;
size_t addrlen = (size_t) -1;
ssize_t len;
- const char *const hostname = SSL_IS_PROXY()?
- conn->http_proxy.host.name : conn->host.name;
- const char *const dispname = SSL_IS_PROXY()?
- conn->http_proxy.host.dispname : conn->host.dispname;
+ const char *const hostname = SSL_IS_PROXY()?
+ conn->http_proxy.host.name : conn->host.name;
+ const char *const dispname = SSL_IS_PROXY()?
+ conn->http_proxy.host.dispname : conn->host.dispname;
#ifdef ENABLE_IPV6
struct in6_addr addr;
#else
diff --git a/contrib/libs/curl/lib/x509asn1.h b/contrib/libs/curl/lib/x509asn1.h
index e63f4afc08..849714492d 100644
--- a/contrib/libs/curl/lib/x509asn1.h
+++ b/contrib/libs/curl/lib/x509asn1.h
@@ -8,11 +8,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, 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.se/docs/copyright.html.
+ * are also available at https://curl.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
@@ -79,51 +79,51 @@
*/
/* ASN.1 parsed element. */
-struct Curl_asn1Element {
- const char *header; /* Pointer to header byte. */
- const char *beg; /* Pointer to element data. */
- const char *end; /* Pointer to 1st byte after element. */
- unsigned char class; /* ASN.1 element class. */
- unsigned char tag; /* ASN.1 element tag. */
- bool constructed; /* Element is constructed. */
-};
+struct Curl_asn1Element {
+ const char *header; /* Pointer to header byte. */
+ const char *beg; /* Pointer to element data. */
+ const char *end; /* Pointer to 1st byte after element. */
+ unsigned char class; /* ASN.1 element class. */
+ unsigned char tag; /* ASN.1 element tag. */
+ bool constructed; /* Element is constructed. */
+};
/* ASN.1 OID table entry. */
-struct Curl_OID {
- const char *numoid; /* Dotted-numeric OID. */
- const char *textoid; /* OID name. */
-};
+struct Curl_OID {
+ const char *numoid; /* Dotted-numeric OID. */
+ const char *textoid; /* OID name. */
+};
/* X509 certificate: RFC 5280. */
-struct Curl_X509certificate {
- struct Curl_asn1Element certificate;
- struct Curl_asn1Element version;
- struct Curl_asn1Element serialNumber;
- struct Curl_asn1Element signatureAlgorithm;
- struct Curl_asn1Element signature;
- struct Curl_asn1Element issuer;
- struct Curl_asn1Element notBefore;
- struct Curl_asn1Element notAfter;
- struct Curl_asn1Element subject;
- struct Curl_asn1Element subjectPublicKeyInfo;
- struct Curl_asn1Element subjectPublicKeyAlgorithm;
- struct Curl_asn1Element subjectPublicKey;
- struct Curl_asn1Element issuerUniqueID;
- struct Curl_asn1Element subjectUniqueID;
- struct Curl_asn1Element extensions;
-};
+struct Curl_X509certificate {
+ struct Curl_asn1Element certificate;
+ struct Curl_asn1Element version;
+ struct Curl_asn1Element serialNumber;
+ struct Curl_asn1Element signatureAlgorithm;
+ struct Curl_asn1Element signature;
+ struct Curl_asn1Element issuer;
+ struct Curl_asn1Element notBefore;
+ struct Curl_asn1Element notAfter;
+ struct Curl_asn1Element subject;
+ struct Curl_asn1Element subjectPublicKeyInfo;
+ struct Curl_asn1Element subjectPublicKeyAlgorithm;
+ struct Curl_asn1Element subjectPublicKey;
+ struct Curl_asn1Element issuerUniqueID;
+ struct Curl_asn1Element subjectUniqueID;
+ struct Curl_asn1Element extensions;
+};
/*
* Prototypes.
*/
-const char *Curl_getASN1Element(struct Curl_asn1Element *elem,
- const char *beg, const char *end);
-const char *Curl_ASN1tostr(struct Curl_asn1Element *elem, int type);
-const char *Curl_DNtostr(struct Curl_asn1Element *dn);
-int Curl_parseX509(struct Curl_X509certificate *cert,
+const char *Curl_getASN1Element(struct Curl_asn1Element *elem,
+ const char *beg, const char *end);
+const char *Curl_ASN1tostr(struct Curl_asn1Element *elem, int type);
+const char *Curl_DNtostr(struct Curl_asn1Element *dn);
+int Curl_parseX509(struct Curl_X509certificate *cert,
const char *beg, const char *end);
CURLcode Curl_extract_certinfo(struct connectdata *conn, int certnum,
const char *beg, const char *end);
diff --git a/contrib/libs/curl/ya.make b/contrib/libs/curl/ya.make
index 06c77ee4a7..00027df424 100644
--- a/contrib/libs/curl/ya.make
+++ b/contrib/libs/curl/ya.make
@@ -7,7 +7,7 @@ OWNER(
g:geoapps_infra
)
-VERSION(7.74.0)
+VERSION(7.74.0)
ORIGINAL_SOURCE(https://curl.haxx.se/download/curl-7.74.0.tar.bz2)
@@ -21,49 +21,49 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
PEERDIR(
- contrib/libs/libc_compat
+ contrib/libs/libc_compat
contrib/libs/openssl
contrib/libs/zlib
)
ADDINCL(
GLOBAL contrib/libs/curl/include
- contrib/libs/c-ares
+ contrib/libs/c-ares
contrib/libs/curl/lib
)
-IF (NOT OS_WINDOWS)
+IF (NOT OS_WINDOWS)
PEERDIR(
- contrib/libs/nghttp2
+ contrib/libs/nghttp2
)
ENDIF()
-NO_COMPILER_WARNINGS()
+NO_COMPILER_WARNINGS()
-NO_RUNTIME()
-
-IF (MAPSMOBI_BUILD_TARGET)
- SET(ARCADIA_CURL_DNS_RESOLVER MULTITHREADED)
+NO_RUNTIME()
+
+IF (MAPSMOBI_BUILD_TARGET)
+ SET(ARCADIA_CURL_DNS_RESOLVER MULTITHREADED)
CFLAGS(
-DMAPSMOBI_BUILD
)
ENDIF()
-DEFAULT(ARCADIA_CURL_DNS_RESOLVER ARES)
+DEFAULT(ARCADIA_CURL_DNS_RESOLVER ARES)
CFLAGS(
GLOBAL -DCURL_STATICLIB
-DBUILDING_LIBCURL
-DHAVE_CONFIG_H
- -DARCADIA_CURL_DNS_RESOLVER_${ARCADIA_CURL_DNS_RESOLVER}
+ -DARCADIA_CURL_DNS_RESOLVER_${ARCADIA_CURL_DNS_RESOLVER}
)
-IF (ARCADIA_CURL_DNS_RESOLVER == ARES)
- PEERDIR(
- contrib/libs/c-ares
- )
-ENDIF()
-
+IF (ARCADIA_CURL_DNS_RESOLVER == ARES)
+ PEERDIR(
+ contrib/libs/c-ares
+ )
+ENDIF()
+
SRCS(
lib/altsvc.c
lib/amigaos.c
@@ -95,10 +95,10 @@ SRCS(
lib/dict.c
lib/doh.c
lib/dotdot.c
- lib/dynbuf.c
+ lib/dynbuf.c
lib/easy.c
- lib/easygetopt.c
- lib/easyoptions.c
+ lib/easygetopt.c
+ lib/easyoptions.c
lib/escape.c
lib/file.c
lib/fileinfo.c
@@ -116,7 +116,7 @@ SRCS(
lib/hostip4.c
lib/hostip6.c
lib/hostsyn.c
- lib/hsts.c
+ lib/hsts.c
lib/http.c
lib/http2.c
lib/http_chunks.c
@@ -137,7 +137,7 @@ SRCS(
lib/memdebug.c
lib/mime.c
lib/mprintf.c
- lib/mqtt.c
+ lib/mqtt.c
lib/multi.c
lib/netrc.c
lib/non-ascii.c
@@ -149,7 +149,7 @@ SRCS(
lib/progress.c
lib/psl.c
lib/rand.c
- lib/rename.c
+ lib/rename.c
lib/rtsp.c
lib/select.c
lib/sendf.c
@@ -159,7 +159,7 @@ SRCS(
lib/slist.c
lib/smb.c
lib/smtp.c
- lib/socketpair.c
+ lib/socketpair.c
lib/socks.c
lib/socks_gssapi.c
lib/socks_sspi.c
@@ -190,16 +190,16 @@ SRCS(
lib/vauth/spnego_sspi.c
lib/vauth/vauth.c
lib/version.c
- lib/version_win32.c
+ lib/version_win32.c
lib/vquic/ngtcp2.c
lib/vquic/quiche.c
- lib/vquic/vquic.c
+ lib/vquic/vquic.c
lib/vssh/libssh.c
lib/vssh/libssh2.c
- lib/vssh/wolfssh.c
- lib/vtls/bearssl.c
- lib/vtls/keylog.c
- lib/vtls/mbedtls_threadlock.c
+ lib/vssh/wolfssh.c
+ lib/vtls/bearssl.c
+ lib/vtls/keylog.c
+ lib/vtls/mbedtls_threadlock.c
lib/vtls/openssl.c
lib/vtls/sectransp.c
lib/vtls/vtls.c