Skip to content

Commit

Permalink
http2: delete multipart form tempfiles after ServeHTTP returns
Browse files Browse the repository at this point in the history
Do the same post-handler cleanup as the HTTP/1 server does.
No test here; test for HTTP/1 and HTTP/2 in CL 423194.

For golang/go#20253.

Change-Id: Iba54110ad2844571076c721d7ec19c39ba36de79
Reviewed-on: https://go-review.googlesource.com/c/net/+/423055
Reviewed-by: Robert Griesemer <[email protected]>
Run-TryBot: Damien Neil <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
neild committed Aug 12, 2022
1 parent 1d4ff48 commit 4c34ddd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions http2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,9 @@ func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler
didPanic := true
defer func() {
rw.rws.stream.cancelCtx()
if req.MultipartForm != nil {
req.MultipartForm.RemoveAll()
}
if didPanic {
e := recover()
sc.writeFrameFromHandler(FrameWriteRequest{
Expand Down

0 comments on commit 4c34ddd

Please sign in to comment.