Skip to content

Commit

Permalink
Fix potential NPE in HTTP proxying
Browse files Browse the repository at this point in the history
Fixes: quarkusio#35706
(cherry picked from commit bcd2edb)
  • Loading branch information
geoand authored and aloubyansky committed Oct 25, 2023
1 parent d81f764 commit 2dd13e6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void calculate() {

matcher = FORWARDED_FOR_PATTERN.matcher(forwarded);
if (matcher.find()) {
remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress.port());
remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress != null ? remoteAddress.port() : port);
}
} else if (forwardingProxyOptions.allowXForwarded) {
String protocolHeader = delegate.getHeader(X_FORWARDED_PROTO);
Expand Down Expand Up @@ -167,7 +167,7 @@ private void calculate() {

String forHeader = delegate.getHeader(X_FORWARDED_FOR);
if (forHeader != null) {
remoteAddress = parseFor(getFirstElement(forHeader), remoteAddress.port());
remoteAddress = parseFor(getFirstElement(forHeader), remoteAddress != null ? remoteAddress.port() : port);
}
}
}
Expand Down

0 comments on commit 2dd13e6

Please sign in to comment.