cURL / Mailing Lists / curl-library / Single Mail

curl-library

Binary or control characters in test files

From: Patrick Monnerat <Patrick.Monnerat_at_datasphere.ch>
Date: Wed, 17 Oct 2007 21:08:46 +0200

I'm currently considering new test cases for CURLOPT_POSTFIELDS and
CURLOPT_COPYPOSTFIELDS with data embedding NUL bytes. This requires to
enter these NUL bytes in the test files, that IMHO should stay text
files and not become considered as binary.
 
This is feasible, but I think it is bad, because strange things may
occur with those kind of bytes when regarding them as text: There is
already a minor problem with the trailing CRs when using cygwin in
Unix-endline mode in conjunction with a Windows CVS program
(TortoiseCVS): the later checkouts in M$ style (CRLF) while the former
expects \n endlines. Issuing the command "find . -type f | xargs
dos2unix" before ./buildconf should do it, but dos2unix strips all CRs
before the LF --> tests using trailing CRs are not working anymore.
 
Well: there should be a way to code special byte values in the test
files to avoid such strange behavior and improve their real text form.
Since they look like XML, I would propose something like "entities"
("&cr;", "&nul;" or "&#x00;") or a tag "<byte code="hex-value" />" that
would be substituted in the whole loaded document before considering
other tags. But there may be other solutions.
 
Nevertheless I'm not a perl programmer, thus I do not only request your
opinion, but also your action.
 
Thanks
Received on 2007-10-17