HTTPD, WebDAV: use http.ResponseController

backport from Enterprise edition

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2025-08-02 18:00:45 +02:00
parent 9a0137befb
commit ddbe40cefa
11 changed files with 105 additions and 169 deletions

View File

@@ -35,6 +35,17 @@ import (
type Connection struct {
*common.BaseConnection
request *http.Request
rc *http.ResponseController
}
func newConnection(conn *common.BaseConnection, w http.ResponseWriter, r *http.Request) *Connection {
rc := http.NewResponseController(w)
responseControllerDeadlines(rc, time.Time{}, time.Time{})
return &Connection{
BaseConnection: conn,
request: r,
rc: rc,
}
}
// GetClientVersion returns the connected client's version.
@@ -60,6 +71,9 @@ func (c *Connection) GetRemoteAddress() string {
// Disconnect closes the active transfer
func (c *Connection) Disconnect() (err error) {
if c.rc != nil {
responseControllerDeadlines(c.rc, time.Now().Add(5*time.Second), time.Now().Add(5*time.Second))
}
return c.SignalTransfersAbort()
}