Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ben Copsey
2010-06-30 11:29:47 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4535486c06f9f58306257884e59ffd9b87cab61f
4535486c
1 parent
fd1a9e17
Hopefully make SOCKS proxies work
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
Classes/ASIHTTPRequest.h
Classes/ASIHTTPRequest.m
Classes/ASIHTTPRequest.h
View file @
4535486
...
...
@@ -333,6 +333,10 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
NSString
*
proxyHost
;
int
proxyPort
;
// ASIHTTPRequest will assume kCFProxyTypeHTTP if the proxy type could not be automatically determined
// Set to kCFProxyTypeSOCKS if you are manually configuring a SOCKS proxy
NSString
*
proxyType
;
// URL for a PAC (Proxy Auto Configuration) file. If you want to set this yourself, it's probably best if you use a local file
NSURL
*
PACurl
;
...
...
@@ -749,6 +753,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
@property
(
retain
)
NSString
*
proxyHost
;
@property
(
assign
)
int
proxyPort
;
@property
(
retain
)
NSString
*
proxyType
;
@property
(
retain
,
setter
=
setURL
:
)
NSURL
*
url
;
@property
(
retain
)
NSURL
*
originalURL
;
...
...
Classes/ASIHTTPRequest.m
View file @
4535486
...
...
@@ -24,7 +24,7 @@
// Automatically set on build
NSString
*
ASIHTTPRequestVersion
=
@"v1.7-
4
2010-06-30"
;
NSString
*
ASIHTTPRequestVersion
=
@"v1.7-
5
2010-06-30"
;
NSString
*
const
NetworkRequestErrorDomain
=
@"ASIHTTPRequestErrorDomain"
;
...
...
@@ -936,17 +936,35 @@ static NSOperationQueue *sharedQueue = nil;
NSDictionary
*
settings
=
[
proxies
objectAtIndex
:
0
];
[
self
setProxyHost
:[
settings
objectForKey
:(
NSString
*
)
kCFProxyHostNameKey
]];
[
self
setProxyPort
:[[
settings
objectForKey
:(
NSString
*
)
kCFProxyPortNumberKey
]
intValue
]];
[
self
setProxyType
:[
settings
objectForKey
:(
NSString
*
)
kCFProxyTypeKey
]];
}
}
if
([
self
proxyHost
]
&&
[
self
proxyPort
])
{
NSString
*
hostKey
=
(
NSString
*
)
kCFStreamPropertyHTTPProxyHost
;
NSString
*
portKey
=
(
NSString
*
)
kCFStreamPropertyHTTPProxyPort
;
if
([[[[
self
url
]
scheme
]
lowercaseString
]
isEqualToString
:
@"https"
])
{
hostKey
=
(
NSString
*
)
kCFStreamPropertyHTTPSProxyHost
;
portKey
=
(
NSString
*
)
kCFStreamPropertyHTTPSProxyPort
;
NSString
*
hostKey
;
NSString
*
portKey
;
if
(
!
[
self
proxyType
])
{
[
self
setProxyType
:(
NSString
*
)
kCFProxyTypeHTTP
];
}
if
([[
self
proxyType
]
isEqualToString
:(
NSString
*
)
kCFProxyTypeSOCKS
])
{
hostKey
=
(
NSString
*
)
kCFStreamPropertySOCKSProxyHost
;
portKey
=
(
NSString
*
)
kCFStreamPropertySOCKSProxyPort
;
}
else
{
hostKey
=
(
NSString
*
)
kCFStreamPropertyHTTPProxyHost
;
portKey
=
(
NSString
*
)
kCFStreamPropertyHTTPProxyPort
;
if
([[[[
self
url
]
scheme
]
lowercaseString
]
isEqualToString
:
@"https"
])
{
hostKey
=
(
NSString
*
)
kCFStreamPropertyHTTPSProxyHost
;
portKey
=
(
NSString
*
)
kCFStreamPropertyHTTPSProxyPort
;
}
}
NSMutableDictionary
*
proxyToUse
=
[
NSMutableDictionary
dictionaryWithObjectsAndKeys
:[
self
proxyHost
],
hostKey
,[
NSNumber
numberWithInt
:[
self
proxyPort
]],
portKey
,
nil
];
CFReadStreamSetProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertyHTTPProxy
,
proxyToUse
);
if
([[
self
proxyType
]
isEqualToString
:(
NSString
*
)
kCFProxyTypeSOCKS
])
{
CFReadStreamSetProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertySOCKSProxy
,
proxyToUse
);
}
else
{
CFReadStreamSetProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertyHTTPProxy
,
proxyToUse
);
}
}
//
...
...
@@ -3996,6 +4014,7 @@ static NSOperationQueue *sharedQueue = nil;
@synthesize
proxyCredentials
;
@synthesize
proxyHost
;
@synthesize
proxyPort
;
@synthesize
proxyType
;
@synthesize
PACurl
;
@synthesize
authenticationScheme
;
@synthesize
proxyAuthenticationScheme
;
...
...
Please
register
or
login
to post a comment