浏览代码

Adding missing CURLOPT_PROXYUSERPWD option in Curl Adapter

lganee 7 年之前
父节点
当前提交
4ab2d03f61
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/Http/Client/Adapter/Curl.php

+ 4 - 0
src/Http/Client/Adapter/Curl.php

@@ -121,6 +121,10 @@ class Curl implements AdapterInterface
         if (isset($options['proxy']['proxy'])) {
             $out[CURLOPT_PROXY] = $options['proxy']['proxy'];
         }
+        if (isset($options['proxy']['username'])) {
+            $password = !empty($options['proxy']['password']) ? $options['proxy']['password'] : '';
+            $out[CURLOPT_PROXYUSERPWD] = $options['proxy']['username'] . ':' . $password;
+        }
         if (isset($options['curl']) && is_array($options['curl'])) {
             // Can't use array_merge() because keys will be re-ordered.
             foreach ($options['curl'] as $key => $value) {