http-headers - 更改 wget 中的默认 USER-AGENT 和 REFERRER 值

标签 http-headers wget user-agent

在控制台上使用 wget 时,我通常想下载版本,例如我的 Firefox 会得到。

 wget  --header="Accept: text/html" --user-agent="Mozilla/5.0 ..." --referrer connect.wso2.com http://dist.wso2.org/products/carbon/4.2.0/wso2carbon-4.2.0.zip

我怎样才能改变 wget 的默认行为,所以只要使用 wget 就会使用我当前的 Firefox 正在使用的实际 useragent 和 header ? (同时将下载站点的基本 URL 添加为 referer 会很好)

最佳答案

像这样创建一个别名:

alias wget='wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" --referer connect.wso2.com'

您可以使用 type 来显示您的新 wget 别名在用作命令名称时将如何解释。

type wget
wget is aliased to `wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" --referer connect.wso2.com'

关于http-headers - 更改 wget 中的默认 USER-AGENT 和 REFERRER 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32500128/

相关文章:

chef-infra - 当需要密码访问 URL 时使用 Chef 执行 wget

linux - Amazon S3 HTTPS 无法在 Linux 上使用 Chrome 和 wget 加载

javascript - 对预检请求的响应未通过访问控制检查 : The value of the 'Access-

http-headers - HTTP 基本身份验证不适用于 Python 3

php - 如何在来自 Web 服务器的流式内容上设置只读标志

Spring MVC 将代理变量注入(inject)模型

javascript - 更改spynner用户代理不起作用

reactjs - 仅在 chrome 上使用 corsheaders 缺少补丁方法

ubuntu - 如何在 Ubuntu Docker 镜像中运行 wget?

configuration - Nginx 代理或重写取决于用户代理