Untitled

Submitted by reeses on Tue, 2002-11-26 07:12.

This weekend saw the creation of my first Apache module. In a company meeting, I mentioned that we could write an Apache module to provide a service that didn't depend on an application server. After that, writing an ISAPI plugin would be easy. At this point, someone mentioned taking a month to produce this module. In a fit of stupidity, I opened my big mouth and said that I could write the Apache version in an evening.

So, I had to put up.

Let's say that writing an Apache module is a little difficult if you only go by the information available at httpd.apache.org or via semi-obvious searches on Google. Let's just say this because it's true. There is a data structure that needs to be populated with pointers to functions and configuration structures, and that part is pretty straight forward. However, the content of those functions and structures isn't always clear.

So, I'm muddling through trying to build a module on my Windows laptop, and I discover that the toolchain doesn't support building modules with cygwin. Yet another hurdle! It was time for a break. I ran down to a local technical bookstore (Stacey's on Market Street in SF) and bought this book. While the major bulk relates to working with mod_perl, it made my job so much easier.

Until I discovered a little dogslop buried in my code. Because I didn't have a debugging environment handy, I had to resort to the classic debug-by-printf(). After an hour of narrowing down the bug, I discovered the following brilliant maneuver:


for ( prr = pHead; NULL != pHead; prr = prr->m_pNext ) {
...
}

D'oh! And I wondered why I was segfaulting!

Post new comment

Captcha Image: you will need to recognize the text in it.
Please type in the letters/numbers that are shown in the image above.