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

524 Commits

Author SHA1 Message Date
Aaron Bannert
0310c2dff7 Properly detect overflow when reading the hex chunk lines.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95342 13f79535-47bb-0310-9956-ffa450edef68
2002-05-29 06:42:58 +00:00
Justin Erenkrantz
3edf15c424 Switch the limit directive enforcement error paths to match the error handling
code for invalid chunk sizes.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95332 13f79535-47bb-0310-9956-ffa450edef68
2002-05-28 23:55:53 +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
355c623868 Faster, simpler code for form_header_field() on ASCII based
platforms


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95049 13f79535-47bb-0310-9956-ffa450edef68
2002-05-12 21:50:46 +00:00
Brian Pane
2cd262da3c Optimization: replaced apr_pstrcat+apr_strlen with apr_pstrcatv in
basic_http_header()


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95042 13f79535-47bb-0310-9956-ffa450edef68
2002-05-12 01:18:28 +00:00
Cliff Woolley
68055b343f Fix if-modified-since on win32, I think. It should fix it in theory.
Verification would be nice.  At least I know it still works on Unix.  ;)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95007 13f79535-47bb-0310-9956-ffa450edef68
2002-05-08 02:17:04 +00:00
Cliff Woolley
19dcad16a0 Simplify a bit
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94945 13f79535-47bb-0310-9956-ffa450edef68
2002-05-06 08:14:52 +00:00
Justin Erenkrantz
105cb01305 Rewrite ap_byterange_filter so that it can work with data that does not
have a predetermined C-L - such as data that passes through mod_include.
Previously, these requests would generate 416 since when the byterange
filter ran, r->clength would be 0.  r->clength is only guaranteed to
be valid after C-L filter is run, but we need C-L to run after us so
that our data can have a proper C-L returned.  So, we need to rearrange
the code so that we can deal with this case.

Highlights:
- Remove r->boundary since it is possible to have this self-contained in
  boundary's ctx.  (May require MMN bump?)
- Remove call to parse_byteranges in ap_set_byterange since this would
  wrongly return -1 for dynamic responses.  We have to wait until we
  see EOS to call parse_byteranges.
- Move bound_head computation inside the num_parts == 2 check.
- Change a NULL brigade check to APR_BRIGADE_EMPTY
- Move the 416 error return to after we've run through all ranges and
  found none of them to be valid.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94942 13f79535-47bb-0310-9956-ffa450edef68
2002-05-06 07:43:40 +00:00
Justin Erenkrantz
33e0746661 The force-response-1.0 and downgrade-1.0 checks were swapped. This
would mean that downgraded requests were ineligible for force-response
checks.

Previously, 1.3 would do the downgrade in process_request_internal and
then the force-response later on in basic_http_header.

PR: 8357


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94771 13f79535-47bb-0310-9956-ffa450edef68
2002-04-23 22:15:09 +00:00
Brian Pane
a040b262c5 Optimization: short-circuit out of ap_set_byterange() more quickly if the
client isn't requesting a range


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94746 13f79535-47bb-0310-9956-ffa450edef68
2002-04-22 05:05:50 +00:00
Brian Pane
166b62f9c5 Added ap_recent_rfc822_date(), which uses the recent timestamp cache
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94735 13f79535-47bb-0310-9956-ffa450edef68
2002-04-21 07:55:50 +00:00
Justin Erenkrantz
1826f624eb 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94704 13f79535-47bb-0310-9956-ffa450edef68
2002-04-18 22:50:54 +00:00
Justin Erenkrantz
4d16513418 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94676 13f79535-47bb-0310-9956-ffa450edef68
2002-04-17 04:09:07 +00:00
Justin Erenkrantz
b92d0b62b3 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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94668 13f79535-47bb-0310-9956-ffa450edef68
2002-04-16 05:50:37 +00:00
Justin Erenkrantz
6f208d31a7 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.

showstoppers--;


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94667 13f79535-47bb-0310-9956-ffa450edef68
2002-04-16 05:43:09 +00:00
Greg Ames
d4a51d0f74 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.

Submitted by:	Greg Ames, Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94662 13f79535-47bb-0310-9956-ffa450edef68
2002-04-15 20:42:45 +00:00
Justin Erenkrantz
a9960ebdbb Prevent ap_add_output_filters_by_type from being called in
ap_set_content_type if the content-type hasn't changed.

Reviewed by:	Ryan Bloom


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94368 13f79535-47bb-0310-9956-ffa450edef68
2002-04-01 22:26:09 +00:00
Cliff Woolley
3e2ce19baf BUCKET FREELISTS
Add an allocator-passing mechanism throughout the bucket brigades API.

From Apache's standpoint, the apr_bucket_alloc_t* used throughout a given
connection is stored in the conn_rec by the create_connection hook.  That
means it's the MPM's job to optimize recycling of apr_bucket_alloc_t's --
the MPM must ensure that no two threads can ever use the same one at the
same time, for instance.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94304 13f79535-47bb-0310-9956-ffa450edef68
2002-03-29 08:17:26 +00:00
Jeff Trawick
743eeb21e9 style improvement for checking whether the result of an
assignment was NULL

Submitted by:	Sander Striker


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94220 13f79535-47bb-0310-9956-ffa450edef68
2002-03-27 13:05:14 +00:00
Cliff Woolley
7a5af0ba71 Anal-retentive factor -- be consistent in our whitespace.
Reviewed by: Greg Stein


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94192 13f79535-47bb-0310-9956-ffa450edef68
2002-03-27 00:28:07 +00:00
Cliff Woolley
a31e5cc460 nit
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94157 13f79535-47bb-0310-9956-ffa450edef68
2002-03-25 07:37:34 +00:00
Cliff Woolley
0cdeea46f3 What, we don't support HEAD requests now? ;)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94154 13f79535-47bb-0310-9956-ffa450edef68
2002-03-25 01:10:06 +00:00
Jeff Trawick
ee4a64c90a add an extra level of parentheses to say "yes I know what I'm
doing with that single '='" and more importantly to quiet a
gcc -Wall warning


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94141 13f79535-47bb-0310-9956-ffa450edef68
2002-03-22 20:37:04 +00:00
Graham Leggett
9cb9ca8e3a When a proxied site was being served, Apache was replacing
the original site Server header with it's own, which is not
allowed by RFC2616. Fixed.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94133 13f79535-47bb-0310-9956-ffa450edef68
2002-03-22 18:34:46 +00:00
Bill Stoddard
d5c24720dc Commit 1 of 2 to:
1. rename ap_rset_content_type to ap_set_content_type
2. reverse the arguments on the call to aligh with ap_set_content_length


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94056 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 17:41:55 +00:00
Jeff Trawick
f3c3ebe7f5 ap_rset_content_type() should take const char * instead of char *
this is friendlier to callers and r->content_type is const char *
too so it isn't harmful

this fixes a fatal compile error with AIX+xlc


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94051 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 12:03:49 +00:00
Bill Stoddard
470edb9dd8 First commit to introduce accessor function to set r->content_type..
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94027 13f79535-47bb-0310-9956-ffa450edef68
2002-03-20 01:58:47 +00:00
Greg Stein
b9514876c3 The underlying change here was to add the new WebDAV/DeltaV methods
now that it has an RFC. At the same time, I revamped a good chunk of
the name <-> number mapping code in http_protocol.c

* add M_FOO constants for the new RFC 3253 (DeltaV) methods. label
  where each of the builtin methods comes from.

* moved METHOD_NUMBER_FIRST/LAST from http_protocol.h into
  http_protocol.c since they weren't used anywhere else and they
  weren't namespace-protected.

* create register_one_method() and use it to insert all builtin
  methods (at _init() time) and extended methods into the registry.

* add a lookup_builtin_method() to quickly map a method name to a
  builtin method number.

* rebuild ap_method_number_of() to use the new lookup function.

* revamp ap_method_name_of() to use the registry to locate the name
  for any method number. add a pool argument (no callers in the core
  code needed to be updated)

* revamp make_allow() to deal with the new method numbers and all
  extended methods.

* in mod_dav, use the new method numbers rather than registering the
  DeltaV methods.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94015 13f79535-47bb-0310-9956-ffa450edef68
2002-03-19 10:11:33 +00:00
Jeff Trawick
0bd9790c41 fix the type of a string argument to ap_log_error()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93973 13f79535-47bb-0310-9956-ffa450edef68
2002-03-16 20:29:38 +00:00
Roy T. Fielding
845cbfd508 Update our copyright for this year.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93918 13f79535-47bb-0310-9956-ffa450edef68
2002-03-13 20:48:07 +00:00
Ryan Bloom
c8965c1e94 Adding the same filters over and over again used to be okay, because
we would lose the extra filters.  Now, if a filter is added, it is run.
Unfortunately, this can cause an infinite loop, or it can cause request
headers to appear twice.  This commit removes two instances in the core
where we were inserting filters for a second and third time.  The bug
was that error responses were causing infinite loops.

This also removes the reset_filters function, which did the exact
same thing as add_required_filters.  The two functions were both called
in error conditions, which was part of what caused this bug.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93693 13f79535-47bb-0310-9956-ffa450edef68
2002-03-04 05:54:44 +00:00
Justin Erenkrantz
04533b8d27 Don't set bytes_sent to be 0 when r->assbackwards since this screws up
logging.

The content length filter seems to track bytes_sent properly regardless
of HTTP version.  The HTTP header filter knows not to send C-L (or any
headers) to this client.

showstoppers--;

(Also fix typo of my last name in CHANGES...)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93588 13f79535-47bb-0310-9956-ffa450edef68
2002-02-27 03:55:31 +00:00
Justin Erenkrantz
1ed7a6d590 Oh, no. It's legal to have 0 bytes read. Just not -1. If *that* happens,
I want to see a core.  0 bytes reads are fine.  Grr.

(I'm so tempted to throw this assert out, but if we get -1 length
brigades back, we're gonna be screwed.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93202 13f79535-47bb-0310-9956-ffa450edef68
2002-02-03 17:43:35 +00:00
Justin Erenkrantz
94d01b65aa Change ap_get_brigade prototype to remove *readbytes in favor of readbytes.
If you need the length, you should be using apr_brigade_length.  This is
much more consistent.  Of all the places that call ap_get_brigade, only
one (ap_http_filter) needs the length.  This makes it now possible to
pass constants down without assigning them to a temporary variable first.

Also:
- Change proxy_ftp to use EXHAUSTIVE mode (didn't catch its -1 before)
- Fix buglet in mod_ssl that would cause it to return too much data in
  some circumstances


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93014 13f79535-47bb-0310-9956-ffa450edef68
2002-01-25 01:11:47 +00:00
Justin Erenkrantz
cf16de9220 When doing input filtering, get out the way of anything that we don't want
to be explicitly involved in.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92946 13f79535-47bb-0310-9956-ffa450edef68
2002-01-20 18:53:31 +00:00
Justin Erenkrantz
7d32242a14 Input filtering prototype change: Socket blocking type should be
separate from the input filter mode type.

We also no longer look at readbytes to determine the method of
filter operation.  This makes the use of filters more obvious and
allows a wider range of options for input filters modes.

To start with, the new input filter modes are:

AP_MODE_READBYTES (no more than *readbytes returned)
AP_MODE_GETLINE (old *readbytes == 0 case)
AP_MODE_EATCRLF (old AP_MODE_PEEK)
AP_MODE_SPECULATIVE (will be used in a future ap_getline rewrite)
AP_MODE_EXHAUSTIVE (old *readbytes == -1 case)
AP_MODE_INIT (special case for NNTP over SSL)

The block parameter is an apr_read_type_e: APR_BLOCK_READ, APR_NONBLOCK_READ

This also allows cleanup of mod_ssl's handling in the getline case.

Reviewed by:	Ryan Bloom (concept), Greg Stein (concept)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92928 13f79535-47bb-0310-9956-ffa450edef68
2002-01-19 07:45:18 +00:00
Bill Stoddard
e4494ea98a Log a more descriptive error message.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92851 13f79535-47bb-0310-9956-ffa450edef68
2002-01-14 14:44:25 +00:00
Ken Coar
0d1a46028e Bring forward the FileETag directive enhancement from 1.3.23-dev.
(Passes all 61 of the apache/etags.t test.)  Bump MMN due to
	change to core_dir_config structure (new fields at end).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92830 13f79535-47bb-0310-9956-ffa450edef68
2002-01-11 18:55:27 +00:00
Greg Stein
e312a3c306 Fix how mod_dav examines methods in the request -- use the method number
from the request. To do this, we also need to register all of the new/custom
methods that mod_dav recognizes.

Note: this fixes a bug where a method (e.g. REPORT) would appear in a
Limit(Except) directive and Apache would register the method. The method
number in the request would then be something *other* than M_INVALID, which
threw off mod_dav's tests.

Submitted by: Sander Striker <striker@apache.org>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92764 13f79535-47bb-0310-9956-ffa450edef68
2002-01-07 22:36:15 +00:00
Bill Stoddard
59550522ce Fix seg fault in HTTP_IN when trying to handle the LimitRequestBody
directive when reading a proxy response. We should bypass LimitRequestBody
activities when handling a response from the proxied server.

I don't think this will circumvent requestbody checking on a large request
coming into the server that is destined to be proxied. (not tested though).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92722 13f79535-47bb-0310-9956-ffa450edef68
2002-01-03 19:20:54 +00:00
Justin Erenkrantz
8c16aeeeb8 Fix LimitRequestBody directive by moving the relevant code from
ap_*_client_block to ap_http_filter (aka HTTP_IN).  This is the
only appropriate place for limit checking to occur (otherwise,
chunked input is not correctly limited).

Also changed the type of limit_req_body to apr_off_t to match the
other types inside of HTTP_IN.  Also made the strtol call for
limit_req_body a bit more robust.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92700 13f79535-47bb-0310-9956-ffa450edef68
2002-01-02 07:56:25 +00:00
Brian Pane
c98d16f329 Small performance fix: delay variable initialization in
ap_meets_conditions() until after the point where we
short-circuit out of the function on subrequests


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92354 13f79535-47bb-0310-9956-ffa450edef68
2001-12-06 02:57:19 +00:00
Brian Pane
2f38fa60c8 optimized away the sprintf calls in ap_make_etag()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92161 13f79535-47bb-0310-9956-ffa450edef68
2001-11-24 07:38:52 +00:00
Brian Pane
db91d6cf85 added inlined string concatenation to form_header_field() for speed
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92137 13f79535-47bb-0310-9956-ffa450edef68
2001-11-22 21:04:28 +00:00
Justin Erenkrantz
0506ac2b0a Clean up the declarations and comments of some of the variables in
ap_get_client_block.
There were two len_read vars (each of different types), so the outer one
was shadowed - move it to the correct scope.
Move apr_bucket* old declaration inside of the loop so it is obvious
what its scope is.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91806 13f79535-47bb-0310-9956-ffa450edef68
2001-11-08 19:35:32 +00:00
Justin Erenkrantz
7f3dac3d26 Style guide conformance fixes (remove tabs, enforce {}s, no long lines, etc).
This file has bugged me for ages.  Much better to do this now than later.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91805 13f79535-47bb-0310-9956-ffa450edef68
2001-11-08 19:27:48 +00:00
Ken Coar
b12bfcff03 No functional changes, just style-guide ones..
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91802 13f79535-47bb-0310-9956-ffa450edef68
2001-11-08 15:13:49 +00:00
Greg Ames
272e6e0c4b Insure that ap_get_client_block _always_ sets the length parm positive when
calling ap_get_brigade.  This takes care of the loop with short request bodies
seen on 2.0.27.

This eliminates the use of r->remaining within ap_get_client_block.
http_filter has the equivalent in its context.  r->remaining is
still used in ap_setup_client_block for a "body too long" check.  But that
check can't cover chunked bodies, so it probably should happen elsewhere.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91785 13f79535-47bb-0310-9956-ffa450edef68
2001-11-07 15:41:43 +00:00
Greg Ames
474e1926bb prevent loops & seg faults when GETs have chunked bodies.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91734 13f79535-47bb-0310-9956-ffa450edef68
2001-11-02 20:21:44 +00:00