proxy should be sending error code to client, instead of exiting
This commit is contained in:
1 parent
6911dc8d38
commit
b71a428369
1 file changed
+3
-3
+3
-3
@@ -83,7 +83,7 @@ func (c *client) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
func doRawStream(w http.ResponseWriter, resp *http.Response, client *httputil.ClientConn) {
|
func doRawStream(w http.ResponseWriter, resp *http.Response, client *httputil.ClientConn) {
|
||||||
down, downBuf, up, rem, err := hijack(w, client)
|
down, downBuf, up, rem, err := hijack(w, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error.Fatal(w, "Unable to hijack connection for raw stream mode", http.StatusInternalServerError)
|
http.Error(w, "Unable to hijack connection for raw stream mode", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer down.Close()
|
defer down.Close()
|
||||||
@@ -135,7 +135,7 @@ func doChunkedResponse(w http.ResponseWriter, resp *http.Response, client *httpu
|
|||||||
|
|
||||||
down, _, up, rem, err := hijack(w, client)
|
down, _, up, rem, err := hijack(w, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error.Fatal("Unable to hijack response stream for chunked response", http.StatusInternalServerError)
|
http.Error(w, "Unable to hijack response stream for chunked response", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer up.Close()
|
defer up.Close()
|
||||||
@@ -144,7 +144,7 @@ func doChunkedResponse(w http.ResponseWriter, resp *http.Response, client *httpu
|
|||||||
// stopping at the end of the chunked section.
|
// stopping at the end of the chunked section.
|
||||||
rawResponseBody := io.MultiReader(rem, up)
|
rawResponseBody := io.MultiReader(rem, up)
|
||||||
if _, err := io.Copy(ioutil.Discard, httputil.NewChunkedReader(io.TeeReader(rawResponseBody, down))); err != nil {
|
if _, err := io.Copy(ioutil.Discard, httputil.NewChunkedReader(io.TeeReader(rawResponseBody, down))); err != nil {
|
||||||
Error.Fatal("Error copying chunked response body", http.StatusInternalServerError)
|
http.Error(w, "Error copying chunked response body", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resp.Trailer.Write(down)
|
resp.Trailer.Write(down)
|
||||||
|
|||||||
Reference in new issue
Block a user