cryptospore / 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

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