Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 87BB910811 for ; Fri, 4 Oct 2013 17:29:54 +0000 (UTC) Received: (qmail 20415 invoked by uid 500); 4 Oct 2013 17:29:54 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 19587 invoked by uid 500); 4 Oct 2013 17:29:47 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 18550 invoked by uid 99); 4 Oct 2013 17:29:43 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Oct 2013 17:29:43 +0000 Date: Fri, 4 Oct 2013 17:29:43 +0000 (UTC) From: "Mike Youngstrom (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HTTPCLIENT-1412) SystemDefaultCredentialsProvider doesn't specify RequestorType.PROXY for proxy authentication requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Mike Youngstrom created HTTPCLIENT-1412: ------------------------------------------- Summary: SystemDefaultCredentialsProvider doesn't specify RequestorType.PROXY for proxy authentication requests Key: HTTPCLIENT-1412 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1412 Project: HttpComponents HttpClient Issue Type: Bug Components: HttpClient Affects Versions: 4.3 Final Reporter: Mike Youngstrom Priority: Minor I have a custom java.net.Authenticator that uses system properties to provide authentication for proxy requests. When using SystemDefaultCredentialsProvider with useSystemProperties() my custom authenticator doesn't work because the getRequestorType() is set to SERVER and not PROXY as it should be for a proxy auth request. Below is a simple test case that illustrates the problem if you have a proxy that requires basic auth that you can connect to. {code} public static void main(String[] args) throws Exception { System.setProperty("http.proxyHost", "some.basic.auth.proxy"); System.setProperty("http.proxyPort", "1080"); System.setProperty("http.proxyUser", "someUser"); System.setProperty("http.proxyPassword", "somePassword"); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { //getRequestorType() == SERVER not PROXY if (getRequestorType() == RequestorType.PROXY) { String prot = getRequestingProtocol().toLowerCase(); String host = System.getProperty(prot + ".proxyHost", ""); String port = System.getProperty(prot + ".proxyPort", ""); String user = System.getProperty(prot + ".proxyUser", ""); String password = System.getProperty(prot + ".proxyPassword", ""); if (getRequestingHost().equalsIgnoreCase(host)) { if (Integer.parseInt(port) == getRequestingPort()) { // We're connecting to the proxy. Go ahead and send credentials. return new PasswordAuthentication(user, password.toCharArray()); } } } return null; } }); HttpClient client = HttpClients.custom().useSystemProperties().build(); client.execute(new HttpHost("www.google.com"), new HttpGet("/")).getEntity().writeTo(System.out); } {code} I am then attempting to use the -- This message was sent by Atlassian JIRA (v6.1#6144) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org