是“用户代理” HTTPS中的标题强制性根据RFC获取请求

发布于 2025-01-21 04:36:01 字数 239 浏览 3 评论 0原文

我试图使用MBEDTL从服务器下载文件。 使用以下get请求

get /xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx http /1.1

主机:example_xxxxxx.com

连接:保持

使用状态403响应的服务器

服务器在我添加“用户代理”标头时

开始工作。根据RFC规范,使用HTTP的用户代理是强制性的。

I was trying to download a file from a server using mbedtls.
used the following GET request

GET /xxxxxxxxxxxxxxx.xml HTTP/1.1

Host: example_xxxxx.com

Connection: keep-alive

The server responded with status 403

When I add a "User-Agent" header filed, it started working.

Is User-Agent mandatory for HTTP GET requests as per RFC specification.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥抱影子 2025-01-28 04:36:01

RFC 2616 14.43:

用户代理应将此字段包含在请求中。

就RFC而言,这不是必需的。

您正在访问的服务器选择需要用户代理,这可能是某些基本的反剪切机制。

RFC 2616 14.43:

User agents SHOULD include this field with requests.

As far as the RFC is concerned, it's not required.

The server you're accessing has chosen to require the user agent, possibly as some rudimentary anti-scraping mechanism.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文