merged dom's changes
This commit is contained in:
commit
a8f6d307a9
1 changed files with 5 additions and 5 deletions
|
|
@ -42,7 +42,6 @@ proc parseUrl*(url: string): TURL =
|
||||||
inc(i) #Skip the @
|
inc(i) #Skip the @
|
||||||
#hostname(subdomain, domain, port)
|
#hostname(subdomain, domain, port)
|
||||||
if url[i] == '/' or url[i] == '\0':
|
if url[i] == '/' or url[i] == '\0':
|
||||||
#TODO
|
|
||||||
hostname = temp
|
hostname = temp
|
||||||
if hostname.split(':').len() > 1:
|
if hostname.split(':').len() > 1:
|
||||||
port = hostname.split(':')[1]
|
port = hostname.split(':')[1]
|
||||||
|
|
@ -54,6 +53,7 @@ proc parseUrl*(url: string): TURL =
|
||||||
temp.add(url[i])
|
temp.add(url[i])
|
||||||
inc(i)
|
inc(i)
|
||||||
|
|
||||||
|
if url[i] == '/': inc(i) # Skip the '/'
|
||||||
#Path
|
#Path
|
||||||
while True:
|
while True:
|
||||||
if url[i] == '?':
|
if url[i] == '?':
|
||||||
|
|
@ -88,8 +88,8 @@ proc `$`*(t: TURL): string =
|
||||||
result.add(t.username & ":" & t.password & "@")
|
result.add(t.username & ":" & t.password & "@")
|
||||||
else:
|
else:
|
||||||
result.add(t.username & "@")
|
result.add(t.username & "@")
|
||||||
if t.hostname != "": result.add(t.hostname)
|
result.add(t.hostname)
|
||||||
if t.port != "": result.add(":" & t.port)
|
if t.port != "": result.add(":" & t.port)
|
||||||
if t.path != "": result.add(t.path)
|
if t.path != "": result.add("/" & t.path)
|
||||||
if t.query != "": result.add(t.query)
|
result.add(t.query)
|
||||||
if t.anchor != "": result.add(t.anchor)
|
result.add(t.anchor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue