Writing Apache Modules with Perl and C

The Apache API and mod_perl

Lincoln Stein, Doug MacEachern

Publisher: O'Reilly, 1999, 724 pages

ISBN: 1-56592-567-X

Keywords: Web Programming, Perl

Last modified: April 14, 2022, 6:27 a.m.

Apache is the most popular web server on the Internet because it is reliable, extensible, and free. The modular design of Apache coupled with its roots in Open Source development enables you to extend your web server's functionality through the Apache API.

Historically, however, the Apache API has only been available to C programmers, mod_perl the popular Apache module used primarily for enhanced CGI performance, changed all that by making the Apache API available to Perl programmers. With mod_perl you can develop Apache modules while taking advantage of Perl's famous power and rapid development cycle.

Writing Apache Modules with Perl and C teaches you how to extend the capabilities of your web server. The explains the design of Apache, mod_perl, and the Apache API. It then demonstrates how to use them to perform tasks such as:

  • Using mod_perl to vastly improve the performance of Perl-based CGI scripts
  • Rewriting CGI scripts as Apache modules to give them full access to the Apache API
  • Server-side filtering of HTML documents to embed special markup or code (much like SSI)
  • Enhancing server log functionality
  • Converting file formats on the fly
  • Implementing dynamic navigation bars
  • Incorporating database access into CGI scripts
  • Customizing access control and authorization to block robots or to use an external database for passwords

Included with the book is a detachable mod_perl quick reference card for easy lookup of mod_perl syntax and functionality.

  1. Server-Side Programming with Apache
    • Web Programming Then and Now
    • The Apache Project
    • The Apache C and Perl APIs
    • Ideas and Success Stories
  2. A First Module
    • Preliminaries
    • Directory Layout Structure
    • Installing mod_perl
    • "Hello World" with the Perl API
    • "Hello World" with the C API
    • Instant Modules with Apache::Registry
    • Troubleshooting Modules
  3. The Apache Module Architecture and API
    • How Apache Works
    • The Apache Life Cycle
    • The Handler API
    • Perl API Classes and Data Structures
  4. Content Handlers
    • Content Handlers as File Processors
    • Virtual Documents
    • Redirection
    • Processing Input
    • Apache::Registry
    • Handling Errors
    • Chaining Content Handlers
    • Method Handlers
  5. Maintaining State
    • Choosing the Right Technique
    • Maintaining State in Hidden Fields
    • Maintaining State with Cookies
    • Protecting Client-Side Information
    • Storing State at the Server Side
    • Storing State Information in SQL Databases
    • Other Server-Side Techniques
  6. Authentication and Authorization
    • Access Control, Authentication, and Authorization
    • Access Control with mod_perl
    • Authentication Handles
    • Authorization Handlers
    • Cookie-Based Access Control
    • Authentication with the Secure Sockets Layer
  7. Other Request Phases
    • The Child Initialization and Exit Phases
    • The Post Read Request Phase
    • The URI Transition Phase
    • The Header Parser Phase
    • Customizing the Type Checking Phase
    • Customizing the Fixup Phase
    • The Logging Phase
    • Registered Cleanups
    • Handling Proxy Requests
    • Perl Server-Side Includes
    • Subclassing the Apache Class
  8. Customizing the Apache Configuration Process
    • Simple Configuration with the PerlSetVar Directive
    • The Apache Configuration Directive API
    • Configuring Apache with Perl
    • Documenting Configuration Files
  9. Perl API Reference Guide
    • The Apache Request Object
    • Other Core Perl API Classes
    • Configuration Classes
    • The Apache::File Class
    • Special Global Variables, Subroutines, and Literals
  10. C API Reference Guide, Part I
    • Which Header Files to Use?
    • Major Data Structures
    • Memory Management and Resource Pools
    • The Array API
    • The Table API
    • Processing Requests
    • Server Core Routines
  11. C API Reference Guide, Part II
    • Implementing Configuration Directives in C
    • Customizing the Configuration Process
    • String and URI Manipulation
    • File and Directory Management
    • Time and Data Functions
    • Message Digest Algorithm Functions
    • User and Group ID Information Routines
    • Data Mutex Locking
    • Launching Subprocesses
  1. Standard Noncore Modules
  2. Buildling and Installing mod_perl
  3. Building Multiple C API Modules
  4. Apache:: Modules Available on CPAN
  5. Third-Party C Modules
  6. HTML::Embperl — Embedding Perl Code in HTML

Reviews

Writing Apache Modules with Perl and C

Reviewed by Roland Buresund

OK ***** (5 out of 10)

Last modified: April 13, 2022, 1:07 a.m.

If you're into Apache and its API, I assume it is an OK book. Hard to get very excited about it.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required