Blame kdelibs-3.5.10-oCERT-2009-015-xmlhttprequest.patch
|
Lukas Tinkl |
6fa4cd2 |
Index: xmlhttprequest.cpp
|
|
Lukas Tinkl |
6fa4cd2 |
===================================================================
|
|
Lukas Tinkl |
6fa4cd2 |
--- khtml/ecma/xmlhttprequest.cpp (revision 954808)
|
|
Lukas Tinkl |
6fa4cd2 |
+++ khtml/ecma/xmlhttprequest.cpp (working copy)
|
|
Lukas Tinkl |
6fa4cd2 |
@@ -342,17 +342,17 @@
|
|
Lukas Tinkl |
6fa4cd2 |
{
|
|
Lukas Tinkl |
6fa4cd2 |
aborted = false;
|
|
Lukas Tinkl |
6fa4cd2 |
|
|
Lukas Tinkl |
6fa4cd2 |
+ const QString protocol = url.protocol().lower();
|
|
Lukas Tinkl |
6fa4cd2 |
+ // Abandon the request when the protocol is other than "http",
|
|
Lukas Tinkl |
6fa4cd2 |
+ // instead of blindly doing a KIO::get on other protocols like file:/.
|
|
Lukas Tinkl |
6fa4cd2 |
+ if (!protocol.startsWith("http") && !protocol.startsWith("webdav"))
|
|
Lukas Tinkl |
6fa4cd2 |
+ {
|
|
Lukas Tinkl |
6fa4cd2 |
+ abort();
|
|
Lukas Tinkl |
6fa4cd2 |
+ return;
|
|
Lukas Tinkl |
6fa4cd2 |
+ }
|
|
Lukas Tinkl |
6fa4cd2 |
+
|
|
Lukas Tinkl |
6fa4cd2 |
if (method == "post") {
|
|
Lukas Tinkl |
6fa4cd2 |
- QString protocol = url.protocol().lower();
|
|
Lukas Tinkl |
6fa4cd2 |
|
|
Lukas Tinkl |
6fa4cd2 |
- // Abondon the request when the protocol is other than "http",
|
|
Lukas Tinkl |
6fa4cd2 |
- // instead of blindly changing it to a "get" request.
|
|
Lukas Tinkl |
6fa4cd2 |
- if (!protocol.startsWith("http") && !protocol.startsWith("webdav"))
|
|
Lukas Tinkl |
6fa4cd2 |
- {
|
|
Lukas Tinkl |
6fa4cd2 |
- abort();
|
|
Lukas Tinkl |
6fa4cd2 |
- return;
|
|
Lukas Tinkl |
6fa4cd2 |
- }
|
|
Lukas Tinkl |
6fa4cd2 |
-
|
|
Lukas Tinkl |
6fa4cd2 |
// FIXME: determine post encoding correctly by looking in headers
|
|
Lukas Tinkl |
6fa4cd2 |
// for charset.
|
|
Lukas Tinkl |
6fa4cd2 |
QByteArray buf;
|
|
Lukas Tinkl |
6fa4cd2 |
@@ -763,11 +763,11 @@
|
|
Lukas Tinkl |
6fa4cd2 |
if (obj.isValid() && obj.inherits(&DOMDocument::info)) {
|
|
Lukas Tinkl |
6fa4cd2 |
DOM::Node docNode = static_cast<KJS::DOMDocument *>(obj.imp())->toNode();
|
|
Lukas Tinkl |
6fa4cd2 |
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl *>(docNode.handle());
|
|
Lukas Tinkl |
6fa4cd2 |
-
|
|
Lukas Tinkl |
6fa4cd2 |
+
|
|
Lukas Tinkl |
6fa4cd2 |
try {
|
|
Lukas Tinkl |
6fa4cd2 |
body = doc->toString().string();
|
|
Lukas Tinkl |
6fa4cd2 |
// FIXME: also need to set content type, including encoding!
|
|
Lukas Tinkl |
6fa4cd2 |
-
|
|
Lukas Tinkl |
6fa4cd2 |
+
|
|
Lukas Tinkl |
6fa4cd2 |
} catch(DOM::DOMException& e) {
|
|
Lukas Tinkl |
6fa4cd2 |
Object err = Error::create(exec, GeneralError, "Exception serializing document");
|
|
Lukas Tinkl |
6fa4cd2 |
exec->setException(err);
|