#apr
Posts
-
Digging into Apache httpd's Source 3: The Big Picture — Core, APR, MPM, Modules and the Three Big Structs
A map for anyone opening the Apache httpd source for the first time. We look at the layers (operating system, APR, core, MPM, modules), why even the core is a module, how modules compiled into the binary differ from ones loaded with LoadModule, the three structs server_rec, conn_rec and request_rec, the pool hierarchy, and the path a single request takes — all checked against the real source and examples I actually ran.
-
Digging into Apache httpd's Source 4: APR Memory Pools — Managing Memory Without free()
You will hardly find free() in httpd's C code. Instead of handing memory back piece by piece, httpd groups everything with the same lifetime — "one request", "one connection" — into a pool and throws it away in one go. This post looks at APR pool nodes and the allocator, why apr_palloc is just a pointer bump, the order cleanups run in, where httpd creates and destroys its pools, and the two classic mistakes — all checked against the real source and real runs.
-
Digging into Apache httpd's Source 6: Modules and Hooks — How a Module Plugs into the Server
Nearly every feature of httpd is a module, and a module plugs into the server by attaching functions to fixed points called hooks. Using the source at a pinned commit and three small modules written for this post, we look at the module struct, the two ways a module gets registered (static modules and LoadModule), what the hook macros really expand to, how RUN_FIRST differs from RUN_ALL, and how the call order is decided from order values and the names of other modules.
-
Digging into Apache httpd's Source 11: Filters and Bucket Brigades — How a Response Flows Out
What shape a response takes inside httpd on its way from the handler to the socket, followed for someone opening the source for the first time. APR-util's buckets and brigades (a ring), PIPE and FILE buckets that change shape when read, filters lining up in six tiers and ap_pass_brigade, chunked encoding and sendfile, and what the core output filter does when the socket is full — all checked with the log of a filter module written for this post.