Merge branch 'master' of https://github.com/tomohisa/AFNetworking into tomohisa-master
Conflicts: AFNetworking/AFHTTPClient.m
This commit is contained in:
commit
f47c5c6fb5
1 changed files with 25 additions and 23 deletions
|
|
@ -145,7 +145,7 @@ NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) {
|
|||
NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
||||
NSMutableArray *mutableQueryStringComponents = [NSMutableArray array];
|
||||
|
||||
if([value isKindOfClass:[NSDictionary class]]) {
|
||||
if ([value isKindOfClass:[NSDictionary class]]) {
|
||||
// Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries
|
||||
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(caseInsensitiveCompare:)];
|
||||
[[[value allKeys] sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]] enumerateObjectsUsingBlock:^(id nestedKey, __unused NSUInteger idx, __unused BOOL *stop) {
|
||||
|
|
@ -154,7 +154,7 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) {
|
|||
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)];
|
||||
}
|
||||
}];
|
||||
} else if([value isKindOfClass:[NSArray class]]) {
|
||||
} else if ([value isKindOfClass:[NSArray class]]) {
|
||||
NSArray *array = value;
|
||||
[array enumerateObjectsUsingBlock:^(id nestedValue, __unused NSUInteger idx, __unused BOOL *stop) {
|
||||
[mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)];
|
||||
|
|
@ -279,11 +279,11 @@ static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetwork
|
|||
BOOL isNetworkReachable = (isReachable && !needsConnection);
|
||||
|
||||
AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown;
|
||||
if(isNetworkReachable == NO){
|
||||
if (isNetworkReachable == NO) {
|
||||
status = AFNetworkReachabilityStatusNotReachable;
|
||||
}
|
||||
#if TARGET_OS_IPHONE
|
||||
else if((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0){
|
||||
else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
|
||||
status = AFNetworkReachabilityStatusReachableViaWWAN;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -330,7 +330,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
|
|||
}
|
||||
|
||||
__weak __typeof(&*self)weakSelf = self;
|
||||
AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status){
|
||||
AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) {
|
||||
__strong __typeof(&*weakSelf)strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
return;
|
||||
|
|
@ -669,8 +669,8 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
|
|||
return nil;
|
||||
}
|
||||
|
||||
self.stringEncoding = (NSStringEncoding)[aDecoder decodeIntegerForKey:@"stringEncoding"];
|
||||
self.parameterEncoding = (AFHTTPClientParameterEncoding)[aDecoder decodeIntegerForKey:@"parameterEncoding"];
|
||||
self.stringEncoding = [aDecoder decodeIntegerForKey:@"stringEncoding"];
|
||||
self.parameterEncoding = [aDecoder decodeIntegerForKey:@"parameterEncoding"];
|
||||
self.registeredHTTPOperationClassNames = [aDecoder decodeObjectForKey:@"registeredHTTPOperationClassNames"];
|
||||
self.defaultHeaders = [aDecoder decodeObjectForKey:@"defaultHeaders"];
|
||||
|
||||
|
|
@ -954,7 +954,6 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
|||
if ([self streamStatus] == NSStreamStatusClosed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
NSInteger bytesRead = 0;
|
||||
|
||||
while ((NSUInteger)bytesRead < MIN(length, self.numberOfBytesInPacket)) {
|
||||
|
|
@ -969,7 +968,6 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
|
|
@ -1112,6 +1110,11 @@ typedef enum {
|
|||
}
|
||||
|
||||
- (BOOL)hasBytesAvailable {
|
||||
// Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the avaiable buffer
|
||||
if (_phase == AFFinalBoundaryPhase) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
switch (self.inputStream.streamStatus) {
|
||||
case NSStreamStatusNotOpen:
|
||||
case NSStreamStatusOpening:
|
||||
|
|
@ -1197,7 +1200,6 @@ typedef enum {
|
|||
_phase = AFEncapsulationBoundaryPhase;
|
||||
break;
|
||||
}
|
||||
|
||||
_phaseReadOffset = 0;
|
||||
|
||||
return YES;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue