Read from stdin when source is -
This commit is contained in:
parent
1d750ad2f9
commit
a6916f6179
1 changed files with 13 additions and 3 deletions
|
@ -18,9 +18,11 @@
|
|||
|
||||
#include "html_pool.hpp"
|
||||
#include "htmlretrieve.hpp"
|
||||
#include "read_all.hpp"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
|
||||
namespace duck {
|
||||
HtmlPool::HtmlPool (std::string&& agent_name) :
|
||||
|
@ -29,9 +31,17 @@ namespace duck {
|
|||
}
|
||||
|
||||
auto HtmlPool::OnResourceLoad (ResourceObjectParameterType parRes) -> ResourceType* {
|
||||
auto html = std::make_unique<std::string>(
|
||||
std::unique_ptr<std::string> html;
|
||||
|
||||
if (parRes == "-") {
|
||||
html = std::make_unique<std::string>(read_all(std::cin));
|
||||
}
|
||||
else {
|
||||
html = std::make_unique<std::string>(
|
||||
fetch_html(parRes, m_agent, false, false)
|
||||
);
|
||||
}
|
||||
|
||||
*html = duck::clean_html(std::move(*html));
|
||||
return html.release();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue