mirror of
https://github.com/apache/httpd.git
synced 2025-07-29 09:01:18 +03:00
Make cache_server_conf, cache_enable and cache_disable private. Remove
public prefixes from ap_cache_accept_headers, ap_cache_try_lock and ap_cache_get_providers. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1000211 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
6
modules/cache/cache_storage.c
vendored
6
modules/cache/cache_storage.c
vendored
@ -114,8 +114,8 @@ static int set_cookie_doo_doo(void *v, const char *key, const char *val)
|
|||||||
* Take headers from the cache, and overlap them over the existing response
|
* Take headers from the cache, and overlap them over the existing response
|
||||||
* headers.
|
* headers.
|
||||||
*/
|
*/
|
||||||
CACHE_DECLARE(void) ap_cache_accept_headers(cache_handle_t *h, request_rec *r,
|
void cache_accept_headers(cache_handle_t *h, request_rec *r,
|
||||||
int preserve_orig)
|
int preserve_orig)
|
||||||
{
|
{
|
||||||
apr_table_t *cookie_table, *hdr_copy;
|
apr_table_t *cookie_table, *hdr_copy;
|
||||||
const char *v;
|
const char *v;
|
||||||
@ -339,7 +339,7 @@ int cache_select(cache_request_rec *cache, request_rec *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Okay, this response looks okay. Merge in our stuff and go. */
|
/* Okay, this response looks okay. Merge in our stuff and go. */
|
||||||
ap_cache_accept_headers(h, r, 0);
|
cache_accept_headers(h, r, 0);
|
||||||
|
|
||||||
cache->handle = h;
|
cache->handle = h;
|
||||||
return OK;
|
return OK;
|
||||||
|
10
modules/cache/cache_storage.h
vendored
10
modules/cache/cache_storage.h
vendored
@ -42,6 +42,16 @@ int cache_select(cache_request_rec *cache, request_rec *r);
|
|||||||
apr_status_t cache_generate_key_default(cache_request_rec *cache, request_rec *r,
|
apr_status_t cache_generate_key_default(cache_request_rec *cache, request_rec *r,
|
||||||
apr_pool_t* p, char **key);
|
apr_pool_t* p, char **key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge in cached headers into the response
|
||||||
|
* @param h cache_handle_t
|
||||||
|
* @param r request_rec
|
||||||
|
* @param preserve_orig If 1, the values in r->headers_out are preserved.
|
||||||
|
* Otherwise, they are overwritten by the cached value.
|
||||||
|
*/
|
||||||
|
void cache_accept_headers(cache_handle_t *h, request_rec *r,
|
||||||
|
int preserve_orig);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
19
modules/cache/cache_util.c
vendored
19
modules/cache/cache_util.c
vendored
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "mod_cache.h"
|
#include "mod_cache.h"
|
||||||
|
|
||||||
|
#include "cache_util.h"
|
||||||
#include <ap_provider.h>
|
#include <ap_provider.h>
|
||||||
|
|
||||||
APLOG_USE_MODULE(cache);
|
APLOG_USE_MODULE(cache);
|
||||||
@ -123,9 +124,9 @@ static int uri_meets_conditions(const apr_uri_t *filter, const int pathlen,
|
|||||||
return !strncmp(filter->path, url->path, pathlen);
|
return !strncmp(filter->path, url->path, pathlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
CACHE_DECLARE(cache_provider_list *)ap_cache_get_providers(request_rec *r,
|
cache_provider_list *cache_get_providers(request_rec *r,
|
||||||
cache_server_conf *conf,
|
cache_server_conf *conf,
|
||||||
apr_uri_t uri)
|
apr_uri_t uri)
|
||||||
{
|
{
|
||||||
cache_provider_list *providers = NULL;
|
cache_provider_list *providers = NULL;
|
||||||
int i;
|
int i;
|
||||||
@ -229,7 +230,7 @@ CACHE_DECLARE(apr_int64_t) ap_cache_current_age(cache_info *info,
|
|||||||
* no point is it possible for this lock to permanently deny access to
|
* no point is it possible for this lock to permanently deny access to
|
||||||
* the backend.
|
* the backend.
|
||||||
*/
|
*/
|
||||||
CACHE_DECLARE(apr_status_t) ap_cache_try_lock(cache_server_conf *conf,
|
apr_status_t cache_try_lock(cache_server_conf *conf,
|
||||||
cache_request_rec *cache, request_rec *r, char *key)
|
cache_request_rec *cache, request_rec *r, char *key)
|
||||||
{
|
{
|
||||||
apr_status_t status;
|
apr_status_t status;
|
||||||
@ -322,7 +323,7 @@ CACHE_DECLARE(apr_status_t) ap_cache_try_lock(cache_server_conf *conf,
|
|||||||
* If an optional bucket brigade is passed, the lock will only be
|
* If an optional bucket brigade is passed, the lock will only be
|
||||||
* removed if the bucket brigade contains an EOS bucket.
|
* removed if the bucket brigade contains an EOS bucket.
|
||||||
*/
|
*/
|
||||||
CACHE_DECLARE(apr_status_t) ap_cache_remove_lock(cache_server_conf *conf,
|
apr_status_t cache_remove_lock(cache_server_conf *conf,
|
||||||
cache_request_rec *cache, request_rec *r, char *key,
|
cache_request_rec *cache, request_rec *r, char *key,
|
||||||
apr_bucket_brigade *bb)
|
apr_bucket_brigade *bb)
|
||||||
{
|
{
|
||||||
@ -441,9 +442,9 @@ CACHE_DECLARE(int) ap_cache_check_allowed(request_rec *r) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h,
|
int cache_check_freshness(cache_handle_t *h,
|
||||||
cache_request_rec *cache,
|
cache_request_rec *cache,
|
||||||
request_rec *r)
|
request_rec *r)
|
||||||
{
|
{
|
||||||
apr_status_t status;
|
apr_status_t status;
|
||||||
apr_int64_t age, maxage_req, maxage_cresp, maxage, smaxage, maxstale;
|
apr_int64_t age, maxage_req, maxage_cresp, maxage, smaxage, maxstale;
|
||||||
@ -691,7 +692,7 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h,
|
|||||||
* A lock that exceeds a maximum age will be deleted, and another
|
* A lock that exceeds a maximum age will be deleted, and another
|
||||||
* request gets to make a new lock and try again.
|
* request gets to make a new lock and try again.
|
||||||
*/
|
*/
|
||||||
status = ap_cache_try_lock(conf, cache, r, (char *)h->cache_obj->key);
|
status = cache_try_lock(conf, cache, r, (char *)h->cache_obj->key);
|
||||||
if (APR_SUCCESS == status) {
|
if (APR_SUCCESS == status) {
|
||||||
/* we obtained a lock, follow the stale path */
|
/* we obtained a lock, follow the stale path */
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
|
79
modules/cache/cache_util.h
vendored
79
modules/cache/cache_util.h
vendored
@ -36,6 +36,75 @@ extern "C" {
|
|||||||
* cache_util.c
|
* cache_util.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct cache_enable {
|
||||||
|
apr_uri_t url;
|
||||||
|
const char *type;
|
||||||
|
apr_size_t pathlen;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cache_disable {
|
||||||
|
apr_uri_t url;
|
||||||
|
apr_size_t pathlen;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* static information about the local cache */
|
||||||
|
typedef struct {
|
||||||
|
apr_array_header_t *cacheenable; /* URLs to cache */
|
||||||
|
apr_array_header_t *cachedisable; /* URLs not to cache */
|
||||||
|
/* Maximum time to keep cached files in msecs */
|
||||||
|
apr_time_t maxex;
|
||||||
|
int maxex_set;
|
||||||
|
/* default time to keep cached file in msecs */
|
||||||
|
int defex_set;
|
||||||
|
apr_time_t defex;
|
||||||
|
/* factor for estimating expires date */
|
||||||
|
double factor;
|
||||||
|
int factor_set;
|
||||||
|
/** ignore the last-modified header when deciding to cache this request */
|
||||||
|
int no_last_mod_ignore_set;
|
||||||
|
int no_last_mod_ignore;
|
||||||
|
/** ignore client's requests for uncached responses */
|
||||||
|
int ignorecachecontrol;
|
||||||
|
int ignorecachecontrol_set;
|
||||||
|
/** ignore expiration date from server */
|
||||||
|
int store_expired;
|
||||||
|
int store_expired_set;
|
||||||
|
/** ignore Cache-Control: private header from server */
|
||||||
|
int store_private;
|
||||||
|
int store_private_set;
|
||||||
|
/** ignore Cache-Control: no-store header from client or server */
|
||||||
|
int store_nostore;
|
||||||
|
int store_nostore_set;
|
||||||
|
/* flag if CacheIgnoreHeader has been set */
|
||||||
|
#define CACHE_IGNORE_HEADERS_SET 1
|
||||||
|
#define CACHE_IGNORE_HEADERS_UNSET 0
|
||||||
|
int ignore_headers_set;
|
||||||
|
/** store the headers that should not be stored in the cache */
|
||||||
|
apr_array_header_t *ignore_headers;
|
||||||
|
/* Minimum time to keep cached files in msecs */
|
||||||
|
apr_time_t minex;
|
||||||
|
int minex_set;
|
||||||
|
/** ignore query-string when caching */
|
||||||
|
int ignorequerystring;
|
||||||
|
int ignorequerystring_set;
|
||||||
|
/* flag if CacheIgnoreURLSessionIdentifiers has been set */
|
||||||
|
#define CACHE_IGNORE_SESSION_ID_SET 1
|
||||||
|
#define CACHE_IGNORE_SESSION_ID_UNSET 0
|
||||||
|
int ignore_session_id_set;
|
||||||
|
/** store the identifiers that should not be used for key calculation */
|
||||||
|
apr_array_header_t *ignore_session_id;
|
||||||
|
/* thundering herd lock */
|
||||||
|
int lock;
|
||||||
|
int lock_set;
|
||||||
|
const char *lockpath;
|
||||||
|
int lockpath_set;
|
||||||
|
int lockmaxage_set;
|
||||||
|
apr_time_t lockmaxage;
|
||||||
|
/** run within the quick handler */
|
||||||
|
int quick;
|
||||||
|
int quick_set;
|
||||||
|
} cache_server_conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the freshness of the cache object per RFC2616 section 13.2 (Expiration Model)
|
* Check the freshness of the cache object per RFC2616 section 13.2 (Expiration Model)
|
||||||
* @param h cache_handle_t
|
* @param h cache_handle_t
|
||||||
@ -85,16 +154,6 @@ apr_status_t cache_remove_lock(cache_server_conf *conf,
|
|||||||
cache_request_rec *cache, request_rec *r, char *key,
|
cache_request_rec *cache, request_rec *r, char *key,
|
||||||
apr_bucket_brigade *bb);
|
apr_bucket_brigade *bb);
|
||||||
|
|
||||||
/**
|
|
||||||
* Merge in cached headers into the response
|
|
||||||
* @param h cache_handle_t
|
|
||||||
* @param r request_rec
|
|
||||||
* @param preserve_orig If 1, the values in r->headers_out are preserved.
|
|
||||||
* Otherwise, they are overwritten by the cached value.
|
|
||||||
*/
|
|
||||||
void cache_accept_headers(cache_handle_t *h, request_rec *r,
|
|
||||||
int preserve_orig);
|
|
||||||
|
|
||||||
cache_provider_list *cache_get_providers(request_rec *r,
|
cache_provider_list *cache_get_providers(request_rec *r,
|
||||||
cache_server_conf *conf, apr_uri_t uri);
|
cache_server_conf *conf, apr_uri_t uri);
|
||||||
|
|
||||||
|
69
modules/cache/mod_cache.h
vendored
69
modules/cache/mod_cache.h
vendored
@ -111,75 +111,6 @@
|
|||||||
#define CACHE_DECLARE_DATA __declspec(dllimport)
|
#define CACHE_DECLARE_DATA __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct cache_enable {
|
|
||||||
apr_uri_t url;
|
|
||||||
const char *type;
|
|
||||||
apr_size_t pathlen;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct cache_disable {
|
|
||||||
apr_uri_t url;
|
|
||||||
apr_size_t pathlen;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* static information about the local cache */
|
|
||||||
typedef struct {
|
|
||||||
apr_array_header_t *cacheenable; /* URLs to cache */
|
|
||||||
apr_array_header_t *cachedisable; /* URLs not to cache */
|
|
||||||
/* Maximum time to keep cached files in msecs */
|
|
||||||
apr_time_t maxex;
|
|
||||||
int maxex_set;
|
|
||||||
/* default time to keep cached file in msecs */
|
|
||||||
int defex_set;
|
|
||||||
apr_time_t defex;
|
|
||||||
/* factor for estimating expires date */
|
|
||||||
double factor;
|
|
||||||
int factor_set;
|
|
||||||
/** ignore the last-modified header when deciding to cache this request */
|
|
||||||
int no_last_mod_ignore_set;
|
|
||||||
int no_last_mod_ignore;
|
|
||||||
/** ignore client's requests for uncached responses */
|
|
||||||
int ignorecachecontrol;
|
|
||||||
int ignorecachecontrol_set;
|
|
||||||
/** ignore expiration date from server */
|
|
||||||
int store_expired;
|
|
||||||
int store_expired_set;
|
|
||||||
/** ignore Cache-Control: private header from server */
|
|
||||||
int store_private;
|
|
||||||
int store_private_set;
|
|
||||||
/** ignore Cache-Control: no-store header from client or server */
|
|
||||||
int store_nostore;
|
|
||||||
int store_nostore_set;
|
|
||||||
/* flag if CacheIgnoreHeader has been set */
|
|
||||||
#define CACHE_IGNORE_HEADERS_SET 1
|
|
||||||
#define CACHE_IGNORE_HEADERS_UNSET 0
|
|
||||||
int ignore_headers_set;
|
|
||||||
/** store the headers that should not be stored in the cache */
|
|
||||||
apr_array_header_t *ignore_headers;
|
|
||||||
/* Minimum time to keep cached files in msecs */
|
|
||||||
apr_time_t minex;
|
|
||||||
int minex_set;
|
|
||||||
/** ignore query-string when caching */
|
|
||||||
int ignorequerystring;
|
|
||||||
int ignorequerystring_set;
|
|
||||||
/* flag if CacheIgnoreURLSessionIdentifiers has been set */
|
|
||||||
#define CACHE_IGNORE_SESSION_ID_SET 1
|
|
||||||
#define CACHE_IGNORE_SESSION_ID_UNSET 0
|
|
||||||
int ignore_session_id_set;
|
|
||||||
/** store the identifiers that should not be used for key calculation */
|
|
||||||
apr_array_header_t *ignore_session_id;
|
|
||||||
/* thundering herd lock */
|
|
||||||
int lock;
|
|
||||||
int lock_set;
|
|
||||||
const char *lockpath;
|
|
||||||
int lockpath_set;
|
|
||||||
int lockmaxage_set;
|
|
||||||
apr_time_t lockmaxage;
|
|
||||||
/** run within the quick handler */
|
|
||||||
int quick;
|
|
||||||
int quick_set;
|
|
||||||
} cache_server_conf;
|
|
||||||
|
|
||||||
/* cache info information */
|
/* cache info information */
|
||||||
typedef struct cache_info cache_info;
|
typedef struct cache_info cache_info;
|
||||||
struct cache_info {
|
struct cache_info {
|
||||||
|
Reference in New Issue
Block a user