Re: Filter recieves only EOF buckets

2007-04-23 Thread shookie

Mike [EMAIL PROTECTED] wrote 23.04.2007 00:29:38:

 Show us main bucket brigade loop and hook function. Probably you forgot
 to insert the filter or smth...


It is just a debugging loop atm. And the loop body only gets called once, and 
there EOS bucket in it.
When I ignore he sentinel bucket, and go on anyway, all that is in the brigade 
are alternating EOS and METADATA buckets.
And the filter definitely gets inserted. Since it gets called. And it also only 
gets inserted when I want it inserted, since it only gets called then.

static const char* buckettype(apr_bucket *b)
{
if(APR_BUCKET_IS_FLUSH(b)) return FLUSH;
if(APR_BUCKET_IS_EOS(b)) return EOS;
if(APR_BUCKET_IS_FILE(b)) return FILE;
if(APR_BUCKET_IS_PIPE(b)) return PIPE;
if(APR_BUCKET_IS_HEAP(b)) return HEAP;
if(APR_BUCKET_IS_MMAP(b)) return MMAP;
if(APR_BUCKET_IS_IMMORTAL(b)) return IMMORTAL;
if(APR_BUCKET_IS_TRANSIENT(b)) return TRANSIENT;
if(APR_BUCKET_IS_POOL(b)) return POOL;
if(APR_BUCKET_IS_METADATA(b)) return METADATA;
return unknown;
}

static int main_filter_hook(ap_filter_t *f, apr_bucket_brigade *bb)
{
apr_bucket *b = APR_BRIGADE_FIRST(bb);
ap_filter_t *tf = f-r-output_filters;

while (b != APR_BRIGADE_SENTINEL(bb))
{

//ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, f-r, 
filter: %s, tf-frec-name);
//if(!tf-next)break;
//else tf = tf-next;

ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, f-r, type: 
%s, buckettype(b));
b = APR_BUCKET_NEXT(b);
}

return ap_pass_brigade(f-next, bb);
}


Jan Schukat


Debugging Apache with GDB

2007-04-23 Thread David Wortham

Hello again module developers,

   I'm trying to track down a SegFault in my module.  It's running on a
high-traffic server and Apache is intermittently receiving SegFaults.  As
child processes die, new ones are taking their place but there are still
requests that go unanswered.

   I don't have control of the high-traffic server's environment:
- It's running on a RedHat Linux (kernel 2.6.20) box (Apache 2.0.59)
- I am not allowed to use gdb... if it is even installed (which apparently
is not the case)
- I can't reproduce this with small load servers (makes me think a pool is
running out of allocatable memory)

  My problem is that I am getting core dumps (using the CoreDumpDirectory
directive of the MPM module) but I can't read them with my version of gdb (I
am running 6.3-5).  My specific error is:
/home/.../core.pid is not a core dump: File format not recognized

  I tried using readelf to see what I could see (I found out newer Linux
core dumps are in ELF format).  It appears to know how to parse the file,
but hex is useless to me without a human-readable backtrace.  I'm a
programmer, but I can't see the Matrix (yet).

  Any suggestions?  Does anyone know a surefire way to get a backtrace from
an Apache (Linux) coredump file? Perhaps other mailing lists that could
help?


Thanks,
Dave
--
David Wortham
Senior Web Applications Developer
Unspam Technologies, Inc.
1901 Prospector Dr. #30
Park City, UT 84060
(435) 513-0672


Re: Filter recieves only EOF buckets

2007-04-23 Thread shookie
Have found my mistake, and have actually described it in my question: You 
cannot call ap_add_output_filter in the translate_name hook. That must happen 
after the handler /generator was called. So I defined the insert_filter hook 
and use a flag in the request config to decide wether to add the filter o not. 
That flag is set at the place where ap_add_output_filter was called before in 
the translate name hook.

Thank you all for bearing with me :)

Jan Schukat


Re: Debugging Apache with GDB

2007-04-23 Thread David Wortham

Nick,
Thanks for the response.

I think it was a gdb versioning issue.  The server was running a version (I
assume newer than my development box).

I put some pressure on the powers that be and I got gdb installed on the
high-traffic box (although I didn't attach gdb to the httpd process... just
used it to read the core dumps).  Using the same version of gdb to read the
trace seemed to fix whatever file format difference existed.

I found the source of the SegFaults and am on my way to fixing them.

Thanks again,
Dave


On 4/23/07, Nick Kew [EMAIL PROTECTED] wrote:


On Mon, 23 Apr 2007 13:19:40 -0500
David Wortham [EMAIL PROTECTED] wrote:

My problem is that I am getting core dumps (using the
 CoreDumpDirectory directive of the MPM module) but I can't read them
 with my version of gdb (I am running 6.3-5).  My specific error is:
 /home/.../core.pid is not a core dump: File format not recognized

What does file core.whatever tell you?  What you're saying sounds
a little implausible.

Any suggestions?

See the fatal exception stuff at
http://people.apache.org/~trawick/
for alternative diagnostic tools.


--
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/





--
David Wortham
Senior Web Applications Developer
Unspam Technologies, Inc.
1901 Prospector Dr. #30
Park City, UT 84060
(435) 513-0672


Bug report for Apache httpd-1.3 [2007/04/22]

2007-04-23 Thread bugzilla
+---+
| Bugzilla Bug ID   |
| +-+
| | Status: UNC=Unconfirmed NEW=New ASS=Assigned|
| | OPN=ReopenedVER=Verified(Skipped Closed/Resolved)   |
| |   +-+
| |   | Severity: BLK=Blocker CRI=CriticalMAJ=Major |
| |   |   MIN=Minor   NOR=Normal  ENH=Enhancement   |
| |   |   +-+
| |   |   | Date Posted |
| |   |   |  +--+
| |   |   |  | Description  |
| |   |   |  |  |
| 8329|New|Nor|2002-04-20|mime_magic gives 500 and no error_log on Microsoft|
| 8849|New|Nor|2002-05-07|make install errors as root on NFS shares |
| 8882|New|Enh|2002-05-07|[PATCH] mod_rewrite communicates with external rew|
| 9037|New|Min|2002-05-13|Slow performance when acessing an unresolved IP ad|
| 9126|New|Blk|2002-05-15|68k-next-openstep v. 4.0  |
| 9726|New|Min|2002-06-09|Double quotes should be flagged as T_HTTP_TOKEN_ST|
| 9894|New|Maj|2002-06-16|getline sub in support progs collides with existin|
| |New|Nor|2002-06-19|Incorrect default manualdir value with layout.|
|10038|New|Min|2002-06-20|ab benchmaker hangs on 10K https URLs with keepali|
|10073|New|Maj|2002-06-20|upgrade from 1.3.24 to 1.3.26 breaks include direc|
|10166|Opn|Min|2002-06-24|HTTP/1.1 proxy requests made even when client make|
|10169|New|Nor|2002-06-24|Apache seg faults due to attempt to access out of |
|10178|New|Maj|2002-06-24|Proxy server cuts off begining of buffer when spec|
|10195|New|Nor|2002-06-24|Configure script erroneously detects system Expat |
|10199|New|Nor|2002-06-24|Configure can't handle directory names with unders|
|10243|New|Maj|2002-06-26|CGI scripts not getting POST data |
|10354|New|Nor|2002-06-30|ErrorDocument(.htaccess) fails when passed URL wit|
|10446|Opn|Blk|2002-07-03|spaces in link to http server seen as foreign char|
|10666|New|Enh|2002-07-10|line-end comment error message missing file name  |
|10744|New|Nor|2002-07-12|suexec might fail to open log file|
|10747|New|Maj|2002-07-12|ftp SIZE command and 'smart' ftp servers results i|
|10760|New|Maj|2002-07-12|empty ftp directory listings from cached ftp direc|
|10939|New|Maj|2002-07-18|directory listing errors  |
|11020|New|Maj|2002-07-21|APXS only recognise tests made by ./configure |
|11236|New|Min|2002-07-27|Possible Log exhaustion bug?  |
|11265|New|Blk|2002-07-29|mod_rewrite fails to encode special characters|
|11765|New|Nor|2002-08-16|.apaci.install.tmp installs in existing httpd.conf|
|11986|New|Nor|2002-08-23|Restart hangs when piping logs on rotation log pro|
|12096|New|Nor|2002-08-27|apxs does not handle binary dists installed at non|
|12574|New|Nor|2002-09-12|Broken images comes from mod_proxy when caching ww|
|12583|New|Nor|2002-09-12|First piped log process do not handle SIGTERM |
|12598|Opn|Maj|2002-09-12|Apache hanging in Keepalive State |
|12770|Opn|Nor|2002-09-18|ErrorDocument fail redirecting error 400  |
|13188|New|Nor|2002-10-02|does not configure correctly for hppa64-hp-hpux11.|
|13274|Ass|Nor|2002-10-04|Subsequent requests are destroyed by the request e|
|13607|Opn|Enh|2002-10-14|Catch-all enhancement for vhost_alias?|
|13687|New|Min|2002-10-16|Leave Debug symbol on Darwin  |
|13822|New|Maj|2002-10-21|Problem while running Perl modules accessing CGI::|
|14095|Opn|Nor|2002-10-30|Change default Content-Type (DefaultType) in defau|
|14250|New|Maj|2002-11-05|Alternate UserDirs don't work intermittantly  |
|14443|New|Maj|2002-11-11|Keep-Alive randomly causes TCP RSTs   |
|14448|Opn|Cri|2002-11-11|Apache WebServer not starting if installed on Comp|
|14518|Opn|Nor|2002-11-13|QUERY_STRING parts not incorporated by mod_rewrite|
|14670|New|Cri|2002-11-19|Apache didn't deallocate unused memory|
|14748|New|Nor|2002-11-21|Configure Can't find DBM on Mac OS X  |
|15011|New|Nor|2002-12-03|Apache processes not timing out on Solaris 8  |
|15028|New|Maj|2002-12-03|RedirectMatch does not escape properly|
|16013|Opn|Nor|2003-01-13|Fooling mod_autoindex + IndexIgnore   |
|16236|New|Maj|2003-01-18|Include directive in Apache is not parsed within c|
|16241|New|Maj|2003-01-19|Apache processes takes 100% CPU until killed manua|
|16492|New|Maj|2003-01-28|mod_proxy doesn't correctly retrieve values from C|

Patch for implementing ap_document_root as a hook

2007-04-23 Thread Jakob Goldbach

Hi,

Attached is a patch which implements ap_document_root(r) as a hook.
This way modules can set document_root on the fly. (think vhost_alias)
AND get the right DOCUMENT_ROOT env. variable (as set by
ap_add_common_vars(r)).

The patch also changes ap_core_translate to use ap_document_root(r)
instead of conf-ap_document_root.  This way, modules that just need
to point to a different docroot won't have to implement a translate
hook by appending r-uri til r-filename, but just rely on
ap_document_root.

Comments ?

/Jakob
Index: server/core.c
===
--- server/core.c	(revision 530676)
+++ server/core.c	(working copy)
@@ -69,12 +69,16 @@
 
 APR_HOOK_STRUCT(
 APR_HOOK_LINK(get_mgmt_items)
+APR_HOOK_LINK(document_root)
 )
 
 AP_IMPLEMENT_HOOK_RUN_ALL(int, get_mgmt_items,
   (apr_pool_t *p, const char *val, apr_hash_t *ht),
   (p, val, ht), OK, DECLINED)
 
+AP_IMPLEMENT_HOOK_RUN_FIRST(const char *,document_root,
+			(request_rec *r), (r), NULL)
+
 /* Server core module... This module provides support for really basic
  * server operations, including options and commands which control the
  * operation of other modules.  Consider this the bureaucracy module.
@@ -682,7 +686,7 @@
: DEFAULT_CONTENT_TYPE;
 }
 
-AP_DECLARE(const char *) ap_document_root(request_rec *r) /* Don't use this! */
+AP_DECLARE(const char *) ap_core_document_root(request_rec *r)
 {
 core_server_config *conf;
 
@@ -3390,7 +3394,7 @@
 while (*path == '/') {
 ++path;
 }
-if ((rv = apr_filepath_merge(r-filename, conf-ap_document_root, path,
+if ((rv = apr_filepath_merge(r-filename, ap_document_root(r), path,
  APR_FILEPATH_TRUENAME
| APR_FILEPATH_SECUREROOT, r-pool))
 != APR_SUCCESS) {
@@ -3413,7 +3417,7 @@
 while (*path == '/') {
 ++path;
 }
-if ((rv = apr_filepath_merge(r-filename, conf-ap_document_root, path,
+if ((rv = apr_filepath_merge(r-filename, ap_document_root(r), path,
  APR_FILEPATH_TRUENAME
| APR_FILEPATH_SECUREROOT, r-pool))
 != APR_SUCCESS) {
@@ -3863,6 +3867,7 @@
 APR_OPTIONAL_HOOK(proxy, create_req, core_create_proxy_req, NULL, NULL,
   APR_HOOK_MIDDLE);
 ap_hook_pre_mpm(ap_create_scoreboard, NULL, NULL, APR_HOOK_MIDDLE);
+ap_hook_document_root(ap_core_document_root, NULL, NULL, APR_HOOK_REALLY_LAST);
 
 /* register the core's insert_filter hook and register core-provided
  * filters
Index: include/http_core.h
===
--- include/http_core.h	(revision 530676)
+++ include/http_core.h	(working copy)
@@ -148,11 +148,10 @@
 /**
  * Retrieve the document root for this server
  * @param r The current request
- * @warning Don't use this!  If your request went through a Userdir, or 
- * something like that, it'll screw you.  But it's back-compatible...
  * @return The document root
  */
-AP_DECLARE(const char *) ap_document_root(request_rec *r);
+AP_DECLARE(const char *) ap_core_document_root(request_rec *r);
+#define ap_document_root(r) ap_run_document_root(r)
 
 /**
  * Lookup the remote client's DNS name or IP address
@@ -629,6 +628,14 @@
 AP_DECLARE_HOOK(int, get_mgmt_items,
 (apr_pool_t *p, const char * val, apr_hash_t *ht))
 
+/**
+ * This hook allows modules to return customized documentroot
+ * @param r the current request
+ * @ingroup hooks
+ */
+AP_DECLARE_HOOK(const char*,document_root,(request_rec *r))
+
+
 /* -- */
 
 /* --


Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread Jakob Goldbach

It is now in bugzilla as  #42192

/Jakob


Re: DO NOT REPLY [Bug 42192] - Implementing ap_document_root as a hook

2007-04-23 Thread William A. Rowe, Jr.
[EMAIL PROTECTED] wrote:
 
 --- Additional Comments From [EMAIL PROTECTED]  2007-04-23 01:38 ---
 This patch changes the semantics of an existing API, so it'll randomly break
 things.  That's a no-no.

On what planet?  We can break things in 2.3 for 2.4 or 3.0.  Breakage
is good.  (I had other observations why this patch was a bad idea.)


Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread William A. Rowe, Jr.
Jakob Goldbach wrote:
 Hi,
 
 Attached is a patch which implements ap_document_root(r) as a hook.
 This way modules can set document_root on the fly. (think vhost_alias)
 AND get the right DOCUMENT_ROOT env. variable (as set by
 ap_add_common_vars(r)).
 
 The patch also changes ap_core_translate to use ap_document_root(r)
 instead of conf-ap_document_root.  This way, modules that just need
 to point to a different docroot won't have to implement a translate
 hook by appending r-uri til r-filename, but just rely on
 ap_document_root.

-1 on the face of things.  The map_to_storage hook was added to accomplish
what you desire.  Unfortunately it is not coupled to the DOCUMENT_ROOT
variable, but I'd look at remedying this over building on ap_document_root,
which should simply go away, IMHO.




Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread Jakob Goldbach

-1 on the face of things.  The map_to_storage hook was added to accomplish
what you desire.


I thought map_to_storage was made to do per-dir configuration. Not
path-translation.

The problem is not really doing the translation. I can always provide
my own translate handler in my module.

But in the current API I cannot to set my env. variables at will. They
will be overwritten by ap_add_common_vars which returns
carved-in-stone docroot from ap_document_root.

My only other option is to patch every single module which calls
add_common_vars, that is,  cgi,cgid, fastcgi, includes,...

I thought a document_root hook was more elegant. Or maybe a
add_common_vars hook? [I would be happy to supply it]


Unfortunately it is not coupled to the DOCUMENT_ROOT
variable, but I'd look at remedying this over building on ap_document_root,
which should simply go away, IMHO.


What's so bad about ap_document_root?  I know the source says 'dont
use' because it won't be right with mod_userdir etc. But with a hook
it would be possible to get right.

/Jakob


Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread Brian J. France


On Apr 23, 2007, at 10:32 AM, Jakob Goldbach wrote:

-1 on the face of things.  The map_to_storage hook was added to  
accomplish

what you desire.


I thought map_to_storage was made to do per-dir configuration. Not
path-translation.

The problem is not really doing the translation. I can always provide
my own translate handler in my module.

But in the current API I cannot to set my env. variables at will. They
will be overwritten by ap_add_common_vars which returns
carved-in-stone docroot from ap_document_root.


We need this same functionality (would like to back port to 2.2 if  
possible).


We currently hack the doc root in the post read hook in 1.3, would  
like to be able to do it with out hacking the core and screwing  
around with internal structs at runtime.


Brian





My only other option is to patch every single module which calls
add_common_vars, that is,  cgi,cgid, fastcgi, includes,...

I thought a document_root hook was more elegant. Or maybe a
add_common_vars hook? [I would be happy to supply it]


Unfortunately it is not coupled to the DOCUMENT_ROOT
variable, but I'd look at remedying this over building on  
ap_document_root,

which should simply go away, IMHO.


What's so bad about ap_document_root?  I know the source says 'dont
use' because it won't be right with mod_userdir etc. But with a hook
it would be possible to get right.

/Jakob




Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread Paul Querna

Brian J. France wrote:


On Apr 23, 2007, at 10:32 AM, Jakob Goldbach wrote:

-1 on the face of things.  The map_to_storage hook was added to 
accomplish

what you desire.


I thought map_to_storage was made to do per-dir configuration. Not
path-translation.

The problem is not really doing the translation. I can always provide
my own translate handler in my module.

But in the current API I cannot to set my env. variables at will. They
will be overwritten by ap_add_common_vars which returns
carved-in-stone docroot from ap_document_root.


We need this same functionality (would like to back port to 2.2 if 
possible).


We currently hack the doc root in the post read hook in 1.3, would like 
to be able to do it with out hacking the core and screwing around with 
internal structs at runtime.


+1, I've been down this road before too.

The problem is that many applications use DOCUMENT_ROOT.  I kinda think 
that they shouldn't, because the entire concept of an document root 
isn't very valid with Alias / Rewrite rules changing the path, but it 
doesn't change that people are using it.


Either we need to change ap_add_common_vars to allow overrides easier 
(and hopefully in a more generic way, for all environment variables), or 
we need to truly make it pluggable, like the path that this patch is 
going down.


I do have issues with how this patch does it, but its general direction 
isn't wrong.


-Paul


Re: [mod_wombat] Bug (and patch!) Tracking Logistics

2007-04-23 Thread Brian McCallister

On Apr 22, 2007, at 4:52 PM, Sander Temme wrote:


On Apr 22, 2007, at 2:00 PM, Brian McCallister wrote:

Should I pester folks to create a new httpd component in bugzilla  
(mod_wombat) or just track issues and patches as a separate  
project (and hence pester folks to set that up)?


I'd favor a new mod_wombat component under httpd-2.  However,  
should httpd and mod_wombat ever decide to part company, a separate  
'product' is more easily excised from Bugzilla.


Either works for me, I just want somewhere to start posting patches!


I can create either of these in Bugzilla.


Thanks!

-Brian


Re: bug with Apache 1.3 NetWare build system

2007-04-23 Thread Brad Nicholes
 On 4/19/2007 at 11:36 AM, in message
[EMAIL PROTECTED], Guenter Knauf
[EMAIL PROTECTED] wrote:
 Hi Brad,
 I've just found that we have same bug in the AP13 build system as what I 
 fixed long time ago with the AP2x build system already; in each 
 NWGNUmakefile.mak you can read: 
 #
 # These flags will be added to the link.opt file
 #
 XLFLAGS   += \
   $(EOLIST)
 
 but in fact the XLFLAGS dont go into the link.opt file but instead into the 
 link.def file.
 This does not work, and I'm unable to add additional libraries for 
 linking
 the following patch fixes this:
 
 --- NWGNUtail.inc.origWed Jul 12 10:16:06 2006
 +++ NWGNUtail.inc Thu Apr 19 19:25:24 2007
 @@ -220,7 +220,7 @@
   @echo -l $(REGEX)\$(OBJDIR)  $@
   @echo -l $(STDMOD)\$(OBJDIR)  $@
   @echo -l $(NWOS)\$(OBJDIR)  $@
 -#@echo -l $(METROWERKS)\Novell Support\Metrowerks 
 Support\Libraries\Runtime  
 $@
 +#@echo -l $(METROWERKS)\Novell Support\Metrowerks 
Support\Libraries\Runtime  $@
   @echo -l $(NWSDKDIR)\imports  $@
   @echo -l $(LDAPSDK)\Netware\clib\imports  $@
   @echo -nodefaults  $@
 @@ -240,6 +240,9 @@
  ifneq $(NLM_FLAGS) 
   @echo -flags $(NLM_FLAGS)  $@
  endif
 +ifneq $(strip $(XLFLAGS)) 
 + @echo $(strip $(XLFLAGS))  $@
 +endif
  ifneq $(strip $(FILES_nlm_objs)) 
   @echo $(foreach objfile,$(strip $(FILES_nlm_objs)),$(subst 
 /,\,$(objfile))) 
 $@
  endif
 @@ -262,9 +265,6 @@
  ifneq $(FILES_nlm_exports) 
   @echo Export $(foreach export,$(subst $(SPACE),$(COMMA),$(strip 
 $(FILES_nlm_exports))),$(subst /,\,$(export)))  
 $(OBJDIR)\$(NLM_NAME)_link.def
  endif
 -ifneq $(strip $(XLFLAGS)) 
 - @echo $(strip $(XLFLAGS))  $(OBJDIR)\$(NLM_NAME)_link.def
 -endif
  #ifndef XDCFOUND
  #@echo XDCData $(NWOS)\apache.xdc  $(OBJDIR)\$(NLM_NAME)_link.def
  #endif
 
 can we get this into the Apache 1.3 source tree?
 
 thanks, Guenter.

+1, go ahead and commit it.

Brad



Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread Akins, Brian
On 4/23/07 11:33 AM, Paul Querna [EMAIL PROTECTED] wrote:
 +1, I've been down this road before too.

+1 on the concept. Still looking at patch.

-- 
Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies


[RELEASE CANDIDATE] libapreq 1.34-RC1

2007-04-23 Thread Issac Goldstand
The apreq developers are planning a maintenance release of
libapreq1.  This version primarily addresses an issue noted
with FireFox 2.0 truncating file uploads in SSL mode.

Please give the tarball at

http://people.apache.org/~issac/libapreq-1.34-RC1.tar.gz

a try and report comments/problems/etc. to the apreq-dev list
at [EMAIL PROTECTED] 

Thanks,
  Issac


Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread William A. Rowe, Jr.
Brian J. France wrote:
 
 On Apr 23, 2007, at 10:32 AM, Jakob Goldbach wrote:
 
 -1 on the face of things.  The map_to_storage hook was added to
 accomplish what you desire.

 I thought map_to_storage was made to do per-dir configuration. Not
 path-translation.

Actually it does both.  An amusing use case is



 The problem is not really doing the translation. I can always provide
 my own translate handler in my module.
 But in the current API I cannot to set my env. variables at will. They
 will be overwritten by ap_add_common_vars which returns
 carved-in-stone docroot from ap_document_root.
 
 We need this same functionality (would like to back port to 2.2 if
 possible).
 
 We currently hack the doc root in the post read hook in 1.3, would like
 to be able to do it with out hacking the core and screwing around with
 internal structs at runtime.

I don't quite see this happening, but maybe.  If the docroot could be
cached from the translate_name/map_to_storage phase, you could obviously
abuse it as necessary.

 I thought a document_root hook was more elegant. Or maybe a
 add_common_vars hook? [I would be happy to supply it]

***ding ding ding*** - hooking add_common_vars is something I could get
behind.

 What's so bad about ap_document_root?  I know the source says 'dont
 use' because it won't be right with mod_userdir etc. But with a hook
 it would be possible to get right.

What is the docroot of http://example.com/user/webapp/login - is it the
path to /user/webapp/ or somewhere in the admin's htdoc?  I find the
concept fundamentally flawed :)



RFC: replace r-subprocess_env was Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread Akins, Brian
This idea has been rattling around in my head off and on for a while.  What
is we replaced all the r-subprocess_env with something a little more
interesting...

General environment API:

/*
directly set an env variable. Will always show up in env list
*/
apr_status_t ap_set_env(request_rec *r, const char *key, const char *val)

/*
Get the value of an env var.
*/
const char *ap_get_env(request_rec *r, const char *key

And the interesting ones:

/*
Set a handler for a given key for env variables.  Can choose whether or not
the key shows up in the list.
*/
apr_status_t ap_set_env_handler(constchar *key, ap_env_func *func, int
show_in_list)

/*
Return a list of available (exposed) env variables suitable for iteration
*/
apr_array_header_t *ap_env_list( request_rec *r, const char *key)

ap_env_func would be :
const char* my_env_handler(request_rec*r, const char* key)


This would allow most env variables to be overridden easily.  Also, many env
variables could be set lazily, ie, only calculate it when someone actually
needs it.  A good example of this is when you occasionally use UNIQUE_ID and
only want the calculation to be done when you actually need it, not on every
single request.

The handler could cache it's results if it wanted.  We may want a flag to
say cache is okay or not. Or do caching in env itself...

The actually handler, could actually be a hook.  For example, the handler
for DOCUMENT_ROOT could actually be a wrapper around a hook.

Thoughts?


-- 
Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies


Re: Patch for implementing ap_document_root as a hook

2007-04-23 Thread William A. Rowe, Jr.
William A. Rowe, Jr. wrote:
 Brian J. France wrote:
 On Apr 23, 2007, at 10:32 AM, Jakob Goldbach wrote:

 -1 on the face of things.  The map_to_storage hook was added to
 accomplish what you desire.
 I thought map_to_storage was made to do per-dir configuration. Not
 path-translation.
 
 Actually it does both.  An amusing use case is

...not the one I was thinking of, this one is more fun... jump to the
ftp_cmd_rnto(...) implementation in

http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c?revision=522706view=markup