XHTTP client: Add decideHTTPVersion() and more logs

https://github.com/XTLS/Xray-core/pull/4150#issuecomment-2537981368
This commit is contained in:
RPRX 2024-12-12 12:19:18 +00:00 committed by GitHub
parent 743435d6e6
commit 7463561856
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 69 additions and 55 deletions

View file

@ -39,8 +39,7 @@ type DialerClient interface {
type DefaultDialerClient struct {
transportConfig *Config
client *http.Client
isH2 bool
isH3 bool
httpVersion string
// pool of net.Conn, created using dialUploadConn
uploadRawPool *sync.Pool
dialUploadConn func(ctxInner context.Context) (net.Conn, error)
@ -172,7 +171,7 @@ func (c *DefaultDialerClient) SendUploadRequest(ctx context.Context, url string,
req.ContentLength = contentLength
req.Header = c.transportConfig.GetRequestHeader()
if c.isH2 || c.isH3 {
if c.httpVersion != "1.1" {
resp, err := c.client.Do(req)
if err != nil {
return err