[svn:parrot] r46856 - in trunk: runtime/parrot/library t/library
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Fri May 21 13:01:33 UTC 2010
Author: fperrad
Date: Fri May 21 13:01:32 2010
New Revision: 46856
URL: https://trac.parrot.org/parrot/changeset/46856
Log:
[URI] fix host when userinfo
Modified:
trunk/runtime/parrot/library/URI.pir
trunk/t/library/uri.t
Modified: trunk/runtime/parrot/library/URI.pir
==============================================================================
--- trunk/runtime/parrot/library/URI.pir Fri May 21 12:28:11 2010 (r46855)
+++ trunk/runtime/parrot/library/URI.pir Fri May 21 13:01:32 2010 (r46856)
@@ -300,20 +300,25 @@
.sub 'host' :method
$S0 = self.'authority'()
+ $I0 = index $S0, '@'
+ if $I0 < 0 goto L1
+ inc $I0
+ $S0 = substr $S0, $I0
+ L1:
.local int pos, lastpos
lastpos = length $S0
pos = 0
- L1:
+ L2:
pos = index $S0, ':', pos
- if pos < 0 goto L2
+ if pos < 0 goto L3
$I1 = pos
inc pos
$I0 = is_cclass .CCLASS_NUMERIC, $S0, pos
- unless $I0 goto L1
+ unless $I0 goto L2
$I0 = find_not_cclass .CCLASS_NUMERIC, $S0, pos, lastpos
- unless $I0 == lastpos goto L1
+ unless $I0 == lastpos goto L2
$S0 = substr $S0, 0, $I1
- L2:
+ L3:
.return ($S0)
.end
Modified: trunk/t/library/uri.t
==============================================================================
--- trunk/t/library/uri.t Fri May 21 12:28:11 2010 (r46855)
+++ trunk/t/library/uri.t Fri May 21 13:01:32 2010 (r46856)
@@ -170,7 +170,7 @@
$S0 = $P0.'userinfo'()
is($S0, 'user:passwd', 'userinfo')
$S0 = $P0.'host'()
- is($S0, 'user:passwd at proxy.net', 'host')
+ is($S0, 'proxy.net', 'host')
$S0 = $P0.'port'()
is($S0, '8000', 'port')
.end
More information about the parrot-commits
mailing list