From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>
Cc: qemu-devel@nongnu.org, Anton Nefedov <anton.nefedov@virtuozzo.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] io: ignore case in WebSocket HTTP header #PSBM-57554
Date: Mon, 27 Feb 2017 20:11:19 +0000 [thread overview]
Message-ID: <20170227201119.GA25346@redhat.com> (raw)
In-Reply-To: <1485782396-22341-1-git-send-email-den@openvz.org>
On Mon, Jan 30, 2017 at 04:19:56PM +0300, Denis V. Lunev wrote:
> From: Anton Nefedov <anton.nefedov@virtuozzo.com>
>
> According to RFC7230 Section 3.2, header field name is case-insensitive.
>
> The haystack string length is limited by 4096 bytes by
> qio_channel_websock_handshake_read().
>
> Further, handshake_process() dups and NULL-terminates the string
> so it is safe to call non length-limited functions like strcasestr().
>
> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Daniel P. Berrange <berrange@redhat.com>
> ---
> io/channel-websock.c | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/io/channel-websock.c b/io/channel-websock.c
> index d5a4ed3..991925a 100644
> --- a/io/channel-websock.c
> +++ b/io/channel-websock.c
> @@ -108,18 +108,16 @@ enum {
> };
>
> static char *qio_channel_websock_handshake_entry(const char *handshake,
> - size_t handshake_len,
> const char *name)
> {
> char *begin, *end, *ret = NULL;
> char *line = g_strdup_printf("%s%s: ",
> QIO_CHANNEL_WEBSOCK_HANDSHAKE_DELIM,
> name);
> - begin = g_strstr_len(handshake, handshake_len, line);
> + begin = strcasestr(handshake, line);
So this turns out to break Windows builds since there's no strcasestr
on Mingw. There's no alternative that I know of in glib and I don't
fancy implementing a custom strcasestr() function. So I'm going to
drop this patch entirely, and copy you on an alternative fix that
simply converts the input data to lowercase before comparison. Would
appreciate if you can test my alternate patch with whatever client
you had problems with.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
next prev parent reply other threads:[~2017-02-27 20:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-30 13:19 [Qemu-devel] [PATCH 1/1] io: ignore case in WebSocket HTTP header #PSBM-57554 Denis V. Lunev
2017-01-30 15:47 ` Daniel P. Berrange
2017-01-30 15:52 ` Denis V. Lunev
2017-02-27 20:11 ` Daniel P. Berrange [this message]
2017-02-27 20:13 ` Denis V. Lunev
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=20170227201119.GA25346@redhat.com \
--to=berrange@redhat.com \
--cc=anton.nefedov@virtuozzo.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).