From 20e1abc00c01ee708a559a4d4e0cde1d9f4a5995 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 16 Apr 2014 19:17:28 +0200 Subject: [PATCH] http client: allow HTTP 1.1 to HTTP 1.0 switch --- src/httpc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/httpc.c b/src/httpc.c index 52226be0..4be83d74 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -905,8 +905,13 @@ header: return http_client_flush(hc, -EINVAL); if ((ver = http_str2ver(argv[0])) < 0) return http_client_flush(hc, -EINVAL); - if (ver != hc->hc_version) - return http_client_flush(hc, -EINVAL); + if (ver != hc->hc_version) { + /* 1.1 -> 1.0 transition allowed */ + if (hc->hc_version == HTTP_VERSION_1_1 && ver == HTTP_VERSION_1_0) + hc->hc_version = ver; + else + return http_client_flush(hc, -EINVAL); + } if ((hc->hc_code = atoi(argv[1])) < 200) return http_client_flush(hc, -EINVAL); while ((p = strtok_r(NULL, "\r\n", &saveptr)) != NULL) {