Ryan Bloom [Sat, 14 Oct 2000 06:21:38 +0000 (06:21 +0000)]
My last patch had most of the code to insert the eos bucket, but it was
missing some major pieces that I only found after the commit. This patch
fixes the problem, and makes sure that request bodies are always ended
with an EOS bucket.
Ryan Bloom [Sat, 14 Oct 2000 04:37:22 +0000 (04:37 +0000)]
Get non-chunked input body filtering working with an EOS bucket. The
basic design has ap_setup_client_block setting a field in the conn_rec
which tells http_filter how much data is in the body (with chunking this
will represent how much data is in the chunk). The ap_get_client_block
then calls down the stack with the maximum amount of data that it can
receive back. When http_filter reads all of the data, it adds an eos
bucket to the end of the brigade. ap_get_client_block continues to read
data until it gets the eos bucket. This allows filters to increase the
size of the body data.
Jeff Trawick [Fri, 13 Oct 2000 18:39:18 +0000 (18:39 +0000)]
Introduce ap_debug_assert() macro, like ap_assert() but only active if
AP_DEBUG is defined.
ap_get_client_block():
. avoid some cases where we leak a temporary bucket brigade
. clean up/fix the logic to copy a brigade into the caller's buffer;
the wrong length was used in some cases
. add an AP_DEBUG-only assertion for some assumptions made regarding
the brigade returned by the filters
Submitted by: partly by Greg Stein, but of course anything bad is mine
Jeff Trawick [Fri, 13 Oct 2000 17:54:24 +0000 (17:54 +0000)]
getline() fixes...
If ap_get_brigade() returns APR_SUCCESS but an empty brigade, bail out.
Previously, we kept going and sometimes segfaulted while operating on
what we thought was the first bucket.
Ryan Bloom [Fri, 13 Oct 2000 05:35:57 +0000 (05:35 +0000)]
Remove all function pointers from the ap_bucket type. These function
pointers are replaced with a global table that allows modules to register
their bucket types. Those bucket types are then allowed to be used in
the server processing. This also required removing all direct calls to
those functions. The ap_bucket type has an index into an array, so in
each ap_bucket_* function, we use that index to find the correct set of
functions.
Jeff Trawick [Fri, 13 Oct 2000 03:38:35 +0000 (03:38 +0000)]
mod_cgid: In the handler, shut down the Unix socket (only for write)
once we finish writing the request body to the cgi child process;
otherwise, the client doesn't hit EOF on stdin. Small request bodies
worked without this change (for reasons I don't understand), but large
ones didn't.
Jeff Trawick [Fri, 13 Oct 2000 03:12:54 +0000 (03:12 +0000)]
Fix a couple of problems related to large request bodies:
http_filter() - this was referencing e->length even though e->length
is sometimes -1 (if we have to read the socket bucket to get the
next bit of the request body); now it does e->read() to force a
socket need if required
ap_get_client_block() - this was getting a brigade back with the
desired amount of data (yeah, right) but only copying out the first
bucket
Modify ap_make_dirstr_prefix, platforms with HAVE_DRIVE_LETTERS or NETWARE
can request 0 elements, returning the '/' root.
[William Rowe, Tim Costello] from 1.3, with documentation
Ryan Bloom [Thu, 12 Oct 2000 18:01:30 +0000 (18:01 +0000)]
Remove the offset field from ap_bucket type. This is a file bucket
specific value, and therefore it belongs in the ap_bucket_file type,
which was also created with this commit. ap_bucket needs to be as generic
as possible to make it easily extensible, which means we have to keep
the generic ap_bucket type very separate from ap_bucket_foo.
Ryan Bloom [Thu, 12 Oct 2000 16:35:39 +0000 (16:35 +0000)]
Implement a length argument on input filters. There are three possible
values for the length, -1, 0, and a positive number. -1 means that the
next filter should return all the data it has, the current filter will
take care to ensure that the protocol is followed. Most filters will
never use this, because it implies they are implementing a conn_based
input filter. 0 means give me exactly one line of data. A positive
number means give me a maximum of n bytes.
I hope this clarifies. Greg is absolutely correct, there is no need for
any modules symbol other than AP_MODULE_DECLARE_DATA, since module .h
files containing imports and exports imply something more sophisticated,
as the early mod_dav.c example illustrated.
Ryan Bloom [Thu, 12 Oct 2000 04:47:21 +0000 (04:47 +0000)]
We never actually store anything in input_data (from the conn_rec), so it
doesn't make much sense to check to see if there is something there. This
removes the input_data brigade from the conn_rec altogether. There is no
good reason for a filter to be accessing a bucket brigade from within the
conn_rec. This shouldn't be here anymore, just like the output_filter
shouldn't be storing the data in the conn_rec.
Ryan Bloom [Thu, 12 Oct 2000 03:57:45 +0000 (03:57 +0000)]
This is pretty much the wrong solution, but at least it makes POSTs work
again. Chunking input doesn't work with this change, but that is because
this is a stop-gap to get POSTs working again.
Jeff Trawick [Thu, 12 Oct 2000 02:54:38 +0000 (02:54 +0000)]
In read_request_line(), we don't have to check any sort of EOF flag
anymore because getline() returns < 0 upon EOF.
There are also a few very minor tweaks to getline() -- remove an
unused variable, remove a couple of unnecessary comments, simplify
an error path.
Ryan Bloom [Wed, 11 Oct 2000 23:27:03 +0000 (23:27 +0000)]
Clean up the input filtering a lot. This makes the code a bit easier
to follow. This code works for browser based requests and line-based
telnet requests. It is untested with character-based telnet requests.
I will be testing that very soon.
Ryan Bloom [Wed, 11 Oct 2000 18:32:19 +0000 (18:32 +0000)]
Cleanup the input filtering a bit. This does not work with telnet
currently, but it is a step in the right direction. Input filtering
should be slowly improving from here on out.
Submitted by: Greg Ames, Ryan Bloom, Jeff Trawick
Jeff Trawick [Wed, 11 Oct 2000 17:37:22 +0000 (17:37 +0000)]
In getline() and ap_get_client_block(), use ap_bucket_destroy()
instead of bucket->destroy(). bucket->destroy() wasn't being
called correctly and also we were leaking the storage for the
bucket itself since bucket->destroy() doesn't free the ap_bucket.
Submitted by: Ryan Bloom, Jeff Trawick
Parallels the commit to apr.h.in/apr.hw for the apache core library.
Only mod_dav/mod_dav_fs and ap_hooks.h (as best examples) will use these
symbols until it is acceptable to all or the new symbols are backed out.
This symbol rename will have the unique quality that
strlen("API_EXPORT") == strlen("AP_DECLARE"), therefore the mass symbol
rename will not throw off function continuation lines.
This one is odd, it's not the patch either of us are concerned with, it's
the logic that they started with. If problems we never knew about just
go away, don't blame us.
Submitted by: William Rowe
Reviewed by: Bill Stoddard
Jeff Trawick [Tue, 10 Oct 2000 17:04:19 +0000 (17:04 +0000)]
minor cleanups in http_filter() and ap_get_client_block()
this is not the change to allow us to read broken-up header lines again :(
. http_filter()
- respect apr_status_t as set by bucket->read() or ap_get_brigade()
- return apr_status_t instead of length
. ap_get_client_block()
- remove a confusing line which set the length parameter before
- passing it to bucket->read()
Ryan Bloom [Tue, 10 Oct 2000 03:35:11 +0000 (03:35 +0000)]
Back out the change to move the core_output_filters brigade to the
conn_rec. Since all requests on a given connection use the same
core_output_filter, the ctx in that filter has the correct lifetime
Ryan Bloom [Mon, 9 Oct 2000 23:35:12 +0000 (23:35 +0000)]
We need to flush all logs when the child exits. To do this, we just
create a child_init hook, and use it to register a cleanup for child
exit.
PR: 6550
Bill Stoddard [Mon, 9 Oct 2000 22:08:49 +0000 (22:08 +0000)]
Fix another bug in the send_the_file() read/write loop. A partial
send by apr_send would cause unsent data in the read buffer to
get clobbered. Complete making send_the_file handle partial
writes to the network.
Ryan Bloom [Mon, 9 Oct 2000 19:03:27 +0000 (19:03 +0000)]
Fix some types in the latest tree, so that AIX builds cleanly again.
Submitted by: Victor J. Orlikowski <v.j.orlikowski@gte.net>
Reviewed by: Ryan Bloom
Jeff Trawick [Mon, 9 Oct 2000 17:39:10 +0000 (17:39 +0000)]
Remove stray semicolon from AP_NOBODY_READ and AP_NOBODY_WROTE decls.
Remove some out-of-date ap_pass_brigade() doc.
Tweak the ap_get_brigade() doc a little.
Bill Stoddard [Mon, 9 Oct 2000 16:33:24 +0000 (16:33 +0000)]
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.
Ok, if I remember right, somewhere along the way we decided not to
generate a pcre.h header from pcre.in, but Win32 (at this instant)
still generates pcre.h from the pcre.hw source. For this moment
(T-0001 to tag and roll) this is the reasonable fix.
Ryan Bloom [Sun, 8 Oct 2000 19:03:18 +0000 (19:03 +0000)]
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.
Movin on over from 1.3.13-dev : this patch fixes the problem of nasty
popup windows alerting an Admin that the isapi isn't working, and
simplifies mod_isapi by relying on dso.
Ryan Bloom [Sun, 8 Oct 2000 04:02:11 +0000 (04:02 +0000)]
Add back the ap_disable_nagle call in make_sock. However, this is a
performance enhancement only on platforms where turning off nagle is
inherited by accepted sockets. Because this is not always true, in order
to have the disable_nagle call active, the macro DISABLE_NAGLE_INHERITED
must be defined.
PR: 6531
Ryan Bloom [Sun, 8 Oct 2000 03:23:05 +0000 (03:23 +0000)]
Remove all compiler warnings from the proxy code. There are no garauntees
that this still works, but most of the changes were just const-safeness
changes.
PR: 6631
Ryan Bloom [Sun, 8 Oct 2000 00:55:46 +0000 (00:55 +0000)]
Remove ap_send_fb and ap_send_fb_length. These functions don't make much
sense anymore, because the BUFFs that Apache used to use it for have all
been replaced with buckets. BUFFs can't be used with filters, and Apache
doesn't use these functions anywhere anymore, so they need to go away now.
Ryan Bloom [Sat, 7 Oct 2000 21:54:16 +0000 (21:54 +0000)]
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
Ryan Bloom [Sat, 7 Oct 2000 18:10:02 +0000 (18:10 +0000)]
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.
Addresses the huge issue that Crypt::PasswdMD5 is probably not, and
Digest::SHA1 is possibly not already installed, but the user may not
even need it for their files! Also inform the user what to grab and
where. Finally, assures that the old Crypt::PasswdMD5 (that didn't
export apache_md5_crypt()) will work nonetheless.
There is still one -big- problem ... the list of xDBM_Files options
won't necessarily correspond to how Apache was built, nor if they
are using mod_auth_db vs. mod_auth_dbm. This has -got- to be fixed
(although it's an old problem.)
Ryan Bloom [Sat, 7 Oct 2000 05:41:59 +0000 (05:41 +0000)]
The newest incarnation of http_filter. This is far from perfect, but it
is a step in the right direction. The idea is that the http_filter knows
about the http protocol. So, it uses that knowledge to discover HTTP
request headers, and sends those headers up to getline. However, it keeps
the request body saved in it's ctx pointer.
Later, when ap_get_client_block is called, we have set the remaining field
in the conn_rec. This tells the http_filter how much of the remaining
data is request body, and how much isn't. So, the http_filter can return
the request body unparsed up throught ap_get_client_block.
This doesn't even try to work with chunked input data, and there are still
some other bugs in it, but it works for small-ish files in my tests, and
it lets other people play with the concept of input filters. I will try
to play with this more, but others should feel free to hack around in it
too.