Skip to content

Commit aaca2de

Browse files
committed
Works with latest compiler now. Added license information.
1 parent e9ad788 commit aaca2de

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

errorpages.nim

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (C) 2012 Dominik Picheta
2+
# MIT License - Look at license.txt for details.
13
import htmlgen
24
proc error*(err, jesterVer: string): string =
35
return html(head(title(err)),

jester.nim

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (C) 2012 Dominik Picheta
2+
# MIT License - Look at license.txt for details.
13
import httpserver, sockets, strtabs, re, tables, parseutils, os, strutils, uri,
24
scgi, cookies, times, mimetypes
35

@@ -8,7 +10,7 @@ from cgi import decodeData, ECgi
810
type
911
TCallbackRet = tuple[action: TCallbackAction, code: THttpCode,
1012
headers: PStringTable, content: string]
11-
TCallback = proc (request: var TRequest): TCallbackRet
13+
TCallback = proc (request: var TRequest): TCallbackRet {.nimcall.}
1214

1315
TJester = object
1416
isHttp: bool
@@ -159,7 +161,7 @@ proc createReq(path, body, ip: string, headers,
159161
result.cookies = parseCookies(result.headers["Cookie"])
160162
else: result.cookies = newStringTable()
161163

162-
template routeReq(): stmt =
164+
template routeReq(): stmt {.dirty.} =
163165
var (action, code, headers, content) = (TCActionNothing, http200,
164166
{:}.newStringTable, "")
165167
try:
@@ -298,6 +300,9 @@ proc run*(appName = "", port = TPort(5000), http = true) =
298300
handleSCGIRequest(j.scgiServer)
299301
except EScgi:
300302
echo("[Warning] SCGI gave error: ", getCurrentExceptionMsg())
303+
except:
304+
echo getStackTrace(getCurrentException())
305+
break
301306

302307
proc regex*(s: string, flags = {reExtended, reStudy}): TRegexMatch =
303308
result = (re(s, flags), s)
@@ -319,7 +324,7 @@ template matchAddPattern(meth: THttpCode, path: string,
319324
match.typ = MSpecial
320325
match.pattern = parsePattern(path)
321326

322-
j.routes.add((meth, match, (proc (request: var TRequest): TCallbackRet =
327+
j.routes.add((meth, match, (proc (request: var TRequest): TCallbackRet {.nimcall.} =
323328
setDefaultResp()
324329
body)))
325330

license.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (C) 2012 Dominik Picheta
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19+
IN THE SOFTWARE.

patterns.nim

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (C) 2012 Dominik Picheta
2+
# MIT License - Look at license.txt for details.
13
import parseutils, strtabs
24
type
35
TNodeType = enum

utils.nim

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (C) 2012 Dominik Picheta
2+
# MIT License - Look at license.txt for details.
13
import parseutils, strtabs, strutils, tables
24
from cgi import urlDecode
35

0 commit comments

Comments
 (0)