Return-Path: Delivered-To: apmail-jakarta-httpclient-dev-archive@www.apache.org Received: (qmail 27523 invoked from network); 21 Dec 2005 11:23:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Dec 2005 11:23:10 -0000 Received: (qmail 31677 invoked by uid 500); 21 Dec 2005 11:22:59 -0000 Delivered-To: apmail-jakarta-httpclient-dev-archive@jakarta.apache.org Received: (qmail 31653 invoked by uid 500); 21 Dec 2005 11:22:58 -0000 Mailing-List: contact httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "HttpClient Project" Reply-To: "HttpClient Project" Delivered-To: mailing list httpclient-dev@jakarta.apache.org Received: (qmail 31635 invoked by uid 99); 21 Dec 2005 11:22:58 -0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Dec 2005 03:22:57 -0800 Received: by ajax.apache.org (Postfix, from userid 99) id AF2CDCB; Wed, 21 Dec 2005 12:22:36 +0100 (CET) From: bugzilla@apache.org To: httpclient-dev@jakarta.apache.org Subject: DO NOT REPLY [Bug 37988] New: - UserInfo disapears after creating URI Message-ID: X-Bugzilla-Reason: AssignedTo Date: Wed, 21 Dec 2005 12:22:36 +0100 (CET) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=37988 Summary: UserInfo disapears after creating URI Product: HttpClient Version: 3.0 Final Platform: Other OS/Version: Windows 2000 Status: NEW Severity: normal Priority: P2 Component: Commons HttpClient AssignedTo: httpclient-dev@jakarta.apache.org ReportedBy: harmdelaat@gmail.com I tested this using firefox (Where I have configured our proxy server) I run the following URI: ftp://username:password@ftp.mytest.test/testdir/ I use a sniffer to look at the GET commond send to the proxy server. It looks as follows: GET ftp://username:password@ftp.mytest.test/testdir/ HTTP/1.1 Host: ftp.mytest.test User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Proxy-Connection: keep-alive Using this request we get access to the directory and see the contents displayed. However, when I try the same in Java (using HttpClient) I get the following GET request (Java code included below): GET ftp://ftp.mytest.test/testdir/ HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.0-rc3 Host: ftp.mytest.test Proxy-Connection: Keep-Alive Finally I get a ACCESS DENIED error. This seems to be because the GET request does not contain the USER / PASSWORD info in the URL. /// JAVA CODE: package nl.essent.test.ftp.httptest; import java.io.IOException; import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.NTCredentials; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory; import org.apache.commons.httpclient.protocol.Protocol; public class TestClient { public static void main(String[] args) { new TestClient().testFtpViaHttp(); } public void testFtpViaHttp() { HttpClient client = new HttpClient(); HostConfiguration hostConfig = client.getHostConfiguration(); hostConfig.setProxy("proxy", 8080); client.setHostConfiguration(hostConfig); Protocol protol = new Protocol("ftp", new DefaultProtocolSocketFactory(), 21); Protocol.registerProtocol("ftp", protol); Credentials proxyCreds = new NTCredentials("xxxx", "xxxxx","", "xxxx" ); client.getState().setProxyCredentials(AuthScope.ANY, proxyCreds); GetMethod gmethod = new GetMethod("ftp://username:password@ftp.mytest.test/testdir/"); gmethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); try { // Execute the method. int statusCode = client.executeMethod(gmethod); if (statusCode != HttpStatus.SC_OK) { System.err.println("Method failed: " + gmethod.getStatusLine()); } // Read the response body. byte[] responseBody = gmethod.getResponseBody(); // Deal with the response. // Use caution: ensure correct character encoding and is not binary data System.out.println(new String(responseBody)); } catch (HttpException e) { System.err.println("Fatal protocol violation: " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { System.err.println("Fatal transport error: " + e.getMessage()); e.printStackTrace(); } finally { // Release the connection. gmethod.releaseConnection(); } } } //// END JAVA CODE -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org