/**
* Adapt a POST response to a Message.
*
* @param $response Result of a POST to an OpenID endpoint.
*
* @access private
*/
static function _httpResponseToMessage($response, $server_url)
{
// Should this function be named Message.fromHTTPResponse instead?
$response_message = Auth_OpenID_Message::fromKVForm($response->body);
if ($response->status == 400) {
return Auth_OpenID_ServerErrorContainer::fromMessage($response_message);
} else {
if ($response->status != 200 and $response->status != 206) {
return null;
}
}
return $response_message;
}