From 3853bbd6e4254b604aab0ff379536157221d8b6a Mon Sep 17 00:00:00 2001 From: Kamil Jezek Date: Mon, 17 Jan 2022 10:21:44 +0100 Subject: [PATCH 1/3] extended condition not to add the content-length header negative --- .../org/glassfish/jersey/apache/connector/ApacheConnector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java index 9a7c3c776a..4571b67535 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java @@ -509,7 +509,7 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing final HttpEntity entity = response.getEntity(); if (entity != null) { - if (headers.get(HttpHeaders.CONTENT_LENGTH) == null) { + if (headers.get(HttpHeaders.CONTENT_LENGTH) == null && entity.getContentLength() > 0) { headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getContentLength())); } From a68bd33d482374a3073c036460ece26d858d42eb Mon Sep 17 00:00:00 2001 From: Kamil Jezek Date: Mon, 17 Jan 2022 14:37:38 +0100 Subject: [PATCH 2/3] updated the license year --- .../org/glassfish/jersey/apache/connector/ApacheConnector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java index 4571b67535..9559f493a7 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at From 89ad6cf2f7e727555d182e71614b57f388f4b348 Mon Sep 17 00:00:00 2001 From: Kamil Jezek Date: Mon, 17 Jan 2022 17:52:15 +0100 Subject: [PATCH 3/3] content-length may be zero - it is a valid value --- .../org/glassfish/jersey/apache/connector/ApacheConnector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java index 9559f493a7..52059bb125 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnector.java @@ -509,7 +509,7 @@ public ClientResponse apply(final ClientRequest clientRequest) throws Processing final HttpEntity entity = response.getEntity(); if (entity != null) { - if (headers.get(HttpHeaders.CONTENT_LENGTH) == null && entity.getContentLength() > 0) { + if (headers.get(HttpHeaders.CONTENT_LENGTH) == null && entity.getContentLength() >= 0) { headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getContentLength())); }