30
30
#import " GCDWebServerRequest.h"
31
31
#import " GCDWebServerResponse.h"
32
32
33
+ NS_ASSUME_NONNULL_BEGIN
34
+
33
35
/* *
34
36
* The GCDWebServerMatchBlock is called for every handler added to the
35
37
* GCDWebServer whenever a new HTTP request has started (i.e. HTTP headers have
40
42
* GCDWebServerRequest instance created with the same basic info.
41
43
* Otherwise, it simply returns nil.
42
44
*/
43
- typedef GCDWebServerRequest* (^GCDWebServerMatchBlock)(NSString * requestMethod, NSURL * requestURL, NSDictionary * requestHeaders, NSString * urlPath, NSDictionary * urlQuery);
45
+ typedef GCDWebServerRequest* _Nullable (^GCDWebServerMatchBlock)(NSString * requestMethod, NSURL * requestURL, NSDictionary * requestHeaders, NSString * urlPath, NSDictionary * urlQuery);
44
46
45
47
/* *
46
48
* The GCDWebServerProcessBlock is called after the HTTP request has been fully
@@ -52,7 +54,7 @@ typedef GCDWebServerRequest* (^GCDWebServerMatchBlock)(NSString* requestMethod,
52
54
* recommended to return a GCDWebServerErrorResponse on error so more useful
53
55
* information can be returned to the client.
54
56
*/
55
- typedef GCDWebServerResponse* (^GCDWebServerProcessBlock)(__kindof GCDWebServerRequest* request);
57
+ typedef GCDWebServerResponse* _Nullable (^GCDWebServerProcessBlock)(__kindof GCDWebServerRequest* request);
56
58
57
59
/* *
58
60
* The GCDWebServerAsynchronousProcessBlock works like the GCDWebServerProcessBlock
@@ -64,7 +66,7 @@ typedef GCDWebServerResponse* (^GCDWebServerProcessBlock)(__kindof GCDWebServerR
64
66
* It's however recommended to return a GCDWebServerErrorResponse on error so more
65
67
* useful information can be returned to the client.
66
68
*/
67
- typedef void (^GCDWebServerCompletionBlock)(GCDWebServerResponse* response);
69
+ typedef void (^GCDWebServerCompletionBlock)(GCDWebServerResponse* _Nullable response);
68
70
typedef void (^GCDWebServerAsyncProcessBlock)(__kindof GCDWebServerRequest* request, GCDWebServerCompletionBlock completionBlock);
69
71
70
72
/* *
@@ -295,7 +297,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
295
297
/* *
296
298
* Sets the delegate for the server.
297
299
*/
298
- @property (nonatomic , assign ) id <GCDWebServerDelegate> delegate;
300
+ @property (nonatomic , weak , nullable ) id <GCDWebServerDelegate> delegate;
299
301
300
302
/* *
301
303
* Returns YES if the server is currently running.
@@ -315,15 +317,15 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
315
317
* @warning This property is only valid if the server is running and Bonjour
316
318
* registration has successfully completed, which can take up to a few seconds.
317
319
*/
318
- @property (nonatomic , readonly ) NSString * bonjourName;
320
+ @property (nonatomic , readonly , nullable ) NSString * bonjourName;
319
321
320
322
/* *
321
323
* Returns the Bonjour service type used by the server.
322
324
*
323
325
* @warning This property is only valid if the server is running and Bonjour
324
326
* registration has successfully completed, which can take up to a few seconds.
325
327
*/
326
- @property (nonatomic , readonly ) NSString * bonjourType;
328
+ @property (nonatomic , readonly , nullable ) NSString * bonjourType;
327
329
328
330
/* *
329
331
* This method is the designated initializer for the class.
@@ -363,7 +365,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
363
365
*
364
366
* Returns NO if the server failed to start and sets "error" argument if not NULL.
365
367
*/
366
- - (BOOL )startWithOptions : (NSDictionary *)options error : (NSError **)error ;
368
+ - (BOOL )startWithOptions : (nullable NSDictionary *)options error : (NSError ** _Nullable )error ;
367
369
368
370
/* *
369
371
* Stops the server and prevents it to accepts new HTTP requests.
@@ -383,7 +385,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
383
385
*
384
386
* @warning This property is only valid if the server is running.
385
387
*/
386
- @property (nonatomic , readonly ) NSURL * serverURL;
388
+ @property (nonatomic , readonly , nullable ) NSURL * serverURL;
387
389
388
390
/* *
389
391
* Returns the server's Bonjour URL.
@@ -393,15 +395,15 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
393
395
* Also be aware this property will not automatically update if the Bonjour hostname
394
396
* has been dynamically changed after the server started running (this should be rare).
395
397
*/
396
- @property (nonatomic , readonly ) NSURL * bonjourServerURL;
398
+ @property (nonatomic , readonly , nullable ) NSURL * bonjourServerURL;
397
399
398
400
/* *
399
401
* Returns the server's public URL.
400
402
*
401
403
* @warning This property is only valid if the server is running and NAT port
402
404
* mapping is active.
403
405
*/
404
- @property (nonatomic , readonly ) NSURL * publicServerURL;
406
+ @property (nonatomic , readonly , nullable ) NSURL * publicServerURL;
405
407
406
408
/* *
407
409
* Starts the server on port 8080 (OS X & iOS Simulator) or port 80 (iOS)
@@ -418,7 +420,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
418
420
*
419
421
* Returns NO if the server failed to start.
420
422
*/
421
- - (BOOL )startWithPort : (NSUInteger )port bonjourName : (NSString *)name ;
423
+ - (BOOL )startWithPort : (NSUInteger )port bonjourName : (nullable NSString *)name ;
422
424
423
425
#if !TARGET_OS_IPHONE
424
426
@@ -431,7 +433,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
431
433
*
432
434
* @warning This method must be used from the main thread only.
433
435
*/
434
- - (BOOL )runWithPort : (NSUInteger )port bonjourName : (NSString *)name ;
436
+ - (BOOL )runWithPort : (NSUInteger )port bonjourName : (nullable NSString *)name ;
435
437
436
438
/* *
437
439
* Runs the server synchronously using -startWithOptions: until a SIGTERM or
@@ -442,7 +444,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
442
444
*
443
445
* @warning This method must be used from the main thread only.
444
446
*/
445
- - (BOOL )runWithOptions : (NSDictionary *)options error : (NSError **)error ;
447
+ - (BOOL )runWithOptions : (nullable NSDictionary *)options error : (NSError ** _Nullable )error ;
446
448
447
449
#endif
448
450
@@ -498,7 +500,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
498
500
* Adds a handler to the server to respond to incoming "GET" HTTP requests
499
501
* with a specific case-insensitive path with in-memory data.
500
502
*/
501
- - (void )addGETHandlerForPath : (NSString *)path staticData : (NSData *)staticData contentType : (NSString *)contentType cacheAge : (NSUInteger )cacheAge ;
503
+ - (void )addGETHandlerForPath : (NSString *)path staticData : (NSData *)staticData contentType : (nullable NSString *)contentType cacheAge : (NSUInteger )cacheAge ;
502
504
503
505
/* *
504
506
* Adds a handler to the server to respond to incoming "GET" HTTP requests
@@ -515,7 +517,7 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
515
517
* The "indexFilename" argument allows to specify an "index" file name to use
516
518
* when the request path corresponds to a directory.
517
519
*/
518
- - (void )addGETHandlerForBasePath : (NSString *)basePath directoryPath : (NSString *)directoryPath indexFilename : (NSString *)indexFilename cacheAge : (NSUInteger )cacheAge allowRangeRequests : (BOOL )allowRangeRequests ;
520
+ - (void )addGETHandlerForBasePath : (NSString *)basePath directoryPath : (NSString *)directoryPath indexFilename : (nullable NSString *)indexFilename cacheAge : (NSUInteger )cacheAge allowRangeRequests : (BOOL )allowRangeRequests ;
519
521
520
522
@end
521
523
@@ -612,8 +614,10 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
612
614
*
613
615
* Returns the number of failed tests or -1 if server failed to start.
614
616
*/
615
- - (NSInteger )runTestsWithOptions : (NSDictionary *)options inDirectory : (NSString *)path ;
617
+ - (NSInteger )runTestsWithOptions : (nullable NSDictionary *)options inDirectory : (NSString *)path ;
616
618
617
619
@end
618
620
619
621
#endif
622
+
623
+ NS_ASSUME_NONNULL_END
0 commit comments