-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: full range header support #141
Conversation
f2657ce
to
6a4bdac
Compare
Deploying with Cloudflare Pages
|
6a4bdac
to
dc18d81
Compare
packages/api/src/perma-cache/get.js
Outdated
if (r2Object) { | ||
return new Response(r2Object.body) | ||
return new Response(r2Object.body, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs Content-Range
header e.g. https://github.com/nftstorage/dagcargo-bucket/blob/899070ab67ed2fd39cd1c2f02aad299a179af7e9/src/worker.js#L58
Needs Content-Length
header e.g. https://github.com/nftstorage/dagcargo-bucket/blob/899070ab67ed2fd39cd1c2f02aad299a179af7e9/src/worker.js#L59
packages/api/src/perma-cache/get.js
Outdated
const parts = encoded.split('bytes=')[1]?.split('-') ?? [] | ||
if (parts.length !== 2) { | ||
throw new InvalidRangeError( | ||
'Not supported to skip specifying the beginning/ending byte at this time' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can maybe use this: https://github.com/nftstorage/dagcargo-bucket/blob/main/src/r2.js
dc18d81
to
906b537
Compare
5cd00ff
to
44eb2ab
Compare
dedae51
to
ab25929
Compare
[cache.match(request.url), getFromPermaCache(request, env)], | ||
[ | ||
cache.match(request), // Request from cache API | ||
cache.match(request.url), // Request URL from cache API - To be deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to have this for sometime until cache LRU cycles. Let's say 24H?
ab25929
to
c11d12d
Compare
c11d12d
to
bf813c4
Compare
This PR adds range header support to both content requested to Cache API, as well as from perma cache. The headers already go to the race as well, so race already does range
Needs:
Closes #77