• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How should a NSURLProtocol handle a wrong URL?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How should a NSURLProtocol handle a wrong URL?


  • Subject: Re: How should a NSURLProtocol handle a wrong URL?
  • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Date: Mon, 04 Aug 2014 10:04:49 +0100

On 2 Aug 2014, at 00:17, Daryle Walker <email@hidden> wrote:

> Why would the goal matter when dealing with URLs that are so malformed that they shouldn’t be passed to the next step in the process.

Because it's likely to cause compatibility problems if your definition of "malformed" is different from someone else's definition.  The last thing you want to do is fail a request that some other protocol could handle properly.  This is especially problematic if the other protocol's implementation can change over time (for example, any of the built-in protocols).

My experience with NSURLProtocols is that lots of really weird URLs end up being passed to +canInitWithRequest: method.  You should be particularly tolerant there, returning NO instead of crashing or tripping an assert.

Beyond that, if you're working on a custom scheme, rather than overriding a built-in scheme, I'd deal with malformed URLs by failing the request with NSURLErrorBadURL.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >How should a NSURLProtocol handle a wrong URL? (From: Daryle Walker <email@hidden>)
 >Re: How should a NSURLProtocol handle a wrong URL? (From: "Quinn \"The Eskimo!\"" <email@hidden>)
 >Re: How should a NSURLProtocol handle a wrong URL? (From: Daryle Walker <email@hidden>)

  • Prev by Date: Re: How should a NSURLProtocol handle a wrong URL?
  • Next by Date: Re: Configure socket used by NSURLConnection?
  • Previous by thread: Re: How should a NSURLProtocol handle a wrong URL?
  • Next by thread: Re: Configure socket used by NSURLConnection?
  • Index(es):
    • Date
    • Thread