url: default to CURL_HTTP_VERSION_2TLS if built h2-enabled

Closes #2709
This commit is contained in:
Daniel Stenberg 2018-09-05 14:35:57 +02:00
parent d7c4213bd0
commit 25fd1057c9
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 15 additions and 11 deletions

View File

@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___ .\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____| .\" * \___|\___/|_| \_\_____|
.\" * .\" *
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * .\" *
.\" * This software is licensed as described in the file COPYING, which .\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms .\" * you should have received as part of this distribution. The terms
@ -60,7 +60,9 @@ prior knowledge that the server supports HTTP/2 straight away. HTTPS requests
will still do HTTP/2 the standard way with negotiated protocol version in the will still do HTTP/2 the standard way with negotiated protocol version in the
TLS handshake. (Added in 7.49.0) TLS handshake. (Added in 7.49.0)
.SH DEFAULT .SH DEFAULT
CURL_HTTP_VERSION_NONE Since curl 7.62.0: CURL_HTTP_VERSION_2TLS
Before that: CURL_HTTP_VERSION_1_1
.SH PROTOCOLS .SH PROTOCOLS
HTTP HTTP
.SH EXAMPLE .SH EXAMPLE

View File

@ -841,6 +841,8 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option,
#else #else
if(arg > CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) if(arg > CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE)
return CURLE_UNSUPPORTED_PROTOCOL; return CURLE_UNSUPPORTED_PROTOCOL;
if(arg == CURL_HTTP_VERSION_NONE)
arg = CURL_HTTP_VERSION_2TLS;
#endif #endif
data->set.httpversion = arg; data->set.httpversion = arg;
break; break;

View File

@ -516,25 +516,27 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
set->wildcard_enabled = FALSE; set->wildcard_enabled = FALSE;
set->chunk_bgn = ZERO_NULL; set->chunk_bgn = ZERO_NULL;
set->chunk_end = ZERO_NULL; set->chunk_end = ZERO_NULL;
/* tcp keepalives are disabled by default, but provide reasonable values for
* the interval and idle times.
*/
set->tcp_keepalive = FALSE; set->tcp_keepalive = FALSE;
set->tcp_keepintvl = 60; set->tcp_keepintvl = 60;
set->tcp_keepidle = 60; set->tcp_keepidle = 60;
set->tcp_fastopen = FALSE; set->tcp_fastopen = FALSE;
set->tcp_nodelay = TRUE; set->tcp_nodelay = TRUE;
set->ssl_enable_npn = TRUE; set->ssl_enable_npn = TRUE;
set->ssl_enable_alpn = TRUE; set->ssl_enable_alpn = TRUE;
set->expect_100_timeout = 1000L; /* Wait for a second by default. */ set->expect_100_timeout = 1000L; /* Wait for a second by default. */
set->sep_headers = TRUE; /* separated header lists by default */ set->sep_headers = TRUE; /* separated header lists by default */
set->buffer_size = READBUFFER_SIZE; set->buffer_size = READBUFFER_SIZE;
set->upload_buffer_size = UPLOAD_BUFSIZE; set->upload_buffer_size = UPLOAD_BUFSIZE;
set->happy_eyeballs_timeout = CURL_HET_DEFAULT; set->happy_eyeballs_timeout = CURL_HET_DEFAULT;
set->fnmatch = ZERO_NULL;
set->maxconnects = DEFAULT_CONNCACHE_SIZE; /* for easy handles */
set->httpversion =
#ifdef USE_NGHTTP2
CURL_HTTP_VERSION_2TLS
#else
CURL_HTTP_VERSION_1_1
#endif
;
Curl_http2_init_userset(set); Curl_http2_init_userset(set);
return result; return result;
} }
@ -594,8 +596,6 @@ CURLcode Curl_open(struct Curl_easy **curl)
data->progress.flags |= PGRS_HIDE; data->progress.flags |= PGRS_HIDE;
data->state.current_speed = -1; /* init to negative == impossible */ data->state.current_speed = -1; /* init to negative == impossible */
data->set.fnmatch = ZERO_NULL;
data->set.maxconnects = DEFAULT_CONNCACHE_SIZE; /* for easy handles */
Curl_http2_init_state(&data->state); Curl_http2_init_state(&data->state);
} }