Re: Fix for NSURLProtocol

2009-02-28 Thread p . o . roussel
Selon Richard Frith-Macdonald rich...@tiptree.demon.co.uk:


 On 27 Feb 2009, at 21:04, p.o.rous...@free.fr wrote:

  Hi all,
 
  The attached patch allows me to use NSURLConnection with an URL
  needing
  authentication.
  Without that change the connection never receives data and ends
  right after
  didReceiveAuthenticationChallenge: is received and treated by the
  delegate.
 
  This patch may not be the right fix, I didn't looked closely.

 Thanks ... I did something slightly different.  I think the ASSIGN()
 you used would cause a memory leak as the request being assigned was
 produced by a mutable copy and was not autoreleased.
 Please try doing:

 [this-request release];
 this-request = request;

Yes, you're obviously right, I didn't think about request lifecycle. Thanks for
the explanation.

Philippe




___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Fix for NSURLProtocol

2009-02-27 Thread p . o . roussel
Hi all,

The attached patch allows me to use NSURLConnection with an URL needing
authentication.
Without that change the connection never receives data and ends right after
didReceiveAuthenticationChallenge: is received and treated by the delegate.

This patch may not be the right fix, I didn't looked closely.

Hope this helps,
Philippe
Index: Source/NSURLProtocol.m
===
--- Source/NSURLProtocol.m	(révision 28000)
+++ Source/NSURLProtocol.m	(copie de travail)
@@ -1085,8 +1085,10 @@
 		  [request setValue: auth
 			forHTTPHeaderField: @Authorization];
 		  [self stopLoading];
+		  ASSIGN(this-request, request);
 		  DESTROY(this-cachedResponse);
 		  [self startLoading];
+		  return;
 		}
 		}
 	}
___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev