summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Tyrychtr <lukastyrychtr@gmail.com>2022-11-02 14:49:54 +0100
committerMarge Bot <marge-bot@gnome.org>2022-11-02 21:25:59 +0000
commitfe439cbdc5a473e5220f217d43f3409ff26a5252 (patch)
tree82767a569a04e447daef29ed682b52737653d8b4
parent680e148a9aa0cc7361f52e74c982103f47499c5d (diff)
downloadepiphany-fe439cbdc5a473e5220f217d43f3409ff26a5252.tar.gz
Remove unreachable libsoup code
Fixes #1892. Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1211>
-rw-r--r--lib/safe-browsing/ephy-gsb-service.c18
-rw-r--r--lib/sync/debug/ephy-sync-debug.c40
-rw-r--r--lib/sync/ephy-sync-service.c162
-rw-r--r--src/ephy-suggestion-model.c19
-rw-r--r--src/webextension/api/cookies.c8
-rw-r--r--tests/ephy-web-view-test.c23
6 files changed, 2 insertions, 268 deletions
diff --git a/lib/safe-browsing/ephy-gsb-service.c b/lib/safe-browsing/ephy-gsb-service.c
index 97086038f..40b65a0c3 100644
--- a/lib/safe-browsing/ephy-gsb-service.c
+++ b/lib/safe-browsing/ephy-gsb-service.c
@@ -192,10 +192,8 @@ ephy_gsb_service_update_in_thread (EphyGSBService *self)
char *body;
g_autoptr (GBytes) response_body = NULL;
guint status_code;
-#if SOUP_CHECK_VERSION (2, 99, 4)
g_autoptr (GBytes) bytes = NULL;
g_autoptr (GError) error = NULL;
-#endif
g_assert (EPHY_IS_GSB_SERVICE (self));
@@ -220,7 +218,6 @@ ephy_gsb_service_update_in_thread (EphyGSBService *self)
body = ephy_gsb_utils_make_list_updates_request (threat_lists);
url = g_strdup_printf ("%sthreatListUpdates:fetch?key=%s", API_PREFIX, self->api_key);
msg = soup_message_new (SOUP_METHOD_POST, url);
-#if SOUP_CHECK_VERSION (2, 99, 4)
bytes = g_bytes_new_take (body, strlen (body));
soup_message_set_request_body_from_bytes (msg, "application/json", bytes);
response_body = soup_session_send_and_read (self->session, msg, NULL, &error);
@@ -232,12 +229,6 @@ ephy_gsb_service_update_in_thread (EphyGSBService *self)
}
status_code = soup_message_get_status (msg);
-#else
- soup_message_set_request (msg, "application/json", SOUP_MEMORY_TAKE, body, strlen (body));
- soup_session_send_message (self->session, msg);
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
/* Handle unsuccessful responses. */
if (status_code != 200) {
@@ -575,10 +566,8 @@ ephy_gsb_service_update_full_hashes_in_thread (UpdateFullHashesData *data)
double duration;
g_autoptr (GBytes) response_body = NULL;
guint status_code;
-#if SOUP_CHECK_VERSION (2, 99, 4)
g_autoptr (GBytes) bytes = NULL;
g_autoptr (GError) error = NULL;
-#endif
g_assert (EPHY_IS_GSB_SERVICE (self));
g_assert (ephy_gsb_storage_is_operable (self->storage));
@@ -605,7 +594,6 @@ ephy_gsb_service_update_full_hashes_in_thread (UpdateFullHashesData *data)
body = ephy_gsb_utils_make_full_hashes_request (threat_lists, data->prefixes);
url = g_strdup_printf ("%sfullHashes:find?key=%s", API_PREFIX, self->api_key);
msg = soup_message_new (SOUP_METHOD_POST, url);
-#if SOUP_CHECK_VERSION (2, 99, 4)
bytes = g_bytes_new_take (body, strlen (body));
soup_message_set_request_body_from_bytes (msg, "application/json", bytes);
response_body = soup_session_send_and_read (self->session, msg, NULL, &error);
@@ -617,12 +605,6 @@ ephy_gsb_service_update_full_hashes_in_thread (UpdateFullHashesData *data)
}
status_code = soup_message_get_status (msg);
-#else
- soup_message_set_request (msg, "application/json", SOUP_MEMORY_TAKE, body, strlen (body));
- soup_session_send_message (self->session, msg);
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
/* Handle unsuccessful responses. */
if (status_code != 200) {
diff --git a/lib/sync/debug/ephy-sync-debug.c b/lib/sync/debug/ephy-sync-debug.c
index 892ffeabf..2621fe013 100644
--- a/lib/sync/debug/ephy-sync-debug.c
+++ b/lib/sync/debug/ephy-sync-debug.c
@@ -237,25 +237,15 @@ ephy_sync_debug_prepare_soup_message (const char *url,
msg = soup_message_new (method, url);
-#if SOUP_CHECK_VERSION (2, 99, 4)
request_headers = soup_message_get_request_headers (msg);
-#else
- request_headers = msg->request_headers;
-#endif
if (body) {
-#if SOUP_CHECK_VERSION (2, 99, 4)
g_autoptr (GBytes) bytes = NULL;
-#endif
options = ephy_sync_crypto_hawk_options_new (NULL, NULL, NULL, content_type,
NULL, NULL, NULL, body, NULL);
-#if SOUP_CHECK_VERSION (2, 99, 4)
bytes = g_bytes_new (body, strlen (body));
soup_message_set_request_body_from_bytes (msg, content_type, bytes);
-#else
- soup_message_set_request (msg, content_type, SOUP_MEMORY_COPY, body, strlen (body));
-#endif
}
if (!g_strcmp0 (method, "PUT") || !g_strcmp0 (method, "POST"))
@@ -321,7 +311,6 @@ ephy_sync_debug_get_signed_certificate (const char *session_token,
msg = ephy_sync_debug_prepare_soup_message (url, "POST", body,
id_hex, key, 32);
session = soup_session_new ();
-#if SOUP_CHECK_VERSION (2, 99, 4)
response_body = soup_session_send_and_read (session, msg, NULL, &error);
if (!response_body) {
LOG ("Failed to get signed certificate: %s", error->message);
@@ -329,11 +318,6 @@ ephy_sync_debug_get_signed_certificate (const char *session_token,
}
status_code = soup_message_get_status (msg);
-#else
- status_code = soup_session_send_message (session, msg);
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
-
if (status_code != 200) {
LOG ("Failed to get signed certificate: %s", (const char *)g_bytes_get_data (response_body, NULL));
goto free_session;
@@ -410,15 +394,10 @@ ephy_sync_debug_get_storage_credentials (char **storage_endpoint,
client_state = g_strndup (hashed_kb, 32);
authorization = g_strdup_printf ("BrowserID %s", assertion);
msg = soup_message_new ("GET", token_server);
-#if SOUP_CHECK_VERSION (2, 99, 4)
request_headers = soup_message_get_request_headers (msg);
-#else
- request_headers = msg->request_headers;
-#endif
soup_message_headers_append (request_headers, "X-Client-State", client_state);
soup_message_headers_append (request_headers, "authorization", authorization);
session = soup_session_new ();
-#if SOUP_CHECK_VERSION (2, 99, 4)
response_body = soup_session_send_and_read (session, msg, NULL, &error);
if (!response_body) {
LOG ("Failed to get storage credentials: %s", error->message);
@@ -426,10 +405,6 @@ ephy_sync_debug_get_storage_credentials (char **storage_endpoint,
}
status_code = soup_message_get_status (msg);
-#else
- status_code = soup_session_send_message (session, msg);
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
LOG ("Failed to get storage credentials: %s", (const char *)g_bytes_get_data (response_body, NULL));
@@ -498,13 +473,8 @@ ephy_sync_debug_send_request (const char *endpoint,
(const guint8 *)storage_key,
strlen (storage_key));
session = soup_session_new ();
-#if SOUP_CHECK_VERSION (2, 99, 4)
response_body = soup_session_send_and_read (session, msg, NULL, NULL);
status_code = soup_message_get_status (msg);
-#else
- status_code = soup_session_send_message (session, msg);
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (response_body) {
if (status_code == 200)
@@ -1096,12 +1066,7 @@ ephy_sync_debug_view_connected_devices (void)
id_hex = ephy_sync_utils_encode_hex (id, 32);
msg = ephy_sync_debug_prepare_soup_message (url, "GET", NULL, id_hex, key, 32);
session = soup_session_new ();
-#if SOUP_CHECK_VERSION (2, 99, 4)
response_body = soup_session_send_and_read (session, msg, NULL, NULL);
-#else
- soup_session_send_message (session, msg);
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (response_body)
LOG ("%s", (const char *)g_bytes_get_data (response_body, NULL));
@@ -1157,7 +1122,6 @@ ephy_sync_debug_get_current_device (void)
id_hex = ephy_sync_utils_encode_hex (id, 32);
msg = ephy_sync_debug_prepare_soup_message (url, "GET", NULL, id_hex, key, 32);
session = soup_session_new ();
-#if SOUP_CHECK_VERSION (2, 99, 4)
response_body = soup_session_send_and_read (session, msg, NULL, &error);
if (!response_body) {
LOG ("Failed to GET account devices: %s", error->message);
@@ -1165,10 +1129,6 @@ ephy_sync_debug_get_current_device (void)
}
status_code = soup_message_get_status (msg);
-#else
- status_code = soup_session_send_message (session, msg);
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
LOG ("Failed to GET account devices: %s", (const char *)g_bytes_get_data (response_body, NULL));
diff --git a/lib/sync/ephy-sync-service.c b/lib/sync/ephy-sync-service.c
index 815c147c7..884ad9115 100644
--- a/lib/sync/ephy-sync-service.c
+++ b/lib/sync/ephy-sync-service.c
@@ -97,11 +97,9 @@ enum {
static guint signals[LAST_SIGNAL];
-#if SOUP_CHECK_VERSION (2, 99, 4)
typedef void (*SoupSessionCallback) (SoupSession *session,
SoupMessage *msg,
gpointer user_data);
-#endif
typedef struct {
char *endpoint;
@@ -185,7 +183,6 @@ storage_request_async_data_free (StorageRequestAsyncData *data)
g_free (data);
}
-#if SOUP_CHECK_VERSION (2, 99, 4)
typedef struct {
SoupSessionCallback callback;
gpointer user_data;
@@ -249,7 +246,6 @@ storage_request_async_ready_cb (SoupSession *session,
data->callback (session, msg, data->user_data);
storage_request_async_data_free (data);
}
-#endif
static SignInAsyncData *
sign_in_async_data_new (EphySyncService *service,
@@ -539,9 +535,7 @@ ephy_sync_service_fxa_hawk_post (EphySyncService *self,
char *url;
const char *content_type = "application/json; charset=utf-8";
g_autofree char *accounts_server = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
g_autoptr (GBytes) bytes = NULL;
-#endif
g_assert (EPHY_IS_SYNC_SERVICE (self));
g_assert (endpoint);
@@ -552,15 +546,9 @@ ephy_sync_service_fxa_hawk_post (EphySyncService *self,
accounts_server = ephy_sync_utils_get_accounts_server ();
url = g_strdup_printf ("%s/%s", accounts_server, endpoint);
msg = soup_message_new (SOUP_METHOD_POST, url);
-#if SOUP_CHECK_VERSION (2, 99, 4)
bytes = g_bytes_new (request_body, strlen (request_body));
soup_message_set_request_body_from_bytes (msg, content_type, bytes);
request_headers = soup_message_get_request_headers (msg);
-#else
- soup_message_set_request (msg, content_type, SOUP_MEMORY_COPY,
- request_body, strlen (request_body));
- request_headers = msg->request_headers;
-#endif
options = ephy_sync_crypto_hawk_options_new (NULL, NULL, NULL, content_type,
NULL, NULL, NULL, request_body,
@@ -568,13 +556,9 @@ ephy_sync_service_fxa_hawk_post (EphySyncService *self,
header = ephy_sync_crypto_hawk_header_new (url, "POST", id, key, key_len, options);
soup_message_headers_append (request_headers, "authorization", header->header);
soup_message_headers_append (request_headers, "content-type", content_type);
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_session_send_and_read_async (self->session, msg, G_PRIORITY_DEFAULT, NULL,
(GAsyncReadyCallback)send_and_read_async_ready_cb,
send_and_read_async_data_new (callback, user_data));
-#else
- soup_session_queue_message (self->session, msg, callback, user_data);
-#endif
g_free (url);
ephy_sync_crypto_hawk_options_free (options);
@@ -605,19 +589,11 @@ ephy_sync_service_fxa_hawk_get (EphySyncService *self,
url = g_strdup_printf ("%s/%s", accounts_server, endpoint);
msg = soup_message_new (SOUP_METHOD_GET, url);
header = ephy_sync_crypto_hawk_header_new (url, "GET", id, key, key_len, NULL);
-#if SOUP_CHECK_VERSION (2, 99, 4)
request_headers = soup_message_get_request_headers (msg);
-#else
- request_headers = msg->request_headers;
-#endif
soup_message_headers_append (request_headers, "authorization", header->header);
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_session_send_and_read_async (self->session, msg, G_PRIORITY_DEFAULT, NULL,
(GAsyncReadyCallback)send_and_read_async_ready_cb,
send_and_read_async_data_new (callback, user_data));
-#else
- soup_session_queue_message (self->session, msg, callback, user_data);
-#endif
g_free (url);
ephy_sync_crypto_hawk_header_free (header);
@@ -643,27 +619,16 @@ ephy_sync_service_send_storage_request (EphySyncService *self,
msg = soup_message_new (data->method, url);
if (data->request_body) {
-#if SOUP_CHECK_VERSION (2, 99, 4)
g_autoptr (GBytes) bytes = NULL;
-#endif
+
options = ephy_sync_crypto_hawk_options_new (NULL, NULL, NULL, content_type,
NULL, NULL, NULL, data->request_body,
NULL);
-#if SOUP_CHECK_VERSION (2, 99, 4)
bytes = g_bytes_new (data->request_body, strlen (data->request_body));
soup_message_set_request_body_from_bytes (msg, content_type, bytes);
-#else
- soup_message_set_request (msg, content_type, SOUP_MEMORY_COPY,
- data->request_body, strlen (data->request_body));
-#endif
}
-#if SOUP_CHECK_VERSION (2, 99, 4)
request_headers = soup_message_get_request_headers (msg);
-#else
- request_headers = msg->request_headers;
-#endif
-
if (!g_strcmp0 (data->method, SOUP_METHOD_PUT) || !g_strcmp0 (data->method, SOUP_METHOD_POST))
soup_message_headers_append (request_headers, "content-type", content_type);
@@ -684,14 +649,9 @@ ephy_sync_service_send_storage_request (EphySyncService *self,
strlen (self->storage_credentials_key),
options);
soup_message_headers_append (request_headers, "authorization", header->header);
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_session_send_and_read_async (self->session, msg, G_PRIORITY_DEFAULT, NULL,
(GAsyncReadyCallback)storage_request_async_ready_cb,
data);
-#else
- soup_session_queue_message (self->session, msg, data->callback, data->user_data);
- storage_request_async_data_free (data);
-#endif
g_free (url);
g_free (if_modified_since);
@@ -857,13 +817,8 @@ destroy_session_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to destroy session. Status code: %u, response: %s",
@@ -873,7 +828,6 @@ destroy_session_cb (SoupSession *session,
}
}
-#if SOUP_CHECK_VERSION (2, 99, 4)
static void
destroy_session_send_and_read_ready_cb (SoupSession *session,
GAsyncResult *result,
@@ -893,7 +847,6 @@ destroy_session_send_and_read_ready_cb (SoupSession *session,
(GDestroyNotify)g_bytes_unref);
destroy_session_cb (session, msg, user_data);
}
-#endif
static void
ephy_sync_service_destroy_session (EphySyncService *self,
@@ -911,9 +864,7 @@ ephy_sync_service_destroy_session (EphySyncService *self,
const char *content_type = "application/json; charset=utf-8";
const char *request_body = "{}";
g_autofree char *accounts_server = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
g_autoptr (GBytes) bytes = NULL;
-#endif
g_assert (EPHY_IS_SYNC_SERVICE (self));
if (!session_token)
@@ -928,15 +879,9 @@ ephy_sync_service_destroy_session (EphySyncService *self,
token_id_hex = ephy_sync_utils_encode_hex (token_id, 32);
msg = soup_message_new (SOUP_METHOD_POST, url);
-#if SOUP_CHECK_VERSION (2, 99, 4)
bytes = g_bytes_new_static (request_body, strlen (request_body));
soup_message_set_request_body_from_bytes (msg, content_type, bytes);
request_headers = soup_message_get_request_headers (msg);
-#else
- soup_message_set_request (msg, content_type, SOUP_MEMORY_STATIC,
- request_body, strlen (request_body));
- request_headers = msg->request_headers;
-#endif
options = ephy_sync_crypto_hawk_options_new (NULL, NULL, NULL, content_type,
NULL, NULL, NULL, request_body,
NULL);
@@ -944,13 +889,9 @@ ephy_sync_service_destroy_session (EphySyncService *self,
req_hmac_key, 32, options);
soup_message_headers_append (request_headers, "authorization", header->header);
soup_message_headers_append (request_headers, "content-type", content_type);
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_session_send_and_read_async (self->session, msg, G_PRIORITY_DEFAULT, NULL,
(GAsyncReadyCallback)destroy_session_send_and_read_ready_cb,
NULL);
-#else
- soup_session_queue_message (self->session, msg, destroy_session_cb, NULL);
-#endif
g_free (token_id_hex);
g_free (token_id);
@@ -999,13 +940,8 @@ get_storage_credentials_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to obtain storage credentials. Status code: %u, response: %s",
@@ -1059,7 +995,6 @@ out:
g_error_free (error);
}
-#if SOUP_CHECK_VERSION (2, 99, 4)
static void
get_storage_credentials_ready_cb (SoupSession *session,
GAsyncResult *result,
@@ -1079,7 +1014,6 @@ get_storage_credentials_ready_cb (SoupSession *session,
(GDestroyNotify)g_bytes_unref);
get_storage_credentials_cb (session, msg, user_data);
}
-#endif
static void
ephy_sync_service_trade_browserid_assertion (EphySyncService *self)
@@ -1108,23 +1042,15 @@ ephy_sync_service_trade_browserid_assertion (EphySyncService *self)
authorization = g_strdup_printf ("BrowserID %s", assertion);
msg = soup_message_new (SOUP_METHOD_GET, token_server);
-#if SOUP_CHECK_VERSION (2, 99, 4)
request_headers = soup_message_get_request_headers (msg);
-#else
- request_headers = msg->request_headers;
-#endif
/* We need to add the X-Client-State header so that the Token Server will
* recognize accounts that were previously used to sync Firefox data too.
*/
soup_message_headers_append (request_headers, "X-Client-State", client_state);
soup_message_headers_append (request_headers, "authorization", authorization);
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_session_send_and_read_async (self->session, msg, G_PRIORITY_DEFAULT, NULL,
(GAsyncReadyCallback)get_storage_credentials_ready_cb,
self);
-#else
- soup_session_queue_message (self->session, msg, get_storage_credentials_cb, self);
-#endif
g_free (kb);
g_free (hashed_kb);
@@ -1149,13 +1075,8 @@ get_signed_certificate_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
node = json_from_string (g_bytes_get_data (response_body, NULL), &error);
if (error) {
@@ -1330,13 +1251,8 @@ delete_synchronizable_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code == 200) {
LOG ("Successfully deleted from server");
@@ -1421,13 +1337,8 @@ download_synchronizable_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to download object. Status code: %u, response: %s",
@@ -1515,13 +1426,8 @@ upload_synchronizable_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
/* Code 412 means that there is a more recent version on the server.
* Download it.
@@ -1647,15 +1553,9 @@ commit_batch_cb (SoupSession *session,
SoupMessageHeaders *response_headers;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_headers = soup_message_get_response_headers (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_headers = msg->response_headers;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to commit batch. Status code: %u, response: %s",
@@ -1683,13 +1583,8 @@ upload_batch_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
/* Note: "202 Accepted" status code. */
if (status_code != 202) {
@@ -1732,13 +1627,8 @@ start_batch_upload_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
/* Note: "202 Accepted" status code. */
if (status_code != 202) {
@@ -1836,13 +1726,8 @@ sync_collection_cb (SoupSession *session,
collection = ephy_synchronizable_manager_get_collection_name (data->manager);
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to get records in collection %s. Status code: %u, response: %s",
@@ -2169,13 +2054,8 @@ upload_client_record_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to upload client record. Status code: %u, response: %s",
@@ -2378,13 +2258,8 @@ upload_crypto_keys_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to upload crypto/keys record. Status code: %u, response: %s",
@@ -2455,13 +2330,8 @@ get_crypto_keys_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code == 404) {
LOG ("crypto/keys record not found, uploading new one...");
@@ -2554,13 +2424,8 @@ upload_meta_global_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to upload meta/global record. Status code: %u, response: %s",
@@ -2640,13 +2505,8 @@ verify_storage_version_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code == 404) {
LOG ("meta/global record not found, uploading new one...");
@@ -2736,13 +2596,8 @@ upload_fxa_device_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to upload device info on FxA Server. Status code: %u, response: %s",
@@ -2885,13 +2740,8 @@ get_account_keys_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
node = json_from_string (g_bytes_get_data (response_body, NULL), &error);
if (error) {
@@ -3086,13 +2936,8 @@ delete_open_tabs_record_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to delete open tabs record. Status code: %u, response: %s",
@@ -3123,13 +2968,8 @@ delete_client_record_cb (SoupSession *session,
guint status_code;
g_autoptr (GBytes) response_body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
status_code = soup_message_get_status (msg);
response_body = g_bytes_ref (g_object_get_data (G_OBJECT (msg), "ephy-request-body"));
-#else
- status_code = msg->status_code;
- response_body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
if (status_code != 200) {
g_warning ("Failed to delete client record. Status code: %u, response: %s",
diff --git a/src/ephy-suggestion-model.c b/src/ephy-suggestion-model.c
index 08a397585..84a9321b5 100644
--- a/src/ephy-suggestion-model.c
+++ b/src/ephy-suggestion-model.c
@@ -635,17 +635,10 @@ history_query_completed_cb (EphyHistoryService *service,
query_collection_done (self, g_steal_pointer (&task));
}
-#if SOUP_CHECK_VERSION (2, 99, 4)
static void
google_search_suggestions_cb (SoupSession *session,
GAsyncResult *result,
gpointer user_data)
-#else
-static void
-google_search_suggestions_cb (SoupSession *session,
- SoupMessage *msg,
- gpointer user_data)
-#endif
{
GTask *task = G_TASK (user_data);
EphySuggestionModel *self = g_task_get_source_object (task);
@@ -658,7 +651,7 @@ google_search_suggestions_cb (SoupSession *session,
EphySearchEngine *engine;
int added = 0;
g_autoptr (GBytes) body = NULL;
-#if SOUP_CHECK_VERSION (2, 99, 4)
+
SoupMessage *msg;
body = soup_session_send_and_read_finish (session, result, NULL);
@@ -670,12 +663,6 @@ google_search_suggestions_cb (SoupSession *session,
goto out;
/* FIXME: we don't have a way to get the status code */
-#else
- if (msg->status_code != 200)
- goto out;
-
- body = g_bytes_new_static (msg->response_body->data, msg->response_body->length);
-#endif
shell = ephy_embed_shell_get_default ();
manager = ephy_embed_shell_get_search_engine_manager (shell);
@@ -731,14 +718,10 @@ google_search_suggestions_query (EphySuggestionModel *self,
escaped_query = g_markup_escape_text (query, -1);
url = g_strdup_printf ("http://suggestqueries.google.com/complete/search?client=firefox&q=%s", escaped_query);
msg = soup_message_new (SOUP_METHOD_GET, url);
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_session_send_and_read_async (self->session, msg, G_PRIORITY_DEFAULT, NULL,
(GAsyncReadyCallback)google_search_suggestions_cb,
g_steal_pointer (&task));
g_object_unref (msg);
-#else
- soup_session_queue_message (self->session, g_steal_pointer (&msg), google_search_suggestions_cb, g_steal_pointer (&task));
-#endif
}
void
diff --git a/src/webextension/api/cookies.c b/src/webextension/api/cookies.c
index a3badb5e6..e3b50fe12 100644
--- a/src/webextension/api/cookies.c
+++ b/src/webextension/api/cookies.c
@@ -63,11 +63,7 @@ static void
add_cookie_to_json (JsonBuilder *builder,
SoupCookie *cookie)
{
-#if SOUP_CHECK_VERSION (2, 99, 4)
GDateTime *expires = soup_cookie_get_expires (cookie);
-#else
- SoupDate *expires = soup_cookie_get_expires (cookie);
-#endif
json_builder_begin_object (builder);
json_builder_set_member_name (builder, "name");
@@ -86,11 +82,7 @@ add_cookie_to_json (JsonBuilder *builder,
json_builder_add_string_value (builder, samesite_to_string (soup_cookie_get_same_site_policy (cookie)));
if (expires) {
json_builder_set_member_name (builder, "expirationDate");
-#if SOUP_CHECK_VERSION (2, 99, 4)
json_builder_add_int_value (builder, g_date_time_to_unix (expires));
-#else
- json_builder_add_int_value (builder, soup_date_to_time_t (expires));
-#endif
}
json_builder_end_object (builder);
}
diff --git a/tests/ephy-web-view-test.c b/tests/ephy-web-view-test.c
index 77526363e..662bc83c4 100644
--- a/tests/ephy-web-view-test.c
+++ b/tests/ephy-web-view-test.c
@@ -38,47 +38,24 @@
#define HTML_STRING "testing-ephy-web-view"
#define SERVER_PORT 12321
-#if SOUP_CHECK_VERSION (2, 99, 4)
static void
server_callback (SoupServer *server,
SoupServerMessage *msg,
const char *path,
GHashTable *query,
gpointer data)
-#else
-static void
-server_callback (SoupServer *server,
- SoupMessage *msg,
- const char *path,
- GHashTable *query,
- SoupClientContext *context,
- gpointer data)
-#endif
{
SoupMessageHeaders *response_headers;
SoupMessageBody *response_body;
-#if SOUP_CHECK_VERSION (2, 99, 4)
response_headers = soup_server_message_get_response_headers (msg);
response_body = soup_server_message_get_response_body (msg);
-#else
- response_headers = msg->response_headers;
- response_body = msg->response_body;
-#endif
if (!strcmp (path, "/redirect")) {
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_server_message_set_status (msg, SOUP_STATUS_MOVED_PERMANENTLY, NULL);
-#else
- soup_message_set_status (msg, SOUP_STATUS_MOVED_PERMANENTLY);
-#endif
soup_message_headers_append (response_headers, "Location", "/redirect-result");
} else {
-#if SOUP_CHECK_VERSION (2, 99, 4)
soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL);
-#else
- soup_message_set_status (msg, SOUP_STATUS_OK);
-#endif
}