Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin parsing fails when there are multiple hosts without a port number #7236

Open
spenes opened this issue Aug 7, 2023 · 0 comments
Open
Labels
uri raze it and salt the earth whence it grew

Comments

@spenes
Copy link

spenes commented Aug 7, 2023

I've encountered this problem in version 0.23.23. Origin parsing fails when there are multiple hosts without a port number.

In OriginHeaderSuite, given

private val host4 = Origin.Host(Uri.Scheme.https, Uri.RegName("bar.foo.com"), None)
private val hostString4 = "https://bar.foo.com"

add the following test :

  test("OriginHeader parser should Parse a list of multiple hosts without a port number") {
    val text = s"$hostString4 $hostString4"
    val origin = Origin.HostList(NonEmptyList.of(host4, host4))
    val headers = Headers(("Origin", text))
    val extracted = headers.get[Origin]
    assertEquals(extracted, Some(origin))
  }

Test fails because Origin parser fails to parse the input. Test passes when port number is added to host.

@armanbilge armanbilge added the uri raze it and salt the earth whence it grew label Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
uri raze it and salt the earth whence it grew
Projects
None yet
Development

No branches or pull requests

2 participants