diff options
author | Araq <rumpf_a@web.de> | 2010-10-30 19:13:35 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2010-10-30 19:13:35 +0200 |
commit | d11a62af3142751cb4bfb5ebfaf1e749d9d828ac (patch) | |
tree | 526170a74d71862f900204d1e7c9da5971c0147a /lib | |
parent | 8733886e5370e507e4179932b5658be2ee696e0f (diff) | |
download | Nim-d11a62af3142751cb4bfb5ebfaf1e749d9d828ac.tar.gz |
bugfix: httpclient
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/pure/cgi.nim | 5 | ||||
-rwxr-xr-x | 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 490ae926d..643c67bec 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 = "<br />\n" +proc setStackTraceNewLine*() = + ## Modifies the debug stack traces so that they contain + ## ``<br />`` and are easily readable in a browser. + system.stackTraceNewLine = "<br />\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 c02a7a6e7..9948e6c9b 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) |