diff options
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 12 |
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()); } |