Skip to content
Browse files

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

…am/MIMEType properties.
  • Loading branch information...
1 parent 55f53a5 commit 4fc14be006746ef106ac789431a8924968e3a760 @samdeane samdeane committed Feb 12, 2013
Showing with 5 additions and 26 deletions.
  1. +4 −25 ConnectionKit/CK2WebDAVProtocol.m
  2. +1 −1 DAVKit
View
29 ConnectionKit/CK2WebDAVProtocol.m
@@ -151,18 +151,15 @@ - (id)initForCreatingFileWithRequest:(NSURLRequest *)request withIntermediateDir
if ((self = [self initWithRequest:request client:client]) != nil)
{
NSString* path = [self pathForRequest:request];
- NSData* data = [request HTTPBody];
- NSInputStream* stream = [request HTTPBodyStream];
CK2WebDAVCompletionHandler makeFileBlock = ^(id result) {
- DAVPutRequest* davRequest = [[DAVPutRequest alloc] initWithPath:path session:_session delegate:self];
- davRequest.data = data;
- davRequest.stream = stream;
- davRequest.dataMIMEType = [self MIMETypeForExtension:[path pathExtension]];
+
+ DAVPutRequest* davRequest = [[DAVPutRequest alloc] initWithPath:path originalRequest:request session:_session delegate:self];
+
[_queue addOperation:davRequest];
[davRequest release];
- CKTransferRecord* transfer = [CKTransferRecord recordWithName:[path lastPathComponent] size:[data length]];
+ CKTransferRecord* transfer = [CKTransferRecord recordWithName:[path lastPathComponent] size:davRequest.expectedLength];
self.progressHandler = ^(NSUInteger progress, NSUInteger previousAttemptsCount) {
[transfer setProgress:progress];
@@ -265,24 +262,6 @@ - (NSString*)pathForRequest:(NSURLRequest*)request
return path;
}
-- (NSString*)MIMETypeForExtension:(NSString*)extension
-{
- CFStringRef type = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)extension, NULL);
- NSString* mimeType = nil;
- if (type)
- {
- mimeType = (NSString*)UTTypeCopyPreferredTagWithClass(type, kUTTagClassMIMEType);
- CFRelease(type);
- [mimeType autorelease];
- }
- if (!mimeType)
- {
- mimeType = @"application/octet-stream";
- }
-
- return mimeType;
-}
-
#pragma mark Request Delegate
- (void)requestDidBegin:(DAVRequest *)aRequest;
2 DAVKit
@@ -1 +1 @@
-Subproject commit 9396249e617af2e0c627d87d2f970036051b78ba
+Subproject commit 8d5dccd787ea39c8259495ac6eebb264a6f2135f

0 comments on commit 4fc14be

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