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

支持header中定义Host #23

Closed
typ431127 opened this issue May 25, 2021 · 8 comments
Closed

支持header中定义Host #23

typ431127 opened this issue May 25, 2021 · 8 comments

Comments

@typ431127
Copy link

这个工具下载速度确实很快,很棒的一个项目!
能否支持在header中定义host,有些走默认域名下载很慢,想直接走ip

@monkeyWie
Copy link
Member

你是说命令行工具吗

@typ431127
Copy link
Author

你是说命令行工具吗
命令行支持也可以,最好download.Boot()调用中也支持

@monkeyWie
Copy link
Member

Boot()方法是支持传递请求头的,示例:

URL("https://www.baidu.com/index.html").
Extra(http.Extra{
	Header: map[string]string{"host": "127.0.0.1"},
})

@typ431127
Copy link
Author

Boot()方法是支持传递请求头的,示例:

URL("https://www.baidu.com/index.html").
Extra(http.Extra{
	Header: map[string]string{"host": "127.0.0.1"},
})

感谢!

@monkeyWie
Copy link
Member

不客气哈~

@typ431127
Copy link
Author

不客气哈~

net/http这个包直接在header中写Host参数似乎是不能生效的,我通过internal/protocol/http/fetcher.gobuildRequest设置了Host,解决了我的问题,非常感谢你写的这个项目,下载速度确实快!

httpReq.Host = 'xxxx.com'

@monkeyWie
Copy link
Member

@typ431127 这样啊,那可以在http.Extra加一个Host字段专门来做设置

@typ431127
Copy link
Author

@typ431127 这样啊,那可以在http.Extra加一个Host字段专门来做设置

👍👍👍👍👍

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