Repository: quarkusio/quarkus
Issue: `Forwarded` header is not parsed as expected

### Describe the bug

According to [RFC7239](https://www.rfc-editor.org/rfc/rfc7239#section-4), the `Forwarded` header can have a comma-separated list of values. It is used to indicate the string of proxies (including the client that initiated the request).

The ForwardedParser class splits this header by comma and later considers only the first element. This element will be the one that will determine each property of the request (protocol, host, etc). This is not the expected behavior as it will discard the remaining information in the header, as you will see in the next sections. 

### Expected behavior

When a client does a HTTP request with the following header, `Forwarded: by=proxy;for=backend:4444,for=backend2:5555;host=somehost;proto=https`, the quarkus server must consider `host` and `proto` properties defined by the header.


### Actual behavior

The properties `host` and `proto` are not considered, and eventually discarded.

### How to Reproduce?


```
    @Test
    public void testForwardedForWithSequenceOfProxies() {
        assertThat(RestAssured.get("/forward").asString()).startsWith("http|");

        RestAssured.given()
                .header("Forwarded", "by=proxy;for=backend:4444,for=backend2:5555;host=somehost;proto=https")
                .get("/forward")
                .then()
                .body(Matchers.equalTo("https|somehost|backend:4444"));
    }

```

### Output of `uname -a` or `ver`

Darwin dibss-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64

### Output of `java -version`

openjdk version "11.0.15" 2022-04-19 OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10) OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10, mixed mode)

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

_No response_

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

### Additional information

_No response_

Changed files:
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java
extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java

diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java
index eab3ac1503c..9fc8a8b841d 100644
--- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java
+++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java
@@ -30,4 +30,36 @@ public void test() {
                 .body(Matchers.equalTo("https|somehost|backend:4444"));
     }
 
+    @Test
+    public void testForwardedForWithSequenceOfProxies() {
+        assertThat(RestAssured.get("/forward").asString()).startsWith("http|");
+
+        RestAssured.given()
+                .header("Forwarded", "by=proxy;for=backend:4444,for=backend2:5555;host=somehost;proto=https")
+                .get("/forward")
+                .then()
+                .body(Matchers.equalTo("https|somehost|backend:4444"));
+    }
+
+    @Test
+    public void testForwardedWithSequenceOfProxiesIncludingIpv6Address() {
+        assertThat(RestAssured.get("/forward").asString()).startsWith("http|");
+
+        RestAssured.given()
+                .header("Forwarded", "by=proxy;for=\\"[2001:db8:cafe::17]:47011\\",for=backend:4444;host=somehost;proto=https")
+                .get("/forward")
+                .then()
+                .body(Matchers.equalTo("https|somehost|[2001:db8:cafe::17]:47011"));
+    }
+
+    @Test
+    public void testForwardedForWithIpv6Address2() {
+        assertThat(RestAssured.get("/forward").asString()).startsWith("http|");
+
+        RestAssured.given()
+                .header("Forwarded", "by=proxy;for=\\"[2001:db8:cafe::17]:47011\\",for=backend:4444;host=somehost;proto=https")
+                .get("/forward")
+                .then()
+                .body(Matchers.equalTo("https|somehost|[2001:db8:cafe::17]:47011"));
+    }
 }
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java
index aab3cabcb6d..3755c618715 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java
@@ -110,19 +110,18 @@ private void calculate() {
 
         String forwarded = delegate.getHeader(FORWARDED);
         if (forwardingProxyOptions.allowForwarded && forwarded != null) {
-            String forwardedToUse = forwarded.split(",")[0];
-            Matcher matcher = FORWARDED_PROTO_PATTERN.matcher(forwardedToUse);
+            Matcher matcher = FORWARDED_PROTO_PATTERN.matcher(forwarded);
             if (matcher.find()) {
                 scheme = (matcher.group(1).trim());
                 port = -1;
             }
 
-            matcher = FORWARDED_HOST_PATTERN.matcher(forwardedToUse);
+            matcher = FORWARDED_HOST_PATTERN.matcher(forwarded);
             if (matcher.find()) {
                 setHostAndPort(matcher.group(1).trim(), port);
             }
 
-            matcher = FORWARDED_FOR_PATTERN.matcher(forwardedToUse);
+            matcher = FORWARDED_FOR_PATTERN.matcher(forwarded);
             if (matcher.find()) {
                 remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress.port());
             }