From f9089db681792468919dbacc2ff7a60b69bc9d7e Mon Sep 17 00:00:00 2001 From: dom96 Date: Wed, 16 May 2012 22:29:51 +0100 Subject: [PATCH] The httpserver now grabs the IP address of the client. RST gen fix for smileys. --- lib/pure/httpserver.nim | 5 ++++- packages/docutils/rstgen.nim | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pure/httpserver.nim b/lib/pure/httpserver.nim index 586f603b3b..046844db46 100755 --- a/lib/pure/httpserver.nim +++ b/lib/pure/httpserver.nim @@ -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 = "" diff --git a/packages/docutils/rstgen.nim b/packages/docutils/rstgen.nim index a9f9376f31..fc68580a97 100644 --- a/packages/docutils/rstgen.nim +++ b/packages/docutils/rstgen.nim @@ -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, - """""", "\\includegraphics{$1}", [n.text])