Use an own http client adapter


(ixiter) #1

The Problem with Zend_Http_Client is, that it uses Zend_Http_Client_Adapter_Socket by default, which uses stream_socket_client() for the HTTP Request. stream_socket_client() allows connection, using all PHP supported protocols.
For that reason, stream_socket_open() is disabled at some Shared Hosting Systems.
This results in Error Messages i.e. in the Piwik Blog widget on my piwik main page. My System cant do the Http Request for the feed.

My Suggestion is to implement an own Piwik_Http_Client_Adapter_Fsockopen that uses, as said, fsockopen() to do HTTP Requests. fsockopen() allows only tcp:// and udp:// and isnt disabled usually.

Maybe we need also Piwik_Http_Client to set our Adapter as default. And maybe we need to change further classes in the chain to Zend_Feed? I didnt check details yet, only know the basic problem style_emoticons/<#EMO_DIR#>/wink.gif


(vipsoft) #2

Thanks. There’s already a patch in trac awaiting review.


(ixiter) #3

Ah, thx. I need to watch the SVN some more.


(Matthieu Aubry) #4

does the patch in SVN also cover the widget Piwik Blog? I thought it covered the update check request?


(vipsoft) #5

No. This isn’t covered by the changes, now in core/Http.php.

Looking at Zend_Feed and Zend_Http_Client, it looks like this would require coding a new Zend_Http_Client_Adapter_*. At that point, we might consider refactoring Piwik_Http to use Zend_Http_Client.