<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
On 27/03/2024 01:51, Sergey Chernyshev wrote:<br>
<blockquote type="cite" cite="mid:b25b9ced-3d1e-4067-bb91-77bd17844611@bell-sw.com">
<p>Hello Core Libs Dev team, </p>
<p>I would like to propose a PR to extend the InetAddress API in
JDK 23, namely to provide interface to constructing InetAddress
objects from literal addresses in POSIX/BSD form (please see the
discussion [1]), to the Apps that need to mimic the behavior of
POSIX network APIs (<code class="notranslate">inet_addr</code>)
used by standard network utilities such as netcat/curl/wget and
the majority of web browsers. At present time, there's no way to
construct <code class="notranslate">InetAddress</code> object
from such literal addresses because the new API <code class="notranslate">InetAddress.ofLiteral()</code> and <code class="notranslate">Inet4Address.ofLiteral()</code> will
consume an address and successfully parse it as decimal,
ignoring the octal prefix. Hence, the resulting object will
point to a different IP address than it is expected to point to.</p>
</blockquote>
Better to start the discussion on net-dev as that is where the
InetAddress API is maintained. Make sure to go through the recent
discussions there on ofLiteral(String), particularly security
concerns which is partly why the method is not specified to allow
octal values.<br>
<br>
-Alan<br>
</body>
</html>