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-02-04 12:00:21 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6639959e8f44915c58ab9ae9f2685c8f5c0651f3
6639959e
1 parent
ebeb785d
Added the ability to set the default timeout
Tweak locking behaviour for session credentials
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
Classes/ASIHTTPRequest.h
Classes/ASIHTTPRequest.m
Classes/Tests/ASIHTTPRequestTests.m
Classes/ASIHTTPRequest.h
View file @
6639959
...
...
@@ -506,6 +506,11 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Called automatically when a request is started to clean up any persistent connections that have expired
+
(
void
)
expirePersistentConnections
;
#pragma mark default time out
+
(
NSTimeInterval
)
defaultTimeOutSeconds
;
+
(
void
)
setDefaultTimeOutSeconds
:(
NSTimeInterval
)
newTimeOutSeconds
;
#pragma mark session credentials
+
(
NSMutableArray
*
)
sessionProxyCredentialsStore
;
...
...
Classes/ASIHTTPRequest.m
View file @
6639959
...
...
@@ -21,7 +21,7 @@
#import "ASIInputStream.h"
// Automatically set on build
NSString
*
ASIHTTPRequestVersion
=
@"v1.5-4
2 2010-02-03
"
;
NSString
*
ASIHTTPRequestVersion
=
@"v1.5-4
3 2010-02-04
"
;
NSString
*
const
NetworkRequestErrorDomain
=
@"ASIHTTPRequestErrorDomain"
;
...
...
@@ -40,6 +40,9 @@ static NSMutableArray *sessionCookies = nil;
// The number of times we will allow requests to redirect before we fail with a redirection error
const
int
RedirectionLimit
=
5
;
// The default number of seconds to use for a timeout
static
NSTimeInterval
defaultTimeOutSeconds
=
10
;
static
void
ReadStreamClientCallBack
(
CFReadStreamRef
readStream
,
CFStreamEventType
type
,
void
*
clientCallBackInfo
)
{
[((
ASIHTTPRequest
*
)
clientCallBackInfo
)
handleNetworkEvent
:
type
];
}
...
...
@@ -227,7 +230,7 @@ static BOOL isiPhoneOS2;
[
self
setDefaultResponseEncoding
:
NSISOLatin1StringEncoding
];
[
self
setShouldPresentProxyAuthenticationDialog
:
YES
];
[
self
setTimeOutSeconds
:
10
];
[
self
setTimeOutSeconds
:
[
ASIHTTPRequest
defaultTimeOutSeconds
]
];
[
self
setUseSessionPersistance
:
YES
];
[
self
setUseCookiePersistance
:
YES
];
[
self
setValidatesSecureCertificate
:
YES
];
...
...
@@ -2733,21 +2736,37 @@ static BOOL isiPhoneOS2;
return
newRequest
;
}
#pragma mark default time out
+
(
NSTimeInterval
)
defaultTimeOutSeconds
{
return
defaultTimeOutSeconds
;
}
+
(
void
)
setDefaultTimeOutSeconds
:
(
NSTimeInterval
)
newTimeOutSeconds
{
defaultTimeOutSeconds
=
newTimeOutSeconds
;
}
#pragma mark session credentials
+
(
NSMutableArray
*
)
sessionProxyCredentialsStore
{
[
sessionCredentialsLock
lock
];
if
(
!
sessionProxyCredentialsStore
)
{
sessionProxyCredentialsStore
=
[[
NSMutableArray
alloc
]
init
];
}
[
sessionCredentialsLock
unlock
];
return
sessionProxyCredentialsStore
;
}
+
(
NSMutableArray
*
)
sessionCredentialsStore
{
[
sessionCredentialsLock
lock
];
if
(
!
sessionCredentialsStore
)
{
sessionCredentialsStore
=
[[
NSMutableArray
alloc
]
init
];
}
[
sessionCredentialsLock
unlock
];
return
sessionCredentialsStore
;
}
...
...
Classes/Tests/ASIHTTPRequestTests.m
View file @
6639959
...
...
@@ -242,6 +242,14 @@
BOOL
success
=
[[
request
error
]
code
]
==
ASIRequestTimedOutErrorType
;
GHAssertTrue
(
success
,
@"Timeout didn't generate the correct error"
);
[
ASIHTTPRequest
setDefaultTimeOutSeconds
:
0
.
0001
];
[
request
startSynchronous
];
success
=
[[
request
error
]
code
]
==
ASIRequestTimedOutErrorType
;
GHAssertTrue
(
success
,
@"Failed to change the default timeout"
);
[
ASIHTTPRequest
setDefaultTimeOutSeconds
:
10
];
}
...
...
Please
register
or
login
to post a comment