I've made a dummy django view that accepts PUT
requests:
# urls.py
url(r'^put/.*$', 'put', name='put'),
# views.py
def put(request):
print request.method
return HttpResponse()
Now, when I try to make a PUT
xhr call to the view, it returns a 403:
[27/Sep/2012 22:32:43] "PUT /put/x-unconverted/e02ed7da08d411e2bfa974de2b4d1b84?partNumber=115&uploadId=35UxOsGCCG98rke3VjpazmCy.0ZFpesndJ.XPp5Bw6R2CumfIsYKP5DlBYPY3gh3I0PCwfCg4DqSRttYp75bZg-- HTTP/1.1" 403 156400
(why it returns 403, I don't care right now). The REAL problem is this:
The XHR call returns status 0 (aborted?!), even if the real response was a 403, with content (notice 156400 content length).
Why doesn't it show the 403 response?
EDIT: the PUT
request is made like this:
var xhr = new XMLHttpRequest();
var path = "/" + u.settings.key;
path += "?partNumber=" + (chunk + 1) + "&uploadId=" + u.upload_id;
var method = "PUT";
var authorization = "AWS " + u.settings.access_key + ":" + signature;
var blob = u.file.slice(start, end); // mozSlice / webkitSlice, depending on browser
xhr.upload.addEventListener("progress", progress_handler);
xhr.addEventListener("readystatechange", handler);
xhr.addEventListener("error", error_handler);
xhr.addEventListener("timeout", error_handler);
xhr.open(method, /*u.settings.host*/ "http://localhost:8000/put" + path, true);
xhr.setRequestHeader("x-amz-date", date);
xhr.setRequestHeader("Authorization", authorization);
xhr.setRequestHeader("Content-Type", u.settings.content_type);
xhr.setRequestHeader("Content-Disposition", "attachment; filename=" + u.file.name);
xhr.send(blob);