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

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