Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Works with latest compiler now. Added license information.

  • Loading branch information...
commit aaca2dea2a0d698b0528696986a6c4d05ffcf30c 1 parent e9ad788
@dom96 authored
View
2  errorpages.nim
@@ -1,3 +1,5 @@
+# Copyright (C) 2012 Dominik Picheta
+# MIT License - Look at license.txt for details.
import htmlgen
proc error*(err, jesterVer: string): string =
return html(head(title(err)),
View
11 jester.nim
@@ -1,3 +1,5 @@
+# Copyright (C) 2012 Dominik Picheta
+# MIT License - Look at license.txt for details.
import httpserver, sockets, strtabs, re, tables, parseutils, os, strutils, uri,
scgi, cookies, times, mimetypes
@@ -8,7 +10,7 @@ from cgi import decodeData, ECgi
type
TCallbackRet = tuple[action: TCallbackAction, code: THttpCode,
headers: PStringTable, content: string]
- TCallback = proc (request: var TRequest): TCallbackRet
+ TCallback = proc (request: var TRequest): TCallbackRet {.nimcall.}
TJester = object
isHttp: bool
@@ -159,7 +161,7 @@ proc createReq(path, body, ip: string, headers,
result.cookies = parseCookies(result.headers["Cookie"])
else: result.cookies = newStringTable()
-template routeReq(): stmt =
+template routeReq(): stmt {.dirty.} =
var (action, code, headers, content) = (TCActionNothing, http200,
{:}.newStringTable, "")
try:
@@ -298,6 +300,9 @@ proc run*(appName = "", port = TPort(5000), http = true) =
handleSCGIRequest(j.scgiServer)
except EScgi:
echo("[Warning] SCGI gave error: ", getCurrentExceptionMsg())
+ except:
+ echo getStackTrace(getCurrentException())
+ break
proc regex*(s: string, flags = {reExtended, reStudy}): TRegexMatch =
result = (re(s, flags), s)
@@ -319,7 +324,7 @@ template matchAddPattern(meth: THttpCode, path: string,
match.typ = MSpecial
match.pattern = parsePattern(path)
- j.routes.add((meth, match, (proc (request: var TRequest): TCallbackRet =
+ j.routes.add((meth, match, (proc (request: var TRequest): TCallbackRet {.nimcall.} =
setDefaultResp()
body)))
View
19 license.txt
@@ -0,0 +1,19 @@
+Copyright (C) 2012 Dominik Picheta
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
View
2  patterns.nim
@@ -1,3 +1,5 @@
+# Copyright (C) 2012 Dominik Picheta
+# MIT License - Look at license.txt for details.
import parseutils, strtabs
type
TNodeType = enum
View
2  utils.nim
@@ -1,3 +1,5 @@
+# Copyright (C) 2012 Dominik Picheta
+# MIT License - Look at license.txt for details.
import parseutils, strtabs, strutils, tables
from cgi import urlDecode
Please sign in to comment.
Something went wrong with that request. Please try again.