|
|
@ -120,17 +120,24 @@ public class TunnelClientSocketClientHandler extends SimpleChannelInboundHandler
|
|
|
|
String targetUrl = targetUrls.get(0);
|
|
|
|
String targetUrl = targetUrls.get(0);
|
|
|
|
SimpleHttpResponse simpleHttpResponse = proxyClient.query(targetUrl);
|
|
|
|
SimpleHttpResponse simpleHttpResponse = proxyClient.query(targetUrl);
|
|
|
|
|
|
|
|
|
|
|
|
ByteBuf byteBuf = Base64
|
|
|
|
ByteBuf byteBuf = null;
|
|
|
|
.encode(Unpooled.wrappedBuffer(SimpleHttpResponse.toBytes(simpleHttpResponse)));
|
|
|
|
try{
|
|
|
|
String requestData = byteBuf.toString(CharsetUtil.UTF_8);
|
|
|
|
byteBuf = Base64
|
|
|
|
|
|
|
|
.encode(Unpooled.wrappedBuffer(SimpleHttpResponse.toBytes(simpleHttpResponse)));
|
|
|
|
QueryStringEncoder queryEncoder = new QueryStringEncoder("");
|
|
|
|
String requestData = byteBuf.toString(CharsetUtil.UTF_8);
|
|
|
|
queryEncoder.addParam(URIConstans.METHOD, MethodConstants.HTTP_PROXY);
|
|
|
|
|
|
|
|
queryEncoder.addParam(URIConstans.PROXY_REQUEST_ID, id);
|
|
|
|
QueryStringEncoder queryEncoder = new QueryStringEncoder("");
|
|
|
|
queryEncoder.addParam(URIConstans.PROXY_RESPONSE_DATA, requestData);
|
|
|
|
queryEncoder.addParam(URIConstans.METHOD, MethodConstants.HTTP_PROXY);
|
|
|
|
|
|
|
|
queryEncoder.addParam(URIConstans.PROXY_REQUEST_ID, id);
|
|
|
|
String url = queryEncoder.toString();
|
|
|
|
queryEncoder.addParam(URIConstans.PROXY_RESPONSE_DATA, requestData);
|
|
|
|
ctx.writeAndFlush(new TextWebSocketFrame(url));
|
|
|
|
|
|
|
|
|
|
|
|
String url = queryEncoder.toString();
|
|
|
|
|
|
|
|
ctx.writeAndFlush(new TextWebSocketFrame(url));
|
|
|
|
|
|
|
|
}finally {
|
|
|
|
|
|
|
|
if (byteBuf != null) {
|
|
|
|
|
|
|
|
byteBuf.release();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|