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
2009-10-30 16:20:43 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3d2b4de7977878f457eeee2a67f41d642b869cc6
3d2b4de7
1 parent
7c0eddf2
Move autorelease pool to local rather than ivar
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
Classes/ASIHTTPRequest.h
Classes/ASIHTTPRequest.m
Classes/ASIHTTPRequest.h
View file @
3d2b4de
...
...
@@ -245,9 +245,6 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Number of seconds to wait before timing out - default is 10
NSTimeInterval
timeOutSeconds
;
// Autorelease pool for the main loop, since it's highly likely that this operation will run in a thread
NSAutoreleasePool
*
pool
;
// Will be YES when a HEAD request will handle the content-length before this request starts
BOOL
shouldResetProgressIndicators
;
...
...
Classes/ASIHTTPRequest.m
View file @
3d2b4de
...
...
@@ -436,12 +436,12 @@ static BOOL isiPhoneOS2;
// Create the request
-
(
void
)
main
{
[
pool
release
];
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
[
self
setComplete
:
NO
];
if
(
!
[
self
url
])
{
[
self
failWithError
:
ASIUnableToCreateRequestError
];
[
pool
release
];
return
;
}
...
...
@@ -459,6 +459,7 @@ static BOOL isiPhoneOS2;
request
=
CFHTTPMessageCreateRequest
(
kCFAllocatorDefault
,
(
CFStringRef
)[
self
requestMethod
],
(
CFURLRef
)[
self
url
],
[
self
useHTTPVersionOne
]
?
kCFHTTPVersion1_0
:
kCFHTTPVersion1_1
);
if
(
!
request
)
{
[
self
failWithError
:
ASIUnableToCreateRequestError
];
[
pool
release
];
return
;
}
...
...
@@ -481,6 +482,8 @@ static BOOL isiPhoneOS2;
}
[
self
loadRequest
];
[
pool
release
];
}
-
(
void
)
applyAuthorizationHeader
...
...
@@ -786,6 +789,7 @@ static BOOL isiPhoneOS2;
// Wait for the request to finish
while
(
!
complete
)
{
// We won't let the request cancel until we're done with this cycle of the loop
[[
self
cancelledLock
]
lock
];
...
...
@@ -797,13 +801,11 @@ static BOOL isiPhoneOS2;
break
;
}
// This may take a while, so we'll release the pool each cycle to stop a giant backlog of autoreleased objects building up
[
pool
release
];
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
// This may take a while, so we'll create a new pool each cycle to stop a giant backlog of autoreleased objects building up
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSDate
*
now
=
[
NSDate
date
];
NSDate
*
now
=
[
NSDate
date
];
// See if we need to timeout
if
(
lastActivityTime
&&
timeOutSeconds
>
0
&&
[
now
timeIntervalSinceDate
:
lastActivityTime
]
>
timeOutSeconds
)
{
...
...
@@ -816,6 +818,7 @@ static BOOL isiPhoneOS2;
[
self
cancelLoad
];
[
self
setComplete
:
YES
];
[[
self
cancelledLock
]
unlock
];
[
pool
release
];
break
;
}
}
...
...
@@ -836,6 +839,7 @@ static BOOL isiPhoneOS2;
[
self
main
];
}
[
pool
release
];
break
;
}
...
...
@@ -861,9 +865,10 @@ static BOOL isiPhoneOS2;
[[
self
cancelledLock
]
unlock
];
[
pool
release
];
}
[
pool
release
];
pool
=
nil
;
}
// Cancel loading and clean up. DO NOT USE THIS TO CANCEL REQUESTS - use [request cancel] instead
...
...
Please
register
or
login
to post a comment