This PR fixes the handling of null bytes in CurlCommandFormatter. Up to now, an exception is thrown in escapeshellarg. In addition, non-seekable streams get formatted in the same manner.
Example Usage
Requests containing null bytes are formatted as follows:
curl 'http://foo.com/bar' --request POST --data '[binary stream omitted]'
Checklist
[x] Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
To Do
[ ] At the moment, as soon as any control character (including \n) is detected, the payload is omitted. If we want to keep them we would probably have to implement platform-dependent escaping routines to output a one-liner. escapeshellarg() doesn't help as it would just pass all control characters (except \0). An example of such routines can be found in Chromium.
[ ] Should we limit the size of the body too? I think it's rarely useful to dump megabytes of data even if there are no null bytes.
What's in this PR?
This PR fixes the handling of null bytes in
CurlCommandFormatter
. Up to now, an exception is thrown inescapeshellarg
. In addition, non-seekable streams get formatted in the same manner.Example Usage
Requests containing null bytes are formatted as follows:
Checklist
To Do
escapeshellarg()
doesn't help as it would just pass all control characters (except \0). An example of such routines can be found in Chromium.