[sr-dev] git:pd/websocket: modules/websockets: Changes WS to be a protocol in its own right instead of a flag on TCP/ TLS connections

Peter Dunkley peter.dunkley at crocodile-rcs.com
Fri Jun 29 18:48:07 CEST 2012


Module: sip-router
Branch: pd/websocket
Commit: 353ad95af22d7a4c7d20aebbed291fef085867ba
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=353ad95af22d7a4c7d20aebbed291fef085867ba

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Fri Jun 29 17:47:22 2012 +0100

modules/websockets: Changes WS to be a protocol in its own right instead of a flag on TCP/TLS connections

---

 modules/websocket/ws_handshake.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/modules/websocket/ws_handshake.c b/modules/websocket/ws_handshake.c
index ecc8fad..4bacd61 100644
--- a/modules/websocket/ws_handshake.c
+++ b/modules/websocket/ws_handshake.c
@@ -133,6 +133,12 @@ int ws_handle_handshake(struct sip_msg *msg)
 		return 0;
 	}
 
+	if (con->type != PROTO_TCP && con->type != PROTO_TLS)
+	{
+		LM_ERR("unsupported transport: %d", con->type);
+		return 0;
+	}
+
 	/* Process HTTP headers */
 	while (hdr != NULL)
 	{
@@ -304,7 +310,10 @@ int ws_handle_handshake(struct sip_msg *msg)
 
 	/* Make sure Kamailio core sends future messages on this connection
 	   directly to this module */
-	con->flags |= F_CONN_WS;
+	if (con->type == PROTO_TLS)
+		con->type = con->rcv.proto = PROTO_WSS;
+	else
+		con->type = con->rcv.proto = PROTO_WS;
 
 	return 0;
 }




More information about the sr-dev mailing list