Validators work

This commit is contained in:
Vinnie Falco
2013-09-12 15:05:26 -07:00
parent b839ae0552
commit 0d2344c9a6
26 changed files with 1337 additions and 928 deletions

View File

@@ -0,0 +1,64 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================
namespace Validators
{
class SourceURLImp : public SourceURL
{
public:
explicit SourceURLImp (UniformResourceLocator const& url)
: m_url (url)
{
}
~SourceURLImp ()
{
}
String name ()
{
return "URL: '" + m_url.full() + "'";
}
Result fetch (CancelCallback&, Journal journal)
{
Result result;
ScopedPointer <HTTPClientBase> client (HTTPClientBase::New ());
HTTPClientBase::Result httpResult (client->get (m_url));
if (httpResult.error == 0)
{
//Logger::outputDebugString (httpResult.response->toString ());
}
else
{
journal.error() <<
"HTTP GET to " << m_url.full().toStdString() <<
" failed: '" << httpResult.error.message () << "'";
}
return result;
}
private:
UniformResourceLocator m_url;
};
//------------------------------------------------------------------------------
SourceURL* SourceURL::New (
UniformResourceLocator const& url)
{
ScopedPointer <SourceURL> object (
new SourceURLImp (url));
return object.release ();
}
}