1 / 25

Why filters?

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

tiger-wiley
Télécharger la présentation

Why filters?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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)

  3. 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)

  4. Basic filters in 2.0 • Modules • SSI_filter (parse files for SSI tags) • External (run external programs) • Charset-encoding (translate between charsets)

  5. 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)

  6. 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

  7. Buckets and brigades

  8. File Pool MMAP EOS Flush Error Types of buckets • Heap • Transient • Immortal • Pipe • Socket

  9. 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

  10. Bucket Functions • apr_bucket_*_create • Different arguments for each bucket type • apr_bucket_split • apr_bucket_destroy • apr_bucket_copy • apr_bucket_setaside

  11. Bucket Creation

  12. Bucket Split

  13. Bucket copy

  14. 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

  15. apr_brigade_write

  16. apr_brigade_write("foo")

  17. apr_brigade_write("bar")

  18. Input Filter flow

  19. apcon_filter_in

  20. apcon_filter_in

  21. apcon_filter_in

  22. generator/filter flow

  23. Header/Footer Filter

  24. Header/Footer Filter

  25. 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

More Related