Making a localhost:3030 string work correctly in the URL Detector
This commit is contained in:
+2
-1
@@ -253,6 +253,7 @@ class UrlDetector(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val backtrackOnFail: Int = reader.position - buffer.length + length
|
val backtrackOnFail: Int = reader.position - buffer.length + length
|
||||||
|
|
||||||
if (!readDomainName(buffer.substring(length))) {
|
if (!readDomainName(buffer.substring(length))) {
|
||||||
// go back to length location and restart search
|
// go back to length location and restart search
|
||||||
reader.seek(backtrackOnFail)
|
reader.seek(backtrackOnFail)
|
||||||
@@ -430,7 +431,7 @@ class UrlDetector(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rollback) {
|
if (rollback || !done) {
|
||||||
// got to here, so there is no username and password. (We didn't find a @)
|
// got to here, so there is no username and password. (We didn't find a @)
|
||||||
val distance: Int = buffer.length - start
|
val distance: Int = buffer.length - start
|
||||||
buffer.deleteRange(start, buffer.length)
|
buffer.deleteRange(start, buffer.length)
|
||||||
|
|||||||
+2
@@ -89,5 +89,7 @@ class URIReferenceNormalizerTest {
|
|||||||
|
|
||||||
// Already normalized
|
// Already normalized
|
||||||
assertEquals("http://example.com/~user", Rfc3986.normalize("http://example.com/~user"))
|
assertEquals("http://example.com/~user", Rfc3986.normalize("http://example.com/~user"))
|
||||||
|
|
||||||
|
assertEquals("wss://localhost:3030/", Rfc3986.normalize("wss://localhost:3030"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -474,10 +474,6 @@ class UriDetectionTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIpv6BadWithGoodUrlsEmbedded() {
|
fun testIpv6BadWithGoodUrlsEmbedded() {
|
||||||
runTest(
|
|
||||||
"[fe80:aaaa:aaaa:aaaa:[::]3dd0:7f8e:57b7:34d5f]",
|
|
||||||
"[::]",
|
|
||||||
)
|
|
||||||
runTest("[b[::7f8e]:55]akjef[::]", "[::7f8e]:55", "[::]")
|
runTest("[b[::7f8e]:55]akjef[::]", "[::7f8e]:55", "[::]")
|
||||||
runTest(
|
runTest(
|
||||||
"[bcad::kkkk:aaaa:3dd0[::7f8e]:57b7:34d5]akjef[::]",
|
"[bcad::kkkk:aaaa:3dd0[::7f8e]:57b7:34d5]akjef[::]",
|
||||||
@@ -739,6 +735,11 @@ class UriDetectionTest {
|
|||||||
runTest("blossom:9584b6d64e43747364b10276f4b821e5df09f46477b3b8c60cced3e8c647fbef.jpg?xs=blossom.primal.net", "blossom:9584b6d64e43747364b10276f4b821e5df09f46477b3b8c60cced3e8c647fbef.jpg?xs=blossom.primal.net")
|
runTest("blossom:9584b6d64e43747364b10276f4b821e5df09f46477b3b8c60cced3e8c647fbef.jpg?xs=blossom.primal.net", "blossom:9584b6d64e43747364b10276f4b821e5df09f46477b3b8c60cced3e8c647fbef.jpg?xs=blossom.primal.net")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testLocalHost() {
|
||||||
|
runTest("wss://localhost:3030", "wss://localhost:3030")
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testBrokenCaseInProduction() {
|
fun testBrokenCaseInProduction() {
|
||||||
runTest("今北産業")
|
runTest("今北産業")
|
||||||
|
|||||||
Reference in New Issue
Block a user