Re: [Httpunit-develop] HttpUnit
Brought to you by:
russgold
From: Serge M. <ser...@ya...> - 2010-01-23 15:15:01
|
Hi There is a patch for tripple dotted url, i.e. http://en.wikipedia.org/wiki/...And_Found Index: src/com/meterware/httpunit/WebRequest.java =================================================================== --- src/com/meterware/httpunit/WebRequest.java (revision 1062) +++ src/com/meterware/httpunit/WebRequest.java (working copy) @@ -142,7 +142,7 @@ private String getNormalizedPath( String path ) { if (path.lastIndexOf( "//" ) > path.lastIndexOf( "://" ) + 1) return getNormalizedPath( stripDoubleSlashes( path ) ); - if (path.indexOf( "/.." ) > 0) return getNormalizedPath( stripUpNavigation( path ) ); + if (path.indexOf( "/../" )>0 || path.endsWith("/..")) return getNormalizedPath( stripUpNavigation( path ) ); if (path.indexOf( "/./" ) > 0) return getNormalizedPath( stripInPlaceNavigation( path ) ); return path; } Index: test/com/meterware/httpunit/NormalizeURLTest.java =================================================================== --- test/com/meterware/httpunit/NormalizeURLTest.java (revision 1062) +++ test/com/meterware/httpunit/NormalizeURLTest.java (working copy) @@ -239,6 +239,10 @@ assertEquals( "URL", request.getURL().toExternalForm(), "http://host.name/file.html" ); } + public void testTripleDottedPath() throws Exception { + WebRequest request = new GetMethodWebRequest( "http://en.wikipedia.org/wiki/...And_Found" ); + assertEquals( "URL", request.getURL().toExternalForm(), "http://en.wikipedia.org/wiki/...And_Found" ); + } /* * Test relative URLs with directory navigation. With best regards Serge Maslyukov ________________________________ From: Serge Maslyukov <ser...@ya...> To: Wolfgang Fahl <wf...@bi...> Cc: rus...@ht...; Discussion of use and development of HttpUnit <htt...@li...> Sent: Tue, December 22, 2009 11:32:33 PM Subject: Re: HttpUnit Hello, Wolfgang There is a patch for an issue with non standard content type declaration i.e.: text/html charset=windows-1251 I already sent it to you. May be my e-mail was dropped to spam (. Index: src/com/meterware/httpunit/HttpUnitUtils.java =================================================================== --- src/com/meterware/httpunit/HttpUnitUtils.java (revision 1062) +++ src/com/meterware/httpunit/HttpUnitUtils.java Tue Dec 22 23:23:06 MSK 2009 @@ -76,7 +76,7 @@ public static String[] parseContentTypeHeader( String header ) { String[] result = new String[] { "text/plain", null }; if (header.trim().length()>0){ - StringTokenizer st = new StringTokenizer( header, ";=" ); + StringTokenizer st = new StringTokenizer( header, ";= " ); result[0] = st.nextToken(); while (st.hasMoreTokens()) { String parameter = st.nextToken(); Index: test/com/meterware/httpunit/HttpUnitUtilsTest.java =================================================================== --- test/com/meterware/httpunit/HttpUnitUtilsTest.java Sat Dec 05 18:48:31 MSK 2009 +++ test/com/meterware/httpunit/HttpUnitUtilsTest.java Sat Dec 05 18:48:31 MSK 2009 @@ -0,0 +1,31 @@ +package com.meterware.httpunit; + +import junit.framework.TestCase; + +/** + * User: SergeMaslyukov + * Date: 05.12.2009 + * Time: 18:29:04 + */ +public class HttpUnitUtilsTest extends TestCase { + + public void testParseContentTypeHeader() throws Exception { + String[] ct; + ct = HttpUnitUtils.parseContentTypeHeader("text/html charset=windows-1251"); + assertEquals(2, ct.length); + assertEquals("text/html", ct[0]); + assertEquals("windows-1251", ct[1]); + ct = HttpUnitUtils.parseContentTypeHeader("text/html; charset=utf-8"); + assertEquals(2, ct.length); + assertEquals("text/html", ct[0]); + assertEquals("utf-8", ct[1]); + ct = HttpUnitUtils.parseContentTypeHeader("text/html; charset = utf-8"); + assertEquals(2, ct.length); + assertEquals("text/html", ct[0]); + assertEquals("utf-8", ct[1]); + ct = HttpUnitUtils.parseContentTypeHeader("text/html; charset=\"iso-8859-8\""); + assertEquals(2, ct.length); + assertEquals("text/html", ct[0]); + assertEquals("iso-8859-8", ct[1]); + } +} With best regards Serge Maslyukov ________________________________ From: Wolfgang Fahl <wf...@bi...> To: Serge Maslyukov <ser...@ya...> Cc: rus...@ht...; Discussion of use and development of HttpUnit <htt...@li...> Sent: Tue, December 22, 2009 6:39:01 PM Subject: Re: HttpUnit Serge, thanx for the patch. 1062 has it: http://httpunit.svn.sourceforge.net/viewvc/httpunit?view=rev&revision=1062 I have added two tests and solved the issue slightly differently by postponing the issue to the parsing phase. Also I have tried to work around the current regression problems i think there is an issue with defineResource if a resource has to be redefined - I assume the cleanup is not properly done and therefore have modified the tests to create resources with unique names instead which should not defeat the test purpose at all. Have a good christmas time and keep up the good work! Wolfgang Am 20.12.09 14:55, schrieb Serge Maslyukov: > >Hello > > >>This is a new path for issue when server return empty content type >value: > >>Index: src/com/meterware/httpunit/WebResponse.java >>=================================================================== >>--- src/com/meterware/httpunit/WebResponse.java (revision 1061) >>+++ src/com/meterware/httpunit/WebResponse.java (working copy) >>@@ -1308,7 +1308,7 @@ >> private void readContentTypeHeader() { >> String contentHeader = (_contentHeader != null) ? >_contentHeader >> : >getHeaderField( "Content-type" ); >>- if (contentHeader == null) { >>+ if (contentHeader == null || contentHeader.trim().length()==0) >{ >> _contentType = HttpUnitOptions.getDefaultContentType(); >> setCharacterSet( HttpUnitOptions.getDefaultCharacterSet() >); >> _contentHeader = _contentType + ";charset=" + >_characterSet; > > >>Sorry, without test case. > > >With best regards >>Serge Maslyukov > > > > > > ________________________________ From: >Serge Maslyukov <ser...@ya...> >To: wf...@bi... >Cc: rus...@ht... >Sent: Sat, December 5, >2009 6:57:25 PM >Subject: Re: HttpUnit > > >Hello > >>There is a patch for an issue with non standard content type declaration >>i.e.: text/html charset=windows-1251 > > >With best regards >>Serge Maslyukov > > > > > > ________________________________ From: >Wolfgang Fahl <wf...@bi...> >To: Serge Maslyukov ><ser...@ya...> >Sent: Fri, March 13, >2009 5:34:50 PM >Subject: Re: HttpUnit > > >Serge, > > >>sorry for the delay in responding. >>Excellent work! >>SVN Version 1020 has your patch included. > > >>I'm looking forward to more of this ... > > >>Wolfgang > > >>> >>> Hello >>> >>> This is patch for solve issue with drupal's cookie >>> >>> With best regards >>> Serge Maslyukov >>> >>> From: Wolfgang Fahl <wf...@bi...> >>> To: Serge Maslyukov <ser...@ya...> >>> Cc: rus...@ht... >>> Sent: Thursday, February 12, 2009 11:28:26 AM >>> Subject: Re: HttpUnit >>> >>> Serge, >>> >>> thanks for the overview. For a start you can send me your results >and >>> I'll commit them after discussing details with you. After a while >of >>> doing so you' should be familiar with the procedures and rules we >are >>> following and I assume Russel will be more likely to give you >direct >>> committer right. >>> >>> I'm looking forward to your contribution >>> >>> Wolfgang >>> > >>> > Hello Wolfgang >>> > >>> > I wrote to Russel, but not receive response from him. Can you >ask him >>> > about me? >>> > >>> > My primary area of elaboration is cookie, script-less >processing and >>> > improve with maven integration. >>> > cookie - I use httpunit to test my drupal site and I have >some problem >>> > with processing of cooke in httpunit. I already fix this >issue and can >>> > post it as patch >>> > >>> > script-less processing - httpunit always upload script files >from >>> site. >>> >HttpUnitOptions.setScriptingEnabled(false) not control of this > >>> behavior. >>> > >>> > maven - build realeses with javadoc and source files. I use >IDEA and >>> > after processing of my pom.xml file, I lost manualy created >refs to >>> src >>> > and javadoc. >>> > >>> > >>> > >>> > >>> > With best regards >>> > Serge Maslyukov >>> > >>> > From: Wolfgang Fahl <wf...@bi...> >>> > To: Serge Maslyukov <ser...@ya...> >>> > Cc: rus...@ht... >>> > Sent: Wednesday, February 11, 2009 4:14:55 PM >>> > Subject: Re: HttpUnit >>> > >>> > Hi Serge, >>> > >>> > thank you for your interest in becoming a httpunit committer. >>> > you wrote: >>> > > Can you add me as commiter to HttpUnit project? >>> > Russell is the project administrator - you'd have to contact >him >>> >directly. >>> > > My personal page at sf.net - >>> https://sourceforge.net/users/serg_main/ >>> > > and main project - https://sourceforge.net/projects/riverock/ >>> > Would you please elaborate a bit on what you intend to do >with >>> httpunit >>> > comitter rights? >>> > >>> >Cheers >>> >Wolfgang >>> > >>> > BITPlan - smart solutions >>> > Pater-Delp-Str. 1, D-47877 Willich Schiefbahn >>> > Tel. +49 2154 811-480, Fax +49 2154 811-481 >>> > Web: http://www.bitplan.de >>> > bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: >10258040548, >>> Geschäftsführer: Wolfgang >>> >Fahl >>> > >>> > >>> > >>> > >>> > >>> > >>> >>> >>> >>> BITPlan - smart solutions >>> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn >>> Tel. +49 2154 811-480, Fax +49 2154 811-481 >>> Web: http://www.bitplan.de >>> bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548, >Geschäftsführer: Wolfgang >>> Fahl >>> >>> >>> >>> >>> >>> > > > > > > >BITPlan - smart solutions >>Pater-Delp-Str. 1, D-47877 Willich Schiefbahn >>Tel. +49 2154 811-480, Fax +49 2154 811-481 >>Web: http://www.bitplan.de >>bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548, >Geschäftsführer: Wolfgang Fahl >> > > -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl |