File tree Expand file tree Collapse file tree 5 files changed +20
-1
lines changed Expand file tree Collapse file tree 5 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Next Version
4
4
* 对象存储,修复无法对 key 为空字符串的对象进行操作
5
+ * 修复 301 重定向无法正确获取 header 信息
5
6
6
7
## 7.8.0 (2022-10-25)
7
8
* 移除不推荐域名,并增加区域亚太-首尔和华东-浙江2
Original file line number Diff line number Diff line change @@ -35,8 +35,9 @@ public function __construct($obj = array())
35
35
*/
36
36
public static function parseRawText ($ raw )
37
37
{
38
+ $ multipleHeaders = explode ("\r\n\r\n" , trim ($ raw ));
38
39
$ headers = array ();
39
- $ headerLines = explode ("\r\n" , $ raw );
40
+ $ headerLines = explode ("\r\n" , end ( $ multipleHeaders ) );
40
41
foreach ($ headerLines as $ line ) {
41
42
$ headerLine = trim ($ line );
42
43
$ kv = explode (': ' , $ headerLine );
Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ public function testGetTimeout()
32
32
$ this ->assertEquals (-1 , $ response ->statusCode );
33
33
}
34
34
35
+ public function testGetRedirect ()
36
+ {
37
+ $ response = Client::get ('localhost:9000/redirect.php ' );
38
+ $ this ->assertEquals (200 , $ response ->statusCode );
39
+ $ this ->assertEquals ('application/json;charset=UTF-8 ' , $ response ->normalizedHeaders ['Content-Type ' ]);
40
+ $ respData = $ response ->json ();
41
+ $ this ->assertEquals ('ok ' , $ respData ['msg ' ]);
42
+ }
43
+
35
44
public function testDelete ()
36
45
{
37
46
$ response = Client::delete ('uc.qbox.me/bucketTagging ' , array ());
Original file line number Diff line number Diff line change
1
+ <?php
2
+ header ("Content-Type: application/json;charset=UTF-8 " );
3
+ echo '{"msg": "ok"} ' ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ header ("Content-Type: text/plain;charset=UTF-8 " , true );
3
+ header ("Location: ./ok.php " , true , 301 );
4
+ echo "redirect to ok.php " ;
5
+ exit ();
You can’t perform that action at this time.
0 commit comments