Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 96787 invoked from network); 7 Jan 2011 17:14:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jan 2011 17:14:11 -0000 Received: (qmail 54081 invoked by uid 500); 7 Jan 2011 17:14:11 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 53419 invoked by uid 500); 7 Jan 2011 17:14:08 -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 53389 invoked by uid 99); 7 Jan 2011 17:14:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jan 2011 17:14:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jan 2011 17:14:07 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p07HDkP0017294 for ; Fri, 7 Jan 2011 17:13:46 GMT Message-ID: <5915659.215371294420426785.JavaMail.jira@thor> Date: Fri, 7 Jan 2011 12:13:46 -0500 (EST) From: "Thorsten Scherler (JIRA)" To: dev@hc.apache.org Subject: [jira] Commented: (HTTPCLIENT-1042) CachingHttpClient should use conditionalRequest instead of the request in the suitabilityChecker calls In-Reply-To: <28101675.212681294412265269.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12978866#action_12978866 ] Thorsten Scherler commented on HTTPCLIENT-1042: ----------------------------------------------- Thank you very much Jon and sorry for the noise. I did an unconditional request and expected an incorrect behavior from the CachingHttpClient. Having now something like: {{{ HttpGet httpget = new HttpGet(Environment.LIVE.getBaseUri(PUB_ID)+url); if(lastModified!=null){ httpget.setHeader("If-Modified-Since", lastModified); } HttpResponse response = cachingClient.execute(httpget, localContext); Header[] lmHeader = response.getHeaders(HeaderConstants.LAST_MODIFIED); if (lmHeader.length>0) { this.lastModified = lmHeader[0].getValue(); } }}} is working as expected. Thanks again. > CachingHttpClient should use conditionalRequest instead of the request in the suitabilityChecker calls > ------------------------------------------------------------------------------------------------------ > > Key: HTTPCLIENT-1042 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1042 > Project: HttpComponents HttpClient > Issue Type: Bug > Affects Versions: 4.1 Beta1 > Reporter: Thorsten Scherler > Assignee: Jon Moore > Attachments: 1042.patch, thorsten-test-cases.patch > > > I am using the CachingHttpClient to test whether our site returns the > correct status for the following test. > 1) request page -> returns 200 > 2) do it again -> returns 304 > 3) run a change on the source so last modified changes > 4) request page -> returns 200 > 5) do it again -> returns 304 > I encounter following problems in the revalidateCacheEntry method. > I) in the above step 2 the cachingClient is not returning a 304 because > the suitabilityChecker.isConditional(conditionalRequest) is against the > request and not the conditionalRequest > - if (suitabilityChecker.isConditional(request) > - && suitabilityChecker.allConditionalsMatch(request, > updatedEntry, new Date())) { > + if (suitabilityChecker.isConditional(conditionalRequest) > + && > suitabilityChecker.allConditionalsMatch(conditionalRequest, > updatedEntry, new Date())) { > return > responseGenerator.generateNotModifiedResponse(updatedEntry); > } > return responseGenerator.generateResponse(updatedEntry); > Since conditionalRequest > [Via: 1.1 localhost (Apache-HttpClient/4.1-beta1 (cache)), > If-Modified-Since: Fri, 07 Jan 2011 12:27:25 GMT] > and the backendResponse > HTTP/1.1 304 Not Modified [Date: Fri, 07 Jan 2011 12:42:08 GMT, Server: > Jetty/5.1.4 (Linux/2.6.32-27-generic i386 java/1.6.0_20, > X-Cocoon-Version: 2.1.12-dev, Expires: Fri, 7 Jan 2011 13:42:08 +0100, > Last-Modified: Fri, 07 Jan 2011 12:27:25 GMT, Content-Type: text/html; > charset=utf-8, Via: 1.1 localhost (Apache-HttpClient/4.1-beta1 (cache))] > So Last-Modified: is the same as If-Modified-Since:. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org