Fix bugs in http sync protocol. WIP.