Switch ap_http_filter to use ap_get_brigade and apr_brigade_flatten
instead of ap_getline - this prevents some odd looping issues that
can cause problems.
Also, when we call get_mime_headers to read the trailers, we need
to reset our ctx->state to BODY_NONE - there should only be MIME-header
information (followed by a blank CRLF line) - and we don't know
how much data there will be - so it is by definition BODY_NONE.
Simplify last commit by only calling cat once (this should hopefully resolve
rbb's concern about maintainability and still address mine about annoying /s).
Don't call mkdir when we are the top-level directory. We *have* to have
been created before hand.
Replace this bogus check with something that actually works. I have no
idea what this line is attempting to do, but it doesn't work in the
top-level Makefile - causing an error. Therefore, take the line we use
in APR to check if a file exists.
The pedant in me wishes to see all extraneous trailing / go away.
So, if we are in the top-level makefile, don't add an extra trailing
slash to srcdir, builddir, or VPATH. It's annoying.
Bill Stoddard [Wed, 17 Apr 2002 18:52:32 +0000 (18:52 +0000)]
Fix seg fault when garbage collecting an expired entry. remove_entity
should just remove the object from the cache and set the cleanup flag
in the object. decrement_refcount will clean the object up when the refcount
goes to zero.
Experimental patch that may mitigate (but not eliminate) the errors in
[crit] (32538)An operation was attempted on something that is not a socket.
: Parent: WSADuplicateSocket failed for socket ...
if the particular stacks' bug is that it won't associate a handle as a
socket if that handle was duped with DuplicateHandle(). Other bugs with
unimplemented WSADuplicateSocket are not addressed by this patch.
Introduced -E startup_logfile_name option to httpd to allow admins
to begin logging errors immediately. This provides Win32 users
an alternative to sending startup errors to the event viewer, and
allows other daemon tool authors an alternative to logging to stderr.
Jeff Trawick [Wed, 17 Apr 2002 15:45:27 +0000 (15:45 +0000)]
use an independent pool for threads so that when we abandon them
during graceless termination the cleanups on pchild won't mess with
stuff they are still referencing
Brian Havard [Wed, 17 Apr 2002 14:55:20 +0000 (14:55 +0000)]
When an exception in a worker thread initiates a child shutdown, get things
moving sooner by sending a SIGHUP to the accept thread, breaking it out
of its accept/poll.
Fix subreqs with non-defined Content-Types being served improperly.
If we do not know a C-T for a subreq, we *must* propogate that
non-knowledge upwards to the main request.
Previously, if you used a DirectoryIndex with a file without a C-T (say
.shtml without AddType), the r->content_type will be kept as
httpd/unix-directory when we promoted the subreq in mod_dir. Since there
would be no handler on this file, ap_invoke_handler (config.c:355) would
set the handler to be httpd/unix-directory (which was the old C-T of the
dir). This would then trigger the handler to become httpd/unix-directory.
mod_autoindex would then try to serve the request. But, the filename
was propogated upwards by mod_dir's DirectoryIndex via
internal_fast_redirect - it would then return a 403 trying to generate a
mod_autoindex page for a file.
Now, we will use ap_default_type() which is correct.
Tired of 'foo.h not found' messages in the build. Checked ms's docs,
seems xcopy's /y arg goes all the way back to Win95. This shouldn't
introduce any hassles.
Brian Pane [Tue, 16 Apr 2002 23:37:06 +0000 (23:37 +0000)]
Another experimental MPM derived from worker:
The threadpool MPM implements Aaron Bannert's "time-space tradeoff"
design managing idle workers. Rather than putting accepted connections
into a queue, the threadpool MPM keeps idle worker threads in a stack.
Its dedicated listener thread retrieves an idle worker from the stack
before accepting a connection. If there are no idle workers, the
listener blocks until a worker becomes available before doing an accept.
In many ways, threadpool is also a variant of leader/follower. They
both maintain a stack of idle threads. The difference is that threadpool
has a dedicated listener thread, and leader/follower rotates the listening
responsibility among its worker threads. In my initial testing, the
leader/follower MPM performs very well on multiprocessor Solaris 8 when
listening on a single port, but poorly when listening on multiple ports.
(I don't know why this is happening. What I've found so far is that
when you add a poll on the listen socket(s) before the accept in the
leader/follower MPM, all the socket-related syscalls in the httpd get
slower. My hypothesis is that the thread scheduler is making an optimal
decision about where (on what CPU) to run the newly awakened thread if
its first syscall is an accept, and a nonoptimal decision if its first
syscall is a poll.) The threadpool MPM performs better with multiple
listener ports, and in my testing so far it looks competitive with
leader/follower when running with a single listener.
Merge in latest GNU config.guess and config.sub files. Synchronize all
config.guess/config.sub files to be identical. Previously, we had three
different versions of the guess files - now they are the same.
I attempted to merge in ASF changes that were marked and still needed.
Please verify that these work on your platform. (Particular attention
is required for the IBM platforms.)
Part of PR 7818 stems from the fact that the bundled expat did not have an
included config.guess/config.sub. Therefore, it would take the config.guess
from the system. Icarus's autoconf/libtool is very old (2.13/1.3.5). The
machine that was used to roll 2.0.32 had a recent autoconf/libtool which
explains the behavior that Sander saw in the PR. Therefore, we now
explicitly provide a config.guess/.sub for the bundled expat so that
all of the versions are in sync. This should minimize configuration
problems.
pcre was using a config.guess that was imported when Brian made the 3.9
import. It did not have the Apache modifications, but seems to have
had the Darwin changes. Go figure. Sync it up as well.
PR: 7818
Obtained from: GNU FSF - ftp.gnu.org/gnu/config
worker is not the default Unix MPM. [This statement has been in the docs
ever since this was copy-and-pasted from the threaded MPM documentation,
and threaded *was* the default at one point.]
Move 100 - Continue support to the HTTP_IN filter so that filters
are guaranteed to support 100 - Continue logic without any
intervention.
This requires some reshuffling of the code in http_protocol.c so
that some static declarations are available early enough in the
code so that ap_http_filter can access them.
Note that we can not read the chunk until after (possibly) sending the
100.
Adds support for reading trailers on input by exporting get_mime_headers
to ap_get_mime_headers and calling it in the appropriate place in
ap_http_filter.
ap_send_error_response: reset r->output filters to the protocol filters.
The equivalent logic was deleted when request filters were renamed to
RESOURCE filters. This fixes the seg faults that sometimes happen on
daedalus after a bogus 416 HTTP response is generated.
In this case, includes_filter had found an <!--#include virtual > tag, and
sent a brigade representing the data before it down the filter chain. The
byterange filter generated the bogus 416. ap_send_error_response essentially
starts over with a new response, but it didn't do anything to clean up the
filter chain. So the same instance of the includes_filter got driven from the
top with the canned error text and and EOS bucket, which confused the heck
out of it. It inserted a sentinel from the original brigade into the
error page brigade, causing problems further down the filter chain.
would get a 400. RFC 2616 specifically allows for a "blank" host field.
The read_request code properly handled this, but the fix_hostname in
vhost.c would cause the 400. Now, simply return in fix_hostname when
we see a blank hostname rather than erroring out.
Brian Havard [Sun, 14 Apr 2002 08:38:15 +0000 (08:38 +0000)]
Get local address info in listener sockets initialized when constructed in
the child process from a descriptor passed from the parent. This fixed vhost
address matching.
If we have a registry command or a shebang line invocation, correct the
invocation type to APR_PROGRAM_PATH so we will both search the path, and
accept undecorated names, e.g. "perl" should be acceptable for "perl.exe".
In order for Win32 to accept the shebang line of #!perl so we 1) search
the PATH and 2) resolve perl.exe for perl, we must add the progtype so
we can override APR_PROGRAM with APR_PROGRAM_PATH. This is the API change
only for the cgi build command line option function.
Correct const'ness of argv in all support apps, and use the new
apr_app_initialize over apr_initialize for win32, and other platforms
that may wish to tweak 'apr-ized' application support (e.g. Netware?)
Readjustment of where the bucket is being allocated now that they are being
cleaned up. Need to move the call to after apr_pool_clear() so that it doesn't
get cleanup too soon and never reallocated.
Jeff Trawick [Fri, 12 Apr 2002 19:58:52 +0000 (19:58 +0000)]
worker MPM: Fix a situation where a child exited without releasing
the accept mutex. Depending on the OS and mutex mechanism this
could result in a hang.
Touch these files so that their datestamps are newer than the corresponding
.y and .l files. These must be kept newer than those at all times to avoid
introducing a dependency on flex and yacc.
Flip the order. If the user specifies ScriptInterpreterSource,
either Registry or RegistryStrict, test the registry in preference
over a shebang line. This is how 1.3 behaved, and allows scripts
with invalid shebang lines (straight from another box, for example)
to run without modification.
Change httpd.pid placement to rel_runtimedir instead of rel_logfiledir.
With the standard apache layout, this changes nothing (since runtimedir ==
logfiledir), but for other layouts, this makes a lot more sense.
Bill Stoddard [Wed, 10 Apr 2002 17:02:00 +0000 (17:02 +0000)]
The accept loop was sleeping way too long when we ran out of completion contexts.
All that is really necessary is that the accept look yield the rest of its time slice
when this condition is hit.
Bill Stoddard [Wed, 10 Apr 2002 14:52:38 +0000 (14:52 +0000)]
Move the socket info initialization into the winnt_accept() loop (this more closely
follows Apaches socket abstraction design principles). Made similar change to
Win9x code to keep that OS working. Reuse the ptrans pool across transactions.
Jeff Trawick [Tue, 9 Apr 2002 11:18:41 +0000 (11:18 +0000)]
move a loop-invariant computation out of the thread loop and
at the same time quiet a gcc warning (it assumed that thread_limit
could be zero, which would leave ps_record uninitialized when
referenced after the end of the thread loop)
Graham Leggett [Tue, 9 Apr 2002 09:39:04 +0000 (09:39 +0000)]
Proxy was bombing out every second keepalive request, caused by a
stray CRLF before the second response's status line. Proxy now
tries to read one more line if it encounters a CRLF where it
expected a status.
PR: 10010
Obtained from:
Submitted by:
Reviewed by: