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-01-08 11:23:49 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a52a71f76f862344a8f11d9ef7343471c5bfdf7e
a52a71f7
1 parent
da6d8564
Fix stupid regression that broke download progress
You can never have enough tests! :)
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
Classes/ASIHTTPRequest.m
Classes/Tests/ASIHTTPRequestTests.m
Classes/ASIHTTPRequest.m
View file @
a52a71f
...
...
@@ -21,7 +21,7 @@
#import "ASIInputStream.h"
// Automatically set on build
NSString
*
ASIHTTPRequestVersion
=
@"v1.
2-72 2010-01-06
"
;
NSString
*
ASIHTTPRequestVersion
=
@"v1.
5-1 2010-01-08
"
;
NSString
*
const
NetworkRequestErrorDomain
=
@"ASIHTTPRequestErrorDomain"
;
...
...
@@ -2367,6 +2367,10 @@ static BOOL isiPhoneOS2;
-
(
void
)
handleBytesAvailable
{
if
(
!
[
self
responseHeaders
])
{
[
self
readResponseHeaders
];
}
// In certain (presumably very rare) circumstances, handleBytesAvailable seems to be called when there isn't actually any data available
// We'll check that there is actually data available to prevent blocking on CFReadStreamRead()
// So far, I've only seen this in the stress tests, so it might never happen in real-world situations.
...
...
Classes/Tests/ASIHTTPRequestTests.m
View file @
a52a71f
...
...
@@ -446,6 +446,21 @@
BOOL
success
=
(
progress
==
1
.
0
);
GHAssertTrue
(
success
,
@"Failed to properly increment download progress %f != 1.0"
,
progress
);
progress
=
0
;
request
=
[
ASIHTTPRequest
requestWithURL
:[
NSURL
URLWithString
:
@"http://allseeing-i.com/ASIHTTPRequest/tests/the_great_american_novel.txt"
]];
[
request
setDownloadProgressDelegate
:
self
];
[
request
startAsynchronous
];
[[
NSRunLoop
currentRunLoop
]
runUntilDate
:[
NSDate
dateWithTimeIntervalSinceNow
:
2
]];
success
=
(
progress
!=
1
.
0
);
GHAssertTrue
(
success
,
@"Downloaded too quickly, cannot proceed with test"
);
success
=
(
progress
>
0
);
GHAssertTrue
(
success
,
@"Either downloaded too slowly, or progress is not being correctly updated"
);
}
-
(
void
)
testUploadProgress
...
...
Please
register
or
login
to post a comment