monkeyWie / proxyee

HTTP proxy server,support HTTPS&websocket.MITM impl,intercept and tamper HTTPS traffic.
MIT License
1.52k stars 572 forks source link

URL中有中文字符时,日志与服务端接收到的都是乱码 #230

Closed wangjiquan-qm closed 2 years ago

wangjiquan-qm commented 2 years ago

URL中有中文字符时,日志与服务端接收到的都是乱码。 有没有可能是http报文信息转String的时候使用的字符集不对导致?

image

monkeyWie commented 2 years ago

url按理说在客户端请求的时候都会做url编码的啊,你那边是什么客户端

wangjiquan-qm commented 2 years ago

按理来说都应该对url中的参数做url编码,但是他是一套非常非常老的bs系统(估计没有按常规流程开发),而且已经无人运维无法修改系统代码。 另外这套bs系统还使用了frameset结构,在经过代理之后大概率偶发出现iframe里的页面无法正常显示(从日志看response内容已经返回)。 方便加您一下联系方式,当面请教一下吗?

monkeyWie commented 2 years ago

这种情况只能按你现在的方式特殊处理了啊,可以加下wx: liwei-8466

wangjiquan-qm commented 2 years ago

1、url中有未经urldecode编码的中文情况,通过创建自定义FullRequestIntercept在handleRequest中对URI解码即可解决。 ` public class SelfRequestIntercept extends FullRequestIntercept {

@Override
public boolean match(HttpRequest httpRequest, HttpProxyInterceptPipeline pipeline) {
    return true;
}

@Override
public void handleRequest(FullHttpRequest httpRequest, HttpProxyInterceptPipeline pipeline) {
    httpRequest.setUri(new String(httpRequest.uri().getBytes(StandardCharsets.ISO_8859_1), Charset.defaultCharset()));
}

} `

2、偶发白屏一直处于pedding状态问题,通过升级到1.6.8版本解决