diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-08-12 18:51:10 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-08-13 08:20:35 +0000 |
commit | ca75c14f05777f2aa35f3c69aa547822bcc6081b (patch) | |
tree | fdca5559015d8e266af1a5c719de7fba4a4a6668 /epan/dissectors/packet-websocket.c | |
parent | 3a9f1717634a331507e9ccae74108fd9e3c1222a (diff) |
HTTP: create dissector table for HTTP Upgrade
Based on an idea from David M. Lloyd, let subdissectors register
themselves with the HTTP dissector based on the Upgrade header instead
of the other way round.
Tested with SSTP (bug 82390), WebSocket (bug 13889), HTTP2 PRI without
Upgrade (bug 11331), h2c (from HTTP2 wiki), spdy/3.1 (bug 12874).
Change-Id: I1425b7119d4d85e626032408504fc2c6b2f2eeb8
Reviewed-on: https://code.wireshark.org/review/29112
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-websocket.c')
-rw-r--r-- | epan/dissectors/packet-websocket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/epan/dissectors/packet-websocket.c b/epan/dissectors/packet-websocket.c index decb724e91..37aee6ed67 100644 --- a/epan/dissectors/packet-websocket.c +++ b/epan/dissectors/packet-websocket.c @@ -36,6 +36,7 @@ void proto_register_websocket(void); void proto_reg_handoff_websocket(void); +static dissector_handle_t websocket_handle; static dissector_handle_t text_lines_handle; static dissector_handle_t json_handle; static dissector_handle_t sip_handle; @@ -793,7 +794,7 @@ proto_register_websocket(void) expert_websocket = expert_register_protocol(proto_websocket); expert_register_field_array(expert_websocket, ei, array_length(ei)); - register_dissector("websocket", dissect_websocket, proto_websocket); + websocket_handle = register_dissector("websocket", dissect_websocket, proto_websocket); websocket_module = prefs_register_protocol(proto_websocket, proto_reg_handoff_websocket); @@ -808,6 +809,8 @@ proto_register_websocket(void) void proto_reg_handoff_websocket(void) { + dissector_add_string("http.upgrade", "websocket", websocket_handle); + text_lines_handle = find_dissector_add_dependency("data-text-lines", proto_websocket); json_handle = find_dissector_add_dependency("json", proto_websocket); sip_handle = find_dissector_add_dependency("sip", proto_websocket); |