| 1 |
portion of finagle-base-http/src/test/scala/com/twitter/finagle/http/codec/HttpDtabTest.scala |
| 2 |
from finagle-finagle-17.11.0.tar.gz used to trigger |
| 3 |
Complex regular subexpression recursion limit (32766) exceeded |
| 4 |
|
| 5 |
package com.twitter.finagle.http.codec |
| 6 |
|
| 7 |
import com.google.common.io.BaseEncoding |
| 8 |
import com.twitter.finagle.http.{Message, Method, Request, Version} |
| 9 |
import com.twitter.finagle.{Dentry, Dtab, Failure, NameTree} |
| 10 |
import java.nio.charset.Charset |
| 11 |
import org.scalatest.FunSuite |
| 12 |
import org.scalatest.junit.AssertionsForJUnit |
| 13 |
|
| 14 |
class HttpDtabTest extends FunSuite with AssertionsForJUnit { |
| 15 |
val okDests = Vector("/$/inet/10.0.0.1/9000", "/foo/bar", "/") |
| 16 |
val okPrefixes = Vector("/foo", "/", "/foo/*/bar") |
| 17 |
val okDentries = for { |
| 18 |
prefix <- okPrefixes |
| 19 |
dest <- okDests |
| 20 |
} yield Dentry(Dentry.Prefix.read(prefix), NameTree.read(dest)) |
| 21 |
|
| 22 |
val Utf8 = Charset.forName("UTF-8") |
| 23 |
val Base64 = BaseEncoding.base64() |
| 24 |
private def b64Encode(v: String): String = |
| 25 |
Base64.encode(v.getBytes(Utf8)) |
| 26 |
|
| 27 |
val okDtabs = |
| 28 |
Dtab.empty +: (okDentries.permutations map (ds => Dtab(ds))).toIndexedSeq |
| 29 |
|
| 30 |
def newMsg(): Message = Request(Version.Http11, Method.Get, "/") |
| 31 |
|
| 32 |
// test("write(dtab, msg); read(msg) == dtab") { |
| 33 |
// for (dtab <- okDtabs) { |
| 34 |
// val m = newMsg() |
| 35 |
// HttpDtab.write(dtab, m) |
| 36 |
// val dtab1 = HttpDtab.read(m).get() |
| 37 |
// assert(Equiv[Dtab].equiv(dtab, dtab1)) |
| 38 |
// } |
| 39 |
// } |
| 40 |
|
| 41 |
} |