Merge branch 'master' of github.com:h3rald/nimhttpd
h3rald h3rald@h3rald.com
Mon, 30 Sep 2019 14:21:03 +0200
2 files changed,
7 insertions(+),
3 deletions(-)
M
src/nimhttpd.nim
→
src/nimhttpd.nim
@@ -8,7 +8,8 @@ times,
parseopt, parsecfg, streams, - strutils + strutils, + uri from httpcore import HttpMethod, HttpHeaders@@ -34,6 +35,7 @@ directory The directory to serve (default: current directory).
Options: -p, --port The port to listen to (default: 1337). + -a, --address The address to listen to (default: 127.0.0.1). """ % [name, version, description, author]@@ -146,7 +148,7 @@ proc serve*(settings: NimHttpSettings) =
var server = newAsyncHttpServer() proc handleHttpRequest(req: Request): Future[void] {.async.} = printReqInfo(settings, req) - let path = settings.directory/req.url.path.replace("%20", " ") + let path = settings.directory/req.url.path.replace("%20", " ").decodeUrl() var res: NimHttpResponse if req.reqMethod != HttpGet: res = sendNotImplemented(settings, path)@@ -180,6 +182,8 @@ quit(0)
of "version", "v": echo version quit(0) + of "address", "a": + address = val of "port", "p": try: port = Port(val.parseInt)
M
src/nimhttpdpkg/config.nim
→
src/nimhttpdpkg/config.nim
@@ -1,5 +1,5 @@
const pkgTitle* = "NimHTTPd" - pkgVersion* = "1.0.7" + pkgVersion* = "1.0.8" pkgAuthor* = "Fabio Cevasco" pkgDescription* = "A tiny static file web server."