I am developing a site to receive uploaded data from mobile handsets (the client is J2ME), that send HTTP uploads using chunked encoding.
This works with IIS, but not with Cassini (or the ASP.NET dev server).
To test this I use cURL(
http://curl.haxx.se/) with a test upload page that echoes POSTed fields or attached files.
Code:
C:\Program Files\cURL>curl -X POST -H "Transfer-Encoding: chunked" --form "upload=@README" http://localhost:3030/upload.aspx --show-error --verbose
* About to connect() to localhost port 3030 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 3030 (#0)
> POST /upload.aspx HTTP/1.1
> User-Agent: curl/7.16.0 (i586-pc-mingw32msvc) libcurl/7.16.0 zlib/1.2.2
> Host: localhost:3030
> Accept: */*
> Transfer-Encoding: chunked
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------f7783df477cd
>
< HTTP/1.1 200 OK
< Server: UltiDev Cassini/2.1.4.3
< Date: Wed, 28 Feb 2007 15:32:25 GMT
< X-AspNet-Version: 2.0.50727
< Cache-Control: private
< Content-Type: text/html; charset=utf-8
< Content-Length: 50
< Connection: Close
**** Form Fields *****<br><br>**** Files *****<br>* Closing connection #0
This will work OK if the -H "Transfer-Encoding: chunked" is removed...
Code:C:\Program Files\cURL>curl -X POST --form "upload=@README" http://localhost:3030/upload.aspx --show-error --verbose
* About to connect() to localhost port 3030 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 3030 (#0)
> POST /upload.aspx HTTP/1.1
> User-Agent: curl/7.16.0 (i586-pc-mingw32msvc) libcurl/7.16.0 zlib/1.2.2
> Host: localhost:3030
> Accept: */*
> Content-Length: 2000
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------d1c5d26d570a
>
< HTTP/1.1 100 Continue
< Server: UltiDev Cassini/2.1.4.3
< Date: Wed, 28 Feb 2007 15:34:27 GMT
< Content-Length: 0
< HTTP/1.1 200 OK
< Server: UltiDev Cassini/2.1.4.3
< Date: Wed, 28 Feb 2007 15:34:27 GMT
< X-AspNet-Version: 2.0.50727
< Cache-Control: private
< Content-Type: text/html; charset=utf-8
< Content-Length: 72
< Connection: Close
**** Form Fields *****<br><br>**** Files *****<br>README length=1800<br>* Closing connection #0