Skip to content

Commit

Permalink
Revert "Implement `URLSession:task:willPerformHTTPRedirection:newRequ…
Browse files Browse the repository at this point in the history
…est:completionHandler`"

This reverts commit 98486a0.
  • Loading branch information
SoneeJohn committed Dec 7, 2020
1 parent 960e327 commit 53eda3b
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions XCDYouTubeKit/XCDYouTubeVideoOperation.m
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ typedef NS_ENUM(NSUInteger, XCDYouTubeRequestType) {

};

@interface XCDYouTubeVideoOperation () <NSURLSessionTaskDelegate>
@interface XCDYouTubeVideoOperation ()
@property (atomic, copy, readonly) NSString *videoIdentifier;
@property (atomic, copy, readonly) NSString *languageIdentifier;
@property (atomic, strong, readonly) NSArray <NSHTTPCookie *> *cookies;
@@ -89,7 +89,7 @@ - (instancetype) initWithVideoIdentifier:(NSString *)videoIdentifier languageIde
_videoIdentifier = videoIdentifier ?: @"";
_languageIdentifier = languageIdentifier ?: @"en";

_session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration] delegate:self delegateQueue:nil];
_session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration]];
_cookies = [cookies copy];
_customPatterns = [customPatterns copy];

@@ -140,14 +140,6 @@ - (instancetype) initWithVideoIdentifier:(NSString *)videoIdentifier languageIde
return [self initWithVideoIdentifier:videoIdentifier languageIdentifier:languageIdentifier cookies:cookies customPatterns:nil];
}

#pragma mark - NSURLSessionTaskDelegate

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest *))completionHandler
{
//Prevent redirects
//See https://github.com/0xced/XCDYouTubeKit/issues/510#issuecomment-739465698
completionHandler(nil);
}
#pragma mark - Requests

- (void) startNextRequest
@@ -432,8 +424,6 @@ - (void) finish
{
self.isExecuting = NO;
self.isFinished = YES;
//Important to invalidate and cancel or we will leak
[self.session invalidateAndCancel];
}

#pragma mark - NSOperation

0 comments on commit 53eda3b

Please sign in to comment.