Skip to content

Commit 45dd67f

Browse files
authored
Merge branch 'minio:master' into ping
2 parents 6fc812b + 383560b commit 45dd67f

File tree

9 files changed

+396
-78
lines changed

9 files changed

+396
-78
lines changed

CREDITS

Lines changed: 209 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4245,6 +4245,214 @@ SOFTWARE.
42454245

42464246
================================================================
42474247

4248+
github.com/minio/crc64nvme
4249+
https://github.com/minio/crc64nvme
4250+
----------------------------------------------------------------
4251+
4252+
Apache License
4253+
Version 2.0, January 2004
4254+
http://www.apache.org/licenses/
4255+
4256+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4257+
4258+
1. Definitions.
4259+
4260+
"License" shall mean the terms and conditions for use, reproduction,
4261+
and distribution as defined by Sections 1 through 9 of this document.
4262+
4263+
"Licensor" shall mean the copyright owner or entity authorized by
4264+
the copyright owner that is granting the License.
4265+
4266+
"Legal Entity" shall mean the union of the acting entity and all
4267+
other entities that control, are controlled by, or are under common
4268+
control with that entity. For the purposes of this definition,
4269+
"control" means (i) the power, direct or indirect, to cause the
4270+
direction or management of such entity, whether by contract or
4271+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
4272+
outstanding shares, or (iii) beneficial ownership of such entity.
4273+
4274+
"You" (or "Your") shall mean an individual or Legal Entity
4275+
exercising permissions granted by this License.
4276+
4277+
"Source" form shall mean the preferred form for making modifications,
4278+
including but not limited to software source code, documentation
4279+
source, and configuration files.
4280+
4281+
"Object" form shall mean any form resulting from mechanical
4282+
transformation or translation of a Source form, including but
4283+
not limited to compiled object code, generated documentation,
4284+
and conversions to other media types.
4285+
4286+
"Work" shall mean the work of authorship, whether in Source or
4287+
Object form, made available under the License, as indicated by a
4288+
copyright notice that is included in or attached to the work
4289+
(an example is provided in the Appendix below).
4290+
4291+
"Derivative Works" shall mean any work, whether in Source or Object
4292+
form, that is based on (or derived from) the Work and for which the
4293+
editorial revisions, annotations, elaborations, or other modifications
4294+
represent, as a whole, an original work of authorship. For the purposes
4295+
of this License, Derivative Works shall not include works that remain
4296+
separable from, or merely link (or bind by name) to the interfaces of,
4297+
the Work and Derivative Works thereof.
4298+
4299+
"Contribution" shall mean any work of authorship, including
4300+
the original version of the Work and any modifications or additions
4301+
to that Work or Derivative Works thereof, that is intentionally
4302+
submitted to Licensor for inclusion in the Work by the copyright owner
4303+
or by an individual or Legal Entity authorized to submit on behalf of
4304+
the copyright owner. For the purposes of this definition, "submitted"
4305+
means any form of electronic, verbal, or written communication sent
4306+
to the Licensor or its representatives, including but not limited to
4307+
communication on electronic mailing lists, source code control systems,
4308+
and issue tracking systems that are managed by, or on behalf of, the
4309+
Licensor for the purpose of discussing and improving the Work, but
4310+
excluding communication that is conspicuously marked or otherwise
4311+
designated in writing by the copyright owner as "Not a Contribution."
4312+
4313+
"Contributor" shall mean Licensor and any individual or Legal Entity
4314+
on behalf of whom a Contribution has been received by Licensor and
4315+
subsequently incorporated within the Work.
4316+
4317+
2. Grant of Copyright License. Subject to the terms and conditions of
4318+
this License, each Contributor hereby grants to You a perpetual,
4319+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
4320+
copyright license to reproduce, prepare Derivative Works of,
4321+
publicly display, publicly perform, sublicense, and distribute the
4322+
Work and such Derivative Works in Source or Object form.
4323+
4324+
3. Grant of Patent License. Subject to the terms and conditions of
4325+
this License, each Contributor hereby grants to You a perpetual,
4326+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
4327+
(except as stated in this section) patent license to make, have made,
4328+
use, offer to sell, sell, import, and otherwise transfer the Work,
4329+
where such license applies only to those patent claims licensable
4330+
by such Contributor that are necessarily infringed by their
4331+
Contribution(s) alone or by combination of their Contribution(s)
4332+
with the Work to which such Contribution(s) was submitted. If You
4333+
institute patent litigation against any entity (including a
4334+
cross-claim or counterclaim in a lawsuit) alleging that the Work
4335+
or a Contribution incorporated within the Work constitutes direct
4336+
or contributory patent infringement, then any patent licenses
4337+
granted to You under this License for that Work shall terminate
4338+
as of the date such litigation is filed.
4339+
4340+
4. Redistribution. You may reproduce and distribute copies of the
4341+
Work or Derivative Works thereof in any medium, with or without
4342+
modifications, and in Source or Object form, provided that You
4343+
meet the following conditions:
4344+
4345+
(a) You must give any other recipients of the Work or
4346+
Derivative Works a copy of this License; and
4347+
4348+
(b) You must cause any modified files to carry prominent notices
4349+
stating that You changed the files; and
4350+
4351+
(c) You must retain, in the Source form of any Derivative Works
4352+
that You distribute, all copyright, patent, trademark, and
4353+
attribution notices from the Source form of the Work,
4354+
excluding those notices that do not pertain to any part of
4355+
the Derivative Works; and
4356+
4357+
(d) If the Work includes a "NOTICE" text file as part of its
4358+
distribution, then any Derivative Works that You distribute must
4359+
include a readable copy of the attribution notices contained
4360+
within such NOTICE file, excluding those notices that do not
4361+
pertain to any part of the Derivative Works, in at least one
4362+
of the following places: within a NOTICE text file distributed
4363+
as part of the Derivative Works; within the Source form or
4364+
documentation, if provided along with the Derivative Works; or,
4365+
within a display generated by the Derivative Works, if and
4366+
wherever such third-party notices normally appear. The contents
4367+
of the NOTICE file are for informational purposes only and
4368+
do not modify the License. You may add Your own attribution
4369+
notices within Derivative Works that You distribute, alongside
4370+
or as an addendum to the NOTICE text from the Work, provided
4371+
that such additional attribution notices cannot be construed
4372+
as modifying the License.
4373+
4374+
You may add Your own copyright statement to Your modifications and
4375+
may provide additional or different license terms and conditions
4376+
for use, reproduction, or distribution of Your modifications, or
4377+
for any such Derivative Works as a whole, provided Your use,
4378+
reproduction, and distribution of the Work otherwise complies with
4379+
the conditions stated in this License.
4380+
4381+
5. Submission of Contributions. Unless You explicitly state otherwise,
4382+
any Contribution intentionally submitted for inclusion in the Work
4383+
by You to the Licensor shall be under the terms and conditions of
4384+
this License, without any additional terms or conditions.
4385+
Notwithstanding the above, nothing herein shall supersede or modify
4386+
the terms of any separate license agreement you may have executed
4387+
with Licensor regarding such Contributions.
4388+
4389+
6. Trademarks. This License does not grant permission to use the trade
4390+
names, trademarks, service marks, or product names of the Licensor,
4391+
except as required for reasonable and customary use in describing the
4392+
origin of the Work and reproducing the content of the NOTICE file.
4393+
4394+
7. Disclaimer of Warranty. Unless required by applicable law or
4395+
agreed to in writing, Licensor provides the Work (and each
4396+
Contributor provides its Contributions) on an "AS IS" BASIS,
4397+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
4398+
implied, including, without limitation, any warranties or conditions
4399+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
4400+
PARTICULAR PURPOSE. You are solely responsible for determining the
4401+
appropriateness of using or redistributing the Work and assume any
4402+
risks associated with Your exercise of permissions under this License.
4403+
4404+
8. Limitation of Liability. In no event and under no legal theory,
4405+
whether in tort (including negligence), contract, or otherwise,
4406+
unless required by applicable law (such as deliberate and grossly
4407+
negligent acts) or agreed to in writing, shall any Contributor be
4408+
liable to You for damages, including any direct, indirect, special,
4409+
incidental, or consequential damages of any character arising as a
4410+
result of this License or out of the use or inability to use the
4411+
Work (including but not limited to damages for loss of goodwill,
4412+
work stoppage, computer failure or malfunction, or any and all
4413+
other commercial damages or losses), even if such Contributor
4414+
has been advised of the possibility of such damages.
4415+
4416+
9. Accepting Warranty or Additional Liability. While redistributing
4417+
the Work or Derivative Works thereof, You may choose to offer,
4418+
and charge a fee for, acceptance of support, warranty, indemnity,
4419+
or other liability obligations and/or rights consistent with this
4420+
License. However, in accepting such obligations, You may act only
4421+
on Your own behalf and on Your sole responsibility, not on behalf
4422+
of any other Contributor, and only if You agree to indemnify,
4423+
defend, and hold each Contributor harmless for any liability
4424+
incurred by, or claims asserted against, such Contributor by reason
4425+
of your accepting any such warranty or additional liability.
4426+
4427+
END OF TERMS AND CONDITIONS
4428+
4429+
APPENDIX: How to apply the Apache License to your work.
4430+
4431+
To apply the Apache License to your work, attach the following
4432+
boilerplate notice, with the fields enclosed by brackets "[]"
4433+
replaced with your own identifying information. (Don't include
4434+
the brackets!) The text should be enclosed in the appropriate
4435+
comment syntax for the file format. We also recommend that a
4436+
file or class name and description of purpose be included on the
4437+
same "printed page" as the copyright notice for easier
4438+
identification within third-party archives.
4439+
4440+
Copyright [yyyy] [name of copyright owner]
4441+
4442+
Licensed under the Apache License, Version 2.0 (the "License");
4443+
you may not use this file except in compliance with the License.
4444+
You may obtain a copy of the License at
4445+
4446+
http://www.apache.org/licenses/LICENSE-2.0
4447+
4448+
Unless required by applicable law or agreed to in writing, software
4449+
distributed under the License is distributed on an "AS IS" BASIS,
4450+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4451+
See the License for the specific language governing permissions and
4452+
limitations under the License.
4453+
4454+
================================================================
4455+
42484456
github.com/minio/madmin-go/v3
42494457
https://github.com/minio/madmin-go/v3
42504458
----------------------------------------------------------------
@@ -8109,7 +8317,7 @@ https://github.com/safchain/ethtool
81098317
same "printed page" as the copyright notice for easier
81108318
identification within third-party archives.
81118319

8112-
Copyright {yyyy} {name of copyright owner}
8320+
Copyright (c) 2015 The Ethtool Authors
81138321

81148322
Licensed under the Apache License, Version 2.0 (the "License");
81158323
you may not use this file except in compliance with the License.

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ PWD := $(shell pwd)
22
GOPATH := $(shell go env GOPATH)
33
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
44

5-
GOARCH ?= $(shell go env GOARCH)
6-
GOOS ?= $(shell go env GOOS)
5+
TARGET_GOARCH ?= $(shell go env GOARCH)
6+
TARGET_GOOS ?= $(shell go env GOOS)
77

88
VERSION ?= $(shell git describe --tags)
99
TAG ?= "minio/mc:$(VERSION)"
@@ -64,7 +64,7 @@ verify:
6464
# Builds mc locally.
6565
build: checks
6666
@echo "Building mc binary to './mc'"
67-
@GO111MODULE=on GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -trimpath -tags kqueue --ldflags "$(LDFLAGS)" -o $(PWD)/mc
67+
@GO111MODULE=on GOOS=$(TARGET_GOOS) GOARCH=$(TARGET_GOARCH) CGO_ENABLED=0 go build -trimpath -tags kqueue --ldflags "$(LDFLAGS)" -o $(PWD)/mc
6868

6969
hotfix-vars:
7070
$(eval LDFLAGS := $(shell MC_RELEASE="RELEASE" MC_HOTFIX="hotfix.$(shell git rev-parse --short HEAD)" go run buildscripts/gen-ldflags.go $(shell git describe --tags --abbrev=0 | \
@@ -78,9 +78,9 @@ hotfix: hotfix-vars install ## builds mc binary with hotfix tags
7878
@sha256sum < ./mc.$(VERSION) | sed 's, -,mc.$(VERSION),g' > mc.$(VERSION).sha256sum
7979

8080
hotfix-push: hotfix
81-
@scp -q -r mc.$(VERSION)* [email protected]:~/releases/client/mc/hotfixes/linux-$(GOARCH)/archive/
82-
@scp -q -r mc.$(VERSION)* [email protected]:~/releases/client/mc/hotfixes/linux-$(GOARCH)/archive/
83-
@echo "Published new hotfix binaries at https://dl.min.io/client/mc/hotfixes/linux-$(GOARCH)/archive/mc.$(VERSION)"
81+
@scp -q -r mc.$(VERSION)* [email protected]:~/releases/client/mc/hotfixes/$(TARGET_GOOS)-$(TARGET_GOARCH)/archive/
82+
@scp -q -r mc.$(VERSION)* [email protected]:~/releases/client/mc/hotfixes/$(TARGET_GOOS)-$(TARGET_GOARCH)/archive/
83+
@echo "Published new hotfix binaries at https://dl.min.io/client/mc/hotfixes/$(TARGET_GOOS)-$(TARGET_GOARCH)/archive/mc.$(VERSION)"
8484

8585
docker-hotfix-push: docker-hotfix
8686
@docker push -q $(TAG) && echo "Published new container $(TAG)"

cmd/client-s3.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,7 @@ func (c *S3Client) objectInfo2ClientContent(bucket string, entry minio.ObjectInf
22952295
setChecksum("CRC32C", entry.ChecksumCRC32C)
22962296
setChecksum("SHA1", entry.ChecksumSHA1)
22972297
setChecksum("SHA256", entry.ChecksumSHA256)
2298+
setChecksum("CRC64NVME", entry.ChecksumCRC64NVME)
22982299
return content
22992300
}
23002301

cmd/client.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,16 @@ func (config *Config) initTransport(withS3v2 bool) {
372372
// return nil, probe.NewError(e)
373373
// }
374374
}
375-
transport = tr
375+
376+
if len(globalCustomHeader) > 0 {
377+
transport = &headerTransport{
378+
RoundTripper: tr,
379+
customHeader: globalCustomHeader.Clone(),
380+
}
381+
} else {
382+
transport = tr
383+
}
384+
376385
}
377386

378387
transport = limiter.New(config.UploadLimit, config.DownloadLimit, transport)
@@ -399,3 +408,15 @@ type SelectObjectOpts struct {
399408
OutputSerOpts map[string]map[string]string
400409
CompressionType minio.SelectCompressionType
401410
}
411+
412+
type headerTransport struct {
413+
http.RoundTripper
414+
customHeader http.Header
415+
}
416+
417+
func (h *headerTransport) RoundTrip(request *http.Request) (*http.Response, error) {
418+
for k, v := range h.customHeader {
419+
request.Header[k] = v
420+
}
421+
return h.RoundTripper.RoundTrip(request)
422+
}

cmd/flags.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ var globalFlags = []cli.Flag{
9696
Hidden: true,
9797
Value: 10 * time.Minute,
9898
},
99+
cli.StringSliceFlag{
100+
Name: "custom-header,H",
101+
Usage: "add custom HTTP header to the request. 'key:value' format.",
102+
},
99103
}
100104

101105
// bundled encryption flags
@@ -124,7 +128,7 @@ var encS3Flag = cli.StringSliceFlag{
124128

125129
var checksumFlag = cli.StringFlag{
126130
Name: "checksum",
127-
Usage: "Add checksum to uploaded object. Values: MD5, CRC32, CRC32C, SHA1 or SHA256. Requires server trailing headers (AWS, MinIO)",
131+
Usage: "Add checksum to uploaded object. Values: CRC64NVME, CRC32, CRC32C, SHA1 or SHA256. Requires server trailing headers (AWS, MinIO)",
128132
Value: "",
129133
}
130134

@@ -136,14 +140,20 @@ func parseChecksum(ctx *cli.Context) (useMD5 bool, ct minio.ChecksumType) {
136140
ct = minio.ChecksumCRC32
137141
case "CRC32C":
138142
ct = minio.ChecksumCRC32C
143+
case "CRC32-FO":
144+
ct = minio.ChecksumFullObjectCRC32
145+
case "CRC32C-FO":
146+
ct = minio.ChecksumFullObjectCRC32C
139147
case "SHA1":
140148
ct = minio.ChecksumSHA1
141149
case "SHA256":
142150
ct = minio.ChecksumSHA256
151+
case "CRC64N", "CRC64NVME":
152+
ct = minio.ChecksumCRC64NVME
143153
case "MD5":
144154
useMD5 = true
145155
default:
146-
err := fmt.Errorf("unknown checksum type: %s. Should be one of MD5, CRC32, CRC32C, SHA1 or SHA256", cs)
156+
err := fmt.Errorf("unknown checksum type: %s. Should be one of CRC64NVME, MD5, CRC32, CRC32C, SHA1 or SHA256", cs)
147157
fatalIf(probe.NewError(err), "")
148158
}
149159
if ct.IsSet() {

cmd/globals.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"crypto/x509"
2424
"fmt"
2525
"net"
26+
"net/http"
2627
"net/netip"
2728
"net/url"
2829
"os"
@@ -36,6 +37,7 @@ import (
3637
"github.com/minio/madmin-go/v3"
3738
"github.com/minio/pkg/v3/console"
3839
"github.com/muesli/termenv"
40+
"golang.org/x/net/http/httpguts"
3941
)
4042

4143
const (
@@ -90,6 +92,8 @@ var (
9092
globalLimitDownload uint64
9193

9294
globalContext, globalCancel = context.WithCancel(context.Background())
95+
96+
globalCustomHeader http.Header
9397
)
9498

9599
var (
@@ -200,5 +204,23 @@ func setGlobalsFromContext(ctx *cli.Context) error {
200204
globalResolvers[host] = addr
201205
}
202206
}
207+
208+
customHeaders := ctx.StringSlice("custom-header")
209+
if len(customHeaders) > 0 {
210+
globalCustomHeader = make(http.Header)
211+
for _, header := range customHeaders {
212+
i := strings.IndexByte(header, ':')
213+
if i <= 0 {
214+
return fmt.Errorf("invalid custom header entry %s", header)
215+
}
216+
h := strings.TrimSpace(header[:i])
217+
hv := strings.TrimSpace(header[i+1:])
218+
if !httpguts.ValidHeaderFieldName(h) || !httpguts.ValidHeaderFieldValue(hv) {
219+
return fmt.Errorf("invalid custom header entry %s", header)
220+
}
221+
globalCustomHeader.Add(h, hv)
222+
}
223+
}
224+
203225
return nil
204226
}

0 commit comments

Comments
 (0)