From ab203acf554993d15e37604773f160c84b4d8252 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 13 Dec 2023 12:08:05 +0100 Subject: Move http out of main binary Now it is (technically) no longer mandatory to link to libcurl. Also, Chawan is at last completely protocol and network backend agnostic :) * Implement multipart requests in local CGI * Implement simultaneous download of CGI data * Add REQUEST_HEADERS env var with all headers * cssparser: add a missing check in consumeEscape --- adapter/protocol/file.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'adapter/protocol/file.nim') diff --git a/adapter/protocol/file.nim b/adapter/protocol/file.nim index f3ffa93e..168be58b 100644 --- a/adapter/protocol/file.nim +++ b/adapter/protocol/file.nim @@ -4,8 +4,9 @@ import std/streams import std/times import std/envvars +import dirlist + import loader/connecterror -import loader/dirlist import utils/twtstr proc loadDir(path: string) = @@ -84,14 +85,14 @@ proc loadFile(istream: Stream) = stdout.write("\n") let outs = newFileStream(stdout) while not istream.atEnd: - const bufferSize = 4096 - var buffer {.noinit.}: array[bufferSize, char] + const BufferSize = 16384 + var buffer {.noinit.}: array[BufferSize, char] while true: - let n = readData(istream, addr buffer[0], bufferSize) + let n = readData(istream, addr buffer[0], BufferSize) if n == 0: break outs.writeData(addr buffer[0], n) - if n < bufferSize: + if n < BufferSize: break proc main() = -- cgit 1.4.1-2-gfad0