thanks richard. I will forawrd your mail to the pharo mailing-list. Stef On Aug 21, 2013, at 6:34 PM, Richard Sargent <richard.sargent@gemtalksystems.com> wrote:
Hi Stephane,
I was looking at some of the Pharo code and discovered a gap in the logic. (But is is perhaps a gap in my understanding of the underlying specification.) The same error may well be found in 3.0 (I have not checked).
Try the following.
UrlTest>>#testUsernameEncodedWithoutPassword2 "Sometimes, weird usernames or passwords are necessary in applications, and, thus, we might receive them in a Url. The @ and the : are the kind of critical ones."
#( "('user' 'pword' 'host' port 'path')" ('Stéphane rst Pückler' '' 'cottbus.brandenburg' 80 'mein/Zuhause') ('Jeannde.d''Arc' '' 'orleans' 8080 'une/deux/trois') ('HaXor@roxor:fnac' '' 'cbase' 42 'do/not_try') ) do: [:urlParts | |theUrl| theUrl := ('http://{1}@{3}:{4}/{5}' format: { (urlParts at: 1) encodeForHTTP. (urlParts at: 2) encodeForHTTP. urlParts at: 3. urlParts at: 4. urlParts at: 5. }) asUrl. self assert: (theUrl schemeName = 'http'). self assert: (theUrl username = (urlParts at: 1)). self assert: (theUrl password = (urlParts at: 2)). self assert: (theUrl authority = (urlParts at: 3)). self assert: (theUrl port = (urlParts at: 4)). self assert: theUrl path first = ((urlParts at: 5) copyUpTo: $/ )]
-- Richard Sargent Business Development Manager richard.sargent@gemtalksystems.com GemTalk Systems 15220 NW Greenbrier Parkway #240 Beaverton, OR 97006