summaryrefslogtreecommitdiffstats
path: root/lib/http.c
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@cool.haxx.se>2021-09-22 06:10:23 (GMT)
committerBrad King <brad.king@kitware.com>2021-09-24 14:03:55 (GMT)
commitc4f76b28dcabdf9513a244eb1ce7d1431ae4d84d (patch)
treee6c32f13cdc2b226f2a69720b87b7f4b65ec32e8 /lib/http.c
parent386467c9dc939cd20711c451dd7d60341fd0e802 (diff)
downloadCMake-c4f76b28dcabdf9513a244eb1ce7d1431ae4d84d.zip
CMake-c4f76b28dcabdf9513a244eb1ce7d1431ae4d84d.tar.gz
CMake-c4f76b28dcabdf9513a244eb1ce7d1431ae4d84d.tar.bz2
curl 2021-09-22 (c7aef0a9)
Code extracted from: https://github.com/curl/curl.git at commit c7aef0a945f9b6fb6d3f91716a21dfe2f4ea635f (curl-7_79_1).
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/http.c b/lib/http.c
index d5c36dd..648583c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -4232,9 +4232,9 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
char separator;
char twoorthree[2];
int httpversion = 0;
- int digit4 = -1; /* should remain untouched to be good */
+ char digit4 = 0;
nc = sscanf(HEADER1,
- " HTTP/%1d.%1d%c%3d%1d",
+ " HTTP/%1d.%1d%c%3d%c",
&httpversion_major,
&httpversion,
&separator,
@@ -4250,13 +4250,13 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
/* There can only be a 4th response code digit stored in 'digit4' if
all the other fields were parsed and stored first, so nc is 5 when
- digit4 is not -1 */
- else if(digit4 != -1) {
+ digit4 a digit */
+ else if(ISDIGIT(digit4)) {
failf(data, "Unsupported response code in HTTP response");
return CURLE_UNSUPPORTED_PROTOCOL;
}
- if((nc == 4) && (' ' == separator)) {
+ if((nc >= 4) && (' ' == separator)) {
httpversion += 10 * httpversion_major;
switch(httpversion) {
case 10: