Yurunsoft / YurunHttp

YurunHttp 是开源的 PHP HTTP 客户端,支持链式操作,简单易用。完美支持Curl、Swoole 协程。QQ群:17916227
MIT License
261 stars 56 forks source link

[BUG] http 304 响应会导致错误的重定向处理 #3

Closed NHZEX closed 4 years ago

NHZEX commented 4 years ago
[Argument 1 passed to Yurun\Util\YurunHttp\Http\Psr7\Request::withUri() must implement interface Psr\Http\Message\UriInterface, null given, called in /home/vagrant/code/project/vendor/yurunsoft/yurun-http/src/YurunHttp/Handler/Swoole.php on line 307
#class: TypeError
#0 /home/vagrant/code/project/vendor/yurunsoft/yurun-http/src/YurunHttp/Handler/Swoole.php(307): Yurun\Util\YurunHttp\Http\Psr7\Request->withUri(NULL)
#1 /home/vagrant/code/project/vendor/yurunsoft/yurun-http/src/YurunHttp/Handler/Swoole.php(189): Yurun\Util\YurunHttp\Handler\Swoole->recvDefer(Object(Yurun\Util\YurunHttp\Http\Request))
#2 /home/vagrant/code/project/vendor/yurunsoft/yurun-http/src/YurunHttp.php(97): Yurun\Util\YurunHttp\Handler\Swoole->send(Object(Yurun\Util\YurunHttp\Http\Request))
#3 /home/vagrant/code/project/vendor/yurunsoft/yurun-http/src/HttpRequest.php(756): Yurun\Util\YurunHttp::send(Object(Yurun\Util\YurunHttp\Http\Request), Object(Yurun\Util\YurunHttp\Handler\Swoole))
#4 /home/vagrant/code/project/vendor/yurunsoft/yurun-http/src/HttpRequest.php(795): Yurun\Util\HttpRequest->send('http://devimage...', Array, 'GET')
#5 /home/vagrant/code/project/App/HttpController/Auth.php(231): Yurun\Util\HttpRequest->get('http://devimage...')
#6 /home/vagrant/code/project/App/HttpController/Auth.php(182): App\HttpController\Auth->handleM3u8('iphone/samples/...', Array)
#7 /home/vagrant/code/project/vendor/easyswoole/http/src/AbstractInterface/Controller.php(115): App\HttpController\Auth->index()
#8 /home/vagrant/code/project/vendor/easyswoole/http/src/Dispatcher.php(182): EasySwoole\Http\AbstractInterface\Controller->__hook('index', Object(EasySwoole\Http\Request), Object(EasySwoole\Http\Response))
#9 /home/vagrant/code/project/vendor/easyswoole/http/src/Dispatcher.php(137): EasySwoole\Http\Dispatcher->controllerHandler(Object(EasySwoole\Http\Request), Object(EasySwoole\Http\Response), '/Auth')
#10 /home/vagrant/code/project/vendor/easyswoole/easyswoole/src/Core.php(255): EasySwoole\Http\Dispatcher->dispatch(Object(EasySwoole\Http\Request), Object(EasySwoole\Http\Response))

https://github.com/Yurunsoft/YurunHttp/blob/b9779fe608856191e816b4ca85727ad9c3bcf4cb/src/YurunHttp/Handler/Swoole.php#L288-L310

http code 的定义: https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status

location 只有 301、302、303、307、308 才会存在 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/Location

Yurunsoft commented 4 years ago

已在 https://github.com/Yurunsoft/YurunHttp/commit/5076c843a19396fabafd46c3c129b42af9d30415 中修复