Fix [NSURLProtocol -initWithRequest:cachedResponse:client:] to retain the client (up until the last message is sent to it) as OSX does.

This commit is contained in:
Richard Frith-Macdonald 2020-04-13 08:53:02 +01:00
parent df1b6dd6d5
commit ccb8594bc0
3 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2020-04-13 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSURLProtocol.h:
* Source/NSURLProtocol.m:
Fix [NSURLProtocol -initWithRequest:cachedResponse:client:] to retain
the client (up until the last message is sent to it) as OSX does.
2020-04-12 Richard Frith-Macdonald <rfm@gnu.org>
* CharSets/URLFragmentAllowedCharSet.h:

View file

@ -171,7 +171,8 @@ extern "C" {
* The cachedResponse may be the result of a previous load of the
* request (in which case the protocol may validate and use it).<br />
* The client is the object which receives messages about the progress
* of the load.
* of the load. This is retained by the protocl instance and is released
* once the last message has been sent to it.
*/
- (id) initWithRequest: (NSURLRequest *)request
cachedResponse: (NSCachedURLResponse *)cachedResponse

View file

@ -373,7 +373,7 @@ typedef struct {
NSInputStream *input;
NSOutputStream *output;
NSCachedURLResponse *cachedResponse;
id <NSURLProtocolClient> client; // Not retained
id <NSURLProtocolClient> client;
NSURLRequest *request;
NSString *in;
NSString *out;
@ -526,6 +526,7 @@ static NSURLProtocol *placeholder = nil;
}
DESTROY(this->cachedResponse);
DESTROY(this->request);
DESTROY(this->client);
#if USE_ZLIB
if (this->compressing == YES)
{