imroc / req

Simple Go HTTP client with Black Magic
https://req.cool
MIT License
4.25k stars 347 forks source link

3.41.0 bug #263

Closed Nyx2022 closed 1 year ago

Nyx2022 commented 1 year ago

具体调用链如图 image 感谢修复

imroc commented 1 year ago

从堆栈上看是依赖库utls在tls握手时内部发生空指针,怀疑是utls最新版的bug:https://github.com/refraction-networking/utls/issues/218 刚已经有人提PR修复,还没合进去

你可以先手动改 go.mod,降低utls版本然后 go mod tidy 一下。或者等待utls修复完我这边release个版本

gaukas commented 1 year ago

Hi @imroc, thanks for linking. Turns out it is not really a bug and the PR I proposed (in #219) is much like a dirty fix than a supposed way to use it. crypto/tls has started enforcing saving any received session_ticket to the ClientSessionCache specified in the config.

Kindly implement a ClientSessionCache and set it in the Config will fix the issue and is seemingly the most appropriate solution. By default crypto/tls does not trigger this issue simply due to its Client does not advertise support for session_ticket and therefore does not receive one from the server.


事实证明,这并不是一个真正的错误,而我提出的 PR (在#219) 更像是一个肮脏的修复,而不是所谓的使用方法。crypto/tls 已开始强制将收到的 session_ticket 保存到配置中指定的 ClientSessionCache 中。

请实现一个 ClientSessionCache,并在配置中设置它,这样就能解决问题,而且似乎也是最合适的解决方案。默认情况下,crypto/tls 不会触发此问题,原因很简单,因为它的 Client 没有公布对 session_ticket 的支持,因此不会从服务器接收 session_ticket

gaukas commented 1 year ago

Of course I would be happy to push forward the PR since it makes everyone's life easier. But I'd still like to point out that by applying my dirty fix we are not respecting how crypto/tls is supporting the session_ticket extension starting from Go 1.21.


当然,我很乐意推进该 PR,因为它能让每个人的生活更轻松。但我还是想指出,应用我的肮脏修正并不尊重从Go 1.21开始crypto/tls如何支持session_ticket扩展。

gaukas commented 1 year ago

I pushed v1.4.2 for uTLS to address the issue, see if it helps?

imroc commented 1 year ago

I pushed v1.4.2 for uTLS to address the issue, see if it helps?

Thanks, I've tested and no panic any more.

imroc commented 1 year ago

@Nyx2022 v3.41.1 release了,可以测试下

Nyx2022 commented 1 year ago

确实解决了,感谢感谢

@Nyx2022 v3.41.1 release了,可以测试下