Re: How to handle spaces/blanks in URLs
Russell Gold <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Safari tries the http://www.bit%20plan.com approach as well. I think
that is correct.
On Mar 29, 2008, at 5:53 AM, Wolfgang Fahl wrote:
> Dear httpunit developers,
>
> while working on Bug report 1908117
> the issue of how to handle spaces in URLs came up. I've added a test
> case with comments to document the current behaviour of httpunit
> which will count the link as a valid link and remove the blank. Does
> any real browser behave like this?
>
> Yours
> Wolfgang
>
> /**
> * test for Bug report 1908117 by firebird74
> * http://www.w3.org/Addressing/URL/url - spec.html
> * says
> * Spaces and control characters in URLs must
> be escaped for transmission in HTTP
> * so %20 ist used for space/blank
> * trying out
> * <html>
> * <body>
> * <a href="http://www.bit plan.com">BITlan blank link </a>
> * </body>
> * </html>
> * in different browers gives different results.
> * Firefox 2.0.0.13 will not show a link at all
> * Internet Explorer 6.0 will show a link that
> has http://www.bit%20plan.com
> * as it's target
> * @throws Exception
> */
> public void testLinkToURLWithBlanks() throws Exception {
> defineWebPage( "urlwithblank" ,
> "<a href='http://bla.fasel.com/a/b/lorem
> ipsum.pdf'>link with blank</a>" +
> "<a href='http://bla.fasel.com/a/b/lorem
> %20ipsum.pdf'>link with blank</a>" );
> WebConversation wc = new WebConversation();
> WebResponse resp = wc.getResponse( getHostPath() + "/
> urlwithblank.html" );
> WebLink [] webLinks = resp.getLinks();
> assertTrue( "There should be two link but there are " +webLinks.
> length ,webLinks. length ==2);
> String blankLink1= "http://bla.fasel.com/a/b/loremipsum.pdf" ;
> String blankLink2= "http://bla.fasel.com/a/b/lorem%20ipsum.pdf" ;
> WebLink link1 = webLinks[0];
> assertTrue( "the blank in the link1 should be removed but we got
> '" +link1.getURLString()+
> "'" ,link1.getURLString().equals(blankLink1));
> WebLink link2 = webLinks[1];
> assertTrue( "the blank %20 in the link2 should not be converted
> but we got '" +link2.getURLString()+
> "'" ,link2.getURLString().equals(blankLink2));
> }
>
>
> BITPlan - smart solutions
> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
> Tel. +49 1805 - BITPLAN / +49 1805 248 752, Fax +49 2154 811-481
> Web: http://www.bitplan.de
> bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548,
> Geschäftsführer: Wolfgang Fahl
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace_______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop