Skip to content

Commit

Permalink
Cleanup of relative redirect handling #11014
Browse files Browse the repository at this point in the history
+ Handle request relative redirects
+ Moved to Response
+ Changed default to allow relative
  • Loading branch information
gregw committed Dec 4, 2023
1 parent cd195ff commit 14bede5
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ public void test103RedirectHttp10Path() throws Exception

specId = "10.3 Redirection HTTP/1.0 - basic";
assertThat(specId, response.getStatus(), is(HttpStatus.FOUND_302));
assertEquals(getServer().getScheme() + "://myhost:1234/tests/", response.get("Location"), specId);
assertEquals("/tests/", response.get("Location"), specId);
}

/**
Expand Down Expand Up @@ -1091,12 +1091,12 @@ public void test103RedirectHttp11Path() throws Exception
HttpTester.Response response = responses.get(0);
String specId = "10.3 Redirection HTTP/1.1 - basic (response 1)";
assertThat(specId, response.getStatus(), is(HttpStatus.FOUND_302));
assertEquals(getServer().getScheme() + "://localhost/tests/", response.get("Location"), specId);
assertEquals("/tests/", response.get("Location"), specId);

response = responses.get(1);
specId = "10.3 Redirection HTTP/1.1 - basic (response 2)";
assertThat(specId, response.getStatus(), is(HttpStatus.FOUND_302));
assertEquals(getServer().getScheme() + "://localhost/tests/", response.get("Location"), specId);
assertEquals("/tests/", response.get("Location"), specId);
assertEquals("close", response.get("Connection"), specId);
}

Expand All @@ -1120,7 +1120,7 @@ public void test103RedirectHttp10Resource() throws Exception

String specId = "10.3 Redirection HTTP/1.0 w/content";
assertThat(specId, response.getStatus(), is(HttpStatus.FOUND_302));
assertEquals(getServer().getScheme() + "://localhost/tests/R1.txt", response.get("Location"), specId);
assertEquals("/tests/R1.txt", response.get("Location"), specId);
}

/**
Expand All @@ -1143,7 +1143,7 @@ public void test103RedirectHttp11Resource() throws Exception

String specId = "10.3 Redirection HTTP/1.1 w/content";
assertThat(specId + " [status]", response.getStatus(), is(HttpStatus.FOUND_302));
assertThat(specId + " [location]", response.get("Location"), is(getServer().getScheme() + "://localhost/tests/R2.txt"));
assertThat(specId + " [location]", response.get("Location"), is("/tests/R2.txt"));
assertThat(specId + " [connection]", response.get("Connection"), is("close"));
}

Expand Down

0 comments on commit 14bede5

Please sign in to comment.