39 points · by pyinthesky · 7y ago · 13 comments
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.
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.