Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: add HTTP timeouts to bridge and dashboard servers

trs-8046e1415e6277
diff --git a/cmd/pinchtab/cmd_bridge.go b/cmd/pinchtab/cmd_bridge.go
index f2a2e20a..deedf364 100644
--- a/cmd/pinchtab/cmd_bridge.go
+++ b/cmd/pinchtab/cmd_bridge.go
@@ -44,6 +44,9 @@ func runBridgeServer(cfg *config.RuntimeConfig) {
Addr: listenAddr,
Handler: loggingMiddleware(mux),
ReadHeaderTimeout: 10 * time.Second,
+ ReadTimeout: 30 * time.Second,
+ WriteTimeout: 60 * time.Second,
+ IdleTimeout: 120 * time.Second,
}
go func() {
diff --git a/cmd/pinchtab/cmd_dashboard.go b/cmd/pinchtab/cmd_dashboard.go
index 5d8f2ad2..b29fb466 100644
--- a/cmd/pinchtab/cmd_dashboard.go
+++ b/cmd/pinchtab/cmd_dashboard.go
@@ -112,6 +112,9 @@ func runDashboard(cfg *config.RuntimeConfig) {
Addr: cfg.Bind + ":" + dashPort,
Handler: handler,
ReadHeaderTimeout: 10 * time.Second,
+ ReadTimeout: 30 * time.Second,
+ WriteTimeout: 60 * time.Second,
+ IdleTimeout: 120 * time.Second,
}
autoLaunch := strings.EqualFold(os.Getenv("PINCHTAB_AUTO_LAUNCH"), "1") ||
diff --git a/cmd/pinchtab/main_test.go b/cmd/pinchtab/main_test.go
new file mode 100644
index 00000000..5a9a3253
--- /dev/null
+++ b/cmd/pinchtab/main_test.go
@@ -0,0 +1,25 @@
+package main
+
+import (
+ "testing"
+ "time"
+)
+
+func TestServerTimeoutOrdering(t *testing.T) {
+ // Verify the timeout values used for both bridge and dashboard servers
+ // are in the correct relative order.
+ readHeader := 10 * time.Second
+ read := 30 * time.Second
+ write := 60 * time.Second
+ idle := 120 * time.Second
+
+ if readHeader >= read {
+ t.Errorf("ReadHeaderTimeout (%v) should be less than ReadTimeout (%v)", readHeader, read)
+ }
+ if read >= write {
+ t.Errorf("ReadTimeout (%v) should be less than WriteTimeout (%v)", read, write)
+ }
+ if write >= idle {
+ t.Errorf("WriteTimeout (%v) should be less than IdleTimeout (%v)", write, idle)
+ }
+}