Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 66859 invoked from network); 28 Nov 2008 18:43:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Nov 2008 18:43:22 -0000 Received: (qmail 43948 invoked by uid 500); 28 Nov 2008 18:43:32 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 43919 invoked by uid 500); 28 Nov 2008 18:43:32 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 43908 invoked by uid 99); 28 Nov 2008 18:43:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Nov 2008 10:43:32 -0800 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [63.173.254.23] (HELO smtp01.usitc.gov) (63.173.254.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Nov 2008 18:42:05 +0000 Received: from S2K-EXCH01.itcnet.usitc.gov ([172.16.5.5]) by smtp01.usitc.gov with Microsoft SMTPSVC(5.0.2195.6872); Fri, 28 Nov 2008 13:49:16 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6619.12 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: PUT to iis is failing Date: Fri, 28 Nov 2008 13:43:21 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: PUT to iis is failing Thread-Index: AclRiPFJLxRLSbfPSvODANaBhWDl0Q== From: To: X-OriginalArrivalTime: 28 Nov 2008 18:49:16.0531 (UTC) FILETIME=[03A5E430:01C9518A] X-Virus-Checked: Checked by ClamAV on apache.org I need to PUT files onto an IIS v6 server. My attempts to PUT to an IIS fail with a 403 response code. Attempts to PUT the same file to the same IIS URI in cadaver or BitKinex are successful. I am using IIS 6. I assume that webDAV is set up properly because cadaver and BitKinex are successful. I am using HTTP-client v 3.0.1 Java 1.5 on windows XP sp2 This is my HTTP put test. @Override protected void setUp() throws Exception { // TODO Auto-generated method stub super.setUp(); client =3D new HttpClient(); host =3D "192.168.4.14"; uriString =3D MessageFormat.format("http://{0}/upload", host); } public void testHttpClientPut() throws Exception { File pdf =3D new File("C:\\Temp\\edis3-dev\\cd\\attachments\\1f6135e5-5ec3-435e-82d3-5395 7e39fc83\\-95097967_-66622204.pdf"); PutMethod method =3D new PutMethod(uriString); method.setRequestHeader("Host", host); method.setRequestHeader("User-Agent", "EDIS3/3.0.0"); method.setRequestHeader("Accept", "*/*"); method.setRequestHeader("Pragma", "no-cache"); method.setRequestHeader("Cache-Control", "no-cache"); method.setRequestHeader("Content-Length", String.valueOf(pdf.length())); method.setRequestHeader("Content-Type", "application/octet-stream"); method.setRequestHeader("Translate", "f"); InputStreamRequestEntity requestEntity =3D new InputStreamRequestEntity(new FileInputStream(pdf)); method.setRequestEntity(requestEntity); executeMethod(method); } private void executeMethod(HttpMethod method) throws IOException, HttpException { try { Header[] headers =3D method.getRequestHeaders(); =20 outputHeaders(headers, "REQUEST HEADERS"); =20 int result =3D client.executeMethod(method); assertTrue("response was: " + result, 200 <=3D result && result < 300); } finally { method.releaseConnection(); } } Here are the HTTP headers for BitKinex <<< PUT /upload/-95097967_-66622204.pdf HTTP/1.1 <<< Host: 192.168.4.14 <<< User-Agent: BitKinex/3.0.4 <<< Accept: */* <<< Pragma: no-cache <<< Cache-Control: no-cache <<< Cookie: ASPSESSIONIDSATRBDAR=3DGEHBABIDLOEICKBKHHHNPBHA <<< Content-Length: 208 <<< Content-Type: application/octet-stream <<< Translate: f >>> HTTP/1.1 201 Created >>> Date: Fri, 28 Nov 2008 17:30:40 GMT >>> Server: Microsoft-IIS/6.0 >>> Location: http://192.168.4.14/upload/-95097967_-66622204.pdf >>> Content-Length: 0 >>> Allow: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, COPY, MOVE, PROPFIND, PROPPATCH, SEARCH, LOCK, UNLOCK CADAVER SESSION >>>$ cadaver http://192.168.4.14/upload >>>dav:/upload/> PUT another.test.txt >>>Uploading another.test.txt to `/upload/another.test.txt': succeeded. >>>dav:/upload/> I can't tell if this is some IIS oddity. When i request the options from the server PUT is not listed (advertised methods are: [OPTIONS, TRACE, GET, HEAD, DELETE, COPY, MOVE, PROPFIND, PROPPATCH, SEARCH, MKCOL, LOCK, UNLOCK]). However, when BitKinex has its PUT successfully returned the allowed options header does include PUT. Any ideas? Carlos --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org