Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Treat URLs with no hostname in them as invalid

  • Loading branch information...
commit 5d606f407930f24c8ad44d67aaeae2d15456c563 1 parent be9e172
@havocp havocp authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 web/src/main/scala/com/typesafe/webwords/web/WebActors.scala
View
8 web/src/main/scala/com/typesafe/webwords/web/WebActors.scala
@@ -156,8 +156,12 @@ class WordsActor(config: WebWordsConfig) extends Actor {
private def parseURL(s: String): Option[URL] = {
val maybe = try {
- new URI(s) // we want it to be a valid URI also
- Some(new URL(s))
+ val uri = new URI(s) // we want it to be a valid URI also
+ val url = new URL(s)
+ // apparently a valid URI can have no hostname
+ if (uri.getHost() == null)
+ throw new URISyntaxException(s, "No host in URI")
+ Some(url)
} catch {
case e: MalformedURLException => None
case e: URISyntaxException => None
Please sign in to comment.
Something went wrong with that request. Please try again.