Return-Path: Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@www.apache.org Received: (qmail 18913 invoked from network); 13 Jul 2004 18:06:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Jul 2004 18:06:20 -0000 Received: (qmail 65987 invoked by uid 500); 13 Jul 2004 18:06:19 -0000 Delivered-To: apmail-jakarta-commons-httpclient-dev-archive@jakarta.apache.org Received: (qmail 65883 invoked by uid 500); 13 Jul 2004 18:06:17 -0000 Mailing-List: contact commons-httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Commons HttpClient Project" Reply-To: "Commons HttpClient Project" Delivered-To: mailing list commons-httpclient-dev@jakarta.apache.org Received: (qmail 65870 invoked by uid 99); 13 Jul 2004 18:06:17 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received: from [17.254.13.23] (HELO mail-out4.apple.com) (17.254.13.23) by apache.org (qpsmtpd/0.27.1) with ESMTP; Tue, 13 Jul 2004 11:06:15 -0700 Received: from mailgate1.apple.com (a17-128-100-225.apple.com [17.128.100.225]) by mail-out4.apple.com (8.12.11/8.12.11) with ESMTP id i6DI6ofP011891 for ; Tue, 13 Jul 2004 11:06:50 -0700 (PDT) Received: from relay3.apple.com (relay3.apple.com) by mailgate1.apple.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Tue, 13 Jul 2004 11:06:08 -0700 Received: from [17.207.15.182] (jward.apple.com [17.207.15.182]) by relay3.apple.com (8.12.11/8.12.11) with ESMTP id i6DI5pe2025525 for ; Tue, 13 Jul 2004 11:05:52 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v618) In-Reply-To: <200407130720.i6D7Kdug014350@vorschatten.fiz-chemie.de> References: <200407130720.i6D7Kdug014350@vorschatten.fiz-chemie.de> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <4816F4EA-D4F7-11D8-B83B-000A95EED958@apple.com> Content-Transfer-Encoding: 7bit From: Jennifer Ward Subject: Re: Getting exception: Unbuffered entity enclosing request can not be repeated Date: Tue, 13 Jul 2004 11:05:53 -0700 To: Commons HttpClient Project X-Mailer: Apple Mail (2.618) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Thanks for the reply. Unfortunately, I tried setting the Content-Length header (no chunked transfer encoding), but that didn't work either. I would appreciate any other suggestions you may have. Sincerely, Jennifer Ward On Jul 13, 2004, at 12:20 AM, Ingo Brunberg wrote: > The problem is that you are using chunked transfer encoding. This > prevents Httpclient to automatically buffer the content in memory and > the InputStream can only be read once. > > The workaround is simply to provide the exact content-length. > > Ingo > >> Hi, >> >> I wonder if anyone could offer a suggestion for getting around an >> exception I'm seeing. >> >> I am writing a load test client that sends requests to a webdav >> server. >> I have a putMethod which does the following: >> >> PutMethod method = new PutMethod(URIUtil.encodePathQuery(path)); >> generateIfHeader(method); >> if (getGetContentType() != null && !getGetContentType().equals("")) >> method.setRequestHeader("Content-Type", getGetContentType()); >> method.setRequestContentLength(PutMethod.CONTENT_LENGTH_CHUNKED); >> method.setRequestBody(bis); >> int statusCode = client.executeMethod(method); >> >> bis is a BufferedInputStream. >> >> This method works fine when sending requests using Basic >> authentication. However, I want to use Digest authentication (I have >> setAuthenticationPreemptive set to false). When sending the request >> using Digest, I get the exception: >> >> org.apache.commons.httpclient.HttpException: Unbuffered entity >> enclosing request can not be repeated. >> >> In looking at the code, it appears that >> EntityEnclosingMethod.writeRequestBody does not cache the request >> body. >> So, when the request is resent (with the digest auth header), the >> contentCache is null, thus the exception. >> >> Does anyone know of a way around this? >> >> Thanks, >> Jennifer > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > commons-httpclient-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: > commons-httpclient-dev-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org