cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to POST binary data with libcurl?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 26 Jul 2006 23:27:17 +0200 (CEST)

On Wed, 26 Jul 2006, Tillmann Steinbrecher wrote:

> curl_formadd(&post, &last,
> CURLFORM_COPYNAME, "mydata",
> CURLFORM_PTRCONTENTS, "test\0test",
> CURLFORM_CONTENTSLENGTH, 9,
> CURLFORM_END);
>
> -> 4 bytes are posted, but not 9

I just built a test application using exactly this snippet. Worked exactly
like documented, and sent the 9 bytes fine:

=> Send data, 150 bytes (0x96)
0000: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 64 35 --------------d5
0020: 66 34 30 63 31 30 63 39 32 66 0d 0a 43 6f 6e 74 f40c10c92f..Cont
0030: 65 6e 74 2d 44 69 73 70 6f 73 69 74 69 6f 6e 3a ent-Disposition:
0040: 20 66 6f 72 6d 2d 64 61 74 61 3b 20 6e 61 6d 65 form-data; name
0050: 3d 22 6d 79 64 61 74 61 22 0d 0a 0d 0a 74 65 73 ="mydata"....tes
0060: 74 00 74 65 73 74 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d t.test..--------
0070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0080: 2d 2d 2d 2d 2d 2d 64 35 66 34 30 63 31 30 63 39 ------d5f40c10c9
0090: 32 66 2d 2d 0d 0a 2f--..

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-07-26