diff --git a/GCDWebServer/Core/GCDWebServerConnection.m b/GCDWebServer/Core/GCDWebServerConnection.m index b59f3f4..1781696 100644 --- a/GCDWebServer/Core/GCDWebServerConnection.m +++ b/GCDWebServer/Core/GCDWebServerConnection.m @@ -753,7 +753,7 @@ static inline NSUInteger _ScanHexNumber(const void* bytes, NSUInteger size) { NSString* authorizationHeader = [request.headers objectForKey:@"Authorization"]; if ([authorizationHeader hasPrefix:@"Digest "]) { NSString* realm = GCDWebServerExtractHeaderValueParameter(authorizationHeader, @"realm"); - if ([realm isEqualToString:_server.authenticationRealm]) { + if (realm && [_server.authenticationRealm isEqualToString:realm]) { NSString* nonce = GCDWebServerExtractHeaderValueParameter(authorizationHeader, @"nonce"); if ([nonce isEqualToString:_digestAuthenticationNonce]) { NSString* username = GCDWebServerExtractHeaderValueParameter(authorizationHeader, @"username"); diff --git a/GCDWebServer/Core/GCDWebServerPrivate.h b/GCDWebServer/Core/GCDWebServerPrivate.h index 847bf7a..c6a0fac 100644 --- a/GCDWebServer/Core/GCDWebServerPrivate.h +++ b/GCDWebServer/Core/GCDWebServerPrivate.h @@ -207,10 +207,10 @@ extern NSString* GCDWebServerStringFromSockAddr(const struct sockaddr* addr, BOO @interface GCDWebServer () @property(nonatomic, readonly) NSMutableArray* handlers; -@property(nonatomic, readonly) NSString* serverName; -@property(nonatomic, readonly) NSString* authenticationRealm; -@property(nonatomic, readonly) NSMutableDictionary* authenticationBasicAccounts; -@property(nonatomic, readonly) NSMutableDictionary* authenticationDigestAccounts; +@property(nonatomic, readonly, nullable) NSString* serverName; +@property(nonatomic, readonly, nullable) NSString* authenticationRealm; +@property(nonatomic, readonly, nullable) NSMutableDictionary* authenticationBasicAccounts; +@property(nonatomic, readonly, nullable) NSMutableDictionary* authenticationDigestAccounts; @property(nonatomic, readonly) BOOL shouldAutomaticallyMapHEADToGET; @property(nonatomic, readonly) dispatch_queue_priority_t dispatchQueuePriority; - (void)willStartConnection:(GCDWebServerConnection*)connection;