-
Notifications
You must be signed in to change notification settings - Fork 120
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
Should we combine .host and .socketPath on HTTPClient.Request? #229
Comments
I don't think trying to validate TLS certificates with the socket path in them is likely to work well: so far as I know, nobody does that. The same applies to SNI, given that again, socket paths are essentially never used there. It's possible that the right thing to do for those two cases is to allow an override, such that users can say what Host they want to treat the request as being for, irregardless of what the URL actually says. curl does this with |
Actually, in general I wonder if that's not the correct solution to all of this. Essentially, to say that there are some subset of hostnames that are "fake", and resolve to some other underlying socket address. Then the client will essentially map the request to that other socket address, but for things like SNI, cert verification, and other purposes we'll behave as though the host was the one provided directly to us. In fact, this might be something we can do with apple/swift-nio#1487. |
I agree that being able to pass in a custom hostname in any scenario is probably the better way to go about this. If one is not provided though, should it fall back to the socket path? Is it ok to make a request with a Host that is just |
Yeah, I don't think it's worth passing the socket path as |
If I were to add this to
Note that it seems like this would apply towards the entire HTTPClient at the moment, since a configuration can't seem to be attached to A Swift-ier solution could be to have one
Do you have any thoughts regarding this? |
In general I’m inclined to say this probably wants to be a mapping of the hostname override from string hostname to string hostname. These string “hostnames” can then also match the hostnames in UDS socket paths and IP addresses. That allows a much more substantial override. Does that make sense? |
Ah, that makes sense. Let me draft out something along those lines. |
Here is something I came up with: master...dimitribouniol:hostname-overrides (still missing tests) Specifically, the Essentially, I add a new Thoughts before I start writing tests against this? |
I think that approach looks reasonable to me. @weissi thoughts? |
Yes, looks reasonable to me. A few questions:
|
I'm assuming you are referring to
Which methods are you referring to? I'm happy to remove/make private/change anything you think is too much 🙂
I would also love to do this on a per As always, I'm open to thoughts on the topic and happy to help out where I can 🙂 |
While refactoring the unix domain socket implementation in #228, I noticed that we could probably combine the
host
and (new)socketPath
properties onHTTPClient.Request
.From what I could tell:
""
)""
as opposed tonil
, which it's doing for IPs)host
as well (currently, it's also set to""
for socket domain responses)The text was updated successfully, but these errors were encountered: