@@ -149,9 +149,6 @@ func getTopPosts(ctx context.Context, timeout time.Duration, logger *logos.Logge
149
149
150
150
ua := runtime .GOOS + ":" + "grabbit" + ":" + version + " (go.bbkane.com/grabbit)"
151
151
152
- // The reddit API does not like HTTP/2
153
- // Per https://pkg.go.dev/net/http?utm_source=gopls#pkg-overview ,
154
- // I'm copying http.DefaultTransport and replacing the HTTP/2 stuff
155
152
transport := & http.Transport {
156
153
Dial : nil ,
157
154
DialTLSContext : nil ,
@@ -169,29 +166,13 @@ func getTopPosts(ctx context.Context, timeout time.Duration, logger *logos.Logge
169
166
ReadBufferSize : 0 ,
170
167
Proxy : http .ProxyFromEnvironment ,
171
168
OnProxyConnectResponse : nil ,
172
- DialContext : (& net.Dialer {
173
- Timeout : 30 * time .Second ,
174
- KeepAlive : 30 * time .Second ,
175
- Deadline : time.Time {},
176
- LocalAddr : nil ,
177
- DualStack : false ,
178
- FallbackDelay : 0 ,
179
- Resolver : nil ,
180
- Cancel : nil ,
181
- Control : nil ,
182
- ControlContext : nil ,
183
- }).DialContext ,
184
-
185
- // change from default
186
- ForceAttemptHTTP2 : false ,
187
-
188
- MaxIdleConns : 100 ,
189
- IdleConnTimeout : 90 * time .Second ,
190
- TLSHandshakeTimeout : 10 * time .Second ,
191
-
192
- // use an empty map instead of nil per the link above
193
- TLSNextProto : make (map [string ]func (authority string , c * tls.Conn ) http.RoundTripper ),
194
-
169
+ DialContext : nil ,
170
+ // https://www.reddit.com/r/redditdev/comments/uncu00/comment/i8gyfmx/
171
+ ForceAttemptHTTP2 : true ,
172
+ MaxIdleConns : 100 ,
173
+ IdleConnTimeout : 90 * time .Second ,
174
+ TLSHandshakeTimeout : 10 * time .Second ,
175
+ TLSNextProto : nil ,
195
176
ExpectContinueTimeout : 1 * time .Second ,
196
177
}
197
178
0 commit comments