fix bugs in custom HTTP headers code, add example. fixes #131