This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 0127db8 CAMEL-13960: retain the proxied body
0127db8 is described below
commit 0127db814f83bd7802ebcc7d2d75549c62b967a4
Author: Zoran Regvart <[email protected]>
AuthorDate: Tue Sep 10 13:55:53 2019 +0200
CAMEL-13960: retain the proxied body
We need to retain the body of the HTTP request when proxying as the
request will be released and the body along with it, so when the body is
passed to the next request in the chain and released on use the
reference count would already reached 0.
---
.../org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
index 8339e7e..c20f6b3 100644
---
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
+++
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
@@ -100,7 +100,8 @@ public class DefaultNettyHttpBinding implements
NettyHttpBinding, Cloneable {
if (configuration.isHttpProxy() ||
configuration.isDisableStreamCache()) {
// keep the body as is, and use type converters
// for proxy use case pass the request body buffer directly to the
response to avoid additional processing
- answer.setBody(request.content());
+ // we need to retain it so that the request can be released and we
can keep the content
+ answer.setBody(request.content().retain());
} else {
// turn the body into stream cached (on the client/consumer side
we can facade the netty stream instead of converting to byte array)
NettyChannelBufferStreamCache cache = new
NettyChannelBufferStreamCache(request.content());