Skip to content

http: add metadata defaults for --http-no-head - #9648

Merged
ncw merged 3 commits into
rclone:masterfrom
giri256:fix/http-no-head-defaults-7988
Oct 18, 2026
Merged

ncw merged 3 commits into
rclone:masterfrom
giri256:fix/http-no-head-defaults-7988

Conversation

@giri256

@giri256 giri256 commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Adds two advanced HTTP backend options for use with --http-no-head:

  • --http-no-head-size reports a configured size for every file instead of the usual unknown size. Its default is -1 (unknown), while any non-negative value—including 0—is reported as authoritative.
  • --http-no-head-time reports a configured modification time instead of the Unix epoch sentinel.

Both options preserve current behavior when left unset. The values are applied in the common no-HEAD metadata path, so they cover both directory listings and direct object lookup.

The size option's help now calls out that an incorrect fixed size can cause transfer size-check failures/retries, incorrect multi-thread ranges, and mount reads being limited at the reported size. The time option notes that changing it later makes every file appear modified to a sync.

Verification

  • go test ./backend/http -count=1
  • go vet ./backend/http
  • golangci-lint run ./backend/http/... with zero findings
  • git diff --check

Focused tests cover the default unknown size, an explicit zero-byte size, and configured size/time metadata.

Fixes #7988

@giri256
giri256 requested a review from ncw as a code owner July 22, 2026 17:49

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put some minor concerns inline - otherwise looks great - thank you.

Comment thread backend/http/http.go Resolved
Comment thread backend/http/http.go Resolved
Comment thread backend/http/http.go Resolved
@giri256

giri256 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

All requested changes are addressed in 6328fd613: -1 is now the unknown-size default while explicit zero remains valid, the fixed-size risks are documented, and the configured-time sync caveat is documented. Focused tests, go vet, golangci-lint, and git diff --check all pass. Ready for re-review.

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great now - thank you.

I have a minor thing that needs fixing - see inline - then I can merge

Thank you :-)

Comment thread backend/http/http.go Outdated

When HEAD requests are disabled, rclone normally reports an unknown file size.
Set this option to a non-negative value to report that size for every file,
including 0. Leave it at -1 to keep reporting an unknown size.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should say "Leave it unset (the default, shown as "off") to keep reporting an unknown size"

As you can't actually set an fs.SizeSuffix value to -1

@ncw

ncw commented Oct 14, 2026

Copy link
Copy Markdown
Member

Hi @giri256, a gentle nudge on this one. It's only one line away from merging: the no_head_size help says "Leave it at -1", but a SizeSuffix can't be set to -1, so it should say something like "Leave it unset (the default, shown as "off") to keep reporting an unknown size".

If you'd rather, I can make that change when I merge. Just say so. Thanks!

@giri256

giri256 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the nudge, and sorry for the delay. Fixed in abcf0ffe0: the help now says "Leave it unset (the default, shown as "off") to keep reporting an unknown size."

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you - looks great now :-)

@ncw
ncw merged commit f43a214 into rclone:master Oct 18, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need option for setting returned file size when using HTTP filesystem with --http-no-head

2 participants