From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Denis V. Lunev" <den@openvz.org>,
Anton Nefedov <anton.nefedov@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH] io: ignore case when matching websockets HTTP headers
Date: Mon, 27 Feb 2017 15:20:37 -0600 [thread overview]
Message-ID: <739c3a03-fffe-46d0-0ba6-a328a9a18eb2@redhat.com> (raw)
In-Reply-To: <20170227201456.31814-1-berrange@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]
On 02/27/2017 02:14 PM, Daniel P. Berrange wrote:
> According to RFC7230 Section 3.2, header field name is case-insensitive.
> Convert the header data into all lowercase before doing string matching
> on the headers.
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> io/channel-websock.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> @@ -223,7 +223,7 @@ static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
> static int qio_channel_websock_handshake_read(QIOChannelWebsock *ioc,
> Error **errp)
> {
> - char *handshake_end;
> + char *handshake_end, *tmp;
> ssize_t ret;
> /* Typical HTTP headers from novnc are 512 bytes, so limiting
> * total header size to 4096 is easily enough. */
Drive-by grammar nit: s/easily/easy/
> @@ -249,9 +249,13 @@ static int qio_channel_websock_handshake_read(QIOChannelWebsock *ioc,
> }
> }
>
> + for (tmp = (char *)ioc->encinput.buffer; tmp < handshake_end; tmp++) {
> + *tmp = g_ascii_tolower(*tmp);
> + }
> +
> if (qio_channel_websock_handshake_process(ioc,
> (char *)ioc->encinput.buffer,
> - ioc->encinput.offset,
> + handshake_end - (char *)ioc->encinput.buffer,
I'm not sure why this change is here; nothing else in the patch changed
ioc->encinput.offset.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-02-27 21:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 20:14 [Qemu-devel] [PATCH] io: ignore case when matching websockets HTTP headers Daniel P. Berrange
2017-02-27 21:20 ` Eric Blake [this message]
2017-02-28 7:29 ` Denis V. Lunev
2017-02-28 10:09 ` Daniel P. Berrange
2017-02-28 10:12 ` Denis V. Lunev
2017-02-27 21:28 ` no-reply
2017-02-28 10:48 ` Daniel P. Berrange
2017-02-28 10:54 ` Denis V. Lunev
2017-02-28 10:58 ` Denis V. Lunev
2017-02-28 11:56 ` Daniel P. Berrange
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=739c3a03-fffe-46d0-0ba6-a328a9a18eb2@redhat.com \
--to=eblake@redhat.com \
--cc=anton.nefedov@virtuozzo.com \
--cc=berrange@redhat.com \
--cc=den@openvz.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).