Skip to content

Commit

Permalink
Use slow transport for validation data fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 21, 2023
1 parent a9b4548 commit 2c45fc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion imessage/direct/nacserv/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (c *Client) fetch(ctx context.Context, url string, body []byte, dataType st

log.Info().Str("url", req.URL.String()).Str("data_type", dataType).Msg("Fetching nacserv data")

resp, data, err := httputil.Do(httputil.Normal, req)
resp, data, err := httputil.Do(httputil.Slow, req)
if err != nil {
return nil, fmt.Errorf("failed to send request: %w", err)
} else if resp.StatusCode != http.StatusOK {
Expand Down
7 changes: 6 additions & 1 deletion imessage/direct/util/httputil/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ var normalTransport = &http.Transport{
TLSHandshakeTimeout: 10 * time.Second,
ResponseHeaderTimeout: 5 * time.Second,
}
var slowTransport = &http.Transport{}
var slowTransport = &http.Transport{
DialContext: (&net.Dialer{Timeout: 20 * time.Second}).DialContext,
ForceAttemptHTTP2: true,
TLSHandshakeTimeout: 20 * time.Second,
ResponseHeaderTimeout: 60 * time.Second,
}
var appleTLSTransport = &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: appletls.CertPool,
Expand Down

0 comments on commit 2c45fc5

Please sign in to comment.