Skip to content

Commit

Permalink
vtls: use ALPN "http/1.1" for HTTP/1.x, including HTTP/1.0
Browse files Browse the repository at this point in the history
Some servers don't support the ALPN protocol "http/1.0" (e.g. IIS 10),
avoid it and use "http/1.1" instead.

This reverts commit df856cb (curl#10183).

Fixes curl#12259
Closes #...
  • Loading branch information
mkauf committed Nov 6, 2023
1 parent ba281e5 commit f2e5e6e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
3 changes: 0 additions & 3 deletions lib/cf-https-connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ static CURLcode baller_connected(struct Curl_cfilter *cf,
#endif
infof(data, "using HTTP/2");
break;
case CURL_HTTP_VERSION_1_1:
infof(data, "using HTTP/1.1");
break;
default:
infof(data, "using HTTP/1.x");
break;
Expand Down
2 changes: 1 addition & 1 deletion lib/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -3182,7 +3182,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
DEBUGASSERT(Curl_conn_is_http2(data, conn, FIRSTSOCKET));
break;
case CURL_HTTP_VERSION_1_1:
/* continue with HTTP/1.1 when explicitly requested */
/* continue with HTTP/1.x when explicitly requested */
break;
default:
/* Check if user wants to use HTTP/2 with clear TCP */
Expand Down
11 changes: 2 additions & 9 deletions lib/vtls/vtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ static bool blobcmp(struct curl_blob *first, struct curl_blob *second)
}

#ifdef USE_SSL
static const struct alpn_spec ALPN_SPEC_H10 = {
{ ALPN_HTTP_1_0 }, 1
};
static const struct alpn_spec ALPN_SPEC_H11 = {
{ ALPN_HTTP_1_1 }, 1
};
Expand All @@ -147,12 +144,12 @@ static const struct alpn_spec *alpn_get_spec(int httpwant, bool use_alpn)
{
if(!use_alpn)
return NULL;
if(httpwant == CURL_HTTP_VERSION_1_0)
return &ALPN_SPEC_H10;
#ifdef USE_HTTP2
if(httpwant >= CURL_HTTP_VERSION_2)
return &ALPN_SPEC_H2_H11;
#endif
/* Use the ALPN protocol "http/1.1" for HTTP/1.x.
Avoid "http/1.0" because some servers don't support it. */
return &ALPN_SPEC_H11;
}
#endif /* USE_SSL */
Expand Down Expand Up @@ -2107,10 +2104,6 @@ CURLcode Curl_alpn_set_negotiated(struct Curl_cfilter *cf,
!memcmp(ALPN_HTTP_1_1, proto, ALPN_HTTP_1_1_LENGTH)) {
*palpn = CURL_HTTP_VERSION_1_1;
}
else if(proto_len == ALPN_HTTP_1_0_LENGTH &&
!memcmp(ALPN_HTTP_1_0, proto, ALPN_HTTP_1_0_LENGTH)) {
*palpn = CURL_HTTP_VERSION_1_0;
}
#ifdef USE_HTTP2
else if(proto_len == ALPN_H2_LENGTH &&
!memcmp(ALPN_H2, proto, ALPN_H2_LENGTH)) {
Expand Down
2 changes: 0 additions & 2 deletions lib/vtls/vtls_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
/* see https://www.iana.org/assignments/tls-extensiontype-values/ */
#define ALPN_HTTP_1_1_LENGTH 8
#define ALPN_HTTP_1_1 "http/1.1"
#define ALPN_HTTP_1_0_LENGTH 8
#define ALPN_HTTP_1_0 "http/1.0"
#define ALPN_H2_LENGTH 2
#define ALPN_H2 "h2"
#define ALPN_H3_LENGTH 2
Expand Down

0 comments on commit f2e5e6e

Please sign in to comment.