Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Mxmilu666 opened this issue May 4, 2024 · 7 comments
Closed

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

Mxmilu666 opened this issue May 4, 2024 · 7 comments

Comments

@Mxmilu666
Copy link

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
Copy link
Member

NathanFreeman commented May 4, 2024

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

@Mxmilu666
Copy link
Author

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

@Mxmilu666
Copy link
Author

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

@NathanFreeman
Copy link
Member

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

@Mxmilu666
Copy link
Author

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

@twose
Copy link
Member

twose commented May 4, 2024

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

@Mxmilu666
Copy link
Author

那我看看别的库什么的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants