Skip to content

Commit

Permalink
Make sure Response and RestResponse work properly with IPv6 addresses
Browse files Browse the repository at this point in the history
Fixes: #39041
  • Loading branch information
geoand committed Feb 28, 2024
1 parent 93ee818 commit 86fc0b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Response.ResponseBuilder location(URI location) {
try {
String host = req.getRequestHost();
int port = -1;
int index = host.indexOf(":");
int index = host.lastIndexOf(":");
if (index > -1) {
port = Integer.parseInt(host.substring(index + 1));
host = host.substring(0, index);
Expand Down Expand Up @@ -69,7 +69,7 @@ public Response.ResponseBuilder contentLocation(URI location) {
try {
String host = req.getRequestHost();
int port = -1;
int index = host.indexOf(":");
int index = host.lastIndexOf(":");
if (index > -1) {
port = Integer.parseInt(host.substring(index + 1));
host = host.substring(0, index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public RestResponse.ResponseBuilder<T> location(URI location) {
try {
String host = req.getRequestHost();
int port = -1;
int index = host.indexOf(":");
int index = host.lastIndexOf(":");
if (index > -1) {
port = Integer.parseInt(host.substring(index + 1));
host = host.substring(0, index);
Expand Down Expand Up @@ -69,7 +69,7 @@ public RestResponse.ResponseBuilder<T> contentLocation(URI location) {
try {
String host = req.getRequestHost();
int port = -1;
int index = host.indexOf(":");
int index = host.lastIndexOf(":");
if (index > -1) {
port = Integer.parseInt(host.substring(index + 1));
host = host.substring(0, index);
Expand Down

0 comments on commit 86fc0b2

Please sign in to comment.