mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2024-10-07 08:32:16 +08:00
__unsafe_unretained does not prevent self retain-cycles when not under ARC
This commit is contained in:
parent
811e45ab26
commit
efad06f506
@ -663,7 +663,11 @@ static void _NetServiceClientCallBack(CFNetServiceRef service, CFStreamError* er
|
||||
|
||||
- (void)addGETHandlerForBasePath:(NSString*)basePath directoryPath:(NSString*)directoryPath indexFilename:(NSString*)indexFilename cacheAge:(NSUInteger)cacheAge allowRangeRequests:(BOOL)allowRangeRequests {
|
||||
if ([basePath hasPrefix:@"/"] && [basePath hasSuffix:@"/"]) {
|
||||
#if __has_feature(objc_arc)
|
||||
GCDWebServer* __unsafe_unretained server = self;
|
||||
#else
|
||||
__block GCDWebServer* server = self;
|
||||
#endif
|
||||
[self addHandlerWithMatchBlock:^GCDWebServerRequest *(NSString* requestMethod, NSURL* requestURL, NSDictionary* requestHeaders, NSString* urlPath, NSDictionary* urlQuery) {
|
||||
|
||||
if (![requestMethod isEqualToString:@"GET"]) {
|
||||
|
@ -561,7 +561,11 @@ static inline xmlNodePtr _XMLChildWithName(xmlNodePtr child, const xmlChar* name
|
||||
- (instancetype)initWithUploadDirectory:(NSString*)path {
|
||||
if ((self = [super init])) {
|
||||
_uploadDirectory = [[path stringByStandardizingPath] copy];
|
||||
#if __has_feature(objc_arc)
|
||||
GCDWebDAVServer* __unsafe_unretained server = self;
|
||||
#else
|
||||
__block GCDWebDAVServer* server = self;
|
||||
#endif
|
||||
|
||||
// 9.1 PROPFIND method
|
||||
[self addDefaultHandlerForMethod:@"PROPFIND" requestClass:[GCDWebServerDataRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) {
|
||||
|
@ -277,7 +277,11 @@
|
||||
return nil;
|
||||
}
|
||||
_uploadDirectory = [[path stringByStandardizingPath] copy];
|
||||
#if __has_feature(objc_arc)
|
||||
GCDWebUploader* __unsafe_unretained server = self;
|
||||
#else
|
||||
__block GCDWebUploader* server = self;
|
||||
#endif
|
||||
|
||||
// Resource files
|
||||
[self addGETHandlerForBasePath:@"/" directoryPath:[siteBundle resourcePath] indexFilename:nil cacheAge:3600 allowRangeRequests:NO];
|
||||
|
Loading…
Reference in New Issue
Block a user