commit d08bb39e5fa97340c25297c8b6853a6ef34f8f07
parent 8de07671a7c8ce4f26bc31661351efc7dd68fd8c
Author: ms <ms@taler.net>
Date: Sat, 20 Nov 2021 21:07:13 +0100
fix proxied URL construction
Diffstat:
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -423,7 +423,7 @@ suspend inline fun <reified T : Any> ApplicationCall.receiveJson(): T {
val singleThreadContext = newSingleThreadContext("DB")
val sandboxApp: Application.() -> Unit = {
- install(io.ktor.features.CallLogging) {
+ install(CallLogging) {
this.level = org.slf4j.event.Level.DEBUG
this.logger = logger
}
@@ -1013,7 +1013,6 @@ val sandboxApp: Application.() -> Unit = {
}
// Talk to wallets.
route("/integration-api") {
-
get("/config") {
val demobank = ensureDemobank(call)
call.respond(object {
@@ -1149,6 +1148,7 @@ val sandboxApp: Application.() -> Unit = {
":${baseUrl.port}"
else ""
),
+ baseUrl.path, // has x-forwarded-prefix, or single slash.
"demobanks",
demobank.name,
"integration-api",
diff --git a/util/src/main/kotlin/HTTP.kt b/util/src/main/kotlin/HTTP.kt
@@ -145,7 +145,7 @@ fun getAuthorizationHeader(request: ApplicationRequest): String {
val authorization = request.headers["Authorization"]
logger.debug("Found Authorization header: $authorization")
return authorization ?: throw UtilError(
- HttpStatusCode.BadRequest, "Authorization header not found",
+ HttpStatusCode.Unauthorized, "Authorization header not found",
LibeufinErrorCode.LIBEUFIN_EC_AUTHENTICATION_FAILED
)
}
diff --git a/util/src/main/kotlin/Payto.kt b/util/src/main/kotlin/Payto.kt
@@ -50,7 +50,7 @@ fun parsePayto(paytoLine: String): Payto {
}
val splitPath = javaParsedUri.path.split("/").filter { it.isNotEmpty() }
if (splitPath.size > 2) {
- throw InvalidPaytoError("too many path segments in iban payto URI")
+ throw InvalidPaytoError("too many path segments in iban payto URI: $paytoLine")
}
val (iban, bic) = if (splitPath.size == 1) {
Pair(splitPath[0], null)
diff --git a/util/src/main/kotlin/UnixDomainSocket.kt b/util/src/main/kotlin/UnixDomainSocket.kt
@@ -56,7 +56,7 @@ class LibeufinHttpInit(
) : ChannelInitializer<Channel>() {
override fun initChannel(ch: Channel) {
ch.pipeline(
- ).addLast(LoggingHandler("tech.libeufin.util")
+ ).addLast(LoggingHandler("tech.libeufin.dev")
).addLast(HttpServerCodec() // in- and out- bound
).addLast(HttpObjectAggregator(Int.MAX_VALUE) // only in- bound
).addLast(ChunkedWriteHandler()