英文:
do more headers mean better chance the server thinks you're a human
问题
这不是与编程相关的问题,但我经常使用python
的requests
库。
我通常使用的标头包括:
- accept-encoding
- origin
- referrer
- user-agent
- accept-language
- accept
- cookie
在检查执行登录等任务时发送到服务器的请求时,您会注意到一些额外的标头,如:
- Host
- content-length
- TE
如果我决定将这些标头添加到我的请求中,是否会增加被服务器识别为人类的机会,因为它向服务器提供有关“浏览器”的信息。
英文:
This is not a programming related question, but I've used python
requests
a lot of times.
The headers I usually use are:
- accept-encoding
- origin
- referrer
- user-agent
- accept-language
- accept
- cookie
While examining the requests sent to a server when performing a task such as logging in, you notice headers like:
- Host
- content-length
- TE
If I decided to add these headers to my requests, would it improve my chance of being recognized as a human since it tells the server information about the "browser".
答案1
得分: 2
"Host" 是 HTTP v.1.1 协议中的必需标头,因此它总是被发送。"requests" 模块会隐式设置此标头。您不应该手动设置它,在 99 情况下您应该不必关心此标头。
虽然 "Content-Length" 是一个可选标头,但几乎所有时候都在使用,因为它是告诉远程服务器 HTTP 消息实际结束位置的最简单方法。最流行的替代方法是 "Transfer-Encoding: chunked"。这两个标头都不会透露有关客户端的任何信息,因此您不必担心它们。
最后,通过使用 "TE" 标头,客户端告诉远程服务器所需的 "Transfer-Encoding" 格式。再次强调,此标头只是在客户端和服务器之间协商数据格式,它几乎不会提高您被识别为人类的机会。
英文:
Not really.
Host
is a required header in HTTP v.1.1 protocol, so it is sent anyway. The requests
module sets this header implicitly. You should not set it manually and in 99 cases of 100 you should never care about this header.
Although Content-Length
is an optional header, it is being used almost all the time, because it is the easiest way to tell the remote server where HTTP message actually ends. The most popular alternative is Transfer-Encoding: chunked
. Any of these two headers do not disclose any information about the client, so you should not worry about them.
Finally, by using TE
header client tells the remote server the desired Transfer-Encoding
format. Again, this header just negotiates data format between client and server, it will hardly improve your chances to be recognized as a human.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论