From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: David Edmondson <david.edmondson@oracle.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH 2/2] block/curl: HTTP header field names are case insensitive
Date: Wed, 19 Feb 2020 15:01:26 +0100 [thread overview]
Message-ID: <b0b900f0-e879-727d-e88b-5ddb3ffe8fc1@redhat.com> (raw)
In-Reply-To: <20200219132745.315381-3-david.edmondson@oracle.com>
Hi David,
On 2/19/20 2:27 PM, David Edmondson wrote:
> RFC 7230 section 3.2 indicates that HTTP header field names are case
> insensitive.
>
> Signed-off-by: David Edmondson <david.edmondson@oracle.com>
> ---
> block/curl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/curl.c b/block/curl.c
> index 0cf99a4b31b8..4256659cd85b 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -216,11 +216,11 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
> size_t realsize = size * nmemb;
> const char *header = (char *)ptr;
> const char *end = header + realsize;
> - const char *accept_ranges = "Accept-Ranges:";
> + const char *accept_ranges = "accept-ranges:";
> const char *bytes = "bytes";
>
> if (realsize >= strlen(accept_ranges)
> - && strncmp(header, accept_ranges, strlen(accept_ranges)) == 0) {
> + && strncasecmp(header, accept_ranges, strlen(accept_ranges)) == 0) {
Can you use g_ascii_strncasecmp() instead?
>
> char *p = strchr(header, ':') + 1;
>
>
prev parent reply other threads:[~2020-02-19 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 13:27 [PATCH 0/2] block/curl: Improve HTTP header parsing David Edmondson
2020-02-19 13:27 ` [PATCH 1/2] block/curl: HTTP header fields allow whitespace around values David Edmondson
2020-02-19 13:27 ` [PATCH 2/2] block/curl: HTTP header field names are case insensitive David Edmondson
2020-02-19 14:01 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0b900f0-e879-727d-e88b-5ddb3ffe8fc1@redhat.com \
--to=philmd@redhat.com \
--cc=david.edmondson@oracle.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).