1919
2020package org .elasticsearch .http ;
2121
22- import org .apache .logging .log4j .LogManager ;
2322import org .elasticsearch .common .io .stream .StreamInput ;
2423import org .elasticsearch .common .io .stream .StreamOutput ;
2524import org .elasticsearch .common .io .stream .Writeable ;
26- import org .elasticsearch .common .logging .DeprecationLogger ;
2725import org .elasticsearch .common .network .InetAddresses ;
2826import org .elasticsearch .common .transport .BoundTransportAddress ;
2927import org .elasticsearch .common .transport .TransportAddress ;
3331
3432import java .io .IOException ;
3533
36- import static org .elasticsearch .common .Booleans .parseBoolean ;
37-
3834public class HttpInfo implements Writeable , ToXContentFragment {
39-
40- private static final DeprecationLogger deprecationLogger = new DeprecationLogger (LogManager .getLogger (HttpInfo .class ));
41-
42- /** Whether to add hostname to publish host field when serializing. */
43- private static final boolean CNAME_IN_PUBLISH_HOST =
44- parseBoolean (System .getProperty ("es.http.cname_in_publish_address" ), true );
45-
4635 private final BoundTransportAddress address ;
4736 private final long maxContentLength ;
48- private final boolean cnameInPublishHost ;
4937
5038 public HttpInfo (StreamInput in ) throws IOException {
51- this (new BoundTransportAddress (in ), in .readLong (), CNAME_IN_PUBLISH_HOST );
39+ this (new BoundTransportAddress (in ), in .readLong ());
5240 }
5341
5442 public HttpInfo (BoundTransportAddress address , long maxContentLength ) {
55- this (address , maxContentLength , CNAME_IN_PUBLISH_HOST );
56- }
57-
58- HttpInfo (BoundTransportAddress address , long maxContentLength , boolean cnameInPublishHost ) {
5943 this .address = address ;
6044 this .maxContentLength = maxContentLength ;
61- this .cnameInPublishHost = cnameInPublishHost ;
6245 }
6346
6447 @ Override
@@ -83,15 +66,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
8366 String publishAddressString = publishAddress .toString ();
8467 String hostString = publishAddress .address ().getHostString ();
8568 if (InetAddresses .isInetAddress (hostString ) == false ) {
86- if (cnameInPublishHost ) {
87- publishAddressString = hostString + '/' + publishAddress .toString ();
88- } else {
89- deprecationLogger .deprecated (
90- "[http.publish_host] was printed as [ip:port] instead of [hostname/ip:port]. "
91- + "This format is deprecated and will change to [hostname/ip:port] in a future version. "
92- + "Use -Des.http.cname_in_publish_address=true to enforce non-deprecated formatting."
93- );
94- }
69+ publishAddressString = hostString + '/' + publishAddress .toString ();
9570 }
9671 builder .field (Fields .PUBLISH_ADDRESS , publishAddressString );
9772 builder .humanReadableField (Fields .MAX_CONTENT_LENGTH_IN_BYTES , Fields .MAX_CONTENT_LENGTH , maxContentLength ());
0 commit comments