Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 66012 invoked by uid 500); 12 Dec 2001 00:34:48 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 66002 invoked by uid 500); 12 Dec 2001 00:34:48 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 12 Dec 2001 00:34:47 -0000 Message-ID: <20011212003447.40105.qmail@icarus.apache.org> From: rubys@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/src/org/apache/axis/transport/http HTTPConstants.java HTTPSender.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N rubys 01/12/11 16:34:47 Modified: java/src/org/apache/axis/transport/http Tag: alpha-3 HTTPConstants.java HTTPSender.java Log: Added User-Agent to avoid "javax.net.ssl.SSLException: SSL V2.0 servers are not supported." Fixes for HTTP via proxy: - Use the userid and password from http.proxyUser and http.proxyHost Fixes for HTTPS via proxy: - Pick up http.* properties *ONLY* if https.* equivalents are not set. - Proxy userid and password are not used. Removed them for now. Submitted by: dims Revision Changes Path No revision No revision 1.12.2.2 +1 -0 xml-axis/java/src/org/apache/axis/transport/http/HTTPConstants.java Index: HTTPConstants.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/HTTPConstants.java,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -u -r1.12.2.1 -r1.12.2.2 --- HTTPConstants.java 2001/12/07 18:17:23 1.12.2.1 +++ HTTPConstants.java 2001/12/12 00:34:47 1.12.2.2 @@ -77,6 +77,7 @@ public static final String HEADER_CONTENT_ID = "Content-ID"; public static final String HEADER_SOAP_ACTION = "SOAPAction"; public static final String HEADER_AUTHORIZATION = "Authorization"; + public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization"; /** * Cookie headers 1.38.2.4 +23 -10 xml-axis/java/src/org/apache/axis/transport/http/HTTPSender.java Index: HTTPSender.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/HTTPSender.java,v retrieving revision 1.38.2.3 retrieving revision 1.38.2.4 diff -u -r1.38.2.3 -r1.38.2.4 --- HTTPSender.java 2001/12/12 00:17:24 1.38.2.3 +++ HTTPSender.java 2001/12/12 00:34:47 1.38.2.4 @@ -124,20 +124,17 @@ if ( (port = tmpURL.getPort()) == -1 ) port = 80; Socket sock = null ; + StringBuffer otherHeaders = new StringBuffer(); if (tmpURL.getProtocol().equalsIgnoreCase("https")) { if ( (port = tmpURL.getPort()) == -1 ) port = 443; // Use http.proxyXXX settings if https.proxyXXX is not set - String tunnelHost = System.getProperty("http.proxyHost"); - String tunnelPortStr = System.getProperty("http.proxyPort"); - String tunnelUsername = System.getProperty("http.proxyUsername"); - String tunnelPassword = System.getProperty("http.proxyPassword"); + String tunnelHost = System.getProperty("https.proxyHost"); + String tunnelPortStr = System.getProperty("https.proxyPort"); - if (tunnelHost==null) tunnelHost = System.getProperty("https.proxyHost"); - if (tunnelPortStr==null) tunnelPortStr = System.getProperty("https.proxyPort"); - if (tunnelUsername==null) tunnelUsername = System.getProperty("https.proxyUsername"); - if (tunnelPassword==null) tunnelPassword = System.getProperty("https.proxyPassword"); + if (tunnelHost==null) tunnelHost = System.getProperty("http.proxyHost"); + if (tunnelPortStr==null) tunnelPortStr = System.getProperty("http.proxyPort"); try { Class SSLSocketFactoryClass = @@ -170,9 +167,13 @@ // The tunnel handshake method (condensed and made reflexive) OutputStream tunnelOutputStream = (OutputStream)SSLSocketClass.getMethod("getOutputStream", new Class[] {}).invoke(tunnel, new Object[] {}); + PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(tunnelOutputStream))); - out.print("CONNECT " + host + ":" + port + " HTTP/1.0\n\r\n\r"); + out.print("CONNECT " + host + ":" + port + " HTTP/1.0\n" + + "User-Agent: AxisClient" + + "\r\n\r\n"); out.flush(); + InputStream tunnelInputStream = (InputStream)SSLSocketClass.getMethod("getInputStream", new Class[] {}).invoke(tunnel, new Object[] {}); if (category.isDebugEnabled()) { category.debug(JavaUtils.getMessage("isNull00", @@ -242,7 +243,20 @@ String proxyPort = System.getProperty("http.proxyPort"); String nonProxyHosts = System.getProperty("http.nonProxyHosts"); boolean hostInNonProxyList = isHostInNonProxyList(host, nonProxyHosts); + String proxyUsername = System.getProperty("http.proxyUser"); + String proxyPassword = System.getProperty("http.proxyPassword"); + if ( proxyUsername != null ) { + StringBuffer tmpBuf = new StringBuffer(); + tmpBuf.append( proxyUsername ) + .append( ":" ) + .append( (proxyPassword == null) ? "" : proxyPassword) ; + otherHeaders.append( HTTPConstants.HEADER_PROXY_AUTHORIZATION ) + .append( ": Basic " ) + .append( Base64.encode( tmpBuf.toString().getBytes() ) ) + .append("\n" ); + } + if ((port = tmpURL.getPort()) == -1 ) port = 80; if (proxyHost == null || proxyHost.equals("") @@ -272,7 +286,6 @@ OutputStream out = new BufferedOutputStream(sock.getOutputStream(), 8*1024); - StringBuffer otherHeaders = new StringBuffer(); String userID = null ; String passwd = null ;