Ejemplo n.º 1
0
void HTTPResponseTest::testRead3()
{
	std::string s("HTTP/1.1 200 \r\nContent-Length: 0\r\n\r\n");
	std::istringstream istr(s);
	HTTPResponse response;
	response.read(istr);
	assert (response.getVersion() == HTTPMessage::HTTP_1_1);
	assert (response.getStatus() == HTTPResponse::HTTP_OK);
	assert (response.getReason() == "");
	assert (response.size() == 1);
	assert (response.getContentLength() == 0);
	assert (istr.get() == -1);
}
Ejemplo n.º 2
0
void HTTPResponseTest::testRead2()
{
	std::string s("HTTP/1.0 301 Moved Permanently\r\nLocation: http://www.appinf.com/index.html\r\nServer: Poco/1.0\r\n\r\n");
	std::istringstream istr(s);
	HTTPResponse response;
	response.read(istr);
	assert (response.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY);
	assert (response.getReason() == "Moved Permanently");
	assert (response.getVersion() == HTTPMessage::HTTP_1_0);
	assert (response.size() == 2);
	assert (response["Location"] == "http://www.appinf.com/index.html");
	assert (response["Server"] == "Poco/1.0");
	assert (istr.get() == -1);
}