From eba360f66247784057c452c7e944b6f53575d9b9 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 31 Aug 2020 09:43:04 -0500 Subject: [PATCH] Issue #5214 - Use known content_length when in bypass write + In the case of HEAD, the servlet-api response is a wrapper of javax.servlet.http.HttpServlet$NoBodyResponse We know the content_length, use it. Signed-off-by: Joakim Erdfelt --- .../src/main/java/org/eclipse/jetty/server/ResourceService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java index 94bf5462e421..6ad0df3534c3 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java @@ -677,7 +677,7 @@ protected boolean sendData(HttpServletRequest request, else if (written || !(out instanceof HttpOutput)) { // write normally - putHeaders(response, content, written ? -1 : 0); + putHeaders(response, content, content_length); ByteBuffer buffer = content.getIndirectBuffer(); if (buffer != null) BufferUtil.writeTo(buffer, out);