[haiku-commits] Re: haiku: hrev50368 - src/kits/network/libnetapi headers/os/net
- From: "Mark Hellegers" <mark@xxxxxxxxxxxx>
- To: haiku-commits@xxxxxxxxxxxxx
- Date: Wed, 22 Jun 2016 23:37:12 +0200 CEST
On Tue, Jun 21, 2016 at 10:23 PM, Adrien Destugues
It can be useful in other cases as well. For example, an HTTP
usually needs to know which hostname is used as it specifies it in
request header. There may be similar uses in other protocols.
It depends if we want to consider BNetworkAddress as IPv4/6
something a bit higher level and more friendly to upper layer
For me this is a good argument for keeping the hostname out of
The hostname that is sent in HTTP headers or used for TLS SNI is an
application layer concern and should be dealt with at that level.
BNetworkAddress is operating at the transport/internet layer and
should just be concerned with addressing endpoints.
I'm a bit surprised there is this much discussion on this commit as the
patch was basically unchanged on Trac for weeks with hardly any comment
But as to the concerns about the patch:
The hostname is used in the application layer, but that does not make
it an application concern. It is a network address and I see no problem
with storing it at the internet layer in BNetworkAddress. It already
gets it anyway, we just didn't store it before. There was even already
a function to retrieve the hostname in BNetworkAddres. It simply was
Additionally, the BSecureSocket constructor gets a BNetworkAddress in
the constructor and under some circumstances the caller of the
constructor might only have the BNetworkAddress and nothing else. In
that case there is no way to retrieve the hostname anymore.
Also, it seems awkward to force the caller to call an extra function
simply to set the hostname while BNetworkAddress seems perfectly
capable of holding that information. I would think that encourages
buggy code by applications forgetting to set it, while it is now
automatic as long as BNetworkAddress is called with a hostname.
Spangalese for beginners
`Darvan melod dislar.'
`Your hamsters do that funky dance.'
Other related posts: