Skip to content

Hurl debug curl command are not valid when request binary body contains NUL (\x00) char #5141

Description

@jcamiel

Given this Hurl file:

POST http://localhost:8000/post-bytes-null
Content-Type: application/octet-stream
base64,AAECAw==;  # printf '\x00\x01\x02\x03' | base64
HTTP 200

The request body sent is \x00\x01\x02\x03 but the curl command produced by Hurl (with --verbose or --curl) is:

$ curl --header 'Content-Type: application/octet-stream' --data $'\x00\x01\x02\x03' 'http://localhost:8000/post-bytes-null'

Because of the way of bash treats NUL-C terminated string, this does not work.

In this case (and only in this case), we could print the following curl command:

$ printf '\x00\x01\x02\x03' | curl --header 'Content-Type: application/octet-stream' --data-binary @- 'http://localhost:8000/post-bytes-null'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions