/* */ #include "ProtocolDetector.h" #include "Request.h" #include #include #include namespace aria2 { ProtocolDetector::ProtocolDetector() {} ProtocolDetector::~ProtocolDetector() {} bool ProtocolDetector::isStreamProtocol(const std::string& uri) const { return Request().setUrl(uri); } bool ProtocolDetector::guessTorrentFile(const std::string& uri) const { std::ifstream in(uri.c_str()); if(in) { char head; in >> head; return head == 'd'; } else { return false; } } bool ProtocolDetector::guessMetalinkFile(const std::string& uri) const { std::ifstream in(uri.c_str()); if(in) { char head[6]; in >> std::setw(6) >> head; return strcmp(head, "