aboutsummaryrefslogtreecommitdiff
path: root/src/mime
AgeCommit message (Collapse)Author
2023-02-14mime/multipart: limit memory/inode consumption of ReadFormDamien Neil
Reader.ReadForm is documented as storing "up to maxMemory bytes + 10MB" in memory. Parsed forms can consume substantially more memory than this limit, since ReadForm does not account for map entry overhead and MIME headers. In addition, while the amount of disk memory consumed by ReadForm can be constrained by limiting the size of the parsed input, ReadForm will create one temporary file per form part stored on disk, potentially consuming a large number of inodes. Update ReadForm's memory accounting to include part names, MIME headers, and map entry overhead. Update ReadForm to store all on-disk file parts in a single temporary file. Files returned by FileHeader.Open are documented as having a concrete type of *os.File when a file is stored on disk. The change to use a single temporary file for all parts means that this is no longer the case when a form contains more than a single file part stored on disk. The previous behavior of storing each file part in a separate disk file may be reenabled with GODEBUG=multipartfiles=distinct. Update Reader.NextPart and Reader.NextRawPart to set a 10MiB cap on the size of MIME headers. Thanks to Jakob Ackermann (@das7pad) for reporting this issue. Fixes #58006 Fixes CVE-2022-41725 Change-Id: Ibd780a6c4c83ac8bcfd3cbe344f042e9940f2eab Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1714276 Reviewed-by: Julie Qiu <julieqiu@google.com> TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <bracewell@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/468124 Auto-Submit: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-20mime/multipart: use %w when wrapping error in NextPartthinkofher
Use "%w" instead of "%v" as format verb for error value in the NextPart method. This way it will be possible to use common go error utilities from std library when parsing from custom io.Readers. This issue was discovered during attempts to use http.Request.ParseMultipartForm together with http.MaxBytesHandler. Change-Id: Idb82510fb536b66b51ed1d943737c4828f07c2f2 GitHub-Last-Rev: 8bc49c945c1b393bcfb4d8df545c93593c9bd7c4 GitHub-Pull-Request: golang/go#55133 Reviewed-on: https://go-review.googlesource.com/c/go/+/431675 Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2022-09-06mime: use strings.Buildercuiweixie
Change-Id: I2756fab046154a2df49435ba1978a32176de830a Reviewed-on: https://go-review.googlesource.com/c/go/+/428265 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: xie cui <523516579@qq.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2022-08-26mime: allow duplicate media type parameters with equivalent valuesPaschalis Tsilias
Fixes #48866 Change-Id: I2bd2c806e44eb4064b1fb9a6509d79cecbbef013 Reviewed-on: https://go-review.googlesource.com/c/go/+/363094 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Tim King <taking@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: David Chase <drchase@google.com>
2022-08-08mime: remove test ordering dependencyIan Lance Taylor
Arrange for tests that call setMimeInit to fully restore the old values, by clearing the sync.Once that controls initialization. Once we've done that, call initMime in initMimeUnixTest because otherwise the test types loaded there will be cleared by the call to initMime that previously was not being done. For golang/go#51648 Change-Id: I8bf92b305fc4499337db06113817c9decdc5aedb Reviewed-on: https://go-review.googlesource.com/c/go/+/421442 Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-05-28mime: ignore .js => text/plain in Windows registryIan Lance Taylor
This seems to be a common registry misconfiguration on Windows. Fixes #32350 Change-Id: I68c617c42a6e72948e2acdf335ff8e7df569432d Reviewed-on: https://go-review.googlesource.com/c/go/+/406894 Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
2022-05-13mime: skip globs2 entries that are not simple file extensionsVille Skyttä
The entries in globs2 can be globs beyond simple *.ext ones. We support only simple extension based matching, so skip entries that do not represent them. Change-Id: Id5d089cb4067e53beb2471a5e67a59c13880a017 GitHub-Last-Rev: f725a910547ec52d12605760563f158dfb72e4b0 GitHub-Pull-Request: golang/go#51156 Reviewed-on: https://go-review.googlesource.com/c/go/+/385256 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-04-15mime: ignore non-extension globs2 entriesVille Skyttä
Change-Id: Ic2315b593dca5648c02f793b7650b5936a997bff GitHub-Last-Rev: ee55edcf087416c6f0d50d5dd51cbddfd1d77620 GitHub-Pull-Request: golang/go#51226 Reviewed-on: https://go-review.googlesource.com/c/go/+/386334 Reviewed-by: Damien Neil <dneil@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-04-11all: gofmt main repoRuss Cox
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-04-01mime/multipart: allow nested boundary with outer boundary+dash prefixOlivier Szika
Fixes #46042 Change-Id: Icd243eb12c6e260aeead04710f12340048a0e859 Reviewed-on: https://go-review.googlesource.com/c/go/+/338549 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
2022-03-31mime/multipart: unified Part and Reader receiver nameWayne Zuo
Change-Id: Ic36dd232f3ea049403715fadec00a74efbf7dc9e Reviewed-on: https://go-review.googlesource.com/c/go/+/394075 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Trust: Damien Neil <dneil@google.com>
2022-03-29all: use new "unix" build tag where appropriateIan Lance Taylor
For #20322 For #51572 Change-Id: Id0b4799d097d01128e98ba4cc0092298357bca45 Reviewed-on: https://go-review.googlesource.com/c/go/+/389935 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-12-13all: gofmt -w -r 'interface{} -> any' srcRuss Cox
And then revert the bootstrap cmd directories and certain testdata. And adjust tests as needed. Not reverting the changes in std that are bootstrapped, because some of those changes would appear in API docs, and we want to use any consistently. Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories when preparing the bootstrap copy. A few files changed as a result of running gofmt -w not because of interface{} -> any but because they hadn't been updated for the new //go:build lines. Fixes #49884. Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09 Reviewed-on: https://go-review.googlesource.com/c/go/+/368254 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-11-09mime: keep parsing after trailing semicolonIllirgway
Fixes #46323 Change-Id: Ibd624b1aaa15f907b7eb965b4eaec61018a45486 GitHub-Last-Rev: 7ad670b088144a2a09860dd990c53dea75c0d40f GitHub-Pull-Request: golang/go#47029 Reviewed-on: https://go-review.googlesource.com/c/go/+/332509 Trust: Ian Lance Taylor <iant@golang.org> Trust: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2021-10-28all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox
When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-10-06all: use bytes.Cut, strings.CutRuss Cox
Many uses of Index/IndexByte/IndexRune/Split/SplitN can be written more clearly using the new Cut functions. Do that. Also rewrite to other functions if that's clearer. For #46336. Change-Id: I68d024716ace41a57a8bf74455c62279bde0f448 Reviewed-on: https://go-review.googlesource.com/c/go/+/351711 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-26mime: document use of the Shared MIME-Info DatabaseDamien Neil
For #44513. Fixes #46013. Change-Id: I382603208aa94b66d5220cf0f418b8528a4e4148 Reviewed-on: https://go-review.googlesource.com/c/go/+/322892 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-05net/http: ignore directory path when parsing multipart formsKatie Hockman
Fixes #45789 Change-Id: Id588f5dbbecf5fbfb54e957c53903aaa900171f2 Reviewed-on: https://go-review.googlesource.com/c/go/+/313809 Trust: Katie Hockman <katie@golang.org> Run-TryBot: Katie Hockman <katie@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-04-15mime: keep builtinTypesLower sorted alphabeticallyTobias Klauser
Updates #44602 Change-Id: I2c32e388143e56928850821587f57d9729434220 Reviewed-on: https://go-review.googlesource.com/c/go/+/310034 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-14mime: add mime type for avif image file formatAmit Kumar
Fixes #44602 Change-Id: I28b6df5e2523fc2ece6fd8251fcabc83c7c38d89 Reviewed-on: https://go-review.googlesource.com/c/go/+/256478 Trust: Ian Lance Taylor <iant@golang.org> Trust: Michael Knyszek <mknyszek@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-13mime: in globs2 file only keep first time extension is seenIan Lance Taylor
Fixes #45534 Change-Id: I9855607e845951f26ab85cb179ec6dea40d92156 Reviewed-on: https://go-review.googlesource.com/c/go/+/309574 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-12mime: support reading shared mime-info database on unix systemsJacalz
This adds support for reading the FreeDesktop Shared MIME-info Database on Unix systems, if it exists. It should make lookups work on systems where the mime.types files are not present and should lead to better mimetype lookup in general. If the shared mimetype database does not exist, we will fall back to reading mime.types files in common locations. Related to a bug on Solus bugtracker: https://dev.getsol.us/T9394 This change makes the mime package work on Solus. Change-Id: If330c22ffe523bf31f7f10807a54fc8858517055 GitHub-Last-Rev: d5fbe8c41a9d975029b35498183a0f5a40df8e6a GitHub-Pull-Request: golang/go#45271 Reviewed-on: https://go-review.googlesource.com/c/go/+/305230 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-02-20all: go fmt std cmd (but revert vendor)Russ Cox
Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-03mime/multipart: handle ReadForm(math.MaxInt64) betterRuss Cox
Returning an error about integer overflow is needlessly pedantic. The meaning of ReadForm(MaxInt64) is easily understood (accept a lot of data) and can be implemented. Fixes #40430. Change-Id: I8a522033dd9a2f9ad31dd2ad82cf08d553736ab9 Reviewed-on: https://go-review.googlesource.com/c/go/+/275112 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-27mime: look up mime types on Arch LinuxAndy Williams
Some systems use "httpd" directory structure instead of "apache" Change-Id: I77600baf356f0c0c3359b331505b0426112daebb GitHub-Last-Rev: c64766f88cc28899d3d387e3eebfa4fcc3eef808 GitHub-Pull-Request: golang/go#39416 Reviewed-on: https://go-review.googlesource.com/c/go/+/236677 Trust: Tobias Klauser <tobias.klauser@gmail.com> Trust: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-10-20all: update references to symbols moved from io/ioutil to ioRuss Cox
The old ioutil references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. Also excluded vendored code. For #41190. Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/263142 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-10-13syscall: remove dependency on ioRuss Cox
Keep syscall and io separated; neither should depend on the other. Change-Id: Icdd61bd0c05d874cabd7b5ae6631dd09dec90112 Reviewed-on: https://go-review.googlesource.com/c/go/+/243902 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2020-09-28mime/multipart: return overflow errors in Reader.ReadFormavivklas
Updates Reader.ReadForm to check for overflow errors that may result from a leeway addition of 10MiB to the input argument maxMemory. Fixes #40430 Change-Id: I510b8966c95c51d04695ba9d08fcfe005fd11a5d Reviewed-on: https://go-review.googlesource.com/c/go/+/247477 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-09-06mime: add examples for FormatMediaType and ParseMediaTypeAinar Garipov
Change-Id: Ic129c58784ad1f0b8b90fc9d33e52bee61bdf0eb Reviewed-on: https://go-review.googlesource.com/c/go/+/253237 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-07mime: add .json to built-in list of MIME typesAn Long
Since json is popular and mime package's builtin type does not contain it, and some Linux distributions do not contain the '/etc/mime.types' file with minimal installations. Change-Id: I933393c82be296ef176206c253f4dd19b6f33bb1 GitHub-Last-Rev: ce4eae56a4d468631555dc85e0e7ab4bbd0ef45d GitHub-Pull-Request: golang/go#34737 Reviewed-on: https://go-review.googlesource.com/c/go/+/199657 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-02-25mime: fix ExtensionsByType bug when there are duplicatesBrad Fitzpatrick
Also, sort them so the results aren't random. Thanks to @junedev for the bug report & repro. Fixes #36524 Change-Id: Ic9197ebeceddfb3d0aee895d8fc12ce4d205b164 Reviewed-on: https://go-review.googlesource.com/c/go/+/214680 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-11mime/multipart: add Part.NextRawPart to avoid QP decodingAlex Buchanan
NextPart has automatic handling of quoted-printable encoding, which is sometimes undesirable. NextRawPart adds a method for reading a part while bypassing such automatic handling. Fixes #29090 Change-Id: I6a042a4077c64091efa3f5dbecce0d9a34ac7065 Reviewed-on: https://go-review.googlesource.com/c/go/+/152877 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-09all: remove the nacl port (part 1)Brad Fitzpatrick
You were a useful port and you've served your purpose. Thanks for all the play. A subsequent CL will remove amd64p32 (including assembly files and toolchain bits) and remaining bits. The amd64p32 removal will be separated into its own CL in case we want to support the Linux x32 ABI in the future and want our old amd64p32 support as a starting point. Updates #30439 Change-Id: Ia3a0c7d49804adc87bf52a4dea7e3d3007f2b1cd Reviewed-on: https://go-review.googlesource.com/c/go/+/199499 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-01mime: update type of .js and .mjs files to text/javascriptAndrew Bonventre
application/javascript is being deprecated per https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/ Specify a charset to be consistent with other text/* mime types. Fixes #32351 Change-Id: I7300f6cfdbcf574103764991cb75172a252a3400 Reviewed-on: https://go-review.googlesource.com/c/go/+/186927 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-05-23mime: encode CTL and non-US-ASCII characters in FormatMediaTypeandrius4669
Encodes non-WSP CTL and non-US-ASCII UTF-8 characters using syntax specified in RFC 2231. Fixes #7668 Fixes #9624 Change-Id: I433f167c5bdd84a7f811ac0410b08b10790e0d9f GitHub-Last-Rev: 9c77146760341fdb3af35c1b94d4ee00ffb0daae GitHub-Pull-Request: golang/go#29328 Reviewed-on: https://go-review.googlesource.com/c/go/+/154760 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-22all: shorten some testsRuss Cox
Shorten some of the longest tests that run during all.bash. Removes 7r 50u 21s from all.bash. After this change, all.bash is under 5 minutes again on my laptop. For #26473. Change-Id: Ie0460aa935808d65460408feaed210fbaa1d5d79 Reviewed-on: https://go-review.googlesource.com/c/go/+/177559 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-05-21mime: add .webp for builtinEduard Urbach
This change modifies Go to include image/webp as a built-in mime type for the .webp file extension. Change-Id: Id46d34fac8cc859ddd69aa8669294815654214f8 GitHub-Last-Rev: f191e1c325126e2caeb3123c912131ce5236542b GitHub-Pull-Request: golang/go#32157 Reviewed-on: https://go-review.googlesource.com/c/go/+/178317 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-13mime: update .mjs MIME type from text/ to application/javascriptBrad Fitzpatrick
.mjs should be the same MIME type as .js, and RFC 4329 says that text/javascript is obsolete, even back in 2006: https://tools.ietf.org/html/rfc4329#section-7.1 I didn't notice this when I recently reviewed CL 169502. Also, re-sort it. Updates #30547 Change-Id: I8ed8ddaf06c8a08b010423ebd071f39ef3a325e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/175459 Reviewed-by: Andrew Bonventre <andybons@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org>
2019-04-03mime: add .jpeg for builtinKenichi Tsunokawa
Change-Id: I32b0c02039d8baca1358dac2cc0afd14fa6cd173 GitHub-Last-Rev: d3be7aa039fbe94450c54f2c1dc5a510cf183378 GitHub-Pull-Request: golang/go#31232 Reviewed-on: https://go-review.googlesource.com/c/go/+/170657 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-27mime: add javascript module mime type (.mjs)John
There are default mime types in this package for handling static content, but there's a new one missing ".mjs" that is "Content-Type: text/javascript". https://developers.google.com/web/fundamentals/primers/modules#mjs Change-Id: Ie842ece0cb55770fb6c9eb65f8bfee2ecf7bc624 GitHub-Last-Rev: e26d9f76171c987112d5d6db292446819a8393e2 GitHub-Pull-Request: golang/go#31071 Reviewed-on: https://go-review.googlesource.com/c/go/+/169502 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13mime/multipart: quote boundary in Content-Type if necessaryIan Lance Taylor
Fixes #26532 Change-Id: Ic086c90503c7b24982f947c828c7ccf016ddbf69 Reviewed-on: https://go-review.googlesource.com/c/154120 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-20mime: remove allocation introduced in recent fixBrad Fitzpatrick
CL 150417 was submitted before I could recommend this change to remove an unnecessary allocation. Updates #28849 Change-Id: I4cd655f62bb3d00eda6c997f074785385bceee0c Reviewed-on: https://go-review.googlesource.com/c/150498 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-20mime: correctly detect non-ASCII characters in FormatMediaTypeDavid Heuschmann
FormatMediaType used rune&0x80==0 to check if parameter values consisted of valid ascii charaters. Comparing strings using their runes instead of their bytes leads to some non-ascii strings to pass as valid. E.g. the rune for 'Ą' is 0x104, 0x104 & 0x80 => 0. Its byte representation is 0xc4 0x84, both of which result in non zero values when masked with 0x80 Fixes #28849 Change-Id: Ib9fb4968bcbbec0197d81136f380d40a2a56c14b Reviewed-on: https://go-review.googlesource.com/c/150417 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-09mime/multipart: check for quoted-printable case insensitivelyBrad Fitzpatrick
Fixes #28674 Change-Id: Id88e0a4b86b50eb45f0d968d7e4bbe66b7f37f82 Reviewed-on: https://go-review.googlesource.com/c/148579 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-10mime: add AIX operating systemClément Chigot
This commit adds AIX operating system to mime package for ppc64 architecture. Updates: #25893 Change-Id: I1b81a9204446c8c76ae24ea5c6fd33077c373ae4 Reviewed-on: https://go-review.googlesource.com/c/138723 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-26all: use strings.ReplaceAll and bytes.ReplaceAll where applicableBrad Fitzpatrick
I omitted vendor directories and anything necessary for bootstrapping. (Tested by bootstrapping with Go 1.4) Updates #27864 Change-Id: I7d9b68d0372d3a34dee22966cca323513ece7e8a Reviewed-on: https://go-review.googlesource.com/137856 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-24mime: derestrict value backslash unescaping for all encodingsEugene Kalinin
Previously consumeValue performed consumption of "unnecessary backslashes" strictly for non-ASCII and non-token runes. Thus if it encountered a backslash before a rune that is out of the ASCII range, it would erroneously skip that backslash. This change now derestricts "unnecessary backslash" unescaping for all character encodings, using "isTSpecial" instead of "!isTokenChar". This change is a follow-up of CL 32175. Fixes #25888 Change-Id: I5e02bbf9c42f753a6eb31399b8d20315af991490 Reviewed-on: https://go-review.googlesource.com/119795 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-27mime/quotedprintable: accept bytes >= 0x80Ian Lance Taylor
RFC 2045 doesn't permit non-ASCII bytes, but some systems send them anyhow. With this change, we accept them. This does make it harder to validate quotedprintable data, but on balance this seems like the best approach given the existence of systems that generate invalid data. Fixes #22597 Change-Id: I9f80f90a60b76ada2b5dea658b8dc8aace56cdbd Reviewed-on: https://go-review.googlesource.com/121095 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-26mime/multipart: restore 1.9 handling of missing/empty form-data file nameIan Lance Taylor
Revert the code changes of CL 96975 and CL 70931, but keep the tests, appropriately modified for the code changes. This restores the 1.9 handling of form-data entries with missing or empty file names. Changing the handling of this simply confused existing programs for no useful benefit. Go back to the old behavior. Updates #19183 Fixes #24041 Change-Id: I4ebc32433911e6360b9fd79d8f63a6d884822e0e Reviewed-on: https://go-review.googlesource.com/121055 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>