After this config file is parsed, the only statement in the config
tree is the last statement in the IfModule container ("RewriteRule blah
blah").
The problem is that when ap_build_config_sub() handles this type of
construct, it moves *current to the end of the list before returning.
If this construct were the first thing in the file, the caller would
set conftree to *current, not realizing that there were list elements
before *current. The caller doesn't have addressability to those list
elements.
With this change, ap_build_config_sub() sets *conftree before
walking *current to the end of the list.
Ryan Bloom [Fri, 4 Aug 2000 07:07:33 +0000 (07:07 +0000)]
Fix the Perchild MPM. This does work now. This change has us using
socketpair instead of sockets created with AF_UNIX. There is very little
chance this will work anywhere other than Linux, but it is a start. I
have a machine with two virtual hosts, which are started as two different
users. When I make requests for each virtual host, they pass the request
to the correct child process. It is possible for a virtual host to have
multiple child processes all with the same user ID, and they all share
the responsability for answering requests.
There are a lot of bugs in this code, and it is not for the faint
hearted, but it works, and that's saying quite a bit in my mind.
Docs coming tomorrow. Right now, it's time to sleep.
Jeff Trawick [Fri, 4 Aug 2000 02:25:08 +0000 (02:25 +0000)]
Disable the dbm_ usage in mod_rewrite so that it links.
Still to do: decide at config time whether any modules need dbm, whether
to use the native one or sdbm, etc.
Ryan Bloom [Fri, 4 Aug 2000 00:21:07 +0000 (00:21 +0000)]
More progress with the perchild MPM. This is serving pages again, but
only when the request is accepted by the server that supposed to serve the
result. The biggest problem right now is descriptor passing. This isn't
likely to work anyplace other than Linux right now either.
Ryan Bloom [Wed, 2 Aug 2000 17:55:26 +0000 (17:55 +0000)]
Update the perchild MPM. This does not work, but that is because Linux
doesn't use any of the standard methods for passing around file
descriptors. I am setting this aside for a day or two, and then I will
come back and finish the implementation on a new OS. This is highlighting
the need for descriptor passing in APR.
Ryan Bloom [Tue, 1 Aug 2000 18:58:19 +0000 (18:58 +0000)]
Complete redesign of this MPM. This is almost working now.
HOW IT WORKS:
In the config file, the sysadmin specified:
ChildPerUserID uid gid num_processes
and in each virtual host:
AssignUserID uid gid
The MPM creates a unix domain socket for each uid/gid pair, and if any
child processes are left over, one for the default user and group
specified in the main config.
When a child process is started, it looks at what it's user id and group
id are supposed to be. It then inserts the correct socket into it's
listen array, and switches to the uid and gid specified.
When a request comes in, whichever child gets the request looks at which
child process it is actually for, and if it isn't for the current
process, the request gets forwarded through the unix domain socket to the
correct child process. From there, processing continues normally.
Currently, no requests are forwarded, but everything seems to be working.
Ryan Bloom [Tue, 1 Aug 2000 17:36:13 +0000 (17:36 +0000)]
Add a NO_DETACH environment variable to all MPMs that understand
ONE_PROCESS. This allows Apache to start up without detaching from
the controlling terminal, but also not going into single process mode.
The main purpose of this patch is to make it very easy to debug the
child process startup code.
PR: 2144
Ken Coar [Tue, 1 Aug 2000 17:06:20 +0000 (17:06 +0000)]
Put back PR#6347, but note that it's waiting for an external
entity. Add a 'Status:' line for each PR, but don't remove
any -- because if they're not in STATUS, they essentially
don't exist. If we're not serious about dealing with them,
let's just close them. If we *are* serious, they should be
in the work-to-do list.
Ken Coar [Tue, 1 Aug 2000 15:56:07 +0000 (15:56 +0000)]
We've been ignoring lots of PRs forever, marking them as
'suspended' with the supposed intention of either implementing
them someday or saying why not. Well, it's about time we did
something with them, so now they're listed in STATUS for people
to work on as they may.
Jeff Trawick [Mon, 31 Jul 2000 17:22:01 +0000 (17:22 +0000)]
Include <strings.h> if we have it to get protos for strcase* on AIX.
Submitted by: Victor J. Orlikowski <vjo@raleigh.ibm.com>
Reviewed by: Jeff Trawick
Jeff Trawick [Mon, 31 Jul 2000 15:39:19 +0000 (15:39 +0000)]
Fix some problems with which error code to use after a pthread_ failure.
Most of the changes added support for PTHREAD_SETS_ERRNO; a few of the
changes fixed bugs in existing code which always used errno (which
doesn't get the right error code on most platforms).
Jeff Trawick [Sun, 30 Jul 2000 23:06:57 +0000 (23:06 +0000)]
Get dsos working again by including $(LTFLAGS) on the command-line for
the --mode=link invocations of libtool/shlibtool. The lack of LTFLAGS
resulted in no -export-dynamic, and dsos couldn't resolve symbols in
httpd.
LTFLAGS was lost in the 1.23 revision of rules.mk.
Change semantics of ap_child_table somewhat. Instead of checking for a
dead process with status == SERVER_DEAD, check with pid == 0. This
makes somewhat more sense conceptually, and also matches the behavior
of MPMs that use a shmem scoreboard to track children.
Ryan Bloom [Sat, 29 Jul 2000 21:05:40 +0000 (21:05 +0000)]
Begin to document http_config.h. This documents most (if not all) of the
structures defined by this header file. The functions will be the next
thing that needs documenting.
Ryan Bloom [Sat, 29 Jul 2000 16:24:15 +0000 (16:24 +0000)]
Remove iol_socket.h. This file had one declaration, and it makes more
sense for that declaraion to move to ap_iol.h. This also modifies all of
the files that include iol_socket.h to include ap_iol.h
Ryan Bloom [Sat, 29 Jul 2000 07:29:48 +0000 (07:29 +0000)]
Associate virtual hosts with a specific child process. This doesn't
work quite yet. The problem right now is that the thread doesn't really
have the logic required to pass the request to the next child process.
Jeff Trawick [Sat, 29 Jul 2000 03:08:13 +0000 (03:08 +0000)]
Change the storage allocation mechanism for ap_proc_t structures
passed to ap_note_subprocess() by mod_rewrite and mod_include. The
storage needs to last as long as the pool passed to
ap_note_subprocess(), so autodata won't work.
The mod_rewrite change wasn't tested. A normal build with mod_rewrite
on Linux currently results in the link failing due to unresolved
references to dbm_*.
Ryan Bloom [Fri, 28 Jul 2000 20:31:02 +0000 (20:31 +0000)]
Add the ability to register filters. This commit introduces a warning
into the build. This warning will be removed automatically, as soon as
we decide on a prototype for the function causing the warning. That
decision is tied to which filtering mechanism we decide on.
Submitted by: Ryan Bloom and Greg Stein
Ryan Bloom [Fri, 28 Jul 2000 19:34:39 +0000 (19:34 +0000)]
Cleanup the perchild MPM. What I am doing so far in this MPM does not
require hashes. This makes it much easier to now associate the child
process with a virtual host.
Jeff Trawick [Fri, 28 Jul 2000 18:15:21 +0000 (18:15 +0000)]
Use ap_note_subprocess() to register the mod_cgid daemon process for cleanup
so that it is killed at termination if it does not die when the parent gets
SIGTERM. This change is to fix occasional problems where the process stays
around.
Ryan Bloom [Fri, 28 Jul 2000 17:45:13 +0000 (17:45 +0000)]
Update the perchild MPM. At this point, it is possible to specify that
a child process runs as a specified user. That child process is not
currently tied to a virtual host. Using this MPM, I can launch Apache
and have it serve as both nobody and rbb.
Bill Stoddard [Thu, 27 Jul 2000 18:42:39 +0000 (18:42 +0000)]
Win32: Revamp NT shutdown code. I think this shutdown code is pretty close
to production ready. Introduce a two-phase shutdown. First phase is
shutdown_pending which prevents new contexts from being queued to the
AcceptEx completion port. The server runs for a period (~1 second)
in this state to enable threads to drain the completion port of active
connections by handling the connections. This works very well on a busy
server as the contexts are consumed quickly and completely (leaving non
to cancel in the next phase).
The next phase is the workers_may exit phase, which prevents threads
from blocking on the completion port (especially important to prevent
threads unblocking off of keep-alive connections from calling
GetQueuedCompletionStatus). One we enter this phase, all threads blocked on the
port (we track the number carefully) are unblocked and allowed to exit.
Then we cancel any pending i/o completion contexts on the listeners (those which
were not consumed naturally in the shutdown phase). Then we reap the ABORTED
completion packets off the port. (Possible to reap a few good "accepted"
connections here also. Oh well...). Once we are done reaping completion packets,
we release the start mutex which allows the new child (in a restart) to
begin accepting connections.
It is really REALLY important to not let multiple processes call
GetQueuedCompletionStatus at the same time. Results are unpredictable.
Another day's progress... little changes, but just establishing the
baseline for fully implementing extensions. Filters... that's still
a little way away. This demonstrates the HSE_STATUS_PENDING result
wait event trap, so we let another thread keep working till we get
the HSE_REQ_DONE_WITH_SESSION request. Cleaned up callback names
and tossed bunches of stuff in the isapi_cid (connection/request) and
the isapi_loaded (dll details) for future caching optimizations.
Ryan Bloom [Thu, 27 Jul 2000 00:16:32 +0000 (00:16 +0000)]
Add a new MPM. Currently this is almost an exact copy of the dexter MPM.
In time, this will be the MPM that allows each child process to have a
unique user id. I need a place to work and keep track of my changes.
Don't expect this to work until next week sometime.
Ryan Bloom [Thu, 27 Jul 2000 00:04:11 +0000 (00:04 +0000)]
Cleanup the MPM #defines. Each MPM #defines a unique name that identifies
it to the system. That name should be of the format NAME_MPM where name
is something like DEXTER, MPMT_PTHREAD, SPMT_OS2, etc.
Jeff Trawick [Wed, 26 Jul 2000 18:07:34 +0000 (18:07 +0000)]
Fix some build issues for dexter:
. dexter/scoreboard.c needed apr_strings.h to get the right
function prototypes
. main/mpm_common.c needed to recognize that we were building
for dexter; otherwise, no ap_reclaim_child_processes() was
compiled and linking failed
(It would be nice to standardize on which preprocessor symbols
are checked for... mpmname_MPM seems nice enough. Didn't the
check for symbol mpmname (no "_MPM") come with mpmt.c?)
Ryan Bloom [Wed, 26 Jul 2000 15:31:30 +0000 (15:31 +0000)]
Remove all of the ap_is* functions from Apache. They were already in APR,
and we all hate duplicate code. :-) This also required adding ap_isascii
to APR.
Jeff Trawick [Wed, 26 Jul 2000 14:29:34 +0000 (14:29 +0000)]
packet minimization when doing sendfile...
When preparing to call iol_sendfile(), don't call ap_bflush() first.
Instead, pass the data ap_bflush() would have written (if any) to
iol_sendfile() as a header. In practice, this prevents sending headers
separately from the first part of the file.
Submitted by: Greg Ames
Reviewed by: Jeff Trawick
Ryan Bloom [Wed, 26 Jul 2000 13:48:17 +0000 (13:48 +0000)]
Fix an error in service.c, where we were returning APR_NOTFOUND and
should have been return APR_ENOFILE
Submitted by: Gregory Nicholls <gnicholls@level8.com>
Reviewed by: Ryan Bloom
Ryan Bloom [Wed, 26 Jul 2000 13:45:01 +0000 (13:45 +0000)]
The Windows MPM was sometimes returning APR_NOTFOUND when it should
have been returning APR_ENOFILE. This fixes that problem.
Submitted by: Gregory Nicholls <gnicholls@level8.com>
Reviewed by: Ryan Bloom
- fix POOL_DEBUG ... restored the ap_pool_joins that dreid removed.
- removed the apr_abort foo since every caller was passing it NULL anyway;
and this is debugging code, so i don't have any qualms about using
stderr or abort().
Ryan Bloom [Tue, 25 Jul 2000 23:48:21 +0000 (23:48 +0000)]
REmove the mpmt MPM. This also removes all of the config logic required
to get this MPM to compile. I may try to combine the two threading MPMs
a bit more, or I may not.
Ryan Bloom [Tue, 25 Jul 2000 20:08:12 +0000 (20:08 +0000)]
Change --enable-shared that Apache defines to --enable-mods-shared. The
original name was conflicting with an option for ./configure that libtool
defines automatically.
Ryan Bloom [Tue, 25 Jul 2000 05:35:34 +0000 (05:35 +0000)]
Remove EXEC_ON_READ from ClearModuleList and AddModule. Having these
as EXEC_ON_READ was causing a seg fault, and it was unnecessary. Neither
of these directives changes how the server interprets the config file,
they only change how the server responds to the configuration.
PR: 6318
This should be clean... ap_snprintf already holds a byte for the
null terminator, and this patch sets aside whatever space is needed
for the newline termination.
Add APR_EOL_STR for a platform specific text delimiter, provided by
apr.h (defined in apr.h.in and apr.hw). This is needed -only- in APR
created files (true raw files) such as logs. It is not required in any
splat to screen (stderr/stdout) formatting, nor any html markup.
Some other modules slipped through in the prior apr_strings.h commit.
Sorry 'bout that.
Changes to get Win32 compiling again, including substituting
apr_string.h for apr_lib.h, fix some bad linkage declarations,
and some more comments on threadproc/win32/proc.c
Ryan Bloom [Mon, 24 Jul 2000 20:48:24 +0000 (20:48 +0000)]
Fix some issues with mod_mime_magic. Basically, we need to include
apr_strings.h, the command table needed to be fixed to use the new
format, and we had vestiges of stat left around.
The top two issues are simple, we include apr_strings and fix the command
recs.
The last issue required using APR enums instead of the stat.h macros. This
also allows us to remove some ugly #ifdefs. :-)
Submitted by: Shaun Savage <shaun@igel.de>
Reviewed by: Ryan Bloom