From 28b33d04fc1c4a2140d43319710804983b2171be Mon Sep 17 00:00:00 2001 From: Vigilans Date: Thu, 9 Sep 2021 19:06:43 +0800 Subject: [PATCH] Make HTTP dialer accept socket config --- transport/internet/http/dialer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transport/internet/http/dialer.go b/transport/internet/http/dialer.go index faf811b29ec..364db37e404 100644 --- a/transport/internet/http/dialer.go +++ b/transport/internet/http/dialer.go @@ -28,7 +28,7 @@ var ( type dialerCanceller func() -func getHTTPClient(ctx context.Context, dest net.Destination, tlsSettings *tls.Config) (*http.Client, dialerCanceller) { +func getHTTPClient(ctx context.Context, dest net.Destination, tlsSettings *tls.Config, streamSettings *internet.MemoryStreamConfig) (*http.Client, dialerCanceller) { globalDialerAccess.Lock() defer globalDialerAccess.Unlock() @@ -62,7 +62,7 @@ func getHTTPClient(ctx context.Context, dest net.Destination, tlsSettings *tls.C address := net.ParseAddress(rawHost) detachedContext := core.ToBackgroundDetachedContext(ctx) - pconn, err := internet.DialSystem(detachedContext, net.TCPDestination(address, port), nil) + pconn, err := internet.DialSystem(detachedContext, net.TCPDestination(address, port), streamSettings.SocketSettings) if err != nil { return nil, err } @@ -100,7 +100,7 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me if tlsConfig == nil { return nil, newError("TLS must be enabled for http transport.").AtWarning() } - client, canceller := getHTTPClient(ctx, dest, tlsConfig) + client, canceller := getHTTPClient(ctx, dest, tlsConfig, streamSettings) opts := pipe.OptionsFromContext(ctx) preader, pwriter := pipe.New(opts...)