Skip to content
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

Send static files as chunks using IO::Handle.Supply #106

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lukasvalle
Copy link

The intention of this PR is to show, that cro-http and the IO::Handle.Supply core functionality would work nice together to implement something similar to sendfile_max_chunk in nginx to reduce memory consumption when delivering large files.

This PR includes:

  • test for Content-length for static served files for the existing implementation
  • test for Content-length and content for chunk served files
  • a named parameter chunk_size for the static sub
  • a named parameter content_length for Supply BodySerializer and the Router content method to set the content_length header field for chunk deliverd content

…ould reduce memory usage when serving large files. Using Supply is a common pattern in cro in general. The rakudo default size makes the downloads a lot slower than server it from memory. 1MB is better. But what would be a sensible size for the chunks?
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.

1 participant