diff --git a/imessage/direct/nacserv/client.go b/imessage/direct/nacserv/client.go index 6ba7a6a..e8a7dcf 100644 --- a/imessage/direct/nacserv/client.go +++ b/imessage/direct/nacserv/client.go @@ -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 { diff --git a/imessage/direct/util/httputil/client.go b/imessage/direct/util/httputil/client.go index 5584268..05f952e 100644 --- a/imessage/direct/util/httputil/client.go +++ b/imessage/direct/util/httputil/client.go @@ -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,