Simplify domain & host parsing
This commit is contained in:
@ -119,11 +119,12 @@ GCDWebServer *webServer =nil;
|
|||||||
|
|
||||||
NSString* rawExceptions = [defaults stringForKey:@"ProxyExceptions"];
|
NSString* rawExceptions = [defaults stringForKey:@"ProxyExceptions"];
|
||||||
if (rawExceptions) {
|
if (rawExceptions) {
|
||||||
NSCharacterSet* seps = [NSCharacterSet characterSetWithCharactersInString:@", 、"];
|
|
||||||
NSCharacterSet* whites = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
NSCharacterSet* whites = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||||
|
NSMutableCharacterSet* seps = [NSMutableCharacterSet characterSetWithCharactersInString:@",、"];
|
||||||
|
[seps formUnionWithCharacterSet:whites];
|
||||||
|
|
||||||
NSArray* exceptions = [rawExceptions componentsSeparatedByCharactersInSet:seps];
|
NSArray* exceptions = [rawExceptions componentsSeparatedByCharactersInSet:seps];
|
||||||
for (NSString* rawDomainOrHost in exceptions) {
|
for (NSString* domainOrHost in exceptions) {
|
||||||
NSString* domainOrHost = [rawDomainOrHost stringByTrimmingCharactersInSet:whites];
|
|
||||||
if ([domainOrHost length] > 0) {
|
if ([domainOrHost length] > 0) {
|
||||||
[args addObject:@"-x"];
|
[args addObject:@"-x"];
|
||||||
[args addObject:domainOrHost];
|
[args addObject:domainOrHost];
|
||||||
|
Reference in New Issue
Block a user