diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 5e0360f..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "type": "java", - "name": "CodeLens (Launch) - InterceptPassHttpProxyServer", - "request": "launch", - "mainClass": "com.github.monkeywie.proxyee.InterceptPassHttpProxyServer", - "projectName": "proxyee" - }, - { - "type": "java", - "name": "CodeLens (Launch) - InterceptRedirectHttpProxyServer", - "request": "launch", - "mainClass": "com.github.monkeywie.proxyee.InterceptRedirectHttpProxyServer", - "projectName": "proxyee" - } - ] -} \ No newline at end of file diff --git a/README.md b/README.md index bc1a531..ad87b86 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Proxyee is a JAVA written HTTP proxy server library that supports HTTP, HTTPS, W com.github.monkeywie proxyee - 1.6.9 + 1.7.0 ``` diff --git a/README_zh-CN.md b/README_zh-CN.md index 5066235..176c5b5 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -25,7 +25,7 @@ Proxyee 是一个 JAVA 编写的 HTTP 代理服务器类库,支持 HTTP、HTTP com.github.monkeywie proxyee - 1.6.9 + 1.7.0 ``` diff --git a/pom.xml b/pom.xml index 7e1c540..65ee3b0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.monkeywie proxyee - 1.6.9 + 1.7.0 jar diff --git a/src/main/java/com/github/monkeywie/proxyee/handler/HttpProxyServerHandler.java b/src/main/java/com/github/monkeywie/proxyee/handler/HttpProxyServerHandler.java index edfcfc6..5c5f10b 100644 --- a/src/main/java/com/github/monkeywie/proxyee/handler/HttpProxyServerHandler.java +++ b/src/main/java/com/github/monkeywie/proxyee/handler/HttpProxyServerHandler.java @@ -287,13 +287,6 @@ private void handleProxyData(Channel channel, Object msg, boolean isHttp) throws RequestProto newRP = ProtoUtil.getRequestProto(httpRequest); if (!newRP.equals(pipeRp)) { isChangeRp = true; - // 更新Host请求头 - if ((pipeRp.getSsl() && pipeRp.getPort() == 443) - || (!pipeRp.getSsl() && pipeRp.getPort() == 80)) { - httpRequest.headers().set(HttpHeaderNames.HOST, pipeRp.getHost()); - } else { - httpRequest.headers().set(HttpHeaderNames.HOST, pipeRp.getHost() + ":" + pipeRp.getPort()); - } } } diff --git a/src/test/java/com/github/monkeywie/proxyee/InterceptForwardHttpProxyServer.java b/src/test/java/com/github/monkeywie/proxyee/InterceptForwardHttpProxyServer.java index bd9ca15..aca1bb7 100644 --- a/src/test/java/com/github/monkeywie/proxyee/InterceptForwardHttpProxyServer.java +++ b/src/test/java/com/github/monkeywie/proxyee/InterceptForwardHttpProxyServer.java @@ -8,6 +8,7 @@ import com.github.monkeywie.proxyee.server.HttpProxyServerConfig; import com.github.monkeywie.proxyee.util.HttpUtil; import io.netty.channel.Channel; +import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpRequest; /** @@ -37,6 +38,7 @@ public void beforeRequest(Channel clientChannel, HttpRequest httpRequest, pipeline.getRequestProto().setHost("www.taobao.com"); pipeline.getRequestProto().setPort(443); pipeline.getRequestProto().setSsl(true); + httpRequest.headers().set(HttpHeaderNames.HOST, "www.taobao.com"); } pipeline.beforeRequest(clientChannel, httpRequest); }