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