From 0a758da44714b4ebef64a5d5a56f225f6e22e7a6 Mon Sep 17 00:00:00 2001 From: Maxim Nesen Date: Fri, 28 Jan 2022 14:33:19 +0100 Subject: [PATCH] Exclude unix protocols from request processing in closing strategy Signed-off-by: Maxim Nesen --- .../apache/connector/ApacheConnectionClosingStrategy.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnectionClosingStrategy.java b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnectionClosingStrategy.java index 8c248eae57..96c3ee0836 100644 --- a/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnectionClosingStrategy.java +++ b/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheConnectionClosingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -63,12 +63,15 @@ void close(ClientRequest clientRequest, HttpUriRequest request, CloseableHttpRes * Strategy that aborts Apache HttpRequests for the case of Chunked Stream, closes the stream, and response next. */ class GracefulClosingStrategy implements ApacheConnectionClosingStrategy { + private static final String UNIX_PROTOCOL = "unix"; + static final GracefulClosingStrategy INSTANCE = new GracefulClosingStrategy(); @Override public void close(ClientRequest clientRequest, HttpUriRequest request, CloseableHttpResponse response, InputStream stream) throws IOException { - if (response.getEntity() != null && response.getEntity().isChunked()) { + if (response.getEntity() != null && response.getEntity().isChunked() + && !request.getURI().getScheme().equals(UNIX_PROTOCOL)) { request.abort(); } try {