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

463 Commits

Author SHA1 Message Date
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
William A. Rowe Jr
3731e4e4f7 Thank you again for the proxy autobuild reports ;)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90809 13f79535-47bb-0310-9956-ffa450edef68
2001-08-30 08:26:08 +00:00
William A. Rowe Jr
3641520e9f Changed syntax of Set{Input|Output}Filter. The list of filters
must be semicolon delimited (if more than one filter is given.)
     The Set{Input|Output}Filter directive now overrides a parent
     container's directive (e.g. SetInputFilter in <Directory /web/foo>
     will override any SetInputFilter directive in <Directory /web>.)
     This new syntax is more consistent with Add{Input|Output}Filter
     directives defined in mod_mime.  Also cures a bug in prior releases
     where the Set{Input|Output}Filter directive would corrupt the
     global configuration if the multiple directives were nested.
     [William Rowe]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90799 13f79535-47bb-0310-9956-ffa450edef68
2001-08-30 05:10:54 +00:00
William A. Rowe Jr
1a9639e088 Since the mod_mime patch was applied, here is the rest of the patch to
introduce the ForceType and SetHandler [absolute references] directly
  into the very top of the fixups phase.  This means these will always
  override _any_ mime module, not just mod_mime.  Ergo, other mime modules
  can continue to set charset, encodings, etc.  Since these are globals,
  they belong in the core.

  This highlights a very serious drawback to the type_checker hook.  By
  using run first, a module that identifies _partial_ information (maybe
  just the content type) won't pass the query on to other modules, like
  mod_mime, that might further define the encoding or charset.  The
  type_checker hook should clearly become a run-all, and the modules should
  decline if they see someone ahead of them answered a question they were
  going to try to figure.

  Which means - if type_checker becomes RUN_ALL - this new override hook
  fn should become a type_checker again - and RUN_REALLY_FIRST, and let
  other modules _choose_ not to override this election.  (We can run it
  again at the end, for a recount ;)  Votes?


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90797 13f79535-47bb-0310-9956-ffa450edef68
2001-08-30 04:24:09 +00:00
William A. Rowe Jr
12912e8dbb This is the same granularity of control as mod_mime gave to set handlers
(and now AddInputFilter and AddOutputFilter by extension) so this seems
  entirely appropriate in the core as well.  Options FileInfo is required
  to change the processing behavior of files.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90760 13f79535-47bb-0310-9956-ffa450edef68
2001-08-28 15:45:01 +00:00
Jeff Trawick
9855487db6 Fix a growing connection pool in core_output_filter() for
keepalive requests.  We were allocating a brigade out of the
connection pool; the number of these brigades allocated
per connection was theoretically unlimited.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90736 13f79535-47bb-0310-9956-ffa450edef68
2001-08-27 20:48:00 +00:00
William A. Rowe Jr
15cdc86233 Solve a bug I introduced this weekend, we want to compare core_*->r
as a boolean, not by value.

  Reported by: Barrie Slaymaker <barries@slaysys.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90729 13f79535-47bb-0310-9956-ffa450edef68
2001-08-27 16:35:43 +00:00
Doug MacEachern
68e7797264 apr_pstrcat args were not NULL terminated
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90698 13f79535-47bb-0310-9956-ffa450edef68
2001-08-26 17:38:14 +00:00
William A. Rowe Jr
7552c9cb16 Eliminate proxy: (and all other 'special') processing from the
ap_directory_walk() phase.  Modules that want to use special
  walk logic should refer to the mod_proxy map_to_location example,
  with it's proxy_walk and proxysection implementation.  This makes
  either directory_walk flavor much more legible, since that phase
  only runs against real <Directory > blocks.

  On a technical note, this patch also forces the Directory to be
  canonical (unless it is "/" or a regex.)  It also allows us to
  be more explicit when declaring <Directory > block errors.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90684 13f79535-47bb-0310-9956-ffa450edef68
2001-08-26 05:10:17 +00:00
William A. Rowe Jr
307ab55886 Introduce the map_to_storage hook, which allows modules to bypass
the directory_walk and file_walk for non-file requests.  TRACE
  shortcut moved to http_protocol.c as APR_HOOK_MIDDLE, and the
  directory_walk/file_walk happen as APR_HOOK_VERY_LAST in core.c.

  A seperate patch to mod_proxy is required to short circuit both the
  TRACE and directory_walk/file_walk stuff.  That patch is next.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90665 13f79535-47bb-0310-9956-ffa450edef68
2001-08-25 23:43:19 +00:00
William A. Rowe Jr
bb757df043 sec, sec, who's got a sec? This gave me a headache, but I had to clear
out the last patch before I rearranged this to be _readable_.

  Next step for everyone's sanity, provide <Proxy > directives ;)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90646 13f79535-47bb-0310-9956-ffa450edef68
2001-08-24 18:12:02 +00:00
William A. Rowe Jr
6be8943643 Commit this code before another patch becomes to difficult to follow.
This patch does one thing, it changes the root path "/" to reflect an
  element count of Zero (0).  directory_walk will always accept the zero
  element (which sorts first, thankfully) on it's first go around.

  So, Unix will accept "/" when it's parsing it's first element "/".

  Dos/Win32 will accept "/" and "C:/" when they parse their first element,
  "C:/".  The root sorted first, so it behaves as users expect.

  The syntax "//" or "//machine" will be depreciated for now, the user
  needs to set up the extact "//machine/share/" that they want served
  on Win32.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90644 13f79535-47bb-0310-9956-ffa450edef68
2001-08-24 18:01:25 +00:00
William A. Rowe Jr
791e5eef89 Will I ever get my str*cmp semantics right? Not at this hour...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90611 13f79535-47bb-0310-9956-ffa450edef68
2001-08-24 03:45:21 +00:00
William A. Rowe Jr
744ab1e4a7 My initial changes failed to accomodate this faux entry.
If you didn't see any <Directory > blocks working right, try
  this cvs update.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90610 13f79535-47bb-0310-9956-ffa450edef68
2001-08-24 03:40:18 +00:00
Jeff Trawick
0171b0a5b9 fix fubar with recent commit to ap_core_translate()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90598 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 23:49:41 +00:00
William A. Rowe Jr
017d3624ed Fix my typo (I invented the silly constant, you would expect me to recall it.)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90594 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 22:19:49 +00:00
William A. Rowe Jr
304f5cb2c8 Increase security in core.c by testing (as we merge the path) that the
URI does not go above the DocumentRoot (as defined by the OS, not by
  the URI specification), and give us the true name.

  When we are done, note the name is canonical for directory_walk.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90593 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 22:17:19 +00:00
William A. Rowe Jr
1a1e251ca8 Start with the presumption that canonical_filename is not likely to be set.
Therefore we will canonicalize it when it doesn't match filename.

  The next optimization should take the path common to canonical_filename
  and filename, and start merging filename from there for canonicalization.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90591 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 21:56:36 +00:00
William A. Rowe Jr
503b17b20b Eliminated ap_os_[systemcase|[case_]canonical]_filename() and
changes for ap_os_is_path_absolute (moved to util.c).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90572 13f79535-47bb-0310-9956-ffa450edef68
2001-08-23 19:15:13 +00:00
Ryan Bloom
6fdd45dc48 Update the Apache code to account for the XtOffset change in APR.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90356 13f79535-47bb-0310-9956-ffa450edef68
2001-08-19 05:48:19 +00:00
Ryan Bloom
8006145310 Begin to sanitize the MPM configuration directives. Now, all
MPMs use the same functions for all common MPM directives.  This
should make it easier to catch all bugs in these directives once.

Everybody should check their favorite MPM to ensure that it still
compiles, and that these directives work.  This is a big patch, and
although it looks good, and things compiled for me, that is no
garauntee that it will work on all platforms.  :-)

Submitted by:	Cody Sherr <csherr@covalent.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90132 13f79535-47bb-0310-9956-ffa450edef68
2001-08-13 04:57:35 +00:00
Ryan Bloom
6e932b2870 Fix the new method code. We need to cast 1 to an apr_int64_t or it will
be treated as a 32-bit integer, and it will wrap after being shifted
32 times.
Submitted by:	Cody Sherr <csherr@covalent.net> and
		Ryan Morgan <rmorgan@covalent.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90090 13f79535-47bb-0310-9956-ffa450edef68
2001-08-11 04:04:13 +00:00
Ryan Bloom
cf2e6a1831 Remove all warnings from the input filtering stack.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89987 13f79535-47bb-0310-9956-ffa450edef68
2001-08-07 16:19:03 +00:00
Ryan Bloom
85e8fbd0e2 Add the ability to extend the methods that Apache understands
and have those methods <limit>able in the httpd.conf. It uses
the same bit mask/shifted offset as the original HTTP methods
such as M_GET or M_POST, but expands the total bits from an int to
an ap_int64_t to handle more bits for new request methods than
an int provides.
Submitted by:	Cody Sherr <csherr@covalent.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89869 13f79535-47bb-0310-9956-ffa450edef68
2001-08-02 04:25:20 +00:00
William A. Rowe Jr
203ca097b9 This patch fixes more untold breakage than you can shake a stick at.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89863 13f79535-47bb-0310-9956-ffa450edef68
2001-08-01 19:15:22 +00:00
William A. Rowe Jr
0eee59792b Provide the same optimization to the dir_config structure to track
d_is_absolute, along with d_is_fnmatch.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89791 13f79535-47bb-0310-9956-ffa450edef68
2001-07-30 18:51:57 +00:00
William A. Rowe Jr
10f9a8910c More obsessive changes to meet HTML 3.2, HTML 4.01 Transitional and
XHTML 1.0 Transitional


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89750 13f79535-47bb-0310-9956-ffa450edef68
2001-07-28 00:46:49 +00:00
William A. Rowe Jr
ed317a04fc Cliff's most sane advise :-)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89719 13f79535-47bb-0310-9956-ffa450edef68
2001-07-25 22:38:21 +00:00
William A. Rowe Jr
c9148bcd49 This same patch is needed in mod_asis and others, I'm testing the waters
for this solution.  I'm easily convinced to choose AP_MAX_SENDFILE based
  on any reasonable argument, provided it's smaller than 2^30 :-)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89714 13f79535-47bb-0310-9956-ffa450edef68
2001-07-25 21:41:44 +00:00
William A. Rowe Jr
7b2c62a74e Changes to respect the new apr bucket and brigade length types (either
apr_size_t for bucket lengths, or apr_off_t for aggregate brigade lengths.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89683 13f79535-47bb-0310-9956-ffa450edef68
2001-07-24 20:38:01 +00:00
Ryan Bloom
3d8f3ce64b Make scoreboard creation a hook. This allows management
modules to have access to the scoreboard at the time that it is
created, and at every restart request.
Submitted by:	Cody Sherr <csherr@covalent.net>
Reviewed by:	Ryan Bloom


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89608 13f79535-47bb-0310-9956-ffa450edef68
2001-07-18 20:45:36 +00:00
Bill Stoddard
aedbb34ee7 Add error message and return if we fail reading from a bucket in the
core_outout_filter(). core_output_filter() is in need of a rewrite, it is
getting quite crufty.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89507 13f79535-47bb-0310-9956-ffa450edef68
2001-07-06 18:41:56 +00:00
Bill Stoddard
3ab4db196a emulate_sendfile() is a better name for what this function does. No function
change is made by this patch, only a static function name change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89506 13f79535-47bb-0310-9956-ffa450edef68
2001-07-06 18:07:24 +00:00
Cliff Woolley
29212e8c6b *) Account for the new pool parameter to apr_bucket_file_create()
and apr_bucket_file_make().

*) Simplify mod_file_cache's sendfile_handler by taking advantage
   the new ability of file buckets to handle files opened in XTHREAD
   mode.  [Also inlined some of the brigade construction stuff in
   mod_file_cache's handlers to save a palloc() or two.]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89438 13f79535-47bb-0310-9956-ffa450edef68
2001-06-27 20:18:09 +00:00
Jeff Trawick
03a0359eb8 As with Apache 1.3, use priority APLOG_INFO (instead of APLOG_ERR) for
log messages which report network errors writing to the client.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89384 13f79535-47bb-0310-9956-ffa450edef68
2001-06-18 12:38:17 +00:00
Ryan Bloom
afaf899642 Back out the change to allocate files out of the main request pool, and
implement pool-based setaside for FILE and MMAP buckets.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89370 13f79535-47bb-0310-9956-ffa450edef68
2001-06-14 22:56:12 +00:00
Greg Stein
e5640cedcc Define a hook for fetching management/status items.
This patch was submitted by Ian Holsman. Greg revised some names, applied
the Apache style, and namespace-prefixed the public symbols. Minor bugfix in
the use of the hook implementation macro.

Submitted by: Ian Holsman <IanH@cnet.com>
Reviewed by: Greg Stein


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89364 13f79535-47bb-0310-9956-ffa450edef68
2001-06-13 20:11:45 +00:00
Ryan Bloom
66a61c359d Add a pool to the ap_save_brigade prototype. This removes a todo from
the comments that is really necessary before the setaside stuff will
work properly.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89362 13f79535-47bb-0310-9956-ffa450edef68
2001-06-13 13:44:40 +00:00
Greg Ames
4419b1ab32 Fix seg faults and/or missing output from mod_include. The
default_handler was using the subrequest pool for files and
MMAPs, even though the associated APR structures typically
live longer than the subrequest.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89354 13f79535-47bb-0310-9956-ffa450edef68
2001-06-12 19:03:08 +00:00
Ryan Bloom
0f8c1f462c We need to increment i during this for loop. Without this change, we will
end up in an infinite loop.
Submitted by:	Ryan Morgan


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89309 13f79535-47bb-0310-9956-ffa450edef68
2001-06-08 16:39:48 +00:00
Ryan Bloom
1c98aabbf1 Back out the recent change to ap_get_brigade, to make it use indirection
again.  The problem is that the amount of data read from the network,
is not necessarily the amount of data returned from the filters.  It is
possible for input filters to add bytes to the data read from the network.

To fix the original bug, I just removed the line from ap_get_client_block
that decremented r->remaining, we allow the http_filter to do that for
us.

I have also removed an incorrect comment.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89041 13f79535-47bb-0310-9956-ffa450edef68
2001-05-06 23:27:14 +00:00
Greg Stein
5cba6d7345 Fix a bug in the input handling. ap_http_filter() was modifying *readbytes
which corresponded to r->remaining (in ap_get_client_block). However,
ap_get_client_block was *also* adjusting r->remaining. Net result was that
PUT (and probably POST) was broken. (at least on large inputs)

To fix it, I simply removed the indirection on "readbytes" for input
filters. There is no reason for them to return data (the brigade length is
the return length). This also simplifies a number of calls where people
needed to do &zero just to pass zero.

I also added a number of comments about operations and where things could be
improved, or are (semi) broken.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89008 13f79535-47bb-0310-9956-ffa450edef68
2001-05-05 11:18:01 +00:00
Bill Stoddard
91a89a9056 Set the conn_rec->aborted flag when we detect a whacked connection on the
write path.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88978 13f79535-47bb-0310-9956-ffa450edef68
2001-05-02 20:15:56 +00:00