diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2017-09-06 14:49:41 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2017-10-04 13:21:53 +0100 |
commit | 33badfd1e3735b877e41939100511c65572be6b9 (patch) | |
tree | 78bf958819aa39e34757b508207650949a0b0c3d /io/channel-websock.c | |
parent | 3a3f8705962c8c8a47a9b981ffd5aab7274ad508 (diff) |
io: use case insensitive check for Connection & Upgrade websock headers
When checking the value of the Connection and Upgrade HTTP headers
the websock RFC (6455) requires the comparison to be case insensitive.
The Connection value should be an exact match not a substring.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'io/channel-websock.c')
-rw-r--r-- | io/channel-websock.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/io/channel-websock.c b/io/channel-websock.c index 6ddcec1549..2258557a21 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -431,12 +431,12 @@ static void qio_channel_websock_handshake_process(QIOChannelWebsock *ioc, goto bad_request; } - if (!g_strrstr(connection, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE)) { + if (strcasecmp(connection, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE) != 0) { error_setg(errp, "No connection upgrade requested '%s'", connection); goto bad_request; } - if (!g_str_equal(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET)) { + if (strcasecmp(upgrade, QIO_CHANNEL_WEBSOCK_UPGRADE_WEBSOCKET) != 0) { error_setg(errp, "Incorrect upgrade method '%s'", upgrade); goto bad_request; } |