Răsfoiți Sursa

Only write default Connection header to HTTP requests if needed (#11604)

Currently sys/Http writes "Connection: Close" to all requests, but
this should not be done if, for example, a given request includes a
"Connection: Keep-Alive" header.
Ian 1 an în urmă
părinte
comite
3297a0bae2
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      std/sys/Http.hx

+ 2 - 1
std/sys/Http.hx

@@ -223,7 +223,8 @@ class Http extends haxe.http.HttpBase {
 			else
 			else
 				b.writeString("Content-Length: " + uri.length + "\r\n");
 				b.writeString("Content-Length: " + uri.length + "\r\n");
 		}
 		}
-		b.writeString("Connection: close\r\n");
+		if( !Lambda.exists(headers, function(h) return h.name == "Connection") )
+			b.writeString("Connection: close\r\n");
 		for (h in headers) {
 		for (h in headers) {
 			b.writeString(h.name);
 			b.writeString(h.name);
 			b.writeString(": ");
 			b.writeString(": ");