no usar un buffer
This commit is contained in:
parent
fc01157a81
commit
4ba4be180a
1 changed files with 2 additions and 4 deletions
|
@ -124,8 +124,7 @@ func (r *cache) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
http.Error(w, "server error", http.StatusInternalServerError)
|
http.Error(w, "server error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buf := [8 * 1024 * 1024]byte{}
|
_, err = io.Copy(file, req.Body)
|
||||||
_, err = io.CopyBuffer(file, req.Body, buf[:])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("io.Copy: %w", err)
|
log.Printf("io.Copy: %w", err)
|
||||||
http.Error(w, "server error", http.StatusInternalServerError)
|
http.Error(w, "server error", http.StatusInternalServerError)
|
||||||
|
@ -143,8 +142,7 @@ func (r *cache) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
http.Error(w, "server error", http.StatusInternalServerError)
|
http.Error(w, "server error", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buf := [8 * 1024 * 1024]byte{}
|
_, err = io.Copy(w, file)
|
||||||
_, err = io.CopyBuffer(w, file, buf[:])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("io.Copy: %w", err)
|
log.Printf("io.Copy: %w", err)
|
||||||
http.Error(w, "server error", http.StatusInternalServerError)
|
http.Error(w, "server error", http.StatusInternalServerError)
|
||||||
|
|
Loading…
Reference in a new issue