ソースを参照

Allow settings for HttpSocket

Mark Scherer 10 年 前
コミット
cb77df4fdc
1 ファイル変更5 行追加1 行削除
  1. 5 1
      Lib/GeocodeLib.php

+ 5 - 1
Lib/GeocodeLib.php

@@ -8,6 +8,9 @@ App::uses('HttpSocket', 'Network/Http');
  *
  *
  * Used by Tools.GeocoderBehavior
  * Used by Tools.GeocoderBehavior
  *
  *
+ * Pass HttpSocket options as config:
+ * Configure::write('Geocode.HttpSocket.ssl_verify_host', false);
+ *
  * TODOS (since 1.2):
  * TODOS (since 1.2):
  * - Work with exceptions in 2.x
  * - Work with exceptions in 2.x
  *
  *
@@ -691,8 +694,9 @@ class GeocodeLib {
 	 * @return mixed
 	 * @return mixed
 	 */
 	 */
 	protected function _fetch($url, $query) {
 	protected function _fetch($url, $query) {
+		$options = (array)Configure::read('Geocode.HttpSocket');
 		if (!isset($this->HttpSocket)) {
 		if (!isset($this->HttpSocket)) {
-			$this->HttpSocket = new HttpSocket();
+			$this->HttpSocket = new HttpSocket($options);
 		}
 		}
 		foreach ($query as $k => $v) {
 		foreach ($query as $k => $v) {
 			if ($v === '') {
 			if ($v === '') {