mirror of https://github.com/goproxyio/goproxy
fix. when using a proxy encounters move will repeat 302
parent
e03dc0f0bf
commit
c597945a02
|
@ -115,6 +115,7 @@ func (router *Router) customModResponse(r *http.Response) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp.Body = ioutil.NopCloser(bytes.NewReader(buf))
|
resp.Body = ioutil.NopCloser(bytes.NewReader(buf))
|
||||||
|
|
||||||
if buf != nil {
|
if buf != nil {
|
||||||
file := filepath.Join(router.opts.DownloadRoot, r.Request.URL.Path)
|
file := filepath.Join(router.opts.DownloadRoot, r.Request.URL.Path)
|
||||||
os.MkdirAll(path.Dir(file), os.ModePerm)
|
os.MkdirAll(path.Dir(file), os.ModePerm)
|
||||||
|
@ -123,6 +124,13 @@ func (router *Router) customModResponse(r *http.Response) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// requests from the client also need to be processed here,
|
||||||
|
// otherwise this 302 status will be sent to the client unchanged
|
||||||
|
r.StatusCode = http.StatusOK
|
||||||
|
resp.Header.Del("Content-Encoding")
|
||||||
|
resp.Header.Del("Content-Length")
|
||||||
|
r.Header = resp.Header
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue