Skip to content

Commit

Permalink
fix: issue #102
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Oct 26, 2020
1 parent 076a79e commit 28c8c94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Proxyee is a JAVA written HTTP proxy server library that supports HTTP, HTTPS, W
<dependency>
<groupId>com.github.monkeywie</groupId>
<artifactId>proxyee</artifactId>
<version>1.2.2</version>
<version>1.2.3</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public final void beforeRequest(Channel clientChannel, HttpRequest httpRequest,
//添加gzip解压处理
clientChannel.pipeline().addAfter("httpCodec", "decompress", new HttpContentDecompressor());
//添加Full request解码器
clientChannel.pipeline().addAfter("decompress", "aggregator", new HttpObjectAggregator(DEFAULT_MAX_CONTENT_LENGTH));
clientChannel.pipeline().addAfter("decompress", "aggregator", new HttpObjectAggregator(maxContentLength));
//重新过一遍处理器链
clientChannel.pipeline().fireChannelRead(httpRequest);
return;
Expand All @@ -51,8 +51,12 @@ public final void beforeRequest(Channel clientChannel, HttpRequest httpRequest,
public void afterResponse(Channel clientChannel, Channel proxyChannel, HttpResponse httpResponse, HttpProxyInterceptPipeline pipeline) throws Exception {
//如果是FullHttpRequest
if (pipeline.getHttpRequest() instanceof FullHttpRequest) {
clientChannel.pipeline().remove("decompress");
clientChannel.pipeline().remove("aggregator");
if (clientChannel.pipeline().get("decompress") != null) {
clientChannel.pipeline().remove("decompress");
}
if (clientChannel.pipeline().get("aggregator") != null) {
clientChannel.pipeline().remove("aggregator");
}
FullHttpRequest httpRequest = (FullHttpRequest) pipeline.getHttpRequest();
httpRequest.content().resetReaderIndex();
}
Expand Down

0 comments on commit 28c8c94

Please sign in to comment.