正在显示
1 个修改的文件
包含
8 行增加
和
4 行删除
| @@ -40,7 +40,7 @@ class Body { | @@ -40,7 +40,7 @@ class Body { | ||
| 40 | */ | 40 | */ | 
| 41 | public function __construct(string $result, Header $header) | 41 | public function __construct(string $result, Header $header) | 
| 42 | { | 42 | { | 
| 43 | - $this->raw = $result; | 43 | + $this->raw = trim($result); | 
| 44 | 44 | ||
| 45 | $this->header = $header; | 45 | $this->header = $header; | 
| 46 | 46 | ||
| @@ -49,11 +49,11 @@ class Body { | @@ -49,11 +49,11 @@ class Body { | ||
| 49 | $boundary = $this->header->getBoundary(); | 49 | $boundary = $this->header->getBoundary(); | 
| 50 | if($boundary){ | 50 | if($boundary){ | 
| 51 | $this->parseBoundaryBody($this->raw,$boundary); | 51 | $this->parseBoundaryBody($this->raw,$boundary); | 
| 52 | - } | 52 | + }else | 
| 53 | // 不是多块级 | 53 | // 不是多块级 | 
| 54 | - if(stripos($this->header->get('content-type'),'text/')===0){ | 54 | +// if(stripos($this->header->get('content-type'),'text/')===0){ | 
| 55 | $this->parseRawHtml($this->raw); | 55 | $this->parseRawHtml($this->raw); | 
| 56 | - } | 56 | +// } | 
| 57 | 57 | ||
| 58 | 58 | ||
| 59 | } | 59 | } | 
| @@ -136,6 +136,10 @@ class Body { | @@ -136,6 +136,10 @@ class Body { | ||
| 136 | $data->body = explode("\r\n\r\n",$data->body,2)[1]; | 136 | $data->body = explode("\r\n\r\n",$data->body,2)[1]; | 
| 137 | } | 137 | } | 
| 138 | 138 | ||
| 139 | + if(!$data->get('content-type')){ | ||
| 140 | + $data->set('content-type','text/html'); | ||
| 141 | + } | ||
| 142 | + | ||
| 139 | $this->items[] = $this->bodyDeCode($data); | 143 | $this->items[] = $this->bodyDeCode($data); | 
| 140 | 144 | ||
| 141 | } | 145 | } | 
- 
请 注册 或 登录 后发表评论