Merge branch 'master' into http2-push

This commit is contained in:
Daniel Stenberg
2015-06-05 13:36:13 +02:00
10 changed files with 46 additions and 98 deletions

View File

@@ -50,7 +50,7 @@ Cocoa
D D
Written by Kenneth Bogert Written by Kenneth Bogert
http://curl.haxx.se/libcurl/d/ http://dlang.org/library/std/net/curl.html
Dylan Dylan
@@ -60,7 +60,7 @@ Dylan
Eiffel Eiffel
Written by Eiffel Software Written by Eiffel Software
http://curl.haxx.se/libcurl/eiffel/ https://room.eiffel.com/library/curl
Euphoria Euphoria
@@ -102,8 +102,7 @@ Haskell
Java Java
Maintained by [blank] https://github.com/pjlegato/curl-java
http://curl.haxx.se/libcurl/java/
Julia Julia
@@ -155,13 +154,13 @@ Pascal
Perl Perl
Maintained by Cris Bailiff Maintained by Cris Bailiff and Bálint Szilakszi
http://curl.haxx.se/libcurl/perl/ https://github.com/szbalint/WWW--Curl
PHP PHP
Written by Sterling Hughes Written by Sterling Hughes
http://curl.haxx.se/libcurl/php/ http://php.net/curl
PostgreSQL PostgreSQL
@@ -197,10 +196,15 @@ Ruby
ruby-curl-multi - written by Kristjan Petursson and Keith Rarick ruby-curl-multi - written by Kristjan Petursson and Keith Rarick
http://curl-multi.rubyforge.org/ http://curl-multi.rubyforge.org/
Rust
curl-rust - by Carl Lerche
https://github.com/carllerche/curl-rust
Scheme Scheme
Bigloo binding by Kirill Lisovsky Bigloo binding by Kirill Lisovsky
http://curl.haxx.se/libcurl/scheme/ http://www.metapaper.net/lisovsky/web/curl/
S-Lang S-Lang

View File

@@ -52,6 +52,9 @@ for older and later versions as things don't change drastically that often.
The libcurl source code generally use the name 'data' for the variable that The libcurl source code generally use the name 'data' for the variable that
points to the SessionHandle. points to the SessionHandle.
When doing multiplexed HTTP/2 transfers, each SessionHandle is associated
with an individual stream, sharing the same connectdata struct. Multiplexing
makes it even more important to keep things associated with the right thing!
1.2 connectdata 1.2 connectdata
@@ -70,7 +73,7 @@ for older and later versions as things don't change drastically that often.
connection or the SessionHandle. connection or the SessionHandle.
Functions in libcurl will assume that connectdata->data points to the Functions in libcurl will assume that connectdata->data points to the
SessionHandle that uses this connection. SessionHandle that uses this connection (for the moment).
As a special complexity, some protocols supported by libcurl require a As a special complexity, some protocols supported by libcurl require a
special disconnect procedure that is more than just shutting down the special disconnect procedure that is more than just shutting down the

View File

@@ -84,12 +84,12 @@ Coming dates
Based on the description above, here are some planned release dates (at the Based on the description above, here are some planned release dates (at the
time of this writing): time of this writing):
- February 25, 2015 (version 7.41.0) - June 17, 2015 (version 7.43.0)
- April 22, 2015
- June 17, 2015
- August 12, 2015 - August 12, 2015
- October 7, 2015 - October 7, 2015
- December 2, 2015 - December 2, 2015
- January 27, 2016 - January 27, 2016
- March 23, 2016 - March 23, 2016
- May 18, 2016 - May 18, 2016
- July 13, 2016
- September 7, 2016

View File

@@ -96,7 +96,12 @@ main(void)
return 1; return 1;
} }
/* HTTP-header style cookie */ /* HTTP-header style cookie. If you use the Set-Cookie format and don't
specify a domain then the cookie is sent for any domain and will not be
modified, likely not what you intended. Starting in 7.43.0 any-domain
cookies will not be exported either. For more information refer to the
CURLOPT_COOKIELIST documentation.
*/
snprintf(nline, sizeof(nline), snprintf(nline, sizeof(nline),
"Set-Cookie: OLD_PREF=3d141414bf4209321; " "Set-Cookie: OLD_PREF=3d141414bf4209321; "
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"); "expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com");

View File

@@ -43,6 +43,9 @@ transfer to that server, likely not what you intended. Either set a domain in
Set-Cookie (doing that will include sub domains) or use the Netscape format as Set-Cookie (doing that will include sub domains) or use the Netscape format as
shown in EXAMPLE. shown in EXAMPLE.
Starting in 7.43.0 the aforementioned any-domain cookies will not appear in the
lists exported by \fICURLINFO_COOKIELIST(3)\fP and \fICURLOPT_COOKIEJAR(3)\fP.
Additionally, there are commands available that perform actions if you pass in Additionally, there are commands available that perform actions if you pass in
these exact strings: these exact strings:
.IP ALL .IP ALL

View File

@@ -671,6 +671,7 @@ CURL_GLOBAL_WIN32 7.8.1
CURL_HTTP_VERSION_1_0 7.9.1 CURL_HTTP_VERSION_1_0 7.9.1
CURL_HTTP_VERSION_1_1 7.9.1 CURL_HTTP_VERSION_1_1 7.9.1
CURL_HTTP_VERSION_2_0 7.33.0 CURL_HTTP_VERSION_2_0 7.33.0
CURL_HTTP_VERSION_2 7.43.0
CURL_HTTP_VERSION_NONE 7.9.1 CURL_HTTP_VERSION_NONE 7.9.1
CURL_IPRESOLVE_V4 7.10.8 CURL_IPRESOLVE_V4 7.10.8
CURL_IPRESOLVE_V6 7.10.8 CURL_IPRESOLVE_V6 7.10.8

View File

@@ -1695,6 +1695,11 @@ enum {
CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
}; };
/* Convenience definition simple because the name of the version is HTTP/2 and
not 2.0. The 2_0 version of the enum name was set while the version was
still planned to be 2.0 and we stick to it for compatibility. */
#define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0
/* /*
* Public API enums for RTSP requests * Public API enums for RTSP requests
*/ */

View File

@@ -1277,6 +1277,8 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
co = c->cookies; co = c->cookies;
while(co) { while(co) {
if(!co->domain)
continue;
format_ptr = get_netscape_format(co); format_ptr = get_netscape_format(co);
if(format_ptr == NULL) { if(format_ptr == NULL) {
fprintf(out, "#\n# Fatal libcurl error\n"); fprintf(out, "#\n# Fatal libcurl error\n");
@@ -1310,7 +1312,8 @@ struct curl_slist *Curl_cookie_list(struct SessionHandle *data)
c = data->cookies->cookies; c = data->cookies->cookies;
while(c) { while(c) {
/* fill the list with _all_ the cookies we know */ if(!c->domain)
continue;
line = get_netscape_format(c); line = get_netscape_format(c);
if(!line) { if(!line) {
curl_slist_free_all(list); curl_slist_free_all(list);

View File

@@ -710,7 +710,7 @@ int netware_init(void);
/* In Windows the default file mode is text but an application can override it. /* In Windows the default file mode is text but an application can override it.
Therefore we specify it explicitly. https://github.com/bagder/curl/pull/258 Therefore we specify it explicitly. https://github.com/bagder/curl/pull/258
*/ */
#if defined(WIN32) #if defined(WIN32) || defined(MSDOS)
#define FOPEN_READTEXT "rt" #define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "wt" #define FOPEN_WRITETEXT "wt"
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)

View File

@@ -83,18 +83,6 @@
#error "OPENSSL_VERSION_NUMBER not defined" #error "OPENSSL_VERSION_NUMBER not defined"
#endif #endif
#if OPENSSL_VERSION_NUMBER >= 0x0090581fL
#define HAVE_SSL_GET1_SESSION 1
#else
#undef HAVE_SSL_GET1_SESSION
#endif
#if OPENSSL_VERSION_NUMBER >= 0x00904100L
#define HAVE_USERDATA_IN_PWD_CALLBACK 1
#else
#undef HAVE_USERDATA_IN_PWD_CALLBACK
#endif
#if OPENSSL_VERSION_NUMBER >= 0x00907001L && !defined(OPENSSL_IS_BORINGSSL) #if OPENSSL_VERSION_NUMBER >= 0x00907001L && !defined(OPENSSL_IS_BORINGSSL)
/* ENGINE_load_private_key() takes four arguments */ /* ENGINE_load_private_key() takes four arguments */
#define HAVE_ENGINE_LOAD_FOUR_ARGS #define HAVE_ENGINE_LOAD_FOUR_ARGS
@@ -114,10 +102,6 @@
#undef HAVE_PKCS12_SUPPORT #undef HAVE_PKCS12_SUPPORT
#endif #endif
#if OPENSSL_VERSION_NUMBER >= 0x00906001L
#define HAVE_ERR_ERROR_STRING_N 1
#endif
#if OPENSSL_VERSION_NUMBER >= 0x00909000L #if OPENSSL_VERSION_NUMBER >= 0x00909000L
#define SSL_METHOD_QUAL const #define SSL_METHOD_QUAL const
#else #else
@@ -160,18 +144,8 @@
*/ */
#define RAND_LOAD_LENGTH 1024 #define RAND_LOAD_LENGTH 1024
#ifndef HAVE_USERDATA_IN_PWD_CALLBACK static int passwd_callback(char *buf, int num, int encrypting,
static char global_passwd[64]; void *global_passwd)
#endif
static int passwd_callback(char *buf, int num, int encrypting
#ifdef HAVE_USERDATA_IN_PWD_CALLBACK
/* This was introduced in 0.9.4, we can set this
using SSL_CTX_set_default_passwd_cb_userdata()
*/
, void *global_passwd
#endif
)
{ {
DEBUGASSERT(0 == encrypting); DEBUGASSERT(0 == encrypting);
@@ -376,23 +350,9 @@ int cert_stuff(struct connectdata *conn,
int cert_done = 0; int cert_done = 0;
if(data->set.str[STRING_KEY_PASSWD]) { if(data->set.str[STRING_KEY_PASSWD]) {
#ifndef HAVE_USERDATA_IN_PWD_CALLBACK /* set the password in the callback userdata */
/*
* If password has been given, we store that in the global
* area (*shudder*) for a while:
*/
size_t len = strlen(data->set.str[STRING_KEY_PASSWD]);
if(len < sizeof(global_passwd))
memcpy(global_passwd, data->set.str[STRING_KEY_PASSWD], len+1);
else
global_passwd[0] = '\0';
#else
/*
* We set the password in the callback userdata
*/
SSL_CTX_set_default_passwd_cb_userdata(ctx, SSL_CTX_set_default_passwd_cb_userdata(ctx,
data->set.str[STRING_KEY_PASSWD]); data->set.str[STRING_KEY_PASSWD]);
#endif
/* Set passwd callback: */ /* Set passwd callback: */
SSL_CTX_set_default_passwd_cb(ctx, passwd_callback); SSL_CTX_set_default_passwd_cb(ctx, passwd_callback);
} }
@@ -678,10 +638,6 @@ int cert_stuff(struct connectdata *conn,
failf(data, "Private key does not match the certificate public key"); failf(data, "Private key does not match the certificate public key");
return 0; return 0;
} }
#ifndef HAVE_USERDATA_IN_PWD_CALLBACK
/* erase it now */
memset(global_passwd, 0, sizeof(global_passwd));
#endif
} }
return 1; return 1;
} }
@@ -716,30 +672,14 @@ static int x509_name_oneline(X509_NAME *a, char *buf, size_t size)
#endif #endif
} }
static
int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
{
X509 *err_cert;
char buf[256];
err_cert=X509_STORE_CTX_get_current_cert(ctx);
(void)x509_name_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf));
return ok;
}
/* Return error string for last OpenSSL error /* Return error string for last OpenSSL error
*/ */
static char *SSL_strerror(unsigned long error, char *buf, size_t size) static char *SSL_strerror(unsigned long error, char *buf, size_t size)
{ {
#ifdef HAVE_ERR_ERROR_STRING_N
/* OpenSSL 0.9.6 and later has a function named /* OpenSSL 0.9.6 and later has a function named
ERR_error_string_n() that takes the size of the buffer as a ERR_error_string_n() that takes the size of the buffer as a
third argument */ third argument */
ERR_error_string_n(error, buf, size); ERR_error_string_n(error, buf, size);
#else
(void) size;
ERR_error_string(error, buf);
#endif
return buf; return buf;
} }
@@ -2079,7 +2019,7 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
* SSL_get_verify_result() below. */ * SSL_get_verify_result() below. */
SSL_CTX_set_verify(connssl->ctx, SSL_CTX_set_verify(connssl->ctx,
data->set.ssl.verifypeer?SSL_VERIFY_PEER:SSL_VERIFY_NONE, data->set.ssl.verifypeer?SSL_VERIFY_PEER:SSL_VERIFY_NONE,
cert_verify_callback); NULL);
/* give application a chance to interfere with SSL set up. */ /* give application a chance to interfere with SSL set up. */
if(data->set.ssl.fsslctx) { if(data->set.ssl.fsslctx) {
@@ -2825,25 +2765,11 @@ static CURLcode ossl_connect_step3(struct connectdata *conn, int sockindex)
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state); DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
#ifdef HAVE_SSL_GET1_SESSION
our_ssl_sessionid = SSL_get1_session(connssl->handle); our_ssl_sessionid = SSL_get1_session(connssl->handle);
/* SSL_get1_session() will increment the reference /* SSL_get1_session() will increment the reference count and the session
count and the session will stay in memory until explicitly freed with will stay in memory until explicitly freed with SSL_SESSION_free(3),
SSL_SESSION_free(3), regardless of its state. regardless of its state. */
This function was introduced in openssl 0.9.5a. */
#else
our_ssl_sessionid = SSL_get_session(connssl->handle);
/* if SSL_get1_session() is unavailable, use SSL_get_session().
This is an inferior option because the session can be flushed
at any time by openssl. It is included only so curl compiles
under versions of openssl < 0.9.5a.
WARNING: How curl behaves if it's session is flushed is
untested.
*/
#endif
incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL)); incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL));
if(incache) { if(incache) {
@@ -2862,7 +2788,6 @@ static CURLcode ossl_connect_step3(struct connectdata *conn, int sockindex)
return result; return result;
} }
} }
#ifdef HAVE_SSL_GET1_SESSION
else { else {
/* Session was incache, so refcount already incremented earlier. /* Session was incache, so refcount already incremented earlier.
* Avoid further increments with each SSL_get1_session() call. * Avoid further increments with each SSL_get1_session() call.
@@ -2870,7 +2795,6 @@ static CURLcode ossl_connect_step3(struct connectdata *conn, int sockindex)
*/ */
SSL_SESSION_free(our_ssl_sessionid); SSL_SESSION_free(our_ssl_sessionid);
} }
#endif
/* /*
* We check certificates to authenticate the server; otherwise we risk * We check certificates to authenticate the server; otherwise we risk