1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-24 18:13:00 +01:00

Changing request_config to config. Adding curl adapter options.

This commit is contained in:
Michael Dowling 2013-08-13 21:38:12 -07:00
parent 4dd901f9cb
commit 49a23effa0
3 changed files with 15 additions and 2 deletions

View File

@ -32,8 +32,12 @@ class CurlFactory
$this->applyMethod($request, $options);
$this->applyTransferOptions($request, $response, $options);
$this->applyHeaders($request, $options);
$handle = curl_init();
unset($options['_headers']);
// Add adapter options from the request's configuration options
if ($config = $request->getConfig()['curl']) {
$options = $config + $options;
}
$handle = curl_init();
curl_setopt_array($handle, $options);
return $handle;

View File

@ -146,6 +146,15 @@ class MessageFactory implements MessageFactoryInterface
}
}
private function visit_config(RequestInterface $request, $value)
{
if (!is_array($value)) {
throw new \InvalidArgumentException('config value must be an associative array');
}
$request->getConfig()->overwriteWith($value);
}
private function visit_allow_redirects(RequestInterface $request, $value)
{
if ($value !== false) {

View File

@ -43,7 +43,7 @@ interface MessageFactoryInterface
* the certificate.
* "proxy": Specify an HTTP proxy (e.g. "http://username:password@192.168.16.1:10")
* "debug": Set to true to display all data sent over the wire
* "request_config": Associative array of options that are forwarded to a request's config collection.
* "config": Associative array of options that are forwarded to a request's config collection.
* These values are used as configuration options that can be consumed by plugins and adapters.
* "expect": Set to true to enable "Expect: 100-Continue" headers for requests that send a body. Set to
* false to disable for all requests. So to a number so that the size of the payload must be greater