Parent Directory
|
Revision Log
| Links to HEAD: | (view) (annotate) |
| Sticky Revision: |
Further to r599711; document new API guarantee for handling non-NULL request_rec pointer when adding connection filters; minor MMN bump: * server/util_filter.c (add_any_filter_handle): Set f->r for connection filters even if passed-in r is non-NULL. Style nit fix also. * include/util_filter.h (ap_add_output_filter, ap_add_output_filter_handle): Document new API guarantee. * include/ap_mmn.h: Minor MMN bump.
* Use the correct pool when adding connection level filters. Submitted by: jorton Reviewed by: rpluem
* server/util_filter.c (ap_filter_flush): Tweak comment; no functional change.
* server/util_filter.c (ap_filter_flush): Ensure that the brigade is empty before returning. PR: 36780
update license header text
Update the copyright year in all .c, .h and .xml files
No functional Change: Removing trailing whitespace. This also means that "blank" lines consisting of just spaces or tabs are now really blank lines
No functional change: simple detabbing of indented code.
Make ap_register_output_filter back into a function (*sigh*) but update its API doc
Make ap_register_output_filter a #define
Update copyright year to 2005 and standardize on current copyright owner line.
general property cleanup
* server/util_filter.c (ap_save_brigade): Be more tolerant of a bucket type which neither implements ->setaside nor morphs on ->read, such as the mod_perl SV bucket type in mod_perl <1.99_17; defer returning an error in this case until after calling setaside on each bucket.
* server/util_filter.c (ap_save_brigade): Handle an ENOTIMPL setaside function correctly. * modules/generators/mod_cgi.c (cgi_handler): Revert r1.169, unnecessary CGI bucket lifetime kludge. PR: 31247
Merge mod_filter with util_filter structs; add API for protocol stuff. Rename FilterDebug directive to FilterTrace.
fix name of The Apache Software Foundation
apply Apache License, Version 2.0
update license to 2004.
get rid of _FOREACH
While processing filters on internal redirects, remember seen EOS buckets also in the request structure of the redirect issuer(s). This prevents filters (such as mod_deflate) to add garbage to the response, because ap_finalize_request_protocol won't send another EOS bucket then. PR: 14451
finished that boring job: update license to 2003. Happy New Year! ;-))
Renames Pending: This clears the list of renames pending in apr-util. Parts of this list was alreadu done, but the pending list hadn't been updated. apr_hook_debug_current from apr_current_hooking_module apr_hook_debug_show from apr_show_hook apr_hook_global_pool from apr_global_hook_pool apr_hook_sort_all from apr_sort_hooks apr_uri_port_of_scheme from apr_uri_default_port_for_scheme apr_uri_unparse from apr_uri_unparse_components apr_uri_parse from apr_uri_parse_components apr_uri_parse_hostinfo from apr_uri_parse_hostinfo_components apr_uri_t from apr_uri_components All APR_URI_* from all APU_URI_* symbols All APR_UNP_* from all UNP_* symbols PR: Obtained from: Submitted by: Thom May Reviewed by:
Add a filter_init function to the filters so that a filter can execute arbitrary code before the handlers are invoked. This resolves an issue with incorrect 304s on If-Modified-Since mod_include requests since ap_meets_conditions() is not aware that this is a dynamic request and it is not possible to satisfy 304 for these requests (unless xbithack full is on, of course). When mod_include runs as a filter, it is too late to set any flag since the handler is responsible for calling ap_meets_conditions(), which it should do before generating any data. If a module doesn't need to run such arbitrary code, it can just pass NULL as the argument and all is well. PR: 9673 Reviewed by: Ryan Bloom and others
stop using APLOG_NOERRNO in calls to ap_log_?error()
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.
Update our copyright for this year.
As hinted on dev@httpd, change filter naming schemes to match our expectations of their usage. The reason that we should make this change now is that we have changed the implied meaning of AP_FTYPE_HTTP_HEADER - some users of this should be PROTOCOL while others should be CONTENT_SET. In order to clarify it, toss all of the bogus names and force the filter writers to make sure they understand what they are doing. CONTENT_SET is new (horrible name - change if you have better idea), but it indicates that it should run between RESOURCE and PROTOCOL. mod_deflate is the ideal CONTENT_SET filter. The changed type names are: CONTENT is now RESOURCE. HTTP_HEADER is now PROTOCOL. However, most filters that used HTTP_HEADER may want CONTENT_SET. (Only things like POP and HTTP belong as PROTOCOL.) MMN bump since all filters need to be recompiled due to filter reordering.
When using mod_ssl, it is possible that we'd be called when there are no protocol filters, so stop the segfault.
Remove the prev pointer from the filter chain. This removes the complexity of trying to set the filter chain correctly, with the side-effect of forcing us to walk the entire chain whenever we add a filter. Since the filter chains are small, the decrease in complexity is worth it. Reviewed by: Allan Edwards
make sure r->proto_xxput_filter gets updated as necessary when deleting a filter from the chain
Stop the loop when we have found the correct filter, or when the filter list is over. Do not stop if the next filter is NULL.
If we insert a protocol filter before we insert a request filter, we must set the r->output_filter to r->proto_output_filter. If we don't, then as soon as we insert the request filter, the protocol filter will be removed. This was causing headers to not be sent on some requests.
I forgot the return, which mean meaningless log messages. This makes us return the correct information.
This fixes most of the header bug that was committed last night. The server is seg faulting on pipelined requests currently, but I want to get people back to a running server.
This finishes the mod_dir/mod_negotiation bug. This final part of the solution ensures that we don't lose filters if they are added later than we expect. The problem could be seen if a connection filter was added after a request-based filter was added in the past. The problem was that the request-based filters pointed to the first filter in the connection record, so the new connection filter was never called. Now, all filters are put on their correct filter lists, and we are sure to always update all pointers when adding a filter.
Fix the mod_dir/mod_negotiation bug, where redirects and sub requests were not getting the correct filters. This is done by creating a location in the request rec that holds protocol level filters. Protocol level filters survive for one request, from the time the request is received from the user to the time the response is sent. r->output_filters now stores the request level filters, which are only valid for the lifetime of one request_rec. This patch works, but it is not complete. The second half of the problem is that add_any_filter doesn't check where it puts the filters that it adds, so it is possible for filters to be put on this wrong list, and for filters to be lost completely during request processing. That half of the fix will be coming in the next day or so. Submitted by: Will Rowe, Justin Erenkrantz, Ryan Bloom
forgot the ap-declare's the're needed for win32
Added ap_get_input_filter_handle() and ap_get_output_filter_handle() Submitted by: Ryan Morgan Reviewed by: Brian Pane
Added new functions ap_add_input_filter_handle() and ap_add_output_filter_handle() There are many places in the core modules where we do ap_add_input_filter() or ap_add_output_filter() on a hardcoded filter name (e.g., "CORE" or "BYTERANGE"). This requires a string-to-filter mapping that wastes CPU time. (Even though the string lookup uses a trie for speed, it still ranks as a big consumer of CPU time because of the large number of filters added per request.) The new ap_add_*_filter_handle() functions will allow us to skip the string-to-filter mapping in cases where the module adding the filter happens to have the ap_filter_rec_t* for the registered filter (e.g., because it's the same module that registered the filter in the first place).
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
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)
Fix a shadow variable. (c is also declared to be the connection.)
While contemplating a cast to (char) for the c arg to trie_node_link, I decided it's more plesant to let the cpu not to think so hard (no wasted space, the c member will by word aligned anyways.)
converted apr_pcalloc to apr_palloc for 15% reduction in run time of add_any_filter
replaced the hash used in add_any_filter() with a trie for 2.5x speedup
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.
Jeff pointed out that the character array must be constant. Well, it's not, so make it allocated from the correct pool rather than the heap.
**NO CODE CHANGES** This is a reformat commit *ONLY* Please drive on through. (One spelling tpyo fixed...)
The ap_add_input_filter/ap_add_output_filter functions do an O(n) scan through the list of registered filters. This patch replaces the linear list with a hash table for better performance. Submitted by: Brian Pane <bpane@pacbell.net> Reviewed by: Justin Erenkrantz
fix ap_remove_output_filter; the recent change to use remove_any_filter made it possible to wipe out the entire filter chain. and then when ap_finalize_request_protocol was called, r->output_filters was NULL, preventing data from being flushed to the client. PR: Obtained from: Submitted by: Reviewed by:
remove_any_filter() and ap_remove_foo_filter() are void; how can you return a value?
Allow mod_ssl to send back an error message if an HTTP request is sent over an HTTPS connection. This also adds an ap_remove_input_filter function, which should be used to remove the SSL input filter in this case, as soon as this code is stressed a bit more. For right now, we are sending the same message that we used to send in mod_ssl for Apache 1.3.
Remove all warnings from the input filtering stack.
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.
Convert the filter and brigade writing functions to return status values, not byte counts.
*) Add apr_bucket_setaside_noop to use for buckets that do not require a
setaside function. It simply returns APR_SUCCESS.
- adjust the EOS, FLUSH, IMMORTAL, and HEAP buckets to use _noop.
*) Make the setaside() function take a pool to define the (new) lifetime for
the bucket's data.
- Adjust the apr_bucket_setaside() macro.
- Adjust the apr_bucket_setaside_notimpl() and transient_setaside()
functions.
- Pass the additional parameter in ap_save_brigade()
*) Update docs for setaside()
*) Minor nit with macros in apr_buckets.h: add parens for binding safety.
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.
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.
At the hack-athon we decided to change the way that input filters determine how much data is returned to the previous filter. Prior to this change, we used a field in the conn_rec to determine how much to return. After this change, we use an argument to ap_get_brigade. This makes it much more obvious how things work at all levels, so that module authors can easily determine how much data is supposed to be returned to them.
The ap_f* functions should flush data to the filter that is passed in, not to the filter after the one passed in. The fixes a bug, where one filter is skipped when using ap_f*. Submitted by: Ryan Morgan <rmorgan@covalent.net>
Update copyright to 2001
Fix a compile warning.
First cut of TLS support.
*) continued header revamping *) torch some headers (and some libs) from the autoconf stuff
"v" in the name has come to mean that a va_arg is in the parameter list. putstrs is clearer in this case.
Fix another windows compile break.
Functions that use ... have to be NONSTD. At least I think Will told me that at one point.
A few small docs changes (there were ';' in the ScanDoc), and remove some very cool but totally unportable macros. :-(
*) namespace protect the filter_flush() function *) don't toss the status value from ap_pass_brigade in ap_fflush; return it *) doc/macro nits
Allow filters to buffer data in a brigade using the ap_f* functions. These have become simple macros that just wrap the apr_brigade functions, allowing filter writers to ignore the flush function and the ctx pointer.
renaming various functions for consistency sake see: http://apr.apache.org/~dougm/apr_rename.pl PR: Obtained from: Submitted by: Reviewed by:
The big change. This is part 3 of the apr-util symbols rename, please see the first commit of srclib/apr-util/include (cvs apr-util/include) for the quick glance at symbols changed.
ap_save_brigade() can fail, so report what happened via an apr_status_t return code.
include <strings.h> for the strcasecmp() and strncasecmp() prototypes; AIX doesn't have prototypes for these in string.h
Fix an error message since we are using common code to add all filters. Submitted by: Greg Stein
Remove some common code in adding filters to either the input or output filter lists. Submitted by: Sascha Schumann <sascha@schumann.cx>
minor tweaks, cleanup, comments.
Add a comment about a requirement with the eos_sent variable.
Fix some brain dead code. Submitted by: Greg Stein Reviewed by: Bill Stoddard
Correct a check to see if we are attempting to remove a filter that has already been removed from the stack. Hummm, seems to me we should not attempt to remove filters multiple times....
Add a way to remove output filters. This is used by http_header_filter to remove itself once it has actually sent the headers.
Input filters and ap_get_brigade() now have a input mode parameter (blocking, non-blocking, peek) instead of a length parameter.
Renamed all MODULE_EXPORT symbols to AP_MODULE_DECLARE and all symbols for CORE_EXPORT to AP_CORE_DECLARE (namespace protecting the wrapper) and retitled API_EXPORT as AP_DECLARE and APR_EXPORT as APR_DECLARE. All _VAR_ flavors changes to _DATA to be absolutely clear. Thank you Greg, for the most obvious suggestion.
Stop using the index into the array for the bucket type. Now we just use a pointer to a static structure. The ap_foo_type functions have also been replaced with simple macro calls. I am going to replace the ap_bucket_(read|split|setaside|destroy) functions with macros soon. Reviewed by: Will Rowe
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.
Fix a typo from earlier today. The filters accept apr_ssize_t's, so the get_brigade code should also use apr_ssize_t. Submitted by: Greg Stein
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.
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
Now that we have ap_add_input_filter(), rename ap_add_filter() to ap_add_output_filter().
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
Replace ap_get_data_from_filter and ap_save_data_to_filter with ap_save_brigade. This function does not try to save the actual brigade to a specific location. If just traverses the brigade, calls setaside if it is available and concatenates it with a previously setaside brigade. The resulting brigade is returned to the caller for them to save it to the appropriate location.
Fix two problems. First we are setting aside the wrong bucket brigade. Second, we need to check that a setaside routine is defined for the bucket before attempting to call it. Not sure at all if we even want to keep this routine as it does not allow using filter->ctx for other purposes.
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.
Fix filter registration so that the appropriate list of registrations is actually modified. This allows Apache to server pages again. (Before this, every ap_add_filter() silently failed and so output content went to the bit bucket.) Also, repair some comments and un-namespace-protect a now-static function.
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.
Change r->filters to r->output_filters. This sets things up for us to put input filters into Apache.
put ctx back in ap_add_filter()
Add a pointer to the filter_rec_t from the filter_t. This allows modules to get to the filter name from the filter itself. This is useful for modules like mod_perl, which have one filter function that does different things based on the name used when the filter was inserted.
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.
Ensure that only one EOS bucket is sent down the filter stack. This is done by adding a flag to the request_rec. When ap_pass_bucket sees an EOS bucket, the flag is set. If the flag is still unset when ap_finalize_request is called, then ap_finalize_request sends an EOS. This fixes the problem with chunking and CGI.
Use wrapper macros to avoid the verbosity of the AP_RING macros when doing things with bucket brigades.
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.
reversing the latest commit; it was vetoed a while back.
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.
Filters (and thus ap_pass_brigade()) now return an apr_status_t as their return value.
this shouldn't have gone in yet. there is still pending discussion.
Make ap_add_filter use a LIFO stack instead of a FIFO queue to add filters to the filter stack. This makes the chunking filter work. Without this, the core_filter is installed in the insert_filters hook, when we get to the ap_send_http_headers function, we insert the chunking filter, but it has been installed after the core_filter. This means the chunk_filter is never called. This reverses this. The core_filter is installed in the insert_filters hook, and we put the chunk_filter in during ap_send_http_headers. This time, the chunking filter is installed before the core_filter, and it gets called correctly.
Ryan's recent, suggested patch in this area pointed out that we were
missing the needed comparison on the request. this allows subrequests to
insert filters properly (by stopping the scan before transitioning to
the parent request's filters)
When ap_register_filter() registers a cleanup function, specify apr_null_cleanup() instead of NULL to indicate that no child cleanup is desired. (With NULL, we branch to zero.)
Add an error condition to the filter code. Basically, if somehow we get to the very bottom of the filter stack and nobody has written anything to the network, then we need to return an error.
Initial Filtering code. This uses a bucket brigade scheme to allow modules to add and modify data while processing a request. The docs still need to be updated, and a simple html page needs to be created explaining all of this. The only filter currently in the code is the core filter. This filter takes a bucket brigade and writes it to the network through the buff structure. In time, the buff will go away completely. More filters will need to be written. Submitted by: The Apache Community Reviewed by: The Apache Community
Fix a small name mix-up. Filters are part of Apache, and should have the ap_ prefix, not apr_
prefix libapr functions and types with apr_
Add the ability to register filters. This commit introduces a warning into the build. This warning will be removed automatically, as soon as we decide on a prototype for the function causing the warning. That decision is tied to which filtering mechanism we decide on. Submitted by: Ryan Bloom and Greg Stein
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
| apache@apache.org | ViewVC Help |
| Powered by ViewVC 1.1.2 |