From b8fb89cd119b09997559f52f5ca21df91d527106 Mon Sep 17 00:00:00 2001 From: lynn Date: Thu, 14 Apr 2022 15:12:54 +0800 Subject: [PATCH] fix location --- .../cn/promptness/rpt/client/handler/ReceiveHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rpt-client/src/main/java/cn/promptness/rpt/client/handler/ReceiveHandler.java b/rpt-client/src/main/java/cn/promptness/rpt/client/handler/ReceiveHandler.java index b4fe838..952b294 100644 --- a/rpt-client/src/main/java/cn/promptness/rpt/client/handler/ReceiveHandler.java +++ b/rpt-client/src/main/java/cn/promptness/rpt/client/handler/ReceiveHandler.java @@ -57,9 +57,11 @@ protected void channelRead0(ChannelHandlerContext ctx, FullHttpResponse response HttpResponseStatus status = response.status(); if (REDIRECT_STATUS.contains(status.code())) { String location = String.valueOf(response.headers().get(HttpHeaderNames.LOCATION)); - int index = location.indexOf("/", 8); - location = HttpScheme.HTTP + "://" + clientConfig.getConfig().get(0).getDomain() + location.substring(index); - response.headers().set(HttpHeaderNames.LOCATION, location); + if (location.startsWith(HttpScheme.HTTP.toString())) { + int index = location.indexOf("/", 8); + location = HttpScheme.HTTP + "://" + clientConfig.getConfig().get(0).getDomain() + location.substring(index); + response.headers().set(HttpHeaderNames.LOCATION, location); + } } response.headers().set(HttpHeaderNames.SERVER, Constants.RPT); List encode = new ArrayList<>();