Uploader, Gears, and multipart POSTs
Colin Clark
colin.clark at utoronto.ca
Thu Feb 12 16:20:13 UTC 2009
Hey,
On 12-Feb-09, at 11:05 AM, Antranig Basman wrote:
> The POST data from Gears is limited by the API to consist purely
> of a file slice. You have arbitrary control over headers, but
> there is not sufficient leeway in the API to compose a proper
> formenc multipart request - in particular, a POST body may not
> consist of any more file slices than one, nor can you add
> the required slice boundaries.
Yep, Antranig has described it perfectly. To be needlessly precise,
the request from Gears looks like this:
POST /sakai-imagegallery2-web/site/multiFileUpload HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:
1.9.0.6) Gecko/2009011912 Firefox/3.0.6 Ubiquity/0.1.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Content-Type: multipart/form-data
content-disposition: attachment; filename='Banana.jpg'
Content-Range: bytes 1708
Content-Length: 1708
Pragma: no-cache
Cache-Control: no-cache
[binary stream of the file itself goes here]
So you can see that we're missing the requisite boundary markers,
among other things. In the end, it's not terribly difficult to handle
this sort of request, it's just that it's non-standard. As a result,
you'd need to write a completely separate request handler just for
Gears.
Colin
---
Colin Clark
Technical Lead, Fluid Project
Adaptive Technology Resource Centre, University of Toronto
http://fluidproject.org
More information about the fluid-work
mailing list