{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/226","labels_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/226/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/226/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/226/events","html_url":"https://github.com/elastic/elasticsearch-php/issues/226","id":70533074,"number":226,"title":"Guzzle options are not being honored","user":{"login":"warroyo","id":616621,"avatar_url":"https://avatars.githubusercontent.com/u/616621?v=3","gravatar_id":"","url":"https://api.github.com/users/warroyo","html_url":"https://github.com/warroyo","followers_url":"https://api.github.com/users/warroyo/followers","following_url":"https://api.github.com/users/warroyo/following{/other_user}","gists_url":"https://api.github.com/users/warroyo/gists{/gist_id}","starred_url":"https://api.github.com/users/warroyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warroyo/subscriptions","organizations_url":"https://api.github.com/users/warroyo/orgs","repos_url":"https://api.github.com/users/warroyo/repos","events_url":"https://api.github.com/users/warroyo/events{/privacy}","received_events_url":"https://api.github.com/users/warroyo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-23T22:55:36Z","updated_at":"2015-04-24T00:08:32Z","closed_at":null,"body":"I am attempting to set the HTTP version to 1.0 (so that a connection will be closed immediately, but it does not seem to be honored. below are my settings when I instantiate the client.\r\n\r\n       $this->params = array(\r\n          'hosts' => array(\r\n              'myhost:443'\r\n          ),\r\n          'connectionParams' => array('auth' => array(\r\n                  'user',\r\n                  $_ENV['ES_pass'],\r\n                  'Basic'\r\n              )\r\n          ),\r\n          'guzzleOptions' => array(\r\n              \\Guzzle\\Http\\Client::SSL_CERT_AUTHORITY => false,\r\n              'version'=>'v1.0'\r\n          ),\r\n          'logging' => true,\r\n          'logPath' => '/pathto/log',\r\n          'logLevel' => 'Log\\LogLevel::DEBUG'\r\n      );\r\n\r\n\r\nGuzzle Docs:\r\n\r\n    $client = new Client('https://api.twitter.com/{version}', array(\r\n    'version'        => 'v1.1',\r\n    'request.options' => array(\r\n        'headers' => array('Foo' => 'Bar'),\r\n        'query'   => array('testing' => '123'),\r\n        'auth'    => array('username', 'password', 'Basic|Digest|NTLM|Any'),\r\n        'proxy'   => 'tcp://localhost:80'\r\n     )\r\n    ));"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/comments/95756991","html_url":"https://github.com/elastic/elasticsearch-php/issues/226#issuecomment-95756991","issue_url":"https://api.github.com/repos/elastic/elasticsearch-php/issues/226","id":95756991,"user":{"login":"polyfractal","id":1224228,"avatar_url":"https://avatars.githubusercontent.com/u/1224228?v=3","gravatar_id":"","url":"https://api.github.com/users/polyfractal","html_url":"https://github.com/polyfractal","followers_url":"https://api.github.com/users/polyfractal/followers","following_url":"https://api.github.com/users/polyfractal/following{/other_user}","gists_url":"https://api.github.com/users/polyfractal/gists{/gist_id}","starred_url":"https://api.github.com/users/polyfractal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/polyfractal/subscriptions","organizations_url":"https://api.github.com/users/polyfractal/orgs","repos_url":"https://api.github.com/users/polyfractal/repos","events_url":"https://api.github.com/users/polyfractal/events{/privacy}","received_events_url":"https://api.github.com/users/polyfractal/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T00:08:32Z","updated_at":"2015-04-24T00:08:32Z","body":"To be honest, I'm not sure why `version` isn't being honored.  Other guzzle parameters are being honored, for example:\r\n\r\n```php\r\n$params = [\r\n    'hosts' => ['127.0.0.1:1234'],\r\n    'guzzleOptions' => [\r\n        'version'=>'v1.0',\r\n        'request.options' => [\r\n            'headers' => ['Foo' => 'Bar']\r\n        ]\r\n    ]\r\n];\r\n\r\n$client = new Elasticsearch\\Client($params);\r\n\r\ntry {\r\n    $client->index(['index' => 'test', 'type' => 'test', 'id' => 'test', 'body' => []]);\r\n} catch (\\Exception $e) {\r\n\r\n}\r\n```\r\n\r\n```shell\r\n# spin up a netcat listen server\r\n$ nc -l -v -k 1234\r\n\r\nPUT /test/test/test HTTP/1.1\r\nHost: 127.0.0.1:1234\r\nContent-Type: application/json\r\nUser-Agent: Guzzle/3.9.3 curl/7.39.0 PHP/5.5.20\r\nFoo: Bar                             # <----- Note header being added\r\nContent-Length: 2\r\n\r\n{}\r\n```\r\n\r\nNotice the presence of \"Foo: Bar\" in the headers.  Without digging into the Guzzle code closer, I'm not sure why that particular parameter isn't working.  If you want to force HTTP/1.0, I'd personally just use the raw curl option.  I'd probably forbid connection reuse explicitly too (which would also work for HTTP/1.1):\r\n\r\n```php\r\n$params = [\r\n    'hosts' => ['127.0.0.1:1234'],\r\n    'guzzleOptions' => [\r\n        'curl.options' => [\r\n            CURLOPT_FORBID_REUSE => true,\r\n            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0\r\n        ]\r\n    ]\r\n];\r\n\r\n$client = new Elasticsearch\\Client($params);\r\n\r\ntry {\r\n    $client->index(['index' => 'test', 'type' => 'test', 'id' => 'test', 'body' => []]);\r\n} catch (\\Exception $e) {\r\n\r\n}\r\n```\r\n\r\n```shell\r\nnc -l -v -k 1234\r\n\r\nPUT /test/test/test HTTP/1.0  # <----- Note HTTP/1.0\r\nHost: 127.0.0.1:1234\r\nContent-Type: application/json\r\nUser-Agent: Guzzle/3.9.3 curl/7.39.0 PHP/5.5.20\r\nContent-Length: 2\r\n\r\n{}\r\n```\r\n\r\n"}}