Skip to content

关于header 名称大小写问题 #257

@tim0991

Description

@tim0991

php 7.0.7
sdk 7.2.2
os osx 10.11.2

$headers = self::parseHeaders(substr($result, 0, $header_size));

不同环境下header内容如下

浏览器环境下

HTTP/1.1 200 OK
connection: keep-alive
content-length: 1309
content-type: application/json
date: Fri, 19 Jan 2018 06:43:57 GMT
server: openresty
x-log: RSF:2;RSF:4;ZONEPROXY:186
x-reqid: VDQAAKwPRqwMIwsV
x-via: vdn-hnhy-tel-1-2,xs632

cli环境下

HTTP/1.1 200 OK
Server: openresty
Date: Fri, 19 Jan 2018 06:43:57 GMT
Content-Type: application/json
Content-Length: 1309
Connection: keep-alive
X-Log: RSF:2;RSF:4;ZONEPROXY:155
X-Reqid: VDQAAK1HDuIMIwsV
X-Via: vdn-hnhy-tel-1-2,xs99

这将导致后续 Qiniu\Http\Response::isJson 调用失败

strpos($headers['Content-Type'], 'application/json') === 0;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions