[jcifs] NTLM/SSL

O'ROURKE, Tom, FM IT tom.orourke at rbos.com
Wed Aug 17 14:05:32 GMT 2005


Hi
 
I have a working HTTP client through our NTLM proxies - this is fine.
However I need to be able to get to an HTTPS site, can I do this ?
 
I am using version JCIFS.1.2.1
 
The error I currently get is :
 
Exception in thread "main" java.io.IOException: Unable to tunnel through
proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Required"
        at
sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.ja
va:934)
        at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA
12275)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java:626)
        at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA12275
)
        at
jcifs.http.NtlmHttpURLConnection.getInputStream(NtlmHttpURLConnection.java:2
42)
        at java.net.URL.openStream(URL.java:913)
        at NtlmHttpClient.main(NtlmHttpClient.java:49)

 
 
Here is the code :
 
import java.io.*;
import java.net.*;
import jcifs.*;
import jcifs.https.Handler;
 
import java.util.*;
 

public class NtlmHttpClient {
 
    public static void main(String[] args) throws Exception {
 
 Config.registerSmbURLHandler();
 
 
 String proxy = "FM-EU-LON-PROXY.fm.rbsgrp.net";
        String port = "8080";
 Properties systemProperties = System.getProperties();
        systemProperties.setProperty("http.proxyHost",proxy);
        systemProperties.setProperty("http.proxyPort",port);
        systemProperties.setProperty("https.proxyHost",proxy);
        systemProperties.setProperty("https.proxyPort",port);
  
  
 
        if (args == null || args.length < 0) {
            System.out.println("NtlmHttpClient <url>");
            System.exit(1);
        }
 
        String location = " <https://www.markit.com/export.jsp>
https://www.markit.com/export.jsp";
        String domain = "domain";
        String user = "user";
        String password = "pass";
 
        Config.setProperty("jcifs.smb.client.domain", domain);
        Config.setProperty("jcifs.smb.client.username", user);
        Config.setProperty("jcifs.smb.client.password", password);
 
  
        try {
            Config.setProperty("jcifs.netbios.hostname",
                    Config.getProperty("jcifs.netbios.hostname",
                            InetAddress.getLocalHost().getHostName()));
        } catch (Exception ex) { }
        URL url = new URL(location);
      
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(url.openStream()));
        String line;
        while ((line = reader.readLine()) != null) {
            System.out.println(line);
        }
    }
 
}

 
It seems I can change the handler - but am not sure how ?
 
 
 
Tom O'Rourke
E-Commerce Infrastructure Team
Royal Bank of Scotland Financial Markets
Desk: +44 (0)20 7085 3821
Mobile: +44 (0)7917 210411
 


***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312.       Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.                                      
Authorised and regulated by the Financial Services Authority     
 
This e-mail message is confidential and for use by the                      
addressee only. If the message is received by anyone other             
than the addressee, please return the message to the sender          
by replying to it and then delete the message from your                    
computer. Internet e-mails are not necessarily secure. The               
Royal Bank of Scotland plc does not accept responsibility for          
changes made to this message after it was sent.                              
                                                                                                        
Whilst all reasonable care has been taken to avoid the                   
transmission of viruses, it is the responsibility of the recipient to        
ensure that the onward transmission, opening or use of this             
message and any attachments will not adversely affect its               
systems or data.  No responsibility is accepted by The Royal           
Bank of Scotland plc in this regard and the recipient should carry   
out such virus and other checks as it considers appropriate.           
                                                                                                               Visit our websites at:                                                                          
http://www.rbs.co.uk/CBFM                                                        
http://www.rbsmarkets.com                                                         
                                                                                                       ********************************************************************************

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list