[Frameworkspider-svn] spider-commit [77] util_GetHttpResponseクラスでURLがFQDNで終了してる文字列の場合に接続エラーとなる問題の修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 6月 25日 (木) 10:26:29 JST


Revision: 77
          http://sourceforge.jp/projects/frameworkspider/svn/view?view=rev&revision=77
Author:   m_nakashima
Date:     2009-06-25 10:26:29 +0900 (Thu, 25 Jun 2009)

Log Message:
-----------
util_GetHttpResponseクラスでURLがFQDNで終了してる文字列の場合に接続エラーとなる問題の修正
util_CharUtilityで正規表現関連のメソッド名を変更

Modified Paths:
--------------
    current/DATA/lib/util/CharUtility.class.php
    current/DATA/lib/util/GetHTTPResponse.class.php


-------------- next part --------------
Modified: current/DATA/lib/util/CharUtility.class.php
===================================================================
--- current/DATA/lib/util/CharUtility.class.php	2009-06-25 01:24:58 UTC (rev 76)
+++ current/DATA/lib/util/CharUtility.class.php	2009-06-25 01:26:29 UTC (rev 77)
@@ -238,6 +238,9 @@
 	 * 正規表現で利用する為の文字パターン用にエスケープします。
 	 */
 	function escape_regx_str($str){
+		return util_CharUtility::escapeRegxStr($str);
+	}
+	function escapeRegxStr($str){
 		$str = str_replace('\\', '\\\\', $str);
 		$str = str_replace('*', '\\*', $str);
 		$str = str_replace('+', '\\+', $str);

Modified: current/DATA/lib/util/GetHTTPResponse.class.php
===================================================================
--- current/DATA/lib/util/GetHTTPResponse.class.php	2009-06-25 01:24:58 UTC (rev 76)
+++ current/DATA/lib/util/GetHTTPResponse.class.php	2009-06-25 01:26:29 UTC (rev 77)
@@ -20,6 +20,12 @@
 		list( $pr, $blank, $domain )	= explode('/',$url );
 		$uri	= substr($url,strpos($url,$domain));
 		$uri	= str_replace($domain,"",$uri);
+		if( strlen($uri) == 0 ) {
+			$uri	= '/';
+		}
+		if( preg_match('/^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}/',gethostbyname($domain)) == 0 ) {
+			return false;
+		}
 		return $this->get_response($domain,$uri,$header_params);
 	}
 	function get_response($host,$uri,$header_params=array()){



Frameworkspider-svn メーリングリストの案内
Back to archive index