guusdk / httpfileuploadcomponent

A XMPP External Component that implements XEP-0363 'HTTP File Upload'.
Apache License 2.0
8 stars 10 forks source link

Content length issue #44

Closed shreekantha closed 10 months ago

shreekantha commented 10 months ago

When I try to upload the file using put method, it is throwing the bellow exception

2024.01.09 15:57:05 INFO [Jetty-QTP-BOSH-1115]: nl.goodbytes.xmpp.xep0363.Servlet - Processing PUT request... (127.0.0.1 submitting to /httpfileupload/HSOuN8Kx-9C1qlzkpxFlx_AY8Kc/Screenshot%202023-12-30%20at%2010-25-04%20DataEntryPortal.png)

2024.01.09 15:57:05 INFO [Jetty-QTP-BOSH-1115]: nl.goodbytes.xmpp.xep0363.Servlet - ... responded with BAD_REQUEST. Content length in request (2) does not correspond with slot size (213592).

guusdk commented 10 months ago

This is likely an issue with the software that is uploading the file.

Prior to the upload, an XMPP request was used to create the slot to which the upload will happen. In that XMPP request, the size of the data that will be uploaded was provided. In your case, that appears to have been 213592.

The upload of data happens with a HTTP request. That request has a header (named "Content-Length") that indicates the size of the data that is being uploaded. The HTTP request had a value of 2.

The slot size and the size of the data that is being uploaded (and reported in the HTTP header) must be equal.