Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
109f979
feat: add http3
imz87 Jul 30, 2024
272caa4
feat: add http3 examples
imz87 Jul 30, 2024
349e8ca
feat: add http3 version
imz87 Jul 30, 2024
4e9bc60
feat: handle ssl on http3
imz87 Jul 30, 2024
87ba5ee
feat: just a draft
imz87 Jul 30, 2024
003055f
feat: add http3 to sslContextFactory
imz87 Jul 30, 2024
e08380b
feat: add http3 to sslContextFactory
imz87 Jul 30, 2024
a9323e0
feat: wrapper is not acceptable
imz87 Jul 30, 2024
f07de3e
feat: use a single protocolVersion in options
imz87 Jul 31, 2024
bffd970
feat: move connectionHandler to HttpChannelConnector
imz87 Jul 31, 2024
42442a3
feat: improve implementation
imz87 Aug 1, 2024
323bda4
feat: remove unused methods
imz87 Aug 5, 2024
ba0ef83
feat: use handler
imz87 Aug 5, 2024
fd09043
feat: cleaning
imz87 Aug 5, 2024
76955f9
feat: support ssl for http3
imz87 Aug 5, 2024
3314489
feat: add http3 main classes
imz87 Aug 5, 2024
8795f25
feat: make headers unified
imz87 Aug 6, 2024
e3c2abb
feat: add connection delegate for future usage
imz87 Aug 7, 2024
37aa7e1
feat: use VertxHttpStreamBase
imz87 Aug 7, 2024
7c76adc
feat: return resp
imz87 Aug 7, 2024
761148c
feat: add more wrapper methods
imz87 Aug 8, 2024
45b2069
feat: extract Stream from Http2ClientConnection
imz87 Aug 8, 2024
caa087a
feat: to be used in other classes
imz87 Aug 8, 2024
6c66566
feat: extract Stream from Http2ClientConnection
imz87 Aug 8, 2024
6425bf0
feat: add vertxDefaultHttpHeaders
imz87 Aug 8, 2024
f19e54c
feat: move common methods to parent
imz87 Aug 8, 2024
0172bed
feat: use new structure for http3Connection
imz87 Aug 8, 2024
53eca62
feat: remove unused flag
imz87 Aug 8, 2024
24f7342
feat: add more methods
imz87 Aug 8, 2024
46bd273
feat: resolve type check issue
imz87 Aug 8, 2024
a0b224d
feat: add correct implementation
imz87 Aug 8, 2024
20f3e9e
feat: remove methods with implementations
imz87 Aug 8, 2024
a45016e
feat: correct implementation
imz87 Aug 8, 2024
6d8669b
feat: correct implementation
imz87 Aug 8, 2024
0fe3e6b
feat: correct implementation
imz87 Aug 8, 2024
9fd629a
feat: reformat
imz87 Aug 8, 2024
d29b631
feat: reformat
imz87 Aug 8, 2024
8147b13
feat: reformat
imz87 Aug 8, 2024
64e7a70
feat: remove streams
imz87 Aug 8, 2024
fb24f8e
feat: remove streams
imz87 Aug 8, 2024
ac1146c
feat: remove streams
imz87 Aug 8, 2024
c12f03d
feat: reformat
imz87 Aug 11, 2024
d1a702b
feat: remove uncalled lines
imz87 Aug 11, 2024
49eae65
feat: verify ssl connection
imz87 Aug 11, 2024
8393b44
feat: move logic to VertxHttp3ControlStreamHandler
imz87 Aug 12, 2024
cfe4fb2
feat: move logic to VertxHttp3ControlStreamHandler
imz87 Aug 12, 2024
adf3f30
feat: remove connection delegate
imz87 Aug 12, 2024
0fe836f
feat: remove connection delegate
imz87 Aug 12, 2024
b51323b
feat: omit a wrong dependency
imz87 Aug 12, 2024
4ba398f
feat: resolve a bug
imz87 Aug 12, 2024
73d2439
feat: make like http2 creation
imz87 Aug 13, 2024
6a5c649
feat: add settings capability
imz87 Aug 13, 2024
4237cff
feat: make similar to http2
imz87 Aug 13, 2024
bee9d7b
feat: make similar to http2
imz87 Aug 13, 2024
36454b9
feat: make similar to http2
imz87 Aug 13, 2024
33419d6
feat: make similar to http2
imz87 Aug 13, 2024
849db36
feat: remove a complicated part
imz87 Aug 14, 2024
109f34f
feat: organize
imz87 Aug 14, 2024
12d9376
feat: correct todo
imz87 Aug 14, 2024
4a3abfa
feat: remove a complicated part
imz87 Aug 14, 2024
62efac0
feat: add channelInactive
imz87 Aug 14, 2024
6288651
feat: add channelInactive
imz87 Aug 14, 2024
9055252
feat: add exception handler
imz87 Aug 14, 2024
23d9c21
feat: remove handlers
imz87 Aug 14, 2024
e756f96
feat: organize class
imz87 Aug 14, 2024
5bac492
feat: move writeHeader to handler
imz87 Aug 14, 2024
38a9d7b
feat: move writeData to handler
imz87 Aug 14, 2024
b5fa97a
feat: handle both http2 and http3 priority
imz87 Aug 18, 2024
3662fd3
feat: correct tests
imz87 Aug 18, 2024
8abcc73
feat: correct tests
imz87 Aug 18, 2024
35d86fe
feat: create default priority
imz87 Aug 19, 2024
d16bb00
feat: create DefaultHttp3HeadersFrame before writing header
imz87 Aug 19, 2024
37efb9d
feat: handle exception on connection timeout
imz87 Aug 20, 2024
84f5cd9
feat: remove unused class
imz87 Aug 21, 2024
8716b92
feat: use resolved host in the previous step
imz87 Aug 21, 2024
fd6173c
feat: use resolved host in the previous step
imz87 Aug 21, 2024
945b650
feat: handling multiple streams
imz87 Aug 25, 2024
092adf6
feat: organize code
imz87 Aug 25, 2024
8ed08ce
feat: improve example
imz87 Aug 25, 2024
f0aa825
feat: correct headers
imz87 Aug 25, 2024
aaa4d96
feat: remove unused handler
imz87 Aug 25, 2024
9d19a41
feat: set meaningful title
imz87 Aug 26, 2024
26edbe2
feat: prepare condition for goaway and settings read
imz87 Aug 26, 2024
e0e1b55
feat: make Http3ConnectionBase
imz87 Aug 26, 2024
ce9fbbe
feat: handle goAway
imz87 Aug 26, 2024
bcf5c22
feat: handle goAway
imz87 Aug 26, 2024
598dea3
feat: handle unknownFrame
imz87 Aug 26, 2024
d00e682
feat: handle different frames or events
imz87 Aug 26, 2024
d10d8b4
feat: remove generic headers to simplify
imz87 Aug 27, 2024
f7a6911
feat: remove generic headers to simplify part2
imz87 Aug 27, 2024
4030927
feat: remove generic headers to simplify! part3
imz87 Aug 27, 2024
64e4ab5
feat: remove generic headers to simplify! part4
imz87 Aug 27, 2024
8d1a6d7
feat: remove generic headers to simplify! part4
imz87 Aug 27, 2024
cce4566
feat: remove generic headers to simplify! part5
imz87 Aug 27, 2024
5aa3a98
feat: add header tests
imz87 Aug 28, 2024
fa84dc0
feat: add header tests
imz87 Aug 28, 2024
37b4c1c
feat: add header tests
imz87 Aug 29, 2024
757dd23
feat: add header tests
imz87 Aug 29, 2024
cf5496b
feat: add header tests
imz87 Aug 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
</dependency>
<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-codec-http3</artifactId>
<version>0.0.28.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, HttpCli
obj.setPoolEventLoopSize(((Number)member.getValue()).intValue());
}
break;
case "protocolVersion":
if (member.getValue() instanceof String) {
obj.setProtocolVersion(io.vertx.core.http.HttpVersion.valueOf((String)member.getValue()));
}
break;
case "sendUnmaskedFrames":
if (member.getValue() instanceof Boolean) {
obj.setSendUnmaskedFrames((Boolean)member.getValue());
Expand Down Expand Up @@ -274,9 +269,6 @@ static void toJson(HttpClientOptions obj, java.util.Map<String, Object> json) {
json.put("pipeliningLimit", obj.getPipeliningLimit());
json.put("poolCleanerPeriod", obj.getPoolCleanerPeriod());
json.put("poolEventLoopSize", obj.getPoolEventLoopSize());
if (obj.getProtocolVersion() != null) {
json.put("protocolVersion", obj.getProtocolVersion().name());
}
json.put("sendUnmaskedFrames", obj.isSendUnmaskedFrames());
json.put("shared", obj.isShared());
if (obj.getTracingPolicy() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, ClientO
obj.setNonProxyHosts(list);
}
break;
case "protocolVersion":
if (member.getValue() instanceof String) {
obj.setProtocolVersion(io.vertx.core.http.HttpVersion.valueOf((String)member.getValue()));
}
break;
case "proxyOptions":
if (member.getValue() instanceof JsonObject) {
obj.setProxyOptions(new io.vertx.core.net.ProxyOptions((io.vertx.core.json.JsonObject)member.getValue()));
Expand Down Expand Up @@ -76,6 +81,9 @@ static void toJson(ClientOptionsBase obj, java.util.Map<String, Object> json) {
obj.getNonProxyHosts().forEach(item -> array.add(item));
json.put("nonProxyHosts", array);
}
if (obj.getProtocolVersion() != null) {
json.put("protocolVersion", obj.getProtocolVersion().name());
}
if (obj.getProxyOptions() != null) {
json.put("proxyOptions", obj.getProxyOptions().toJson());
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/generated/io/vertx/core/net/SSLOptionsConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, SSLOpti
obj.setEnabledSecureTransportProtocols(list);
}
break;
case "http3":
if (member.getValue() instanceof Boolean) {
obj.setHttp3((Boolean)member.getValue());
}
break;
case "sslHandshakeTimeout":
if (member.getValue() instanceof Number) {
obj.setSslHandshakeTimeout(((Number)member.getValue()).longValue());
Expand Down Expand Up @@ -98,6 +103,7 @@ static void toJson(SSLOptions obj, java.util.Map<String, Object> json) {
obj.getEnabledSecureTransportProtocols().forEach(item -> array.add(item));
json.put("enabledSecureTransportProtocols", array);
}
json.put("http3", obj.isHttp3());
json.put("sslHandshakeTimeout", obj.getSslHandshakeTimeout());
if (obj.getSslHandshakeTimeoutUnit() != null) {
json.put("sslHandshakeTimeoutUnit", obj.getSslHandshakeTimeoutUnit().name());
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/examples/HTTP2Examples.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,18 @@ public void example6(HttpServerRequest request) {
public void example7(Vertx vertx) {

HttpClientOptions options = new HttpClientOptions().
setProtocolVersion(HttpVersion.HTTP_2).
setSsl(true).
setUseAlpn(true).
setTrustAll(true);
options.setProtocolVersion(HttpVersion.HTTP_2);

HttpClient client = vertx.createHttpClient(options);
}

public void example8(Vertx vertx) {

HttpClientOptions options = new HttpClientOptions().setProtocolVersion(HttpVersion.HTTP_2);
HttpClientOptions options = new HttpClientOptions();
options.setProtocolVersion(HttpVersion.HTTP_2);

HttpClient client = vertx.createHttpClient(options);
}
Expand Down
81 changes: 81 additions & 0 deletions src/main/java/examples/HTTP3Examples.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2011-2019 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/

package examples;

import io.netty.incubator.codec.http3.DefaultHttp3SettingsFrame;
import io.netty.incubator.codec.http3.Http3SettingsFrame;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.http.HttpClientResponse;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpVersion;

/**
* @author <a href="mailto:[email protected]">Iman Zolfaghari</a>
*/
public class HTTP3Examples {

public void example01(Vertx vertx) {

DefaultHttp3SettingsFrame settings = new DefaultHttp3SettingsFrame();
settings.put(Http3SettingsFrame.HTTP3_SETTINGS_MAX_FIELD_SECTION_SIZE,
100000000000L);

HttpClientOptions options = new HttpClientOptions().
setSsl(true).
setUseAlpn(true).
setHttp3InitialSettings(settings).
setTrustAll(true);
options.setProtocolVersion(HttpVersion.HTTP_3);

HttpClient client = vertx.createHttpClient(options);

client.request(HttpMethod.GET, 443, "www.google.com", "/")
// client.request(HttpMethod.GET, 9999, NetUtil.LOCALHOST4.getHostAddress(), "/")
// client.request(HttpMethod.GET, 443, "www.mozilla.org", "/")
// client.request(HttpMethod.GET, 443, "www.bing.com", "/")
// client.request(HttpMethod.GET, 443, "www.yahoo.com", "/")
// client.request(HttpMethod.GET, 443, "http3.is", "/")
.compose(req -> {

req.connection().goAwayHandler(goAway -> {
System.out.println(" Received goAway from server! ");
});

req.connection().shutdownHandler(v -> {
System.out.println(" Received shutdown signal! ");
req.connection().close();
vertx.close();
});

return req
.end()
.compose(res -> req
.response()
.onSuccess(resp -> {
System.out.println("The returned headers are: " + resp.headers());
System.out.println("The returned Alt-Svc is: " + resp.headers().get(
"Alt-Svc"));
}).compose(HttpClientResponse::body).onSuccess(body ->
System.out.println("The response body is: " + body.toString()))
);
})
.onFailure(Throwable::printStackTrace)
.onComplete(event -> vertx.close())
;
}

public static void main(String[] args) {
new HTTP3Examples().example01(Vertx.vertx());
}
}
65 changes: 65 additions & 0 deletions src/main/java/io/vertx/core/http/Http2StreamPriority.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package io.vertx.core.http;

public class Http2StreamPriority implements StreamPriorityBase {
private final StreamPriority streamPriority;

public Http2StreamPriority(StreamPriority streamPriority) {
this.streamPriority = streamPriority;
}

public Http2StreamPriority() {
this(new StreamPriority());
}

public short getWeight() {
return this.streamPriority.getWeight();
}

public Http2StreamPriority setWeight(short weight) {
this.streamPriority.setWeight(weight);
return this;
}

public int getDependency() {
return this.streamPriority.getDependency();
}

public Http2StreamPriority setDependency(int dependency) {
this.streamPriority.setDependency(dependency);
return this;
}

public boolean isExclusive() {
return this.streamPriority.isExclusive();
}

public Http2StreamPriority setExclusive(boolean exclusive) {
this.streamPriority.setExclusive(exclusive);
return this;
}

@Override
public int urgency() {
throw new RuntimeException("Not Http3 Priority!");
}

@Override
public boolean isIncremental() {
throw new RuntimeException("Not Http3 Priority!");
}

@Override
public int hashCode() {
return this.streamPriority.hashCode();
}

@Override
public boolean equals(Object obj) {
return obj instanceof Http2StreamPriority && this.streamPriority.equals(((Http2StreamPriority) obj).streamPriority);
}

@Override
public String toString() {
return this.streamPriority.toString();
}
}
64 changes: 64 additions & 0 deletions src/main/java/io/vertx/core/http/Http3StreamPriority.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.vertx.core.http;

import io.netty.incubator.codec.quic.QuicStreamPriority;

public class Http3StreamPriority implements StreamPriorityBase {
private final QuicStreamPriority quicStreamPriority;

public Http3StreamPriority(QuicStreamPriority quicStreamPriority) {
this.quicStreamPriority = quicStreamPriority;
}

public int urgency() {
return this.quicStreamPriority.urgency();
}

public boolean isIncremental() {
return this.quicStreamPriority.isIncremental();
}

@Override
public short getWeight() {
throw new RuntimeException("Not Http2 Priority!");
}

@Override
public StreamPriorityBase setWeight(short weight) {
throw new RuntimeException("Not Http2 Priority!");
}

@Override
public int getDependency() {
throw new RuntimeException("Not Http2 Priority!");
}

@Override
public StreamPriorityBase setDependency(int dependency) {
throw new RuntimeException("Not Http2 Priority!");
}

@Override
public boolean isExclusive() {
throw new RuntimeException("Not Http2 Priority!");
}

@Override
public StreamPriorityBase setExclusive(boolean exclusive) {
throw new RuntimeException("Not Http2 Priority!");
}

@Override
public int hashCode() {
return this.quicStreamPriority.hashCode();
}

@Override
public boolean equals(Object obj) {
return obj instanceof Http3StreamPriority && this.quicStreamPriority.equals(((Http3StreamPriority) obj).quicStreamPriority);
}

@Override
public String toString() {
return this.quicStreamPriority.toString();
}
}
Loading