1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-06 16:49:32 +03:00
Commit Graph

190 Commits

Author SHA1 Message Date
Roy T. Fielding
7ff9306de2 only call mutex functions if APR_HAS_THREADS
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@745338 13f79535-47bb-0310-9956-ffa450edef68
2009-02-18 00:59:39 +00:00
Jim Jagielski
6777364613 Hopefully the final fix for the subreq/filter issue. The
prob was that we at this point could still have some
stale and incorrect refs when we adjusted the f-stack.
So move the update earlier so when we adjust, we're
affecting r. RŸdiger and Jim pretty much
simultaneously :)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@725077 13f79535-47bb-0310-9956-ffa450edef68
2008-12-10 13:01:31 +00:00
Jim Jagielski
a36484e4e0 reset chain if we need to...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@724805 13f79535-47bb-0310-9956-ffa450edef68
2008-12-09 18:19:20 +00:00
Ruediger Pluem
206fa0e2f4 * Correctly remove the SUBREQ_CORE filter from the filter chain if we do an
internal fast redirect and if the new redirected request is NO subrequest.
  This fixes at least one of the possible subtle issues mentioned in the
  comment to r620133.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@724515 13f79535-47bb-0310-9956-ffa450edef68
2008-12-08 22:18:27 +00:00
Paul Querna
f47b6f394e Import the core parts of the DTrace patch. This is a modified and updated
version of what was submited by Theo before:
 <http://mail-archives.apache.org/mod_mbox/httpd-dev/200805.mbox/%3C6AFBCFE8-4CCA-4A02-8A43-F9170689695D@omniti.com%3E>

Note, this does not hook it up into the build system at this time, because
the original patch was a little too creative there.

Submitted By: Theo Schlossnagle <jesus omniti.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@723565 13f79535-47bb-0310-9956-ffa450edef68
2008-12-05 03:34:52 +00:00
Ruediger Pluem
cd505682e9 * Avoid sending no answer at all if a custom error page causes an
AP_FILTER_ERROR.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@722213 13f79535-47bb-0310-9956-ffa450edef68
2008-12-01 20:27:27 +00:00
Paul Querna
92e9540e3b * modules/http/http_request.c
(ap_process_async_request): Fix warning: 'return' with a value, in function 
      returning void


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@708821 13f79535-47bb-0310-9956-ffa450edef68
2008-10-29 08:18:45 +00:00
Paul Querna
767cc30c02 Introduce Suspendable Requests to the Event MPM.
Using this basic framework, you can return SUSPENDED from an HTTP Handler,
and then register a callback that is invoked by the MPM at a later time.

This initial version only supports _timers_ as callbacks, but in the future I
would like to add things like wait for socket activity, on a socket specified by
the handler.

Once in a callback, It is then the responsibility of the callback fucntion 
to finish the HTTP Request handling, but this alows you to do cool things like 
a fully async proxy, COMET support, or even rate limiting.

To prove I'm not insane, I've inlcuded an example module, mod_dialup.

You can configure it like this:
<Location "/docs">
  ModemStandard "V.32"
</Location>

And for static files inside that path, you will be rate limited to V.32 speeds, 
aka 9.6 kilobits/second.

Does anyone besides Rüdiger read commit emails :-) ?

I know there are likely huge problems with this, but I would like to see how far
we can push the Event MPM, figure out what to do better, if there is anything, 
and then really dive into the 3.0 development before ApacheCon.

* server/mpm/experimental/event/fdqueue.h:
    (timer_event_t): New structure to hold timer events and callback functions.
    
* server/mpm/experimental/event/fdqueue.c
    (ap_queue_empty): Modify to also look at Timer Ring.

    (ap_queue_init): Initialize Timer Ring.

    (ap_queue_push_timer): New function, pushes a timer event into the queue.

    (ap_queue_pop_something): Renamed function, returns a timer event or
        a socket/pool for a worker thread to run.


* server/mpm/experimental/event/event.c
    (process_socket): If the connection is in SUSPENDED state, don't force it
        into linger mode yet, the callback will have to take care of that.

    (push_timer2worker): New shortcut function, pushes timer event into queue
        for a worker to run.

    (timer_free_ring): New global data structure to recycle memory used by 
        timer events.

    (timer_ring): New global data structure to hold active timer events.

    (g_timer_ring_mtx): Thread mutex to protect timer event data structures.

    (ap_mpm_register_timed_callback): New Function, registers a callback to be
        invoked by the MPM at a later time.

    (listener_thread): Calculate our wakeup time based on the upcoming Event 
        Queue, and after pollset_poll runs, push any Timers that have passed
        onto worker threads to run.
    
    (worker_thread): Call new queue pop method, and if the Timer Event is 
        non-null, invoke the callback.  Once the callback is done, push the
        structure onto the timer_free_ring, to be recycled.

    (child_main): Initialize new mutex and ring structures.


* server/config.c
    (ap_invoke_handler): Allow SUSPENDED aa valid return code from handlers.


* modules/http/http_core.c
    (ap_process_http_async_connection): Don't close the connection when in 
        SUSPENDED state.


* modules/http/http_request.c
    (ap_process_request_after_handler): New function, body pulled from the old,
        ap_process_async_request.  Split to let handlers invoke this so they 
        don't need to know all of the details of finishing a request.

    (ap_process_async_request): If the handler returns SUSPENDED, don't do
        anything but return.


* include/ap_mmn.h: Bump MMN.


* include/ap_mpm.h
    (ap_mpm_register_timed_callback): New function.


* include/httpd.h:
    (SUSPENDED): New return code for handlers.
    (request_rec::invoke_mtx): New mutex to protect callback invokcations
        from being run before the original handler finishes running.
    (conn_state_e): Add a suspended state.


* include/http_request.h
    (ap_process_request_after_handler): New function to make it easier for 
        handlers to finish the HTTP Request.


* modules/test/config.m4: Add mod_dialup to build.


* modules/test/mod_dialup.c: New rate limiting module, requires the Event MPM 
    to work.




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@697357 13f79535-47bb-0310-9956-ffa450edef68
2008-09-20 11:58:08 +00:00
Paul Querna
a324a1d72f Remove all references to CORE_PRIVATE.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@645455 13f79535-47bb-0310-9956-ffa450edef68
2008-04-07 10:45:43 +00:00
Ruediger Pluem
63351a529b - In AP_MODE_SPECULATIVE ap_core_input_filter returns APR_SUCCESS and an empty
brigade in the case that a non blocking read from the socket returned
  APR_EAGAIN. So getting an empty brigade also shows that no data is present
  in the input filter.
  While this reduces the number of false positives for "real data" in the input
  filter the behaviour is not as good as before 533820 because if there are
  only CRLF's in the input filter we do not flush, but we should. To fix this
  it seems that a simulation of AP_MODE_EATCRLF is needed inside of
  check_pipeline.
- Destroy brigade bb at the end of the function.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@535879 13f79535-47bb-0310-9956-ffa450edef68
2007-05-07 14:20:09 +00:00
Greg Ames
2c91e92953 check_pipeline: use AP_MODE_SPECULATIVE to check for data in the input filters
to accomodate mod_ssl's input filter.  AP_MODE_EATCRLF is essentially a no-op
in that filter.

this fixes missing imbedded graphics etc when using the Event MPM with mod_ssl
with HTTP pipelining enabled in the browser.  the pipelined requests after the
first were never read from mod_ssl's input filter.  it might reduce unneeded 
flushes with other MPMs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@533820 13f79535-47bb-0310-9956-ffa450edef68
2007-04-30 18:16:06 +00:00
Garrett Rooney
49291c1444 Follow up to r451287, use APR_STATUS_IS_TIMEUP instead of comparing
against APR_TIMEUP directly.

* modules/http/http_request.c
  (ap_process_request): Use APR_STATUS_IS_TIMEUP.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@451288 13f79535-47bb-0310-9956-ffa450edef68
2006-09-29 13:44:45 +00:00
Ruediger Pluem
70cf75f609 * Notice a timeout as an error message. This might be valuable for detecting
clients with broken network connections or possible DoS attacks.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@451287 13f79535-47bb-0310-9956-ffa450edef68
2006-09-29 13:39:53 +00:00
Roy T. Fielding
de659cbed0 update license header text
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@420983 13f79535-47bb-0310-9956-ffa450edef68
2006-07-11 20:33:53 +00:00
Colm MacCarthaigh
dd95d7c37c Update the copyright year in all .c, .h and .xml files
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@395228 13f79535-47bb-0310-9956-ffa450edef68
2006-04-19 12:11:27 +00:00
Nick Kew
24c5cde238 PR 36090
Fix recursive ErrorDocument handling


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@354118 13f79535-47bb-0310-9956-ffa450edef68
2005-12-05 18:22:29 +00:00
Jim Jagielski
5061d9fa92 No functional Change: Removing trailing whitespace. This also
means that "blank" lines consisting of just spaces or
tabs are now really blank lines


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332306 13f79535-47bb-0310-9956-ffa450edef68
2005-11-10 15:11:44 +00:00
Brian Pane
f0538ad65c Allocate the brigade containing the EOR bucket from the connection
pool, rather than the request pool, because the core output filter
may need to reference the brigade immediately after deleting the
EOR bucket (and thus the request pool).  This fixes a coredump
encountered when running t/TEST on an httpd compiled with
"--enable-pool-debug."


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@329484 13f79535-47bb-0310-9956-ffa450edef68
2005-10-29 21:11:51 +00:00
Brian Pane
cb0e5db86f Async write completion for Event MPM
(backported from async-dev branch to 2.3 trunk)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@327945 13f79535-47bb-0310-9956-ffa450edef68
2005-10-24 03:33:14 +00:00
Brian Pane
158559eacb Redesign of request cleanup and logging to use End-Of-Request bucket
(backport from async-dev branch to 2.3 trunk)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@327925 13f79535-47bb-0310-9956-ffa450edef68
2005-10-24 02:39:49 +00:00
André Malo
9c1115eb44 * modules/http/http_request.c
(ap_allow_methods): add missing va_end call


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@321500 13f79535-47bb-0310-9956-ffa450edef68
2005-10-15 21:37:38 +00:00
Justin Erenkrantz
905cdf9f0b Update copyright year to 2005 and standardize on current copyright owner line.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@151408 13f79535-47bb-0310-9956-ffa450edef68
2005-02-04 20:28:49 +00:00
Jim Jagielski
9e6b472772 Keep track of time taken to process requests again.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@149550 13f79535-47bb-0310-9956-ffa450edef68
2005-02-02 19:32:18 +00:00
Paul Querna
95d5391b9f Compile Fix for Netware Port with CodeWarrior.
Noticed By: <normw@bocnet.com.au>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@106072 13f79535-47bb-0310-9956-ffa450edef68
2004-11-21 05:53:38 +00:00
Paul Querna
34959f29db The Event MPM.
Designed to minimize Apache's KeepAlive overhead.

This MPM depends on the current APR-trunk for new features added to 
the apr_pollset interface. Currently the underlying operating
system must support KQueue or EPoll.

Status:
  Should work as a drop in replacement for all non-ssl servers.
  SSL Requests that use HTTP 1.1 Pipelining do not currently work.

Testing:
  I have tested it with Linux 2.6, FreeBSD 5.2.1, and OS X 10.3.
  
Originally based on the patch by Greg Ames.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105919 13f79535-47bb-0310-9956-ffa450edef68
2004-11-20 02:52:36 +00:00
Justin Erenkrantz
c28dfa19f1 * modules/http/http_request.c (ap_internal_redirect): Call quick_handler
when we do an internal redirect to allow caching.  This allows mod_dir
  requests to be cached.

Reviewed by:	Bill Stoddard


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104446 13f79535-47bb-0310-9956-ffa450edef68
2004-08-02 17:12:32 +00:00
André Malo
a688f06b19 fix name of The Apache Software Foundation
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102618 13f79535-47bb-0310-9956-ffa450edef68
2004-02-09 20:31:03 +00:00
André Malo
d0e05bada9 fix copyright dates according to the first check in
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102565 13f79535-47bb-0310-9956-ffa450edef68
2004-02-08 12:07:22 +00:00
André Malo
4f02cb1e18 apply Apache License, Version 2.0
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102525 13f79535-47bb-0310-9956-ffa450edef68
2004-02-06 22:58:42 +00:00
André Malo
afc28afde4 internal_fast_redirect: take over important request_rec members
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102330 13f79535-47bb-0310-9956-ffa450edef68
2004-01-13 23:59:57 +00:00
André Malo
fb07607180 update license to 2004.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102135 13f79535-47bb-0310-9956-ffa450edef68
2004-01-01 13:26:26 +00:00
Jeff Trawick
0c3c5b7145 Set the scoreboard state to indicate logging prior to running
logging hooks so that server-status will show 'L' for hung loggers
instead of 'W'.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101517 13f79535-47bb-0310-9956-ffa450edef68
2003-10-22 16:45:53 +00:00
André Malo
8dd8543053 Rework of the recursion stopper - collapse recursion counters into one function
Reviewed by: Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100095 13f79535-47bb-0310-9956-ffa450edef68
2003-05-29 23:04:32 +00:00
André Malo
b2b035253f - revert my patch (r1.155) since it produces regressions.
- add a note to STATUS that we don't forget the thing.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100086 13f79535-47bb-0310-9956-ffa450edef68
2003-05-29 15:07:12 +00:00
André Malo
1af02389bb Prevent the server from crashing when entering infinite loops. The
new LimitInternalRecursion directive configures limits of subsequent
internal redirects and nested subrequests, after which the request
will be aborted.
[William Rowe, Jeff Trawick, Andr� Malo]

PR: 19753 (and probably others)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99911 13f79535-47bb-0310-9956-ffa450edef68
2003-05-19 01:19:55 +00:00
André Malo
986cb6b961 Do not bypass output filters when redirecting subrequests internally.
PR: 17629


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99042 13f79535-47bb-0310-9956-ffa450edef68
2003-03-22 22:15:40 +00:00
Jeff Trawick
f03fc13861 Keep the subrequest filter in place when a subrequest is
redirected.

PR: 15423


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98778 13f79535-47bb-0310-9956-ffa450edef68
2003-02-24 00:57:40 +00:00
André Malo
742af25096 finished that boring job:
update license to 2003.

Happy New Year! ;-))


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98573 13f79535-47bb-0310-9956-ffa450edef68
2003-02-03 17:53:28 +00:00
Greg Ames
65b5ceef11 fix weird things that happen with canned error messages due to using two
different request_recs after an ErrorDocument internal redirect failure.
examples: wrong Content-Type, garbled output from ebcdic servers due to
double charset translation


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96364 13f79535-47bb-0310-9956-ffa450edef68
2002-08-13 14:27:39 +00:00
Justin Erenkrantz
32e15557ff Fix infinite loop when reading certain data due to two HTTP_IN filters being
present for internally redirected requests.

If HTTP_IN is present, r->proto_input_filters would have it, so adding it
twice is wrong.

PR: 10146
Reviewed by:	Brian Pane


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95895 13f79535-47bb-0310-9956-ffa450edef68
2002-06-27 04:40:47 +00:00
Justin Erenkrantz
001b387bcd Change conn_rec->keepalive to an enumerated value of
AP_CONN_UNKNOWN
AP_CONN_CLOSE
AP_CONN_KEEPALIVE

This also fixes a problem where ap_discard_request_body would not discard
the body when keepalive was 0.  This actually meant the keepalive status
was unknown *not* closed, but no one ever remembered that.

This problem was seen with mod_dav sending error responses (as reported by
Karl Fogel).

Suggested by:	Greg "this isn't the '80s" Stein
Reviewed by:	Greg Ames


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95891 13f79535-47bb-0310-9956-ffa450edef68
2002-06-26 19:45:07 +00:00
Greg Ames
38de4bc46f ap_die: get rid of bad side effects from the recursive error handling code
that mess with the status and which request_rec the rest of the function uses.

Submitted by:  Justin Erenkrantz, Greg Ames


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95834 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 13:58:39 +00:00
Greg Ames
54b431dfb6 prevent infinite recursion if an ErrorDocument gets an error
Reported by: Colm MacC�rthaigh <colmmacc@Redbrick.DCU.IE>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95825 13f79535-47bb-0310-9956-ffa450edef68
2002-06-20 19:34:28 +00:00
Cliff Woolley
969ce29888 detabify
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95598 13f79535-47bb-0310-9956-ffa450edef68
2002-06-10 22:02:57 +00:00
Ryan Bloom
a90a9ba2be Call ap_discard_request_body from ap_finalize_request. Remove the call
from all other modules that do not use it to determine the response for
the request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95576 13f79535-47bb-0310-9956-ffa450edef68
2002-06-07 22:31:34 +00:00
Justin Erenkrantz
0186760562 Fix the case where we generate both a 401 and 413 and we go bonkers.
- If an error would drop the connection, we do not return the top-level
  error anymore as we will assume this new one takes precedence over the
  original error.  This also ensures that we will not read the input
  body (which is the point of returning these special error messages in
  the first place).
- The ap_discard_request_body return value in ap_die() must be checked
  to make sure we don't encounter this recursive case and print two errors.

Kudos to Jeff Trawick for his sample input which pointed this out.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95426 13f79535-47bb-0310-9956-ffa450edef68
2002-05-31 07:37:19 +00:00
Justin Erenkrantz
6d8dd592a5 Correctly return 413 when an invalid chunk size is given on input.
- If get_chunk_size() returns a negative number, that probably implies
  an overflow.  So, create a 413 error and pass it to the output filters.
- Modify ap_discard_request_body() to return OK quickly if we're a subreq
  or our status code implies that we will be dropping the connection.
- Modify ap_die() so that if the new status implies that we will drop
  the connection, that we correctly indicate that we can not keepalive
  this connection.  (Without this, the error is returned, but the connection
  is not closed.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95331 13f79535-47bb-0310-9956-ffa450edef68
2002-05-28 23:38:31 +00:00
Jeff Trawick
bc0cf18899 stop using APLOG_NOERRNO in calls to ap_log_[pr]error()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95151 13f79535-47bb-0310-9956-ffa450edef68
2002-05-17 11:33:10 +00:00
Brian Pane
4c04f98079 Replaced a sprintf("%d") with itoa
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94856 13f79535-47bb-0310-9956-ffa450edef68
2002-04-29 08:05:37 +00:00
Justin Erenkrantz
d8b443e424 If a subreq added a filter (say INCLUDES) and the subreq was promoted via
fast_redirect, the filter would still point at the subreq - rather than
the original r.  So, we must update any filters pointing at rr to be r.

This would cause lots of problems with mod_include with mod_dir requests
such as seen in PR 7966.  mod_include would be unsetting the headers_out
of rr instead of r.  But, we disassociate rr->headers_out and r->headers_out.
Therefore, the C-L header in r->headers_out would remain - even though it
bears no relation to what we will be outputting - causing problems.

This also now permits chunked-encoding of mod_dir/mod_include requests
which could never happen before and fixes the content-length problem
seen in PR 7966.

As hinted at in PR 7966, there is a race condition - if for some reason
the server stalls reading an included file (or even better, placing a
sleep in the cgi-bin script!), the invalid C-L may get propogated to the
client.

(Note that internal_internal_redirect has this same code fragment.)

PR: 7966


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94832 13f79535-47bb-0310-9956-ffa450edef68
2002-04-28 06:41:35 +00:00