 }
 
 : read-body ( -- body )
-    [ readln ] loop>array ;
+    [ 1024 read ] loop>array concat ;
 
 : ?read-body ( status -- body/f )
     ?first CHAR: 2 = [ read-body ] [ f ] if ;
 
 : read-response ( -- status meta body/f )
-    readln [ blank? ] split1-when over ?read-body ;
+    readln utf8 decode "\r" ?tail drop [ blank? ] split1-when over ?read-body ;
 
 : send-request ( url -- )
-    present write "\r\n" write flush ;
+    present utf8 encode write B{ CHAR: \r CHAR: \n } write flush ;
 
 : gemini-addr ( url -- addr )
     [ host>> ] [ port>> 1965 or ] bi <inet> ;


:: gemtext. ( base-url body -- )
    f "pre" [
        body [
            {
                { [ "```" ?head ] [ drop "pre" on ] }
                { [ "=>" ?head ] [ base-url gemini-link. ] }

PRIVATE>

: gemini ( url -- status meta body/f )
    dup gemini-addr binary [
        gemini-tls
        send-request
        read-response
