It is decided:
curl \ -X POST \ -H "Content-Type: multipart/form-data; boundary=----------------------------4ebf00fbcf09" \ --data-binary @test.txt \ http:
Where test.txt contains the following text and, most importantly, has a CRLF line ending (\ r \ n) :
------------------------------4ebf00fbcf09 Content-Disposition: form-data; name="example" test ------------------------------4ebf00fbcf09--
Notes: it is important to use --data-binary instead of the usual old -d , since the first saves the end of the line (which is very important). Also note that the boundary in the body begins with an extra -- .
I am going to repeat it because it is so important, but this request-body file must have a CRLF line ending. A multi-platform text editor with good end-of-line support is jEdit ( how to set line endings in jEdit ).
If you are interested in how I did this (debugging using the Ruby on Rails application), and not just the final solution, I wrote my debugging steps on my blog .
William Denniss May 26 '12 at 9:57 a.m. 2012-05-26 09:57
source share