File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ public function getBackupUpHostByToken($uptoken)
3636 {
3737 list ($ ak , $ bucket ) = $ this ->unmarshalUpToken ($ uptoken );
3838 list ($ upHosts ,) = $ this ->getUpHosts ($ ak , $ bucket );
39- return $ upHosts [1 ];
39+
40+ $ upHost = isset ($ upHosts [1 ]) ? $ upHosts [1 ] : $ upHosts [0 ];
41+ return $ upHost ;
4042 }
4143
4244 public function getIoHost ($ ak , $ bucket )
Original file line number Diff line number Diff line change @@ -51,6 +51,30 @@ public function testUpHosts()
5151 $ this ->assertEquals ('https://up-z1.qbox.me ' , $ upHosts [0 ]);
5252 }
5353
54+ public function testUpHostByToken ()
55+ {
56+ $ uptoken_bc = 'QWYn5TFQsLLU1pL5MFEmX3s5DmHdUThav9WyOWOm:bl77a3xPdTyBNYFGVRy
57+ oIQNyp_s=:eyJzY29wZSI6InBocHNkay1iYyIsImRlYWRsaW5lIjoxNDcwNzI1MzE1LCJ1cEhvc
58+ 3RzIjpbImh0dHA6XC9cL3VwLXoxLnFpbml1LmNvbSIsImh0dHA6XC9cL3VwbG9hZC16MS5xaW5p
59+ dS5jb20iLCItSCB1cC16MS5xaW5pdS5jb20gaHR0cDpcL1wvMTA2LjM4LjIyNy4yNyJdfQ== ' ;
60+
61+ $ upHost = $ this ->zone ->getUpHostByToken ($ uptoken_bc );
62+ $ this ->assertEquals ('http://up-z1.qiniu.com ' , $ upHost );
63+
64+ $ upHostBackup = $ this ->zone ->getBackupUpHostByToken ($ uptoken_bc );
65+ $ this ->assertEquals ('http://upload-z1.qiniu.com ' , $ upHostBackup );
66+
67+
68+ $ uptoken_bc_https = 'QWYn5TFQsLLU1pL5MFEmX3s5DmHdUThav9WyOWOm:7I47O-vFcN5TKO
69+ 6D7cobHPVkyIA=:eyJzY29wZSI6InBocHNkay1iYyIsImRlYWRsaW5lIjoxNDcwNzIyNzQ1LCJ1c
70+ Ehvc3RzIjpbImh0dHBzOlwvXC91cC16MS5xYm94Lm1lIl19 ' ;
71+ $ upHost = $ this ->zoneHttps ->getUpHostByToken ($ uptoken_bc_https );
72+ $ this ->assertEquals ('https://up-z1.qbox.me ' , $ upHost );
73+
74+ $ upHostBackup = $ this ->zoneHttps ->getBackupUpHostByToken ($ uptoken_bc_https );
75+ $ this ->assertEquals ('https://up-z1.qbox.me ' , $ upHostBackup );
76+ }
77+
5478 public function testIoHosts ()
5579 {
5680
You can’t perform that action at this time.
0 commit comments