Bounds checking and generic headers

I've experienced panic from nginx for unknown reasons (didn't have a core dump to investigate further). But could be due to corrupt/invalid input.

I've now coded up bounds checking of key-value vars. Also included are generic header support, upper case header mappings, and enable repeated headers (sometimes they exist).

Please have a look and see if you want to merge back to trunk after testing.
Thanks
Leon