all repos — nimhttpd @ 1b57f412f55df29cdfd39023dfd134d2f9d35b97

A useful static file web server.

Fixed warnings for nim v.1.4.0.
h3rald h3rald@h3rald.com
Sat, 31 Oct 2020 22:07:05 +0100
commit

1b57f412f55df29cdfd39023dfd134d2f9d35b97

parent

441a39dc226afbf7c305971eac77a9a13aa24bb5

2 files changed, 6 insertions(+), 6 deletions(-)

jump to
M src/nimhttpd.nimsrc/nimhttpd.nim

@@ -92,7 +92,7 @@ return path

else: path2.delete(0, cwd.len-1) var relpath = path2.replace("\\", "/") - if (not relpath.endsWith("/")) and (not path.existsFile): + if (not relpath.endsWith("/")) and (not path.fileExists): relpath = relpath&"/" if not relpath.startsWith("/"): relpath = "/"&relpath

@@ -135,7 +135,7 @@ let name = i.path.extractFilename

let relpath = i.path.relativePath(cwd) if name == "index.html" or name == "index.htm": return sendStaticFile(settings, i.path) - if i.path.existsDir: + if i.path.dirExists: files.add """<li class="i-folder entypo"><a href="$1">$2</a></li>""" % [relpath, name] else: files.add """<li class="i-file entypo"><a href="$1">$2</a></li>""" % [relpath, name]

@@ -176,9 +176,9 @@ let path = settings.directory/req.url.path.replace("%20", " ").decodeUrl()

var res: NimHttpResponse if req.reqMethod != HttpGet: res = sendNotImplemented(settings, path) - elif path.existsDir: + elif path.dirExists: res = sendDirContents(settings, path) - elif path.existsFile: + elif path.fileExists: res = sendStaticFile(settings, path) else: res = sendNotFound(settings, path)

@@ -225,7 +225,7 @@ if key.isAbsolute:

dir = key else: dir = www/key - if dir.existsDir: + if dir.dirExists: www = expandFilename dir else: echo "Error: Directory '"&dir&"' does not exist."
M src/nimhttpdpkg/config.nimsrc/nimhttpdpkg/config.nim

@@ -1,5 +1,5 @@

const pkgTitle* = "NimHTTPd" - pkgVersion* = "1.1.0" + pkgVersion* = "1.1.1" pkgAuthor* = "Fabio Cevasco" pkgDescription* = "A tiny static file web server."