diff --git a/config.go b/config.go index 93e301adc..12cb82e7e 100644 --- a/config.go +++ b/config.go @@ -227,7 +227,7 @@ const ( defaultGrpcClientPingMinWait = 5 * time.Second // defaultHTTPHeaderTimeout is the default timeout for HTTP requests. - defaultHTTPHeaderTimeout = 5 * time.Second + DefaultHTTPHeaderTimeout = 5 * time.Second // BitcoinChainName is a string that represents the Bitcoin blockchain. BitcoinChainName = "bitcoin" @@ -702,7 +702,7 @@ func DefaultConfig() Config { ClientPingMinWait: defaultGrpcClientPingMinWait, }, WtClient: lncfg.DefaultWtClientCfg(), - HTTPHeaderTimeout: defaultHTTPHeaderTimeout, + HTTPHeaderTimeout: DefaultHTTPHeaderTimeout, } } diff --git a/docs/release-notes/release-notes-0.18.0.md b/docs/release-notes/release-notes-0.18.0.md index 2bf472de9..5d029eb4e 100644 --- a/docs/release-notes/release-notes-0.18.0.md +++ b/docs/release-notes/release-notes-0.18.0.md @@ -8,14 +8,16 @@ - [Functional Updates](#functional-updates) - [RPC Updates](#rpc-updates) - [lncli Updates](#lncli-updates) + - [Code Health](#code-health) - [Breaking Changes](#breaking-changes) - [Performance Improvements](#performance-improvements) - - [Technical and Architectural Updates](#technical-and-architectural-updates) - - [BOLT Spec Updates](#bolt-spec-updates) - - [Testing](#testing) - - [Database](#database) - - [Code Health](#code-health) - - [Tooling and Documentation](#tooling-and-documentation) +- [Technical and Architectural Updates](#technical-and-architectural-updates) + - [BOLT Spec Updates](#bolt-spec-updates) + - [Testing](#testing) + - [Database](#database) + - [Code Health](#code-health-1) + - [Tooling and Documentation](#tooling-and-documentation) +- [Contributors (Alphabetical Order)](#contributors-alphabetical-order) # Bug Fixes @@ -36,6 +38,8 @@ and payment to blinded paths has been added via the `QueryRoutes` (and SendToRouteV2) APIs. This functionality is surfaced in `lncli queryroutes` where the required flags are tagged with `(blinded paths)`. +* A new config value, + [http-header-timeout](https://github.com/lightningnetwork/lnd/pull/7715), is added so users can specify the amount of time the http server will wait for a request to complete before closing the connection. The default value is 5 seconds. ## RPC Additions ## lncli Additions @@ -75,6 +79,7 @@ # Contributors (Alphabetical Order) +* Amin Bashiri * Andras Banki-Horvath * Carla Kirk-Cohen * Elle Mouton diff --git a/lntest/fee_service.go b/lntest/fee_service.go index 1c94713ba..592430b8e 100644 --- a/lntest/fee_service.go +++ b/lntest/fee_service.go @@ -9,6 +9,7 @@ import ( "sync" "testing" + "github.com/lightningnetwork/lnd" "github.com/lightningnetwork/lnd/lntest/node" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/stretchr/testify/require" @@ -81,8 +82,9 @@ func NewFeeService(t *testing.T) *FeeService { mux.HandleFunc("/fee-estimates.json", f.handleRequest) f.srv = &http.Server{ - Addr: listenAddr, - Handler: mux, + Addr: listenAddr, + Handler: mux, + ReadHeaderTimeout: lnd.DefaultHTTPHeaderTimeout, } return &f diff --git a/sample-lnd.conf b/sample-lnd.conf index 3d8a7b292..9bc1a2a84 100644 --- a/sample-lnd.conf +++ b/sample-lnd.conf @@ -519,6 +519,9 @@ ; intelligence services. ; color=#3399FF +; The maximum duration that the server will wait before timing out reading +; the headers of an HTTP request. +; http-header-timeout=5s [prometheus]