如何使用带有原始标头的 wget(或curl)复制请求?
我正在调试一些 http 请求,发现我可以获取这种格式的请求标头:
GET /download?123456:75b3c682a7c4db4cea19641b33bec446/document.docx HTTP/1.1
Host: www.site.com
User-Agent: Mozilla/5.0 Gecko/2010 Firefox/5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Referer: http://www.site.com/dc/517870b8cc7
Cookie: lang=us; reg=1787081http%3A%2F%2Fwww.site.com%2Fdc%2F517870b8cc7
Is it possible or is there a simple way to reconstruct that request using wget or curl (or another CLI tool?)
从阅读 wget 手册页我知道我可以单独设置其中几个内容,但是有没有更简单的方法可以从命令行发送包含所有这些变量的请求?
I was deubgging some http requests and found that I can grab request headers in this type of format:
GET /download?123456:75b3c682a7c4db4cea19641b33bec446/document.docx HTTP/1.1
Host: www.site.com
User-Agent: Mozilla/5.0 Gecko/2010 Firefox/5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Referer: http://www.site.com/dc/517870b8cc7
Cookie: lang=us; reg=1787081http%3A%2F%2Fwww.site.com%2Fdc%2F517870b8cc7
Is it possible or is there an easy way to reconstruct that request using wget or curl (or another CLI tool?)
From reading the wget manual page I know I can set several of these things individually, but is there an easier way to send a request with all these variables from the command line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您只需使用
--header
组合所有标头如果您试图进行非法下载,
它可能会失败,
这取决于托管 URL 的编程方式
Yes, you just need to combine all the headers using
--header
If you are trying to do some illegal download,
it might fail,
is depends on how hosting URL being programmed
这是
curl
版本:在 Chrome 开发者工具中,您可以使用 Copy as cURL 将请求捕获为
curl
。Here is
curl
version:In Chrome developer tools, you can use Copy as cURL to catch request as
curl
.