mirror of
https://github.com/minio/minio.git
synced 2025-02-28 05:49:16 -05:00
Let hijacker and flusher interfaces to be reflected. (#3709)
Ideally here if the interface is not found it would fail the server, as it should be because without these we can't even have a working server in the first place. Just like how it fails in master invariably inside Go net/http code path. Fixes #3708
This commit is contained in:
parent
70e70446bb
commit
a170e44689
@ -17,6 +17,8 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
@ -361,7 +363,6 @@ func (h resourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
// to record some useful http response data.
|
// to record some useful http response data.
|
||||||
type httpResponseRecorder struct {
|
type httpResponseRecorder struct {
|
||||||
http.ResponseWriter
|
http.ResponseWriter
|
||||||
http.Flusher
|
|
||||||
respStatusCode int
|
respStatusCode int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,10 +373,7 @@ func (rww *httpResponseRecorder) Write(b []byte) (int, error) {
|
|||||||
|
|
||||||
// Wraps ResponseWriter's Flush()
|
// Wraps ResponseWriter's Flush()
|
||||||
func (rww *httpResponseRecorder) Flush() {
|
func (rww *httpResponseRecorder) Flush() {
|
||||||
f, ok := rww.ResponseWriter.(http.Flusher)
|
rww.ResponseWriter.(http.Flusher).Flush()
|
||||||
if ok {
|
|
||||||
f.Flush()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wraps ResponseWriter's WriteHeader() and record
|
// Wraps ResponseWriter's WriteHeader() and record
|
||||||
@ -385,6 +383,10 @@ func (rww *httpResponseRecorder) WriteHeader(httpCode int) {
|
|||||||
rww.ResponseWriter.WriteHeader(httpCode)
|
rww.ResponseWriter.WriteHeader(httpCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rww *httpResponseRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||||
|
return rww.ResponseWriter.(http.Hijacker).Hijack()
|
||||||
|
}
|
||||||
|
|
||||||
// httpStatsHandler definition: gather HTTP statistics
|
// httpStatsHandler definition: gather HTTP statistics
|
||||||
type httpStatsHandler struct {
|
type httpStatsHandler struct {
|
||||||
handler http.Handler
|
handler http.Handler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user