Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 59306 invoked from network); 1 May 2003 18:12:57 -0000 Received: from main.gmane.org (80.91.224.249) by daedalus.apache.org with SMTP; 1 May 2003 18:12:57 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19BIVu-0007rH-00 for ; Thu, 01 May 2003 20:10:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: commons-user@jakarta.apache.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19Acy7-0004UW-00 for ; Tue, 29 Apr 2003 23:48:55 +0200 From: Oliver Geisser Subject: Re: HTTPClient Date: Tue, 29 Apr 2003 23:49:59 +0200 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@main.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: de-de, en-us, en In-Reply-To: Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, theis.meggerle@se.abb.com wrote: > Hi everybody! > > I'm both new to http communication, http client and I'm trying to send > files with > authentication. However, when sending the request, the request header does > not contain > any authorization header. Shouldn't it? How does it work? [...] Have a look at the authentication guide: The short answer is to use: setSystemProperty(Authenticator.PREEMPTIVE_PROPERTY, "true"); If you want to understand why/how this works you must know that "usually" authentication is done on the "second try". The first request is sent without authentication headers and gets a "406 Unauthorized" response which includes a "authentication" header. Then with the second request the first request is repeated but with additional authentication information. For more details read the "HTTP 1.1 Authentication Specification" RFC. Setting the above property will force HTTPClient to send username/password with every request. Ciao, Olli --og