From 9195ba577839fdf1663b6cc5bff067425eb7119c Mon Sep 17 00:00:00 2001 From: Jason Ginchereau Date: Thu, 21 Aug 2025 11:37:58 -1000 Subject: [PATCH 1/3] Add request timeout to tunnel options --- cs/src/Contracts/TunnelOptions.cs | 9 +++++++++ go/tunnels/tunnel_options.go | 6 ++++++ go/tunnels/tunnels.go | 2 +- .../com/microsoft/tunnels/contracts/TunnelOptions.java | 9 +++++++++ rs/src/contracts/tunnel_options.rs | 6 ++++++ ts/src/connections/package.json | 4 ++-- ts/src/contracts/tunnelOptions.ts | 8 ++++++++ ts/src/management/package.json | 2 +- 8 files changed, 42 insertions(+), 4 deletions(-) diff --git a/cs/src/Contracts/TunnelOptions.cs b/cs/src/Contracts/TunnelOptions.cs index c21931a7..4dde1eb7 100644 --- a/cs/src/Contracts/TunnelOptions.cs +++ b/cs/src/Contracts/TunnelOptions.cs @@ -94,5 +94,14 @@ public class TunnelOptions /// [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public bool? IsPartitionedSiteAuthenticationEnabled { get; set; } + + /// + /// Gets or sets the timeout for HTTP requests to the tunnel or port. + /// + /// + /// The default timeout is 100 seconds. If the host does not return a response before the timeout, + /// the tunnel relay aborts the request and returns 504 Gateway Timeout. + /// + public int? RequestTimeoutSeconds { get; set; } } } diff --git a/go/tunnels/tunnel_options.go b/go/tunnels/tunnel_options.go index 5dbf80b0..60bc3d35 100644 --- a/go/tunnels/tunnel_options.go +++ b/go/tunnels/tunnel_options.go @@ -58,4 +58,10 @@ type TunnelOptions struct { // A partitioned cookie always also has SameSite=None for compatbility with browsers that // do not support partitioning. IsPartitionedSiteAuthenticationEnabled bool `json:"isPartitionedSiteAuthenticationEnabled,omitempty"` + + // Gets or sets the timeout for HTTP requests to the tunnel or port. + // + // The default timeout is 100 seconds. If the host does not return a response before the + // timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + RequestTimeoutSeconds int32 `json:"requestTimeoutSeconds"` } diff --git a/go/tunnels/tunnels.go b/go/tunnels/tunnels.go index 6c1d2a2d..953e288e 100644 --- a/go/tunnels/tunnels.go +++ b/go/tunnels/tunnels.go @@ -10,7 +10,7 @@ import ( "github.com/rodaine/table" ) -const PackageVersion = "0.1.17" +const PackageVersion = "0.1.18" func (tunnel *Tunnel) requestObject() (*Tunnel, error) { convertedTunnel := &Tunnel{ diff --git a/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java b/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java index 9062111a..052e1f58 100644 --- a/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java +++ b/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java @@ -87,4 +87,13 @@ public class TunnelOptions { */ @Expose public boolean isPartitionedSiteAuthenticationEnabled; + + /** + * Gets or sets the timeout for HTTP requests to the tunnel or port. + * + * The default timeout is 100 seconds. If the host does not return a response before + * the timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + */ + @Expose + public int requestTimeoutSeconds; } diff --git a/rs/src/contracts/tunnel_options.rs b/rs/src/contracts/tunnel_options.rs index 9b2d36ca..8e2417df 100644 --- a/rs/src/contracts/tunnel_options.rs +++ b/rs/src/contracts/tunnel_options.rs @@ -69,4 +69,10 @@ pub struct TunnelOptions { // that do not support partitioning. #[serde(default)] pub is_partitioned_site_authentication_enabled: Option, + + // Gets or sets the timeout for HTTP requests to the tunnel or port. + // + // The default timeout is 100 seconds. If the host does not return a response before + // the timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + pub request_timeout_seconds: Option, } diff --git a/ts/src/connections/package.json b/ts/src/connections/package.json index 6fe45eb5..89b40383 100644 --- a/ts/src/connections/package.json +++ b/ts/src/connections/package.json @@ -18,8 +18,8 @@ "buffer": "^5.2.1", "debug": "^4.1.1", "vscode-jsonrpc": "^4.0.0", - "@microsoft/dev-tunnels-contracts": "^1.3.0", - "@microsoft/dev-tunnels-management": "^1.3.0", + "@microsoft/dev-tunnels-contracts": "^1.3.6", + "@microsoft/dev-tunnels-management": "^1.3.6", "@microsoft/dev-tunnels-ssh": "^3.12.12", "@microsoft/dev-tunnels-ssh-tcp": "^3.12.12", "uuid": "^3.3.3", diff --git a/ts/src/contracts/tunnelOptions.ts b/ts/src/contracts/tunnelOptions.ts index 14aea734..f330b23c 100644 --- a/ts/src/contracts/tunnelOptions.ts +++ b/ts/src/contracts/tunnelOptions.ts @@ -76,4 +76,12 @@ export interface TunnelOptions { * that do not support partitioning. */ isPartitionedSiteAuthenticationEnabled?: boolean; + + /** + * Gets or sets the timeout for HTTP requests to the tunnel or port. + * + * The default timeout is 100 seconds. If the host does not return a response before + * the timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + */ + requestTimeoutSeconds?: number; } diff --git a/ts/src/management/package.json b/ts/src/management/package.json index fad6a4cb..2bc2a21b 100644 --- a/ts/src/management/package.json +++ b/ts/src/management/package.json @@ -18,7 +18,7 @@ "buffer": "^5.2.1", "debug": "^4.1.1", "vscode-jsonrpc": "^4.0.0", - "@microsoft/dev-tunnels-contracts": "^1.3.0", + "@microsoft/dev-tunnels-contracts": "^1.3.6", "axios": "^1.8.4" } } From c4a55936f7d75393d55ad246296de6197e08d414 Mon Sep 17 00:00:00 2001 From: Jason Ginchereau Date: Thu, 21 Aug 2025 11:48:34 -1000 Subject: [PATCH 2/3] Add [JsonIgnore] --- cs/src/Contracts/TunnelOptions.cs | 1 + go/tunnels/tunnel_options.go | 2 +- rs/src/contracts/tunnel_options.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cs/src/Contracts/TunnelOptions.cs b/cs/src/Contracts/TunnelOptions.cs index 4dde1eb7..47738831 100644 --- a/cs/src/Contracts/TunnelOptions.cs +++ b/cs/src/Contracts/TunnelOptions.cs @@ -102,6 +102,7 @@ public class TunnelOptions /// The default timeout is 100 seconds. If the host does not return a response before the timeout, /// the tunnel relay aborts the request and returns 504 Gateway Timeout. /// + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public int? RequestTimeoutSeconds { get; set; } } } diff --git a/go/tunnels/tunnel_options.go b/go/tunnels/tunnel_options.go index 60bc3d35..a27b1e63 100644 --- a/go/tunnels/tunnel_options.go +++ b/go/tunnels/tunnel_options.go @@ -63,5 +63,5 @@ type TunnelOptions struct { // // The default timeout is 100 seconds. If the host does not return a response before the // timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. - RequestTimeoutSeconds int32 `json:"requestTimeoutSeconds"` + RequestTimeoutSeconds int32 `json:"requestTimeoutSeconds,omitempty"` } diff --git a/rs/src/contracts/tunnel_options.rs b/rs/src/contracts/tunnel_options.rs index 8e2417df..9008222e 100644 --- a/rs/src/contracts/tunnel_options.rs +++ b/rs/src/contracts/tunnel_options.rs @@ -74,5 +74,6 @@ pub struct TunnelOptions { // // The default timeout is 100 seconds. If the host does not return a response before // the timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + #[serde(default)] pub request_timeout_seconds: Option, } From fe82c1fa2f1d09f7da39517990719f1106536882 Mon Sep 17 00:00:00 2001 From: Jason Ginchereau Date: Thu, 21 Aug 2025 12:13:58 -1000 Subject: [PATCH 3/3] Add timeout detail comments --- cs/src/Contracts/TunnelOptions.cs | 7 +++++-- go/tunnels/tunnel_options.go | 8 ++++++-- .../com/microsoft/tunnels/contracts/TunnelOptions.java | 8 ++++++-- rs/src/contracts/tunnel_options.rs | 8 ++++++-- ts/src/contracts/tunnelOptions.ts | 8 ++++++-- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/cs/src/Contracts/TunnelOptions.cs b/cs/src/Contracts/TunnelOptions.cs index 47738831..b6690cc1 100644 --- a/cs/src/Contracts/TunnelOptions.cs +++ b/cs/src/Contracts/TunnelOptions.cs @@ -99,8 +99,11 @@ public class TunnelOptions /// Gets or sets the timeout for HTTP requests to the tunnel or port. /// /// - /// The default timeout is 100 seconds. If the host does not return a response before the timeout, - /// the tunnel relay aborts the request and returns 504 Gateway Timeout. + /// The default timeout is 100 seconds. Set this to 0 to disable the timeout. The timeout + /// will reset when response headers are received or after successfully reading or writing + /// any request, response, or streaming data like gRPC or WebSockets. TCP keep-alives and + /// HTTP/2 protocol pings will not reset the timeout, but WebSocket pings will. When a + /// request times out, the tunnel relay aborts the request and returns 504 Gateway Timeout. /// [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public int? RequestTimeoutSeconds { get; set; } diff --git a/go/tunnels/tunnel_options.go b/go/tunnels/tunnel_options.go index a27b1e63..fcddc61b 100644 --- a/go/tunnels/tunnel_options.go +++ b/go/tunnels/tunnel_options.go @@ -61,7 +61,11 @@ type TunnelOptions struct { // Gets or sets the timeout for HTTP requests to the tunnel or port. // - // The default timeout is 100 seconds. If the host does not return a response before the - // timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + // The default timeout is 100 seconds. Set this to 0 to disable the timeout. The timeout + // will reset when response headers are received or after successfully reading or writing + // any request, response, or streaming data like gRPC or WebSockets. TCP keep-alives and + // HTTP/2 protocol pings will not reset the timeout, but WebSocket pings will. When a + // request times out, the tunnel relay aborts the request and returns 504 Gateway + // Timeout. RequestTimeoutSeconds int32 `json:"requestTimeoutSeconds,omitempty"` } diff --git a/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java b/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java index 052e1f58..e43b486d 100644 --- a/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java +++ b/java/src/main/java/com/microsoft/tunnels/contracts/TunnelOptions.java @@ -91,8 +91,12 @@ public class TunnelOptions { /** * Gets or sets the timeout for HTTP requests to the tunnel or port. * - * The default timeout is 100 seconds. If the host does not return a response before - * the timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + * The default timeout is 100 seconds. Set this to 0 to disable the timeout. The + * timeout will reset when response headers are received or after successfully reading + * or writing any request, response, or streaming data like gRPC or WebSockets. TCP + * keep-alives and HTTP/2 protocol pings will not reset the timeout, but WebSocket + * pings will. When a request times out, the tunnel relay aborts the request and + * returns 504 Gateway Timeout. */ @Expose public int requestTimeoutSeconds; diff --git a/rs/src/contracts/tunnel_options.rs b/rs/src/contracts/tunnel_options.rs index 9008222e..ed62c933 100644 --- a/rs/src/contracts/tunnel_options.rs +++ b/rs/src/contracts/tunnel_options.rs @@ -72,8 +72,12 @@ pub struct TunnelOptions { // Gets or sets the timeout for HTTP requests to the tunnel or port. // - // The default timeout is 100 seconds. If the host does not return a response before - // the timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + // The default timeout is 100 seconds. Set this to 0 to disable the timeout. The + // timeout will reset when response headers are received or after successfully reading + // or writing any request, response, or streaming data like gRPC or WebSockets. TCP + // keep-alives and HTTP/2 protocol pings will not reset the timeout, but WebSocket + // pings will. When a request times out, the tunnel relay aborts the request and + // returns 504 Gateway Timeout. #[serde(default)] pub request_timeout_seconds: Option, } diff --git a/ts/src/contracts/tunnelOptions.ts b/ts/src/contracts/tunnelOptions.ts index f330b23c..70c71ddb 100644 --- a/ts/src/contracts/tunnelOptions.ts +++ b/ts/src/contracts/tunnelOptions.ts @@ -80,8 +80,12 @@ export interface TunnelOptions { /** * Gets or sets the timeout for HTTP requests to the tunnel or port. * - * The default timeout is 100 seconds. If the host does not return a response before - * the timeout, the tunnel relay aborts the request and returns 504 Gateway Timeout. + * The default timeout is 100 seconds. Set this to 0 to disable the timeout. The + * timeout will reset when response headers are received or after successfully reading + * or writing any request, response, or streaming data like gRPC or WebSockets. TCP + * keep-alives and HTTP/2 protocol pings will not reset the timeout, but WebSocket + * pings will. When a request times out, the tunnel relay aborts the request and + * returns 504 Gateway Timeout. */ requestTimeoutSeconds?: number; }