Skip to content

Commit

Permalink
[Issue #2032] Only nil out outputStream property of connection operat…
Browse files Browse the repository at this point in the history
…ion if responseData is non-nil, meaning that no custom was set
  • Loading branch information
mattt committed Apr 25, 2014
1 parent 7258cc7 commit ddae2e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AFNetworking/AFURLConnectionOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
/**
The output stream that is used to write data received until the request is finished.
By default, data is accumulated into a buffer that is stored into `responseData` upon completion of the request. When `outputStream` is set, the data will not be accumulated into an internal buffer, and as a result, the `responseData` property of the completed request will be `nil`. The output stream will be scheduled in the network thread runloop upon being set, and set to `nil` on the request operation once the `connection` is closed.
By default, data is accumulated into a buffer that is stored into `responseData` upon completion of the request, with the intermediary `outputStream` property set to `nil`. When `outputStream` is set, the data will not be accumulated into an internal buffer, and as a result, the `responseData` property of the completed request will be `nil`. The output stream will be scheduled in the network thread runloop upon being set.
*/
@property (nonatomic, strong) NSOutputStream *outputStream;

Expand Down
4 changes: 3 additions & 1 deletion AFNetworking/AFURLConnectionOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,9 @@ - (void)connection:(NSURLConnection __unused *)connection
self.error = error;

[self.outputStream close];
self.outputStream = nil;
if (self.responseData) {
self.outputStream = nil;
}

self.connection = nil;

Expand Down

0 comments on commit ddae2e0

Please sign in to comment.