]> git.proxmox.com Git - mirror_qemu.git/commit
io: fully parse & validate HTTP headers for websocket protocol handshake
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 28 Feb 2017 10:37:24 +0000 (10:37 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 28 Feb 2017 11:51:16 +0000 (11:51 +0000)
commit07e95cd529af345fdeea230913f68eff5b925bb6
tree6c0ca2ba948a5485e5b2884d40a2cdd24d641abb
parente3d90312b3748431ca7c1ecb10cd4614f32f0ae3
io: fully parse & validate HTTP headers for websocket protocol handshake

The current websockets protocol handshake code is very relaxed, just
doing crude string searching across the HTTP header data. This causes
it to both reject valid connections and fail to reject invalid
connections. For example, according to the RFC 6455 it:

 - MUST reject any method other than "GET"
 - MUST reject any HTTP version less than "HTTP/1.1"
 - MUST reject Connection header without "Upgrade" listed
 - MUST reject Upgrade header which is not 'websocket'
 - MUST reject missing Host header
 - MUST treat HTTP header names as case insensitive

To do all this validation correctly requires that we fully parse the
HTTP headers, populating a data structure containing the header
fields.

After this change, we also reject any path other than '/'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
io/channel-websock.c