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

feat:http_response set Host #788

Closed
wants to merge 0 commits into from
Closed

feat:http_response set Host #788

wants to merge 0 commits into from

Conversation

arch3754
Copy link
Contributor

@arch3754 arch3754 commented Feb 4, 2024

No description provided.

@arch3754 arch3754 changed the title http_response set Host feat:http_response set Host Feb 4, 2024
@@ -247,7 +248,9 @@ func (ins *Instance) httpGather(target string) (map[string]string, map[string]in
ins.HTTPCommonConfig.Headers[ins.Headers[i]] = ins.Headers[i+1]
}
ins.SetHeaders(request)

if len(ins.Host) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target 那里是多个,这里只设置一个Host 会有不匹配的情况。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

body和header也是一样的情况,如果要改的话,需要整个结构都变成数组,添加host是为了指定ip访问https,类似curl "https://1.1.1.1" -H 'Host: www.example.com' -k

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那可以都统一修改一下。这种指定Host的场景一般为了探测单点或者没内网DNS,大部分情况下req.URL.Host 就是req.Host

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是访问https,那还有个server_name 要设置

@arch3754 arch3754 closed this Feb 5, 2024
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

Successfully merging this pull request may close these issues.

2 participants