cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: POSTing binary data doesn't work in 7.43.0

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 23 Jun 2015 15:28:44 +0200 (CEST)

On Mon, 22 Jun 2015, Stefan Bühler wrote:

> we use CURLOPT_POSTFIELDSIZE_LARGE and CURLOPT_POSTFIELDS to set the POST
> request body.
>
> With 7.43.0 it seems to ignore the size and to use strlen() instead (i.e. it
> cuts the body after the first null byte).

Maybe not that simple. I tried this little patch below on test 578, making
sure that there is a binary zero in the middle of the POST data. However, this
still works as supposed and no error is reported.

Can you provide a simple stand-alone example that repeats the problem?

diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c
index a39b317..3211c37 100644
--- a/tests/libtest/lib578.c
+++ b/tests/libtest/lib578.c
@@ -22,11 +22,11 @@
  #include "test.h"

  #include "memdebug.h"

  /* The size of data should be kept below MAX_INITIAL_POST_SIZE! */
-static char data[]="this is a short string.\n";
+static char data[]="this is a short\0 string\n";

  static size_t data_size = sizeof(data) / sizeof(char);

  static int progress_callback(void *clientp, double dltotal, double dlnow,
double ultotal, double ulnow)
  {

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-06-23