mirror of
https://github.com/multipleof4/ntfy.git
synced 2026-10-17 08:57:55 +00:00
No HTTP/2
This commit is contained in:
+13
-1
@@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/md5" //nolint:gosec // MD5 is required by the S3 protocol for Content-MD5 headers
|
"crypto/md5" //nolint:gosec // MD5 is required by the S3 protocol for Content-MD5 headers
|
||||||
|
"crypto/tls"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"errors"
|
"errors"
|
||||||
@@ -61,7 +62,18 @@ type Client struct {
|
|||||||
func New(config *Config) *Client {
|
func New(config *Config) *Client {
|
||||||
httpClient := config.HTTPClient
|
httpClient := config.HTTPClient
|
||||||
if httpClient == nil {
|
if httpClient == nil {
|
||||||
httpClient = http.DefaultClient
|
// Force HTTP/1.1 to avoid HTTP/2 stream errors with S3-compatible providers
|
||||||
|
// (e.g. DigitalOcean Spaces). HTTP/2 can cause non-retryable failures on
|
||||||
|
// streaming uploads when the server resets the stream mid-transfer.
|
||||||
|
httpClient = &http.Client{
|
||||||
|
Transport: &http.Transport{
|
||||||
|
TLSClientConfig: &tls.Config{
|
||||||
|
MinVersion: tls.VersionTLS12,
|
||||||
|
},
|
||||||
|
ForceAttemptHTTP2: false,
|
||||||
|
TLSNextProto: make(map[string]func(string, *tls.Conn) http.RoundTripper),
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &Client{
|
return &Client{
|
||||||
config: config,
|
config: config,
|
||||||
|
|||||||
Reference in New Issue
Block a user