aboutsummaryrefslogtreecommitdiff
path: root/src/mime
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-03-08 21:01:17 -0500
committerRuss Cox <rsc@golang.org>2024-03-09 14:19:39 +0000
commit74726defe99bb1e19cee35e27db697085f06fda1 (patch)
treed6ca72b6d2d17b99de1001e0a53082b1ab0ad9db /src/mime
parent065c5d220e802e85d410a5e6adba0819ab71aeda (diff)
downloadgo-74726defe99bb1e19cee35e27db697085f06fda1.tar.gz
go-74726defe99bb1e19cee35e27db697085f06fda1.zip
internal/godebugs: test for use of IncNonDefault
A few recent godebugs are missing IncNonDefault uses. Test for that, so that people remember to do it. Filed bugs for the missing ones. For #66215. For #66216. For #66217. Change-Id: Ia3fd10fd108e1b003bb30a8bc2f83995c768fab6 Reviewed-on: https://go-review.googlesource.com/c/go/+/570275 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/mime')
-rw-r--r--src/mime/multipart/formdata.go12
-rw-r--r--src/mime/multipart/multipart.go8
2 files changed, 10 insertions, 10 deletions
diff --git a/src/mime/multipart/formdata.go b/src/mime/multipart/formdata.go
index 85bad2a4cb..e0a63a66ae 100644
--- a/src/mime/multipart/formdata.go
+++ b/src/mime/multipart/formdata.go
@@ -34,8 +34,8 @@ func (r *Reader) ReadForm(maxMemory int64) (*Form, error) {
}
var (
- multipartFiles = godebug.New("#multipartfiles") // TODO: document and remove #
- multipartMaxParts = godebug.New("multipartmaxparts")
+ multipartfiles = godebug.New("#multipartfiles") // TODO: document and remove #
+ multipartmaxparts = godebug.New("multipartmaxparts")
)
func (r *Reader) readForm(maxMemory int64) (_ *Form, err error) {
@@ -46,15 +46,15 @@ func (r *Reader) readForm(maxMemory int64) (_ *Form, err error) {
)
numDiskFiles := 0
combineFiles := true
- if multipartFiles.Value() == "distinct" {
+ if multipartfiles.Value() == "distinct" {
combineFiles = false
- // multipartFiles.IncNonDefault() // TODO: uncomment after documenting
+ // multipartfiles.IncNonDefault() // TODO: uncomment after documenting
}
maxParts := 1000
- if s := multipartMaxParts.Value(); s != "" {
+ if s := multipartmaxparts.Value(); s != "" {
if v, err := strconv.Atoi(s); err == nil && v >= 0 {
maxParts = v
- multipartMaxParts.IncNonDefault()
+ multipartmaxparts.IncNonDefault()
}
}
maxHeaders := maxMIMEHeaders()
diff --git a/src/mime/multipart/multipart.go b/src/mime/multipart/multipart.go
index da1f45810e..00a7e5fe46 100644
--- a/src/mime/multipart/multipart.go
+++ b/src/mime/multipart/multipart.go
@@ -347,15 +347,15 @@ type Reader struct {
// including header keys, values, and map overhead.
const maxMIMEHeaderSize = 10 << 20
-// multipartMaxHeaders is the maximum number of header entries NextPart will return,
+// multipartmaxheaders is the maximum number of header entries NextPart will return,
// as well as the maximum combined total of header entries Reader.ReadForm will return
// in FileHeaders.
-var multipartMaxHeaders = godebug.New("multipartmaxheaders")
+var multipartmaxheaders = godebug.New("multipartmaxheaders")
func maxMIMEHeaders() int64 {
- if s := multipartMaxHeaders.Value(); s != "" {
+ if s := multipartmaxheaders.Value(); s != "" {
if v, err := strconv.ParseInt(s, 10, 64); err == nil && v >= 0 {
- multipartMaxHeaders.IncNonDefault()
+ multipartmaxheaders.IncNonDefault()
return v
}
}