swoole / swoole-src

🚀 Coroutine-based concurrency library for PHP
https://www.swoole.com
Apache License 2.0
18.25k stars 3.16k forks source link

Can allow_redirects be supported on the HTTP/WebSocket? #5312

Closed Mxmilu666 closed 2 weeks ago

Mxmilu666 commented 2 weeks ago

Please answer these questions before submitting your issue.

  1. What did you do? If possible, provide a simple script for reproducing the error. support allow_redirects on the HTTP/WebSocket

  2. What did you expect to see?

  3. What did you see instead?

  4. What version of Swoole are you using (show your php --ri swoole)?

  5. What is your machine environment used (show your uname -a & php -v & gcc -v) ?

NathanFreeman commented 2 weeks ago

请描述一下你想要allow_redirects实现什么功能

Mxmilu666 commented 2 weeks ago

就最简单的 比如说get() download()支持302跟随 因为我现在需要下载文件,但是下载的地址是302过去的,如果download()的话就无法下载到目标文件

Mxmilu666 commented 2 weeks ago

可能我描述的不是很清楚,是HTTP/WebSocket客户端

NathanFreeman commented 2 weeks ago

HTTP/WebSocket客户端不支持这么操作,看看能否通过HTTP/WebSocket客户端的getHeaders()判断状态码是否302,是的话直接访问响应头的Location指向的地址。

Mxmilu666 commented 2 weeks ago

但是我302跳转可能是三个302或者两个302 那没办法的话我只能自己写逻辑了:(

twose commented 2 weeks ago

你说的是 Coroutine HTTP Client 吧,现在都不用那个了,直接用 cURL 就有,社区库用 guzzle 就可以。

Mxmilu666 commented 2 weeks ago

那我看看别的库什么的