Skip to content

Support HTTP range requests #2

@MichaelKreil

Description

@MichaelKreil

Summary

Add support for HTTP Range requests to enable partial content delivery.

Current State

  • The codebase has internal range support in createReadStream() methods (used for reading tile data from .versatiles files)
  • However, HTTP Range request headers from clients are not being handled
  • The server always returns 200 with full content, never 206 Partial Content

What's Missing

  • Parse the Range header from incoming requests
  • Respond with 206 Partial Content status for valid range requests
  • Set Content-Range header (e.g., bytes 0-999/5000)
  • Set Accept-Ranges: bytes header on responses
  • Stream only the requested byte range from the file

Use Cases

  • Video/audio streaming
  • Resumable downloads of large files
  • PDF viewers requesting partial content

Relevant Files

  • src/lib/responder.ts - needs to handle Range header parsing and 206 responses
  • src/lib/bucket/abstract.ts - createReadStream() already supports { start, end } options
  • src/lib/bucket/bucket_google.ts - passes range options to Google Cloud Storage
  • src/lib/bucket/bucket_local.ts - passes range options to fs.createReadStream()

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions