1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-05 05:30:39 +03:00
Commit Graph

405 Commits

Author SHA1 Message Date
Ian Holsman
c7c6e876a9 change open_logs hook to return a value, allowing you to flag a error
while opening logs

Obtained from: Doug MacEachern


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92149 13f79535-47bb-0310-9956-ffa450edef68
2001-11-24 00:08:30 +00:00
Ryan Bloom
4209647600 Fix a bug in the core_output_filter. If we are buffering, it helps
to read from the correct bucket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92146 13f79535-47bb-0310-9956-ffa450edef68
2001-11-23 19:28:04 +00:00
Ian Holsman
86b792b21c Modify post_config hook so that it can return a error,
causing the server not to start.
previous method was to call exit(1) which would not fail
gracefully

PR:
Obtained from:
Submitted by:
Reviewed by:	(Idea only Jeff Trawick)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92144 13f79535-47bb-0310-9956-ffa450edef68
2001-11-23 16:35:22 +00:00
Ryan Bloom
aca4da4092 Fix a bug in our output filter buffering. If a lot of small brigades are
sent, the core will send the first 16 buckets, regardless of how much
data there is.  In the pathological case, this can cause a lot of 16
byte packets.  Now, if we see less than AP_MIN_BYTES, we combine
all of the buckets into a single bucket to be sent in a later packet.

This can cause a lot of memory copies, but it eases our network traffic.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92097 13f79535-47bb-0310-9956-ffa450edef68
2001-11-21 18:25:40 +00:00
Ryan Bloom
d70af2b3eb Fix the timeout logic that I broke last week. This adds a request
level filter that sets the timeout on the socket that is connected
to the client.

Thanks Greg Stein for seeing this bug.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92073 13f79535-47bb-0310-9956-ffa450edef68
2001-11-21 03:46:22 +00:00
Doug MacEachern
4b9c521468 add new input filter mode AP_MODE_INIT:
allows filters such as mod_ssl to initialize a client connection
(ie handshake) before reading request data from the client.
PR:
Obtained from:
Submitted by:   dougm
Reviewed by:	wrowe


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92042 13f79535-47bb-0310-9956-ffa450edef68
2001-11-19 22:36:20 +00:00
Ian Holsman
4f1a15140d change the signature of ap_custom_response() to use a
"const char *" instead of a "char *".


PR: 8791
Submitted by: Kurt Brown kurtb149@yahoo.com
Reviewed by:	Ian Holsman


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92024 13f79535-47bb-0310-9956-ffa450edef68
2001-11-18 02:57:12 +00:00
Ryan Bloom
a4f00625aa Pull lingering close out of the pool cleanup phase. This was causing too
many bugs.  Instead, it is called where it used to be called.  I have
abstracted some of the logic out of the lingering close so that it gets
the socket from the connection using the core's conn_config vector.  This
is in anticipation of a change to use a hook for the lingering close,
which I hope to do soon.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91968 13f79535-47bb-0310-9956-ffa450edef68
2001-11-15 20:49:54 +00:00
Ryan Bloom
137a02bb3b FTYPE_CONTENT - 1 isn't enough for OLD_WRITE. OLD_WRITE is a special
filter, and it MUST run absolutely first.  To allow other filters a little
space to manuver, I am moving this to FTYPE_CONTENT - 10.

Submitted by:	John Sterling <sterling@covalent.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91962 13f79535-47bb-0310-9956-ffa450edef68
2001-11-15 04:39:55 +00:00
Ryan Bloom
8a697835fe Get the proxy module compiling again. This is a hack to get past the
current compiler errors.  Basically, the core now puts the socket
in the conn_rec->conn_config vector.  The proxy grabs that socket and
uses it where it used to use the client_socket field from the conn_rec.
Long-term, all of the direct socket communication needs to be removed,
and this should go through a filter stack.  Short-term, this gets the
proxy working again.

I have tested http and connect, but I haven't looked at the FTP proxy,
although it does compile now.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91952 13f79535-47bb-0310-9956-ffa450edef68
2001-11-14 21:18:47 +00:00
Ryan Bloom
790872b869 Move this to a HOOK_MIDDLE location. We need to add some logic to
make sure that we have a socket that the core controls if we do this,
but it is more correct.

Submitted by:	Greg Stein


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91922 13f79535-47bb-0310-9956-ffa450edef68
2001-11-14 00:38:16 +00:00
Ryan Bloom
695081280d Add the server_rec argument back to the create_connection hook.
Submitted by:	Greg Stein


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91913 13f79535-47bb-0310-9956-ffa450edef68
2001-11-13 20:29:54 +00:00
Ryan Bloom
3d76585bad Back out my last patch. The logic to add sockets to pollsets is back in
the MPM


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91906 13f79535-47bb-0310-9956-ffa450edef68
2001-11-13 17:44:07 +00:00
Ryan Bloom
a47ed5762d This allows modules to add socket descriptors to the pollset. I have
only added this to the perfork MPM, and the others work without it.
Tomorrow I will add it to the other MPMs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91899 13f79535-47bb-0310-9956-ffa450edef68
2001-11-13 07:15:36 +00:00
Ryan Bloom
44baa0367f Cleanup some code that was created during the abstration. This basically
takes the old ap_new_connection, and puts into the new core_create_conn
function.  There is no good reason to have two functions to do this.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91890 13f79535-47bb-0310-9956-ffa450edef68
2001-11-13 02:09:07 +00:00
Ryan Bloom
26444e2900 Remove more network logic from the MPMs. Essentially, each MPM can define
AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK, which tells Apache to disable_nagle
on the accepted socket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91889 13f79535-47bb-0310-9956-ffa450edef68
2001-11-13 01:24:42 +00:00
Ryan Bloom
0c05b625ac Begin to abstract out the underlying transport layer.
The first step is to remove the socket from the conn_rec,
the server now lives in a context that is passed to the
core's input and output filters. This forces us to be very
careful when adding calls that use the socket directly,
because the socket isn't available in most locations.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91887 13f79535-47bb-0310-9956-ffa450edef68
2001-11-12 23:49:08 +00:00
Martin Kraemer
ac0d5e6317 Fixed previous patch to reflect what Apache-1.3 did regarding self-
referential uri's, and updated the manual accordingly.
XXX There is a kludge here: XXX the port number from the client's Host:
header used to be tossed, and there is no clean mechanism to pass it
(in the request_rec) to other consumers. As the unparsed_uri structure
(which could avoid repeated parsing of URI, Host, Port etc) seems to be
mostly unused currently, I used that to pass the port.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91798 13f79535-47bb-0310-9956-ffa450edef68
2001-11-08 14:29:37 +00:00
Martin Kraemer
cd4e5d9455 When no port is given in a "ServerName host" directive, the
server_rec->port is now set to zero, not 80. That allows for
run-time deduction of the correct server port (depending on
SSL/plain, and depending also on the current setting of
UseCanonicalName). This change makes redirections
work, even with https:// connections. [Martin Kraemer]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91797 13f79535-47bb-0310-9956-ffa450edef68
2001-11-08 12:34:21 +00:00
Greg Ames
0dacbadb39 insure that we die quickly without looping etc. if somebody messes up
*readbytes again.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91726 13f79535-47bb-0310-9956-ffa450edef68
2001-11-02 15:17:06 +00:00
Greg Ames
dd68355433 whoops! can't use the return code to pass the length up the filter chain.
with this and a request line that goes on forever, I now get:

[Wed Oct 31 17:45:45 2001] [error] [client 127.0.0.1] request failed:
URI too long

...in the error log, and a 414 in the access log.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91715 13f79535-47bb-0310-9956-ffa450edef68
2001-10-31 22:55:43 +00:00
Greg Ames
d376d32843 return the actual number of bytes read when we're in "read a line" mode and it
looks like the line may never end.

This lets ap_getline determine whether there's excessive bytes or not,
depending on the size of its caller's buffers.  If the buffer can accomodate
more bytes, ap_getline will continue to read.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91713 13f79535-47bb-0310-9956-ffa450edef68
2001-10-31 20:18:56 +00:00
Aaron Bannert
6ce6a5d328 Fix a big memory leak bug related to arbitrarily large header lines.
The core input filter would happily consume all the data you gave it
in a header line, looking for that one LF. This patch limits that
"getline" functionality to HUGE_STRING_LEN (8192 bytes).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91711 13f79535-47bb-0310-9956-ffa450edef68
2001-10-31 18:21:53 +00:00
Jeff Trawick
620934e3bf set the c->aborted flag when we get EPIPE
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91650 13f79535-47bb-0310-9956-ffa450edef68
2001-10-23 20:46:02 +00:00
Cliff Woolley
79403ed8e0 Fix a segfault seen on daedalus earlier this evening. All that was happening
was that we forgot to check whether ctx->bb was empty, so when we pulled the
first bucket, it would be the sentinel, and we'd segfault trying to apr_bucket_read
the sentinel.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91641 13f79535-47bb-0310-9956-ffa450edef68
2001-10-23 09:41:54 +00:00
William A. Rowe Jr
429f7ef0d5 Fix two typos in the last patch... compiles/tests clean... Greg, please
run this against Apache.org until the first core and post the results.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91625 13f79535-47bb-0310-9956-ffa450edef68
2001-10-22 04:36:46 +00:00
William A. Rowe Jr
3e15d70ea7 Perhaps fix the segfault... my earlier patch didn't since we already
memcpy'ed the base into the merged per-dir config.

  This certainly cleans up that function though, and I hope increases
  it's legibility.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91624 13f79535-47bb-0310-9956-ffa450edef68
2001-10-22 04:25:27 +00:00
William A. Rowe Jr
90cb9e9953 Canonicalize all absolute <Directory > sections, not simply those that
fail to end in a '/'.  Slash test is afterwords, once we've canonicalized
  any '\' and other aliases to '/'.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91608 13f79535-47bb-0310-9956-ffa450edef68
2001-10-20 18:29:09 +00:00
William A. Rowe Jr
f31545e763 Listen to my own advise. Fortunately, the new apr_pool_readonly code
catches these in no time ;)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91558 13f79535-47bb-0310-9956-ffa450edef68
2001-10-19 02:08:44 +00:00
William A. Rowe Jr
7055a5ed84 Guys... please be _careful_ when you pcalloc -> palloc!!!
Resolves GAmes' segfault observations


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91556 13f79535-47bb-0310-9956-ffa450edef68
2001-10-19 02:05:48 +00:00
Jeff Trawick
4c8e862ca7 don't lose the retcode in core_create_proxy_req()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91488 13f79535-47bb-0310-9956-ffa450edef68
2001-10-16 11:54:06 +00:00
Ryan Bloom
e31a688ce5 Cleanup the proxy code that creates a request to the origin
server.  This change adds an optional hook, which allows modules
to gain control while the request is created if the proxy module
is loaded.  The purpose of this hook is to allow modules to add
input and/or output filters to the request to the origin.  While
I was at it, I made the core use this hook, so that proxy request
creation uses some of the code from the core.  This can still be
greatly improved, but this is a good start.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91486 13f79535-47bb-0310-9956-ffa450edef68
2001-10-16 05:18:39 +00:00
Justin Erenkrantz
5902e1f3e3 The problem here is that we are getting some zero-length buckets at the head
of our brigade - which are in isolation okay.  In this situation, they
must be removed by the call to APR_BRIGADE_NORMALIZE.

The way we partition the buckets means that we will never remove the
zero-length bucket from the head - causing an infinite loop.  We read only
a single bucket now - previously partition with the blocking reads would
read multiple buckets - but it forced having a defined length which we
agreed was bogus.

Therefore, if we have a zero-length bucket at the head, we would then try
to partition and split at the zero-point of the brigade.  That combination
doesn't actually remove the zero-length bucket - it is still there - causing
an infinite loop because we'll never go past the zero-length bucket.

This call was originally present in core_input_filter.  I think it might
be better to fix partition/split/etc to eliminate a zero-length bucket
and skip it.  But, I'm not 100% sure that needs to happen.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91412 13f79535-47bb-0310-9956-ffa450edef68
2001-10-11 01:38:28 +00:00
Justin Erenkrantz
e109fb066b We also need to increment *readbytes when we find a match in the middle of
a bucket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91411 13f79535-47bb-0310-9956-ffa450edef68
2001-10-10 22:14:10 +00:00
Justin Erenkrantz
4efc873183 Yeah, let's just return this segment to how it was a few hours ago.
If the status code is anything other than SUCCESS for PEEK, it isn't
good.  Just return the value.

(I thought it should be this, but I wasn't 100% sure.  Peer review == good.)

Submitted by:	Will Rowe


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91404 13f79535-47bb-0310-9956-ffa450edef68
2001-10-10 19:19:16 +00:00
Justin Erenkrantz
55a8076e5d For some reason, I was thinking PEEK should read infinitely. Not.
Return with APR_EOF if we get EAGAIN.

(Whomever is calling this with PEEK should really be able to handle EOS
 bucket rather than relying on error codes.)

Thanks to Greg Ames for pointing out this fubar.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91403 13f79535-47bb-0310-9956-ffa450edef68
2001-10-10 18:45:22 +00:00
Justin Erenkrantz
008689be41 Allow the bucket reading code in the core to handle EAGAIN properly.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91400 13f79535-47bb-0310-9956-ffa450edef68
2001-10-10 15:34:35 +00:00
Justin Erenkrantz
7541cc3073 We should only be doing one socket read under any circumstances
(blocking or not).

apr_brigade_partition would do reading multiple times and that's
not really what we want (so I think).

This may speed up POST requests that were waiting for all of the
data to arrive before returning anything in blocking mode.

Reviewed by:	Greg Stein, Ryan Bloom


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91322 13f79535-47bb-0310-9956-ffa450edef68
2001-10-06 00:47:06 +00:00
Justin Erenkrantz
0813cc35a8 Allow the core input filter to handle AP_NONBLOCK_READ request for a
finite number of bytes (i.e. *readbytes > 0).

ap_brigade_partition does a blocking read.  So, what we should do is
apr_bucket_read on the socket for non-blocking.  If we get less than
what they asked for, that's okay and we should just return that amount.
If they were non-blocking, we should always be non-blocking.

Ryan, Greg, and others can figure out if ap_brigade_partition should
be tweaked to handle AP_NONBLOCK_READ natively.  I'm of a mixed mind,
but this addresses the short term need.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91312 13f79535-47bb-0310-9956-ffa450edef68
2001-10-05 08:54:19 +00:00
Jeff Trawick
2d0bcc2a70 get rid of an unused variable
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91301 13f79535-47bb-0310-9956-ffa450edef68
2001-10-05 02:27:48 +00:00
Ryan Bloom
b7bc1a03e7 Remove the Port directive. In it's place, the Listen directive
is now a required directive, which tells Apache what port to
listen on.  The ServerName directive has also been extended
to accept an optional port.  If the port is specified to the
ServerName, the server will report that port whenever it
reports the port that it is listening on.  This change was
made to ease configuration errors that stem from having a Port
directive, and a Listen directive.  In that situation, the server
would only listen to the port specified by the Listen command,
which caused a lot of confusion to users.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91293 13f79535-47bb-0310-9956-ffa450edef68
2001-10-04 20:00:53 +00:00
Justin Erenkrantz
6c7a7c36b2 Implement suggested input filter improvements from Greg and Ryan.
- Clean up scopes and namings of certain variables
- Add comments about potentially bogus modes
- Consolidate a FOREACH loop into a single brigade_length call


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91191 13f79535-47bb-0310-9956-ffa450edef68
2001-09-29 08:33:02 +00:00
Justin Erenkrantz
08eb7609da Input filtering rewrite. Consolidate how we handle HTTP input parsing by
rearranging and rethinking some things.  The net result is that the HTTP
filter is now a request filter and is now only responsible for HTTP things.
The core input filter is now responsible for handling all of the dirty work.

Highlights:
- Removes the dechunk filter and merges it with ap_http_filter (aka HTTP_IN).
  The dechunk filter was incorrectly handling certain cases (trailers).
- Moves ap_http_filter from a connection filter to a request filter
  to support the consolidation above (it needs header info).
- Change support code to allow the http_filter to be a
  request filter (how the request is setup initially).
- Move most of the logic from HTTP_IN to CORE_IN (core_input_filter).
  HTTP_IN is now only concerned about HTTP things.  The core filter
  is now responsible for returning data.  It is impossible to
  consolidate dechunk and http without this because HTTP_IN previously
  buffered data.  As Greg has suggested, it may make sense to write
  some brigade functions that handle input (getline).  It should be
  fairly trivial to add these.  Some of the calls in ap_http_filter
  could be switched as well.

This is the original patch as submitted to dev@httpd on Monday, Sep.
24th.  Additional comments and some minor tweaks done after that
submission are coming up next.  This should allow people who reviewed
the original patch to see what has changed and review them piecemeal.

This test passes all current tests in httpd-test.  Please perform
chicken sacrifices to verify that this hasn't blown up your favorite
input.

Reviewed by:	Greg Stein, Ryan Bloom, and Cliff Woolley (buckets)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91189 13f79535-47bb-0310-9956-ffa450edef68
2001-09-29 08:17:11 +00:00
William A. Rowe Jr
1fdecc1352 Remove the translate_name hack that caused Greg Ames some grief with
mod_rewrite.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91168 13f79535-47bb-0310-9956-ffa450edef68
2001-09-28 04:35:59 +00:00
Justin Erenkrantz
cb8569e4f8 This patch eliminates the wasteful run-time conversion of method names from
strings to numbers in places where the methods are known at compile
time.

(Justin fixed the va_end() call to be correct.)

Submitted by:	Brian Pane <bpane@pacbell.net>
Reviewed by:	Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91078 13f79535-47bb-0310-9956-ffa450edef68
2001-09-19 05:52:42 +00:00
William A. Rowe Jr
f495937085 Remove the Win32 script-processing exception from mod_cgi, and
roll build_command_line/build_argv_list into a unified, overrideable
   ap_cgi_build_command optional function.

   Eliminates a ton of Win32 cruft from core.c for registry parsing.
   Win32 (through the default handler, and newest changes to the
   apr_proc_create fn) continues to serve .bat/.exe files.  This is in
   preparation for adding modules/arch/win32/mod_win32 for scripts.

   Please review the mod_cgi.c behavior very carefully.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91058 13f79535-47bb-0310-9956-ffa450edef68
2001-09-17 21:07:36 +00:00
Ryan Bloom
cac07fa8d9 A very small optimization to the OLD_WRITE logic. This just makes us store
a pointer to the OLD_WRITE frec, and instead of using strcmp or strcasecmp,
we can just do a simple pointer comparison.  This optimization is also
available to other modules.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91006 13f79535-47bb-0310-9956-ffa450edef68
2001-09-11 18:38:21 +00:00
William A. Rowe Jr
05a55c7cc9 Can it be this simple? No, probably not, but this fast-hack will get
us going again for a while.

  We are currently rejecting some internal file_sub_req()'s in the
  translate phase.  I don't like this hack because of risks it potentially
  exposes, but for today, if we have a filename - and we are a subrequest,
  then let it fly without further mapping.  This allows us to serve up
  the default "/" request (run through mod_dir->mod_negotiation->mod_mime)
  without a 400 error.  The right solution is to set up some traps and
  escapes for the subreq mechanism, possibly with a subreq translate hook,
  and drop the URI entirely for these cases.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90847 13f79535-47bb-0310-9956-ffa450edef68
2001-08-31 13:45:16 +00:00
William A. Rowe Jr
a4b4e1a534 Same as Jeff Trawick's patch [thank you!] only a tad faster, and error
out on the old Set{Input|Output}Filter onefilter twofilter syntax
  (prior to this patch, only the last filter in a space seperated list
  would be configured.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90813 13f79535-47bb-0310-9956-ffa450edef68
2001-08-30 14:54:50 +00:00
Jeff Trawick
e5daa97d46 fix an endless loop (well, until you run out of storage from
tiny apr_pstrdup() calls and your machine crashes) when you
have a filter chain

  ap_getword() returns an empty string, not a NULL string,
  when there are no more words

fix a segfault when you don't have a filter chain

  ap_getword() does not check for a NULL string to search


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90810 13f79535-47bb-0310-9956-ffa450edef68
2001-08-30 11:42:59 +00:00