[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Add response header timeouts to broker transports



commit d5ae7562ac65f07d1c2e4137534217644f391612
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date:   Thu Jul 30 16:34:34 2020 -0400

    Add response header timeouts to broker transports
    
    The client and proxy use the net/http default transport to make round
    trip connecitons to the broker. These by default don't time out and can
    wait indefinitely for the broker to respond if the broker hangs and
    doesn't terminate the connection.
---
 client/lib/rendezvous.go | 2 ++
 proxy/snowflake.go       | 1 +
 2 files changed, 3 insertions(+)

diff --git a/client/lib/rendezvous.go b/client/lib/rendezvous.go
index 2702d4e..37ade35 100644
--- a/client/lib/rendezvous.go
+++ b/client/lib/rendezvous.go
@@ -17,6 +17,7 @@ import (
 	"net/http"
 	"net/url"
 	"sync"
+	"time"
 
 	"git.torproject.org/pluggable-transports/snowflake.git/common/nat"
 	"git.torproject.org/pluggable-transports/snowflake.git/common/util"
@@ -48,6 +49,7 @@ type BrokerChannel struct {
 func CreateBrokerTransport() http.RoundTripper {
 	transport := http.DefaultTransport.(*http.Transport)
 	transport.Proxy = nil
+	transport.ResponseHeaderTimeout = 15 * time.Second
 	return transport
 }
 
diff --git a/proxy/snowflake.go b/proxy/snowflake.go
index 464fbb0..b880b36 100644
--- a/proxy/snowflake.go
+++ b/proxy/snowflake.go
@@ -481,6 +481,7 @@ func main() {
 	}
 
 	broker.transport = http.DefaultTransport.(*http.Transport)
+	broker.transport.(*http.Transport).ResponseHeaderTimeout = 15 * time.Second
 	config = webrtc.Configuration{
 		ICEServers: []webrtc.ICEServer{
 			{

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits