mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Fixup to perform a full load
This commit is contained in:
parent
4b5e342c89
commit
e6c387f8fd
1 changed files with 14 additions and 8 deletions
|
@ -67,7 +67,7 @@ resourceDataDidBecomeAvailable: (NSData *)newBytes
|
||||||
{
|
{
|
||||||
[_receivedData release];
|
[_receivedData release];
|
||||||
}
|
}
|
||||||
_receivedData = newBytes;
|
_receivedData = [newBytes retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) URLHandle: (NSURLHandle *)sender
|
- (void) URLHandle: (NSURLHandle *)sender
|
||||||
|
@ -108,7 +108,7 @@ resourceDidFailLoadingWithReason: (NSString *)reason
|
||||||
[handle beginLoadInBackground];
|
[handle beginLoadInBackground];
|
||||||
[handle cancelLoadInBackground];
|
[handle cancelLoadInBackground];
|
||||||
PASS([self status] == URLHandleClientDidCancelLoading,
|
PASS([self status] == URLHandleClientDidCancelLoading,
|
||||||
"URLHandleResourceDidCancelLoading called");
|
"URLHandleClientDidCancelLoading called");
|
||||||
[handle release];
|
[handle release];
|
||||||
|
|
||||||
handle = [[cls alloc] initWithURL: url cached: NO];
|
handle = [[cls alloc] initWithURL: url cached: NO];
|
||||||
|
@ -118,16 +118,22 @@ resourceDidFailLoadingWithReason: (NSString *)reason
|
||||||
*/
|
*/
|
||||||
[handle writeProperty: @"POST" forKey: GSHTTPPropertyMethodKey];
|
[handle writeProperty: @"POST" forKey: GSHTTPPropertyMethodKey];
|
||||||
[handle writeData: [@"Hello" dataUsingEncoding: NSASCIIStringEncoding]];
|
[handle writeData: [@"Hello" dataUsingEncoding: NSASCIIStringEncoding]];
|
||||||
|
[handle setReturnAll: YES];
|
||||||
[handle loadInBackground];
|
[handle loadInBackground];
|
||||||
PASS([self status] == URLHandleClientDidBeginLoading,
|
PASS([self status] == URLHandleClientDidBeginLoading,
|
||||||
"URLHandleResourceDidBeginLoading called");
|
"URLHandleClientDidBeginLoading called");
|
||||||
|
|
||||||
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
|
NSDate *limit = [NSDate dateWithTimeIntervalSinceNow: 5.0];
|
||||||
beforeDate: [NSDate dateWithTimeIntervalSinceNow: 1.0]];
|
while ([limit timeIntervalSinceNow] > 0.0
|
||||||
PASS([self status] == URLHandleClientDidBeginLoading,
|
&& [self status] != URLHandleClientDidFinishLoading)
|
||||||
"URLHandleResourceDidFinishLoading called");
|
{
|
||||||
|
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
|
||||||
|
beforeDate: limit];
|
||||||
|
}
|
||||||
|
PASS([self status] == URLHandleClientDidFinishLoading,
|
||||||
|
"URLHandleClientDidFinishLoading called");
|
||||||
|
|
||||||
|
NSLog(@"Data %@", [handle availableResourceData]);
|
||||||
[handle release];
|
[handle release];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue