Skip to content

Commit

Permalink
Update some URL tests
Browse files Browse the repository at this point in the history
These only get manually executed. The unescaped redirect is tough to port to the Jetty test suite as it won't emit that invalid header.
  • Loading branch information
jhy committed Oct 20, 2023
1 parent 6ccd158 commit da4e275
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/test/java/org/jsoup/integration/UrlConnectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ public void canSpecifyResponseCharset() throws IOException {
public void handlesUnescapedRedirects() throws IOException {
// URL locations should be url safe (ascii) but are often not, so we should try to guess
// in this case the location header is utf-8, but defined in spec as iso8859, so detect, convert, encode
String url = "http://direct.infohound.net/tools/302-utf.pl";
String urlEscaped = "http://direct.infohound.net/tools/test%F0%9F%92%A9.html";
String url = "https://direct.infohound.net/tools/302-utf.pl";
String urlEscaped = "https://direct.infohound.net/tools/test%F0%9F%92%A9.html";

Connection.Response res = Jsoup.connect(url).execute();
Document doc = res.parse();
Expand All @@ -410,17 +410,17 @@ public void handlesUnescapedRedirects() throws IOException {
}

@Test public void handlesEscapesInRedirecct() throws IOException {
Document doc = Jsoup.connect("http://infohound.net/tools/302-escaped.pl").get();
assertEquals("http://infohound.net/tools/q.pl?q=one%20two", doc.location());
Document doc = Jsoup.connect("https://direct.infohound.net/tools/302-escaped.pl").get();
assertEquals("https://direct.infohound.net/tools/q.pl?q=one%20two", doc.location());

doc = Jsoup.connect("http://infohound.net/tools/302-white.pl").get();
assertEquals("http://infohound.net/tools/q.pl?q=one%20two", doc.location());
doc = Jsoup.connect("https://direct.infohound.net/tools/302-white.pl").get();
assertEquals("https://direct.infohound.net/tools/q.pl?q=one+two", doc.location());
}

@Test
public void handlesUt8fInUrl() throws IOException {
String url = "http://direct.infohound.net/tools/test\uD83D\uDCA9.html";
String urlEscaped = "http://direct.infohound.net/tools/test%F0%9F%92%A9.html";
String url = "https://direct.infohound.net/tools/test\uD83D\uDCA9.html";
String urlEscaped = "https://direct.infohound.net/tools/test%F0%9F%92%A9.html";

Connection.Response res = Jsoup.connect(url).execute();
Document doc = res.parse();
Expand Down

0 comments on commit da4e275

Please sign in to comment.