From d174519ecc1409b139175f3f7d0466883eff858b Mon Sep 17 00:00:00 2001 From: Pasin Suriyentrakorn Date: Mon, 22 Oct 2018 13:34:50 -0700 Subject: [PATCH] Fix BasicAuth header not getting sent when SG GUEST is enabled Sent the Basic Auth header without wating for challenge. #2216 --- Objective-C/Internal/Replicator/CBLHTTPLogic.m | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Objective-C/Internal/Replicator/CBLHTTPLogic.m b/Objective-C/Internal/Replicator/CBLHTTPLogic.m index 203f2e7a2..65c7db8d1 100644 --- a/Objective-C/Internal/Replicator/CBLHTTPLogic.m +++ b/Objective-C/Internal/Replicator/CBLHTTPLogic.m @@ -206,7 +206,7 @@ - (CFHTTPMessageRef) newHTTPRequest { } // Add authentication: - if (_responseMsg && _credential.user && !(_proxyType == kCBLHTTPProxy && _useProxyCONNECT)) { + if (_credential.user && !(_proxyType == kCBLHTTPProxy && _useProxyCONNECT)) { if (![self addAuthentication: _credential toRequest: httpMsg forProxy: false]) _credential = nil; } @@ -288,16 +288,6 @@ - (void) receivedResponse: (CFHTTPMessageRef)response { case 401: { NSString* authResponse = getHeader(_responseMsg, @"WWW-Authenticate"); - if (!_authorizationHeader) { - if (!_credential) - _credential = [self credentialForAuthHeader: authResponse]; - CBLLog(WebSocket, @"%@: Auth challenge; credential = %@", self, _credential); - if (_credential) { - // Recoverable auth failure -- try again with new _credential: - _shouldRetry = YES; - break; - } - } CBLLog(WebSocket, @"%@: HTTP auth failed; sent Authorization: %@ ; got WWW-Authenticate: %@", self, _authorizationHeader, authResponse); NSDictionary* challengeInfo = [[self class] parseAuthHeader: authResponse];