From ecd49d2fb2211f80d09b7186339ea971043264fe Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sat, 2 Nov 2013 12:39:56 -0200 Subject: [PATCH] truncate url at '?' when serving htmls --- src/bitcoinrpc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 23eaa422..275d8b20 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -978,7 +978,12 @@ void ServiceConnection(AcceptedConnection *conn) if (strURI != "/") { std::vector 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 )