You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ch...@locus.apache.org on 2000/06/12 22:41:14 UTC
cvs commit: apache-2.0/src/ap ap_cache.c Makefile.in
chuck 00/06/12 13:41:14
Modified: src/ap Makefile.in
Added: src/ap ap_cache.c
Log:
Files for file_cache module for mod_proxy
Submitted by: Sam Magnuson
Reviewed by: Chuck Murcko
Revision Changes Path
1.4 +1 -1 apache-2.0/src/ap/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apache-2.0/src/ap/Makefile.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.in 2000/04/30 00:06:01 1.3
+++ Makefile.in 2000/06/12 20:41:13 1.4
@@ -1,5 +1,5 @@
LTLIBRARY_NAME = libap.la
-LTLIBRARY_SOURCES = ap_base64.c ap_sha1.c ap_buf.c ap_hooks.c
+LTLIBRARY_SOURCES = ap_cache.c ap_base64.c ap_sha1.c ap_buf.c ap_hooks.c
include $(top_srcdir)/build/ltlib.mk
1.1 apache-2.0/src/ap/ap_cache.c
Index: ap_cache.c
===================================================================
#include "ap_cache.h"
#include "httpd.h"
#include "http_log.h"
#include <stdio.h>
/* struct ap_cache_handle_t, some function pointer in the meth */
#define VERIFY_IMPL(x, fun) if(!x || !x->meth.fun) return APR_ENOTIMPL
AP_HOOK_STRUCT(
AP_HOOK_LINK(cache_init)
)
ap_status_t ap_cache_init(ap_cache_handle_t **h, const char *desc, server_rec *server)
{
return ap_run_cache_init(h, desc, server);
}
ap_status_t ap_cache_close(ap_cache_handle_t *h)
{
VERIFY_IMPL(h, cache_close);
return h->meth.cache_close(h);
}
ap_status_t ap_cache_garbage_collect(ap_cache_handle_t *h)
{
VERIFY_IMPL(h, cache_garbage_coll);
return h->meth.cache_garbage_coll(h);
}
ap_status_t ap_cache_seek(ap_cache_handle_t *h, const char *name, ap_cache_el **el)
{
VERIFY_IMPL(h, cache_element);
*el = NULL;
return h->meth.cache_element(h, name, el, AP_CACHE_SEEK);
}
ap_status_t ap_cache_create(ap_cache_handle_t *h, const char *name, ap_cache_el **el)
{
VERIFY_IMPL(h, cache_element);
*el = NULL;
return h->meth.cache_element(h, name, el, AP_CACHE_CREATE);
}
ap_status_t ap_cache_remove(ap_cache_handle_t *h, const char *name)
{
VERIFY_IMPL(h, cache_element);
return h->meth.cache_element(h, name, NULL, AP_CACHE_REMOVE);
}
struct walk_struct { char **place; ap_pool_t *pool; };
static int get_first_val(void *datum, const char *name, const char *val)
{
struct walk_struct *ws = (struct walk_struct *)datum;
*(ws->place) = ap_pstrdup(ws->pool, val);
return 0;
}
ap_status_t ap_cache_el_header(ap_cache_el *el, const char *hdr, char **val)
{
struct walk_struct ws;
if(!val || !el) return APR_BADARG;
*val = NULL;
ws.place = val;
ws.pool = el->cache->pool;
ap_cache_el_header_walk(el, get_first_val, &ws, hdr, NULL);
return *val ? APR_SUCCESS : APR_ENOENT;
}
ap_status_t ap_cache_el_header_walk(ap_cache_el *el,
int (*comp)(void *, const char *, const char *), void *rec, ...)
{
va_list args;
ap_status_t ret;
if(!el) return APR_BADARG;
VERIFY_IMPL(el->cache, cache_el_header_walk);
va_start(args, rec);
ret = el->cache->meth.cache_el_header_walk(el, comp, rec, args);
va_end(args);
return ret;
}
static int merge_tables(void *datum, const char *name, const char *val)
{
ap_cache_el *el = (ap_cache_el *)datum;
ap_cache_el_header_remove(el, name);
ap_cache_el_header_add(el, name, val);
return APR_SUCCESS;
}
ap_status_t ap_cache_el_header_merge(ap_cache_el *el, ap_table_t *tbl)
{
ap_table_entry_t *elts = (ap_table_entry_t *) tbl->a.elts;
int i;
/*
const char *val;
*/
for (i = 0; i < tbl->a.nelts; ++i)
ap_cache_el_header_set(el, elts[i].key, elts[i].val);
return APR_SUCCESS;
}
ap_status_t ap_cache_el_header_set(ap_cache_el *el, const char *hdrname,
const char *hdrval)
{
if(!el) return APR_BADARG;
VERIFY_IMPL(el->cache, cache_el_hdr);
return el->cache->meth.cache_el_hdr(el, hdrname, hdrval, AP_CACHE_CHANGE);
}
ap_status_t ap_cache_el_header_add(ap_cache_el *el, const char *hdrname,
const char *hdrval)
{
if(!el) return APR_BADARG;
VERIFY_IMPL(el->cache, cache_el_hdr);
return el->cache->meth.cache_el_hdr(el, hdrname, hdrval, AP_CACHE_CREATE);
}
ap_status_t ap_cache_el_header_remove(ap_cache_el *el, const char *hdrname)
{
if(!el) return APR_BADARG;
VERIFY_IMPL(el->cache, cache_el_hdr);
return el->cache->meth.cache_el_hdr(el, hdrname, NULL, AP_CACHE_REMOVE);
}
ap_status_t ap_cache_el_header_clear(ap_cache_el *el)
{
if(!el) return APR_BADARG;
VERIFY_IMPL(el->cache, cache_el_reset);
return el->cache->meth.cache_el_reset(el, AP_CACHE_HEADER);
}
ap_status_t ap_cache_el_data(ap_cache_el *el, BUFF **b)
{
if(!b || !el) return APR_BADARG;
*b = NULL;
VERIFY_IMPL(el->cache, cache_el_data);
return el->cache->meth.cache_el_data(el, b);
}
ap_status_t ap_cache_el_data_append(ap_cache_el *el, BUFF *data)
{
BUFF *place;
char buffer[HUGE_STRING_LEN];
ap_status_t ret = APR_SUCCESS;
int nbytes, i;
if((ret = ap_cache_el_data(el, &place)) != APR_SUCCESS) return ret;
while(ap_bread(data, buffer, HUGE_STRING_LEN, &nbytes) == APR_SUCCESS && nbytes) {
int o = 0;
while(nbytes)
{
ap_bwrite(place, buffer + o, nbytes, &i);
o += i;
nbytes -= i;
}
}
return;
}
ap_status_t ap_cache_el_data_clear(ap_cache_el *el)
{
if(!el) return APR_BADARG;
VERIFY_IMPL(el->cache, cache_el_reset);
return el->cache->meth.cache_el_reset(el, AP_CACHE_DATA);
}
ap_status_t ap_cache_el_finalize(ap_cache_el *el)
{
if(!el) return APR_BADARG;
VERIFY_IMPL(el->cache, cache_el_final);
return el->cache->meth.cache_el_final(el);
}
/* hooks */
AP_IMPLEMENT_HOOK_RUN_FIRST(ap_status_t, cache_init, (ap_cache_handle_t **h, const char *desc, server_rec *s),
(h, desc, s), APR_ENOTIMPL);
Re: cvs commit: apache-2.0/src/ap ap_cache.c Makefile.in
Posted by Chuck Murcko <ch...@topsail.org>.
OK. No more files to add.
Greg Stein wrote:
>
> If you've got more files to add, then please put them into src/main/. We're
> trying to get rid of the src/ap/ directory.
>
> At some point, somebody will find and take the time to shift the stuff in
> src/ap/ over. It hasn't happened yet, but "will" before 2.0 final.
>
> Cheers,
> -g
>
> On Mon, Jun 12, 2000 at 08:41:14PM -0000, chuck@locus.apache.org wrote:
> > chuck 00/06/12 13:41:14
> >
> > Modified: src/ap Makefile.in
> > Added: src/ap ap_cache.c
> > Log:
> > Files for file_cache module for mod_proxy
> >
> > Submitted by: Sam Magnuson
> > Reviewed by: Chuck Murcko
>
--
Chuck
Chuck Murcko
Topsail Group
chuck@topsail.org
Re: cvs commit: apache-2.0/src/ap ap_cache.c Makefile.in
Posted by Greg Stein <gs...@lyra.org>.
If you've got more files to add, then please put them into src/main/. We're
trying to get rid of the src/ap/ directory.
At some point, somebody will find and take the time to shift the stuff in
src/ap/ over. It hasn't happened yet, but "will" before 2.0 final.
Cheers,
-g
On Mon, Jun 12, 2000 at 08:41:14PM -0000, chuck@locus.apache.org wrote:
> chuck 00/06/12 13:41:14
>
> Modified: src/ap Makefile.in
> Added: src/ap ap_cache.c
> Log:
> Files for file_cache module for mod_proxy
>
> Submitted by: Sam Magnuson
> Reviewed by: Chuck Murcko
--
Greg Stein, http://www.lyra.org/