Esempio n. 1
0
	size_t client_socket::write(utils::string_view const &str)
	{
		ssize_t written = ::send(fd_.get_raw_fd(), str.begin(), str.size(), MSG_NOSIGNAL);
		check_return_code(written);

		#ifdef CPP_NETWORK_SOCKET_DEBUG
		log(utils::verbose) << "written " << std::to_string(written) << " bytes to " << fd_ << "\n";
		#endif

		return static_cast<size_t>(written);
	}
Esempio n. 2
0
inline bool looks_like_url(utils::string_view str)
{
	return (str.size() >= 8) && ((str.substr(0,7) == "http://") || (str.substr(0,8) == "https://"));
}