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

353 Commits

Author SHA1 Message Date
Bill Stoddard
c184561fb3 Fix bug which would cause offset to be ignored in send_the_file() if there were
no headers to send.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86477 13f79535-47bb-0310-9956-ffa450edef68
2000-10-09 16:35:20 +00:00
Bill Stoddard
3e5333488f Handle receiving APR_ENOTIMPL from apr_sendfile. This is mainly to accomodate
Windows 95/98 with binaries compiled on Windows NT.  The solution is not specific
toWindows though.  Catch up on some CHANGES logging.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86476 13f79535-47bb-0310-9956-ffa450edef68
2000-10-09 16:33:24 +00:00
Ryan Bloom
d07a6058a1 Fix the char-at-a-time problem. To fix this, we just buffer up a line
until we have found a LF, then we send the data up to the previous filter.
I have test on Linux with both Linux's telnet and Win 98 telnet.  Win98
uses a char-at-a-time, so this should solve the problem.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86457 13f79535-47bb-0310-9956-ffa450edef68
2000-10-08 19:03:18 +00:00
Ryan Bloom
a9e2a3673b Update send_the_file to fall back to a read/write loop on platforms
without sendfile.  This also makes the apr_hdtr_t type available on
all platforms, regardless of whether apr_sendfile is defined or not.
Submitted by:	Brian Havard and Ryan Bloom


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86437 13f79535-47bb-0310-9956-ffa450edef68
2000-10-07 21:54:16 +00:00
Ryan Bloom
360f36a96b The core filter should not be using its own brigade inside its own ctx
structure.  This changes the core_output_filter to use a brigade inside
the conn_rec.  Think of this as analagous to the BUFF in the conn_rec.
The idea is that if we have pipelined requests, and it isn't worth it to
send the last bit of data from the first request, we want to save that
extra bit of data to the conn_rec, so that the next request sends it
automatically.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86433 13f79535-47bb-0310-9956-ffa450edef68
2000-10-07 18:10:02 +00:00
Jim Jagielski
3933b6d72f This is ugly, but at least we compile again on platforms that lack
sendfile().
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86423 13f79535-47bb-0310-9956-ffa450edef68
2000-10-07 00:37:18 +00:00
William A. Rowe Jr
cbd58ab0bd Here it is, the Win32 part of the big canonical errors patch.
The reason is really, really simple.  If we ever choose to mix clib and
  dos error codes, they criss-cross and don't line up, but they share the
  same number space.  As I wrote the new APR_IS_ERROR macros, I realized
  we were about to shoot ourselves in the foot.

  These changes nearly entirely affect Win32 only.  The next big patch will
  affect all of the rv == APR_ENOENT type problems throughout the system.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86416 13f79535-47bb-0310-9956-ffa450edef68
2000-10-06 17:24:43 +00:00
Ryan Bloom
bb8525b09d Add the first draft of the http_filter. In time this filter will split
the bucket brigade between the headers and the body.  Right now it just
converts \r\n to \n\0.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86412 13f79535-47bb-0310-9956-ffa450edef68
2000-10-06 06:07:07 +00:00
Jeff Trawick
b7d765272e Add a bit of infrastructure which will be needed for input filtering:
1) separate filter lists hanging off the r and the c

   requests start off with the same filter list as the connection

   the input filter list is not initialized for subrequests

   internal redirects start off with the same filter list as the
   connection

2) AddInputFilter directive (blatant rip-off of Ryan's AddOutputFilter
   directive); as with AddOutputFilter, the network is implicitly to the
   right of the specified filter list; this may not be the most
   intuitive way to specify the filters; not sure yet


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86403 13f79535-47bb-0310-9956-ffa450edef68
2000-10-05 16:55:10 +00:00
Jeff Trawick
a9a0b56629 Now that we have ap_add_input_filter(), rename ap_add_filter() to
ap_add_output_filter().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86401 13f79535-47bb-0310-9956-ffa450edef68
2000-10-05 12:01:48 +00:00
Ryan Bloom
8b56ba850a Connection oriented filters are now stored in the conn_rec instead of the
request_rec.  This means that a conn_rec must be supplied when calling
ap_add_filter.  The reason for this change is that we need to be able to
add the core_filter (whether or SSL or not) before we try to read the
request.  This way, if a request fails, we can actually send the error
page back to the client.  With this change, we add the core filter to the
conn_rec during the pre-connection phase.
Submitted by:	Ryan Bloom, Jeff Trawick, and Greg Ames


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86392 13f79535-47bb-0310-9956-ffa450edef68
2000-10-04 23:19:33 +00:00
Jeff Trawick
73be8aa199 In core_output_filter(), reset nbytes to zero after calling
writev_it_all() in case we have another brigade to process.
Otherwise, nbytes is bogus for the second brigade and
writev_it_all() doesn't know when to quit (it loops).

In writev_it_all(), when compensating for bytes already sent
don't go beyond the number of iovs we were passed on input.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86391 13f79535-47bb-0310-9956-ffa450edef68
2000-10-04 22:09:46 +00:00
Bill Stoddard
f1a7b0d209 Take another shot at reimplementing core_output_filter. This implementation buffers
brigades across multiple calls until MAX_IOVEC_TO_WRITE or
MIN_SIZE_TO_WRITE thresholds are hit. This implementation does not attempt
to coalesce bytes. Moving a bit further down the filter learning curve...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86389 13f79535-47bb-0310-9956-ffa450edef68
2000-10-04 19:11:03 +00:00
Jeff Trawick
eed0345ff6 Clean up md5 digest support in default_handler() a bit:
1) don't compute md5 if we have a content filter; it is almost always wrong
2) add note about adding md5 filter in the future; this can be done
3) delete some APACHE_XLATE/CHARSET_EBCDIC baggage associated with md5
   digest support; part of this deleted baggage is a segfault on
   subrequests referencing r->rrx (which is not allocated for subrequests)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86385 13f79535-47bb-0310-9956-ffa450edef68
2000-10-04 17:14:00 +00:00
Jeff Trawick
d0c344bafa Change core_input_filter() so that it returns an empty brigade upon
FIN/EOF or error.  This meshes with what getline() looks for.  It isn't
perfect, but it avoids some nasty loops consuming all available storage
on http/1.1 connections.  In keepalive state, we call getline to read the
next request...  getline() calls core_input_filter() (indirectly)...
core_input_filter() calls apr_recv() which returns APR_SUCCESS/0 bytes
to signal FIN/EOF.  But core_input_filter() returned a bucket with length
zero to getline(), so getline() called core_input_filter() again.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86379 13f79535-47bb-0310-9956-ffa450edef68
2000-10-03 21:56:43 +00:00
Ryan Bloom
ba047efee0 Move where the CORE_IN filter is added to the server. We used to do this
in ap_new_connection, but that is bogus, because then other modules can't
put their own filter in.  Now, we do this in a new pre-connection hook
function.  Later, we will want to add some checking to make sure that this
is really an HTTP request that we are adding the filter for.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86364 13f79535-47bb-0310-9956-ffa450edef68
2000-10-02 19:52:37 +00:00
Ryan Bloom
7ae2f294fd Implement input filtering. This is definately not completely correct, but
it is a good first step.  It is possible to add filters when reading from
the client with this change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86359 13f79535-47bb-0310-9956-ffa450edef68
2000-10-02 00:47:28 +00:00
Bill Stoddard
bddddae4a1 First cut at a filter to buffer/coalesce multiple small buckets into a single large bucket.
This implementation is limited to coalescing a single string of small (< MIN_BUCKET_SIZE)
buckets into one large bucket.  If a brigade contains a string of small buckets followed by a
large bucket followed by another string of small buckets, only the first string will be coalesced.

This implementation works very well with the output generated by mod_autoindex though.
The number of iovecs handled by http_core is reduced to three from over a thousand for my
test case.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86355 13f79535-47bb-0310-9956-ffa450edef68
2000-09-29 18:12:14 +00:00
Jeff Trawick
22f4f4488f Fix the lifetime of the autodata buffer used for the chunk header.
Submitted by:	Bill Stoddard
Reviewed by:	Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86352 13f79535-47bb-0310-9956-ffa450edef68
2000-09-28 22:57:17 +00:00
Bill Stoddard
3a1e7ab1cb Fix compile break. It should be apr_pstrcat.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86317 13f79535-47bb-0310-9956-ffa450edef68
2000-09-25 16:42:49 +00:00
William A. Rowe Jr
5e822a1c34 Return a decent message, in keeping with conf parsing semantics.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86313 13f79535-47bb-0310-9956-ffa450edef68
2000-09-24 20:13:42 +00:00
Jeff Trawick
ec6cfbd4ed Clean up a few warnings in core_filter().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86311 13f79535-47bb-0310-9956-ffa450edef68
2000-09-24 13:04:31 +00:00
Jeff Trawick
b98f31a568 The new core post_read_request hook needs to return something
(DECLINED).  This allows Apache to serve pages again (other than
the 500 Internal Server Error page, that is).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86309 13f79535-47bb-0310-9956-ffa450edef68
2000-09-23 22:09:30 +00:00
Ryan Bloom
d1a8073aa8 Combine the calls to add the core_filter to one place. Basically, it is
safe to add the core_filter during the post_read_request, and it means
that we only have to add the filter once in the code.  This should make
it easier to add an SSL module in the future.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86307 13f79535-47bb-0310-9956-ffa450edef68
2000-09-23 18:39:30 +00:00
Bill Stoddard
35b3a966f2 Make the core_filter use apr_sendv and apr_sendfile as appropriate. This is still a bit crufty
but it is an improvement over the previous implementation.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86298 13f79535-47bb-0310-9956-ffa450edef68
2000-09-22 20:36:20 +00:00
Bill Stoddard
964740fd45 Fix error in setting bytes_sent. Need more time to think about the other problem
noted in this commit. Thanks Jeff!


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86281 13f79535-47bb-0310-9956-ffa450edef68
2000-09-21 22:44:51 +00:00
Bill Stoddard
9115d6301c First cut at a file bucket. Modify the core_filter to handle use
of apr_sendfile(). Modify ap_send_fd() to use the new file bucket.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86278 13f79535-47bb-0310-9956-ffa450edef68
2000-09-21 16:22:13 +00:00
Greg Ames
c0f7a5b2c8 Fix a bug where errors that happen during early request parsing (like 400
HTTP_BAD_REQUEST) don't send any error message content to the browser.
The core_filter wasn't present this early in request parsing, so the output
went into the bit bucket via r[v]puts->ap_pass_brigade.

The chunking filter takes care of itself nicely, because it is added in
ap_send_http_header if it's needed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86253 13f79535-47bb-0310-9956-ffa450edef68
2000-09-19 21:11:01 +00:00
Ryan Bloom
96c98ff58b tart getting things setup for input filtering. All this basically does
is add part of the infrastructure.  Namely:

1) filter list in the conn_rec, which is where the input filter list
   must live

2) Split the register_filter into multiple functions, one to register
   input filters the other to register output filters.

3) Modify existing modules so they still work.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86251 13f79535-47bb-0310-9956-ffa450edef68
2000-09-19 20:56:09 +00:00
Ryan Bloom
29e68ae602 Change r->filters to r->output_filters. This sets things up for us to
put input filters into Apache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86246 13f79535-47bb-0310-9956-ffa450edef68
2000-09-18 01:24:55 +00:00
Jeff Trawick
cc23cc0866 Fix the types of the variables passed as the len parm to bucket->read()
(in various places).
In ab, change the declaration of argv so that it can be passed into
apr_initopt() without warning.
Submitted by:	Victor J. Orlikowski <v.j.orlikowski@gte.net>
Reviewed and modified slightly by:	Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86229 13f79535-47bb-0310-9956-ffa450edef68
2000-09-14 18:42:58 +00:00
Ryan Bloom
fc05e522e0 Change AddFilter name to AddOutputFilter
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86227 13f79535-47bb-0310-9956-ffa450edef68
2000-09-14 15:37:17 +00:00
Doug MacEachern
dad154a2ca put ctx back in ap_add_filter()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86224 13f79535-47bb-0310-9956-ffa450edef68
2000-09-14 05:08:42 +00:00
Tony Finch
154bfafb72 Improve the way the chunking filter handles zero-length buckets,
and fix the comment explaining how to reduce the incidence of tiny chunks.
Submitted by:	Jeff Trawick
Reviewed by:	Tony Finch


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86222 13f79535-47bb-0310-9956-ffa450edef68
2000-09-14 02:16:07 +00:00
Ryan Bloom
9c295f8e68 Add the AddFilter directive. This directive takes a list of filter names
that have been previously registered with the server.  Currently the
directive is only valid inside the config file, but once the Options
directive is tweaked a bit, I would feel more comfortable exposing this
directive to htaccess files.

As a part of making adding this filter, I removed the ctx pointer from the
ap_add_filter prototype.  The problem is that the core is the thing that
is actually inserting the filter into the filter stack, but the core doesn't
know how to allocate memory for each filter.  The solution is to have the
filters themselves be responsible for allocating the ctx memory whenever
it is required.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86220 13f79535-47bb-0310-9956-ffa450edef68
2000-09-13 23:13:20 +00:00
Ken Coar
5d50a3e277 Start introducing the extension-method elements so we're not
bound to hard-coded names and a bitmask.  We still use the
	bitmask for known methods, but we also have an array for
	extension method named.  Wherever we used the M_* constants
	we need to use a routine that knows about the new structure instead.

	This is far from complete, but AFAIK this interim work doesn't
	break anything -- especially the compile.  The rest of the
	work will be added in segments; this is just a checkpoint.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86210 13f79535-47bb-0310-9956-ffa450edef68
2000-09-13 01:58:15 +00:00
Tony Finch
2e15f37567 Use XXX for comments describing inadequacies in the code, as in the rest
of Apache.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86196 13f79535-47bb-0310-9956-ffa450edef68
2000-09-10 05:00:03 +00:00
Greg Stein
5a6282f94e pass_chunk() was tossing a brigade composed of just the EOS bucket. on
entry, it saw there were zero bytes and simply returned. the client
    would never receive "end of response" and timeout (or the server would
    timeout the client).

*) added comments about what is going on
*) place chunk start/end markers around just the content, if that content
   is non-zero in length
*) insert all the right "end of response" stuff before the EOS bucket


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86193 13f79535-47bb-0310-9956-ffa450edef68
2000-09-09 22:35:03 +00:00
Tony Finch
7ac6ab9f51 Use wrapper macros to avoid the verbosity of the AP_RING macros when
doing things with bucket brigades.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86185 13f79535-47bb-0310-9956-ffa450edef68
2000-09-09 06:48:10 +00:00
Tony Finch
7f4afedb57 Fix inserting elements at the head and tail of a ring when the ring is
empty. Avoiding referring to the element type in the macros resulted
in some double dereferences that did the wrong thing.
Reported by:	Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86184 13f79535-47bb-0310-9956-ffa450edef68
2000-09-09 01:11:15 +00:00
Tony Finch
6d7be19c90 Reduce the manualarity of managing bucket brigade lists by using the
new AP_RING macros. Most of this commit is fairly pedestrian as you
would expect, but I had to redo the chunking filter because of the
amount of pointer juggling it did. I have done some minimal testing
of this patch and it seems to work.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86178 13f79535-47bb-0310-9956-ffa450edef68
2000-09-08 10:16:14 +00:00
Jeff Trawick
3b64d1dfdf Fix merging of AddDefaultCharset directive.
PR:		5872 (reported against 1.3)
Submitted by:	Jun Kuriyama <kuriyama@imgsrc.co.jp>
Reviewed by:	Jeff Trawick


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86176 13f79535-47bb-0310-9956-ffa450edef68
2000-09-07 23:51:36 +00:00
Greg Stein
a1d3d62fc6 reversing the latest commit; it was vetoed a while back.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86162 13f79535-47bb-0310-9956-ffa450edef68
2000-08-30 01:09:09 +00:00
Ryan Bloom
eab77d60ac Modify the way filters are added to the server. Instead of using a FIFO,
we use a modified LIFO.  It is modified, because if we add a filter while
in the middle of another filter, the added filter gets put in after the
current filter.  This requires that the server is smart about which filters
are added when.  This should be handled by the HTTP protocol, but we will
want to keep and eye on things for a little while.

This change is necessary, because currently when we add a filter it goes
after the last filter of the same type.  This is broken whenever we want
to add a filter that has a dependancy.  Think about the core and chunking
filters.  They are of the same type, and core is always added first.  When
we go to insert chunking, it gets added, but it is never called.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86161 13f79535-47bb-0310-9956-ffa450edef68
2000-08-29 22:16:45 +00:00
Jeff Trawick
f357ceef76 Filters (and thus ap_pass_brigade()) now return an apr_status_t as their
return value.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86160 13f79535-47bb-0310-9956-ffa450edef68
2000-08-29 20:57:29 +00:00
Jeff Trawick
d94ed1313d Stop using strlen() for the size of an array. It isn't valid C
(though gcc was happy with it).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86159 13f79535-47bb-0310-9956-ffa450edef68
2000-08-29 20:21:30 +00:00
Jeff Trawick
933a5d5736 Update chunk_filter to handle buckets with unknown length (e.g., pipes).
As soon as we hit such a bucket, we'll read from it then pass everything
we have so far on to the next filter.  At that point we'll start over.

Also, increase the size of the chunk header buffer to handle larger
lengths.

Note: There is still an extra final chunk header (0) when mod_cgi is used
because EOS is coming down twice.

This is likely to have some bugs here and there.  Even worse, it is butt
ugly and in need of simplification.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86155 13f79535-47bb-0310-9956-ffa450edef68
2000-08-28 20:36:42 +00:00
Ryan Bloom
ae7cca1bd9 Remove IOLs from Apache. They are no longer necessary, now that we have
filtering beginning to work.  There is a hack that has been repeated
through this patch, we morph a pipe into a socket, and put the socket
into the BUFF.  Everytime we do that, we are working with a pipe from
a CGI, and we should be creating a pipe bucket and passing that bucket
back.  Because we don't actually have pipe buckets yet, we are using this
hack.  When we get pipe buckets, this will be fixed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86136 13f79535-47bb-0310-9956-ffa450edef68
2000-08-23 00:01:58 +00:00
Tony Finch
e577544881 Add generic support for reference-counting the resources used by
buckets, and alter the HEAP and MMAP buckets to use it. Change
the way buckets are initialised to support changing the type of
buckets in place, and use it when setting aside TRANSIENT buckets.
Change the implementation of TRANSIENT buckets so that it can be
mostly shared with IMMORTAL buckets, which are now implemented.

Reviewed by:	rbb


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86115 13f79535-47bb-0310-9956-ffa450edef68
2000-08-19 06:04:57 +00:00
Ryan Bloom
6545ce8d02 Fix chunking. Two bugs fixed.
1)  don't put the trailing 0\r\n\r\n in lenstr; that buffer is
    already in use (pointed to by another transient bucket); using
    lenstr again overlays that other chunk header
2)  insert the bucket with the trailing "0\r\n\r\n" *before* the eos bucket
Submitted by:	Jeff Trawick <trawickj@bellsouth.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86095 13f79535-47bb-0310-9956-ffa450edef68
2000-08-18 04:46:07 +00:00