Browse Source

truncate url at '?' when serving htmls

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
ecd49d2fb2
  1. 7
      src/bitcoinrpc.cpp

7
src/bitcoinrpc.cpp

@ -978,7 +978,12 @@ void ServiceConnection(AcceptedConnection *conn) @@ -978,7 +978,12 @@ void ServiceConnection(AcceptedConnection *conn)
if (strURI != "/") {
std::vector<char> file_data;
if( load_file(strURI.c_str(), file_data) == 0 ) {
std::string fname = strURI;
size_t qMarkIdx = fname.find('?');
if( qMarkIdx != string::npos ) {
fname.resize(qMarkIdx);
}
if( load_file(fname.c_str(), file_data) == 0 ) {
std::string str(file_data.data(), file_data.size());
const char *contentType = "text/html";
if( strURI.find(".js") != std::string::npos )

Loading…
Cancel
Save