diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 1adea2b..98aa07c 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -107,18 +107,14 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL @property (readwrite, nonatomic, strong) NSURLRequest *request; @property (readwrite, nonatomic, strong) NSHTTPURLResponse *response; @property (readwrite, nonatomic, strong) NSError *HTTPError; -@property (readwrite, nonatomic, copy) NSString *HTTPResponseString; -@property (readwrite, nonatomic, strong) NSRecursiveLock *lock; @end @implementation AFHTTPRequestOperation @synthesize HTTPError = _HTTPError; -@synthesize HTTPResponseString = _HTTPResponseString; @synthesize successCallbackQueue = _successCallbackQueue; @synthesize failureCallbackQueue = _failureCallbackQueue; @dynamic request; @dynamic response; -@dynamic lock; - (void)dealloc { if (_successCallbackQueue) { @@ -166,25 +162,19 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL } } -- (NSString *)responseString { - [self.lock lock]; +- (NSStringEncoding)responseStringEncoding { // When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be labeled with an appropriate charset value. // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.4.1 - if (!self.HTTPResponseString && self.response && !self.response.textEncodingName && self.responseData) { + if (self.response && !self.response.textEncodingName && self.responseData) { NSString *type = nil; AFGetMediaTypeAndSubtypeWithString([[self.response allHeaderFields] valueForKey:@"Content-Type"], &type, nil); if ([type isEqualToString:@"text"]) { - self.HTTPResponseString = [[NSString alloc] initWithData:self.responseData encoding:NSISOLatin1StringEncoding]; + return NSISOLatin1StringEncoding; } } - [self.lock unlock]; - if (self.HTTPResponseString) { - return self.HTTPResponseString; - } else { - return [super responseString]; - } + return [super responseStringEncoding]; } - (void)pause {