Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extend DialOptions to allow Host header override#336

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nhooyr merged 1 commit intocoder:devfrombendiscz:client-host-override
Oct 13, 2023

Conversation

bendiscz
Copy link
Contributor

The standardhttp.Request.Host field allows to override theHost header that is sent with the HTTP request (URL.Host is used by default). Such option can be useful in various scenarios, for example when running behind some proxy server.

This patch extends theDialOptions struct withHost field that basically does the same.

elnappo reacted with thumbs up emoji
Copy link
Contributor

@nhooyrnhooyr left a comment

Choose a reason for hiding this comment

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

Couldn't you useHost inHTTPHeader?

@bendiscz
Copy link
ContributorAuthor

bendiscz commentedMar 6, 2023
edited
Loading

Couldn't you useHost inHTTPHeader?

That does not work unfortunately.http.Client.Do ignoresHost inHTTPHeader, you need to set thehttp.Request.Host field if you want to override host fromhttp.Request.URL.

@nhooyr
Copy link
Contributor

Sounds good will get this in then after#256

@nhooyr
Copy link
Contributor

Or you know what we could actually check forHost inHTTPHeader and special case it to apply tohttp.Request.Host. The API innet/http isn't something we should follow to the tee anyway as it's hodgepodge.

@bendiscz
Copy link
ContributorAuthor

Checking forHost inHTTPHeader works too, I just wanted to keep the API similar to net/http... But that is certainly not required :-)

Should I change the patch?

@nhooyr
Copy link
Contributor

Go for it and thank you for your contribution. It's still going to take me a while to merge as I need to take care of#256

dejan-lokar added a commit to cookieai-jar/websocket that referenced this pull requestOct 12, 2023
@nhooyrnhooyr changed the base branch frommaster todevOctober 13, 2023 07:59
@nhooyrnhooyr merged commit2f44d4e intocoder:devOct 13, 2023
@nhooyr
Copy link
Contributor

Thanks@bendiscz

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
1 more reviewer

@nhooyrnhooyrnhooyr left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@bendiscz@nhooyr

[8]ページ先頭

©2009-2025 Movatter.jp