summary refs log tree commit diff stats
path: root/lib/impure/web.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-09-24 20:22:53 +0200
committerAraq <rumpf_a@web.de>2011-09-24 20:22:53 +0200
commit0f37d0e1f2aeee466b3c6179886963354eaa6222 (patch)
tree51ae4183dabd454877d7570cafb7f72dcf519011 /lib/impure/web.nim
parent485c371942cbbb1f9a10c64b6fcc699e59511460 (diff)
downloadNim-0f37d0e1f2aeee466b3c6179886963354eaa6222.tar.gz
sockets.recv optimizations; stdlib now supports taint mode
Diffstat (limited to 'lib/impure/web.nim')
-rwxr-xr-xlib/impure/web.nim14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/impure/web.nim b/lib/impure/web.nim
index af302cc57..f4009ba80 100755
--- a/lib/impure/web.nim
+++ b/lib/impure/web.nim
@@ -43,19 +43,19 @@ proc URLretrieveStream*(url: string): PStream =
   if easy_perform(hCurl) != E_OK: return nil
   easy_cleanup(hCurl)
   
-proc URLretrieveString*(url: string): string = 
+proc URLretrieveString*(url: string): TaintedString = 
   ## retrieves the given `url` and returns the contents. Returns nil if an
   ## error occurs.
   var stream = newStringStream()
   var hCurl = easy_init()
-  if hCurl == nil: return nil
-  if easy_setopt(hCurl, OPT_URL, url) != E_OK: return nil
+  if hCurl == nil: return
+  if easy_setopt(hCurl, OPT_URL, url) != E_OK: return
   if easy_setopt(hCurl, OPT_WRITEFUNCTION, 
-                      curlwrapperWrite) != E_OK: return nil
-  if easy_setopt(hCurl, OPT_WRITEDATA, stream) != E_OK: return nil
-  if easy_perform(hCurl) != E_OK: return nil
+                      curlwrapperWrite) != E_OK: return
+  if easy_setopt(hCurl, OPT_WRITEDATA, stream) != E_OK: return
+  if easy_perform(hCurl) != E_OK: return
   easy_cleanup(hCurl)
-  result = stream.data
+  result = stream.data.TaintedString
 
 when isMainModule:
   echo URLretrieveString("http://nimrod.ethexor.com/")