mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-11-04 12:28:25 +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,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());
 | 
			
		||||
 | 
			
		||||
@ -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());
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user