imroc / req

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

使用代理+TLS指纹模拟,请求包异常 #272

Open EdwardsBean opened 1 year ago

EdwardsBean commented 1 year ago

req使用带密码验证的http/socks5代理, 并开启EnableForceHTTP1 + ImpersonateChrome 服务器会返回:@@d?"missing connection preface connection preface应该是HTTP2才有的。

req使用带密码验证的http/socks5代理 + 去掉ImpersonateChrome就正常。 req使用带密码验证的http/socks5代理 + 去掉EnableForceHTTP1, 则报错connection error: COMPRESSION_ERROR

EdwardsBean commented 1 year ago

EnableForceHTTP1 是不能和ImpersonateChrome一起用, utls会按照预设模版去握手,即chrome支持http2,服务器就认为需要使用http2。 但是req继续使用http1去和服务器交互,就导致服务器返回missing connection preface

imroc commented 1 year ago

是的,除非网站本身只支持http1,tls握手协商的协议为http/1.1

imroc commented 1 year ago

使用了 ImpersonateXXX 就不能强制指定协议,这个是互斥的,我在注释里加下说明