cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Binary or control characters in test files

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 17 Oct 2007 13:00:48 -0700

On Wed, Oct 17, 2007 at 09:08:46PM +0200, Patrick Monnerat wrote:
> 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.

It's clear these cases are needed!

> 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.

The CR issue is the biggest one preventing the test data files from being
true XML files.

> 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.

There already is a method--the base64 attribute. It's only used for
the compression tests right now (tests 220..224) since zlib data streams
are guaranteed to have at one NUL byte. With base64="yes" the data is
stored in the test data file base64 encoded. There might be enough
support in there to handle binary POST test cases, but I doubt the test
harness currently supports base64="yes" absolutely everywhere.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-10-17