Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

When used as ssh command, http hangs on empty stdin #190

Closed
robertjustjones opened this Issue Dec 30, 2013 · 4 comments

Comments

Projects
None yet
3 participants

This is related to #150 addressed with the --ignore-stdin switch.

When doing the following, httpie assumes a POST and hangs since stdin is piped but empty.

ssh 192.168.1.1 http :8080       # hangs, but I love the new syntax!

The following works as expected, but is verbose.

ssh 192.168.1.1 http --ignore-stdin :8080     

Can HTTPie be made to detect that stdin is empty and not assume a POST here?

mpol commented Feb 4, 2014

I really don't think httpie's stdin can in any way be described as empty in this case. It is open and waiting for data that may be at any time passed from the terminal connected to ssh's stdin.
You can run this command then go for a lunch and after coming back type Hello, World!, press Enter and Ctrl-D to signal EOF and your cheerful message will then be POSTed.

A less verbose workaround for this case would be ssh -t 192.168.1.1 http :8080 to make httpie stdin be a terminal.

But maybe a short version of --ignore-stdin could be created as well?

Of course you are correct about stdin. What I found with ssh -t is that it also messes with stdout by adding terminal escape codes with -j output. However, you led me to try this which is perfectly json pipe-able for me: ssh -n 192.168.1.1 http GET :8080

Yes, a short version of --ignore-stdin would be even better. Thanks!

mpol commented Feb 6, 2014

Yes, the stdout is also connected to a terminal then, so -t is not really nice for redirecting output. Of course you can do ssh -t 192.168.1.1 http --pretty none :8080, but this brings you back to verbose, and possibly confusing.

Owner

jakubroztocil commented Jul 2, 2016

The development version of HTTPie now supports -I as a shortcut for --ignore-stdin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment