From d11a62af3142751cb4bfb5ebfaf1e749d9d828ac Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 30 Oct 2010 19:13:35 +0200 Subject: [PATCH] bugfix: httpclient --- lib/pure/cgi.nim | 5 +++++ lib/pure/httpclient.nim | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/pure/cgi.nim b/lib/pure/cgi.nim index 490ae926d7..643c67bec8 100755 --- a/lib/pure/cgi.nim +++ b/lib/pure/cgi.nim @@ -345,6 +345,11 @@ proc writeContentType*() = write(stdout, "Content-type: text/html\n\n") system.stackTraceNewLine = "
\n" +proc setStackTraceNewLine*() = + ## Modifies the debug stack traces so that they contain + ## ``
`` and are easily readable in a browser. + system.stackTraceNewLine = "
\n" + proc setCookie*(name, value: string) = ## Sets a cookie. write(stdout, "Set-Cookie: ", name, "=", value, "\n") diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index c02a7a6e71..9948e6c9bb 100755 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -238,8 +238,10 @@ proc request*(url: string, httpMethod = httpGET, extraHeaders = "", var headers = copy($httpMethod, len("http")) if r.path != "": - headers.add(" " & r.path & r.query) - headers.add(" / HTTP/1.1\c\L") + headers.add(" /" & r.path & r.query) + else: + headers.add(" /") + headers.add(" HTTP/1.1\c\L") add(headers, "Host: " & r.hostname & "\c\L") add(headers, extraHeaders)