Skip to content

Commit

Permalink
Safety: Use copy(url) instead of withUrl() to avoid possible infinite…
Browse files Browse the repository at this point in the history
… recursion.
  • Loading branch information
htmldoug committed Feb 8, 2019
1 parent c5326ae commit 4a42bf5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ object StandaloneAhcWSClient {
} yield key -> value

req
.withUrl(urlNoQueryParams)
// Intentionally using copy(url) instead of withUrl(url) to avoid
// withUrl() -> normalize() -> withUrl() -> normalize()
// just in case we missed a case.
.copy(url = urlNoQueryParams)(req.materializer)
.withQueryStringParameters(queryParams: _*)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ case class StandaloneAhcWSRequest(
proxyServer: Option[WSProxyServer] = None,
disableUrlEncoding: Option[Boolean] = None,
private val filters: Seq[WSRequestFilter] = Nil
)(implicit materializer: Materializer) extends StandaloneWSRequest with AhcUtilities with WSCookieConverter {
)(implicit private[ahc] val materializer: Materializer) extends StandaloneWSRequest with AhcUtilities with WSCookieConverter {
override type Self = StandaloneWSRequest
override type Response = StandaloneWSResponse

Expand Down

0 comments on commit 4a42bf5

Please sign in to comment.