Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Add support for HTTP range requests #13

Open
mbitsnbites opened this issue Oct 8, 2019 · 0 comments
Open

Add support for HTTP range requests #13

mbitsnbites opened this issue Oct 8, 2019 · 0 comments

Comments

@mbitsnbites
Copy link
Owner

HTTP range requests are useful for reading only a part of a large file (e.g. for skipping ahead in a long video stream).

In order to check if we can do range requests we need to probe the server for its capabilities (e.g. accept-ranges) via a HEAD request that is issued before the actual GET/PUT request.

We also need to add the option to specify a range to the API (the us3_open() signature is growing - consider adding some opt-in options API). For example:

void foo() {
  us3_options_t options = us3_create_options(...);
  us3_set_optioni(options, US3_RANGE_START, 1234);

  us3_handle_t handle = us3_open(..., options);  /* The "options" arg can be NULL */
  us3_delete_options(options);
  ...
  us3_close(handle);
}

...or figure out a way to avoid the create/delete steps for the us3_options_t handle.

If we do not want to support inter-version compatibility for clients and shared libraries, we can define a us3_options_t struct in us3.h, but it's less robust (e.g. it needs to be initialized before passing it to us3_open, e.g. with memset() or an explicit call to us3_init_options()).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant