Fix Node 0.11

I ran into some problems around setting headers in Node 0.11 due to changes in the `http` implementation. These changes correct the issues that I found. Existing test cases were failing in Node 0.11 due to the issues I found so no new test cases needed here.