Blame SOURCES/kvm-io-use-case-insensitive-check-for-Connection-Upgrade.patch

4a2fec
From dad42ba543ed6ed3db06e33a08466c7a912b777e Mon Sep 17 00:00:00 2001
4a2fec
From: "Daniel P. Berrange" <berrange@redhat.com>
4a2fec
Date: Wed, 20 Dec 2017 17:56:45 +0100
4a2fec
Subject: [PATCH 05/42] io: use case insensitive check for Connection & Upgrade
4a2fec
 websock headers
4a2fec
4a2fec
RH-Author: Daniel P. Berrange <berrange@redhat.com>
4a2fec
Message-id: <20171220175702.29663-4-berrange@redhat.com>
4a2fec
Patchwork-id: 78456
4a2fec
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH v2 03/20] io: use case insensitive check for Connection & Upgrade websock headers
4a2fec
Bugzilla: 1518649
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
4a2fec
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
When checking the value of the Connection and Upgrade HTTP headers
4a2fec
the websock RFC (6455) requires the comparison to be case insensitive.
4a2fec
The Connection value should be an exact match not a substring.
4a2fec
4a2fec
Reviewed-by: Eric Blake <eblake@redhat.com>
4a2fec
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4a2fec
(cherry picked from commit 33badfd1e3735b877e41939100511c65572be6b9)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 io/channel-websock.c | 4 ++--
4a2fec
 1 file changed, 2 insertions(+), 2 deletions(-)
4a2fec
4a2fec
diff --git a/io/channel-websock.c b/io/channel-websock.c
4a2fec
index 6ddcec1..2258557 100644
4a2fec
--- a/io/channel-websock.c
4a2fec
+++ b/io/channel-websock.c
4a2fec
@@ -431,12 +431,12 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc,
4a2fec
         goto bad_request;
4a2fec
     }
4a2fec
 
4a2fec
-    if (!g_strrstr(connection, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE)) {
4a2fec
+    if (strcasecmp(connection, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE) != 0) {
4a2fec
         error_setg(errp, "No connection upgrade requested '%s'", connection);
4a2fec
         goto bad_request;
4a2fec
     }
4a2fec
 
4a2fec
-    if (!g_str_equal(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET)) {
4a2fec
+    if (strcasecmp(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET) != 0) {
4a2fec
         error_setg(errp, "Incorrect upgrade method '%s'", upgrade);
4a2fec
         goto bad_request;
4a2fec
     }
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec