-
Notifications
You must be signed in to change notification settings - Fork 1
Add support for HTTP range requests #13
Description
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()).