apache / apache/jmeter

Chunk file upload with PUT method is failing due to incorrect Content-Length auto calculation

Open
#5,695 0 comments 0 reactions 0 assignees View on GitHub
P2
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

**VVSHRI** ([Bug 66234](https://bz.apache.org/bugzilla//show_bug.cgi?id=66234&redirect=false)):
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.

Severity: major
OS:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.