cURL / Mailing Lists / curl-library / Single Mail

curl-library

Suggestion for curl_formadd()

From: Wolf Ihlenfeldt <wdi_at_xemistry.com>
Date: Wed, 27 Aug 2014 18:09:37 +0200

Hi everybody,

thanks for supplying this great library.

Recently I have come across a problem (V 7.37.1) in curl_formadd()
which could be avoided without too much effort.

I am sending binary data without zero terminator bytes in fields, so I
set CURLFORM_CONTENTSLENGTH. Sometimes this data can be of
size 0 - I want to see an empty form field in the transmitted data in
that case. However, in the current implementation, size 0 is also the
value indicating an unset content length, so instead garbage is
transmitted until the first random zero byte is hit. I am now checking
for this condition beforehand and use an empty "" string in these
cases and thus
circumvent this problem. But I think for the sake of consistency and
ease of use, it might be a good idea to change the internal "unset" default
value to something like -1, so that you can explicitly set a zero
field data length.

-- 
Wolf-D. Ihlenfeldt -  Xemistry GmbH - wdi_at_xemistry.com
Phone: +49 6174 201455 - Fax +49 6174 209665
---
xemistry gmbh – Geschäftsführer/Managing Director: Dr. W. D. Ihlenfeldt
Address: Hainholzweg 11, D-61462 Königstein, Germany
HR Königstein B7522 : Ust/VAT ID DE215316329 : DUNS 34-400-1719
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-27