Question about NSURLRequest

  • Hi !

    I'm trying to implement reading ldap:// into the URL loading system.
    I've gotten to the point where I need to choose between starting SSL/
    TLS, doing a simple bind, or doing an SASL bind.
    Now I'm planning to use the mechanism in NSURLRequest that allow to
    set protocol-specific information, so that I can choose between a
    simple bind or SASL (SSL/TLS is used when I get an ldaps:// URL), and
    so two questions rose in my mind :

    Why do there is a mutable subclass : If I'm forced to create a
    mutable subclass everytime I need to change my settings, why separate
    them ? Also I guess it could be better to handle specific protocols
    by subclassing from NSURLRequest ?

    Is there something I'm getting wrong ? I find the documentation on
    the URL loading system a little scarce...

    Etienne Samson
  • On Oct 4, 2007, at 9:20 AM, tiennou wrote:

    > Also I guess it could be better to handle specific protocols by
    > subclassing from NSURLRequest ?

    I can't think of any good reason to subclass NS(Mutable)URLRequest.
    If you want to add a new protocol, then you need to subclass
    NSURLProtocol.

    Nick Zitzmann
    <http://www.chronosnet.com/>
  • Le 4 oct. 07 à 18:13, Nick Zitzmann a écrit :

    >
    > On Oct 4, 2007, at 9:20 AM, tiennou wrote:
    >
    >> Also I guess it could be better to handle specific protocols by
    >> subclassing from NSURLRequest ?
    >
    > I can't think of any good reason to subclass NS(Mutable)URLRequest.
    > If you want to add a new protocol, then you need to subclass
    > NSURLProtocol.

    Sorry I made myself unclear ;-).
    I'm subclassing NSURLProtocol to handle this, and I access protocol-
    specific options of an 'incoming' request by calling [NSURLProtocol
    propertyForKey:LDAPSimpleBindProperty inRequest:[self request]] (this
    one to allow the use to choose between SASL and simple bind). As I'm
    developing this thinking about how I'll use my LDAP classes, I'll
    need to create an NSMutableURLRequest, since I'll need to call
    [theRequest setValue:[NSNumber numberWithBool:YES]
    forLDAPOption:LDAPSimpleBindProperty] on it.

    It think it would feel better with NSURLRequest having only protocol-
    specific subclasses (as NSHTTPURLRequest), not just a mutable
    subclass...

    Or maybe I'm doing something wrong ;-)

    Etienne Samson
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today