Browse code

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

Peter Dunkley authored on 28/06/2012 16:55:53
Showing 1 changed files
... ...
@@ -1024,27 +1024,21 @@ static int tcp_read_ws(struct tcp_connection *c, int* read_flags)
1024 1024
 	struct tcp_req *r;
1025 1025
 
1026 1026
 	r=&c->req;
1027
-	if (unlikely(r->parsed < r->pos))
1028
-	{
1029
-		LM_ERR("next frame...\n");
1030
-		bytes = 0;
1031
-		size = r->pos - r->parsed;
1032
-	}
1033
-	else
1034
-	{
1035 1027
 #ifdef USE_TLS
1036
-		if (unlikely(c->type == PROTO_TLS))
1037
-			bytes = tls_read(c, read_flags);
1038
-		else
1028
+	if (unlikely(c->type == PROTO_TLS))
1029
+		bytes = tls_read(c, read_flags);
1030
+	else
1039 1031
 #endif
1040
-			bytes = tcp_read(c, read_flags);
1032
+		bytes = tcp_read(c, read_flags);
1041 1033
 
1042
-		if (bytes <= 0)
1034
+	if (bytes <= 0)
1035
+	{
1036
+		if (likely(r->parsed >= r->pos))
1043 1037
 			return 0;
1044
-
1045
-		size = bytes;
1046 1038
 	}
1047 1039
 
1040
+	size = r->pos - r->parsed;
1041
+
1048 1042
 	p = r->parsed;
1049 1043
 	pos = 0;
1050 1044