From 3f84a648007fec3a6c0b19b567447151c48d3ccf Mon Sep 17 00:00:00 2001 From: Eitaro Fukamachi Date: Wed, 15 Jan 2025 06:13:23 +0900 Subject: [PATCH] Fix a wrong Content-Length for UTF-8 response bodies. --- README.md | 1 + coalton-lsp.asd | 3 ++- src/lib/rpc.lisp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a3bbe5..bc64dbf 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ following Lisp libraries: - bordeaux-threads - com.inuoe.jzon - usocket +- trivial-utf-8 ## Current Status diff --git a/coalton-lsp.asd b/coalton-lsp.asd index 04e3920..8892015 100644 --- a/coalton-lsp.asd +++ b/coalton-lsp.asd @@ -5,7 +5,8 @@ #:bordeaux-threads #:coalton #:com.inuoe.jzon - #:usocket) + #:usocket + #:trivial-utf-8) :pathname "src/" :serial t :components ((:file "package") diff --git a/src/lib/rpc.lisp b/src/lib/rpc.lisp index 9119a85..1e51e37 100644 --- a/src/lib/rpc.lisp +++ b/src/lib/rpc.lisp @@ -138,7 +138,7 @@ (defun %write-rpc (message stream) (let ((content (message-content message))) (write-headers stream - `(("Content-Length" . ,(length content)) + `(("Content-Length" . ,(trivial-utf-8:utf-8-byte-length content)) ("Content-Type" . "application/json-rpc"))) (write-sequence content stream) (force-output stream)))