JosephP91 / curlcpp

An object oriented C++ wrapper for CURL (libcurl)
https://josephp91.github.io/curlcpp
MIT License
630 stars 174 forks source link

can support Streamed requests? #108

Closed zuowanbushiwo closed 4 years ago

zuowanbushiwo commented 7 years ago

I want to use streams in a program I am writing, like java okhttp3, can you support?

JosephP91 commented 7 years ago

Can you provide more informations about what are you trying to do and what do you mean by streamed requests?

zuowanbushiwo commented 7 years ago

Hi 👍
thanks very much! I want use HTTP/2 multiplexing , one connection Ceate multiple independent data streams and each data stream can be independent of the request and response。 When post request, create a data stream within the physical connection, send the request, and close the data flow after receiving the server response., like okhttp3 ,it RequestBody can be a StreamRequestBody which has a BufferedSink, when write data to BufferedSink ,it can auto post data to server before close it。like this:

public class StreamRequestBody extends RequestBody { private final Pipe pipe = new Pipe(8192); private final BufferedSink mSink = Okio.buffer(pipe.sink());

public BufferedSink sink() {
    return mSink;
}

} and write data like this: bufferedSink.write(recordAudioData);

thanks!!

JosephP91 commented 4 years ago

I think that you can use the curl_multi interface to implement what you described here.