bugfix/607-support_trailer_headers #620

Merged
alexvanin merged 5 commits from dkirillov/frostfs-s3-gw:bugfix/607-support_trailer_headers into master 2025-02-04 11:50:32 +00:00
Member

close #607

close #607
dkirillov self-assigned this 2025-02-03 15:27:00 +00:00
dkirillov added 5 commits 2025-02-03 15:27:00 +00:00
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
[#607] Support sigV4a streaming with trailers
All checks were successful
/ DCO (pull_request) Successful in 32s
/ Vulncheck (pull_request) Successful in 1m6s
/ Builds (pull_request) Successful in 1m34s
/ OCI image (pull_request) Successful in 2m2s
/ Lint (pull_request) Successful in 2m10s
/ Tests (pull_request) Successful in 1m17s
/ Vulncheck (push) Successful in 1m6s
/ Builds (push) Successful in 1m6s
/ Lint (push) Successful in 1m57s
/ Tests (push) Successful in 1m20s
/ OCI image (push) Successful in 2m10s
a53e50b324
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
dkirillov changed title from WIP: bugfix/607-support_trailer_headers to bugfix/607-support_trailer_headers 2025-02-04 06:22:01 +00:00
requested reviews from storage-services-committers, storage-services-developers 2025-02-04 06:22:01 +00:00
alexvanin reviewed 2025-02-04 09:59:41 +00:00
@ -172,0 +203,4 @@
}
switch {
case slices.Contains(c.trailerHeaders, string(k[:len(k)-1])):
Owner

Can we assume that k always has at least the length of one, so this code will never panic?

Can we assume that `k` always has at least the length of one, so this code will never panic?
Author
Member

Yes. The following code should prevent as from panic

k, err = c.reader.ReadBytes(':')
if err != nil {
if err == io.EOF {
break
}
c.err = errMalformedTrailerHeaders
return c.err
}

we got error if we couldn't meet : that lead to breaking the loop

Yes. The following code should prevent as from panic https://git.frostfs.info/dkirillov/frostfs-s3-gw/src/commit/a53e50b324d9d335ab89d290dbfee4256db0ef1e/api/handler/s3v4aReader.go#L187-L194 we got error if we couldn't meet `:` that lead to breaking the loop
@ -172,0 +206,4 @@
case slices.Contains(c.trailerHeaders, string(k[:len(k)-1])):
c.buffer = append(append(c.buffer, k...), v...) // todo use copy
case string(k) == "x-amz-trailer-signature:":
n, err := hex.Decode(v[:], bytes.TrimRight(v[:], "*\n"))
Owner

Didn't know bytes.TrimRight supports wildcard * 👍

Didn't know `bytes.TrimRight` supports wildcard `*` 👍
Author
Member

It doesn't. It's literally * character

It doesn't. It's literally `*` character
Owner

Hm, wait, is it some kind of a wildcard or just a *?

Hm, wait, is it some kind of a wildcard or just a `*`?
Author
Member

Just *

Just `*`
alexvanin approved these changes 2025-02-04 11:48:50 +00:00
alexvanin merged commit a53e50b324 into master 2025-02-04 11:50:32 +00:00
alexvanin deleted branch bugfix/607-support_trailer_headers 2025-02-04 11:50:38 +00:00
alexvanin added this to the v0.32.5 milestone 2025-02-04 11:51:33 +00:00
alexvanin modified the milestone from v0.32.5 to v0.33.0 2025-02-04 11:51:37 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#620
No description provided.