From c3feafa90b854ae7e724b4748db9b27dcefc8d22 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Sun, 21 Feb 2021 16:06:56 -0500 Subject: [PATCH] Move Flush back to ResponseWriter --- response.go | 8 -------- timeout.go | 6 ++++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/response.go b/response.go index d62b8cf..1090ed5 100644 --- a/response.go +++ b/response.go @@ -187,15 +187,7 @@ type ResponseWriter interface { // The provided meta must not be longer than 1024 bytes. // Only one header may be written. WriteHeader(status Status, meta string) -} -// The Flusher interface is implemented by ResponseWriters that allow a -// Gemini handler to flush buffered data to the client. -// -// The default Gemini ResponseWriter implementation supports Flusher, -// but ResponseWriter wrappers may not. Handlers should always test -// for this ability at runtime. -type Flusher interface { // Flush sends any buffered data to the client. Flush() error } diff --git a/timeout.go b/timeout.go index b23a895..e5d4b28 100644 --- a/timeout.go +++ b/timeout.go @@ -13,8 +13,6 @@ import ( // if a call runs for longer than its time limit, the handler responds with a // 40 Temporary Failure error. After such a timeout, writes by h to its // ResponseWriter will return ErrHandlerTimeout. -// -// TimeoutHandler does not support the Hijacker or Flusher interfaces. func TimeoutHandler(h Handler, dt time.Duration) Handler { return &timeoutHandler{ h: h, @@ -108,3 +106,7 @@ func (w *timeoutWriter) writeHeaderLocked(status Status, meta string) { w.meta = meta w.wroteHeader = true } + +func (w *timeoutWriter) Flush() error { + return nil +}