Re: Redirect (and cookies) support in HTTP_Request2 / HTTP_Client2?
Michael Gauthier <mike <at> silverorange.com>
2009-11-01 20:24:44 GMT
On Sun, 2009-11-01 at 18:40 +0300, Alexey Borzov wrote:
> I'd like to gather some feedback on how to properly implement redirect and
> cookies support in HTTP_Request2 and / or HTTP_Client2.
> First, a bit of background. Redirect support was first done in HTTP_Request by
> its original author, but as the class wasn't designed from the ground up for
> performing multiple requests, redirect implementation was a bit of a hack. It is
> currently disabled by default and its use is discouraged.
> HTTP_Client has a cleaner implementation, it uses a new instance of HTTP_Request
> for doing a redirect, has proper code for resolving relative URLs.
> HTTP_Client also has the following useful features:
> * Stores cookies between requests (persistent storage is also possible);
> * Stores default headers, default request parameters and default listeners.
> These are added to all created instances of HTTP_Request;
> * Can store complete response history;
> * get() / post() / head() / put() / delete() convenience methods.
> Now, skip to HTTP_Request2. I suspect that if one enables redirect support in
> cURL adapter, it will work out of the box. It also isn't that difficult to add
> naïve redirect implementation to Socket adapter, only a matter of porting the
> relevant code from HTTP_Client::_performRequest().
> I'd also like to implement cookie storage support, though, and make us of Public