c-hyper: adjust the hyper to curlcode conversion

Closes #11621
This commit is contained in:
Daniel Stenberg 2023-08-08 13:19:37 +02:00
parent 06e2fa2b51
commit 850f6c79e8
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -416,14 +416,26 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
size_t errlen = hyper_error_print(hypererr, errbuf, sizeof(errbuf));
hyper_code code = hyper_error_code(hypererr);
failf(data, "Hyper: [%d] %.*s", (int)code, (int)errlen, errbuf);
if(code == HYPERE_ABORTED_BY_CALLBACK)
switch(code) {
case HYPERE_ABORTED_BY_CALLBACK:
result = CURLE_OK;
else if((code == HYPERE_UNEXPECTED_EOF) && !data->req.bytecount)
result = CURLE_GOT_NOTHING;
else if(code == HYPERE_INVALID_PEER_MESSAGE)
break;
case HYPERE_UNEXPECTED_EOF:
if(!data->req.bytecount)
result = CURLE_GOT_NOTHING;
else
result = CURLE_RECV_ERROR;
break;
case HYPERE_INVALID_PEER_MESSAGE:
/* bump headerbytecount to avoid the count remaining at zero and
appearing to not having read anything from the peer at all */
data->req.headerbytecount++;
result = CURLE_UNSUPPORTED_PROTOCOL; /* maybe */
else
break;
default:
result = CURLE_RECV_ERROR;
break;
}
}
*done = TRUE;
hyper_error_free(hypererr);