Show HN: Pipe To Me – Stream data over HTTP using curl
github.com
github.com
pipefrom() { local key=${1:?"Error: Missing pipe key"}; curl -s https://pipeto.me/$key; }
pipeto() { local key=${1:?"Error: Missing pipe key"}; curl -T- -s https://pipeto.me/$key; }
I also toyed around with using the "-T." curl argument instead of "-T-" to allow some response in this case, but I came up against a known issue in curl (https://github.com/curl/curl/issues/932). I'm sure this wasn't the intended use case though.
It is definitely worth exploring further.
It would probably also make more sense if I were to add some kind of buffering or storage in the future.
People could then use netcat to send and receive, and the server could block either end until someone connects on the other end. Personally I would really appreciate a tool I could connect to with netcat or anything else that speaks TCP. I don’t know how someone would use the service from javascript though.
No buffering needed by the server. If either end has to be asynchronous, just run in background + nohup if you’re calling this from a shell.
Maybe some inspiration from how blocking FIFOs work on Linux: http://man7.org/linux/man-pages/man7/fifo.7.html
You could even do a non-blocking version which just refuses connection. netcat can be set to retry: https://unix.stackexchange.com/questions/432249/nc-to-retry-...
I realise that this doesn’t make it easy to indicate which pipe one wants to connect to.
Edit: One nice thing about the https interface is that you get an encrypted channel. Maybe SSH would be another option for transport. That would also make passing keys easier.
The HTTP request header Expect: 100-Continue and HTTP response status 100 Continue informs the client that the server desires to receive the request body.
However, many servers don't support it, and curl proceeds anyway if there is no Continue response after 1000ms. This timeout was originally fixed [1], but since curl 7.47.0 can be adjusted via --expect100-timeout.