Compare commits
18 Commits
curl-7_45_
...
issue-346
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d363db6ee8 | ||
|
|
854976ad7b | ||
|
|
14d5a86b3e | ||
|
|
db532eff1e | ||
|
|
3ad83bc3a6 | ||
|
|
13ddb9e54a | ||
|
|
7715a70ba2 | ||
|
|
6f8ecea059 | ||
|
|
048f84637f | ||
|
|
d30ad55c59 | ||
|
|
08e5fb4465 | ||
|
|
2e373f4a6f | ||
|
|
bce689605d | ||
|
|
8256b44e5a | ||
|
|
da2d3b5805 | ||
|
|
3771da335b | ||
|
|
8bb43ecd05 | ||
|
|
645fc44764 |
129
RELEASE-NOTES
129
RELEASE-NOTES
@@ -1,92 +1,18 @@
|
||||
Curl and libcurl 7.45.0
|
||||
Curl and libcurl 7.46.0
|
||||
|
||||
Public curl releases: 149
|
||||
Public curl releases: 150
|
||||
Command line options: 177
|
||||
curl_easy_setopt() options: 219
|
||||
Public functions in libcurl: 61
|
||||
Contributors: 1303
|
||||
Contributors: 1322
|
||||
|
||||
This release includes the following changes:
|
||||
|
||||
o added CURLOPT_DEFAULT_PROTOCOL [6]
|
||||
o added new tool option --proto-default [6]
|
||||
o getinfo: added CURLINFO_ACTIVESOCKET
|
||||
o turned CURLINFO_* option docs as stand-alone man pages
|
||||
o curl: point out unnecessary uses of -X in verbose mode [17]
|
||||
o
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o curl_global_init_mem.3: Stronger thread safety warning [1]
|
||||
o buildconf.bat: Fixed issues when ran in directories with special chars [2]
|
||||
o cmake: Fix CurlTests check for gethostbyname_r with 5 arguments
|
||||
o generate.bat: Fixed issues when ran in directories with special chars
|
||||
o generate.bat: Only call buildconf.bat if it exists
|
||||
o generate.bat: Added support for generating only the prerequisite files
|
||||
o curl.1: Document weaknesses in SSLv2 and SSLv3
|
||||
o CURLOPT_HTTP_VERSION.3: connection re-use goes before version
|
||||
o docs: Update the redirect protocols disabled by default
|
||||
o inet_pton.c: Fix MSVC run-time check failure
|
||||
o CURLMOPT_PUSHFUNCTION.3: fix argument types
|
||||
o rtsp: support basic/digest authentication
|
||||
o rtsp: stop reading empty DESCRIBE responses
|
||||
o travis: Upgrading to container based build [3]
|
||||
o travis.yml: Add OS X testbot
|
||||
o FTP: make state machine not get stuck in state
|
||||
o openssl: handle lack of server cert when strict checking disabled [4]
|
||||
o configure: change functions to detect openssl (clones) [5]
|
||||
o configure: detect latest boringssl [5]
|
||||
o runtests: Allow for spaces in server-verify curl custom path
|
||||
o http2: on_frame_recv: get a proper 'conn' for the debug logging
|
||||
o ntlm: mark deliberate switch case fall-through
|
||||
o http2: remove dead code
|
||||
o curl_easy_{escape,unescape}.3: "char *" vs. "const char *" [7]
|
||||
o curl: point out the conflicting HTTP methods if used
|
||||
o cmake: added Windows SSL support [8]
|
||||
o curl_easy_{escape,setopt}.3: fix example
|
||||
o curl_easy_escape.3: escape '\n' [9]
|
||||
o libcurl.m4: Put braces around empty if body [10]
|
||||
o buildconf.bat: Fixed double blank line in 'curl manual' warning output
|
||||
o sasl: Only define Curl_sasl_digest_get_pair() when CRYPTO_AUTH enabled
|
||||
o inet_pton.c: Fix MSVC run-time check failure
|
||||
o CURLOPT_FOLLOWLOCATION.3: mention methods for redirects
|
||||
o http2: don't pass on Connection: headers [11]
|
||||
o nss: do not directly access SSL_ImplementedCiphers [12]
|
||||
o docs: numerous cleanups and spelling fixes
|
||||
o FTP: do_more: add check for wait_data_conn in upload case [13]
|
||||
o parse_proxy: reject illegal port numbers [14]
|
||||
o cmake: IPv6 : disable Unix header check on Windows platform [15]
|
||||
o winbuild: run buildconf.bat if necessary
|
||||
o buildconf.bat: fix syntax error
|
||||
o curl_sspi: fix possibly undefined CRYPT_E_REVOKED [16]
|
||||
o nss: prevent NSS from incorrectly re-using a session [18]
|
||||
o libcurl-errors.3: add two missing error codes
|
||||
o openssl: fix build with < 0.9.8
|
||||
o openssl: refactor certificate parsing to use OpenSSL memory BIO [19]
|
||||
o openldap: only part of LDAP query results received [20]
|
||||
o ssl: add server cert's "sha256//" hash to verbose [21]
|
||||
o NTLM: Reset auth-done when using a fresh connection [22]
|
||||
o curl: generate easysrc only on --libcurl [23]
|
||||
o tests: disable 1801 until fixed [24]
|
||||
o CURLINFO_TLS_SESSION: always return backend info
|
||||
o gnutls: Support CURLOPT_KEYPASSWD
|
||||
o gnutls: Report actual GnuTLS error message for certificate errors
|
||||
o tests: disable 1510 due to CI-problems on github
|
||||
o cmake: Put "winsock2.h" before "windows.h" during configure checks
|
||||
o cmake: Ensure discovered include dirs are considered
|
||||
o configure: Add missing ')' for CURL_CHECK_OPTION_RT [25]
|
||||
o build: fix failures with -Wcast-align and -Werror [26]
|
||||
o FTP: fix uploading ASCII with unknown size
|
||||
o readwrite_data: set a max number of loops
|
||||
o http2: avoid superfluous Curl_expire() calls
|
||||
o http2: set TCP_NODELAY unconditionally [27]
|
||||
o docs: fix unescaped '\n' in man pages
|
||||
o openssl: Fix algorithm init to make (gost) engines work [28]
|
||||
o win32: make recent Borland compilers use long long
|
||||
o runtests: Fix pid check in checkdied
|
||||
o gopher: don't send NUL byte [29]
|
||||
o tool_setopt: fix c_escape truncated octal [30]
|
||||
o hiperfifo: fix the pointer passed to WRITEDATA [31]
|
||||
o getinfo: Fix return code for unknown CURLINFO options [32]
|
||||
o
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
@@ -95,52 +21,9 @@ This release includes the following known bugs:
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Alessandro Ghedini, Benjamin Kircher, Bertrand Simonnet, Brad King,
|
||||
Dan Fandrich, Daniel Hwang, Daniel Kahn Gillmor, Daniel Lee Hwang,
|
||||
Daniel Seither, Daniel Stenberg, Denis Feklushkin, Eric Ridge, Erik Janssen,
|
||||
Isaac Boukris, Jactry Zeng, Jakub Zakrzewski, Jim Hollinger, Kamil Dudka,
|
||||
Maksim Stsepanenka, Marcel Raad, Michael Kalinin, Mike Crowe,
|
||||
Nathaniel Waisbrot, Nikolai Kondrashov, Orange Tsai, Patricia Muscalu,
|
||||
Patrick Monnerat, Rajkumar Mandal, Ray Satiro, Razvan Cojocaru, Rémy Léone,
|
||||
Richard van den Berg, Sam Roth, Sergei Nikulov, Steve Holme,
|
||||
Svyatoslav Mishyn, Tatsuhiro Tsujikawa, Thorsten Schöning, Viktor Szakáts,
|
||||
W. Mark Kubacki,
|
||||
(40 contributors)
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
||||
References to bug reports and discussions on issues:
|
||||
|
||||
[1] = http://curl.haxx.se/mail/lib-2015-08/0016.html
|
||||
[2] = https://github.com/bagder/curl/pull/379
|
||||
[3] = http://curl.haxx.se/bug/?i=388
|
||||
[4] = http://curl.haxx.se/bug/?i=392
|
||||
[5] = https://android.googlesource.com/platform/external/curl/+/f551028d5caab
|
||||
29d4b4a4ae8c159c76c3cfd4887%5E!/
|
||||
[6] = http://curl.haxx.se/bug/?i=351
|
||||
[7] = http://curl.haxx.se/bug/?i=395
|
||||
[8] = http://curl.haxx.se/bug/?i=399
|
||||
[9] = http://curl.haxx.se/bug/?i=398
|
||||
[10] = http://curl.haxx.se/bug/?i=402
|
||||
[11] = http://curl.haxx.se/bug/?i=401
|
||||
[12] = https://lists.fedoraproject.org/pipermail/devel/2015-September/214117.html
|
||||
[13] = http://curl.haxx.se/bug/?i=405
|
||||
[14] = http://curl.haxx.se/bug/?i=415
|
||||
[15] = http://curl.haxx.se/bug/?i=409
|
||||
[16] = http://curl.haxx.se/bug/?i=411
|
||||
[17] = http://daniel.haxx.se/blog/2015/09/11/unnecessary-use-of-curl-x/
|
||||
[18] = https://bugzilla.mozilla.org/1202264
|
||||
[19] = http://curl.haxx.se/bug/?i=427
|
||||
[20] = http://curl.haxx.se/bug/?i=440
|
||||
[21] = http://curl.haxx.se/bug/?i=410
|
||||
[22] = http://curl.haxx.se/bug/?i=435
|
||||
[23] = http://curl.haxx.se/bug/?i=429
|
||||
[24] = http://curl.haxx.se/bug/?i=380
|
||||
[25] = http://curl.haxx.se/bug/?i=456
|
||||
[26] = http://curl.haxx.se/bug/?i=457
|
||||
[27] = http://curl.haxx.se/mail/lib-2015-09/0097.html
|
||||
[28] = http://curl.haxx.se/bug/?i=447
|
||||
[29] = http://curl.haxx.se/bug/?i=466
|
||||
[30] = http://curl.haxx.se/bug/?i=469
|
||||
[31] = http://curl.haxx.se/bug/?i=471
|
||||
[32] = http://curl.haxx.se/bug/?i=468
|
||||
[1] =
|
||||
@@ -5,7 +5,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
@@ -3052,9 +3052,6 @@ dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([CURL_CHECK_PKGCONFIG], [
|
||||
|
||||
PKGCONFIG="no"
|
||||
|
||||
AC_PATH_TOOL( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
|
||||
|
||||
if test x$PKGCONFIG != xno; then
|
||||
|
||||
@@ -39,6 +39,7 @@ AC_CONFIG_SRCDIR([lib/urldata.h])
|
||||
AC_CONFIG_HEADERS(lib/curl_config.h include/curl/curlbuild.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AM_MAINTAINER_MODE
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
CURL_CHECK_OPTION_DEBUG
|
||||
CURL_CHECK_OPTION_OPTIMIZE
|
||||
|
||||
15
docs/INSTALL
15
docs/INSTALL
@@ -950,9 +950,10 @@ REDUCING SIZE
|
||||
important factor. First, be sure to set the CFLAGS variable when
|
||||
configuring with any relevant compiler optimization flags to reduce the
|
||||
size of the binary. For gcc, this would mean at minimum the -Os option,
|
||||
and potentially the -march=X and -mdynamic-no-pic options as well, e.g.
|
||||
and potentially the -march=X, -mdynamic-no-pic and -flto options as well,
|
||||
e.g.
|
||||
|
||||
./configure CFLAGS='-Os' ...
|
||||
./configure CFLAGS='-Os' LDFLAGS='-Wl,-Bsymbolic'...
|
||||
|
||||
Note that newer compilers often produce smaller code than older versions
|
||||
due to improved optimization.
|
||||
@@ -970,7 +971,9 @@ REDUCING SIZE
|
||||
--disable-ipv6 (disables support for IPv6)
|
||||
--disable-manual (disables support for the built-in documentation)
|
||||
--disable-proxy (disables support for HTTP and SOCKS proxies)
|
||||
--disable-unix-sockets (disables support for UNIX sockets)
|
||||
--disable-verbose (eliminates debugging strings and error code strings)
|
||||
--disable-versioned-symbols (disables support for versioned symbols)
|
||||
--enable-hidden-symbols (eliminates unneeded symbols in the shared library)
|
||||
--without-libidn (disables support for the libidn DNS library)
|
||||
--without-librtmp (disables support for RTMP)
|
||||
@@ -983,7 +986,7 @@ REDUCING SIZE
|
||||
configure command-line, e.g.
|
||||
|
||||
CFLAGS="-Os -ffunction-sections -fdata-sections \
|
||||
-fno-unwind-tables -fno-asynchronous-unwind-tables" \
|
||||
-fno-unwind-tables -fno-asynchronous-unwind-tables -flto" \
|
||||
LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections"
|
||||
|
||||
Be sure also to strip debugging symbols from your binaries after
|
||||
@@ -993,9 +996,9 @@ REDUCING SIZE
|
||||
.comment section).
|
||||
|
||||
Using these techniques it is possible to create a basic HTTP-only shared
|
||||
libcurl library for i386 Linux platforms that is only 114 KiB in size, and
|
||||
an FTP-only library that is 115 KiB in size (as of libcurl version 7.35.0,
|
||||
using gcc 4.8.2).
|
||||
libcurl library for i386 Linux platforms that is only 109 KiB in size, and
|
||||
an FTP-only library that is 109 KiB in size (as of libcurl version 7.45.0,
|
||||
using gcc 4.9.2).
|
||||
|
||||
You may find that statically linking libcurl to your application will
|
||||
result in a lower total size than dynamically linking.
|
||||
|
||||
@@ -24,6 +24,8 @@ in the source code repo
|
||||
|
||||
- upload the 8 resulting files to the primary download directory
|
||||
|
||||
- upload the 4 tarballs to github for the HTTPS download
|
||||
|
||||
in the curl-www repo
|
||||
--------------------
|
||||
|
||||
@@ -78,9 +80,7 @@ Coming dates
|
||||
Based on the description above, here are some planned release dates (at the
|
||||
time of this writing):
|
||||
|
||||
- June 17, 2015 (version 7.43.0)
|
||||
- August 12, 2015
|
||||
- October 7, 2015
|
||||
- October 7, 2015 (version 7.45.0)
|
||||
- December 2, 2015
|
||||
- January 27, 2016
|
||||
- March 23, 2016
|
||||
|
||||
@@ -49,7 +49,7 @@ this option.
|
||||
You must ensure that the socket has data to read before calling
|
||||
\fIcurl_easy_recv(3)\fP, otherwise the call will return \fBCURLE_AGAIN\fP -
|
||||
the socket is used in non-blocking mode internally. Use
|
||||
\fIcurl_easy_getinfo(3)\fP with \fBCURLINFO_LASTSOCKET\fP to obtain the
|
||||
\fIcurl_easy_getinfo(3)\fP with \fBCURLINFO_ACTIVESOCKET(3)\fP to obtain the
|
||||
socket; use your operating system facilities like \fIselect(2)\fP to check if
|
||||
it has any data you can read.
|
||||
.SH AVAILABILITY
|
||||
|
||||
@@ -47,7 +47,7 @@ this option.
|
||||
You must ensure that the socket is writable before calling
|
||||
\fIcurl_easy_send(3)\fP, otherwise the call will return \fBCURLE_AGAIN\fP -
|
||||
the socket is used in non-blocking mode internally. Use
|
||||
\fIcurl_easy_getinfo(3)\fP with \fBCURLINFO_LASTSOCKET\fP to obtain the
|
||||
\fIcurl_easy_getinfo(3)\fP with \fBCURLINFO_ACTIVESOCKET(3)\fP to obtain the
|
||||
socket; use your operating system facilities like \fIselect(2)\fP to check if
|
||||
it can be written to.
|
||||
.SH AVAILABILITY
|
||||
|
||||
@@ -30,9 +30,9 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CERTINFO, long certinfo);
|
||||
.SH DESCRIPTION
|
||||
Pass a long set to 1 to enable libcurl's certificate chain info gatherer. With
|
||||
this enabled, libcurl will extract lots of information and data about the
|
||||
certificates in the certificate chain used in the SSL connection. This data may
|
||||
then be retrieved after a transfer using \fIcurl_easy_getinfo(3)\fP and its
|
||||
option \fICURLINFO_CERTINFO\fP.
|
||||
certificates in the certificate chain used in the SSL connection. This data
|
||||
may then be retrieved after a transfer using \fIcurl_easy_getinfo(3)\fP and
|
||||
its option \fICURLINFO_CERTINFO(3)\fP.
|
||||
.SH DEFAULT
|
||||
0
|
||||
.SH PROTOCOLS
|
||||
|
||||
@@ -33,7 +33,7 @@ the required proxy authentication and connection setup, but no data transfer,
|
||||
and then return.
|
||||
|
||||
The option can be used to simply test a connection to a server, but is more
|
||||
useful when used with the \fICURLINFO_LASTSOCKET\fP option to
|
||||
useful when used with the \fICURLINFO_ACTIVESOCKET(3)\fP option to
|
||||
\fIcurl_easy_getinfo(3)\fP as the library can set up the connection and then
|
||||
the application can obtain the most recently used socket for special data
|
||||
transfers.
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.45.0-DEV"
|
||||
#define LIBCURL_VERSION "7.46.0-DEV"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 45
|
||||
#define LIBCURL_VERSION_MINOR 46
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
@@ -57,7 +57,7 @@
|
||||
CURL_VERSION_BITS() macro since curl's own configure script greps for it
|
||||
and needs it to contain the full number.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x072D00
|
||||
#define LIBCURL_VERSION_NUM 0x072E00
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if defined(USE_NTLM) && (!defined(USE_OPENSSL) || defined(HAVE_BORINGSSL))
|
||||
#if defined(USE_NTLM) && !defined(HAVE_DES_SET_ODD_PARITY)
|
||||
|
||||
/* Applies odd parity to the given byte array */
|
||||
void Curl_des_set_odd_parity(unsigned char *bytes, size_t length);
|
||||
|
||||
@@ -664,21 +664,22 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
|
||||
unsigned int len = 0;
|
||||
unsigned char *ptr = NULL;
|
||||
unsigned char hmac_output[NTLM_HMAC_MD5_LEN];
|
||||
#if defined(HAVE_LONGLONG)
|
||||
long long tw;
|
||||
#else
|
||||
__int64 tw;
|
||||
#endif
|
||||
curl_off_t tw;
|
||||
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
#if CURL_SIZEOF_CURL_OFF_T < 8
|
||||
#error "this section needs 64bit support to work"
|
||||
#endif
|
||||
|
||||
/* Calculate the timestamp */
|
||||
#ifdef DEBUGBUILD
|
||||
char *force_timestamp = getenv("CURL_FORCETIME");
|
||||
if(force_timestamp)
|
||||
tw = 11644473600ULL * 10000000ULL;
|
||||
tw = (curl_off_t)11644473600 * 10000000;
|
||||
else
|
||||
#endif
|
||||
tw = ((long long)time(NULL) + 11644473600ULL) * 10000000ULL;
|
||||
tw = ((curl_off_t)time(NULL) + 11644473600) * 10000000;
|
||||
|
||||
/* Calculate the response len */
|
||||
len = NTLM_HMAC_MD5_LEN + NTLMv2_BLOB_LEN;
|
||||
|
||||
25
lib/easy.c
25
lib/easy.c
@@ -220,11 +220,12 @@ curl_calloc_callback Curl_ccalloc;
|
||||
* curl_global_init() globally initializes cURL given a bitwise set of the
|
||||
* different features of what to initialize.
|
||||
*/
|
||||
CURLcode curl_global_init(long flags)
|
||||
static CURLcode global_init(long flags, bool memoryfuncs)
|
||||
{
|
||||
if(initialized++)
|
||||
return CURLE_OK;
|
||||
|
||||
if(memoryfuncs) {
|
||||
/* Setup the default memory functions here (again) */
|
||||
Curl_cmalloc = (curl_malloc_callback)malloc;
|
||||
Curl_cfree = (curl_free_callback)free;
|
||||
@@ -234,6 +235,7 @@ CURLcode curl_global_init(long flags)
|
||||
#if defined(WIN32) && defined(UNICODE)
|
||||
Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(flags & CURL_GLOBAL_SSL)
|
||||
if(!Curl_ssl_init()) {
|
||||
@@ -284,6 +286,16 @@ CURLcode curl_global_init(long flags)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* curl_global_init() globally initializes cURL given a bitwise set of the
|
||||
* different features of what to initialize.
|
||||
*/
|
||||
CURLcode curl_global_init(long flags)
|
||||
{
|
||||
return global_init(flags, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* curl_global_init_mem() globally initializes cURL and also registers the
|
||||
* user provided callback routines.
|
||||
@@ -292,8 +304,6 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m,
|
||||
curl_free_callback f, curl_realloc_callback r,
|
||||
curl_strdup_callback s, curl_calloc_callback c)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
/* Invalid input, return immediately */
|
||||
if(!m || !f || !r || !s || !c)
|
||||
return CURLE_FAILED_INIT;
|
||||
@@ -306,17 +316,16 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/* Call the actual init function first */
|
||||
result = curl_global_init(flags);
|
||||
if(!result) {
|
||||
/* set memory functions before global_init() in case it wants memory
|
||||
functions */
|
||||
Curl_cmalloc = m;
|
||||
Curl_cfree = f;
|
||||
Curl_cstrdup = s;
|
||||
Curl_crealloc = r;
|
||||
Curl_ccalloc = c;
|
||||
}
|
||||
|
||||
return result;
|
||||
/* Call the actual init function, but without setting */
|
||||
return global_init(flags, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1673,8 +1673,8 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
|
||||
BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
size_t actuallyread =
|
||||
data->set.fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
data->set.in);
|
||||
data->state.fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
data->state.in);
|
||||
|
||||
passed += actuallyread;
|
||||
if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
|
||||
|
||||
26
lib/http.c
26
lib/http.c
@@ -1001,8 +1001,8 @@ static size_t readmoredata(char *buffer,
|
||||
/* move backup data into focus and continue on that */
|
||||
http->postdata = http->backup.postdata;
|
||||
http->postsize = http->backup.postsize;
|
||||
conn->data->set.fread_func = http->backup.fread_func;
|
||||
conn->data->set.in = http->backup.fread_in;
|
||||
conn->data->state.fread_func = http->backup.fread_func;
|
||||
conn->data->state.in = http->backup.fread_in;
|
||||
|
||||
http->sending++; /* move one step up */
|
||||
|
||||
@@ -1157,14 +1157,14 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
|
||||
ptr = in->buffer + amount;
|
||||
|
||||
/* backup the currently set pointers */
|
||||
http->backup.fread_func = conn->data->set.fread_func;
|
||||
http->backup.fread_in = conn->data->set.in;
|
||||
http->backup.fread_func = conn->data->state.fread_func;
|
||||
http->backup.fread_in = conn->data->state.in;
|
||||
http->backup.postdata = http->postdata;
|
||||
http->backup.postsize = http->postsize;
|
||||
|
||||
/* set the new pointers for the request-sending */
|
||||
conn->data->set.fread_func = (curl_read_callback)readmoredata;
|
||||
conn->data->set.in = (void *)conn;
|
||||
conn->data->state.fread_func = (curl_read_callback)readmoredata;
|
||||
conn->data->state.in = (void *)conn;
|
||||
http->postdata = ptr;
|
||||
http->postsize = (curl_off_t)size;
|
||||
|
||||
@@ -2162,8 +2162,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
size_t actuallyread =
|
||||
data->set.fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
data->set.in);
|
||||
data->state.fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
data->state.in);
|
||||
|
||||
passed += actuallyread;
|
||||
if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
|
||||
@@ -2437,11 +2437,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
on. The data->set.fread_func pointer itself will be changed for the
|
||||
multipart case to the function that returns a multipart formatted
|
||||
stream. */
|
||||
http->form.fread_func = data->set.fread_func;
|
||||
http->form.fread_func = data->state.fread_func;
|
||||
|
||||
/* Set the read function to read from the generated form data */
|
||||
data->set.fread_func = (curl_read_callback)Curl_FormReader;
|
||||
data->set.in = &http->form;
|
||||
data->state.fread_func = (curl_read_callback)Curl_FormReader;
|
||||
data->state.in = &http->form;
|
||||
|
||||
http->sending = HTTPSEND_BODY;
|
||||
|
||||
@@ -2659,8 +2659,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
|
||||
http->sending = HTTPSEND_BODY;
|
||||
|
||||
data->set.fread_func = (curl_read_callback)readmoredata;
|
||||
data->set.in = (void *)conn;
|
||||
data->state.fread_func = (curl_read_callback)readmoredata;
|
||||
data->state.in = (void *)conn;
|
||||
|
||||
/* set the upload size to the progress meter */
|
||||
Curl_pgrsSetUploadSize(data, http->postsize);
|
||||
|
||||
@@ -1094,15 +1094,11 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
|
||||
nread = ((Curl_recv *)httpc->recv_underlying)(
|
||||
conn, FIRSTSOCKET, httpc->inbuf, H2_BUFSIZE, &result);
|
||||
|
||||
if(result == CURLE_AGAIN) {
|
||||
*err = result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(nread == -1) {
|
||||
if(result != CURLE_AGAIN)
|
||||
failf(data, "Failed receiving HTTP2 data");
|
||||
*err = result;
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(nread == 0) {
|
||||
|
||||
13
lib/multi.c
13
lib/multi.c
@@ -99,6 +99,9 @@ static const char * const statename[]={
|
||||
|
||||
static void multi_freetimeout(void *a, void *b);
|
||||
|
||||
/* function pointer called once when switching TO a state */
|
||||
typedef void (*init_multistate_func)(struct SessionHandle *data);
|
||||
|
||||
/* always use this function to change state, to make debugging easier */
|
||||
static void mstate(struct SessionHandle *data, CURLMstate state
|
||||
#ifdef DEBUGBUILD
|
||||
@@ -107,6 +110,12 @@ static void mstate(struct SessionHandle *data, CURLMstate state
|
||||
)
|
||||
{
|
||||
CURLMstate oldstate = data->mstate;
|
||||
static const init_multistate_func finit[CURLM_STATE_LAST-1] = {
|
||||
NULL,
|
||||
NULL,
|
||||
Curl_init_CONNECT, /* CONNECT */
|
||||
/* the rest is NULL too */
|
||||
};
|
||||
|
||||
#if defined(DEBUGBUILD) && defined(CURL_DISABLE_VERBOSE_STRINGS)
|
||||
(void) lineno;
|
||||
@@ -136,6 +145,10 @@ static void mstate(struct SessionHandle *data, CURLMstate state
|
||||
if(state == CURLM_STATE_COMPLETED)
|
||||
/* changing to COMPLETED means there's one less easy handle 'alive' */
|
||||
data->multi->num_alive--;
|
||||
|
||||
/* if this state has an init-function, run it */
|
||||
if(finit[state])
|
||||
finit[state](data);
|
||||
}
|
||||
|
||||
#ifndef DEBUGBUILD
|
||||
|
||||
@@ -1740,8 +1740,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
size_t actuallyread =
|
||||
data->set.fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
data->set.in);
|
||||
data->state.fread_func(data->state.buffer, 1,
|
||||
readthisamountnow, data->state.in);
|
||||
|
||||
passed += actuallyread;
|
||||
if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
|
||||
|
||||
11
lib/telnet.c
11
lib/telnet.c
@@ -1423,8 +1423,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
for(;;) {
|
||||
if(data->set.is_fread_set) {
|
||||
/* read from user-supplied method */
|
||||
result = (int)data->set.fread_func(buf, 1, BUFSIZE - 1,
|
||||
data->set.in);
|
||||
result = (int)data->state.fread_func(buf, 1, BUFSIZE - 1,
|
||||
data->state.in);
|
||||
if(result == CURL_READFUNC_ABORT) {
|
||||
keepon = FALSE;
|
||||
result = CURLE_READ_ERROR;
|
||||
@@ -1563,13 +1563,13 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
pfd[0].fd = sockfd;
|
||||
pfd[0].events = POLLIN;
|
||||
|
||||
if(data->set.fread_func != (curl_read_callback)fread) {
|
||||
if(data->set.is_fread_set) {
|
||||
poll_cnt = 1;
|
||||
interval_ms = 100; /* poll user-supplied read function */
|
||||
}
|
||||
else {
|
||||
/* really using fread, so infile is a FILE* */
|
||||
pfd[1].fd = fileno((FILE *)data->set.in);
|
||||
pfd[1].fd = fileno((FILE *)data->state.in);
|
||||
pfd[1].events = POLLIN;
|
||||
poll_cnt = 2;
|
||||
interval_ms = 1 * 1000;
|
||||
@@ -1628,7 +1628,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
||||
}
|
||||
else {
|
||||
/* read from user-supplied method */
|
||||
nread = (int)data->set.fread_func(buf, 1, BUFSIZE - 1, data->set.in);
|
||||
nread = (int)data->state.fread_func(buf, 1, BUFSIZE - 1,
|
||||
data->state.in);
|
||||
if(nread == CURL_READFUNC_ABORT) {
|
||||
keepon = FALSE;
|
||||
break;
|
||||
|
||||
@@ -115,8 +115,8 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
|
||||
|
||||
/* this function returns a size_t, so we typecast to int to prevent warnings
|
||||
with picky compilers */
|
||||
nread = (int)data->set.fread_func(data->req.upload_fromhere, 1,
|
||||
buffersize, data->set.in);
|
||||
nread = (int)data->state.fread_func(data->req.upload_fromhere, 1,
|
||||
buffersize, data->state.in);
|
||||
|
||||
if(nread == CURL_READFUNC_ABORT) {
|
||||
failf(data, "operation aborted by callback");
|
||||
@@ -289,8 +289,8 @@ CURLcode Curl_readrewind(struct connectdata *conn)
|
||||
/* If no CURLOPT_READFUNCTION is used, we know that we operate on a
|
||||
given FILE * stream and we can actually attempt to rewind that
|
||||
ourselves with fseek() */
|
||||
if(data->set.fread_func == (curl_read_callback)fread) {
|
||||
if(-1 != fseek(data->set.in, 0, SEEK_SET))
|
||||
if(data->state.fread_func == (curl_read_callback)fread) {
|
||||
if(-1 != fseek(data->state.in, 0, SEEK_SET))
|
||||
/* successful rewind */
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -1286,8 +1286,18 @@ long Curl_sleep_time(curl_off_t rate_bps, curl_off_t cur_rate_bps,
|
||||
return (long)rv;
|
||||
}
|
||||
|
||||
/* Curl_init_CONNECT() gets called each time the handle switches to CONNECT
|
||||
which means this gets called once for each subsequent redirect etc */
|
||||
void Curl_init_CONNECT(struct SessionHandle *data)
|
||||
{
|
||||
data->state.fread_func = data->set.fread_func_set;
|
||||
data->state.in = data->set.in_set;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_pretransfer() is called immediately before a transfer starts.
|
||||
* Curl_pretransfer() is called immediately before a transfer starts, and only
|
||||
* once for one transfer no matter if it has redirects or do multi-pass
|
||||
* authentication etc.
|
||||
*/
|
||||
CURLcode Curl_pretransfer(struct SessionHandle *data)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void Curl_init_CONNECT(struct SessionHandle *data);
|
||||
|
||||
CURLcode Curl_pretransfer(struct SessionHandle *data);
|
||||
CURLcode Curl_second_connect(struct connectdata *conn);
|
||||
CURLcode Curl_posttransfer(struct SessionHandle *data);
|
||||
|
||||
12
lib/url.c
12
lib/url.c
@@ -496,14 +496,14 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
set->out = stdout; /* default output to stdout */
|
||||
set->in = stdin; /* default input from stdin */
|
||||
set->in_set = stdin; /* default input from stdin */
|
||||
set->err = stderr; /* default stderr to stderr */
|
||||
|
||||
/* use fwrite as default function to store output */
|
||||
set->fwrite_func = (curl_write_callback)fwrite;
|
||||
|
||||
/* use fread as default function to read input */
|
||||
set->fread_func = (curl_read_callback)fread;
|
||||
set->fread_func_set = (curl_read_callback)fread;
|
||||
set->is_fread_set = 0;
|
||||
set->is_fwrite_set = 0;
|
||||
|
||||
@@ -1567,7 +1567,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
* FILE pointer to read the file to be uploaded from. Or possibly
|
||||
* used as argument to the read callback.
|
||||
*/
|
||||
data->set.in = va_arg(param, void *);
|
||||
data->set.in_set = va_arg(param, void *);
|
||||
break;
|
||||
case CURLOPT_INFILESIZE:
|
||||
/*
|
||||
@@ -1862,11 +1862,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
/*
|
||||
* Read data callback
|
||||
*/
|
||||
data->set.fread_func = va_arg(param, curl_read_callback);
|
||||
if(!data->set.fread_func) {
|
||||
data->set.fread_func_set = va_arg(param, curl_read_callback);
|
||||
if(!data->set.fread_func_set) {
|
||||
data->set.is_fread_set = 0;
|
||||
/* When set to NULL, reset to our internal default function */
|
||||
data->set.fread_func = (curl_read_callback)fread;
|
||||
data->set.fread_func_set = (curl_read_callback)fread;
|
||||
}
|
||||
else
|
||||
data->set.is_fread_set = 1;
|
||||
|
||||
@@ -1312,6 +1312,9 @@ struct UrlState {
|
||||
bool done; /* set to FALSE when Curl_do() is called and set to TRUE when
|
||||
Curl_done() is called, to prevent Curl_done() to get invoked
|
||||
twice when the multi interface is used. */
|
||||
|
||||
curl_read_callback fread_func; /* read callback/function */
|
||||
void *in; /* CURLOPT_READDATA */
|
||||
};
|
||||
|
||||
|
||||
@@ -1428,7 +1431,7 @@ struct UserDefined {
|
||||
proxy string features a ":[port]" that one will override
|
||||
this. */
|
||||
void *out; /* CURLOPT_WRITEDATA */
|
||||
void *in; /* CURLOPT_READDATA */
|
||||
void *in_set; /* CURLOPT_READDATA */
|
||||
void *writeheader; /* write the header to this if non-NULL */
|
||||
void *rtp_out; /* write RTP to this if non-NULL */
|
||||
long use_port; /* which port to use (when not using default) */
|
||||
@@ -1453,7 +1456,7 @@ struct UserDefined {
|
||||
curl_write_callback fwrite_func; /* function that stores the output */
|
||||
curl_write_callback fwrite_header; /* function that stores headers */
|
||||
curl_write_callback fwrite_rtp; /* function that stores interleaved RTP */
|
||||
curl_read_callback fread_func; /* function that reads the input */
|
||||
curl_read_callback fread_func_set; /* function that reads the input */
|
||||
int is_fread_set; /* boolean, has read callback been set to non-NULL? */
|
||||
int is_fwrite_set; /* boolean, has write callback been set to non-NULL? */
|
||||
curl_progress_callback fprogress; /* OLD and deprecated progress callback */
|
||||
|
||||
@@ -450,7 +450,6 @@ int cert_stuff(struct connectdata *conn,
|
||||
PKCS12 *p12;
|
||||
EVP_PKEY *pri;
|
||||
STACK_OF(X509) *ca = NULL;
|
||||
int i;
|
||||
|
||||
f = fopen(cert_file, "rb");
|
||||
if(!f) {
|
||||
@@ -497,8 +496,8 @@ int cert_stuff(struct connectdata *conn,
|
||||
goto fail;
|
||||
}
|
||||
/* Set Certificate Verification chain */
|
||||
if(ca && sk_X509_num(ca)) {
|
||||
for(i = 0; i < sk_X509_num(ca); i++) {
|
||||
if(ca) {
|
||||
while(sk_X509_num(ca)) {
|
||||
/*
|
||||
* Note that sk_X509_pop() is used below to make sure the cert is
|
||||
* removed from the stack properly before getting passed to
|
||||
@@ -508,6 +507,7 @@ int cert_stuff(struct connectdata *conn,
|
||||
*/
|
||||
X509 *x = sk_X509_pop(ca);
|
||||
if(!SSL_CTX_add_extra_chain_cert(ctx, x)) {
|
||||
X509_free(x);
|
||||
failf(data, "cannot add certificate to certificate chain");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ int test(char *URL)
|
||||
|
||||
/* set the options (I left out a few, you'll get the point anyway) */
|
||||
curl_easy_setopt(easy, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, testDataSize);
|
||||
curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)testDataSize);
|
||||
curl_easy_setopt(easy, CURLOPT_POSTFIELDS, testData);
|
||||
|
||||
/* we start some action by calling perform right away */
|
||||
|
||||
Reference in New Issue
Block a user