Release the accept mutex after receiving the shutdown signal
in single-process mode. (That isn't a critical step, but
neatness counts.)
Submitted by: rpleum
prefork: Fix child process hang during graceful restart/stop in
configurations with multiple listening sockets.
PR: 42829
Submitted by: Joe Orton, with some tweaking and testing from me
Reviewed by: trawick, rpluem, jorton, pgollucci
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@739608 13f79535-47bb-0310-9956-ffa450edef68
CGI: return 504 (Gateway timeout) rather than 500 when a script
times out before returning status line/headers.
PR 42190
Improve canned 504 error message in the light of r729586 and covener's comment.
Submitted by: niq
Reviewed/backported by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@733757 13f79535-47bb-0310-9956-ffa450edef68
As jorton discovered, recent Linux kernels have a new tunable
setting for epoll that will trip up many prefork users. Write
a log message instead of crashing.
As rpluem notes, some Apache doc is in order.
PR: 46467
Submitted by: trawick
Reviewed by: rpluem, covener, trawick
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@733698 13f79535-47bb-0310-9956-ffa450edef68
*) Set Listen protocol to "https" if port is set to 443 and no proto is specified
(as documented but not implemented). PR 46066 [Dan Poirier <poirier pobox.com>]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@727769 13f79535-47bb-0310-9956-ffa450edef68
* Avoid sending no answer at all if a custom error page causes an
AP_FILTER_ERROR.
* allow ap_invoke_handler() to pass-through AP_FILTER_ERROR as if it were
a reserved status code (OK/DECLINED/SUSPENDED). Prevents ap_die() from seeing a
500 error when the http header filter has already taken care of the proper
error response
* To be safe, consume the entire brigade after processing an error bucket in
the HTTP output filter.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@722642 13f79535-47bb-0310-9956-ffa450edef68
Fix MaxRequestsPerChild on the Event MPM. It hasn't worked for 4 years.
* server/mpm/experimental/event/event.c
(process_socket): Be consistent about our return value, returning 0
means this connection is done, and that we can decrement requests_this_child.
Submitted by: pquerna
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@720196 13f79535-47bb-0310-9956-ffa450edef68
* Recheck again if idle workers are still available when we are signaled that
they are. This is needed since it can happen that we are signaled by a
worker thread that went idle but received a context switch before it could
tell us. If it does signal us later once it is on CPU again there might be
no idle worker left. See
https://issues.apache.org/bugzilla/show_bug.cgi?id=45605#c4
PR: 45605
Submitted by: Denis Ustimenko <denusk gmail.com>
Reviewed by: rpluem, jim, gregames
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@705872 13f79535-47bb-0310-9956-ffa450edef68
core: Fix address-in-use startup failure on some platforms caused
by attempting to set up an IPv4 listener which overlaps with an
existing IPv6 listener.
The failure occurred on the second pass of the open-logs hook in
a configuration such as the following:
Listen 8080
Listen 0.0.0.0:8081
Listen [::]:8081
During the first pass, the two port 8081 listen recs were
adjacent and existing logic prevented binding to 0.0.0.0:8081.
On the second pass, they were not adjacent and we then tried
to bind to 0.0.0.0:8081, leading to failure on some platforms
(seen on SLES 9 and Ubuntu 7.10, not seen on many other Unix-ish
platforms).
Leave a note about other unhandled configurations.
Submitted by: trawick
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@664705 13f79535-47bb-0310-9956-ffa450edef68
stdout channel; do not close stdout in the parent process or reassign it to
\\Device\Null, but keep it open so that the console signal handler continues
to interact with the running "daemonized" httpd process.
Not committed to httpd-2.x; there is disagreement as to whether this is good
behavior for a daemon, and the proper 2.4(3.0) behavior on Win32 may be to
daemonize but properly handle -k stop by the PID file contents. Many have
asked for this feature who run a minimal httpd.exe, especially from some
removeable media such as CD, and wish to be able to halt it as a console.
PR: 44800 (part 3/3)
Submitted by: tdonovan
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@663704 13f79535-47bb-0310-9956-ffa450edef68
even on a restart, because some modules (e.g. mod_perl) might have set a console
handler to terminate the process.
PR: 44800 (part 1/3)
Submitted by: tdonovan
Backports: r663669
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@663670 13f79535-47bb-0310-9956-ffa450edef68
* Add the filename of the configuration file to the warning message
about the useless use of AllowOverride.
PR: 39992
Submitted by: Darryl Miles <darryl darrylmiles.org>
Reviewed by: rpluem, jim, pquerna
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@662566 13f79535-47bb-0310-9956-ffa450edef68
* server/mpm/prefork/prefork.c (child_main): If apr_pollset_poll()
fails with EINTR and die_now has been set (indicating a graceful
stop/restart), terminate the child quickly rather than re-entering
poll().
Submitted by: jorton
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@662014 13f79535-47bb-0310-9956-ffa450edef68
* server/mpm/prefork/prefork.c (child_main): Unlock the mutex before
terminating in the multi-listener poll error path.
Submitted by: jorton
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@662013 13f79535-47bb-0310-9956-ffa450edef68
* server/mpm/prefork/prefork.c (child_main): Stop processing new
connections if shutdown_pending is set, i.e. when SIGTERM is received
in single-proecss mode.
Submitted by: Garrett Rooney <rooneg apache.org>
PR: 38848
Submitted by: jorton
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@662012 13f79535-47bb-0310-9956-ffa450edef68
* Do not allow all options of ALL to be set when only a few of them are
allowed.
PR: 44262
Submitted by: Micha?\197?\130 Grz?\196?\153dzicki <lazy iq.pl>
Reviewed by: rpluem
Submitted by: rpluem
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@660585 13f79535-47bb-0310-9956-ffa450edef68
r605838 from trunk:
* Enable the proxy to keep connections persistent in the HTTPS case.
Basicly the persistence is created by keeping the conn_rec structure
created for our backend connection (whether http or https) in the connection
pool. This required to adjust scoreboard.c in a way that its functions can
properly deal with a NULL scoreboard handle by ignoring the call or returning
an error code.
* Use a separate subpool to manage the data for the socket and the connection
member of the proxy_conn_rec struct as we destroy this data more frequently
than other data in the proxy_conn_rec struct like hostname and addr (at least
in the case where we have keepalive connections that timed out and were
closed by the backend).
This fixes a memory leak with short lived and broken connections.
* Fix another memory leak related to PR 44026. Now that we keep the connection
data structure alive in the reslist, the live time of c->pool is too long.
r->pool has the correct live time since rp dies before r.
* Do not register connection_cleanup as cleanup for the conn->pool. In the past
it was needed to register connection_cleanup as a cleanup for the frontend
connection memory pool (c->pool) to ensure that connection returns into the
connection pool if the memory pool of the frontend connection memory pool
gets destroyed / cleared. Now we ensure explicitly the connection returns
to the connection pool once we finished handling the request.
* Tag the pools appropriately to ease memory debugging.
* Only sent a flush bucket down the chain if buckets where sent down the chain
before that could still be buffered in the network filter. This is the case
if we have sent an EOS bucket or if we actually sent buckets with
data down the chain. In all other cases we either have not sent any
buckets at all down the chain or we only sent meta buckets that are
not EOS buckets down the chain. The only meta bucket that remains in
this case is the flush bucket which would have removed all possibly
buffered buckets in the network filter.
If we sent a flush bucket in the case where not ANY buckets were
sent down the chain, we break error handling which happens AFTER us.
* Using the reslist pool for the proxy_conn_rec structure introduces a memory
leak when connections get created and destroyed frequently by the reslist
(e.g. destroying idle elements of the reslist). So use the subpool
dedicated for the proxy_conn_rec structure to allocate the memory for the
structure itself.
PR: 44026, 44543
Submitted by: rpluem
Reviewed by: jim, rpluem, fielding
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@657440 13f79535-47bb-0310-9956-ffa450edef68
gen_test_char: add double-quote to the list of T_HTTP_TOKEN_STOP.
PR: 9727
Submitted by: Ville Skytt <ville.skytta iki.fi>
Submitted by: fielding
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@656000 13f79535-47bb-0310-9956-ffa450edef68
Worker MPM: fix race condition
PR44402: reported and fixed by Basant Kumar Kukreja
* Second part of fix for PR 44402:
- Fix the same race condition in event MPM.
- Slightly optimize code in worker MPM by removing the need for an additional
dereference operation.
- Do some word smithing on the CHANGES entry.
PR: 44402
Submitted by: Basant Kumar Kukreja <basant.kukreja sun.com>
Reviewed by: rpluem
* Add hint to PR in comment. No functional change.
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@631362 13f79535-47bb-0310-9956-ffa450edef68
to /Device/Nul as the server is starting up, mirroring unix MPM's.
PR: 43534
Submitted by: Tom Donovan <Tom.Donovan acm.org> and William Rowe
Backports: r609354, r609366
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@609712 13f79535-47bb-0310-9956-ffa450edef68
by recreating the bucket allocator each time the trans pool is cleared.
PR: 11427 #16 (follow-on)
Submitted by: Tom Donovan <Tom.Donovan acm.org>
Backport: r609181
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@609183 13f79535-47bb-0310-9956-ffa450edef68
child's read end for a reliable piped logger. The child runs
and manages it's own logs, and even if the parent did instead,
the mpm would be adjusted to pass down the child write ends
without read ends to the pipes, so this forever makes no sense.
Backport: r607666
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@607667 13f79535-47bb-0310-9956-ffa450edef68
Prevent 1-byte overflow on 8192 boundary (see PR 43310)
Alternate fix... profiling indicates that the string
termination is completely unneeded and superflous. In
which case, the original allocation size is sufficient
since nothing external worries about a NULL nor
looks for it.
Reviewed by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@602536 13f79535-47bb-0310-9956-ffa450edef68
Add in SeeRequestTail directive, to handle the shortcoming
of only storing 63 bytes of the request, when the requests
are longer than that and only vary towards the end; eg:
GET /disk1/storage/apache/htdocs/images/image-store1/food/fruits/seeded/apples.jpg
GET /disk1/storage/apache/htdocs/images/image-store1/food/fruits/seeded/pears.jpg
GET /disk1/storage/apache/htdocs/images/image-store1/food/fruits/seeded/plums.jpg
Submitted by: jim
Reviewed by: jim, rpluem, niq
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@602508 13f79535-47bb-0310-9956-ffa450edef68
the old implementation of apr_proc_create(), and explicitly pass
the output and error channels to all log processes created.
This goes all the way back to piped logs failing to run on win32.
Not in or needed at trunk/, as apr 1.3.0 has the proper fix.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@602467 13f79535-47bb-0310-9956-ffa450edef68
shutdown of the server when the MaxClients is higher then 257,
in a more responsive manner [Mladen Turk, William Rowe]
Per Mladen's +1, and that it's addressed all of Roy's concerns
with Mladen's original patch.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@584958 13f79535-47bb-0310-9956-ffa450edef68
PR 40037: try to avoid risk of misleading the lusers when they
can't initialise scoreboard after a crash.
Submitted by: niq
Reviewed by: niq, rpluem, trawick
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@582621 13f79535-47bb-0310-9956-ffa450edef68