Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Signal content length to upstream components when present #42

Merged
merged 2 commits into from
Aug 9, 2023

Conversation

masih
Copy link
Member

@masih masih commented Aug 8, 2023

When the HTTP request contains Content-Length header, include it in the body reader passed down to upstream system components. This is to enable further optimisations during processing when the total size of a blob is known beforehand. Examples include piece selection in order to guarantee that a blob will be fully contained within a piece.

With changes introduced, an upstream component may type-check for interface { Size() int64 } and use it to then gain access to the content length.

Note that based on HTTP standards, application/octet-stream content type is not strictly required to specify Content-Length header. Hence the opportunistic signalling via type-checkers.

When the HTTP request contains `Content-Length` header, include it in
the body reader passed down to upstream system components. This is to
enable further optimisations during processing when the total size of a
blob is known beforehand. Examples include piece selection in order to
guarantee that a blob will be fully contained within a piece.

With changes introduced, an upstream component may type-check for
`interface { Size() int64}` and use it to then gain access to the
content length.

Note that based on HTTP standards, `application/octet-stream` content
type is not strictly required to specify `Content-Length` header. Hence
the opportunistic signalling via type-checkers.
The Azure mirrors seem to be intermittently unavailable. This causes
build failure during CI setup steps while installing C libraries
required by filecoin-ffi.

To mitigate the issue, explicitly run `apt-get update` to get the list
of latest package mirrors.
@masih masih merged commit 8fb60b6 into main Aug 9, 2023
17 checks passed
@masih masih deleted the masih/content-lenth-signalling branch August 9, 2023 08:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants