Bug 66234 - Chunk file upload with PUT method is failing due to incorrect Content-Length auto calculation
Summary: Chunk file upload with PUT method is failing due to incorrect Content-Length ...
Status: NEW
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 5.4.3
Hardware: PC
: P2 major (vote)
Target Milestone: JMETER_5.5
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-23 16:23 UTC by VVSHRI
Modified: 2022-08-23 16:23 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description VVSHRI 2022-08-23 16:23:58 UTC
Hi Team,

I am using "HTTP Request" with PUT method for chunk file upload at sFiles {Salesforce share point}. (OS - Windows 10). FileToBeUploaded.pdf is the main file 

$ ls -lrt File*
-rw-r--r-- 1 vikram 197121 12065018 Aug 23 15:51 FileToBeUploaded.pdf
-rw-r--r-- 1 vikram 197121  5773562 Aug 23 15:53 FileToBeUploaded_Chunks.pdf.ab
-rw-r--r-- 1 vikram 197121  6291456 Aug 23 15:53 FileToBeUploaded_Chunks.pdf.aa

For Chunk Upload
1. We have to divide a file to into equal parts and save it somewhere and upload each of them separately on the same URL that you get after creating a session.
2. Content-Length must be the total numbers of bytes of the file that you are uploading in all upload requests of fragments.
3. Content-Range will be like: 0-{fragmentLength-1}/{totalNumberOfBytesOfFile}(same as content-length) and from next fragment the Content-Range will be {uploadedBytes}-{uploadedBytes+nextSetOfBytes-1}/{totalNumberOfBytesOfFile}

To follow this we should have valid Content-Length & Content-Range passed in the request header. 

ISSUE: But Jmeter is calculating content-length automatically and not taking the content-length defined in header manager. For chuck file uploads size in bytes should be accurately set for Content-Length & Content-Range . But Jmeter each time taking a new content-length as per it's auto calculation. 
Client Side Error: [HTTP 400]
{"error":{"code":"invalidRequest","message":"The Content-Range header length does not match the provided number of bytes."}}

I searched on all articles on the internet but could not found any resolution to control/override/hardcode Content-Length in request header. 
This issue must be there for all share point websites which are using PUT method for chunk file upload. [Like Google Drive etc.]

Expected resolution: 
1. Way to control/override/hardcode/Configure Content-Length in "HTTP Request".
2. Addition of a new column under "Files Upload" along with File Path, Parameter Name & MIME Type.

Your help is appreciated on this. Please do let me know for any kind of inputs or information.
Comment 1 The ASF infrastructure team 2022-09-24 20:38:23 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5695