]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http client: allow HTTP 1.1 to HTTP 1.0 switch
authorJaroslav Kysela <perex@perex.cz>
Wed, 16 Apr 2014 17:17:28 +0000 (19:17 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 5 May 2014 20:00:36 +0000 (22:00 +0200)
src/httpc.c

index 52226be01a6b44f0c96da3157ddfe9892d50207a..4be83d74580a5a5e0c2bbc3225e3def72c6621f7 100644 (file)
@@ -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) {