diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-13 12:08:05 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-13 12:56:28 +0100 |
commit | ab203acf554993d15e37604773f160c84b4d8252 (patch) | |
tree | 45428aa45bc751f788cc5c52c32b15bb8a2363f1 /adapter/protocol/file.nim | |
parent | bf761bcb6dcc5288a86aa5e8c2b67df3f0df056b (diff) | |
download | chawan-ab203acf554993d15e37604773f160c84b4d8252.tar.gz |
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
Diffstat (limited to 'adapter/protocol/file.nim')
-rw-r--r-- | adapter/protocol/file.nim | 11 |
1 files changed, 6 insertions, 5 deletions
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() = |