mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:21:41 +03:00
http: expect 100 rework
Move all handling of HTTP's `Expect: 100-continue` feature into a client reader. Add sending flag `KEEP_SEND_TIMED` that triggers transfer sending on general events like a timer. HTTP installs a `CURL_CR_PROTOCOL` reader when announcing `Expect: 100-continue`. That reader works as follows: - on first invocation, records time, starts the `EXPIRE_100_TIMEOUT` timer, disables `KEEP_SEND`, enables `KEEP_SEND_TIMER` and returns 0, eos=FALSE like a paused upload. - on subsequent invocation it checks if the timer has expired. If so, it enables `KEEP_SEND` and switches to passing through reads to the underlying readers. Transfer handling's `readwrite()` will be invoked when a timer expires (like `EXPIRE_100_TIMEOUT`) or when data from the server arrives. Seeing `KEEP_SEND_TIMER`, it will try to upload more data, which triggers reading from the client readers again. Which then may lead to a new pausing or cause the upload to start. Flags and timestamps connected to this have been moved from `SingleRequest` into the reader's context. Closes #13110
This commit is contained in:
parent
3d0fd382a2
commit
80a3b830cc
17 changed files with 301 additions and 189 deletions
17
lib/sendf.h
17
lib/sendf.h
|
|
@ -208,6 +208,8 @@ struct Curl_crtype {
|
|||
struct Curl_creader *reader, curl_off_t offset);
|
||||
CURLcode (*rewind)(struct Curl_easy *data, struct Curl_creader *reader);
|
||||
CURLcode (*unpause)(struct Curl_easy *data, struct Curl_creader *reader);
|
||||
void (*done)(struct Curl_easy *data,
|
||||
struct Curl_creader *reader, int premature);
|
||||
size_t creader_size; /* sizeof() allocated struct Curl_creader */
|
||||
};
|
||||
|
||||
|
|
@ -256,6 +258,8 @@ CURLcode Curl_creader_def_rewind(struct Curl_easy *data,
|
|||
struct Curl_creader *reader);
|
||||
CURLcode Curl_creader_def_unpause(struct Curl_easy *data,
|
||||
struct Curl_creader *reader);
|
||||
void Curl_creader_def_done(struct Curl_easy *data,
|
||||
struct Curl_creader *reader, int premature);
|
||||
|
||||
/**
|
||||
* Convenience method for calling `reader->do_read()` that
|
||||
|
|
@ -361,6 +365,19 @@ CURLcode Curl_creader_resume_from(struct Curl_easy *data, curl_off_t offset);
|
|||
*/
|
||||
CURLcode Curl_creader_unpause(struct Curl_easy *data);
|
||||
|
||||
/**
|
||||
* Tell all client readers that they are done.
|
||||
*/
|
||||
void Curl_creader_done(struct Curl_easy *data, int premature);
|
||||
|
||||
/**
|
||||
* Look up an installed client reader on `data` by its type.
|
||||
* @return first reader with that type or NULL
|
||||
*/
|
||||
struct Curl_creader *Curl_creader_get_by_type(struct Curl_easy *data,
|
||||
const struct Curl_crtype *crt);
|
||||
|
||||
|
||||
/**
|
||||
* Set the client reader to provide 0 bytes, immediate EOS.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue