upload module fails in some cases

Maxim Dounin mdounin at mdounin.ru
Mon Apr 23 06:47:22 UTC 2012


Hello!

On Sun, Apr 22, 2012 at 10:25:16PM -0400, JCR wrote:

> Hello,
> 
> I and using nginx 1.0.15 with the third-party module
> nginx_upload_module-2.2.0/
> 
> When I am using an html form all works perfectly and I can see the
> uploaded files and the post values as expected. 
> 
> But, when I send the HTTP Post request from a Poco application, it does
> not work. (pocoproject.org)
> 
> I am pasting below the code of that C++ Poco app. I don't think that you
> need to be an expert at Poco to understand it. 
> 
> 
> 114   std::ostringstream content;
> 115   content << "------WebKitFormBoundaryq2BIJhJChD7qIY1W\r\n";
> 116   content << "Content-Disposition: form-data;
> name=\"submit\"\r\n\r\n"
> 117              "Upload\r\n"
> 118              "------WebKitFormBoundaryq2BIJhJChD7qIY1W\r\n";
> 119   content << "Content-Disposition: form-data; name=\"file\";
> filename=\"test.txt\"\r\n\r\n"
> 120              "Content-Type: text/plain\r\n"
> 121              "This is a test.\r\n"
> 122              "------WebKitFormBoundaryq2BIJhJChD7qIY1W--";

4 dashes in the boundary here (following the '"--" boundary' 
syntax as per RFC 2046).

> 123 
> 124   std::ostringstream os;
> 125   os << "POST /upload HTTP/1.0\r\n"
> 126         "Host: ip:31000\r\n"
> 127         "User-Agent: AAA\r\n"
> 128         "Accept:
> text/plain,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
> 129         "Accept-Language:
> en-us,ko;q=0.9,ja;q=0.7,cs;q=0.6,th;q=0.4,zh;q=0.3,en;q=0.1\r\n"
> 130         "Accept-Encoding: gzip,deflate\r\n"
> 131         "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"
> 132         "Referer: ip\r\n"
> 133         "Content-Type: multipart/form-data;
> boundary=------WebKitFormBoundaryq2BIJhJChD7qIY1W\r\n";

And 6 dashes here.  This is unlikely to work.

Maxim Dounin



More information about the nginx mailing list