From e4d6d76eea99fbf0add95d5a68244cfed9b9bd20 Mon Sep 17 00:00:00 2001 From: Cameron Palone Date: Thu, 9 Mar 2017 19:50:10 -0800 Subject: [PATCH] Disable HTTP/2 as workaround for nginx bug --- simplepush.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simplepush.go b/simplepush.go index 2f7bfb9..605649f 100644 --- a/simplepush.go +++ b/simplepush.go @@ -7,6 +7,7 @@ import ( "crypto/cipher" "crypto/rand" "crypto/sha1" + "crypto/tls" "encoding/base64" "encoding/hex" "errors" @@ -16,6 +17,12 @@ import ( "net/url" ) +func init() { + // Disable HTTP/2 support- see the package overview in net/http docs + tr, _ := http.DefaultTransport.(*http.Transport) + tr.TLSNextProto = make(map[string]func(authority string, c *tls.Conn) http.RoundTripper) +} + // Message contains all the information necessary to send a, potentially encrypted, message. type Message struct { SimplePushKey string // Your simeplepush.io key