Пример #1
0
		bool onResponse ( Crawler::Worker & worker , Crawler::Website & website , Crawler::Link & link , sf::Http & client , sf::Http::Response & response )
		{
			// Print all responses
			std::cout << & worker << std::dec << " " << static_cast <std::size_t> ( response.getStatus ( ) ) 
				<< " " << website.getScheme ( ) + "://" + website.getAuthority ( )
				<< link.toString ( ) << " " << response.getBody ( ).size ( ) << " Bytes\n" ;
			return true ;
		}
Пример #2
0
	bool MapSite::sendRequest(const std::string& url, sf::Http::Response& resp)
	{
		if(serverGood)
		{
			resp = server.sendRequest({url});

			return resp.getStatus() == sf::Http::Response::Status::Ok;
		}
		else
		{
			return false;
		}
	}
Пример #3
0
	bool MapSite::getPage(const std::string& url, sf::Http::Response& resp)
	{
		sf::Http::Request req(url, sf::Http::Request::Method::Get);
		resp = server.sendRequest(req);
		sf::Http::Response::Status status = resp.getStatus();

		if(status != sf::Http::Response::Ok)
		{
			std::cout << "[ERROR]: Bad response from server: " << status << " on request for: " << url << '\n';
			return false;
		}

		return true;
	}