From 068cbbc0763167653873b363e14c504a15fba906 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sat, 29 Apr 2023 15:44:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Host=E3=81=AE=E7=BD=B2=E5=90=8D?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt b/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt index 74fcfff7..6ed1783d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt +++ b/src/main/kotlin/dev/usbharu/hideout/plugins/ActivityPub.kt @@ -47,7 +47,7 @@ suspend fun HttpClient.postAp(urlString: String, username: String, jsonLd: JsonL suspend fun HttpClient.getAp(urlString: String,username: String):HttpResponse { return this.get(urlString){ header("Accept",ContentType.Application.Activity) - header("Signature","keyId=\"$username\",algorithm=\"rsa-sha256\",headers=\"(request-target) date\"") + header("Signature","keyId=\"$username\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date\"") } } @@ -63,6 +63,7 @@ val httpSignaturePlugin = createClientPlugin("HttpSign", ::HttpSignaturePluginCo request.header("Date", format.format(Date())) + request.header("Host",request.url.host+request.url.port.toString()) println(request.bodyType) println(request.bodyType?.type) if (request.bodyType?.type == String::class) { @@ -110,7 +111,9 @@ val httpSignaturePlugin = createClientPlugin("HttpSign", ::HttpSignaturePluginCo "date" -> { "Date" } - + "host" -> { + "Host" + } else -> { it }