From: "Denis V. Lunev" <den@openvz.org>
To: Eric Blake <eblake@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
qemu-devel@nongnu.org
Cc: Anton Nefedov <anton.nefedov@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH] io: ignore case when matching websockets HTTP headers
Date: Tue, 28 Feb 2017 10:29:15 +0300 [thread overview]
Message-ID: <e4470b32-a66e-a32b-986f-ce5e2183c04e@openvz.org> (raw)
In-Reply-To: <739c3a03-fffe-46d0-0ba6-a328a9a18eb2@redhat.com>
On 02/28/2017 12:20 AM, Eric Blake wrote:
> 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.
>
yep. The rest seems fine to me.
Usage of g_ascii_strdown () seems overkill now. We do not need
the header anymore after this call.
Den
next prev parent reply other threads:[~2017-02-28 8:03 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
2017-02-28 7:29 ` Denis V. Lunev [this message]
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=e4470b32-a66e-a32b-986f-ce5e2183c04e@openvz.org \
--to=den@openvz.org \
--cc=anton.nefedov@virtuozzo.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--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).