The httpserver now grabs the IP address of the client. RST gen fix for smileys.
This commit is contained in:
parent
d6ae98a652
commit
f9089db681
2 changed files with 5 additions and 2 deletions
|
|
@ -214,6 +214,7 @@ type
|
||||||
path*, query*: string ## path and query the client requested
|
path*, query*: string ## path and query the client requested
|
||||||
headers*: PStringTable ## headers with which the client made the request
|
headers*: PStringTable ## headers with which the client made the request
|
||||||
body*: string ## only set with POST requests
|
body*: string ## only set with POST requests
|
||||||
|
ip*: string ## ip address of the requesting client
|
||||||
|
|
||||||
proc open*(s: var TServer, port = TPort(80)) =
|
proc open*(s: var TServer, port = TPort(80)) =
|
||||||
## creates a new server at port `port`. If ``port == 0`` a free port is
|
## 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) =
|
proc next*(s: var TServer) =
|
||||||
## proceed to the first/next request.
|
## 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)
|
s.headers = newStringTable(modeCaseInsensitive)
|
||||||
#headers(s.client, "")
|
#headers(s.client, "")
|
||||||
var data = ""
|
var data = ""
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ proc renderImage(d: PDoc, n: PRstNode, result: var string) =
|
||||||
|
|
||||||
proc renderSmiley(d: PDoc, n: PRstNode, result: var string) =
|
proc renderSmiley(d: PDoc, n: PRstNode, result: var string) =
|
||||||
dispA(d.target, result,
|
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" />""",
|
height="17" hspace="2" vspace="2" />""",
|
||||||
"\\includegraphics{$1}", [n.text])
|
"\\includegraphics{$1}", [n.text])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue