Page MenuHomePhabricator

Chunked upload 500 Internal Server Error for Commons API
Closed, ResolvedPublic

Description

Author: M8R-udfkkf

Description:
The chunked upload request.

I'm getting a '500 Internal Server Error' error when attempting to do a chunked upload via the commons API.

I've attached the request/response with cookie/token removed. (I also spoof the IE browser for testing).

What would a proper raw chunked upload request look like?


Version: 1.21.x
Severity: normal

Attached:

Details

Reference
bz44909

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:21 AM
bzimport set Reference to bz44909.

M8R-udfkkf wrote:

Response

Attached:

M8R-udfkkf wrote:

File in request

Attached:

Untitled.png (1×2 px, 2 MB)

M8R-udfkkf wrote:

I fixed it by including filename for the chunk param even though it's not used:

------------------------------90583427db83
Content-Disposition: form-data; name="chunk"; filename="something"
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary

It should give some sort of error as opposed to a 500.

Without the filename in the chunk parameter, PHP doesn't recognize it as a file upload field. So it tries to process this long chunk of data as if it were a text field, and runs out of memory while trying to run Unicode normalization over it.

But yeah, it would also be nice if the API would recognize that the file upload field is not actually being recognized as a file upload and give an error message rather than even trying to fetch it as a text field.