Skip to content

Commit

Permalink
Merge pull request adamfisk#272 from MediumOne/original-request-copy-fix
Browse files Browse the repository at this point in the history
Fix for ClientToProxyConnection.copy() not copying headers
  • Loading branch information
jekh committed Mar 14, 2016
2 parents 6a7b0f9 + 8ecbb10 commit 1f55e83
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.DefaultHttpRequest;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpContent;
import io.netty.handler.codec.http.HttpHeaders;
Expand Down Expand Up @@ -1006,13 +1006,13 @@ private void writeAuthenticationRequired() {
* @return
*/
private HttpRequest copy(HttpRequest original) {
if (original instanceof DefaultFullHttpRequest) {
ByteBuf content = ((DefaultFullHttpRequest) original).content();
return new DefaultFullHttpRequest(original.getProtocolVersion(),
original.getMethod(), original.getUri(), content);
if (original instanceof FullHttpRequest) {
return ((FullHttpRequest) original).copy();
} else {
return new DefaultHttpRequest(original.getProtocolVersion(),
HttpRequest request = new DefaultHttpRequest(original.getProtocolVersion(),
original.getMethod(), original.getUri());
request.headers().set(original.headers());
return request;
}
}

Expand Down

0 comments on commit 1f55e83

Please sign in to comment.