def verifyUri()

in http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/HttpMessage.scala [514:526]


  def verifyUri(uri: Uri): Unit =
    if (uri.isEmpty) throw IllegalUriException("`uri` must not be empty")
    else {
      def c(i: Int) = CharUtils.toLowerCase(uri.scheme.charAt(i))
      uri.scheme.length match {
        case 0                                                                            => // ok
        case 4 if c(0) == 'h' && c(1) == 't' && c(2) == 't' && c(3) == 'p'                => // ok
        case 5 if c(0) == 'h' && c(1) == 't' && c(2) == 't' && c(3) == 'p' && c(4) == 's' => // ok
        case 2 if c(0) == 'w' && c(1) == 's'                                              => // ok
        case 3 if c(0) == 'w' && c(1) == 's' && c(2) == 's'                               => // ok
        case _                                                                            => throw IllegalUriException("""`uri` must have scheme "http", "https", "ws", "wss" or no scheme""")
      }
    }