diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-13 15:00:34 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-13 15:00:34 +0100 |
commit | 53bc47531543fe55997f4c6875fa03745a17e754 (patch) | |
tree | a7d3b3de2f68580a79415818bad84bf607e58c14 /adapter/protocol/file.nim | |
parent | 4818cb28debf4601213707f6c1b9b22348b51fbc (diff) | |
download | chawan-53bc47531543fe55997f4c6875fa03745a17e754.tar.gz |
Various fixes
* Makefile: fix parallel build, add new binaries to install target * twtstr: split out libunicode-related stuff to luwrap * config: quote default gopher2html URL env var for unquote * adapter/: get rid of types/url dependency, use CURL url in all cases
Diffstat (limited to 'adapter/protocol/file.nim')
-rw-r--r-- | adapter/protocol/file.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/adapter/protocol/file.nim b/adapter/protocol/file.nim index 168be58b..d05d558c 100644 --- a/adapter/protocol/file.nim +++ b/adapter/protocol/file.nim @@ -9,11 +9,11 @@ import dirlist import loader/connecterror import utils/twtstr -proc loadDir(path: string) = +proc loadDir(path, opath: string) = var path = path if path[^1] != '/': #TODO dos/windows path &= '/' - var base = getEnv("QUERY_STRING") + var base = "file://" & opath if base[^1] != '/': #TODO dos/windows base &= '/' stdout.write("Content-Type: text/html\n\n") @@ -96,11 +96,12 @@ proc loadFile(istream: Stream) = break proc main() = - let path = percentDecode(getEnv("MAPPED_URI_PATH")) + let opath = getEnv("MAPPED_URI_PATH") + let path = percentDecode(opath) let istream = newFileStream(path, fmRead) if istream == nil: if dirExists(path): - loadDir(path) + loadDir(path, opath) elif symlinkExists(path): loadSymlink(path) else: |