From ee9a95e33b04e41a12fc9f0323a37fb11152c5e2 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Sat, 21 Nov 2015 20:43:44 +0100 Subject: [PATCH] =htc add test to verify URI against a very long path Was reported in Spray gitter channel, spray's URI throws an StackOverflowException for such URI. Adding the test to make our URI survives it (it does), and that it stays this way. --- .../src/test/scala/akka/http/scaladsl/model/UriSpec.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/akka-http-core/src/test/scala/akka/http/scaladsl/model/UriSpec.scala b/akka-http-core/src/test/scala/akka/http/scaladsl/model/UriSpec.scala index 4c9e1d6e50..189e203a87 100644 --- a/akka-http-core/src/test/scala/akka/http/scaladsl/model/UriSpec.scala +++ b/akka-http-core/src/test/scala/akka/http/scaladsl/model/UriSpec.scala @@ -609,5 +609,11 @@ class UriSpec extends WordSpec with Matchers { Uri("http://example.com/foo/bar?query=1#frag").toHttpRequestTargetOriginForm.toString === "/foo/bar?query=1" Uri("http://example.com//foo/bar?query=1#frag").toHttpRequestTargetOriginForm.toString === "//foo/bar?query=1" } + + "survive parsing a URI with thousands of path segments" in { + val slashes = "/a/" * 2000 + val uri = Uri(s"http://foo.bar/$slashes") + uri.toString // was reported to throw StackOverflowException in Spray's URI + } } }