From 1c5b95db0b049998d4a0e61d1e23879695eb4061 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 6 Oct 2020 18:18:26 +0100 Subject: [PATCH] Revert workaround in Jetty connector The workaround was removed in the 5.3 milestone phase and in master only because the referenced Jetty issue is marked fixed. However, what we need to replace it with should be a little more involved and also it's not entirely clear if the fixes in Jetty aligns with our release and retain semantics so that needs to be investigated more thoroughly. --- .../client/reactive/JettyClientHttpConnector.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java b/spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java index 75dfdc8260..15fcedb813 100644 --- a/spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java +++ b/spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java @@ -131,7 +131,16 @@ public class JettyClientHttpConnector implements ClientHttpConnector { } private DataBuffer toDataBuffer(ContentChunk chunk) { - DataBuffer buffer = this.bufferFactory.wrap(chunk.buffer); + + // Originally we copy due to do: + // https://github.com/eclipse/jetty.project/issues/2429 + + // Now that the issue is marked fixed we need to replace the below with a + // PooledDataBuffer that adapts "release()" to "succeeded()", and also + // evaluate if the concern here is addressed. + + DataBuffer buffer = this.bufferFactory.allocateBuffer(chunk.buffer.capacity()); + buffer.write(chunk.buffer); chunk.callback.succeeded(); return buffer; }