bugfix 302 should not be skip when call res.writeHead
cleaned up pr19 from @xudejia
cleaned up and merged pr19 from @xudejia