                     endCredential = NSURLCredential(
                         user: credential.0,
                         password: credential.1,
-                        persistence: taskConfig.credentialPersistence
+                        persistence: self.defaults.credentialPersistence
                     )
                 }
             }

                    addCookies(request.URL!, newCookies: cookies)
                    let config = TaskConfiguration(
                        credential:auth,
                        credentialPersistence: self.defaults.credentialPersistence,
                        redirects:redirects,
                        originalRequest:request,
                        data:NSMutableData(),

typealias TaskCompletionHandler = (HTTPResult) -> Void
struct TaskConfiguration {
    let credential:Credentials?
    let redirects:Bool
    let originalRequest: NSURLRequest?
    var data: NSMutableData
