[ prog / sol / mona ]

prog


Running SchemeBBS using MIT Scheme 11.2

13 2022-05-30 04:22

>>11

Perhaps a different write-char call is involved.

Yes, you are right. I was mistaken.
The error is raised in the write-http-response procedure in runtime/http-io.scm. The error is caused by the use of newline to write to a binary port. newline can only write to a textual port.

Fix:

--- src/runtime/http-io.scm.orig
+++ src/runtime/http-io.scm
@@ -188,7 +188,8 @@
 	(write-ascii (write-to-string (http-response-status response)) port)
 	(write-u8 (char->integer #\space) port)
 	(write-ascii (http-response-reason response) port)
-	(newline port)
+	(write-u8 (char->integer #\return) port)
+	(write-u8 (char->integer #\newline) port)
 	(write-http-headers (http-response-headers response) port)))
   (write-bytevector (http-response-body response) port)
   (flush-output-port port))
56


VIP:

do not edit these