Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BFC342009DC for ; Tue, 2 May 2017 15:54:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BE50A160BAC; Tue, 2 May 2017 13:54:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 10949160BA1 for ; Tue, 2 May 2017 15:54:08 +0200 (CEST) Received: (qmail 831 invoked by uid 500); 2 May 2017 13:54: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 820 invoked by uid 99); 2 May 2017 13:54:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2017 13:54:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 90651192B8F for ; Tue, 2 May 2017 13:54:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id K2X1t54oqlxo for ; Tue, 2 May 2017 13:54:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 5CB645FDD3 for ; Tue, 2 May 2017 13:54:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id C410BE0BDD for ; Tue, 2 May 2017 13:54:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2C6E421DE6 for ; Tue, 2 May 2017 13:54:04 +0000 (UTC) Date: Tue, 2 May 2017 13:54:04 +0000 (UTC) From: "Oleg Kalnichevski (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HTTPCLIENT-1099) Overriding Caching Policies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 02 May 2017 13:54:09 -0000 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski updated HTTPCLIENT-1099: ------------------------------------------ Labels: cache policy stuck volunteers-wanted (was: cache policy) Fix Version/s: (was: Future) Stuck > Overriding Caching Policies > --------------------------- > > Key: HTTPCLIENT-1099 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1099 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpCache > Affects Versions: 4.1.1 > Reporter: Bart Robeyns > Assignee: Jon Moore > Priority: Minor > Labels: cache, policy, stuck, volunteers-wanted > Fix For: Stuck > > Attachments: OpenPolicies.patch > > > It is not possible to alter the behaviour of the CachingHttpClient because the policies defining the behaviour are private and tied directly to specific implementations in the CachingHttpClients constructor. Furthermore, these policies are package private, discouraging reuse and/or extensions. > Making this possible is easy enough (provide some policy-setters or -constructor-args in CachingHttpClient and make the policy-classes public); the attached patch allows custom Policies, extending the default ones to be set on the CacheConfig class. > The specific case that led to this question: > A back-end application only sets its Content-Length header for responses below 8K. This response does get stored in the cache, but when retrieving it from the cache, CacheValidityPolicy.contentLengthHeaderMatchesActualLength checks the Content-Length header with the stored size (to verify whether the cached content is complete). This check fails, causing the cache entry to be deemed unusable. If we were able to provide our own subclassed CacheValidityPolicy, it would be easy to skip the check if the header is missing and thus accomodate this specific back-end quirk. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org