summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Sorvig <msorvig@trolltech.com>2009-06-23 16:10:15 +0200
committerMorten Sorvig <msorvig@trolltech.com>2009-06-23 16:10:15 +0200
commitec5be0f74d12da302116fb7dc62003f57a803d28 (patch)
tree468e6a9a1f4f45918c493b2358ac0b3770d2f095 /src
parent7d96dfcb3246277970364e8541a032c38eb4b45f (diff)
Use '|' as a prefix on filenames to avoid collisions with other urls (/json messages for example)
Diffstat (limited to 'src')
-rw-r--r--src/eventqueue.cpp2
-rw-r--r--src/index.html2
-rw-r--r--src/qwebclient.js12
-rw-r--r--src/webclientserver.cpp12
4 files changed, 13 insertions, 15 deletions
diff --git a/src/eventqueue.cpp b/src/eventqueue.cpp
index a801379..cc8c9d6 100644
--- a/src/eventqueue.cpp
+++ b/src/eventqueue.cpp
@@ -94,7 +94,7 @@ void EventQueue::handleRequest(HttpRequest *request, HttpResponse *response)
jsonText.replace("%7D", "}");
jsonText.replace("%22", "\"");
- DEBUG << "json request" << jsonText;
+ qDebug() << "json request" << jsonText;
json_object* request = json_tokener_parse(jsonText.data());
json_object* type = json_object_object_get(request, "type");
diff --git a/src/index.html b/src/index.html
index e0cb434..8b68cfc 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1 +1 @@
-<html> <head> <script type="text/javascript" src="qwebclient.js"></script> </head> <body> <div class="qwebclient" style="width:10000px" src="INSERT_HOSTNAME"></div> </body> </html> \ No newline at end of file
+<html> <head> <script type="text/javascript" src=":qwebclient.js"></script> </head> <body> <div class="qwebclient" style="width:10000px" src="INSERT_HOSTNAME"></div> </body> </html> \ No newline at end of file
diff --git a/src/qwebclient.js b/src/qwebclient.js
index 4fb72ef..1fce291 100644
--- a/src/qwebclient.js
+++ b/src/qwebclient.js
@@ -1,7 +1,7 @@
// When adding files here, add the name to allowedFileNames in webclientserver.cpp as well
-document.write("<link rel='stylesheet' href='qwebclient.css'>");
-document.write("<script type='text/javascript' src='dojo.js' djConfig='parseOnLoad: true'></scr"+"ipt>");
-document.write("<script type='text/javascript' src='json2.js'></scr"+"ipt>");
-document.write("<script type='text/javascript' src='draghandler.js'></scr"+"ipt>");
-document.write("<script type='text/javascript' src='sessionhandler.js'></scr"+"ipt>");
-document.write("<script type='text/javascript' src='eventhandler.js'></scr"+"ipt>");
+document.write("<link rel='stylesheet' href=':qwebclient.css'>");
+document.write("<script type='text/javascript' src=':dojo.js' djConfig='parseOnLoad: true'></scr"+"ipt>");
+document.write("<script type='text/javascript' src=':json2.js'></scr"+"ipt>");
+document.write("<script type='text/javascript' src=':draghandler.js'></scr"+"ipt>");
+document.write("<script type='text/javascript' src=':sessionhandler.js'></scr"+"ipt>");
+document.write("<script type='text/javascript' src=':eventhandler.js'></scr"+"ipt>");
diff --git a/src/webclientserver.cpp b/src/webclientserver.cpp
index 21c1eb1..fb01617 100644
--- a/src/webclientserver.cpp
+++ b/src/webclientserver.cpp
@@ -271,10 +271,10 @@ void Server::dataOnSocket()
FileServer::FileServer()
{
allowedFileNames = QSet<QString>()
- << "index.html" << "qwebclient.js"
- << "qwebclient.css" << "dojo.js"
- << "json2.js" << "draghandler.js"
- << "sessionhandler.js" << "eventhandler.js";
+ << ":index.html" << ":qwebclient.js"
+ << ":qwebclient.css" << ":dojo.js"
+ << ":json2.js" << ":draghandler.js"
+ << ":sessionhandler.js" << ":eventhandler.js";
}
@@ -290,13 +290,11 @@ void FileServer::handleRequest(HttpRequest *request, HttpResponse *response)
DEBUG << "file server handle request" << path << filePath;
if (filePath == "")
- filePath = "index.html";
+ filePath = ":index.html";
if (allowedFileNames.contains(filePath) == false)
return; // ### drop connection?
- filePath.prepend(":"); // load from resources.
-
QFile file(filePath);
if (file.exists() == false) {
// DEBUG << "no file" << filePath;