1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

560 Commits

Author SHA1 Message Date
Brian Pane
39a227d48d Simpler, faster code for generating HTTP response headers:
Instead of passing a callback function to apr_table_do() to
generate one field at a time, just build an iovec containing
all the fields and make a single call to apr_brigade_writev().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97122 13f79535-47bb-0310-9956-ffa450edef68
2002-10-07 05:10:54 +00:00
Brian Pane
09ce7e3904 Switch the most frequent apr_brigade_write() and apr_brigade_puts()
calls to apr_brigade_writev() for improved efficiency


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96946 13f79535-47bb-0310-9956-ffa450edef68
2002-09-22 00:05:08 +00:00
Brian Pane
b59de5a08c Clean up the temporary brigade in error cases in ap_discard_request_body()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96663 13f79535-47bb-0310-9956-ffa450edef68
2002-09-06 01:27:48 +00:00
Brian Pane
d6aa2b601f Fixed some bucket memory leaks in ap_http_filter()
Submitted by:	Joe Schaefer <joe+apache@sunstarsys.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96662 13f79535-47bb-0310-9956-ffa450edef68
2002-09-06 01:18:55 +00:00
Brian Pane
95dbc8ea9a Free the temporary working brigade upon exit from ap_get_client_block()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96639 13f79535-47bb-0310-9956-ffa450edef68
2002-09-05 06:20:02 +00:00
Justin Erenkrantz
a85a3814b8 Fix FileETag None directive.
- Fix segfault on strlen computation on the empty string in vlv case
- If the etag is "", don't set the ETag header to be "" - leave the
  header NULL instead.

Andrew's patch would change ap_meets_condition to accept "", but Justin
thinks it would be better just to sidestep it all together and not set
ETag when it would be "".

PR: 12207
Submitted by:	Andrew Ho <andrew@tellme.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96609 13f79535-47bb-0310-9956-ffa450edef68
2002-09-01 18:31:30 +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
Greg Ames
787074640b remove some dead code. It's been there since 1996 (1.3 rev 1.28), so
extra eyeballs would be appreciated.

If it's not really dead, then we need to re-arrange this function so
that earlier changes to the r aren't lost.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96321 13f79535-47bb-0310-9956-ffa450edef68
2002-08-08 20:39:15 +00:00
William A. Rowe Jr
26e0cc6f6d Just an observation, we potentially read/retain far too much of the body,
and this can be optimized.  Not a problem for sendfile based byterange
  requests, but potentially lethal to serve byterange requests of any
  parsed or cgi generated responses.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96304 13f79535-47bb-0310-9956-ffa450edef68
2002-08-04 18:24:10 +00:00
William A. Rowe Jr
a6ac024104 catch up with the apr_atoll -> apr_atoi64 rename
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96299 13f79535-47bb-0310-9956-ffa450edef68
2002-08-03 19:36:33 +00:00
Wilfredo Sanchez
a47715f8fe Replace atol() calls which should return long long with apr_atoll() calls.
Submitted by: Shantonu Sen <ssen@apple.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96179 13f79535-47bb-0310-9956-ffa450edef68
2002-07-24 20:47:28 +00:00
William A. Rowe Jr
347341d9eb Solve C-L post body reads from the HTTP_IN by ap_get_brigade() so that
we know -immediately- that we've read the last of the data.  This patch
  adds an EOS bucket to the brigade if ctx->remaining has been consumed.

Reviewed by:	Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96104 13f79535-47bb-0310-9956-ffa450edef68
2002-07-17 19:18:39 +00:00
Jeff Trawick
9437341232 add notes about a portability problem -- formatting apr_time_t
in hex


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96094 13f79535-47bb-0310-9956-ffa450edef68
2002-07-17 13:50:26 +00:00
Aaron Bannert
e4e4380ff8 Optimize away a couple 64bit integer divides.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96070 13f79535-47bb-0310-9956-ffa450edef68
2002-07-16 06:35:41 +00:00
Jim Jagielski
b05f096d5f Streamline the handling of C-L values in the common case by using
the known properties of ANSI strtol.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96052 13f79535-47bb-0310-9956-ffa450edef68
2002-07-14 13:18:58 +00:00
Brian Pane
3ef8a0f546 added apr_is_empty_array()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96051 13f79535-47bb-0310-9956-ffa450edef68
2002-07-13 18:16:33 +00:00
Brian Pane
667d57fb5b Replaced APR_USEC_PER_SEC division with the new apr_time_sec() macro
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95913 13f79535-47bb-0310-9956-ffa450edef68
2002-06-30 03:46:56 +00:00
Justin Erenkrantz
561d4c3874 Strengthen error-detection code in HTTP_IN and core_input_filter so that
invalid readbytes or errors reading brigades are properly handled.

Reviewed by:	Brian Pane


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95897 13f79535-47bb-0310-9956-ffa450edef68
2002-06-27 05:18:19 +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
2a9d69a140 ap_discard_request_body: exit without reading the body if
connection->keepalive is false.  This works in conjunction with
ap_die which resets connection->keepalive any time
ap_status_drops_connection is true.  The latter is explicity tested
here in case ap_die isn't involved.

Submitted by:   Justin Erenkrantz, Greg Ames


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95882 13f79535-47bb-0310-9956-ffa450edef68
2002-06-24 17:06:19 +00:00
Aaron Bannert
c37b7fb8b5 Better document the error cases returned from get_chunk_size().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95810 13f79535-47bb-0310-9956-ffa450edef68
2002-06-19 18:43:28 +00:00
Roy T. Fielding
6753f54344 It isn't valid to check errno without setting it first, unless an
error return value already indicated that errno was set.  Also, we might
as well accept any error or junk remaining in the field as a parse error.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95743 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 00:14:21 +00:00
Justin Erenkrantz
3ea796a166 Do not use atol() for the Content-Length parsing as its handling of error
cases is undetermined by the ANSI C standard.

Instead, use strtol() with a check for the ERANGE error condition.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95740 13f79535-47bb-0310-9956-ffa450edef68
2002-06-17 22:46:30 +00:00
Justin Erenkrantz
b7319396a7 Rewrite ap_get_client_block to rely on assumptions that have been
solidified after this code was originally written.  Namely:

- AP_MODE_READBYTES will only return a brigade representing AT MOST bytes
  of data.  It can NOT return MORE than requested.
- APR_BLOCK_READ is respected - it is considered a design error of a filter
  if it returns without reading something.
- apr_brigade_flatten is available to do the heavy lifting of the copying
  into a flat buffer (as hinted at by the removed comment).

Tested with httpd-test.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95721 13f79535-47bb-0310-9956-ffa450edef68
2002-06-17 05:09:45 +00:00
Cliff Woolley
f75ee91d7e this comment is way bogus
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95656 13f79535-47bb-0310-9956-ffa450edef68
2002-06-13 20:30:09 +00:00
William A. Rowe Jr
7af68c0bf5 Solve the 80/20 by initializing and storing server_rec->timeout and
server_rec->keep_alive_timeout in apr_time_interval_t format (in apr
  units, whatever they be), as both values exist to pass into APR, and
  all APR timeouts are in apr_time_t.

Reviewed by:	Cliff Woolley


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95623 13f79535-47bb-0310-9956-ffa450edef68
2002-06-12 23:59:31 +00:00
Justin Erenkrantz
c21c07ae09 Tighten this variable's scope to only where it is needed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95583 13f79535-47bb-0310-9956-ffa450edef68
2002-06-08 04:36:05 +00:00
Ryan Bloom
916940b895 Allow ap_discard_request_body to be called multiple times in the
same request.  Essentially, ap_http_filter keeps track of whether
it has sent an EOS bucket up the stack, if so, it will only ever
send an EOS bucket for this request.

Submitted by:	Ryan Bloom, Justin Erenkrantz, Greg Stein


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95505 13f79535-47bb-0310-9956-ffa450edef68
2002-06-04 18:50:13 +00:00
Ryan Bloom
e5777ed3e6 If the request doesn't have a body, then don't try to read it. Without
this, the httpd-test suite was taking five minutes for EVERY test.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95452 13f79535-47bb-0310-9956-ffa450edef68
2002-05-31 20:41:06 +00:00
Justin Erenkrantz
305c215b76 Fix the case where if there is no ErrorDocument specified for an error,
the error would be sent to the client *twice* because both the filter
and the core would trigger error responses.

The problem is that the filters have already handled some errors (say 413)
and due to the ap_get_client_block API, the error was morphed into 400.
Therefore, ap_discard_request_body must use brigades directly rather than
the ap_get_client_block API so that any potential errors are not dropped.

The special value AP_FILTER_ERROR indicates that the lower level has
already dealt with this problem (ap_die() will realize this).  Otherwise,
we'll error with HTTP_BAD_REQUEST and ap_die() will take it from there.

This also prevents needless memory copies when we are just going to
discard it anyway.

Thanks to Cliff Woolley who found this wacky problem.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95424 13f79535-47bb-0310-9956-ffa450edef68
2002-05-31 07:19:04 +00:00
Aaron Bannert
9a80a733b1 This fixes a failed assert when r->remaining is left in a negative
state and we hit some other error (like permission failure) causing
an internal redirect causing us to reevaluate the input buffers
(for discarding the request body).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95419 13f79535-47bb-0310-9956-ffa450edef68
2002-05-31 00:23:34 +00:00
Justin Erenkrantz
be12d995f2 This should have remained cleanup not a re-creation.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95418 13f79535-47bb-0310-9956-ffa450edef68
2002-05-30 23:27:15 +00:00
Justin Erenkrantz
4930450013 - Fix case where the initial chunk length was 0 was not handled correctly.
- Fix bucket lifetimes so that they don't live longer than their brigades.
  That's not nice.
- Simplify some usage of f->r->connection to f->c in the bucket creation
  calls.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95416 13f79535-47bb-0310-9956-ffa450edef68
2002-05-30 23:13:16 +00:00
Justin Erenkrantz
5607afff2b Add a PROXYREQ_RESPONSE value for request_rec->proxyreq because it is
possible that there can be different behavior at the protocol level if
request_rec isn't really a request but a response.

This stems from the fact that request bodies must be indicated by
Content-Length or Transfer-Encoding, but response bodies do not.  The
recent change to ap_http_filter to return EOS if there isn't a body broke
proxy.  Therefore, there must be some way for the proxy to indicate that
this is a response.  Accordingly, ap_http_filter can allow the BODY_NONE
iff this is a response.

Since r->proxyreq is set to PROXYREQ_PROXY even for the original request
from the client, that value isn't sufficient.  Hence, the introduction of
PROXYREQ_RESPONSE.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95390 13f79535-47bb-0310-9956-ffa450edef68
2002-05-30 07:04:45 +00:00
Justin Erenkrantz
1bf35f3dfd As discussed previously on-list, HTTP_IN should return EOS if it thinks
there is no request body.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95370 13f79535-47bb-0310-9956-ffa450edef68
2002-05-29 23:04:14 +00:00
Aaron Bannert
2a83cd4236 Ignore leading zeros when parsing hex value for chunk extensions.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95352 13f79535-47bb-0310-9956-ffa450edef68
2002-05-29 14:57:26 +00:00
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