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

Read request body asynchronously #7

Closed
sagebind opened this issue Aug 29, 2018 · 1 comment
Closed

Read request body asynchronously #7

sagebind opened this issue Aug 29, 2018 · 1 comment
Milestone

Comments

@sagebind
Copy link
Owner

In the new async core implementation, one thread is responsible for driving all of curl's functions. This includes streaming the request body. If the request body is not in memory and attempting to read from it blocks, then the entire agent thread is blocked and all requests will be effectively paused. This is obviously not good.

Devise a way to guarantee the ability to read the response body without blocking. Once we can do that, we can implement this in the following manner:

  • In the read callback, attempt to read without blocking. If the input stream would block, pause the request.
  • When the input stream becomes ready, unpause the request.

We should use well-established means of async I/O if possible. For example, if the input stream is a file, reading a file asynchronously is a can of worms not worth the effort (AIO, IOCP, thread pools).

One possible solution would be to simply copy the entire request body into memory up front.

@sagebind sagebind modified the milestone: Async refactor Aug 29, 2018
@sagebind sagebind mentioned this issue May 14, 2019
8 tasks
@sagebind sagebind added this to the 0.5 milestone Jun 4, 2019
@sagebind
Copy link
Owner Author

This has been implemented in #27 and now merged into master.

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

No branches or pull requests

1 participant