Skip to content

Commit

Permalink
Upon HTTP_1_1_REQUIRED, retry the request with HTTP/1.1
Browse files Browse the repository at this point in the history
This is a companion patch to cbea2fd (NTLM: force the connection to
HTTP/1.1, 2018-12-06): with NTLM, we can switch to HTTP/1.1
preemptively. However, with other (Negotiate) authentication it is not
clear to this developer whether there is a way to make it work with
HTTP/2, so let's try HTTP/2 first and fall back in case we encounter the
error HTTP_1_1_REQUIRED.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Dec 7, 2018
1 parent cbea2fd commit cceec46
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/multi.c
Expand Up @@ -1948,6 +1948,24 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
else if(!result)
result = ret;

if(retry) {
/* if we are to retry, set the result to OK and consider the
request as done */
result = CURLE_OK;
done = TRUE;
}
} else if(CURLE_HTTP2_STREAM == result && data->set.errorbuffer &&
strstr(data->set.errorbuffer, "HTTP_1_1_REQUIRED")) {
CURLcode ret = Curl_retry_request(data->easy_conn, &newurl);

infof(data, "Forcing HTTP/1.1 for NTLM");
data->set.httpversion = CURL_HTTP_VERSION_1_1;

if(!ret)
retry = (newurl)?TRUE:FALSE;
else
result = ret;

if(retry) {
/* if we are to retry, set the result to OK and consider the
request as done */
Expand Down

0 comments on commit cceec46

Please sign in to comment.