Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #59 from owncloud/add_header_OC-TOTAL-LENGHT_to_pu…
Browse files Browse the repository at this point in the history
…t_request

Add OC-Total-Length header to ChunkedUploadRemoteFileOperation
  • Loading branch information
davivel committed Apr 14, 2015
2 parents 2b2fc91 + aaebdef commit 9e76138
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ protected int uploadFile(OwnCloudClient client) throws HttpException, IOExceptio
}
mPutMethod = new PutMethod(uriPrefix + chunkCount + "-" + chunkIndex);
mPutMethod.addRequestHeader(OC_CHUNKED_HEADER, OC_CHUNKED_HEADER);
((ChunkFromFileChannelRequestEntity)mEntity).setOffset(offset);
mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, String.valueOf(file.length()));
((ChunkFromFileChannelRequestEntity) mEntity).setOffset(offset);
mPutMethod.setRequestEntity(mEntity);
status = client.executeMethod(mPutMethod);
client.exhaustResponse(mPutMethod.getResponseBodyAsStream());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

public class UploadRemoteFileOperation extends RemoteOperation {

protected static final String OC_TOTAL_LENGTH_HEADER = "OC-Total-Length";

protected String mLocalPath;
protected String mRemotePath;
Expand Down Expand Up @@ -116,6 +117,7 @@ protected int uploadFile(OwnCloudClient client) throws HttpException, IOExceptio
((ProgressiveDataTransferer)mEntity)
.addDatatransferProgressListeners(mDataTransferListeners);
}
mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, String.valueOf(f.length()));
mPutMethod.setRequestEntity(mEntity);
status = client.executeMethod(mPutMethod);
client.exhaustResponse(mPutMethod.getResponseBodyAsStream());
Expand Down

0 comments on commit 9e76138

Please sign in to comment.