Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Unable to use persistent HTTPS connections with \Zend\Http\Client\Adapter\Socket #2554

Closed
zfbot opened this issue Sep 28, 2012 · 2 comments
Closed

Comments

@zfbot
Copy link

zfbot commented Sep 28, 2012

Jira Information

Original Issue:ZF2-519
Issue Type:Bug
Reporter:commanche
Created:09/04/12
Assignee:weierophinney
Components:Zend\Http

Description

When I use the following setup, I expect, that after the connection is opened on the first request, it is reused for the next ones.

$client = new \Zend\Http\Client('https://example.org/', array(
    'persistent' => true, 
    'ssltransport' => 'ssl'
));

Instead, the connection is closed and new one is opened. The problem is in the socket adapter's connect() method - the part that checks if the new connection's host corresponds to the host we're already connected to:

190:         if (($this->connected_to[0] != $host || $this->connected_to[1] != $port)) {
191:             if (is_resource($this->socket)) {
192:                 $this->close();
193:             }
194:         }

(see http://apigen.juzna.cz/doc/zendframework/zf2/source-class-Zend.Http.Client.Adapter.Socket.html#190)

The stored value is "ssl://example.org" which compared to the $host value "example.org" is always false, so the current connection is then closed.

@zfbot
Copy link
Author

zfbot commented Sep 28, 2012

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF2-519

Known GitHub users mentioned in the original message or comment:
@Commanche, @weierophinney

@jcrawford
Copy link

Fixed in PR #3170

gianarb pushed a commit to zendframework/zend-http that referenced this issue May 15, 2015
gianarb pushed a commit to zendframework/zend-http that referenced this issue May 15, 2015
weierophinney added a commit to zendframework/zend-http that referenced this issue May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants