mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
* Source/GSURLPrivate.h: Addition of private method to NSURLProtocol
category. * Source/NSURLConnection.m: Changes to use the new method and to correct bug #26107. Patch by: doug@riverrock.org * Source/NSURLProtocol.m: Addition of static method to look up class which can handle the given connection protocol. Patch by: doug@riverrock.org git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28229 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7e2dfe453b
commit
4de027cd20
4 changed files with 61 additions and 3 deletions
|
@ -26,7 +26,6 @@
|
|||
#import <Foundation/NSDebug.h>
|
||||
#import "GSURLPrivate.h"
|
||||
|
||||
|
||||
@interface _NSURLConnectionDataCollector : NSObject <NSURLProtocolClient>
|
||||
{
|
||||
NSURLConnection *_connection; // Not retained
|
||||
|
@ -112,6 +111,13 @@ redirectResponse: (NSURLResponse*)redirectResponse
|
|||
_done = YES;
|
||||
}
|
||||
|
||||
- (void) connection: (NSURLConnection *)connection
|
||||
didFailWithError: (NSError *)error
|
||||
{
|
||||
*_error = error;
|
||||
_done = YES;
|
||||
}
|
||||
|
||||
- (void) URLProtocol: (NSURLProtocol*)proto
|
||||
didReceiveResponse: (NSURLResponse*)response
|
||||
cacheStoragePolicy: (NSURLCacheStoragePolicy)policy
|
||||
|
@ -124,10 +130,29 @@ redirectResponse: (NSURLResponse*)redirectResponse
|
|||
_done = YES;
|
||||
}
|
||||
|
||||
- (void) connectionDidFinishLoading: (NSURLConnection *)connection
|
||||
{
|
||||
_done = YES;
|
||||
}
|
||||
|
||||
|
||||
- (void) URLProtocol: (NSURLProtocol*)proto
|
||||
didLoadData: (NSData*)data
|
||||
{
|
||||
if (_data != nil)
|
||||
if (_data == nil)
|
||||
{
|
||||
_data = [data mutableCopy];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_data appendData: data];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) connection: (NSURLConnection *)connection
|
||||
didReceiveData: (NSData *)data
|
||||
{
|
||||
if (_data == nil)
|
||||
{
|
||||
_data = [data mutableCopy];
|
||||
}
|
||||
|
@ -175,7 +200,7 @@ typedef struct {
|
|||
|
||||
+ (BOOL) canHandleRequest: (NSURLRequest *)request
|
||||
{
|
||||
return [NSURLProtocol canInitWithRequest: request];
|
||||
return ([NSURLProtocol _classToHandleRequest: request] != nil);
|
||||
}
|
||||
|
||||
+ (NSURLConnection *) connectionWithRequest: (NSURLRequest *)request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue