tatsuhiro-t/spdylay

Uploading file with spdycat

jarmo opened this issue · 5 comments

I'm trying to upload a file using multipart request, but not able to do that with spdycat.

Here's how i'm uploading file with curl:
curl -X POST -F "file=@my-file" https://example.com/upload

This is how i tried it with spdycat:
spdycat --data my-file https://example.com/upload

It does not seem to work as nginx with spdy module returns with http 400 and in logs i can see that Content-Type header is missing.

What am i doing wrong and how to achieve file upload similar to curl?

spdycat does not support multipart uploading at the moment. It just upload the content of the given file.
The workaround is create multipart data in advance in a file and upload it with -d option.

Thanks! This works.

However, i cannot seem to use stdin as a file like this:
gzip -c foo.bar | ./spdycat --data - https://server.com

It does send something with content-length of 0 if use - as an input.

This is a bug. --data - works with file only. We have a similar fix for nghttp client (nghttp2/nghttp2@a8a6684) and can port here.

Fix committed via 6c17426

Thanks! Using - for stdin works now! I'm gonna close this issue, although multipart uploads are not supported, but i've managed to just upload the content of the file.