Browse Source

fix tcp packet boundary bug.

Nicolas Cannasse 19 years ago
parent
commit
5ddc73e7c7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      std/haxe/Http.hx

+ 3 - 2
std/haxe/Http.hx

@@ -235,8 +235,9 @@ class Http {
 		var s = neko.Lib.makeString(4);
 		sock.setTimeout(10000); // 10 seconds
 		while( true ) {
-			if( sock.receive(s,0,k) != k )
-				throw "Connection aborted early";
+			var p = sock.receive(s,0,k);
+			while( p != k )
+				p += sock.receive(s,p,k - p);
 			b.addSub(s,0,k);
 			switch( k ) {
 			case 1: