Skip to content
This repository
Browse code

Pass original request into DAVPutRequest instead of setting data/stre…

…am/MIMEType properties.
  • Loading branch information...
commit 4fc14be006746ef106ac789431a8924968e3a760 1 parent 55f53a5
Sam Deane samdeane authored

Showing 2 changed files with 5 additions and 26 deletions. Show diff stats Hide diff stats

  1. +4 25 ConnectionKit/CK2WebDAVProtocol.m
  2. +1 1  DAVKit
29 ConnectionKit/CK2WebDAVProtocol.m
@@ -151,18 +151,15 @@ - (id)initForCreatingFileWithRequest:(NSURLRequest *)request withIntermediateDir
151 151 if ((self = [self initWithRequest:request client:client]) != nil)
152 152 {
153 153 NSString* path = [self pathForRequest:request];
154   - NSData* data = [request HTTPBody];
155   - NSInputStream* stream = [request HTTPBodyStream];
156 154
157 155 CK2WebDAVCompletionHandler makeFileBlock = ^(id result) {
158   - DAVPutRequest* davRequest = [[DAVPutRequest alloc] initWithPath:path session:_session delegate:self];
159   - davRequest.data = data;
160   - davRequest.stream = stream;
161   - davRequest.dataMIMEType = [self MIMETypeForExtension:[path pathExtension]];
  156 +
  157 + DAVPutRequest* davRequest = [[DAVPutRequest alloc] initWithPath:path originalRequest:request session:_session delegate:self];
  158 +
162 159 [_queue addOperation:davRequest];
163 160 [davRequest release];
164 161
165   - CKTransferRecord* transfer = [CKTransferRecord recordWithName:[path lastPathComponent] size:[data length]];
  162 + CKTransferRecord* transfer = [CKTransferRecord recordWithName:[path lastPathComponent] size:davRequest.expectedLength];
166 163
167 164 self.progressHandler = ^(NSUInteger progress, NSUInteger previousAttemptsCount) {
168 165 [transfer setProgress:progress];
@@ -265,24 +262,6 @@ - (NSString*)pathForRequest:(NSURLRequest*)request
265 262 return path;
266 263 }
267 264
268   -- (NSString*)MIMETypeForExtension:(NSString*)extension
269   -{
270   - CFStringRef type = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)extension, NULL);
271   - NSString* mimeType = nil;
272   - if (type)
273   - {
274   - mimeType = (NSString*)UTTypeCopyPreferredTagWithClass(type, kUTTagClassMIMEType);
275   - CFRelease(type);
276   - [mimeType autorelease];
277   - }
278   - if (!mimeType)
279   - {
280   - mimeType = @"application/octet-stream";
281   - }
282   -
283   - return mimeType;
284   -}
285   -
286 265 #pragma mark Request Delegate
287 266
288 267 - (void)requestDidBegin:(DAVRequest *)aRequest;
2  DAVKit
... ... @@ -1 +1 @@
1   -Subproject commit 9396249e617af2e0c627d87d2f970036051b78ba
  1 +Subproject commit 8d5dccd787ea39c8259495ac6eebb264a6f2135f

0 comments on commit 4fc14be

Please sign in to comment.
Something went wrong with that request. Please try again.