Skip to content

Commit 31cdbb8

Browse files
committed
Remove follow alt-svc property in HttpClientOptions.
Motivation: The alt-svc property is mostly useful with HTTP/3 and hardly makes sense in HttpClientOptions. It could actually be misleading to think that this would enable HTTP/3. Changes: Remove HttpClientOptions#followAlternativeServices property
1 parent 01f56d9 commit 31cdbb8

4 files changed

Lines changed: 8 additions & 43 deletions

File tree

vertx-core/src/main/generated/io/vertx/core/http/HttpClientOptionsConverter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, HttpCli
152152
obj.setName((String)member.getValue());
153153
}
154154
break;
155-
case "followAlternativeServices":
156-
if (member.getValue() instanceof Boolean) {
157-
obj.setFollowAlternativeServices((Boolean)member.getValue());
158-
}
159-
break;
160155
}
161156
}
162157
}
@@ -207,6 +202,5 @@ static void toJson(HttpClientOptions obj, java.util.Map<String, Object> json) {
207202
if (obj.getName() != null) {
208203
json.put("name", obj.getName());
209204
}
210-
json.put("followAlternativeServices", obj.getFollowAlternativeServices());
211205
}
212206
}

vertx-core/src/main/java/io/vertx/core/http/HttpClientConfig.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
@Unstable
3030
public class HttpClientConfig {
3131

32+
/**
33+
* Follow alternative service server advertisements = {@code false}
34+
*/
35+
public static final boolean DEFAULT_FOLLOW_ALTERNATIVE_SERVICES = false;
36+
3237
private static List<HttpVersion> toSupportedVersion(HttpVersion version) {
3338
switch (version) {
3439
case HTTP_1_0:
@@ -95,7 +100,7 @@ public HttpClientConfig() {
95100
this.observabilityConfig = null;
96101
this.shared = HttpClientOptions.DEFAULT_SHARED;
97102
this.name = HttpClientOptions.DEFAULT_NAME;
98-
this.followAlternativeServices = HttpClientOptions.DEFAULT_FOLLOW_ALTERNATIVE_SERVICES;
103+
this.followAlternativeServices = DEFAULT_FOLLOW_ALTERNATIVE_SERVICES;
99104
}
100105

101106
public HttpClientConfig(HttpClientConfig other) {
@@ -141,7 +146,7 @@ public HttpClientConfig(HttpClientOptions options) {
141146
this.observabilityConfig = observabilityConfig;
142147
this.shared = options.isShared();
143148
this.name = options.getName();
144-
this.followAlternativeServices = options.getFollowAlternativeServices();
149+
this.followAlternativeServices = false;
145150
}
146151

147152
/**

vertx-core/src/main/java/io/vertx/core/http/HttpClientOptions.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import io.netty.handler.logging.ByteBufFormat;
1515
import io.vertx.codegen.annotations.DataObject;
16-
import io.vertx.codegen.annotations.Unstable;
1716
import io.vertx.codegen.json.annotations.JsonGen;
1817
import io.vertx.core.buffer.Buffer;
1918
import io.vertx.core.http.impl.HttpUtils;
@@ -164,11 +163,6 @@ public class HttpClientOptions extends ClientOptionsBase {
164163
*/
165164
public static final boolean DEFAULT_HTTP_2_MULTIPLEX_IMPLEMENTATION = false;
166165

167-
/**
168-
* Follow alternative service server advertisements = {@code false}
169-
*/
170-
public static final boolean DEFAULT_FOLLOW_ALTERNATIVE_SERVICES = false;
171-
172166
private Http1ClientConfig http1Config;
173167
private Http2ClientConfig http2Config;
174168
private boolean verifyHost;
@@ -184,8 +178,6 @@ public class HttpClientOptions extends ClientOptionsBase {
184178
private boolean shared;
185179
private String name;
186180

187-
private boolean followAlternativeServices;
188-
189181
/**
190182
* Default constructor
191183
*/
@@ -260,7 +252,6 @@ private void init() {
260252
tracingPolicy = DEFAULT_TRACING_POLICY;
261253
shared = DEFAULT_SHARED;
262254
name = DEFAULT_NAME;
263-
followAlternativeServices = DEFAULT_FOLLOW_ALTERNATIVE_SERVICES;
264255
}
265256

266257
public Http1ClientConfig getHttp1Config() {
@@ -1031,29 +1022,4 @@ public HttpClientOptions setName(String name) {
10311022
this.name = name;
10321023
return this;
10331024
}
1034-
1035-
/**
1036-
* @return whether the client follows alternative services advertisements
1037-
*/
1038-
@Unstable
1039-
public boolean getFollowAlternativeServices() {
1040-
return followAlternativeServices;
1041-
}
1042-
1043-
/**
1044-
* <p>Configure whether the client follows alternative services advertisements, the default
1045-
* setting does not.</p>
1046-
*
1047-
* <p>Setting this to true, instructs the client to use most appropriate alternative services advertised by
1048-
* HTTP servers.</p>
1049-
*
1050-
* <p>The client only follows alternative services it can trust for a given origin, in practice this means
1051-
* this only the {@code https} scheme is supported and alternatives handshake uses the alternative origin.</p>
1052-
*
1053-
* @param followAlternativeServices the config value
1054-
*/
1055-
public HttpClientOptions setFollowAlternativeServices(boolean followAlternativeServices) {
1056-
this.followAlternativeServices = followAlternativeServices;
1057-
return this;
1058-
}
10591025
}

vertx-core/src/test/java/io/vertx/tests/http/HttpAlternativesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public void testIgnoreAlternativeServicesAdvertisements2() {
401401
.end(request.authority().toString(false));
402402
});
403403
server.listen(8080).await();
404-
client = vertx.createHttpClient(new HttpClientOptions().setProtocolVersion(HttpVersion.HTTP_2).setFollowAlternativeServices(true));
404+
client = vertx.createHttpClient(new HttpClientConfig(new HttpClientOptions().setProtocolVersion(HttpVersion.HTTP_2)).setFollowAlternativeServices(true));
405405
Buffer body = client.request(HttpMethod.GET, 8080, "host2.com", "/")
406406
.compose(request -> request
407407
.send()

0 commit comments

Comments
 (0)