1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-05 00:55:04 -05:00

multi: improved HTTP_1_1_REQUIRED handling

Make sure to downgrade to 1.1 even when we get this HTTP/2 stream error
on first flight.

Reported-by: niner on github
Fixes #3696
Closes #3707
This commit is contained in:
Daniel Stenberg 2019-03-27 23:28:13 +01:00
parent 8759e335ab
commit dbce1bd86f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1881,23 +1881,25 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
} }
} }
else if((CURLE_HTTP2_STREAM == result) && else if((CURLE_HTTP2_STREAM == result) &&
Curl_h2_http_1_1_error(data->conn)) { Curl_h2_http_1_1_error(data->conn)) {
CURLcode ret = Curl_retry_request(data->conn, &newurl); CURLcode ret = Curl_retry_request(data->conn, &newurl);
infof(data, "Forcing HTTP/1.1 for NTLM"); if(!ret) {
data->set.httpversion = CURL_HTTP_VERSION_1_1; infof(data, "Downgrades to HTTP/1.1!\n");
data->set.httpversion = CURL_HTTP_VERSION_1_1;
if(!ret) /* clear the error message bit too as we ignore the one we got */
retry = (newurl)?TRUE:FALSE; data->state.errorbuf = FALSE;
else if(!newurl)
result = ret; /* typically for HTTP_1_1_REQUIRED error on first flight */
newurl = strdup(data->change.url);
if(retry) { /* if we are to retry, set the result to OK and consider the request
/* if we are to retry, set the result to OK and consider the as done */
request as done */ retry = TRUE;
result = CURLE_OK; result = CURLE_OK;
done = TRUE; done = TRUE;
} }
else
result = ret;
} }
if(result) { if(result) {
@ -1942,13 +1944,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
} }
else else
follow = FOLLOW_RETRY; follow = FOLLOW_RETRY;
result = multi_done(data, CURLE_OK, FALSE); (void)multi_done(data, CURLE_OK, FALSE);
/* multi_done() might return CURLE_GOT_NOTHING */
result = Curl_follow(data, newurl, follow);
if(!result) { if(!result) {
result = Curl_follow(data, newurl, follow); multistate(data, CURLM_STATE_CONNECT);
if(!result) { rc = CURLM_CALL_MULTI_PERFORM;
multistate(data, CURLM_STATE_CONNECT);
rc = CURLM_CALL_MULTI_PERFORM;
}
} }
free(newurl); free(newurl);
} }