summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-desktop>2010-03-22 21:50:13 +0100
committerAndreas Rumpf <andreas@andreas-desktop>2010-03-22 21:50:13 +0100
commita8f6d307a9fa4a27f54734604620e1763a8eafa5 (patch)
tree5ad87c5c401fd63d1e4b32b8f49eed638a0f5fd8
parente62a02d5af90e243bf5d84fdf2ac3567e94bdf58 (diff)
parentc6b4d0e5ccd45ed3ac2414161b567e0135b277f4 (diff)
downloadNim-a8f6d307a9fa4a27f54734604620e1763a8eafa5.tar.gz
merged dom's changes
-rwxr-xr-xlib/pure/parseurl.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pure/parseurl.nim b/lib/pure/parseurl.nim
index cd3bc621a..ebeda3fd3 100755
--- a/lib/pure/parseurl.nim
+++ b/lib/pure/parseurl.nim
@@ -42,7 +42,6 @@ proc parseUrl*(url: string): TURL =
         inc(i) #Skip the @ 
       #hostname(subdomain, domain, port)
       if url[i] == '/' or url[i] == '\0':
-        #TODO
         hostname = temp
         if hostname.split(':').len() > 1:
           port = hostname.split(':')[1]
@@ -54,6 +53,7 @@ proc parseUrl*(url: string): TURL =
       temp.add(url[i])
       inc(i)
 
+  if url[i] == '/': inc(i) # Skip the '/'
   #Path
   while True:
     if url[i] == '?':
@@ -88,8 +88,8 @@ proc `$`*(t: TURL): string =
       result.add(t.username & ":" & t.password & "@")
     else:
       result.add(t.username & "@")
-  if t.hostname != "": result.add(t.hostname)
+  result.add(t.hostname)
   if t.port != "": result.add(":" & t.port)
-  if t.path != "": result.add(t.path)
-  if t.query != "": result.add(t.query)
-  if t.anchor != "": result.add(t.anchor)
+  if t.path != "": result.add("/" & t.path)
+  result.add(t.query)
+  result.add(t.anchor)