about summary refs log tree commit diff stats
path: root/adapter
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-12-14 02:04:21 +0100
committerbptato <nincsnevem662@gmail.com>2023-12-14 02:04:21 +0100
commit9037fb6458b68350cc4113b53316ebf1d4a1272d (patch)
tree13792d6c87994276bb3971d3f0c85a694ab78555 /adapter
parent871bd4999b0b3da32e2967c09d3d82d13637e70f (diff)
downloadchawan-9037fb6458b68350cc4113b53316ebf1d4a1272d.tar.gz
file: complain about hostname
fixes error on reloading stdin
Diffstat (limited to 'adapter')
-rw-r--r--adapter/protocol/file.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/adapter/protocol/file.nim b/adapter/protocol/file.nim
index d05d558c..fbd14479 100644
--- a/adapter/protocol/file.nim
+++ b/adapter/protocol/file.nim
@@ -96,6 +96,11 @@ proc loadFile(istream: Stream) =
         break
 
 proc main() =
+  if getEnv("MAPPED_URI_HOST") != "":
+      let code = int(ERROR_INVALID_URL)
+      stdout.write("Cha-Control: ConnectionError " & $code &
+        " cannot use host in file")
+      return
   let opath = getEnv("MAPPED_URI_PATH")
   let path = percentDecode(opath)
   let istream = newFileStream(path, fmRead)