]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "net/http: test that ParseMultipartForm returns an error for int overflow"
authorBryan C. Mills <bcmills@google.com>
Mon, 19 Oct 2020 18:03:51 +0000 (18:03 +0000)
committerBryan C. Mills <bcmills@google.com>
Mon, 19 Oct 2020 19:51:19 +0000 (19:51 +0000)
This reverts CL 254977.

Reason for revert: introduced test failures on longtest builders.

Change-Id: I75e868245f980189ad85dd4103d9178989e06ecf
Reviewed-on: https://go-review.googlesource.com/c/go/+/263658
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/net/http/request_test.go

index 4f4f435814cc6e2956237252b3e99f85731ed9c8..461d66e05d70798a22d2aad0f549df59e6f48980 100644 (file)
@@ -13,7 +13,6 @@ import (
        "fmt"
        "io"
        "io/ioutil"
-       "math"
        "mime/multipart"
        . "net/http"
        "net/http/httptest"
@@ -246,41 +245,6 @@ func TestParseMultipartForm(t *testing.T) {
        }
 }
 
-// Issue #40430: ParseMultipartForm should return error for int overflow
-func TestMaxInt64ForMultipartFormMaxMemory(t *testing.T) {
-       cst := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) {
-               if err := req.ParseMultipartForm(math.MaxInt64); err != nil {
-                       Error(rw, err.Error(), StatusBadRequest)
-                       return
-               }
-       }))
-       defer cst.Close()
-       fBuf := new(bytes.Buffer)
-       mw := multipart.NewWriter(fBuf)
-       mf, err := mw.CreateFormFile("file", "myfile.txt")
-       if err != nil {
-               t.Fatal(err)
-       }
-       if _, err := mf.Write(bytes.Repeat([]byte("abc"), 1<<10)); err != nil {
-               t.Fatal(err)
-       }
-       if err := mw.Close(); err != nil {
-               t.Fatal(err)
-       }
-       req, err := NewRequest("POST", cst.URL, fBuf)
-       if err != nil {
-               t.Fatal(err)
-       }
-       req.Header.Set("Content-Type", mw.FormDataContentType())
-       res, err := cst.Client().Do(req)
-       if err != nil {
-               t.Fatal(err)
-       }
-       if g, w := res.StatusCode, StatusBadRequest; g != w {
-               t.Fatalf("Status code mismatch: got %d, want %d", g, w)
-       }
-}
-
 func TestRedirect_h1(t *testing.T) { testRedirect(t, h1Mode) }
 func TestRedirect_h2(t *testing.T) { testRedirect(t, h2Mode) }
 func testRedirect(t *testing.T, h2 bool) {