Andrew,

Thanks for your reply.  I have attached my class, the original XmlRpcClientLite class 
and a file containing the differences from a Unix diff command.  The implementation of 
SSL resumption in JSSE is no more difficult than reusing the same socket factory to 
create all sockets and doing the SSL handshake on only the first socket created.  It 
took me some time to figure this out because JSSE is not well documented.

Also in Windows it seemed that the writing of each HTML header line was causing 
Windows to flush the buffer (maybe because it has a newline at the end).  This 
effected performance so I changed the class to create the whole message in a string 
buffer and send it at once.  I realize there may be a more efficient way to do this.  

Do not hesitate to contact me if you have any questions.  The SSL resumption can be 
tested by setting the system property "java.net.debug=all".  I would appreciate if you 
kept me as up to date with the changes as possible and when you might release them.

Thanks,
Tim

-----Original Message-----
From: Andrew Evers [mailto:aevers@;redwood.nl]
Sent: Tuesday, October 29, 2002 3:20 PM
To: [EMAIL PROTECTED]
Subject: Re: SSL Resumption Support


> Last January I was inquiring if anyone knew how to perform SSL session
> resumption using an XML-RPC client.  I did not receive a solution so I
> finally went back and addressed the issue.  My solution was to copy the
> XmlRpcClientLite class and change the init method to use SSL sockets
> configured for resumption.  Also on Windows we experienced a
> performance issue where the HTML header was being prematurely flushed.
> In my class I write the HTML header and XML content to a single byte
> array and do one write to the socket output stream.  Attached is my
> class.  I would appreciate it greatly if this capability was somehow
> incorporated into the Apache base-line.  Let me know what you think.

I've just had a quick look at your code and I will try to include it
as part of the general overhaul of the XML-RPC to HTTP(S) interface
that Ryan Hoegg and I are working on at the moment. I still need to
see what the differences between your class and the standard secure
client are.

Do you have a version available as a diff against the original
XmlRpcClientLite? I've just diff'ed it against the current version in
CVS and I'm getting a lot of formatting and small naming changes
in my diff. A diff against your original would allow me to ensure that
all your changes get correctly included.

Andrew.


Attachment: SecureXmlRpcClientLite.java
Description: SecureXmlRpcClientLite.java

59d58
< import javax.net.ssl.*;
71c70
< public class SecureXmlRpcClientLite
---
> public class XmlRpcClientLite 
79c78
<     public SecureXmlRpcClientLite (URL url)
---
>     public XmlRpcClientLite (URL url)
87c86
<     public SecureXmlRpcClientLite (String url) throws MalformedURLException
---
>     public XmlRpcClientLite (String url) throws MalformedURLException
95c94
<     public SecureXmlRpcClientLite (String hostname,
---
>     public XmlRpcClientLite (String hostname,
246,247d244
<     static boolean handshake = false;
<     static SSLSocketFactory factory = null;
257c254
<         SSLSocket socket = null;
---
>         Socket socket = null;
278,289c275,277
< 
<           if (!handshake) {
<              factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
<           }
<           socket= (SSLSocket)factory.createSocket(hostname, port);
<           if (!handshake) {
<             socket.startHandshake();
<             handshake = true;
<           }
< 
<           output = new BufferedOutputStream (socket.getOutputStream());
<           input = new BufferedInputStream (socket.getInputStream ());
---
>             socket = new Socket (hostname, port);
>             output = new BufferedOutputStream (socket.getOutputStream());
>             input = new BufferedInputStream (socket.getInputStream ());
304,327c292,305
<             StringBuffer buffer = new StringBuffer(
<                                 "POST "+ uri + " HTTP/1.0\r\n" +
<                                 "User-Agent: " + XmlRpc.version + "\r\n" +
<                                 "Host: " + host + "\r\n");
< 
<             if (XmlRpc.getKeepAlive()) {
<                 buffer.append("Connection: Keep-Alive\r\n");
<             }
< 
<             buffer.append("Content-Type: text/xml\r\n");
< 
<             if (auth != null) {
<                 buffer.append("Authorization: Basic "+ auth +"\r\n");
<             }
< 
<             buffer.append("Content-Length: " + request.length);
<             buffer.append("\r\n\r\n");
< 
<             byte[] message = new byte[buffer.length() + request.length];
< 
<             
System.arraycopy((buffer.toString()).getBytes(),0,message,0,buffer.length());
<             System.arraycopy(request,0,message,buffer.length(),request.length);
< 
<             output.write (message);
---
>             output.write (("POST "+uri + " HTTP/1.0\r\n").getBytes());
>             output.write ( ("User-Agent: "+XmlRpc.version +
>                         "\r\n").getBytes());
>             output.write (("Host: "+host + "\r\n").getBytes());
>             if (XmlRpc.getKeepAlive())
>                 output.write ("Connection: Keep-Alive\r\n".getBytes());
>             output.write ("Content-Type: text/xml\r\n".getBytes());
>             if (auth != null)
>                 output.write ( ("Authorization: Basic "+auth +
>                             "\r\n").getBytes());
>             output.write (
>                         ("Content-Length: "+request.length).getBytes());
>             output.write ("\r\n\r\n".getBytes());
>             output.write (request);
447a426,427
> 
> 

Attachment: XmlRpcClientLite.java
Description: XmlRpcClientLite.java

Reply via email to