Does AppEngine BlobStore support Chunked Transfer Encoding for uploads (getting Status 411: Length required)?

139 views
Skip to first unread message

Markus Ansmann

unread,
Oct 29, 2012, 3:47:01 PM10/29/12
to google-a...@googlegroups.com
I'm heaving a really hard time finding documentation on a very basic question about AppEngine:

Does the BlobStore support Chunked Transfer Encoding for uploads?

I'm using an HttpURLConnection object in Java with setChunkedStreamingMode to upload a file in a multipart/form-data type request using the following code to set up the connection:

HttpURLConnection cxn = (HttpURLConnection) new URL(uploadUrl).openConnection();
cxn
.setRequestMethod("POST");
cxn
.setChunkedStreamingMode(9999);
cxn
.setRequestProperty("Content-Type", "multipart/form-data; boundary=-");
cxn
.setDoOutput(true);
cxn
.connect();

The dev-server answers my request with Status 411: Length required. Does this mean that chunked transfer mode is not supported, or am I initializing the connection incorrectly? Does the production server act differently here? Is this behavior a consequence of specifying a max upload size when generating the upload url?

If I simply comment out the line cxn.setChunkedStreamingMode(9999);, everything works perfectly, but I'd rather not do this, so I don't have to buffer hundreds of MB in memory before sending the request...

Markus Ansmann

unread,
Oct 30, 2012, 11:42:21 AM10/30/12
to google-a...@googlegroups.com
In case someone does care:

The dev-server does NOT support chunked transfer encoding, but the production server DOES. I guess we just need to write two versions of our code that switch mode of operation based on the upload url...
Reply all
Reply to author
Forward
0 new messages