add explicit Content-Length header to http response (otherwise it is missing in HEAD responses);
authorFabian Huch <huch@in.tum.de>
Tue, 28 May 2024 19:51:09 +0200
changeset 80202 03c058592c58
parent 80201 6ac48d53d371
child 80203 ca9a402735b4
add explicit Content-Length header to http response (otherwise it is missing in HEAD responses);
src/Pure/General/http.scala
--- a/src/Pure/General/http.scala	Tue May 28 19:49:42 2024 +0200
+++ b/src/Pure/General/http.scala	Tue May 28 19:51:09 2024 +0200
@@ -222,6 +222,7 @@
 
     def write(http: HttpExchange, code: Int, is_head: Boolean = false): Unit = {
       http.getResponseHeaders.set("Content-Type", content_type)
+      http.getResponseHeaders.set("Content-Length", output.length.toString)
       http.sendResponseHeaders(code, if (is_head) -1 else output.length.toLong)
       if (!is_head) using(http.getResponseBody)(output.write_stream)
     }