Skip to content

Commit

Permalink
修改Http请求的Host缺失端口
Browse files Browse the repository at this point in the history
  • Loading branch information
IceSoulHanxi committed Jul 11, 2020
1 parent 94da42f commit 6e14660
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/ixnah/mc/ws/util/ConnectUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,12 @@ protected void initChannel(Channel channel) throws SSLException {
}).channel(oclass).connect(address, port).syncUninterruptibly().channel();

String playerId = Minecraft.getMinecraft().getSession().getPlayerID();
String host = uri.getHost();
if (uri.getPort() != -1)
host = host + ":" + uri.getPort();
HttpRequest request = new DefaultFullHttpRequest(HTTP_1_1, GET, uri.getPath());
request.headers()
.add(HOST, uri.getHost())
.add(HOST, host)
.add(USER_AGENT, userAgent)
.add(PRAGMA, NO_CACHE)
.add(CACHE_CONTROL, NO_STORE) // 设置CDN不缓存
Expand Down

0 comments on commit 6e14660

Please sign in to comment.