Re: [PATCH] util_ldap_cache shm broken in apache 2.x
Hi joe, First, thanks for the answer. I based my code on two examples: First the broken util_ldap_cache_mgr.c and i just changed util_ldap_rmm by st-util_ldap_rmm. Then on ssl_scache_shmht.c uring rmm to see if i have to check what return apr_rmm_malloc and calloc. (it's not done) After this, i decided to not check it directly in my util_ald_alloc because of the example. Matthieu Joe Orton wrote: On Tue, Jul 01, 2003 at 03:01:43PM +0200, Estrade Matthieu wrote: ... #if APR_HAS_SHARED_MEMORY -if (util_ldap_shm) { -return (void *)apr_rmm_addr_get(util_ldap_rmm, apr_rmm_calloc(util_ldap_rmm, size)); +if (st-util_ldap_shm) { +return (void *)apr_rmm_addr_get(st-util_ldap_rmm, apr_rmm_calloc(st-util_ldap_rmm, size)); } else { Hi Matthieu - this will still break when the shmem segment fills up, the code needs to check for apr_rmm_malloc/calloc returning 0. joe _ Envie de discuter en live avec vos amis ? Télécharger MSN Messenger http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France _ Envie de discuter en live avec vos amis ? Télécharger MSN Messenger http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France
[PATCH] util_ldap_cache shm broken in apache 2.x
Hi, I sent few weeks ago a patch for util_ldap shm cache which is broken in apache 2.0 The problem are: shm file is unique for all httpd - i created a directive to specify a filename - creating default if not. shm is initialized in child init hook - i move this to post_init hook shm, rmm pointer are global and defined in util_ldap_cache.c - i created st-util_ldap_shm and st-util_ldap_rmm which are per root server address All allocation or free with rmm are using global address - i made them using st-util_ldap_shm and rmm The first patch i sent was my debug code, this one is cleaned and working with me in worker and prefork mpm I would like to know if there is a reason that util_ldap.h is in include/ and all util_ldap code is in modules/experimental Regards, Matthieu ? patch-util_ldap.diff Index: include/util_ldap.h === RCS file: /home/cvspublic/httpd-2.0/include/util_ldap.h,v retrieving revision 1.11 diff -u -r1.11 util_ldap.h --- include/util_ldap.h 14 Feb 2003 16:04:00 - 1.11 +++ include/util_ldap.h 1 Jul 2003 12:48:16 - @@ -65,6 +65,8 @@ #include apr_thread_rwlock.h #include apr_tables.h #include apr_time.h +#include apr_shm.h +#include apr_rmm.h /* Apache header files */ #include ap_config.h @@ -140,6 +142,16 @@ apr_thread_mutex_t *mutex; /* mutex lock for the connection list */ #endif +/* LDAP shm */ +#if APR_HAS_SHARED_MEMORY +const char *shm_file; +apr_shm_t *util_ldap_shm; +apr_rmm_t *util_ldap_rmm; +#endif + +/* LDAP cache */ +void *ldap_cache; + apr_size_t cache_bytes; /* Size (in bytes) of shared memory cache */ long search_cache_ttl; /* TTL for search cache */ long search_cache_size; /* Size (in entries) of search cache */ @@ -291,7 +303,7 @@ * apr_smmem_init() call. Regardless of the status, the cache * will be set up at least for in-process or in-thread operation. */ -apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize); +apr_status_t util_ldap_cache_init(void *data); /** * Display formatted stats for cache @@ -300,7 +312,7 @@ * various stats about the cache. * @deffunc char *util_ald_cache_display(apr_pool_t *pool) */ -char *util_ald_cache_display(apr_pool_t *pool); +char *util_ald_cache_display(apr_pool_t *pool, void *ldap_cache); /* from apr_ldap_cache_mgr.c */ @@ -312,7 +324,7 @@ * various stats about the cache. * @deffunc char *util_ald_cache_display(apr_pool_t *pool) */ -char *util_ald_cache_display(apr_pool_t *pool); +char *util_ald_cache_display(apr_pool_t *pool, void *ldap_cache); #endif /* APU_HAS_LDAP */ #endif /* UTIL_LDAP_H */ Index: modules/experimental/util_ldap.c === RCS file: /home/cvspublic/httpd-2.0/modules/experimental/util_ldap.c,v retrieving revision 1.14 diff -u -r1.14 util_ldap.c --- modules/experimental/util_ldap.c4 Apr 2003 13:47:13 - 1.14 +++ modules/experimental/util_ldap.c1 Jul 2003 12:48:17 - @@ -141,6 +141,8 @@ */ int util_ldap_handler(request_rec *r) { +util_ldap_state_t *st = (util_ldap_state_t *)ap_get_module_config( + r-server-module_config, ldap_module); r-allowed |= (1 M_GET); if (r-method_number != M_GET) @@ -171,7 +173,7 @@ /tr\n, r ); -ap_rputs(util_ald_cache_display(r-pool), r); +ap_rputs(util_ald_cache_display(r-pool, st-ldap_cache), r); ap_rputs(/table\n/p\n, r); @@ -517,7 +519,7 @@ LDAP_CACHE_WRLOCK(); curnode.url = url; -curl = util_ald_cache_fetch(util_ldap_cache, curnode); +curl = util_ald_cache_fetch(st-ldap_cache, curnode); if (curl == NULL) { curl = util_ald_create_caches(st, url); } @@ -596,7 +598,7 @@ LDAP_CACHE_RDLOCK(); newnode.reqdn = (char *)reqdn; newnode.dn = (char *)dn; -util_ald_cache_insert(curl-dn_compare_cache, newnode); +util_ald_cache_insert(st, curl-dn_compare_cache, newnode); LDAP_CACHE_UNLOCK(); } ldc-reason = DN Comparison TRUE (checked on server); @@ -637,7 +639,7 @@ /* get cache entry (or create one) */ LDAP_CACHE_WRLOCK(); curnode.url = url; -curl = util_ald_cache_fetch(util_ldap_cache, curnode); +curl = util_ald_cache_fetch(st-ldap_cache, curnode); if (curl == NULL) { curl = util_ald_create_caches(st, url); } @@ -659,7 +661,7 @@ /* found it... */ if (curtime - compare_nodep-lastcompare st-compare_cache_ttl) { /* ...but it is too old */ -util_ald_cache_remove(curl-compare_cache, compare_nodep); +util_ald_cache_remove(st, curl-compare_cache, compare_nodep); } else { /* ...and it is good */ @@ -714,7 +716,7 @@
[PATCH] first code of a patch for util_ldap - httpd-2.0
Hi, After reading util_ldap in modules/experimental, i found some broken stuff in the cache. The shm was created in child init hook, and util_ldap_shm, util_ldap_rmm, util_ldap_cache were declared as global in util_ldap_cache.h. I tryied to make it running with worker mpm and it was very unstable. I tryied to do a patch. I moved the shm creation in post_config hook, with a file logs/ldap_cache_pid_server instead of /tmp/mod_ldap_cache. Then, i created inside include/util_ldap.h, in the module conf (util_ldap_state_t) 3 new var: util_ldap_shm, util_ldap_rmm, and ldap_cache which were global before. To finish, i patched all function in util_ldap.c util_ldap_cache.c and util_ldap_cache_mgr.c to make them receiving this module conf instead of using the global var. I post the patch i did, which is still dirty and with special comments. i will continue working on it to be sure it's stable and to clean it. I still have to patch the shm init twice because of post_config launched twice. i am open to other way to patch the problem and to modify my code. Why util_ldap.h is in include/ and util_ldap.c is in modules/experimental ? regards, Matthieu Estrade Index: include/util_ldap.h === RCS file: /home/cvspublic/httpd-2.0/include/util_ldap.h,v retrieving revision 1.11 diff -u -r1.11 util_ldap.h --- include/util_ldap.h 14 Feb 2003 16:04:00 - 1.11 +++ include/util_ldap.h 12 Jun 2003 15:02:15 - @@ -65,6 +65,8 @@ #include apr_thread_rwlock.h #include apr_tables.h #include apr_time.h +#include apr_shm.h +#include apr_rmm.h /* Apache header files */ #include ap_config.h @@ -140,6 +142,16 @@ apr_thread_mutex_t *mutex; /* mutex lock for the connection list */ #endif +/* LDAP shm */ +#if APR_HAS_SHARED_MEMORY +const char *shm_file; +apr_shm_t *util_ldap_shm; +apr_rmm_t *util_ldap_rmm; +#endif + +/* LDAP cache */ +void *ldap_cache; + apr_size_t cache_bytes; /* Size (in bytes) of shared memory cache */ long search_cache_ttl; /* TTL for search cache */ long search_cache_size; /* Size (in entries) of search cache */ @@ -291,7 +303,7 @@ * apr_smmem_init() call. Regardless of the status, the cache * will be set up at least for in-process or in-thread operation. */ -apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize); +apr_status_t util_ldap_cache_init(void *data); /** * Display formatted stats for cache @@ -300,7 +312,7 @@ * various stats about the cache. * @deffunc char *util_ald_cache_display(apr_pool_t *pool) */ -char *util_ald_cache_display(apr_pool_t *pool); +char *util_ald_cache_display(apr_pool_t *pool, void *ldap_cache); /* from apr_ldap_cache_mgr.c */ @@ -312,7 +324,7 @@ * various stats about the cache. * @deffunc char *util_ald_cache_display(apr_pool_t *pool) */ -char *util_ald_cache_display(apr_pool_t *pool); +char *util_ald_cache_display(apr_pool_t *pool, void *ldap_cache); #endif /* APU_HAS_LDAP */ #endif /* UTIL_LDAP_H */ Index: modules/experimental/util_ldap.c === RCS file: /home/cvspublic/httpd-2.0/modules/experimental/util_ldap.c,v retrieving revision 1.14 diff -u -r1.14 util_ldap.c --- modules/experimental/util_ldap.c4 Apr 2003 13:47:13 - 1.14 +++ modules/experimental/util_ldap.c12 Jun 2003 15:02:16 - @@ -141,6 +141,8 @@ */ int util_ldap_handler(request_rec *r) { +util_ldap_state_t *st = (util_ldap_state_t *)ap_get_module_config( + r-server-module_config, ldap_module); r-allowed |= (1 M_GET); if (r-method_number != M_GET) @@ -171,7 +173,7 @@ /tr\n, r ); -ap_rputs(util_ald_cache_display(r-pool), r); +ap_rputs(util_ald_cache_display(r-pool, st-ldap_cache), r); ap_rputs(/table\n/p\n, r); @@ -517,7 +519,7 @@ LDAP_CACHE_WRLOCK(); curnode.url = url; -curl = util_ald_cache_fetch(util_ldap_cache, curnode); +curl = util_ald_cache_fetch(st-ldap_cache, curnode); if (curl == NULL) { curl = util_ald_create_caches(st, url); } @@ -596,7 +598,7 @@ LDAP_CACHE_RDLOCK(); newnode.reqdn = (char *)reqdn; newnode.dn = (char *)dn; -util_ald_cache_insert(curl-dn_compare_cache, newnode); +util_ald_cache_insert(st, curl-dn_compare_cache, newnode); LDAP_CACHE_UNLOCK(); } ldc-reason = DN Comparison TRUE (checked on server); @@ -637,7 +639,7 @@ /* get cache entry (or create one) */ LDAP_CACHE_WRLOCK(); curnode.url = url; -curl = util_ald_cache_fetch(util_ldap_cache, curnode); +curl = util_ald_cache_fetch(st-ldap_cache, curnode); if (curl == NULL) { curl = util_ald_create_caches(st, url); } @@ -659,7 +661,7 @@ /* found it... */
Problems with Filters and ErrorDocument
Hi, I'am coding a module for apache 2.0 in reverse proxy mode. Inside this module, i have a post_read_request hook which return HTTP_OK or HTTP error codes like 403 or 500. For some reason, i have also error codes not for apache but for my log analyser, which are written in the error log. for example, 3 or 4 same error codes, i will return an error 403. So the client will receive the same error page for all this internal error codes. My aim is to insert my own document depending to the internal error code corresponding. I coded a filter doing what follow: Receiving the filename in f-ctx Opening the file on hard drive. Creating a file bucket and insert it in the HEAD of the brigade. Creating an EOS bucket and insert it in the end of the brigade Then, i remove my filter pass the brigade to next filter return status of ap_pass_brigade. i declared this filter as an output filter, and declare it also as an output_filter_handle Then i did a function to insert this filter when i encouter the internal error code, doing the following things: ap_run_insert_filter(r); ap_add_output_filter_handle (my error document filter handle); creating a brigade passing the empty brigade to the output filter. ( i looked how mod_cache do to insert the cached document). So now, when my module is running: in my post_read_request hook: i see the internal error code, i launch the function inserting my custom error document. Then i return the Apache error code (403). The client receive my custom error document, and it seems to work ... but if i do a refresh on the client browser, i will receive the apache error document for error 403. So 1/2 times i receive the custom. I think it's because when i return the 403 error code in my post_read_request hook, it's inserting another filter after my custom error document filter. But it was really that, the client should receive the custom error document + apache error document both. I also tryied to destroy the brigade received in my filter, and to create a new one with the file bucket and eos bucket i pass to the next filter. But the behaviour is the same. Is there a way to cancel the error document filter inserting the apache error document ? does somebody see what i could do and if it's possible to do what i want ? Best regards, Estrade Matthieu _ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms
Impossible to use apr_xml_ns_scope in my module.
Hi, I am using the apr_xml function in my module. When i want to display all data in an element, i display, the name, the attributes, the cdata and it's impossible to display the ns_scope. i can't use the apr_xml_ns_scope in my code. i did a for (ns_scope = elem-ns_scope; ns_scope!= NULL; ns_scope=ns_scope-next) but when i declare the apr_xml_ns_scope, it refuse to compile and say it is undeclared. is it normal this struct is unavailable from my module, or is there another way to display all the ns_scope data. regards, Estrade Matthieu _ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms
Re: authz / authn and mod_auth_ldap
Hi, I read the discussion for few messages, i am not an apache developper, so i will speak as a user. IMHO, Splitting into two modules will make auth more complex. actually, it's not really easy to setup, and the documentation is not always up to date. regards Matthieu Bill Stoddard wrote: Graham Leggett wrote: Justin Erenkrantz wrote: No, you don't *have* to split them into different modules. One module could register for both authn/authz providers. The only reason we split was because their wasn't a lot of shared code between the other auth modules. I think mod_auth_ldap has a lot of shared code in its authn/authz split. All (or most) of the shared code is in mod_ldap already. It should be relatively easy to split mod_auth_ldap into mod_authn_ldap and mod_authz_ldap. Why would we want to split the module into two pieces? What benefit to users does it provide and do those benefits (whatever they are) outweigh the additional complexity of knowing when/whether you need to load each piece? Bill _ Envie de discuter en live avec vos amis ? Télécharger MSN Messenger http://www.ifrance.com/_reloc/m la 1ère messagerie instantanée de France _ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms
Re: mod_cache CacheMaxStreamingBuffer
I confirm the CacheMaxStreamingBuffer is a source of misconfiguration Using the MCacheMaxObjectSize could me a good thing. In case of CacheMaxStreamingBuffer used, i don't know how MCacheMaxObjectSize is used for because if a document is bigger than MaxStreamingBuffer, it will be never cached. are you sure MaxStreamingBuffer is not used in disk_cache ? this directive is to store all the brigade before saving the entire data with the write_headers and write_body functions, pointing on disk or mem writing functions. I think it's the same for disk and mem cache. In the same time, could you answer my old mail with the CacheSlashEndingUrl patch i made is usefull or not ? regards Matthieu Bill Stoddard wrote: The CacheMaxStreamingBuffer function is currently implemented in mod_cache. It carves out a chunk of RAM to buffer responses, regardless of the actual storage manager (mod_mem_cache or mod_disk_cache) that will ultimately be used cache the response. The function is not really useful if you are using mod_disk_cache. IMHO, the streaming buffer function belongs in the storage manager (mod_mem_cache) rather than mod_cache. I propose we move this function into mod_mem_cache. I also question the need for the CacheMaxStreamingBuffer configuration directive. Why not use MCacheMaxObjectSize as the max streaming buffer size? This would eliminate a source of misconfiguration, and specifically the case of neglecting to include CacheMaxStreamingBuffer in httpd.conf (I spent maybe 30 minutes trying to figure out why some responses were not being cached that I knew darn well were within my configured cache size thresholds. Most Apache users would not have a clue where to start looking for the cause, nor should they be expected to have a clue). I'll start working on this if I hear no objections. Bill _ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms _ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms
Re: mod_cache CacheMaxStreamingBuffer
what i remember is cache is able to cache unknown size document with MaxStreamingBuffer. i will try to draw it: first brigade, no length, if no EOS bucket, saving data in temp brigade second brigade, if no EOS, concat data to temp_brigade until finding an EOS bucket, or total length is more than MaxStreamingBuffer. All of this is starting line 630 of mod_cache.c then, write_headers, and write_body (with temp brigade if the document is handled with more than 1 brigade), which are pointing on disk or mem cache writing functions depending on setting. how long do you think the cache will stay in experimental I am using it a lot in my product which is used by many customers I found any big problems in worker, reverse_proxy with mem_cache, i have like 300 request on backend for 120 000 request on reverse proxy It increase performance a lot regards, Matthieu Bill Stoddard wrote: I confirm the CacheMaxStreamingBuffer is a source of misconfiguration Using the MCacheMaxObjectSize could me a good thing. In case of CacheMaxStreamingBuffer used, i don't know how MCacheMaxObjectSize is used for because if a document is bigger than MaxStreamingBuffer, it will be never cached. are you sure MaxStreamingBuffer is not used in disk_cache ? this directive is to store all the brigade before saving the entire data with the write_headers and write_body functions, pointing on disk or mem writing functions. I think it's the same for disk and mem cache. I need to look at the old code, but if i recall correctly, mod_mem_cache would reject attempting to cache an object whose length was unknown (see the call to cache_create_entity() in mod_cache). mod_disk_cache otoh would happily attempt to cache objects whose size was not know at the start. Remember that mod_disk_cache is just writing cache objects to disk and does not need to allocate memory to hold/prefetch the object. In the same time, could you answer my old mail with the CacheSlashEndingUrl patch i made is usefull or not ? Yea, I was just looking at that. I think we can eliminate that check. I was originally afraid that this would muck up negotiation but the cache does not work with negotiated content now anyway. Bill _ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagn. Rglement : http://www.ifrance.com/_reloc/sign.sms
Re: r-server-port problem
My module need to know the r-server-port, i mean the port of virtual host used by the client. in my apache, i have 2 VHOST: The problem happened when i was behind an Intel SSL Accelerator. client https --- SSL INTEL 443 -- Reverse Proxy 8095 The SSL accelerator is listening on 443, send clear http on port 8095 of my RP as: GET / HTTP/1.1 Host: lala.com \n\n\r VirtualHost ip:8095 ServerName lala.com ProxyPass / http://host1.com ProxyPassReverse /VirtualHost VirtualHost ip:80 Servername lala.com redirect / https://lala.com (redirect to HTTPS) /VirtualHost my module will find r-server-port = 80 even if the SSL Accelerator is connected on port 8095 It can happen too if i have the same servername in each VHOST. My module is now checking conn-socket-port or something like that... i have no more problem What i find buggy is the correct VHOST is used, if not, the connection should be a loop ! so i am in the correct VHOST and when my module check r-server-port, i find 80 ! Jeff Trawick wrote: Estrade Matthieu [EMAIL PROTECTED] writes: I posted a mail about a problem with r-server-port few days ago, I did a patch to correct this bug, but i am not sure it's a bug... the problem was when UseCannonicalName is Off, I don't think it is a bug. What exactly does your module need to know?
Re: r-server-port problem
heh ok, i was using the wrong stuff, i didn't know about this struct server_addrs_rec. what r-server-port is used for ? i just would like to know what is the difference btw usecanonicalName On and Off for the r-server-port why default port is sent instead of real port (socket port), i think there is a reason :) Jeff Trawick wrote: Estrade Matthieu [EMAIL PROTECTED] writes: My module need to know the r-server-port, i mean the port of virtual host used by the client. isn't that in r-server-addrs-host_port?
input filter
hi, Is there a way to place an input filter before mod_proxy do the connection to backend. I did a register_input_filter and it's called when mod_proxy is proxying the data from backend server (ap_get_brigade in proxy_http.c). my aim is to modify the data before the proxy send it to backend. regards, Estrade Matthieu __ Modem offert : 150,92 euros remboursés sur le Pack eXtense de Wanadoo ! Haut débit à partir de 30 euros/mois : http://www.ifrance.com/_reloc/w
r-server-port problem
Hi, I posted a mail about a problem with r-server-port few days ago, I did a patch to correct this bug, but i am not sure it's a bug... the problem was when UseCannonicalName is Off, If i have a request on port 8095 like: GET / HTTP/1.1 Host: mydomain.com \n\n\r my module is using the r-server-port the r-server-port will be ap_default_port because of in server/core.c: (When UseCanonicalName Off) port = r-parsed_uri.port ? r-parsed_uri.port : r-server-port ? r-server-port : ap_default_port(r); so, i did: port = r-parsed_uri.port ? r-parsed_uri.port : r-server-port ? r-server-port : r-connection-local_addr-port ? r-connection-local_addr-port : ap_default_port(r); I dunno if i am true or false. it's now working in my module, it's finding r-server-port = 8095 instead of 80 regards, Estrade Matthieu ? patch.serverport Index: core.c === RCS file: /home/cvspublic/httpd-2.0/server/core.c,v retrieving revision 1.225 diff -u -r1.225 core.c --- core.c 16 Nov 2002 02:27:33 - 1.225 +++ core.c 25 Nov 2002 16:25:09 - @@ -905,6 +905,7 @@ */ port = r-parsed_uri.port ? r-parsed_uri.port : r-server-port ? r-server-port : + r-connection-local_addr-port ? r-connection-local_addr-port : ap_default_port(r); } else { /* d-use_canonical_name == USE_CANONICAL_NAME_ON */
r-server-port = 80 = ap_default_port on a request to port 8095
Hi, I will try to draw the problem i got today with r-server-port I am in reverse proxy with apache 2.0 (cvs last checkout) i have UseCanonicalName Off I am behing a INTEL SSL Accelerator which connect on my apache reverse proxy on port 8095 but it never put in the request the port 8095 so apache receive GET /lala.html HTTP/1.1 Host: lala.com my vhost is: NameVirtualHost ip:8095 virtualhost ip:8095 servername lala.com /virtualhost When my module is checking the server-port, it find 80 instead of 8095 When i setup UseCanonicalName On, my module find the 8095 in server-port. when i read the server/core.c i find: for UseCannonicalName Off: port = r-parsed_uri.port ? r-parsed_uri.port : r-server-port ? r-server-port : ap_default_port(r); can somebody could explain me why it's not trying the r-connection-local_addr-port like: port = r-parsed_uri.port ? r-parsed_uri.port : r-server-port ? r-server-port : r-connection-local_addr-port ? r-connection-local_addr-port : ap_default_port(r); before sending the default port. I think it's for special case but i would like to know which one. I am now using directly r-connection-local_addr-port in my module so it's working fine. regards, Estrade Matthieu __ Modem offert : 150,92 euros remboursés sur le Pack eXtense de Wanadoo ! Haut débit à partir de 30 euros/mois : http://www.ifrance.com/_reloc/w
mod_cache and slash ending url
Hi, Actually, the cache module is not handling slash ending url and it's impossible with any directive do cache this kind or url. When i send this problem on the mailing few weeks ago, i read on mail answer that was maybe because it could happen problem with negociation and caching slash ending url. I wrote a little directive: CacheSlashEndingUrl On/Off which is per default at Off, to cache slash ending url. i dunno if it can be usefull but i send you the patch. About the negociations, on all website i tested on, there is store and no-cache headers which make the url non cachable. regards, Estrade Matthieu ? patch.cache ? patch.slash.cache Index: mod_cache.c === RCS file: /home/cvspublic/httpd-2.0/modules/experimental/mod_cache.c,v retrieving revision 1.62 diff -u -r1.62 mod_cache.c --- mod_cache.c 6 Nov 2002 14:08:31 - 1.62 +++ mod_cache.c 18 Nov 2002 10:13:20 - @@ -124,10 +124,6 @@ cache: URL exceeds length threshold: %s, url); return DECLINED; } -/* DECLINE urls ending in / ??? EGP: why? */ -if (url[urllen-1] == '/') { -return DECLINED; -} /* make space for the per request config */ cache = (cache_request_rec *) ap_get_module_config(r-request_config, @@ -137,6 +133,12 @@ ap_set_module_config(r-request_config, cache_module, cache); } +if (conf-cache_slash_endingurl == 0) { +if (url[urllen-1] == '/') { +return DECLINED; +} +} + /* save away the type */ cache-types = types; @@ -912,6 +914,8 @@ ps-ignorecachecontrol = 0; ps-ignorecachecontrol_set = 0 ; ps-max_streaming_buffer_size = 0; +ps-cache_slash_endingurl = 0; +ps-cache_slash_endingurl_set = 0; return ps; } @@ -953,6 +957,11 @@ ? base-max_streaming_buffer_size : overrides-max_streaming_buffer_size; +ps-cache_slash_endingurl = +(overrides-cache_slash_endingurl_set == 0) +? base-cache_slash_endingurl +: overrides-cache_slash_endingurl; + return ps; } static const char *set_cache_ignore_no_last_mod(cmd_parms *parms, void *dummy, @@ -1090,6 +1099,20 @@ return NULL; } +static const char *set_cache_slash_endingurl(cmd_parms *parms, void *dummy, + int flag) +{ +cache_server_conf *conf; + +conf = +(cache_server_conf *)ap_get_module_config(parms-server-module_config, + cache_module); +conf-cache_slash_endingurl = flag; +conf-cache_slash_endingurl_set = 1; +return NULL; + +} + static int cache_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { @@ -1140,6 +1163,10 @@ RSRC_CONF, Maximum number of bytes of content to buffer for a streamed response), + AP_INIT_FLAG(CacheSlashEndingUrl, set_cache_slash_endingurl, + NULL, + RSRC_CONF, + Enabling cache on Slash ending Url), {NULL} }; Index: mod_cache.h === RCS file: /home/cvspublic/httpd-2.0/modules/experimental/mod_cache.h,v retrieving revision 1.36 diff -u -r1.36 mod_cache.h --- mod_cache.h 17 Nov 2002 01:33:25 - 1.36 +++ mod_cache.h 18 Nov 2002 10:13:20 - @@ -179,6 +179,9 @@ /** ignore client's requests for uncached responses */ int ignorecachecontrol; int ignorecachecontrol_set; +/* enable/disable cache on slash ending url */ +int cache_slash_endingurl; +int cache_slash_endingurl_set; /* maximum amount of data to buffer on a streamed response where * we haven't yet seen EOS */ apr_off_t max_streaming_buffer_size;
mod_cache and multiple brigade
Hi, i will quickly draw the problem i found 1 month ago: When i am with apache + mod_proxy + mod_cache client -- reverse_proxy_cache -- backend. when the client ask for a document which will be handled with multiple brigade, the first time when mod_cache is caching the document, the client browser is able to display the document. When the client ask again the document, mod_cache serve it from cache and the client browser refuse to display it. I found it was because the client browser received Content-Length header and Transfer-Encoding=chunked header at the same time. I put debug in mod_proxy and mod_cache, and i found: when the backend answer the first request to multiple brigade handled document: backend - mod_proxy: content_length=size, no transfer-encoding headers and r-chunked =0. mod_proxy: delete content-length and Transfer-encoding headers. http_protocol.c: ap_set_keepalive don't find CL or TE headers so: r-chunked=0 at beginning, r-chunked =1 when ending. http_protocol.c: ap_http_header_filter find r-chunked=1 so: add header Transfer-Encoding=chunked mod_cache: find Transfer-Encoding=chunked headers and store it in memory. mod_cache: know the length of data he stored in memory and and the CL header with length of data - client When the backend answer the second request to multiple brigade handled document: rp+cache - mod_cache:cache_out:read_ headers: read headers from what he stored in memory mod_cache:cache_out: send the two headers, CL and TE - client: refuse to display or use document he received. On a unique brigade handled document, the ap_set_keepalive find the connection closed, so he don't put the r-chunked = 1 and it's working fine. The problem is only on multiple brigade handling document To make my mod_mem_cache work, i did this ugly patch, removing the TE-header from headers stored in memory. It was working, but with ugly method. Why mod_proxy is deleting this Content-length header, i understand for the TE, because the setkeepalive and http_headers_filter compute this header, but why the content_lentgh is deleted ? I removed the CL deleting line in the proxy_http.c code and it's now working well, but i understand this line may be usefull, so i will search how to resolve the problem better. i hope you understand the problem, my english is not really good regards, Estrade Matthieu __ Modem offert : 150,92 euros remboursés sur le Pack eXtense de Wanadoo ! Haut débit à partir de 30 euros/mois : http://www.ifrance.com/_reloc/w
mod_auth_ldap
Hi, I am using apache 2.0 + proxy + mod_auth_ldap i have this error in my log: [Wed Oct 23 17:35:59 2002] [error] [client 192.168.100.1] (9)Bad file descriptor: Could not open password file: (null) and return an error 500 this is my vhost auth conf: Location / AuthName test AuthType basic AuthLDAPEnabled On AuthLDAPUrl ldap://192.168.100.2:389/cn=backoffice,dc=company,dc=com?uid Require valid-user /Location when i do this query, with anonymous login, directly on ldap server, it's working if somebody have ideas regards Estrade Matthieu ___ Haut Débit: Modem offert soit 150,92 euros remboursés sur le Pack eXtense de Wanadoo ! Profitez du Haut Débit à partir de 30 euros/mois : http://www.ifrance.com/_reloc/w
Re: mod_auth_ldap
John K. Sterling wrote: try disabling mod_auth. sterling i deleted AuthName and AuthType and this is what i get: Wed Oct 23 18:10:17 2002] [debug] mod_auth_ldap.c(261): [client 192.168.100.1] [8263] auth_ldap authenticate: using URL ldap://192.168.100.2:389/cn=backoffice,dc=company,dc=com?uid [Wed Oct 23 18:10:17 2002] [debug] mod_auth_ldap.c(266): [client 192.168.100.1] [8263] auth_ldap authenticate: ap_get_basic_auth_pw() returns -1 [Wed Oct 23 18:10:17 2002] [crit] [client 192.168.100.1] configuration error: couldn't perform authentication. AuthType not set!: / -- Original Message -- Reply-To: [EMAIL PROTECTED] Date: Wed, 23 Oct 2002 17:33:26 +0200 From: Estrade Matthieu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: mod_auth_ldap Hi, I am using apache 2.0 + proxy + mod_auth_ldap i have this error in my log: [Wed Oct 23 17:35:59 2002] [error] [client 192.168.100.1] (9)Bad file descriptor: Could not open password file: (null) and return an error 500 this is my vhost auth conf: Location / AuthName test AuthType basic AuthLDAPEnabled On AuthLDAPUrl ldap://192.168.100.2:389/cn=backoffice,dc=company,dc=com?uid Require valid-user /Location when i do this query, with anonymous login, directly on ldap server, it's working if somebody have ideas regards Estrade Matthieu ___ Haut Dbit: Modem offert soit 150,92 euros rembourss sur le Pack eXtense de Wanadoo ! Profitez du Haut Dbit partir de 30 euros/mois : http://www.ifrance.com/_reloc/w ___ Haut Dbit: Modem offert soit 150,92 euros rembourss sur le Pack eXtense de Wanadoo ! Profitez du Haut Dbit partir de 30 euros/mois : http://www.ifrance.com/_reloc/w
RE : mod_auth_ldap
Hi, I finally made mod_auth_ldap work. First, basic authentication: AuthName auth AuthType Basic Then, disable Basic authoritative to let the Authorization continue to mod_auth_ldap. AuthBASICAuthoritative Off Then my LDAP Config Maybe this documentation about AuthBasicAuthoritative directive, should be added by a link in mod_auth_ldap documentation. Regards, Estrade Matthieu -Message d'origine- De : Thomas Bennett [mailto:thomas.bennett;eds.com] Envoyé : Wednesday, October 23, 2002 9:43 PM À : Estrade Matthieu Objet : Re: mod_auth_ldap On Thu, 24 Oct 2002 04:33, Estrade Matthieu wrote: Hi, I am using apache 2.0 + proxy + mod_auth_ldap i have this error in my log: [Wed Oct 23 17:35:59 2002] [error] [client 192.168.100.1] (9)Bad file descriptor: Could not open password file: (null) and return an error 500 Add AuthLDAPAuthoritative on to stop it from trying another authentication type when ldap fails. this is my vhost auth conf: Location / AuthName test AuthType basic AuthLDAPEnabled On AuthLDAPUrl ldap://192.168.100.2:389/cn=backoffice,dc=company,dc=com?uid Require valid-user /Location when i do this query, with anonymous login, directly on ldap server, it's working I suggest you look closely at your basedn: cn=backoffice,dc=company,dc=com I simply use o=EDS but of course our sever might be set up differently. Regards Thomas Bennett ___ Haut Débit: Modem offert soit 150,92 euros remboursés sur le Pack eXtense de Wanadoo ! Profitez du Haut Débit à partir de 30 euros/mois : http://www.ifrance.com/_reloc/w
url finishing by / are declined by cache
Hi, Why url finishing by / are not cacheable ? /* DECLINE urls ending in / ??? EGP: why? */ if (url[urllen-1] == '/') { return DECLINED; } I delete this code and it's caching it really well Is it possible to think a directive to enable/disable this ? regards, Estrade Matthieu __ Etudiant: Wanadoo t'offre le Pack eXtense Haut Débit soit 150,92 euros d'économies ! Clique ici : http://www.ifrance.com/_reloc/mail.etudiant
cache+ proxy, chunked + C-L,browsers unable to display documents
Hi, I've just seen you are commiting patch to mod_cache... I haven't receive answer for my post on dev about the chunk/CL problem... Could you tell me what do you think about to let me know how can I code a godd patch against the problem. Regards, Estrade Matthieu __ Etudiant: Wanadoo t'offre le Pack eXtense Haut Débit soit 150,92 euros d'économies ! Clique ici : http://www.ifrance.com/_reloc/mail.etudiant
Mod_cache and multiple brigade problem.
Hi, I found problems in mod_cache + mod_proxy and handling multiple brigade. If someone have ideas on it... 1) When the mod_cache is trying to cache a document in multiple brigade, it store and concat each brigade in cache-saved_brigade. When the first brigade is cached, the r-headers_out are all available, but when the others brigade are going throught the mod_cache, there is no more r-headers_out. Mod_cache is writting the headers informations when it find the last brigade (containing EOS bucket). So at this moment, mod_cache is able to store headers he put in info, but not the others one he should find in r-headers_out So i can read the Server header of my reverse proxy instead of the backend headers. This bug happen really random and i am not able at the moment to exactly find why ? 2) When a document in multiple brigade is handled by reverse proxy and cache. The first time, it cache the document without error. (the browser display the document) The second time, it serve the document from cache.( the browser doesn't display the document) When the browser receive the document from cache, it's impossible for him to display it but he received the good data ( i do a md5sum to control ). The only difference between the two answer, is the not cached and first request doesn't contain a content-length the second request receiving data from cache contain differents headers like content-length (seems to be right) and some more headers like Age. 3) When a document is cached the first time, the debug message say that he will cache the url. I put debug in the cache_write_entity_headers and body to see if they all finish well. the debug message never display an error on that, but the next request which should be handled by cache is still handled by the reverse proxy and the cache say again he will cache the url... In conclusion, do you think all these problems could be linked ? What is amazing is i do my test on two different boxes: the mod_cache + mod_proxy is working fine on redhat 8, a document of 1200bytes is handled in one brigade the mod_cache + mod_proxy is not working properly on a redhat 7.2 and the same document as above is handled in 2 brigade... The compilations lines and the source code are EXACTLY the same. The backend server is the same too for all the test. I will try to find more details about this problems. regards, Estrade Matthieu __ Etudiant: Wanadoo t'offre le Pack eXtense Haut Débit soit 150,92 euros d'économies ! Clique ici : http://www.ifrance.com/_reloc/mail.etudiant
mod_cache and brigade
Hi, After i did my unusable proxy patch for multiple brigade handling by mod_cache, i tried to patch the mod_cache. My code is doing: receiving one brigade if EOS inside, cache it and cache cache-saved_brigade if not null. if no EOS, save brigade in cache-saved_brigade w8 for another brigade, until EOS inside. This code is working, I controlled the data written in the cache and his length. But i have a bug, and i really don't understand why When i call manual.css (2 brigades) alone http://127.0.0.1/manual/style/css/manual.css: first time, it's cached by the mod_cache and served by proxy second time, it's served by cache data received are the same, i did a MD5 on it ! that's why i think the code is working. When i call http://127.0.0.1/manual which is using manual.css, the same as above: first time, it's cached by mod_cache and served by proxy second time, the manual.css is not used by the browser. (netscape US langage) i sniffed the connection btw the reverse proxy and the client. the manual.css data are sent correctly to the client, but there is a difference btw: served by proxy: HTTP/1.1 and no keep alive served by cache: HTTP/1.1 and keepalive + content-length. and age=value the others headers_out are the same. I will continue to search why this bug is happening. I insert my code as attachment, sorry for the french comment inside if left. Matthieu /* * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, *if any, must include the following acknowledgment: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowledgment may appear in the software itself, *if and wherever such third-party acknowledgments normally appear. * * 4. The names Apache and Apache Software Foundation must *not be used to endorse or promote products derived from this *software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache, *nor may Apache appear in their name, without prior written *permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. */ #define CORE_PRIVATE #include mod_cache.h module AP_MODULE_DECLARE_DATA cache_module; APR_OPTIONAL_FN_TYPE (ap_cache_generate_key) * cache_generate_key; /* -- */ /* Handles for cache filters, resolved at startup to eliminate * a name-to-function mapping on each request */ static ap_filter_rec_t *cache_in_filter_handle; static ap_filter_rec_t *cache_out_filter_handle; static ap_filter_rec_t *cache_conditional_filter_handle; /* * CACHE handler * - * * Can we deliver this request from the cache? * If yes: * deliver the content by installing the CACHE_OUT filter. * If no: * check whether we're allowed to try cache it * If yes: * add CACHE_IN filter * If No:
Some mod_cache + mod_proxy problems
Hi, I'am trying to use the cache module with reverse proxy, and i have few problems. When i'am using a browser with data in cache, like the file test.gif. If the picture is in my browser cache before my first try with the reverse proxy, mod_cache is unable to cache the data, because on the first connection on the backend server, it send a 304 to the reverse proxy, and mod_cache is not accepting to cache 304.(headers only). Not really a problem because when i clean the browser cache, it's working well after. but is it possible to think sending request to the backend server, telling it to send a 200 and not a 304.(maybe with force headers). The second problem is with mod_mem_cache and mod_proxy. When mem_cache is trying to find the length of the data requested, it's not working, so length is = -1 And when it do the test with the CacheMaxStreamBuffer, it's always failed because the length must be upper to 0. Maybe because the backend server send back a 304 too. I will try to debug more, because my informations are not very good :) Best regards, Estrade Matthieu
The best hook ?
Hi, I would like to know the best hook to register my module init function. In this function, my aim is: 1- Open files 2- Take data 3- Put this data in structures (alloc memory) 4- All Childs must be able to read/modify all this data. I did my hook with ap_hook_post_config. Do you think it's the best way ? When I setup a MaxRequestPerChild 1, my childs restart. I alloc memory to structure in my init function with calloc because, I am unable to use the apr_pool_p in subfunctions. When the child restart, does it call the post_config function.? Because I see debug message like when apache init the module. Best regards Estrade Matthieu __ Pour mieux recevoir vos emails, utilisez un PC plus performant ! Découvrez la nouvelle gamme DELL en exclusivité sur i (france) http://www.ifrance.com/_reloc/signedell
Input filter
Hi, I am running apache 2.0.40 on RedHat 7.2 x86 I have done a module reading POST (body) data in the input filter. The problem is when I read the data on the bucket, I am not able to let the data available for the other module. I have tried to copy the bucket before read it, or do a transient bucket and insert it but nothing work. Is somebody know how I can do to insert my data in the input filter to be available for the mod_proxy Best regards, Matthieu
Reading-POST-data problem
Hi, (apache 2.0.39 + linux RedHat 7.2 i386) I am using apache in reverse proxy mode. i am reading POST data in my module with ap_should_client_block and ap_get_client_block... then, i put this data into a temp file... and patched apache to make ap_get_client_block, read in this file when it's called by another module ( in this case mod_proxy). it was working with apache 2.0.36 but not now with the 2.0.39... I think it's because of the problem with chunked data buffer overflow patch. i took a look in the proxy_http.c and i saw that the code sending the body to the backend server has been modified... is somebody have the same problem ? considering that my code is from a module build for 1.3.x, is somebody has a new solution to read this data without clear it and let it readable by others modules ? Best regards, Estrade Matthieu __ ifrance.com, l'email gratuit le plus complet de l'Internet ! vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... http://www.ifrance.com/_reloc/email.emailif