Implementing sapi and http response