1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-08 16:36:13 +00:00

Merge pull request #59 from owncloud/add_header_OC-TOTAL-LENGHT_to_put_request

Add OC-Total-Length header to ChunkedUploadRemoteFileOperation
This commit is contained in:
David A. Velasco 2015-04-14 09:30:20 +02:00
commit 9e761387a0
2 changed files with 4 additions and 1 deletions

View File

@ -75,7 +75,8 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation
}
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());

View File

@ -53,6 +53,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
public class UploadRemoteFileOperation extends RemoteOperation {
protected static final String OC_TOTAL_LENGTH_HEADER = "OC-Total-Length";
protected String mLocalPath;
protected String mRemotePath;
@ -116,6 +117,7 @@ public class UploadRemoteFileOperation extends RemoteOperation {
((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());