Skip to content

Ignore stdin when STDIN is closed #660

@mqudsi

Description

@mqudsi

I ran into the bug reported in #150 and subsequently worked around in f7b703b but under different circumstances.

In my case, http was being invoked as part of a BsdMakefile script. bmake helpfully buffers IO when performing a parallel make (make -jX) so that lines from various rule outputs are not intermixed. httpie was detecting this as stdin and reporting an error about conflicting input streams (command line and STDIN).

Before looking up #150 or even Googling the issue, I correctly surmised that was the case, and attempted to work around it by explicitly closing STDIN:

http POST "https://neosmart.net/xxxx" authcode="xxxx" version="5.5.2" 0<&-
usage: http [--json] [--form] [--pretty {all,colors,format,none}]
            [--style STYLE] [--print WHAT] [--headers] [--body] [--verbose]
            [--all] [--history-print WHAT] [--stream] [--output FILE]
            [--download] [--continue]
            [--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH]
            [--auth USER[:PASS]] [--auth-type {basic,digest}]
            [--proxy PROTOCOL:PROXY_URL] [--follow]
            [--max-redirects MAX_REDIRECTS] [--timeout SECONDS]
            [--check-status] [--verify VERIFY]
            [--ssl {ssl2.3,ssl3,tls1,tls1.1,tls1.2}] [--cert CERT]
            [--cert-key CERT_KEY] [--ignore-stdin] [--help] [--version]
            [--traceback] [--default-scheme DEFAULT_SCHEME] [--debug]
            [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http: error: Request body (from stdin or a file) and request data (key=value) cannot be mixed.

Is it possible for httpie to distinguish between a closed and redirected stream?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions