@@ -11,6 +11,7 @@ final class Config
1111 const API_HOST = 'api.qiniuapi.com ' ;
1212 const RS_HOST = 'rs.qiniuapi.com ' ; //RS Host
1313 const UC_HOST = 'uc.qbox.me ' ; //UC Host
14+ const QUERY_REGION_HOST = 'kodo-config.qiniuapi.com ' ;
1415 const RTCAPI_HOST = 'http://rtc.qiniuapi.com ' ;
1516 const ARGUS_HOST = 'ai.qiniuapi.com ' ;
1617 const CASTER_HOST = 'pili-caster.qiniuapi.com ' ;
@@ -32,8 +33,9 @@ final class Config
3233 private $ regionCache ;
3334 // UC Host
3435 private $ ucHost ;
36+ private $ queryRegionHost ;
3537 // backup UC Hosts
36- private $ backupUcHosts ;
38+ private $ backupQueryRegionHosts ;
3739 // backup UC Hosts max retry time
3840 public $ backupUcHostsRetryTimes ;
3941
@@ -45,17 +47,18 @@ public function __construct(Region $z = null)
4547 $ this ->useCdnDomains = false ;
4648 $ this ->regionCache = array ();
4749 $ this ->ucHost = Config::UC_HOST ;
48- $ this ->backupUcHosts = array (
49- "kodo-config.qiniuapi.com " ,
50+ $ this ->queryRegionHost = Config::QUERY_REGION_HOST ;
51+ $ this ->backupQueryRegionHosts = array (
52+ "uc.qbox.me " ,
5053 "api.qiniu.com "
5154 );
5255 $ this ->backupUcHostsRetryTimes = 2 ;
5356 }
5457
55- public function setUcHost ($ ucHost, $ backupUcHosts = array () )
58+ public function setUcHost ($ ucHost )
5659 {
5760 $ this ->ucHost = $ ucHost ;
58- $ this ->backupUcHosts = $ backupUcHosts ;
61+ $ this ->setQueryRegionHost ( $ ucHost ) ;
5962 }
6063
6164 public function getUcHost ()
@@ -69,19 +72,31 @@ public function getUcHost()
6972 return $ scheme . $ this ->ucHost ;
7073 }
7174
72- public function appendBackupUcHosts ( $ hosts )
75+ public function setQueryRegionHost ( $ host , $ backupHosts = array () )
7376 {
74- $ this ->backupUcHosts = array_merge ($ this ->backupUcHosts , $ hosts );
77+ $ this ->queryRegionHost = $ host ;
78+ $ this ->backupQueryRegionHosts = $ backupHosts ;
7579 }
7680
77- public function prependBackupUcHosts ( $ hosts )
81+ public function getQueryRegionHost ( )
7882 {
79- $ this ->backupUcHosts = array_merge ($ hosts , $ this ->backupUcHosts );
83+ if ($ this ->useHTTPS === true ) {
84+ $ scheme = "https:// " ;
85+ } else {
86+ $ scheme = "http:// " ;
87+ }
88+
89+ return $ scheme . $ this ->queryRegionHost ;
90+ }
91+
92+ public function setBackupQueryRegionHosts ($ hosts = array ())
93+ {
94+ $ this ->backupQueryRegionHosts = $ hosts ;
8095 }
8196
82- public function getBackupUcHosts ()
97+ public function getBackupQueryRegionHosts ()
8398 {
84- return $ this ->backupUcHosts ;
99+ return $ this ->backupQueryRegionHosts ;
85100 }
86101
87102 public function getUpHost ($ accessKey , $ bucket )
@@ -336,8 +351,8 @@ private function getRegion($accessKey, $bucket)
336351 $ region = Zone::queryZone (
337352 $ accessKey ,
338353 $ bucket ,
339- $ this ->getUcHost (),
340- $ this ->getBackupUcHosts (),
354+ $ this ->getQueryRegionHost (),
355+ $ this ->getBackupQueryRegionHosts (),
341356 $ this ->backupUcHostsRetryTimes
342357 );
343358 if (is_array ($ region )) {
@@ -366,8 +381,8 @@ private function getRegionV2($accessKey, $bucket)
366381 $ region = Zone::queryZone (
367382 $ accessKey ,
368383 $ bucket ,
369- $ this ->getUcHost (),
370- $ this ->getBackupUcHosts (),
384+ $ this ->getQueryRegionHost (),
385+ $ this ->getBackupQueryRegionHosts (),
371386 $ this ->backupUcHostsRetryTimes
372387 );
373388 if (is_array ($ region )) {
0 commit comments