alt-svc: enable by default

Remove CURLALTSVC_IMMEDIATELY, which was never implemented/supported.

alt-svc support in curl is no longer considered experimental

Closes #5868
This commit is contained in:
Daniel Stenberg 2020-10-25 23:08:54 +01:00
parent e2bcdf557b
commit 96450a1a33
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
27 changed files with 58 additions and 71 deletions

View file

@ -25,7 +25,7 @@
*/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && defined(USE_ALTSVC)
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
#include <curl/curl.h>
#include "urldata.h"
#include "altsvc.h"
@ -457,6 +457,9 @@ 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;
@ -642,4 +645,4 @@ bool Curl_altsvc_lookup(struct altsvcinfo *asi,
return FALSE;
}
#endif /* CURL_DISABLE_HTTP || USE_ALTSVC */
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */

View file

@ -23,7 +23,7 @@
***************************************************************************/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && defined(USE_ALTSVC)
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
#include <curl/curl.h>
#include "llist.h"
@ -75,5 +75,5 @@ bool Curl_altsvc_lookup(struct altsvcinfo *asi,
/* disabled */
#define Curl_altsvc_save(a,b,c)
#define Curl_altsvc_cleanup(x)
#endif /* CURL_DISABLE_HTTP || USE_ALTSVC */
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */
#endif /* HEADER_CURL_ALTSVC_H */

View file

@ -422,9 +422,6 @@
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME
/* Define to enable alt-svc support (experimental) */
#undef USE_ALTSVC
/* Define to enable HTTP3 support (experimental, requires NGTCP2 or QUICHE) */
#undef ENABLE_QUIC

View file

@ -1017,8 +1017,8 @@ ${SIZEOF_TIME_T_CODE}
/* if Unix domain sockets are enabled */
#cmakedefine USE_UNIX_SOCKETS
/* to enable alt-svc */
#cmakedefine USE_ALTSVC 1
/* to disable alt-svc */
#cmakedefine CURL_DISABLE_ALTSVC 1
/* Define to 1 if you are building a Windows target with large file support. */
#cmakedefine USE_WIN32_LARGE_FILES 1

View file

@ -22,7 +22,7 @@
#include "curl_setup.h"
#if !defined(CURL_DISABLE_COOKIES) && !defined(CURL_DISABLE_ALTSVC)
#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC)
#include "curl_get_line.h"
#include "curl_memory.h"

View file

@ -2518,7 +2518,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(result)
return result;
#ifdef USE_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);
@ -3992,7 +3992,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
}
}
}
#ifdef USE_ALTSVC
#ifndef CURL_DISABLE_ALTSVC
/* If enabled, the header is incoming and this is over HTTPS */
else if(data->asi && checkprefix("Alt-Svc:", headp) &&
((conn->handler->flags & PROTOPT_SSL) ||

View file

@ -24,8 +24,8 @@
#include "curl_setup.h"
#if (!defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)) || \
defined(USE_ALTSVC)
#if (!defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_COOKIES)) || \
!defined(CURL_DISABLE_ALTSVC)
#include "curl_multibyte.h"
#include "timeval.h"

View file

@ -2839,7 +2839,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.trailer_data = va_arg(param, void *);
#endif
break;
#ifdef USE_ALTSVC
#ifndef CURL_DISABLE_ALTSVC
case CURLOPT_ALTSVC:
if(!data->asi) {
data->asi = Curl_altsvc_init();

View file

@ -3095,7 +3095,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data,
conn_to_host = conn_to_host->next;
}
#ifdef USE_ALTSVC
#ifndef CURL_DISABLE_ALTSVC
if(data->asi && !host && (port == -1) &&
((conn->handler->protocol == CURLPROTO_HTTPS) ||
#ifdef CURLDEBUG

View file

@ -1899,7 +1899,7 @@ struct Curl_easy {
NOTE that the 'cookie' field in the
UserDefined struct defines if the "engine"
is to be used or not. */
#ifdef USE_ALTSVC
#ifndef CURL_DISABLE_ALTSVC
struct altsvcinfo *asi; /* the alt-svc cache */
#endif
struct Progress progress; /* for all the progress meter data */

View file

@ -415,7 +415,7 @@ static curl_version_info_data version_info = {
#if defined(HAVE_ZSTD)
| CURL_VERSION_ZSTD
#endif
#if defined(USE_ALTSVC)
#ifndef CURL_DISABLE_ALTSVC
| CURL_VERSION_ALTSVC
#endif
,