curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multipart POSTs with large bodies

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 12 Apr 2017 00:50:29 +0200 (CEST)

On Tue, 11 Apr 2017, Reese Grimsley via curl-library wrote:

> I need to send audio data in the second part of a multi-part POST over
> HTTP2, in which the data should be broken into "frames" of 320 bytes each. I
> am using the multi API, and have it set so that this connection is
> multiplexed with a few others. I am wondering if libcurl by default sends
> all data for the entire POST at one time, or if anything is broken up into
> smaller packets.

Well, it sends it all, but of course it sends the whole thing in a series of
"smaller packets".

> The documentation of the recipient suggests that the audio data is just
> going to be a stream encoded binary data, so I am led to believe that I am
> not uploading a file, just the set of data.

Is there a difference? A file is just data with a label on it, stored in a
file system.

> Is this sort of operation supported by formadd() and HTTPPOST?

I don't think I understand what you mean. You can create a multipart formpost
with curl_formadd() and such a formpost can be sent by libcurl... If you can
clarify exactly what you need or want the formposts part to contain or look
like, I can help you do the right formadd.

> Otherwise I will need to set up the POST field, and use the
> POSTFIELDSIZE_LARGE option, correct?

If you rather construct the request body yourself, yes.

> The data to upload will most likely be in the range of 100kB to 1MB. My
> main question is how to send a ensure that a POST message is sent piece by
> piece.

It does (without getting into the exact specifics since I believe you want the
simplified answer here), but you don't have to care about that as it doesn't
matter for an application. It's HTTP and TCP after all and libcurl will send
the data you ask it to send. libcurl can't send "all data at once". Data is
sent and delivered one bit at a time over the wire.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-04-12