httpunit-commit Mailing List for httpunit (Page 29)
Brought to you by:
russgold
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(31) |
Oct
(39) |
Nov
(18) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(8) |
Feb
(5) |
Mar
(8) |
Apr
(25) |
May
(20) |
Jun
(23) |
Jul
(28) |
Aug
(10) |
Sep
(3) |
Oct
(32) |
Nov
(61) |
Dec
(24) |
| 2002 |
Jan
(50) |
Feb
(34) |
Mar
(35) |
Apr
(3) |
May
(25) |
Jun
(25) |
Jul
(30) |
Aug
(146) |
Sep
(49) |
Oct
(156) |
Nov
(121) |
Dec
(54) |
| 2003 |
Jan
(12) |
Feb
(79) |
Mar
(88) |
Apr
(26) |
May
(67) |
Jun
(29) |
Jul
(8) |
Aug
(16) |
Sep
(20) |
Oct
(17) |
Nov
|
Dec
(5) |
| 2004 |
Jan
|
Feb
(40) |
Mar
(30) |
Apr
(5) |
May
|
Jun
(83) |
Jul
(34) |
Aug
(20) |
Sep
(44) |
Oct
(46) |
Nov
|
Dec
(14) |
| 2005 |
Jan
(4) |
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
| 2006 |
Jan
|
Feb
|
Mar
(26) |
Apr
(8) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(36) |
May
(38) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(18) |
Dec
(4) |
| 2009 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(9) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
(18) |
Nov
(1) |
Dec
|
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/website In directory sc8-pr-cvs1:/tmp/cvs-serv25966/site/com/meterware/website Added Files: ExternalPage.java FragmentTemplate.java MenuSpace.java MenuTarget.java PageFragment.java Site.java SiteElement.java SiteTemplate.java WebPage.java Log Message: publish new website design ***** Error reading new file[Errno 2] No such file or directory: 'ExternalPage.java' ***** Error reading new file[Errno 2] No such file or directory: 'FragmentTemplate.java' ***** Error reading new file[Errno 2] No such file or directory: 'MenuSpace.java' ***** Error reading new file[Errno 2] No such file or directory: 'MenuTarget.java' ***** Error reading new file[Errno 2] No such file or directory: 'PageFragment.java' ***** Error reading new file[Errno 2] No such file or directory: 'Site.java' ***** Error reading new file[Errno 2] No such file or directory: 'SiteElement.java' ***** Error reading new file[Errno 2] No such file or directory: 'SiteTemplate.java' ***** Error reading new file[Errno 2] No such file or directory: 'WebPage.java' |
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/httpunit/site In directory sc8-pr-cvs1:/tmp/cvs-serv25966/site/com/meterware/httpunit/site Added Files: Citations.java Developers.java Faq.java News.java WebSite.java Log Message: publish new website design ***** Error reading new file[Errno 2] No such file or directory: 'Citations.java' ***** Error reading new file[Errno 2] No such file or directory: 'Developers.java' ***** Error reading new file[Errno 2] No such file or directory: 'Faq.java' ***** Error reading new file[Errno 2] No such file or directory: 'News.java' ***** Error reading new file[Errno 2] No such file or directory: 'WebSite.java' |
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit/doc/tutorial
In directory sc8-pr-cvs1:/tmp/cvs-serv25966/doc/tutorial
Modified Files:
tutorial.css
Removed Files:
index.html
Log Message:
publish new website design
Index: tutorial.css
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/tutorial/tutorial.css,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tutorial.css 26 Nov 2001 14:19:26 -0000 1.2
+++ tutorial.css 18 May 2003 05:20:47 -0000 1.3
@@ -5,8 +5,6 @@
PRE.test-code { background-color: #cccccc }
PRE.servlet-code { background-color: #cceeee }
OL { margin-top: 0 }
-P.story-name { margin-left: 3em; margin-bottom: 0; font-weight: bold }
-P.story-contents { margin-left: 3em; margin-top: 0 }
P.goals { font-family: helvetica, ariel, sans-serif; font-size: x-small;
background-color: #ffffdd; border-color: black; border-style: solid;
border-top-width: 2px; border-bottom-width: 2px; border-left-width: 0px; border-right-width: 0px }
|
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/xml In directory sc8-pr-cvs1:/tmp/cvs-serv25966/site/com/meterware/xml Added Files: DocumentSemantics.java WriteableRootElement.java WriteableXMLElement.java Log Message: publish new website design ***** Error reading new file[Errno 2] No such file or directory: 'DocumentSemantics.java' ***** Error reading new file[Errno 2] No such file or directory: 'WriteableRootElement.java' ***** Error reading new file[Errno 2] No such file or directory: 'WriteableXMLElement.java' |
|
From: Russell G. <rus...@us...> - 2003-05-18 05:20:51
|
Update of /cvsroot/httpunit/httpunit/site
In directory sc8-pr-cvs1:/tmp/cvs-serv25966/site
Added Files:
index.xml
Log Message:
publish new website design
--- NEW FILE ---
<page>
<section>
<p>The normal way to access web sites is via a browser; however, there are times when it is desirable to
bypass the browser and access a site from a program, including:
<ul><li><ref page="automated-testing">automated web site testing</ref></li>
<li>using a web-site as part of a distributed application</li></ul>
HttpUnit makes this easy. Written in Java,
HttpUnit emulates the relevant portions of browser behavior, including
form submission, <ref page="Javascript-support">JavaScript</ref>,
basic <a href="ftp://ftp.isi.edu/in-notes/rfc2617.txt">http authentication</a>,
cookies and automatic page redirection, and allows
Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links.</p>
<p>
A companion framework, <ref page="servletunit-intro">ServletUnit</ref> is included in the download.
</p>
</section>
<section title="What is it?">
<p><strong>HttpUnit</strong> is a free, <ref page="license">open source</ref> Java API for accessing web sites without a browser,
and is ideally suited for automated unit testing of web sites when combined with a
Java unit test framework such as <a href="http://www.junit.org">JUnit</a>.
It was designed and implemented by <developer>Russell Gold.</developer></p>
</section>
</page>
|
|
From: Russell G. <rus...@us...> - 2003-05-18 03:22:35
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/website In directory sc8-pr-cvs1:/tmp/cvs-serv21512/website Log Message: Directory /cvsroot/httpunit/httpunit/site/com/meterware/website added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:25:24
|
Update of /cvsroot/httpunit/httpunit In directory sc8-pr-cvs1:/tmp/cvs-serv13378 Added Files: favicon.ico Log Message: update icon |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:24:53
|
Update of /cvsroot/httpunit/httpunit In directory sc8-pr-cvs1:/tmp/cvs-serv13205 Removed Files: favicon.ico Log Message: update icon |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:23:00
|
Update of /cvsroot/httpunit/httpunit In directory sc8-pr-cvs1:/tmp/cvs-serv12709 Added Files: favicon.ico Log Message: update icon --- NEW FILE --- |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:19:00
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/httpunit/site In directory sc8-pr-cvs1:/tmp/cvs-serv11436/site/com/meterware/httpunit/site Log Message: Directory /cvsroot/httpunit/httpunit/site/com/meterware/httpunit/site added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:17:45
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/xml In directory sc8-pr-cvs1:/tmp/cvs-serv11163/site/com/meterware/xml Log Message: Directory /cvsroot/httpunit/httpunit/site/com/meterware/xml added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:17:45
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware/httpunit In directory sc8-pr-cvs1:/tmp/cvs-serv11163/site/com/meterware/httpunit Log Message: Directory /cvsroot/httpunit/httpunit/site/com/meterware/httpunit added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:16:58
|
Update of /cvsroot/httpunit/httpunit/site/com/meterware In directory sc8-pr-cvs1:/tmp/cvs-serv10963/site/com/meterware Log Message: Directory /cvsroot/httpunit/httpunit/site/com/meterware added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:16:57
|
Update of /cvsroot/httpunit/httpunit/sitedocs/doc In directory sc8-pr-cvs1:/tmp/cvs-serv10796/sitedocs/doc Log Message: Directory /cvsroot/httpunit/httpunit/sitedocs/doc added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:16:57
|
Update of /cvsroot/httpunit/httpunit/site/com In directory sc8-pr-cvs1:/tmp/cvs-serv10796/site/com Log Message: Directory /cvsroot/httpunit/httpunit/site/com added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:15:18
|
Update of /cvsroot/httpunit/httpunit/site In directory sc8-pr-cvs1:/tmp/cvs-serv10346/site Log Message: Directory /cvsroot/httpunit/httpunit/site added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-16 23:15:18
|
Update of /cvsroot/httpunit/httpunit/sitedocs In directory sc8-pr-cvs1:/tmp/cvs-serv10346/sitedocs Log Message: Directory /cvsroot/httpunit/httpunit/sitedocs added to the repository |
|
From: Russell G. <rus...@us...> - 2003-05-06 13:31:39
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv1408/doc
Modified Files:
release_notes.txt
Log Message:
Select first valid value for Selection control
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.296
retrieving revision 1.297
diff -u -r1.296 -r1.297
--- release_notes.txt 4 May 2003 15:38:02 -0000 1.296
+++ release_notes.txt 6 May 2003 13:31:04 -0000 1.297
@@ -23,6 +23,8 @@
Problems fixed:
1. bug #717280: URLs with "../" in them were not resolved properly
2. bug #717640: <base> element was not being handled in the case when no host was specified.
+ 3. When setting a selection control, HttpUnit would always select a value matching its first option if possible,
+ rather than taking the first valid value.
4-Apr-2003
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2003-05-06 13:31:10
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv1408/test/com/meterware/httpunit
Modified Files:
WebFormTest.java
Log Message:
Select first valid value for Selection control
Index: WebFormTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebFormTest.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- WebFormTest.java 26 Dec 2002 04:59:35 -0000 1.29
+++ WebFormTest.java 6 May 2003 13:31:04 -0000 1.30
@@ -311,6 +311,24 @@
}
+ public void testSingleSelectParameterOrdering() throws Exception {
+ StringBuffer sb = new StringBuffer( "<form action='sendIt' id='theform'>" );
+ for (int i= 0; i < 4; i++) {
+ sb.append( "<select name='enabled'><option value='true'>Enabled<option value='false' selected>Disabled</select>" );
+ }
+ sb.append( "</form>" );
+
+ defineWebPage( "OnCommand", sb.toString() );
+
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ WebForm form = response.getFormWithID( "theform" );
+ form.setParameter( "enabled", new String[] { "true", "false", "false", "true" } );
+ WebRequest request = form.getRequest();
+ assertEquals( "request", getHostPath() + "/sendIt?enabled=true&enabled=false&enabled=false&enabled=true", request.getURL().toExternalForm() );
+ }
+
+
public void testMultiSelect() throws Exception {
defineWebPage( "Default", "<form method=GET action = \"/ask\">" +
"<Select multiple size=4 name=colors>" +
|
|
From: Russell G. <rus...@us...> - 2003-05-06 13:31:09
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv1408/src/com/meterware/httpunit
Modified Files:
FormControl.java
Log Message:
Select first valid value for Selection control
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- FormControl.java 4 May 2003 12:45:10 -0000 1.39
+++ FormControl.java 6 May 2003 13:31:04 -0000 1.40
@@ -850,7 +850,7 @@
_multiSelect = NodeUtils.isNodeAttributePresent( node, "multiple" );
_listBox = _multiSelect || NodeUtils.isNodeAttributePresent( node, "size" );
- _selectionOptions = new Options( node );
+ _selectionOptions = _multiSelect ? (Options) new MultiSelectOptions( node ) : (Options) new SingleSelectOptions( node );
}
@@ -1034,11 +1034,10 @@
}
- class Options extends ScriptableDelegate implements SelectionOptions {
+ abstract class Options extends ScriptableDelegate implements SelectionOptions {
private Option[] _options;
-
Options( Node selectionNode ) {
NodeList nl = ((Element) selectionNode).getElementsByTagName( "option" );
@@ -1054,22 +1053,15 @@
boolean claimUniqueValues( List values ) {
- boolean changed = false;
- int numMatches = 0;
- for (int i = 0; i < _options.length; i++) {
- final boolean newValue = values.contains( _options[i].getValue() );
- if (newValue != _options[i].isSelected()) changed = true;
- _options[i].setSelected( newValue );
- if (newValue) {
- values.remove( _options[i].getValue() );
- numMatches++;
- if (!_multiSelect) for (++i; i < _options.length; i++) _options[i].setSelected( false );
- }
- }
- if (!_listBox && numMatches == 0) {
- throw new IllegalParameterValueException( getName(), (String) values.get(0), getOptionValues() );
- }
- return changed;
+ return claimUniqueValues( values, _options );
+ }
+
+
+ protected abstract boolean claimUniqueValues( List values, Option[] options );
+
+
+ final protected void reportNoMatches( List values ) {
+ if (!_listBox) throw new IllegalParameterValueException( getName(), (String) values.get(0), getOptionValues() );
}
@@ -1121,10 +1113,13 @@
for (int i = 0; i < _options.length; i++) {
if (_options[i].isSelected()) return i;
}
- return _multiSelect ? -1 : 0;
+ return noOptionSelectedIndex();
}
+ protected abstract int noOptionSelectedIndex();
+
+
public int getLength() {
return _options.length;
}
@@ -1151,17 +1146,12 @@
}
_options[i] = (Option) option;
_options[i].setIndex( this, i );
- if (option.isSelected()) ensureUniqueOption(i);
+ if (option.isSelected()) ensureUniqueOption( _options, i);
}
}
- private void ensureUniqueOption( int i ) {
- if (_multiSelect) return;
- for (int j = 0; j < _options.length; j++) {
- _options[j]._selected = (i == j);
- }
- }
+ protected abstract void ensureUniqueOption( Option[] options, int i );
private void deleteOptionsEntry( int i ) {
@@ -1186,7 +1176,7 @@
/** Invoked when an option is set true. **/
void optionSet( int i ) {
- ensureUniqueOption(i);
+ ensureUniqueOption( _options, i);
}
@@ -1208,6 +1198,74 @@
return (value == null) ? "" : value;
}
+ }
+
+
+ class SingleSelectOptions extends Options {
+
+ public SingleSelectOptions( Node selectionNode ) {
+ super( selectionNode );
+ }
+
+
+ protected void ensureUniqueOption( Option[] options, int i ) {
+ for (int j = 0; j < options.length; j++) {
+ options[j]._selected = (i == j);
+ }
+ }
+
+
+ protected int noOptionSelectedIndex() {
+ return 0;
+ }
+
+
+ protected boolean claimUniqueValues( List values, Option[] options ) {
+ boolean changed = false;
+ for (int i = 0; i < values.size(); i++) {
+ String value = (String) values.get( i );
+ for (int j = 0; j < options.length; j++) {
+ boolean selected = value.equals( options[j].getValue() );
+ if (selected != options[j].isSelected()) changed = true;
+ options[j].setSelected( selected );
+ if (selected) {
+ values.remove( value );
+ for (++j; j < options.length; j++) options[j].setSelected( false );
+ return changed;
+ }
+ }
+ }
+ reportNoMatches( values );
+ return changed;
+ }
+ }
+
+
+ class MultiSelectOptions extends Options {
+
+ public MultiSelectOptions( Node selectionNode ) {
+ super( selectionNode );
+ }
+
+
+ protected void ensureUniqueOption( Option[] options, int i ) {}
+
+
+ protected int noOptionSelectedIndex() {
+ return -1;
+ }
+
+
+ protected boolean claimUniqueValues( List values, Option[] options ) {
+ boolean changed = false;
+ for (int i = 0; i < options.length; i++) {
+ final boolean newValue = values.contains( options[i].getValue() );
+ if (newValue != options[i].isSelected()) changed = true;
+ options[i].setSelected( newValue );
+ if (newValue) values.remove( options[i].getValue() );
+ }
+ return changed;
+ }
}
|
|
From: Russell G. <rus...@us...> - 2003-05-04 15:42:23
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv5892/doc
Modified Files:
release_notes.txt
Log Message:
bug #717640: <base> element was not being handled in the case when no host was specified.
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.295
retrieving revision 1.296
diff -u -r1.295 -r1.296
--- release_notes.txt 4 May 2003 15:09:04 -0000 1.295
+++ release_notes.txt 4 May 2003 15:38:02 -0000 1.296
@@ -21,7 +21,8 @@
ant's XMLResultFormatter
2. Form.getOptions() now works for radio buttons and checkboxes - as long as the desired name is located after the control.
Problems fixed:
- 1. bug #717280: Requests with "../" in them are not resolved properly
+ 1. bug #717280: URLs with "../" in them were not resolved properly
+ 2. bug #717640: <base> element was not being handled in the case when no host was specified.
4-Apr-2003
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2003-05-04 15:42:12
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv5892/test/com/meterware/httpunit
Modified Files:
WebLinkTest.java
Log Message:
bug #717640: <base> element was not being handled in the case when no host was specified.
Index: WebLinkTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebLinkTest.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- WebLinkTest.java 27 Feb 2003 23:36:06 -0000 1.27
+++ WebLinkTest.java 4 May 2003 15:38:03 -0000 1.28
@@ -233,7 +233,7 @@
WebConversation wc = new WebConversation();
defineWebPage( "alternate/Target", "Found me!" );
defineResource( "Initial.html", "<html><head><title>Test for Base</title>" +
- " <base href=\"" + getHostPath() + "/alternate/\"></head>" +
+ " <base href='/alternate/'></head>" +
" <body><a href=\"Target.html\">Go</a></body></html>" );
WebResponse initialPage = wc.getResponse( getHostPath() + "/Initial.html" );
|
|
From: Russell G. <rus...@us...> - 2003-05-04 15:42:11
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv5892/src/com/meterware/httpunit
Modified Files:
WebResponse.java
Log Message:
bug #717640: <base> element was not being handled in the case when no host was specified.
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- WebResponse.java 4 Apr 2003 14:51:28 -0000 1.118
+++ WebResponse.java 4 May 2003 15:38:03 -0000 1.119
@@ -805,15 +805,11 @@
private InputStream _inputStream;
+ private final URL _pageURL;
- // the following variables are essentially final; however, the JDK 1.1 compiler does not handle blank final variables properly with
- // multiple constructors that call each other, so the final qualifiers have been removed.
+ private final String _frameName;
- private URL _pageURL;
-
- private String _frameName;
-
- private WebClient _client;
+ private final WebClient _client;
private Scriptable _scriptable;
@@ -864,7 +860,7 @@
private void processBaseTag( ByteTag tag ) throws MalformedURLException {
- if (tag.getAttribute( "href" ) != null) _baseURL = new URL( tag.getAttribute( "href" ) );
+ if (tag.getAttribute( "href" ) != null) _baseURL = new URL( getURL(), tag.getAttribute( "href" ) );
if (tag.getAttribute( "target" ) != null) _baseTarget = tag.getAttribute( "target" );
}
|
|
From: Russell G. <rus...@us...> - 2003-05-04 15:09:08
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv23268/src/com/meterware/httpunit
Modified Files:
WebRequest.java
Log Message:
fixed bug #717280: Requests with '../' in them are not resolved properly
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- WebRequest.java 27 Feb 2003 23:36:01 -0000 1.55
+++ WebRequest.java 4 May 2003 15:09:05 -0000 1.56
@@ -87,8 +87,49 @@
}
HttpsProtocolSupport.verifyProtocolSupport( getURLString().substring( 0, getURLString().indexOf( ':' ) ) );
}
- return spec.startsWith( "?" ) ? new URL( base + spec ) : new URL( base, spec );
+ return spec.startsWith( "?" ) ? new URL( base + spec ) : newCombinedURL( base, spec );
}
+ }
+
+
+ private URL newCombinedURL( final URL base, final String spec ) throws MalformedURLException {
+ if (base == null) return new URL( getNormalizedURL( spec ) );
+ else if (spec.startsWith( ".." )) return new URL( getNormalizedURL( getURLDirectory( base ) + spec ) );
+ else return new URL( base, getNormalizedURL( spec ) );
+ }
+
+
+ private String getURLDirectory( final URL base ) {
+ String url = base.toExternalForm();
+ int i = url.lastIndexOf( '/' );
+ return url.substring( 0, i+1 );
+ }
+
+
+ private String getNormalizedURL( String url ) {
+ if (url.lastIndexOf( "//" ) > url.indexOf( "://" ) + 1) return getNormalizedURL( stripDoubleSlashes( url ) );
+ if (url.indexOf( "/.." ) > 0) return getNormalizedURL( stripUpNavigation( url ) );
+ if (url.indexOf( "/." ) > 0) return getNormalizedURL( stripInPlaceNavigation( url ) );
+ return url;
+ }
+
+
+ private String stripInPlaceNavigation( String url ) {
+ int i = url.lastIndexOf( "/." );
+ return url.substring( 0, i+1 ) + url.substring( i+2 );
+ }
+
+
+ private String stripUpNavigation( String url ) {
+ int i = url.indexOf( "/.." );
+ int j = url.lastIndexOf( "/", i-1 );
+ return url.substring( 0, j+1 ) + url.substring( i+ 3 );
+ }
+
+
+ private String stripDoubleSlashes( String url ) {
+ int i = url.lastIndexOf( "//" );
+ return url.substring( 0, i ) + url.substring( i+1 );
}
|
|
From: Russell G. <rus...@us...> - 2003-05-04 15:09:08
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv23268/doc
Modified Files:
release_notes.txt
Log Message:
fixed bug #717280: Requests with '../' in them are not resolved properly
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -r1.294 -r1.295
--- release_notes.txt 4 May 2003 12:45:10 -0000 1.294
+++ release_notes.txt 4 May 2003 15:09:04 -0000 1.295
@@ -14,10 +14,14 @@
Revision History:
2-May-2003
+Acknowledgements:
+ Thanks to David D. Kilzer for creating thorough tests for URLs containing navigation and showing a way to handle them.
Additions:
1. JUnitServlet now supports a value of 'xml' for the format parameter, generating a format compatible with
ant's XMLResultFormatter
2. Form.getOptions() now works for radio buttons and checkboxes - as long as the desired name is located after the control.
+Problems fixed:
+ 1. bug #717280: Requests with "../" in them are not resolved properly
4-Apr-2003
Acknowledgements:
|