added ping support; extracted common client-server functions to spdy/common.py