Support for httpie stdin #58

Closed
opened 2022-02-15 12:40:26 +01:00 by CRISPYricePC · 1 comment

httpie has super sweet syntax for posting files via stdin:

https 0x0.st < file.txt

But it causes a 400 response from 0x0:

$ https 0x0.st < test.txt
HTTP/1.1 400 BAD REQUEST
Connection: keep-alive
Content-Length: 19
Content-Type: text/html; charset=utf-8
Date: Tue, 15 Feb 2022 11:38:19 GMT
Server: nginx

Segmentation fault

I don't know much about HTTP spec so I'm unsure if this is an issue with how httpie sends files in this way or if an edge case has been missed on the server side.

[httpie](https://github.com/httpie/httpie) has super sweet syntax for posting files via stdin: ``` https 0x0.st < file.txt ``` But it causes a 400 response from 0x0: ``` $ https 0x0.st < test.txt HTTP/1.1 400 BAD REQUEST Connection: keep-alive Content-Length: 19 Content-Type: text/html; charset=utf-8 Date: Tue, 15 Feb 2022 11:38:19 GMT Server: nginx Segmentation fault ``` I don't know much about HTTP spec so I'm unsure if this is an issue with how httpie sends files in this way or if an edge case has been missed on the server side.

That syntax only works for text/json data instead of multipart/form data. It won't work with this project.

However, the following bash script will do exactly what you want.

#!/bin/bash
curl -F "file=@-" "https://${1:-0x0.st}"

You could add this script to your path and use it instead of httpie.

That syntax only works for text/json data instead of multipart/form data. It won't work with this project. However, the following bash script will do exactly what you want. ```sh #!/bin/bash curl -F "file=@-" "https://${1:-0x0.st}" ``` You could add this script to your path and use it instead of httpie.
mia added the
wontfix
label 2022-08-01 17:49:15 +02:00
mia closed this issue 2022-08-01 17:49:17 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mia/0x0#58
No description provided.