فهرست منبع

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

Peter Dunkley 13 سال پیش
والد
کامیت
d07a57f684
1فایلهای تغییر یافته به همراه9 افزوده شده و 15 حذف شده
  1. 9 15
      tcp_read.c

+ 9 - 15
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;