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-20 12:55:30 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
313aab84ffe5006f3ed9b59daa0e33927c72ca0d
313aab84
1 parent
5c731b93
Fix leaking CoreFoundation stuff when running with GC
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
Classes/ASIFormDataRequest.m
Classes/ASIHTTPRequest.m
Mac.xcodeproj/project.pbxproj
Classes/ASIFormDataRequest.m
View file @
313aab8
...
...
@@ -30,7 +30,7 @@
#pragma mark utilities
-
(
NSString
*
)
encodeURL
:(
NSString
*
)
string
{
NSString
*
newString
=
[(
NSString
*
)
CFURLCreateStringByAddingPercentEscapes
(
kCFAllocatorDefault
,
(
CFStringRef
)
string
,
NULL
,
CFSTR
(
":/?#[]@!$ &'()*+,;=
\"
<>%{}|
\\
^~`"
),
CFStringConvertNSStringEncodingToEncoding
([
self
stringEncoding
]))
autorelease
]
;
NSString
*
newString
=
NSMakeCollectable
([(
NSString
*
)
CFURLCreateStringByAddingPercentEscapes
(
kCFAllocatorDefault
,
(
CFStringRef
)
string
,
NULL
,
CFSTR
(
":/?#[]@!$ &'()*+,;=
\"
<>%{}|
\\
^~`"
),
CFStringConvertNSStringEncodingToEncoding
([
self
stringEncoding
]))
autorelease
])
;
if
(
newString
)
{
return
newString
;
}
...
...
Classes/ASIHTTPRequest.m
View file @
313aab8
...
...
@@ -23,7 +23,7 @@
// Automatically set on build
NSString
*
ASIHTTPRequestVersion
=
@"v1.6.2-2
2 2010-06-19
"
;
NSString
*
ASIHTTPRequestVersion
=
@"v1.6.2-2
3 2010-06-20
"
;
NSString
*
const
NetworkRequestErrorDomain
=
@"ASIHTTPRequestErrorDomain"
;
...
...
@@ -871,13 +871,13 @@ static BOOL isiPhoneOS2;
// Can't detect proxies in 2.2.1 Simulator
NSDictionary
*
proxySettings
=
[
NSMutableDictionary
dictionary
];
#else
NSDictionary
*
proxySettings
=
[(
NSDictionary
*
)
CFNetworkCopySystemProxySettings
()
autorelease
]
;
NSDictionary
*
proxySettings
=
NSMakeCollectable
([(
NSDictionary
*
)
CFNetworkCopySystemProxySettings
()
autorelease
])
;
#endif
#else
NSDictionary
*
proxySettings
=
[(
NSDictionary
*
)
SCDynamicStoreCopyProxies
(
NULL
)
autorelease
]
;
NSDictionary
*
proxySettings
=
NSMakeCollectable
([(
NSDictionary
*
)
SCDynamicStoreCopyProxies
(
NULL
)
autorelease
])
;
#endif
proxies
=
[(
NSArray
*
)
CFNetworkCopyProxiesForURL
((
CFURLRef
)[
self
url
],
(
CFDictionaryRef
)
proxySettings
)
autorelease
]
;
proxies
=
NSMakeCollectable
([(
NSArray
*
)
CFNetworkCopyProxiesForURL
((
CFURLRef
)[
self
url
],
(
CFDictionaryRef
)
proxySettings
)
autorelease
])
;
// Now check to see if the proxy settings contained a PAC url, we need to run the script to get the real list of proxies if so
NSDictionary
*
settings
=
[
proxies
objectAtIndex
:
0
];
...
...
@@ -1169,7 +1169,7 @@ static BOOL isiPhoneOS2;
[
self
setLastBytesSent
:
totalBytesSent
];
// Find out how much data we've uploaded so far
[
self
setTotalBytesSent
:[
[(
NSNumber
*
)
CFReadStreamCopyProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertyHTTPRequestBytesWrittenCount
)
autorelease
]
unsignedLongLongValue
]];
[
self
setTotalBytesSent
:[
NSMakeCollectable
([(
NSNumber
*
)
CFReadStreamCopyProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertyHTTPRequestBytesWrittenCount
)
autorelease
])
unsignedLongLongValue
]];
if
(
totalBytesSent
>
lastBytesSent
)
{
// We've uploaded more data, reset the timeout
...
...
@@ -1772,7 +1772,7 @@ static BOOL isiPhoneOS2;
if
([
self
shouldAttemptPersistentConnection
])
{
NSString
*
connectionHeader
=
[[[
self
responseHeaders
]
objectForKey
:
@"Connection"
]
lowercaseString
];
NSString
*
httpVersion
=
[(
NSString
*
)
CFHTTPMessageCopyVersion
(
message
)
autorelease
]
;
NSString
*
httpVersion
=
NSMakeCollectable
([(
NSString
*
)
CFHTTPMessageCopyVersion
(
message
)
autorelease
])
;
// Don't re-use the connection if the server is HTTP 1.0 and didn't send Connection: Keep-Alive
if
(
!
[
httpVersion
isEqualToString
:(
NSString
*
)
kCFHTTPVersion1_0
]
||
[
connectionHeader
isEqualToString
:
@"keep-alive"
])
{
...
...
@@ -2551,7 +2551,7 @@ static BOOL isiPhoneOS2;
[
progressLock
lock
];
// Find out how much data we've uploaded so far
[
self
setLastBytesSent
:
totalBytesSent
];
[
self
setTotalBytesSent
:[
[(
NSNumber
*
)
CFReadStreamCopyProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertyHTTPRequestBytesWrittenCount
)
autorelease
]
unsignedLongLongValue
]];
[
self
setTotalBytesSent
:[
NSMakeCollectable
([(
NSNumber
*
)
CFReadStreamCopyProperty
((
CFReadStreamRef
)[
self
readStream
],
kCFStreamPropertyHTTPRequestBytesWrittenCount
)
autorelease
])
unsignedLongLongValue
]];
[
self
setComplete
:
YES
];
[
self
updateProgressIndicators
];
...
...
@@ -2636,6 +2636,17 @@ static BOOL isiPhoneOS2;
-
(
void
)
markAsFinished
{
[[
self
retain
]
autorelease
];
// release won't be called when running with GC, so we'll clean these up now
if
(
request
)
{
CFMakeCollectable
(
request
);
}
if
(
requestAuthentication
)
{
CFMakeCollectable
(
requestAuthentication
);
}
if
(
proxyAuthentication
)
{
CFMakeCollectable
(
proxyAuthentication
);
}
[
self
willChangeValueForKey
:
@"isFinished"
];
[
self
setInProgress
:
NO
];
[
self
didChangeValueForKey
:
@"isFinished"
];
...
...
@@ -2666,7 +2677,7 @@ static BOOL isiPhoneOS2;
-
(
void
)
handleStreamError
{
NSError
*
underlyingError
=
[(
NSError
*
)
CFReadStreamCopyError
((
CFReadStreamRef
)[
self
readStream
])
autorelease
]
;
NSError
*
underlyingError
=
NSMakeCollectable
([(
NSError
*
)
CFReadStreamCopyError
((
CFReadStreamRef
)[
self
readStream
])
autorelease
])
;
[
self
cancelLoad
];
...
...
@@ -3393,10 +3404,10 @@ static BOOL isiPhoneOS2;
}
// Obtain the list of proxies by running the autoconfiguration script
#if TARGET_IPHONE_SIMULATOR && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0
NSArray
*
proxies
=
[(
NSArray
*
)
CFNetworkCopyProxiesForAutoConfigurationScript
((
CFStringRef
)
script
,(
CFURLRef
)
theURL
)
autorelease
]
;
NSArray
*
proxies
=
NSMakeCollectable
([(
NSArray
*
)
CFNetworkCopyProxiesForAutoConfigurationScript
((
CFStringRef
)
script
,(
CFURLRef
)
theURL
)
autorelease
])
;
#else
CFErrorRef
err2
=
NULL
;
NSArray
*
proxies
=
[(
NSArray
*
)
CFNetworkCopyProxiesForAutoConfigurationScript
((
CFStringRef
)
script
,(
CFURLRef
)
theURL
,
&
err2
)
autorelease
]
;
NSArray
*
proxies
=
NSMakeCollectable
([(
NSArray
*
)
CFNetworkCopyProxiesForAutoConfigurationScript
((
CFStringRef
)
script
,(
CFURLRef
)
theURL
,
&
err2
)
autorelease
])
;
if
(
err2
)
{
return
nil
;
}
...
...
@@ -3420,7 +3431,7 @@ static BOOL isiPhoneOS2;
if
(
!
MIMEType
)
{
return
@"application/octet-stream"
;
}
return
[(
NSString
*
)
MIMEType
autorelease
]
;
return
NSMakeCollectable
([(
NSString
*
)
MIMEType
autorelease
])
;
}
#pragma mark bandwidth measurement / throttling
...
...
Mac.xcodeproj/project.pbxproj
View file @
313aab8
This diff was suppressed by a .gitattributes entry.
Please
register
or
login
to post a comment