{"action":"created","issue":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/350","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/350/labels{/name}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/350/comments","events_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/350/events","html_url":"https://github.com/Alamofire/Alamofire/pull/350","id":57991039,"number":350,"title":"Public SessionDelegate + initial redirect support","user":{"login":"jhersh","id":175139,"avatar_url":"https://avatars.githubusercontent.com/u/175139?v=3","gravatar_id":"","url":"https://api.github.com/users/jhersh","html_url":"https://github.com/jhersh","followers_url":"https://api.github.com/users/jhersh/followers","following_url":"https://api.github.com/users/jhersh/following{/other_user}","gists_url":"https://api.github.com/users/jhersh/gists{/gist_id}","starred_url":"https://api.github.com/users/jhersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhersh/subscriptions","organizations_url":"https://api.github.com/users/jhersh/orgs","repos_url":"https://api.github.com/users/jhersh/repos","events_url":"https://api.github.com/users/jhersh/events{/privacy}","received_events_url":"https://api.github.com/users/jhersh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-17T22:15:44Z","updated_at":"2015-02-18T06:02:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Alamofire/Alamofire/pulls/350","html_url":"https://github.com/Alamofire/Alamofire/pull/350","diff_url":"https://github.com/Alamofire/Alamofire/pull/350.diff","patch_url":"https://github.com/Alamofire/Alamofire/pull/350.patch"},"body":"Resolves #314.\r\n\r\nMy goal here is twofold: \r\n\r\n- Allow for per-request HTTP redirect control, by means of\r\n- Making `public` the internal `SessionDelegate` class and its various closure variables for fine-grained request control across numerous `NSURLSessionTaskDelegate` methods.\r\n\r\nI also changed the block signature of `taskWillPerformHTTPRedirection` to make its return value an optional `NSURLRequest?` (it was previously `NSURLRequest`) because of this note regarding the `completionBlock` from the [`NSURLSessionTaskDelegate` documentation](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionTaskDelegate_protocol/index.html#//apple_ref/occ/intfm/NSURLSessionTaskDelegate/URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:):\r\n\r\n> A block that your handler should call with either the value of the `request` parameter, a modified URL request object, or `NULL` to refuse the redirect and return the body of the redirect response.\r\n\r\nHowever, my attempts to return `nil` here cause a deadlock/timeout in the test. Instead, I've performed the redirect test by returning a new `NSURLRequest` for the original URL, which also effectively refuses the HTTP redirect. I'd welcome input or suggestions here!\r\n"},"comment":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/comments/74817532","html_url":"https://github.com/Alamofire/Alamofire/pull/350#issuecomment-74817532","issue_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/350","id":74817532,"user":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"created_at":"2015-02-18T06:02:02Z","updated_at":"2015-02-18T06:02:02Z","body":"You're facing the same issues with the closures and `SessionDelegate` being internal as I was for background session support in #317."}}