iphone - Why is there no NSHTTPURLProtocol class? -


OK, NSURLProtocol is a very common right? This is to define all types of protocols, right?

So why is nothing like NSHTTPURLProtocol ? Instead, there is an informal category on NSURLRequest with specific HTTP content why do they do this? Why not have any custom HTTP protocols instead?

What is the idea behind putting all these things in NSURLRequest instead of a custom protocol for HTTP?

Of course, HTTP is often used, but anyway: it is misleading to understand the cocoa / cocoachoch entire URL loading system. Now there are two documents, one says, "Create a custom NSURLProtocol subclass for your custom protocol". The second says: "Create informal categories like HTTP stuff for HTTP stuff at" NSURLRequest ".

There is hope that someone with a deep understanding can make clear;)

These are for many good reasons:

  1. You never have access to NSURLProtocol , which is giving power to the connection; Only the NSURL connection / object itself, even if such methods were added to an imaginary NSHTTPURLProtocol class, how would you reach them?

  2. NSURLConnection This protocol uses the request object to determine. Therefore, all the properties of the request must be created before the Protocol object. For example, you can create a custom protocol that can override the default HTTP implementation, but only for some hosts.

  3. It is very clear to provide all the settings up-front if you can access the protocol object and set the property on its middle load? How to manage it - try to ignore, exception or adjust?


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -