gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 06/07: Unix domain socket proxy: fix payload read/write.


From: gnunet
Subject: [libeufin] 06/07: Unix domain socket proxy: fix payload read/write.
Date: Wed, 06 Oct 2021 16:17:57 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

commit b4942a1880831642c87d43dc4de711bb87b5503c
Author: ms <ms@taler.net>
AuthorDate: Wed Oct 6 14:39:54 2021 +0200

    Unix domain socket proxy: fix payload read/write.
---
 util/src/main/kotlin/UnixDomainSocket.kt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/util/src/main/kotlin/UnixDomainSocket.kt 
b/util/src/main/kotlin/UnixDomainSocket.kt
index 6742189..b2713f2 100644
--- a/util/src/main/kotlin/UnixDomainSocket.kt
+++ b/util/src/main/kotlin/UnixDomainSocket.kt
@@ -5,6 +5,8 @@ import io.ktor.http.HttpMethod
 import io.ktor.server.engine.*
 import io.ktor.server.testing.*
 import io.netty.bootstrap.ServerBootstrap
+import io.netty.buffer.ByteBufInputStream
+import io.netty.buffer.Unpooled
 import io.netty.channel.*
 import io.netty.channel.epoll.EpollEventLoopGroup
 import io.netty.channel.epoll.EpollServerDomainSocketChannel
@@ -72,7 +74,7 @@ class LibeufinHttpHandler : 
SimpleChannelInboundHandler<FullHttpRequest>() {
                 method = HttpMethod(msg.method().name())
                 uri = msg.uri()
                 version = httpVersion.text()
-                setBody(msg.content().array())
+                setBody(ByteBufInputStream(msg.content()).readAllBytes())
             }
             val statusCode: Int = call.response.status()?.value ?: throw 
UtilError(
                 HttpStatusCode.InternalServerError,
@@ -80,7 +82,11 @@ class LibeufinHttpHandler : 
SimpleChannelInboundHandler<FullHttpRequest>() {
                 ec = null // FIXME: to be defined.
             )
             // Responding with Netty API.
-            val response = DefaultFullHttpResponse(httpVersion, 
HttpResponseStatus.valueOf(statusCode))
+            val response = DefaultFullHttpResponse(
+                httpVersion,
+                HttpResponseStatus.valueOf(statusCode),
+                Unpooled.wrappedBuffer(call.response.byteContent ?: 
ByteArray(0))
+            )
             call.response.headers.allValues().forEach { s, list ->
                 response.headers().set(s, list.joinToString()) // 
joinToString() separates with ", " by default.
             }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]