summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-12-24 11:27:08 +0000
committerRobert Pösel <robyer@seznam.cz>2014-12-24 11:27:08 +0000
commitd482eb3eec3f0ff0dc14e1b98351b61662bdbbb5 (patch)
tree0de6bf68d3b18d9b9f62811879c3aabcfa2eaa58 /protocols
parent59c158d7a0b26eee240d3d91ea93db6bf01ae8ac (diff)
Facebook: Better check for unexpected redirect at login
git-svn-id: http://svn.miranda-ng.org/main/trunk@11604 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/communication.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index df86bfed9d..d8d91399e4 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -947,9 +947,15 @@ bool facebook_client::login(const char *username, const char *password)
case HTTP_CODE_FOUND: // Found and redirected somewhere
{
if (resp.headers.find("Location") != resp.headers.end()) {
- std::string url = (this->https_ ? "https://"FACEBOOK_SERVER_REGULAR"/" : "http://"FACEBOOK_SERVER_REGULAR"/");
-
- if (resp.headers["Location"] != url) {
+ std::string redirectUrl = resp.headers["location"];
+ std::string expectedUrl = (this->https_ ? "https://"FACEBOOK_SERVER_REGULAR"/" : "http://"FACEBOOK_SERVER_REGULAR"/");
+
+ // Remove eventual parameters
+ std::string::size_type pos = redirectUrl.rfind("?");
+ if (pos != std::tstring::npos)
+ redirectUrl = redirectUrl.substr(0, pos);
+
+ if (redirectUrl != expectedUrl) {
// Unexpected redirect, but we try to ignore it - maybe we were logged in anyway
parent->debugLogA(" ! ! Login error: Unexpected redirect: %s", resp.headers["Location"].c_str());
}