Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

check connection is valid

  • Loading branch information...
commit bf81d0ce425c388a07ee1715b616f60d59f91224 1 parent 23b31f7
Satoshi Nakagawa psychs authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 Classes/Library/GistClient.m
4 Classes/Library/GistClient.m
View
@@ -78,6 +78,8 @@ - (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheRespo
- (void)connection:(NSURLConnection*)sender didFailWithError:(NSError*)error
{
+ if (conn != sender) return;
+
[self cancel];
if ([delegate respondsToSelector:@selector(gistClient:didFailWithError:statusCode:)]) {
@@ -87,6 +89,8 @@ - (void)connection:(NSURLConnection*)sender didFailWithError:(NSError*)error
- (NSURLRequest *)connection:(NSURLConnection *)sender willSendRequest:(NSURLRequest *)req redirectResponse:(NSHTTPURLResponse *)res
{
+ if (conn != sender) return nil;
+
if (res && res.statusCode == 302) {
if ([delegate respondsToSelector:@selector(gistClient:didReceiveResponse:)]) {
[delegate gistClient:self didReceiveResponse:req.URL.absoluteString];
Please sign in to comment.
Something went wrong with that request. Please try again.