Skip to content

Commit

Permalink
Add dock, annotate with @internalapi
Browse files Browse the repository at this point in the history
  • Loading branch information
marychatte committed Dec 5, 2022
1 parent cfd97b1 commit 0448780
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ktor-http/common/src/io/ktor/http/auth/HttpAuthHeader.kt
Expand Up @@ -61,6 +61,7 @@ public fun parseAuthorizationHeader(headerValue: String): HttpAuthHeader? {
* @return a list of [HttpAuthHeader]
* @throws [ParseException] on invalid header
*/
@InternalAPI
public fun parseAuthorizationHeaders(headerValue: String): List<HttpAuthHeader> {
var index = 0
val headers = mutableListOf<HttpAuthHeader>()
Expand Down Expand Up @@ -107,6 +108,12 @@ private fun parseAuthorizationHeader(
return nextIndexChallenge
}

/**
* Check for the ending of the current challenge in a header
* @return -1 if at the end of the header
* @return null if the challenge is not ended
* @return a positive number - the index of the beginning of the next challenge
*/
private fun nextChallengeIndex(
headers: MutableList<HttpAuthHeader>,
header: HttpAuthHeader,
Expand Down
Expand Up @@ -5,6 +5,7 @@
package io.ktor.tests.auth

import io.ktor.http.auth.*
import io.ktor.util.*
import kotlin.random.*
import kotlin.test.*

Expand Down Expand Up @@ -114,6 +115,7 @@ class AuthorizeHeaderParserTest {
}
}

@OptIn(InternalAPI::class)
private fun testParserMultipleChallenges(expected: List<HttpAuthHeader>, headerValue: String) {
val actual = parseAuthorizationHeaders(headerValue)

Expand Down

0 comments on commit 0448780

Please sign in to comment.