Skip to content

Added "Transfer-Encoding:Chunked" support when your content length is unpredictable. #690

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

Closed
wants to merge 3 commits into from

Conversation

berkanuslu
Copy link

When you're working with streams, especially if different threads control this stream, you might not know content-length, but you can transfer your data with Transfer-Encoding: Chunked. It has been implemented based on https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html documentation. I have created an example for transferring your data with chunked. Also, I have added an example of a download file from the internet with the content receiver and ofstream.

Berkan Uslu added 3 commits October 9, 2020 13:41
ADDED Missing ContentReceiver, ResponseHandler, Progress implementation to send_with_content_provider function.
CHANGED Some passing arguments with std::move.
@berkanuslu berkanuslu marked this pull request as draft October 10, 2020 15:01
@evg82
Copy link
Contributor

evg82 commented Oct 10, 2020

Awesome! I ask for this function some days ago. I will try it tomorrow becose i have all my app code ready to use it.

@yhirose
Copy link
Owner

yhirose commented Oct 11, 2020

@berkanuslu, thanks for your pull request. However, I feel the pull request is too big to merge for me. Also I did quick check and I have already found two problems:

So I am not planning to merge it anytime soon though, at least I understand demand of chunked transfer encoding on client side in addition to the existing server side implementation (https://github.com/yhirose/cpp-httplib#chunked-transfer-encoding). Anyway, thanks for your contribution!

@berkanuslu berkanuslu closed this Oct 11, 2020
@berkanuslu
Copy link
Author

@yhirose, thanks for your reply. I don't know what breaks the KeepAlive unit test, but I'm working on fixing this. I just wanted to share this code blocks with the community. But you're right, and it's a little bit big to merge it. It's up to you. By the way, I have closed the pull request. I will split it into a small piece of pull requests.

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

Successfully merging this pull request may close these issues.

3 participants