Explorar el Código

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 hace 1 año
padre
commit
3297a0bae2
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      std/sys/Http.hx

+ 2 - 1
std/sys/Http.hx

@@ -223,7 +223,8 @@ class Http extends haxe.http.HttpBase {
 			else
 				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) {
 			b.writeString(h.name);
 			b.writeString(": ");