yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-curl-HTTP-header-field-names-are-case-insensit.patch

ddf19c
From 5e5ca17e1e09cfe9a780c556528bbde23c93fc4e Mon Sep 17 00:00:00 2001
ddf19c
From: Richard Jones <rjones@redhat.com>
ddf19c
Date: Thu, 28 May 2020 14:27:37 +0100
ddf19c
Subject: [PATCH 03/26] block/curl: HTTP header field names are case
ddf19c
 insensitive
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: Richard Jones <rjones@redhat.com>
ddf19c
Message-id: <20200528142737.17318-3-rjones@redhat.com>
ddf19c
Patchwork-id: 96895
ddf19c
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 2/2] block/curl: HTTP header field names are case insensitive
ddf19c
Bugzilla: 1841038
ddf19c
RH-Acked-by: Eric Blake <eblake@redhat.com>
ddf19c
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ddf19c
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
ddf19c
From: David Edmondson <david.edmondson@oracle.com>
ddf19c
ddf19c
RFC 7230 section 3.2 indicates that HTTP header field names are case
ddf19c
insensitive.
ddf19c
ddf19c
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
ddf19c
Message-Id: <20200224101310.101169-3-david.edmondson@oracle.com>
ddf19c
Reviewed-by: Max Reitz <mreitz@redhat.com>
ddf19c
Signed-off-by: Max Reitz <mreitz@redhat.com>
ddf19c
(cherry picked from commit 69032253c33ae1774233c63cedf36d32242a85fc)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 block/curl.c | 5 +++--
ddf19c
 1 file changed, 3 insertions(+), 2 deletions(-)
ddf19c
ddf19c
diff --git a/block/curl.c b/block/curl.c
ddf19c
index f9ffb7f..6e32590 100644
ddf19c
--- a/block/curl.c
ddf19c
+++ b/block/curl.c
ddf19c
@@ -216,11 +216,12 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
ddf19c
     size_t realsize = size * nmemb;
ddf19c
     const char *header = (char *)ptr;
ddf19c
     const char *end = header + realsize;
ddf19c
-    const char *accept_ranges = "Accept-Ranges:";
ddf19c
+    const char *accept_ranges = "accept-ranges:";
ddf19c
     const char *bytes = "bytes";
ddf19c
 
ddf19c
     if (realsize >= strlen(accept_ranges)
ddf19c
-        && strncmp(header, accept_ranges, strlen(accept_ranges)) == 0) {
ddf19c
+        && g_ascii_strncasecmp(header, accept_ranges,
ddf19c
+                               strlen(accept_ranges)) == 0) {
ddf19c
 
ddf19c
         char *p = strchr(header, ':') + 1;
ddf19c
 
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c