Przeglądaj źródła

Fixed static analyzer issues

Pierre-Olivier Latour 8 lat temu
rodzic
commit
44ffec1cf6

+ 1 - 1
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");

+ 4 - 4
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;