mirror of
https://github.com/1f349/violet.git
synced 2024-11-21 19:01:39 +00:00
Remove the useless hijack call
This commit is contained in:
parent
b5ff809345
commit
53041f4ac7
@ -39,7 +39,7 @@ func (s *serveCmd) Usage() string {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
func (s *serveCmd) Execute(_ context.Context, _ *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
|
||||||
log.Println("[Violet] Starting...")
|
log.Println("[Violet] Starting...")
|
||||||
|
|
||||||
if s.configPath == "" {
|
if s.configPath == "" {
|
||||||
|
@ -172,14 +172,6 @@ func (r Route) internalServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||||||
if resp.Body != nil {
|
if resp.Body != nil {
|
||||||
_, err := io.Copy(rw, resp.Body)
|
_, err := io.Copy(rw, resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// hijack and close upon error
|
|
||||||
if h, ok := rw.(http.Hijacker); ok {
|
|
||||||
hijack, _, err := h.Hijack()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
_ = hijack.Close()
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user