250 likes | 405 Views
Why filters?. Very flexible design Allows one module to modify the data that another module produces Finally, CGI's that output SSI tags A module that puts header and footer information on each page Many many more possibilities. Basic filters in 2.0. Core
E N D
Why filters? • Very flexible design • Allows one module to modify the data that another module produces • Finally, CGI's that output SSI tags • A module that puts header and footer information on each page • Many many more possibilities
Basic filters in 2.0 • Core • core_input_filter (read from network) • core_output_filter (write to network) • byterange_filter (send partial result) • content_length_filter (compute C-L) • sub-request_filter (remove extra EOS) • OLD_WRITE (buffer for ap_r* funcs)
Basic filters in 2.0 • HTTPD • HTTP_IN (header/body determination) • HTTP_HEADER (send headers) • CHUNK (send data in chunks) • DECHUNK (read chunked body from client) • Modules • SSI_filter (parse files for SSI tags)
Basic filters in 2.0 • Modules • SSI_filter (parse files for SSI tags) • External (run external programs) • Charset-encoding (translate between charsets)
Possible Additional Filters • SSL (in process of being written, input and output) • Header/Footer (basic attempt in presentation and handouts) • Cache (cache data in output filter, send it later from cache_handler, basic attempt in CVS)
Handlers and filters • Handlers are the first filter in the chain • Filters use functions like ap_fwrite • Handlers use ap_rwrite • Handlers Generate data from nothing • Filters modify data passed to them from handlers, and other filters
File Pool MMAP EOS Flush Error Types of buckets • Heap • Transient • Immortal • Pipe • Socket
Assumptions • All data can be broken into chunks • Each chunk of data must come from the same source • All HTTP data can be represented as strings of characters, even if not human readable • Filters must allow for optimal performance, even if they don't enforce it • If files are in the output stream, then we should use sendfile
Bucket Functions • apr_bucket_*_create • Different arguments for each bucket type • apr_bucket_split • apr_bucket_destroy • apr_bucket_copy • apr_bucket_setaside
Brigade Functions • apr_brigade_create • apr_brigade_split • Splits based on buckets • apr_brigade_partition • Splits based on offset • apr_brigade_destroy • apr_brigade_write, putstrs, vputstrs, putc, etc • Write into a brigade with buffering
More Information • Slides on-line • Http://www.ntrnet.net/~rbb/presentations • Articles • http://www.apachetoday.com • http://www.covalent.net/ • General Information • http://www.apache.org • new-httpd@apache.org