Make sure firstHandler is called only once

dataHandler was set to realHandler, but its previous value of firstHandler was already set as socket data handler so the change had no effect and firstHandler was still used for all data events.

Also making sure that upgradeHead is released no matter it's length or value.