mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-09 00:46:15 +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:
commit
9e761387a0
@ -75,6 +75,7 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation
|
|||||||
}
|
}
|
||||||
mPutMethod = new PutMethod(uriPrefix + chunkCount + "-" + chunkIndex);
|
mPutMethod = new PutMethod(uriPrefix + chunkCount + "-" + chunkIndex);
|
||||||
mPutMethod.addRequestHeader(OC_CHUNKED_HEADER, OC_CHUNKED_HEADER);
|
mPutMethod.addRequestHeader(OC_CHUNKED_HEADER, OC_CHUNKED_HEADER);
|
||||||
|
mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, String.valueOf(file.length()));
|
||||||
((ChunkFromFileChannelRequestEntity) mEntity).setOffset(offset);
|
((ChunkFromFileChannelRequestEntity) mEntity).setOffset(offset);
|
||||||
mPutMethod.setRequestEntity(mEntity);
|
mPutMethod.setRequestEntity(mEntity);
|
||||||
status = client.executeMethod(mPutMethod);
|
status = client.executeMethod(mPutMethod);
|
||||||
|
@ -53,6 +53,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
|||||||
|
|
||||||
public class UploadRemoteFileOperation extends RemoteOperation {
|
public class UploadRemoteFileOperation extends RemoteOperation {
|
||||||
|
|
||||||
|
protected static final String OC_TOTAL_LENGTH_HEADER = "OC-Total-Length";
|
||||||
|
|
||||||
protected String mLocalPath;
|
protected String mLocalPath;
|
||||||
protected String mRemotePath;
|
protected String mRemotePath;
|
||||||
@ -116,6 +117,7 @@ public class UploadRemoteFileOperation extends RemoteOperation {
|
|||||||
((ProgressiveDataTransferer)mEntity)
|
((ProgressiveDataTransferer)mEntity)
|
||||||
.addDatatransferProgressListeners(mDataTransferListeners);
|
.addDatatransferProgressListeners(mDataTransferListeners);
|
||||||
}
|
}
|
||||||
|
mPutMethod.addRequestHeader(OC_TOTAL_LENGTH_HEADER, String.valueOf(f.length()));
|
||||||
mPutMethod.setRequestEntity(mEntity);
|
mPutMethod.setRequestEntity(mEntity);
|
||||||
status = client.executeMethod(mPutMethod);
|
status = client.executeMethod(mPutMethod);
|
||||||
client.exhaustResponse(mPutMethod.getResponseBodyAsStream());
|
client.exhaustResponse(mPutMethod.getResponseBodyAsStream());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user