Skip navigation.
 
mlRe: How to get NSURL* form NSURLConnection?
FROM : Rob Napier
DATE : Mon Mar 24 23:35:59 2008

Heh, you're right. I went looking through my code and realized that I've
solved it in the past by subclassing NSURLConnection to add a request
accessor or by maintaining a dictionary of connection->request objects in
the delegate.

I'm so used to my subclass that I forgot it's not in real Cocoa.... For an
example of the same issue solved for NSURLProtocol, you can look at some of
my code here:


http://code.google.com/p/pandoraboy/source/browse/trunk/ProxyURLProtocol.m

Focus on initWithRequest:cachedResponse:client for the basic idea (it's
really simple).

-Rob

On Mon, Mar 24, 2008 at 5:39 PM, Laurent Cerveau <<email_removed>> wrote:

> Hi Rob
> Thanks for the answer. Unfortunately I do not see the points of getting
> the NSURLRequest. For example if I implement the delegate method
>
> - (void)connectionDidFinishLoading:(NSURLConnection *)connection;
>
> there is no NSURLRequest here (and no request accessor on the
> NSURLConnection) . Same issue with didFail delegate method.  My problem is
> that I have to manage something like 1000 connections and just being able to
> not have to remember fro which URL there were would simply be nice
>
> Or do I miss something here?
>
>
> laurent
>
> On Mar 24, 2008, at 10:27 PM, Rob Napier wrote:
>
> You get the URL out of the NSURLRequest, which you can fetch at various
> points.
>
> -Rob
>
> On Mon, Mar 24, 2008 at 2:02 PM, Laurent Cerveau <<email_removed>> wrote:
>
> > Hi
> >
> > When using NSURLConnection is  there a way to get back the NSURL from
> > the NSURLConnection (in a delegate method)? Apparently if I log the
> > NSURLConnection it knows what URL is concerned but I do not find an
> > accessor for it.
> >
> >
> --
> Rob Napier -- Software and Security Consulting -- http://robnapier.net
> "Those who would give up essential liberty to purchase a little temporary
> safety, deserve neither liberty nor safety." -- B. Franklin, Printer
>
>
>



--
Rob Napier -- Software and Security Consulting -- http://robnapier.net
"Those who would give up essential liberty to purchase a little temporary
safety, deserve neither liberty nor safety." -- B. Franklin, Printer

Related mailsAuthorDate
mlHow to get NSURL* form NSURLConnection? Laurent Cerveau Mar 24, 19:02
mlRe: How to get NSURL* form NSURLConnection? Rob Napier Mar 24, 22:27
mlRe: How to get NSURL* form NSURLConnection? Laurent Cerveau Mar 24, 22:39
mlRe: How to get NSURL* form NSURLConnection? Rob Napier Mar 24, 23:35
mlRe: How to get NSURL* form NSURLConnection? Jens Alfke Mar 25, 00:06