mirror of
https://github.com/niusmallnan/steve.git
synced 2025-08-28 17:51:57 +00:00
Ensure redirector supports Hijacking if possible
This commit is contained in:
parent
9da27b7130
commit
68ed467231
@ -18,6 +18,9 @@ func RedirectRewrite(next http.Handler) http.Handler {
|
|||||||
ResponseWriter: rw,
|
ResponseWriter: rw,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
}
|
}
|
||||||
|
if h, ok := rw.(http.Hijacker); ok {
|
||||||
|
r.Hijacker = h
|
||||||
|
}
|
||||||
next.ServeHTTP(r, req)
|
next.ServeHTTP(r, req)
|
||||||
r.Close()
|
r.Close()
|
||||||
})
|
})
|
||||||
@ -25,6 +28,7 @@ func RedirectRewrite(next http.Handler) http.Handler {
|
|||||||
|
|
||||||
type redirector struct {
|
type redirector struct {
|
||||||
http.ResponseWriter
|
http.ResponseWriter
|
||||||
|
http.Hijacker
|
||||||
prefix string
|
prefix string
|
||||||
from, to string
|
from, to string
|
||||||
tempBuffer *bytes.Buffer
|
tempBuffer *bytes.Buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user