summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-08 22:26:42 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-08 22:26:42 +0300
commitc9c758098feed5ad2e9f5fe46c9ec9d8057c53ed (patch)
treed874f13f72b06a780d7453afe8ce34eabbec8e92 /protocols
parent1e5ae8efefc6f50082c1c1734c763aab2fb1b7f5 (diff)
fix for wrong url encoded request's body
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/communication.cpp12
-rw-r--r--protocols/FacebookRM/src/entities.h1
-rw-r--r--protocols/FacebookRM/src/feeds.cpp2
-rw-r--r--protocols/FacebookRM/src/history.cpp2
-rw-r--r--protocols/FacebookRM/src/http_request.h2
5 files changed, 9 insertions, 10 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 9dd90ab7c8..13b20e0066 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -461,7 +461,7 @@ bool facebook_client::login(const char *username, const char *password)
while (resp.data.find("id=\"approvals_code\"") != std::string::npos) {
parent->debugLogA(" Login info: Approval code required.");
- std::string fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ std::string fb_dtsg = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
std::string nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
CFacebookGuardDialog guardDialog(parent, fb_dtsg.c_str());
@@ -492,7 +492,7 @@ bool facebook_client::login(const char *username, const char *password)
// Save this actual device
if (resp.data.find("name=\"submit[Continue]\"") != std::string::npos && resp.data.find("name=\"name_action_selected\"") != std::string::npos) {
- std::string fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ std::string fb_dtsg = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
std::string nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
HttpRequest *request = setupMachineRequest(fb_dtsg.c_str(), nh.c_str(), "Continue");
@@ -504,7 +504,7 @@ bool facebook_client::login(const char *username, const char *password)
// 1) Continue to check last unknown login
if (resp.data.find("name=\"submit[Continue]\"") != std::string::npos) {
- std::string fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ std::string fb_dtsg = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
std::string nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
resp = sendRequest(setupMachineRequest(fb_dtsg.c_str(), nh.c_str(), "Continue"));
}
@@ -534,14 +534,14 @@ bool facebook_client::login(const char *username, const char *password)
return handle_error("login", FORCE_QUIT);
}
- std::string fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ std::string fb_dtsg = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
std::string nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
// Recognize device (or "This wasn't me" - this will force to change account password)
resp = sendRequest(setupMachineRequest(fb_dtsg.c_str(), nh.c_str(), "This was me"));
// 3) Save last device
- fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ fb_dtsg = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
HttpRequest *request = setupMachineRequest(fb_dtsg.c_str(), nh.c_str(), "Continue");
@@ -660,7 +660,7 @@ bool facebook_client::home()
// get fb_dtsg
http::response resp = sendRequest(dtsgRequest());
- this->dtsg_ = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ this->dtsg_ = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
{
// Compute ttstamp from dtsg_
std::stringstream csrf;
diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h
index 3fd692a88d..e1f9b69faa 100644
--- a/protocols/FacebookRM/src/entities.h
+++ b/protocols/FacebookRM/src/entities.h
@@ -91,7 +91,6 @@ struct facebook_chatroom
bool is_archived = false;
bool is_subscribed = true;
bool read_only = false;
- int64_t tmp_msgid = 0;
facebook_chatroom(std::string _thread_id) :
thread_id(_thread_id)
diff --git a/protocols/FacebookRM/src/feeds.cpp b/protocols/FacebookRM/src/feeds.cpp
index b4bda2d578..9f18df8ec7 100644
--- a/protocols/FacebookRM/src/feeds.cpp
+++ b/protocols/FacebookRM/src/feeds.cpp
@@ -52,7 +52,7 @@ HttpRequest* facebook_client::memoriesRequest()
<< CHAR_PARAM("last_section_key", "regular_story")
<< INT_PARAM("__be", -1)
<< CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT64_PARAM("timestamp", ::time(nullptr))
+ << INT64_PARAM("timestamp", ::time(nullptr) * 1000)
<< CHAR_PARAM("__dyn", __dyn())
<< CHAR_PARAM("__req", __req())
<< CHAR_PARAM("__rev", __rev())
diff --git a/protocols/FacebookRM/src/history.cpp b/protocols/FacebookRM/src/history.cpp
index d5193f3bdf..b34fbb534e 100644
--- a/protocols/FacebookRM/src/history.cpp
+++ b/protocols/FacebookRM/src/history.cpp
@@ -59,7 +59,7 @@ HttpRequest* facebook_client::threadInfoRequest(bool isChat, const char *id, con
o0 << CHAR_PARAM("doc_id", "1549485615075443") << JSON_PARAM("query_params", query_params);
root << JSON_PARAM("o0", o0);
- p->Body << CHAR_PARAM("queries", utils::url::encode(root.write()).c_str());
+ p->Body << CHAR_PARAM("queries", root.write().c_str());
return p;
}
diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h
index 0c2aa14e67..ffdb6d40ce 100644
--- a/protocols/FacebookRM/src/http_request.h
+++ b/protocols/FacebookRM/src/http_request.h
@@ -161,7 +161,7 @@ protected:
HttpRequestBody& operator<<(const CHAR_PARAM &param)
{
AppendSeparator();
- content.AppendFormat("%s=%s", param.szName, param.szValue);
+ content.AppendFormat("%s=%s", param.szName, utils::url::encode(param.szValue).c_str());
return *this;
}