Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cURL command with data beginning with - passed using printf doesn't work #8050

@roundedrectangle

Description

@roundedrectangle

Problem Description

When copying a cURL command, sometimes it puts a printf call in the -d flag, like this:
-d "$(printf '---other-data')"

But as in the example upper, like this it would show the following error:

bash: printf: --: invalid option

To fix, it would be needed to modify the part to be -d "$(printf -- '---other-data')", so, put a -- after the printf command.

Steps to reproduce

  1. Get an appropriate HTTP request in MitmProxy Web UI (I am not sure if this apples to CLI as well)
  2. Try to copy the request as a cURL command
  3. Run the copied command
  4. Expected result: command runs successfully, actual result: shows the bash: printf: --: invalid option (or, if the argument started with a single dash followed by a letter, that sequence instead of --)

System Information

Mitmproxy: 12.2.1 binary
Python:    3.14.0
OpenSSL:   OpenSSL 3.5.4 30 Sep 2025
Platform:  Linux-6.18.5-200.fc43.x86_64-x86_64-with-glibc2.42

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions