costin 01/01/28 11:53:11 Modified: src/share/org/apache/tomcat/util/test DefaultMatcher.java Header.java HttpClient.java Log: Changes in the test driver: - corectly display response headers - fixes to make default port/host/protocol customization work - send "Host" header - this allows "Location" to work corectly ( XXX a mechanism to detect the "default" host name is still needed - like Apache's ServerName, but some of the tests assume the Location header will be identical with the server name they use to connect - that can't work without Host header in most cases ) Revision Changes Path 1.6 +2 -2 jakarta-tomcat/src/share/org/apache/tomcat/util/test/DefaultMatcher.java Index: DefaultMatcher.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/DefaultMatcher.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- DefaultMatcher.java 2001/01/23 05:08:40 1.5 +++ DefaultMatcher.java 2001/01/28 19:53:11 1.6 @@ -281,8 +281,8 @@ String respValue=h.getValue(); if( respValue==null || respValue.indexOf( value ) <0 ) { log("ERROR expecting header " + key + ":" + - value + " GOT: " + respValue+ " HEADERS(" + - headers + ")"); + value + " \nGOT: " + respValue+ " HEADERS(" + + Header.toString(headers) + ")"); return false; } 1.3 +13 -1 jakarta-tomcat/src/share/org/apache/tomcat/util/test/Header.java Index: Header.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/Header.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Header.java 2001/01/21 06:39:22 1.2 +++ Header.java 2001/01/28 19:53:11 1.3 @@ -152,6 +152,18 @@ } } - + public static String toString( Hashtable headers ) { + StringBuffer sb=new StringBuffer(); + sb.append("{"); + Enumeration eH=headers.keys(); + while(eH.hasMoreElements() ) { + String k=(String)eH.nextElement(); + sb.append( k ).append("="); + sb.append( ((Header)headers.get(k)).getValue()); + if( eH.hasMoreElements()) sb.append(","); + } + sb.append("}"); + return sb.toString(); + } } 1.4 +13 -3 jakarta-tomcat/src/share/org/apache/tomcat/util/test/HttpClient.java Index: HttpClient.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/HttpClient.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HttpClient.java 2001/01/21 20:10:39 1.3 +++ HttpClient.java 2001/01/28 19:53:11 1.4 @@ -85,13 +85,13 @@ String id; // Instance variables - String host=defaultHost; - int port=defaultPort; + String host=null; + int port=-1; int debug=defaultDebug; String method="GET"; - String protocol=defaultProtocol; + String protocol=null; String path; String requestLine; @@ -131,12 +131,14 @@ /** The port used to send the request */ public void setPort(String portS) { + System.out.println("HttpClient.setPort " + portS + " " + port); this.port=Integer.valueOf( portS).intValue(); } /** Set the port as int - different name to avoid confusing introspection */ public void setPortInt(int i) { + System.out.println("HttpClient.setPort " + i + " " + port ); this.port=i; } @@ -289,6 +291,9 @@ contentL=h.getValue(); } } + if( requestHeaders.get("Host") == null ) { + sb.append("Host: ").append(host ).append( CRLF ); + } // If we have a body if( body != null) { @@ -318,6 +323,11 @@ throws Exception { // connect + if( host==null ) host=defaultHost; + if( port==-1) port=defaultPort; + + if( protocol==null ) protocol=defaultProtocol; + Socket s = new Socket( host, port); s.setSoLinger( true, 1000); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]