The httpserver now grabs the IP address of the client. RST gen fix for smileys.

This commit is contained in:
dom96
2012-05-16 22:29:51 +01:00
parent d6ae98a652
commit f9089db681
2 changed files with 5 additions and 2 deletions

View File

@@ -214,6 +214,7 @@ type
path*, query*: string ## path and query the client requested
headers*: PStringTable ## headers with which the client made the request
body*: string ## only set with POST requests
ip*: string ## ip address of the requesting client
proc open*(s: var TServer, port = TPort(80)) =
## creates a new server at port `port`. If ``port == 0`` a free port is
@@ -240,7 +241,9 @@ proc port*(s: var TServer): TPort =
proc next*(s: var TServer) =
## proceed to the first/next request.
s.client = accept(s.socket)
let (client, ip) = acceptAddr(s.socket)
s.client = client
s.ip = ip
s.headers = newStringTable(modeCaseInsensitive)
#headers(s.client, "")
var data = ""

View File

@@ -337,7 +337,7 @@ proc renderImage(d: PDoc, n: PRstNode, result: var string) =
proc renderSmiley(d: PDoc, n: PRstNode, result: var string) =
dispA(d.target, result,
"""<img src="images/smilies/$1.gif" width="15"
"""<img src="/images/smilies/$1.gif" width="15"
height="17" hspace="2" vspace="2" />""",
"\\includegraphics{$1}", [n.text])