monkeyWie / proxyee

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

http下载无响应 #250

Closed xujimu closed 1 year ago

xujimu commented 1 year ago
        HttpProxyServerConfig config =  new HttpProxyServerConfig();
//        config.setAuthenticationProvider(new BasicHttpProxyAuthenticationProvider() {
//            @Override
//            protected BasicHttpToken authenticate(String usr, String pwd) {
//                if ("admin".equals(usr) && "123456".equals(pwd)) {
//                    return new BasicHttpToken(usr, pwd);
//                }
//                return null;
//            }
//        });

        config.setHandleSsl(true);
        new HttpProxyServer()
                .serverConfig(config)
                .proxyInterceptInitializer(new HttpProxyInterceptInitializer() {
                    @Override
                    public void init(HttpProxyInterceptPipeline pipeline) {
                        pipeline.addLast(new FullResponseIntercept() {

                            @Override
                            public boolean match(HttpRequest httpRequest, HttpResponse httpResponse, HttpProxyInterceptPipeline pipeline) {
                                //Insert js when matching to Baidu homepage
                                return true;
                            }

                            @Override
                            public void handleResponse(HttpRequest httpRequest, FullHttpResponse httpResponse, HttpProxyInterceptPipeline pipeline) {
                                //Print raw packet
                            }
                        });
                    }
                })
                .start(9999);

如上代码 我电脑浏览器设置9999代理后 我下载一个文件 他并不会像普通下载文件一样 直接加入下载队列 比如我下载一个80m的内容 点击下载后就会卡个十几秒然后立马下载完成 没有下载进度 我猜测代理内部应该是一次性把文件读完了 再返回给客户端 请问这种问题如何解决呢? 正常的应该是一边读取一边返回呀 大佬

monkeyWie commented 1 year ago

不用FullResponseIntercept就行了

xujimu commented 1 year ago

不用FullResponseIntercept就进行了

好的 谢谢大佬 我想请问一个问题 比如我用下面代码启动了一个代理服务器

HttpProxyServerConfig config = new HttpProxyServerConfig(); config.setHandleSsl(true); new HttpProxyServer() .serverConfig(config) .start(9999);

里面的ssl证书是自签名的 我得另外一台电脑挂上了这个9999的代理 但是没信任证书 他访问会提示你的链接不是专用链接 在我得印象里 别人的代理服务器只需要连上就行了 不需要信任证书他这个是怎么做到的呢?

xujimu commented 1 year ago

不用FullResponseIntercept就进行了

好的 谢谢大佬 我想请问一个问题 比如我用下面代码启动了一个代理服务器

HttpProxyServerConfig config = new HttpProxyServerConfig(); config.setHandleSsl(true); new HttpProxyServer() .serverConfig(config) .start(9999);

里面的ssl证书是自签名的 我得另外一台电脑挂上了这个9999的代理 但是没信任证书 他访问会提示你的链接不是专用链接 在我得印象里 别人的代理服务器只需要连上就行了 不需要信任证书他这个是怎么做到的呢?

我明白了 config.setHandleSsl(true) 去掉就行了 如果这个启用就会用自签的证书拦截请求当中间人 把证书进行掉包 但因为https的ca证书不可伪造的问题 导致所有连上这个代理服务器的客户端都需要信任这个自签证书

monkeyWie commented 1 year ago

是的,你理解的没毛病