? Success

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
24 Jun 2015

This is a backport of joomla-framework/http#12 which enables developers to inject additional adapter specific options into our JHttpTransport interface implementations. This enables developers to set additional options for the transport that are otherwise unable to be set through the API and potentially override some settings depending on how the transport config is assembled.

Also changed with this PR is adding an option to the stream transport to override the path for the cacert.pam file (similar to the curl adapter).

Developer Info

For developers using JHttp there are three new "reserved" keys for the options array; transport.curl, transport.socket, and transport.stream. If using JHttpFactory::getHttp() to build your objects (the preferred method), simply add an array for each of these keys with the transport specific options to inject (examples can be found in the JHttpTransportTest::$options).

Testing Instructions

You can place the below text snippet anywhere which will build a JHttp object with the extra context options added.

$extraOptions = array(
    'transport.curl'   => array(CURLOPT_SSL_VERIFYPEER => false),
    'transport.socket' => array('X-Joomla-Test: true'),
    'transport.stream' => array('ignore_errors' => true)
);

$transportOptions = new \Joomla\Registry\Registry($extraOptions);
$transport = JHttpFactory::getHttp($transportOptions);
$transport->get('http://localhost');

Since the transport connection options aren't retrievable via a public API, you'll need to do a var_dump() on the object the options are being added to before the connection is initiated (this is going to be environment dependent, usually it will be JHttpTransportCurl if your environment supports it). You should verify the extra option is included in the options array. Note for curl that the options array's keys will be integers that match the constant's value, CURLOPT_SSL_VERIFYPEER has a value of 64.

avatar mbabker mbabker - open - 24 Jun 2015
avatar mbabker mbabker - change - 24 Jun 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Jun 2015
Labels Added: ?
Build 3.5-dev staging
avatar Kubik-Rubik
Kubik-Rubik - comment - 24 Jun 2015

Thanks @mbabker! Travis timed out, I've restarted the process.

avatar wilsonge
wilsonge - comment - 24 Jun 2015

All of the code (unit tests not included) are part of #6692 which is already RTC for 3.5

avatar mbabker
mbabker - comment - 24 Jun 2015

Well then merge the darn tests in there and stop making PRs that do a bajillion things (and I actually commented there, geeze) :stuck_out_tongue:

avatar mbabker mbabker - close - 24 Jun 2015
avatar mbabker mbabker - change - 24 Jun 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-06-24 14:51:31
Closed_By mbabker
avatar mbabker mbabker - close - 24 Jun 2015
avatar wilsonge
wilsonge - comment - 24 Jun 2015

Only because you told me to use the framework code there because I needed to inject a CURL var :P

avatar mbabker mbabker - head_ref_deleted - 1 Oct 2015

Add a Comment

Login with GitHub to post a comment