forked from GetiPlayerAutomator/get-iplayer-automator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HTTPProxy.m
40 lines (34 loc) · 953 Bytes
/
HTTPProxy.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// HTTPProxy.m
// Get_iPlayer GUI
//
#import "HTTPProxy.h"
@implementation HTTPProxy
- (id)initWithURL:(NSURL *)aURL
{
self = [super init];
url = [aURL copy];
if ([[[url scheme] lowercaseString] isEqualToString:@"https"])
type = (NSString *)kCFProxyTypeHTTPS;
else
type = (NSString *)kCFProxyTypeHTTP;
host = [[url host] copy];
port = [[url port] integerValue];
user = [[url user] copy];
password = [[url password] copy];
return self;
}
- (id)initWithString:(NSString *)aString
{
if ([[aString lowercaseString] hasPrefix:@"http://"] || [[aString lowercaseString] hasPrefix:@"https://"])
return [self initWithURL:[NSURL URLWithString:aString]];
else
return [self initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", aString]]];
}
@synthesize url;
@synthesize type;
@synthesize host;
@synthesize port;
@synthesize user;
@synthesize password;
@end