@@ -141,14 +141,14 @@ - (instancetype)initWithMatchBlock:(GCDWebServerMatchBlock _Nonnull)matchBlock a
141141@implementation GCDWebServer {
142142 dispatch_queue_t _syncQueue;
143143 dispatch_group_t _sourceGroup;
144- NSMutableArray * _handlers;
144+ NSMutableArray <GCDWebServerHandler*> * _handlers;
145145 NSInteger _activeConnections; // Accessed through _syncQueue only
146146 BOOL _connected; // Accessed on main thread only
147147 CFRunLoopTimerRef _disconnectTimer; // Accessed on main thread only
148148
149- NSDictionary * _options;
150- NSMutableDictionary * _authenticationBasicAccounts;
151- NSMutableDictionary * _authenticationDigestAccounts;
149+ NSDictionary < NSString *, id > * _options;
150+ NSMutableDictionary < NSString *, NSString *> * _authenticationBasicAccounts;
151+ NSMutableDictionary < NSString *, NSString *> * _authenticationDigestAccounts;
152152 Class _connectionClass;
153153 CFTimeInterval _disconnectDelay;
154154 dispatch_source_t _source4;
@@ -408,7 +408,7 @@ static void _SocketCallBack(CFSocketRef s, CFSocketCallBackType type, CFDataRef
408408 }
409409}
410410
411- static inline id _GetOption (NSDictionary * options, NSString * key, id defaultValue) {
411+ static inline id _GetOption (NSDictionary < NSString *, id > * options, NSString * key, id defaultValue) {
412412 id value = [options objectForKey: key];
413413 return value ? value : defaultValue;
414414}
@@ -721,7 +721,7 @@ - (void)_willEnterForeground:(NSNotification*)notification {
721721
722722#endif
723723
724- - (BOOL )startWithOptions : (NSDictionary *)options error : (NSError **)error {
724+ - (BOOL )startWithOptions : (NSDictionary <NSString*, id> *)options error : (NSError **)error {
725725 if (_options == nil ) {
726726 _options = options ? [options copy ] : @{};
727727#if TARGET_OS_IPHONE
@@ -832,7 +832,7 @@ - (BOOL)runWithPort:(NSUInteger)port bonjourName:(NSString*)name {
832832 return [self runWithOptions: options error: NULL ];
833833}
834834
835- - (BOOL )runWithOptions : (NSDictionary *)options error : (NSError **)error {
835+ - (BOOL )runWithOptions : (NSDictionary <NSString*, id> *)options error : (NSError **)error {
836836 GWS_DCHECK ([NSThread isMainThread ]);
837837 BOOL success = NO ;
838838 _run = YES ;
@@ -868,7 +868,7 @@ - (void)addDefaultHandlerForMethod:(NSString*)method requestClass:(Class)aClass
868868}
869869
870870- (void )addDefaultHandlerForMethod : (NSString *)method requestClass : (Class )aClass asyncProcessBlock : (GCDWebServerAsyncProcessBlock)block {
871- [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary * requestHeaders, NSString * urlPath, NSDictionary * urlQuery) {
871+ [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary < NSString *, NSString *>* requestHeaders, NSString * urlPath, NSDictionary < NSString *, NSString *> * urlQuery) {
872872 if (![requestMethod isEqualToString: method]) {
873873 return nil ;
874874 }
@@ -888,7 +888,7 @@ - (void)addHandlerForMethod:(NSString*)method path:(NSString*)path requestClass:
888888
889889- (void )addHandlerForMethod : (NSString *)method path : (NSString *)path requestClass : (Class )aClass asyncProcessBlock : (GCDWebServerAsyncProcessBlock)block {
890890 if ([path hasPrefix: @" /" ] && [aClass isSubclassOfClass: [GCDWebServerRequest class ]]) {
891- [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary * requestHeaders, NSString * urlPath, NSDictionary * urlQuery) {
891+ [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary < NSString *, NSString *>* requestHeaders, NSString * urlPath, NSDictionary < NSString *, NSString *> * urlQuery) {
892892 if (![requestMethod isEqualToString: method]) {
893893 return nil ;
894894 }
@@ -915,7 +915,7 @@ - (void)addHandlerForMethod:(NSString*)method pathRegex:(NSString*)regex request
915915- (void )addHandlerForMethod : (NSString *)method pathRegex : (NSString *)regex requestClass : (Class )aClass asyncProcessBlock : (GCDWebServerAsyncProcessBlock)block {
916916 NSRegularExpression * expression = [NSRegularExpression regularExpressionWithPattern: regex options: NSRegularExpressionCaseInsensitive error: NULL ];
917917 if (expression && [aClass isSubclassOfClass: [GCDWebServerRequest class ]]) {
918- [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary * requestHeaders, NSString * urlPath, NSDictionary * urlQuery) {
918+ [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary < NSString *, NSString *>* requestHeaders, NSString * urlPath, NSDictionary < NSString *, NSString *> * urlQuery) {
919919 if (![requestMethod isEqualToString: method]) {
920920 return nil ;
921921 }
@@ -1013,7 +1013,7 @@ - (GCDWebServerResponse*)_responseWithContentsOfDirectory:(NSString*)path {
10131013- (void )addGETHandlerForBasePath : (NSString *)basePath directoryPath : (NSString *)directoryPath indexFilename : (NSString *)indexFilename cacheAge : (NSUInteger )cacheAge allowRangeRequests : (BOOL )allowRangeRequests {
10141014 if ([basePath hasPrefix: @" /" ] && [basePath hasSuffix: @" /" ]) {
10151015 GCDWebServer* __unsafe_unretained server = self;
1016- [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary * requestHeaders, NSString * urlPath, NSDictionary * urlQuery) {
1016+ [self addHandlerWithMatchBlock: ^GCDWebServerRequest*(NSString * requestMethod, NSURL * requestURL, NSDictionary < NSString *, NSString *>* requestHeaders, NSString * urlPath, NSDictionary < NSString *, NSString *> * urlQuery) {
10171017 if (![requestMethod isEqualToString: @" GET" ]) {
10181018 return nil ;
10191019 }
@@ -1168,7 +1168,7 @@ static void _LogResult(NSString* format, ...) {
11681168 fprintf (stdout, " %s \n " , [message UTF8String ]);
11691169}
11701170
1171- - (NSInteger )runTestsWithOptions : (NSDictionary *)options inDirectory : (NSString *)path {
1171+ - (NSInteger )runTestsWithOptions : (NSDictionary <NSString*, id> *)options inDirectory : (NSString *)path {
11721172 GWS_DCHECK ([NSThread isMainThread ]);
11731173 NSArray * ignoredHeaders = @[ @" Date" , @" Etag" ]; // Dates are always different by definition and ETags depend on file system node IDs
11741174 NSInteger result = -1 ;
0 commit comments