fix for http://bugs.ethersex.de/view.php?id=155
always reset handler on cleanup
reformatted code
Merge pull request #263 from eku/http_state_fix2

Http state fix2