[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebRequest.java,1.47,1.48 WebRequestSourc
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-09-26 18:22:35
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv29024/src/com/meterware/httpunit
Modified Files:
WebRequest.java WebRequestSource.java
Log Message:
Don't URL-encode javascript URLs
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- WebRequest.java 5 Sep 2002 14:46:55 -0000 1.47
+++ WebRequest.java 26 Sep 2002 18:22:32 -0000 1.48
@@ -311,7 +311,7 @@
protected WebRequest( WebRequestSource requestSource ) {
- this( requestSource.getBaseURL(), requestSource.getRelativeURL(), requestSource.getTarget(), newParameterHolder( requestSource ) );
+ this( requestSource.getBaseURL(), requestSource.getRelativePage(), requestSource.getTarget(), newParameterHolder( requestSource ) );
_webRequestSource = requestSource;
setHeaderField( "Referer", requestSource.getBaseURL().toExternalForm() );
}
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- WebRequestSource.java 23 Aug 2002 19:33:13 -0000 1.13
+++ WebRequestSource.java 26 Sep 2002 18:22:33 -0000 1.14
@@ -101,8 +101,9 @@
/**
* Returns the URL relative to the current page which will handle the request.
*/
- String getRelativeURL() {
- final String url = getDestinationPage();
+ String getRelativePage() {
+ final String url = getRelativeURL();
+ if (url.startsWith( "javascript:" )) return url;
final int questionMarkIndex = url.indexOf("?");
if (questionMarkIndex >= 1 && questionMarkIndex < url.length() - 1) {
return url.substring(0, questionMarkIndex);
@@ -111,7 +112,7 @@
}
- private String getDestinationPage() {
+ private String getRelativeURL() {
String result = trimFragment( getDestination() );
if (result.trim().length() == 0) result = getBaseURL().getFile();
return result;
@@ -245,6 +246,7 @@
**/
private String getParametersString() {
final String url = trimFragment( getDestination() );
+ if (url.startsWith( "javascript:" )) return "";
final int questionMarkIndex = url.indexOf("?");
if (questionMarkIndex >= 1 && questionMarkIndex < url.length() - 1) {
return url.substring( questionMarkIndex + 1 );
|