Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

完全用不了了 #12

Open
362227 opened this issue Jun 8, 2022 · 17 comments
Open

完全用不了了 #12

362227 opened this issue Jun 8, 2022 · 17 comments

Comments

@362227
Copy link

362227 commented Jun 8, 2022

刚开始还好,现在根本没法使用,各种各样的错误,跟证书有关系

@koalabearguo
Copy link
Owner

报的什么错误?截个图看看

@koalabearguo
Copy link
Owner

koalabearguo commented Jun 8, 2022

我刚试了我的,我的环境是win10+chrome使用正常

那个证书我中间更新过一次,之前是V1版本的,后面更新到了V3,你可以尝试把旧的证书删掉,把库上最新的证书再导入一遍应该就好了

@362227
Copy link
Author

362227 commented Jun 9, 2022

可以了。

问下能不能支持跳转的php地址(php Fetch server)。比如我填的是https:/www.aaa.com/1.php,这个地址会跳转到https:/www.bbb.com/1.php,我实际就是要https:/www.bbb.com/****.php(每天会变化)

@362227
Copy link
Author

362227 commented Jun 9, 2022

我设置了前置代理
"sni": "a.bc.com",
"listen": "127.0.0.1:8081",
"debug": false,
"insecure": false,
"autoproxy": true,
"user-agent": ""
"proxy": "http://127.0.0.1:1086"
}

报错
2022/06/09 10:20:12 proxy.go:297: Post "https://a.bc.com/php-proxy/index.php": dial tcp: lookup a.bc.com: no such host

@koalabearguo
Copy link
Owner

我设置了前置代理 "sni": "a.bc.com", "listen": "127.0.0.1:8081", "debug": false, "insecure": false, "autoproxy": true, "user-agent": "" "proxy": "http://127.0.0.1:1086" }

报错 2022/06/09 10:20:12 proxy.go:297: Post "https://a.bc.com/php-proxy/index.php": dial tcp: lookup a.bc.com: no such host

你要控制一下这个跳转码,golang http库默认会跳转的,我查了资料,你需要控制你的状态码是307/308,这样POST方法才会跳转。

301 (Moved Permanently)
302 (Found)
303 (See Other)
307 (Temporary Redirect)
308 (Permanent Redirect)
If permitted, a 301, 302, or 303 redirect causes subsequent requests to use HTTP method GET (or HEAD if the original request was HEAD), with no body. A 307 or 308 redirect preserves the original HTTP method and body, provided that the Request.GetBody function is defined

@koalabearguo
Copy link
Owner

我设置了前置代理 "sni": "a.bc.com", "listen": "127.0.0.1:8081", "debug": false, "insecure": false, "autoproxy": true, "user-agent": "" "proxy": "http://127.0.0.1:1086" }

报错 2022/06/09 10:20:12 proxy.go:297: Post "https://a.bc.com/php-proxy/index.php": dial tcp: lookup a.bc.com: no such host

你这个看起来代理没有设置成功,如果我没有看错,你这个后面少个逗号

"user-agent": ""

我自己测试并不会出现你的这个问题,后面我改下,如果启用了前置代理,启动的时候打印出来,要不然也不知道是否启用了前置代理

@362227
Copy link
Author

362227 commented Jun 9, 2022

你要控制一下这个跳转码,golang http库默认会跳转的,我查了资料,你需要控制你的状态码是307/308,这样POST方法才会跳转。

301 (Moved Permanently)
302 (Found)
303 (See Other)
307 (Temporary Redirect)
308 (Permanent Redirect)
If permitted, a 301, 302, or 303 redirect causes subsequent requests to use HTTP method GET (or HEAD if the original request was HEAD), with no body. A 307 or 308 redirect preserves the original HTTP method and body, provided that the Request.GetBody function is defined

默认的反正没有作用,这要怎么修改

@koalabearguo
Copy link
Owner

你方便的话,把你的fetchserver php地址和密码发给我,我debug看下。[email protected],这是我邮箱

@362227
Copy link
Author

362227 commented Jun 10, 2022

你方便的话,把你的fetchserver php地址和密码发给我,我debug看下。[email protected],这是我邮箱

发了

@362227
Copy link
Author

362227 commented Jun 10, 2022

应该要先对fetchserver php地址处理,如果php地址不会跳转,那就直接读取源地址;如果会跳转,那就抓一下跳转后的地址,再读取这个新地址。

@koalabearguo
Copy link
Owner

是这样的,因为工具本身,访问fetchserver是用的POST方法,这种情况如果是302状态的话,实际会跳转到目的地址用GET方法去请求(body会被自动丢弃),因次得不到想要的数据。按照协议的要求如果是POST方法就要用307/308跳转,这样才能保持正确的数据转发。当然可以做一些这样不兼容协议的转换操作,不过这是另外一回事了。我们通常访问网页当然大部分都是GET,因此301,302都能跳转。其实这个工具已经自己跳转了,只不过POST变成GET了,BODY被丢弃了。也许有的网页跳转控制GET是302,但是POST就307,这是正常的。如果强行改掉也许会出现兼容问题,如果你确实需要我可以专门给你编辑修改个版本,我就不上库了。

@koalabearguo
Copy link
Owner

https://go.koalabear.tk/windows_amd64.tar.gz

这是专门给你适配了代码,我试了下可以用,你可以试试

@362227
Copy link
Author

362227 commented Jun 10, 2022

好了,可以了。

不过那个证书问题依旧没有完全解决。之前我删了旧证书,重新导入了新证书,可以用了,但大多数网站还是报错, remote error: tls: unknown certificate

@koalabearguo
Copy link
Owner

不知道你导入的位置是“受信任的根证书颁发机构”这里吗,理论来讲浏览器应该会信任的,如果确实浏览器提示不可信任,那可能是导入的位置不对(或者其他原因浏览器么有加载这个证书)

具体你的log我不知道是什么样子的,浏览器正常不,如果浏览器正常,是不是你fetch server的ssl证书不受信任

remote error: tls: unknown certificate:这个log具体我不知道是指的浏览器这边,还是fetch server这边。

@362227
Copy link
Author

362227 commented Jun 10, 2022

重新导入了下证书,客户端“remote error: tls: unknown certificate”提示没有了。
但问题还是一样,比如我浏览vimeo和heroku,heroku正常,vimeo不正常且浏览器显示的是empty response
image

用下载工具也是这样,heroku正常
image

vimeo不正常
image

@koalabearguo
Copy link
Owner

你使能了智能代理,heroku走的是本机,不是走的远程的fetchserver。你看proxy.go 297这里后面返回的确实是EOF就是空的,看起来,你的电脑到fetchserver连接有问题,你那里指向的IP是不是被封锁了(还是干扰了),我用你的fetchserver访问vimeo首页是正常的。如果网络访问没问题,大概就是你的fetchserver感觉有什么限制

@362227
Copy link
Author

362227 commented Jun 10, 2022

不知道啊。我用旧版php-proxy和goproxy都正常,同样的php地址(跳转后的)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants