zendframework/zf2 — pull request #4215 by driehle (2013-04-12 13:54:00+00:00)
Title: Bugfix for redirection handling in Zend\Http\Client

When working with Zend\Http\Client today I discovered two issues:

1. Client does not count redirects corectly, so ```maxredirects=1``` did not follow any redirect, ```maxredirects=2``` followed 1 redirect.
2. When following a redirect, the client looses the HTTP authentication, if one was set previously, which causes unexpected results when working with websites which are procted by HTTP basic authentication

The first issue is do to a wrong way of counting the redirects, which I fixed in e196bc3. Basically a compare operator was wrong (```<``` instead of ```<=```). I added a test case for that.

The second issue is due to the fact that the ```send()``` method makes a call to ```resetParameters()``` prior to following the redirect. Unfortunatelly this removes the HTTP authentication as well. I added a new method ```clearAuth()``` (similar to ```clearCookies()```) and changed ```resetParameters()``` to only clear the authentication when the newly introduced second parameter is ```true```. To now break backward-compatibilty, this parameter is true by default. All this was done in 954a549, a test case is added as well.