Skip to content

Commit

Permalink
Fix BasicAuth header not getting sent when SG GUEST is enabled
Browse files Browse the repository at this point in the history
Sent the Basic Auth header without wating for challenge.

#2216
  • Loading branch information
pasin committed Oct 22, 2018
1 parent 0e4aaf2 commit d174519
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions Objective-C/Internal/Replicator/CBLHTTPLogic.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit d174519

Please sign in to comment.