[tor-commits] [meek/master] Put a time limit (10 seconds) on reading requests and writing responses.
dcf at torproject.org
dcf at torproject.org
Tue Apr 15 23:28:07 UTC 2014
commit 905333debb47858dcff83e97543920f3e2ff9655
Author: David Fifield <david at bamsoftware.com>
Date: Tue Apr 15 16:23:05 2014 -0700
Put a time limit (10 seconds) on reading requests and writing responses.
Fixed #11504.
---
meek-server/meek-server.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meek-server/meek-server.go b/meek-server/meek-server.go
index 51f094e..a9b1120 100644
--- a/meek-server/meek-server.go
+++ b/meek-server/meek-server.go
@@ -23,6 +23,8 @@ const ptMethodName = "meek"
const minSessionIdLength = 32
const maxPayloadLength = 0x10000
const turnaroundDeadline = 10 * time.Millisecond
+// Passed as ReadTimeout and WriteTimeout when constructing the http.Server.
+const readWriteTimeout = 10 * time.Second
const maxSessionStaleness = 120 * time.Second
var ptInfo pt.ServerInfo
@@ -231,6 +233,8 @@ func startServer(ln net.Listener) (net.Listener, error) {
go state.ExpireSessions()
server := &http.Server{
Handler: state,
+ ReadTimeout: readWriteTimeout,
+ WriteTimeout: readWriteTimeout,
}
go func() {
defer ln.Close()
More information about the tor-commits
mailing list