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 part 4, resume+rewind #13026

Closed
wants to merge 13 commits into from
Closed

Send part 4, resume+rewind #13026

wants to merge 13 commits into from

Conversation

icing
Copy link
Contributor

@icing icing commented Mar 1, 2024

On top of #13010:

  • update client reader documentation
  • client reader, add rewind capabilities
    • tell creader to rewind on next start
    • Curl_client_reset() will keep reader for future rewind if requested
    • add Curl_client_cleanup() for freeing all resources independent of rewinds
    • add Curl_client_start() to trigger rewinds
    • move rewind code from multi.c to sendf.c and make part of "cr-in"'s implementation
  • http, move the "resume_from" handling into the client readers
    • the setup of a HTTP request is reshuffled to follow:
      • determine method, target, auth negotiation
      • install the client reader(s) for the request, including crlf conversions and "chunked" encoding
      • apply ranges to client reader
      • concat request headers, upgrades, cookies, etc.
      • complete request by determining Content-Length of installed readers in combination with method
      • send
    • add methods for client readers to
      • return the overall length they will generate (or -1 when unknown)
      • return the amount of data on the CLIENT level, so that expect-100 can decide if it want to apply itself
      • set a "resume_from" offset or fail if unsupported
    • struct HTTP has become largely empty now
  • rename Client_reader_* to Curl_creader_*

icing added 12 commits March 4, 2024 09:25
- total_length() calls down the reader chain, delivers -1
  when length is not known
- encoding readers, which change length, will intercept this
  and return -1
- use `Curl_creader_total_length(data)` when evaluating
  rewind decisions
- the setup of a HTTP request is reshuffled to follow:
  * determine method, target, auth negotiation
  * install the client reader(s) for the request, including
    crlf conversions and "chunked" encoding
  * apply ranges to client reader
  * concat request headers, upgrades, cookies, etc.
  * complete request by determining Content-Length of
    installed readers in combination with method
  * send
- add methods for client readers to
  * return the overall length they will generate (or -1
    when that is not known)
  * return the amount of data on the CLIENT level, so that
    expect-100 can decide if it want to apply itself
  * set a "resume_from" offset or fail if unsupported
- struct HTTP has become largely empty now
- tell creader to rewind on next start
- Curl_client_reset() will keep reader for future rewind
  if requested
- add Curl_client_cleanup() for freeing all resources
  independent of rewinds
- add Curl_client_start() to trigger rewinds
- move rewind code from multi.c to sendf.c and make
  part of "cr-in"'s implementation
- when switching from POST to GET disable client rewinds as
  they will be no longer needed
- Client reader "cr_in": make a copy of fread_func and "in" data
  on creation and use those through the reader's lifetime.
  This allows a rewind to do the right thing on the old reader
  when a new request is starting, because data->state.fread_func
  is reset on entering the CONNECT state (very early).
…signed but never readfix ubuntu scanbuild, assigned but never readfix ubuntu scanbuild, assigned but never readfix ubuntu scanbuild, assigned but never readfix ubuntu scanbuild, assigned but never readfix ubuntu scanbuild, assigned but never readfix ubuntu scanbuild, assigned but never read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

1 participant