Title: Convert Cookies-->HTTP Request Headers?

I have a unique need purely for testing purposes. I'm not very familiar (yet) with mod_perl handlers in Apache, so I've had a rough time getting anything going.

Here is my goal:

For every request to Apache:
  1. Parse the cookie coming in via the request header
  2. Pull out each value (ex: NAME=bob;TITLE=boss)
  3. Convert them to HTTP Request Headers
  4. Pass the request on to the requested resource (a script of some sort)

So, if I have a cookie like: NAME=bob;TITLE=boss
My program would then see the following headers in the request:
  HTTP_NAME=bob
  HTTP_TITLE=boss

This will help me simulate a Single-Sign-On situation where the authentication handler passes all authenticated user information to the resource via headers.

Can anyone help me by either:
  1. Giving an outline of what handlers I would want to use, and how I can write request headers with them
or
  2. Writing some sample code :)

NOTES:
  1. I'm running Apache 2.0 and mod_perl 2 right now, but I can bump it down if required
  2. I've already used mod_headers to simulate this, but unfortunately that isn't dynamic enough for testing, ie, I need to change httpd.conf and re-start the server to test different header scenarios.

Thanks!

Matt Kruse

Reply via email to