Browse Source

parameter -htmldir

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
bc0519068a
  1. 2
      src/bitcoinrpc.cpp
  2. 1
      src/init.cpp
  3. 14
      src/util.cpp
  4. 1
      src/util.h

2
src/bitcoinrpc.cpp

@ -982,7 +982,7 @@ void ServiceConnection(AcceptedConnection *conn)
ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto); ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto);
if (strURI != "/" && strURI.find("..") == std::string::npos ) { if (strURI != "/" && strURI.find("..") == std::string::npos ) {
filesystem::path pathFile = filesystem::path(GetDataDir()) / "html" / strURI; filesystem::path pathFile = filesystem::path(GetHTMLDir()) / strURI;
std::string fname = pathFile.string(); std::string fname = pathFile.string();
size_t qMarkIdx = fname.find('?'); size_t qMarkIdx = fname.find('?');
if( qMarkIdx != string::npos ) { if( qMarkIdx != string::npos ) {

1
src/init.cpp

@ -171,6 +171,7 @@ std::string HelpMessage()
strUsage += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n"; strUsage += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n";
strUsage += " -gen " + _("Generate coins (default: 0)") + "\n"; strUsage += " -gen " + _("Generate coins (default: 0)") + "\n";
strUsage += " -datadir=<dir> " + _("Specify data directory") + "\n"; strUsage += " -datadir=<dir> " + _("Specify data directory") + "\n";
strUsage += " -htmldir=<dir> " + _("Specify HTML directory to serve (default: <data>/html)") + "\n";
strUsage += " -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n"; strUsage += " -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n";
strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n"; strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n";
strUsage += " -proxy=<ip:port> " + _("Connect through socks proxy") + "\n"; strUsage += " -proxy=<ip:port> " + _("Connect through socks proxy") + "\n";

14
src/util.cpp

@ -1085,6 +1085,20 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
return path; return path;
} }
boost::filesystem::path GetHTMLDir()
{
namespace fs = boost::filesystem;
fs::path path;
if (mapArgs.count("-htmldir")) {
path = fs::system_complete(mapArgs["-htmldir"]);
} else {
path = GetDataDir() / "html";
}
return path;
}
boost::filesystem::path GetConfigFile() boost::filesystem::path GetConfigFile()
{ {
boost::filesystem::path pathConfigFile(GetArg("-conf", "twister.conf")); boost::filesystem::path pathConfigFile(GetArg("-conf", "twister.conf"));

1
src/util.h

@ -206,6 +206,7 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest); bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest);
boost::filesystem::path GetDefaultDataDir(); boost::filesystem::path GetDefaultDataDir();
const boost::filesystem::path &GetDataDir(bool fNetSpecific = true); const boost::filesystem::path &GetDataDir(bool fNetSpecific = true);
boost::filesystem::path GetHTMLDir();
boost::filesystem::path GetConfigFile(); boost::filesystem::path GetConfigFile();
boost::filesystem::path GetPidFile(); boost::filesystem::path GetPidFile();
void CreatePidFile(const boost::filesystem::path &path, pid_t pid); void CreatePidFile(const boost::filesystem::path &path, pid_t pid);

Loading…
Cancel
Save