[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serdev
Subject:    [sr-dev] git:pd/websocket: core: fixed an issue where big websocket requests ( single WS frame but a
From:       Peter Dunkley <peter.dunkley () crocodile-rcs ! com>
Date:       2012-06-28 16:58:47
Message-ID: 20120628165847.11FEBEF804E () rimmer ! ryngle ! com
[Download RAW message or body]

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


Author: Peter Dunkley <peter.dunkley@crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley@crocodile-rcs.com>
Date:   Thu Jun 28 17:55:53 2012 +0100

core: fixed an issue where big websocket requests (single WS frame but across \
multiple packets) weren't handled

---

 tcp_read.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/tcp_read.c b/tcp_read.c
index e33984b..b524727 100644
--- a/tcp_read.c
+++ b/tcp_read.c
@@ -1024,27 +1024,21 @@ static int tcp_read_ws(struct tcp_connection *c, int* \
read_flags)  struct tcp_req *r;
 
 	r=&c->req;
-	if (unlikely(r->parsed < r->pos))
-	{
-		LM_ERR("next frame...\n");
-		bytes = 0;
-		size = r->pos - r->parsed;
-	}
-	else
-	{
 #ifdef USE_TLS
-		if (unlikely(c->type == PROTO_TLS))
-			bytes = tls_read(c, read_flags);
-		else
+	if (unlikely(c->type == PROTO_TLS))
+		bytes = tls_read(c, read_flags);
+	else
 #endif
-			bytes = tcp_read(c, read_flags);
+		bytes = tcp_read(c, read_flags);
 
-		if (bytes <= 0)
+	if (bytes <= 0)
+	{
+		if (likely(r->parsed >= r->pos))
 			return 0;
-
-		size = bytes;
 	}
 
+	size = r->pos - r->parsed;
+
 	p = r->parsed;
 	pos = 0;
 


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic