From 49a23effa00b5f0acfc408fd1e5b47a9e96fd5f8 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Tue, 13 Aug 2013 21:38:12 -0700 Subject: [PATCH] Changing request_config to config. Adding curl adapter options. --- src/Guzzle/Http/Adapter/Curl/CurlFactory.php | 6 +++++- src/Guzzle/Http/Message/MessageFactory.php | 9 +++++++++ src/Guzzle/Http/Message/MessageFactoryInterface.php | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Guzzle/Http/Adapter/Curl/CurlFactory.php b/src/Guzzle/Http/Adapter/Curl/CurlFactory.php index 423cf56f..031ae71d 100644 --- a/src/Guzzle/Http/Adapter/Curl/CurlFactory.php +++ b/src/Guzzle/Http/Adapter/Curl/CurlFactory.php @@ -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; diff --git a/src/Guzzle/Http/Message/MessageFactory.php b/src/Guzzle/Http/Message/MessageFactory.php index 0a7fb0c2..958d5dd4 100644 --- a/src/Guzzle/Http/Message/MessageFactory.php +++ b/src/Guzzle/Http/Message/MessageFactory.php @@ -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) { diff --git a/src/Guzzle/Http/Message/MessageFactoryInterface.php b/src/Guzzle/Http/Message/MessageFactoryInterface.php index 6f501de3..5a796566 100644 --- a/src/Guzzle/Http/Message/MessageFactoryInterface.php +++ b/src/Guzzle/Http/Message/MessageFactoryInterface.php @@ -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