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

如何禁止url自动转码? #146

Open
Ben-Huang opened this issue May 17, 2022 · 2 comments
Open

如何禁止url自动转码? #146

Ben-Huang opened this issue May 17, 2022 · 2 comments

Comments

@Ben-Huang
Copy link

Ben-Huang commented May 17, 2022

最近打算使用saber来作为twitter api 的客户端,发现saber会自动对url进行转码.导致api请求失败.

经过测试发现:
使用
SaberGM::get("http://127.0.0.1/r.php?max_results=10&tweet.fields=lang,created_at,entities&expansions=attachments.media_keys&media.fields=type,preview_image_url,url");

服务端接收到经过转码的QUERY_STRING:
[QUERY_STRING] => max_results=10&tweet_fields=lang%2Ccreated_at%2Centities&expansions=attachments.media_keys&media_fields=type%2Cpreview_image_url%2Curl

而用curl 发送请求:
curl "http://127.0.0.1/r.php?max_results=10&tweet.fields=lang,created_at,entities&expansions=attachments.media_keys&media.fields=type,preview_image_url,url"
服务端能接收到正确的QUERY_STRING:
[QUERY_STRING] => max_results=10&tweet.fields=lang,created_at,entities&expansions=attachments.media_keys&media.fields=type,preview_image_url,url

请问如何禁止saber对url自动转码?

@twose
Copy link
Member

twose commented May 23, 2022

服务器端不能urldecode一下吗?这里是参照guzzle的一个实现

@Ben-Huang
Copy link
Author

服务器端不能urldecode一下吗?这里是参照guzzle的一个实现

服务器的处理不是我能控制的, 使用guzzle(7.4) 测试 并没有这个问题
根据RFC3986中指定了以下字符为保留字符:! * ' ( ) ; : @ & = + $ , / ? # [ ]
希望大大修复一下

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

No branches or pull requests

2 participants