Skip to content

Commit

Permalink
upgrade to vertx 4.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
zyclonite committed Aug 30, 2023
1 parent 7da509b commit af537d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.zyclonite.nassh</groupId>
<artifactId>nassh-relay</artifactId>
<version>1.1.30</version>
<version>1.1.31</version>

<organization>
<name>zyclonite networx</name>
Expand All @@ -19,7 +19,7 @@
</developers>

<properties>
<vertx.version>4.4.4</vertx.version>
<vertx.version>4.4.5</vertx.version>
<log4j2.version>2.20.0</log4j2.version>
<vertx.main>${project.groupId}.MainVerticle</vertx.main>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
19 changes: 8 additions & 11 deletions src/main/java/net/zyclonite/nassh/handler/ProxyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Website: https://github.com/zyclonite/nassh-relay
*
* Copyright 2014-2020 zyclonite networx
* Copyright 2014-2023 zyclonite networx
* http://zyclonite.net
* Developer: Lukas Prettenthaler
*/
Expand Down Expand Up @@ -87,12 +87,9 @@ public void handle(final RoutingContext context) {
((VertxImpl) vertx).resolveAddress(host, result -> {
if (result.succeeded()) {
final InetAddress address = result.result();
vertx.<Boolean>executeBlocking(promise -> {
final boolean isAllowed = AccessHelper.isHostAllowed(accessList, whiteList, blackList, address, authSession);
promise.complete(isAllowed);
}, false, res -> {
if (res.succeeded()) {
if (!res.result()) {
vertx.executeBlocking(() -> AccessHelper.isHostAllowed(accessList, whiteList, blackList, address, authSession), false)
.onSuccess(isAllowed -> {
if (!isAllowed) {
response.setStatusCode(410);
response.end("host not allowed");
logger.warn(() -> "client " + clienthost + " " + (authSession == null ? "" : "(" + authSession + ")") + " tried to access " + address.getHostAddress() + " but was not allowed");
Expand All @@ -107,12 +104,12 @@ public void handle(final RoutingContext context) {
}
});
}
} else {
logger.error(res::cause);
})
.onFailure(t -> {
logger.error(t);
response.setStatusCode(500);
response.end("internal server error");
}
});
});
} else {
response.setStatusCode(410);
response.end("invalid host");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/zyclonite/nassh/util/RequestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Website: https://github.com/zyclonite/nassh-relay
*
* Copyright 2014-2020 zyclonite networx
* Copyright 2014-2023 zyclonite networx
* http://zyclonite.net
* Developer: Lukas Prettenthaler
*/
Expand All @@ -20,7 +20,7 @@ public static String getHost(final HttpServerRequest request) {
if (request.headers().contains("X-Forwarded-Host")) {
return request.headers().get("X-Forwarded-Host");
} else {
return request.host();
return request.authority().host();
}
}

Expand Down

0 comments on commit af537d7

Please sign in to comment.