Exemple #1
0
pfc::string8 get_url(pfc::string8 url, abort_callback &p_abort) {
	pfc::string8 data;
	http_client::ptr client;

	try {
		if (!service_enum_t<http_client>().first(client)) {
			console::print("feed downloading: error, unable to start http service");
			return data;
		}

		http_request::ptr request = client->create_request("GET");
		file::ptr file_ptr = request->run(url.get_ptr(), p_abort);
		char buffer[1025];
		t_size bytes_read;

		while (bytes_read = file_ptr->read(buffer, 1024, p_abort)) {
			data.add_string(buffer, bytes_read);
		}

		return data;
	} catch (exception_aborted) {
		console::print("feed downloading: aborted");
		throw exception_aborted();
	} catch (...) {
		console::print("feed downloading: error, aborted");
		return data;
	}
}
Exemple #2
0
	String^ FromUtf8String(pfc::string8 &value)
	{
		return FromUtf8String(value.get_ptr());
	}