History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ZF-179
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shahar Evron
Reporter: Naoto Ishikawa
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

when redirect to another host, header don't set a new host name.

Created: 30/Jun/06 10:23 PM   Updated: 05/Jul/07 02:44 PM
Component/s: Zend_Http_Client
Affects Version/s: None
Fix Version/s: 0.1.5

Time Tracking:
Not Specified

Resolution Date: 10/Jul/06 02:49 AM


 Description  « Hide
With Zend_Http_Client incubator version,
When a redirect response to another host is returned,
the _prepare_headers method doesn't set the new host name,
so the redirect action doesn't work rightly.

// Set the host header
if (! isset($this->headers['host'])) { $host = $this->uri->getHost() . ($this->uri->getPort() == 80 ? '' : ':' . $this->uri->getPort()); $this->setHeader('host', $host); }

will be fixed to

// Set the host header
$host = $this->uri->getHost() . ($this->uri->getPort() == 80 ? '' : ':' . $this->uri->getPort());
$this->setHeader('host', $host);

Please check it.



 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Shahar Evron - 01/Jul/06 10:05 AM
Please test again with revision 771 - I think the bug is fixed but I have no way to test it right now.

I didn't use the patch you proposed because I want to give people the option to override the "Host" header if they want to by setting it before the request. Instead, I changed the Zend_Http_Client::request() code to unset the "Host" header when redirecting to a valid URI.

Let me know if the problem is solved or not.


Jayson Minard - 09/Jul/06 12:44 AM
Has this been confirmed fixed? If not, set the fix version to 0.2.0 and try to confirm by then.

Naoto Ishikawa - 09/Jul/06 11:34 PM
Sorry, too late.
I tested to access "http://pcweb.mycom.co.jp/" with trunk version(revision 866).
And success redirecting to another host url: "http://jounal.mycom.co.jp/".
Thanks.


// test code
require_once 'Zend.php';
require_once 'Zend/Http/Client.php';

$url = 'http://pcweb.mycom.co.jp/';
$client = new Zend_Http_Client($url);
$response = $client->get();
echo $client->getUri(); // http://journal.mycom.co.jp:80/


Shahar Evron - 10/Jul/06 02:49 AM
Then I guess this confirms that the issue is fixed.

Thank you.


Jayson Minard - 11/Jul/06 11:54 AM
0.1.5 released