User tests: Successful: Unsuccessful:
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).
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
).
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.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
||
Build | 3.5-dev | ⇒ | staging |
Well then merge the darn tests in there and stop making PRs that do a bajillion things (and I actually commented there, geeze)
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-06-24 14:51:31 |
Closed_By | ⇒ | mbabker |
Only because you told me to use the framework code there because I needed to inject a CURL var :P
Thanks @mbabker! Travis timed out, I've restarted the process.