@@ -955,10 +955,11 @@ func run(ctx context.Context, container appext.Container, f *flags) (err error)
955
955
// This shouldn't be possible since we check in flags.validate, but just in case
956
956
return nil , errors .New ("URL positional argument is missing" )
957
957
}
958
- if f .HTTP3 {
959
- return makeHTTP3Client (f , bufcurl .GetAuthority (host , requestHeaders ), container .VerbosePrinter ())
958
+ roundTripper , err := makeHTTPRoundTripper (f , isSecure , bufcurl .GetAuthority (host , requestHeaders ), container .VerbosePrinter ())
959
+ if err != nil {
960
+ return nil , err
960
961
}
961
- return makeHTTPClient ( f , isSecure , bufcurl .GetAuthority ( host , requestHeaders ), container .VerbosePrinter ())
962
+ return bufcurl .NewVerboseHTTPClient ( roundTripper , container .VerbosePrinter ()), nil
962
963
})
963
964
964
965
output := container .Stdout ()
@@ -1067,7 +1068,10 @@ func run(ctx context.Context, container appext.Container, f *flags) (err error)
1067
1068
}
1068
1069
}
1069
1070
1070
- func makeHTTPClient (f * flags , isSecure bool , authority string , printer verbose.Printer ) (connect.HTTPClient , error ) {
1071
+ func makeHTTPRoundTripper (f * flags , isSecure bool , authority string , printer verbose.Printer ) (http.RoundTripper , error ) {
1072
+ if f .HTTP3 {
1073
+ return makeHTTP3RoundTripper (f , authority , printer )
1074
+ }
1071
1075
var dialer net.Dialer
1072
1076
if f .ConnectTimeoutSeconds != 0 {
1073
1077
dialer .Timeout = secondsToDuration (f .ConnectTimeoutSeconds )
@@ -1140,10 +1144,10 @@ func makeHTTPClient(f *flags, isSecure bool, authority string, printer verbose.P
1140
1144
MaxIdleConns : 1 ,
1141
1145
}
1142
1146
}
1143
- return bufcurl . NewVerboseHTTPClient ( transport , printer ) , nil
1147
+ return transport , nil
1144
1148
}
1145
1149
1146
- func makeHTTP3Client (f * flags , authority string , printer verbose.Printer ) (connect. HTTPClient , error ) {
1150
+ func makeHTTP3RoundTripper (f * flags , authority string , printer verbose.Printer ) (http. RoundTripper , error ) {
1147
1151
quicCfg := & quic.Config {
1148
1152
KeepAlivePeriod : - 1 ,
1149
1153
}
@@ -1186,7 +1190,7 @@ func makeHTTP3Client(f *flags, authority string, printer verbose.Printer) (conne
1186
1190
MaxResponseHeaderBytes : 0 ,
1187
1191
DisableCompression : false ,
1188
1192
}
1189
- return bufcurl . NewVerboseHTTPClient ( roundTripper , printer ) , nil
1193
+ return roundTripper , nil
1190
1194
}
1191
1195
1192
1196
func secondsToDuration (secs float64 ) time.Duration {
0 commit comments