I mean POSTing a standard file upload form. Usual command line contains this switch in this case:
-F "Filedata=@filename.zip"
However when I try to feed a named pipe made by linux command "mkfifo", eg. "mkfifo filename.zip", I always get an error message on the producer side:
curl: (23) Failed writing body (1856 != 16384)
And also some error message appears at consumer side of the fifo. I fed my fifo with another curl command on producer side, eg.:
curl http://example.com/archive.zip > filename.zip
And on consumer side:
curl http://example.com/fileupload.php -F "file=@filename.zip"
When I pass a Content-Length HTTP header at the consumer side of my fifo, I don't get error message at the producer side, but error message still appears at the consumer (uploading) side, unsuccessful upload.
curl http://example.com/fileupload.php -F "file=@filename.zip" -H "Content-Length: 393594678"
I also tried feeding cURL file upload a non-named pipe, causing cURL to read data from stdin (marked as @-), like:
curl -# http://example.com/archive.zip | curl -# http://example.com/fileupload.php -F "file=@-"
In this case upload is successful, however the downloading and uploading progress are not in sync, I can see too separate hashmark progress indicators, one for the download and one for the upload, rather consecutively and not operating at the same time. On the top of that remote file is always named as "-", but this is not an issue for me, can be renamed later.
Further notice: I tried the aboves from a Ruby command line IRB / Pry session, and I have noticed that when I used Ruby command "system" to call the piped construct:
system %Q{curl -# http://example.com/archive.zip | curl -# http://example.com/fileupload.php -F "file=@-"}
I can see only one hashmark progress indicator in this case, so I think piping works as it should be, but I can see two consecutive hashmark progress indicator in this second case like this:
%x{curl -# http://example.com/archive.zip | curl -# http://example.com/fileupload.php -F "file=@-"}