It might be worth calling `.rstrip()` on the headers and checking without the `\r\n` -- that seems like it might fail painfully one day.