779 lines
35 KiB
Diff
779 lines
35 KiB
Diff
|
From 20cd11ee4974bb1690d523d5700492ad9c618688 Mon Sep 17 00:00:00 2001
|
||
|
From: Lubomir Rintel <lkundrak@v3.sk>
|
||
|
Date: Mon, 27 Feb 2023 00:09:40 +0100
|
||
|
Subject: [PATCH 3/6] cloud-setup: rename get/Get identifiers to req and Req
|
||
|
|
||
|
We're going to extend those to issue methods other than GET.
|
||
|
Also, "request" would've been too long, "req" looks nicer.
|
||
|
|
||
|
(cherry picked from commit 85ce088616aae3d61c9bc51eb395d1f59ed9a503)
|
||
|
(cherry picked from commit 6e8cfbae32e22ba75693146039b53b516a4147e1)
|
||
|
---
|
||
|
src/nm-cloud-setup/nm-http-client.c | 142 +++++++++++-----------
|
||
|
src/nm-cloud-setup/nm-http-client.h | 8 +-
|
||
|
src/nm-cloud-setup/nmcs-provider-aliyun.c | 20 +--
|
||
|
src/nm-cloud-setup/nmcs-provider-azure.c | 24 ++--
|
||
|
src/nm-cloud-setup/nmcs-provider-ec2.c | 14 +--
|
||
|
src/nm-cloud-setup/nmcs-provider-gcp.c | 20 +--
|
||
|
6 files changed, 114 insertions(+), 114 deletions(-)
|
||
|
|
||
|
diff --git a/src/nm-cloud-setup/nm-http-client.c b/src/nm-cloud-setup/nm-http-client.c
|
||
|
index e6cc20fa75..ed7914df8f 100644
|
||
|
--- a/src/nm-cloud-setup/nm-http-client.c
|
||
|
+++ b/src/nm-cloud-setup/nm-http-client.c
|
||
|
@@ -104,12 +104,12 @@ typedef struct {
|
||
|
} GetResult;
|
||
|
|
||
|
static void
|
||
|
-_get_result_free(gpointer data)
|
||
|
+_req_result_free(gpointer data)
|
||
|
{
|
||
|
- GetResult *get_result = data;
|
||
|
+ GetResult *req_result = data;
|
||
|
|
||
|
- g_bytes_unref(get_result->response_data);
|
||
|
- nm_g_slice_free(get_result);
|
||
|
+ g_bytes_unref(req_result->response_data);
|
||
|
+ nm_g_slice_free(req_result);
|
||
|
}
|
||
|
|
||
|
typedef struct {
|
||
|
@@ -154,7 +154,7 @@ _ehandle_free(EHandleData *edata)
|
||
|
static void
|
||
|
_ehandle_complete(EHandleData *edata, GError *error_take)
|
||
|
{
|
||
|
- GetResult *get_result;
|
||
|
+ GetResult *req_result;
|
||
|
gs_free char *str_tmp_1 = NULL;
|
||
|
long response_code = -1;
|
||
|
|
||
|
@@ -200,15 +200,15 @@ _ehandle_complete(EHandleData *edata, GError *error_take)
|
||
|
|
||
|
_ehandle_free_ehandle(edata);
|
||
|
|
||
|
- get_result = g_slice_new(GetResult);
|
||
|
- *get_result = (GetResult){
|
||
|
+ req_result = g_slice_new(GetResult);
|
||
|
+ *req_result = (GetResult){
|
||
|
.response_code = response_code,
|
||
|
/* This ensures that response_data is always NUL terminated. This is an important guarantee
|
||
|
* that NMHttpClient makes. */
|
||
|
.response_data = nm_str_buf_finalize_to_gbytes(&edata->recv_data),
|
||
|
};
|
||
|
|
||
|
- g_task_return_pointer(edata->task, get_result, _get_result_free);
|
||
|
+ g_task_return_pointer(edata->task, req_result, _req_result_free);
|
||
|
|
||
|
_ehandle_free(edata);
|
||
|
}
|
||
|
@@ -257,7 +257,7 @@ _get_cancelled_cb(GObject *object, gpointer user_data)
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
-nm_http_client_get(NMHttpClient *self,
|
||
|
+nm_http_client_req(NMHttpClient *self,
|
||
|
const char *url,
|
||
|
int timeout_msec,
|
||
|
gssize max_data,
|
||
|
@@ -280,7 +280,7 @@ nm_http_client_get(NMHttpClient *self,
|
||
|
|
||
|
edata = g_slice_new(EHandleData);
|
||
|
*edata = (EHandleData){
|
||
|
- .task = nm_g_task_new(self, cancellable, nm_http_client_get, callback, user_data),
|
||
|
+ .task = nm_g_task_new(self, cancellable, nm_http_client_req, callback, user_data),
|
||
|
.recv_data = NM_STR_BUF_INIT(0, FALSE),
|
||
|
.max_data = max_data,
|
||
|
.url = g_strdup(url),
|
||
|
@@ -352,7 +352,7 @@ nm_http_client_get(NMHttpClient *self,
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
- * nm_http_client_get_finish:
|
||
|
+ * nm_http_client_req_finish:
|
||
|
* @self: the #NMHttpClient instance
|
||
|
* @result: the #GAsyncResult which to complete.
|
||
|
* @out_response_code: (allow-none) (out): the HTTP response code or -1 on other error.
|
||
|
@@ -367,33 +367,33 @@ nm_http_client_get(NMHttpClient *self,
|
||
|
* Returns: %TRUE on success or %FALSE with an error code.
|
||
|
*/
|
||
|
static gboolean
|
||
|
-nm_http_client_get_finish(NMHttpClient *self,
|
||
|
+nm_http_client_req_finish(NMHttpClient *self,
|
||
|
GAsyncResult *result,
|
||
|
long *out_response_code,
|
||
|
GBytes **out_response_data,
|
||
|
GError **error)
|
||
|
{
|
||
|
- GetResult *get_result;
|
||
|
+ GetResult *req_result;
|
||
|
|
||
|
g_return_val_if_fail(NM_IS_HTTP_CLIENT(self), FALSE);
|
||
|
- g_return_val_if_fail(nm_g_task_is_valid(result, self, nm_http_client_get), FALSE);
|
||
|
+ g_return_val_if_fail(nm_g_task_is_valid(result, self, nm_http_client_req), FALSE);
|
||
|
|
||
|
- get_result = g_task_propagate_pointer(G_TASK(result), error);
|
||
|
+ req_result = g_task_propagate_pointer(G_TASK(result), error);
|
||
|
|
||
|
- nm_assert(!error || (!!get_result) == (!*error));
|
||
|
+ nm_assert(!error || (!!req_result) == (!*error));
|
||
|
|
||
|
- if (!get_result) {
|
||
|
+ if (!req_result) {
|
||
|
NM_SET_OUT(out_response_code, -1);
|
||
|
NM_SET_OUT(out_response_data, NULL);
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
- NM_SET_OUT(out_response_code, get_result->response_code);
|
||
|
+ NM_SET_OUT(out_response_code, req_result->response_code);
|
||
|
|
||
|
/* response_data is binary, but is also guaranteed to be NUL terminated! */
|
||
|
- NM_SET_OUT(out_response_data, g_steal_pointer(&get_result->response_data));
|
||
|
+ NM_SET_OUT(out_response_data, g_steal_pointer(&req_result->response_data));
|
||
|
|
||
|
- _get_result_free(get_result);
|
||
|
+ _req_result_free(req_result);
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
@@ -403,63 +403,63 @@ typedef struct {
|
||
|
GTask *task;
|
||
|
char *uri;
|
||
|
const char *const *http_headers;
|
||
|
- NMHttpClientPollGetCheckFcn check_fcn;
|
||
|
+ NMHttpClientPollReqCheckFcn check_fcn;
|
||
|
gpointer check_user_data;
|
||
|
GBytes *response_data;
|
||
|
gsize request_max_data;
|
||
|
long response_code;
|
||
|
int request_timeout_ms;
|
||
|
-} PollGetData;
|
||
|
+} PollReqData;
|
||
|
|
||
|
static void
|
||
|
-_poll_get_data_free(gpointer data)
|
||
|
+_poll_req_data_free(gpointer data)
|
||
|
{
|
||
|
- PollGetData *poll_get_data = data;
|
||
|
+ PollReqData *poll_req_data = data;
|
||
|
|
||
|
- g_free(poll_get_data->uri);
|
||
|
+ g_free(poll_req_data->uri);
|
||
|
|
||
|
- nm_clear_pointer(&poll_get_data->response_data, g_bytes_unref);
|
||
|
- g_free((gpointer) poll_get_data->http_headers);
|
||
|
+ nm_clear_pointer(&poll_req_data->response_data, g_bytes_unref);
|
||
|
+ g_free((gpointer) poll_req_data->http_headers);
|
||
|
|
||
|
- nm_g_slice_free(poll_get_data);
|
||
|
+ nm_g_slice_free(poll_req_data);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
-_poll_get_probe_start_fcn(GCancellable *cancellable,
|
||
|
+_poll_req_probe_start_fcn(GCancellable *cancellable,
|
||
|
gpointer probe_user_data,
|
||
|
GAsyncReadyCallback callback,
|
||
|
gpointer user_data)
|
||
|
{
|
||
|
- PollGetData *poll_get_data = probe_user_data;
|
||
|
+ PollReqData *poll_req_data = probe_user_data;
|
||
|
|
||
|
- /* balanced by _poll_get_probe_finish_fcn() */
|
||
|
- g_object_ref(poll_get_data->task);
|
||
|
+ /* balanced by _poll_req_probe_finish_fcn() */
|
||
|
+ g_object_ref(poll_req_data->task);
|
||
|
|
||
|
- nm_http_client_get(g_task_get_source_object(poll_get_data->task),
|
||
|
- poll_get_data->uri,
|
||
|
- poll_get_data->request_timeout_ms,
|
||
|
- poll_get_data->request_max_data,
|
||
|
- poll_get_data->http_headers,
|
||
|
+ nm_http_client_req(g_task_get_source_object(poll_req_data->task),
|
||
|
+ poll_req_data->uri,
|
||
|
+ poll_req_data->request_timeout_ms,
|
||
|
+ poll_req_data->request_max_data,
|
||
|
+ poll_req_data->http_headers,
|
||
|
cancellable,
|
||
|
callback,
|
||
|
user_data);
|
||
|
}
|
||
|
|
||
|
static gboolean
|
||
|
-_poll_get_probe_finish_fcn(GObject *source,
|
||
|
+_poll_req_probe_finish_fcn(GObject *source,
|
||
|
GAsyncResult *result,
|
||
|
gpointer probe_user_data,
|
||
|
GError **error)
|
||
|
{
|
||
|
- PollGetData *poll_get_data = probe_user_data;
|
||
|
+ PollReqData *poll_req_data = probe_user_data;
|
||
|
_nm_unused gs_unref_object GTask *task =
|
||
|
- poll_get_data->task; /* balance ref from _poll_get_probe_start_fcn() */
|
||
|
+ poll_req_data->task; /* balance ref from _poll_req_probe_start_fcn() */
|
||
|
gboolean success;
|
||
|
gs_free_error GError *local_error = NULL;
|
||
|
gs_unref_bytes GBytes *response_data = NULL;
|
||
|
long response_code = -1;
|
||
|
|
||
|
- success = nm_http_client_get_finish(g_task_get_source_object(poll_get_data->task),
|
||
|
+ success = nm_http_client_req_finish(g_task_get_source_object(poll_req_data->task),
|
||
|
result,
|
||
|
&response_code,
|
||
|
&response_data,
|
||
|
@@ -476,10 +476,10 @@ _poll_get_probe_finish_fcn(GObject *source,
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
- if (poll_get_data->check_fcn) {
|
||
|
- success = poll_get_data->check_fcn(response_code,
|
||
|
+ if (poll_req_data->check_fcn) {
|
||
|
+ success = poll_req_data->check_fcn(response_code,
|
||
|
response_data,
|
||
|
- poll_get_data->check_user_data,
|
||
|
+ poll_req_data->check_user_data,
|
||
|
&local_error);
|
||
|
} else
|
||
|
success = (response_code == 200);
|
||
|
@@ -494,15 +494,15 @@ _poll_get_probe_finish_fcn(GObject *source,
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
- poll_get_data->response_code = response_code;
|
||
|
- poll_get_data->response_data = g_steal_pointer(&response_data);
|
||
|
+ poll_req_data->response_code = response_code;
|
||
|
+ poll_req_data->response_data = g_steal_pointer(&response_data);
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
-_poll_get_done_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
+_poll_req_done_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
{
|
||
|
- PollGetData *poll_get_data = user_data;
|
||
|
+ PollReqData *poll_req_data = user_data;
|
||
|
gs_free_error GError *error = NULL;
|
||
|
gboolean success;
|
||
|
|
||
|
@@ -511,15 +511,15 @@ _poll_get_done_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
nm_assert((!!success) == (!error));
|
||
|
|
||
|
if (error)
|
||
|
- g_task_return_error(poll_get_data->task, g_steal_pointer(&error));
|
||
|
+ g_task_return_error(poll_req_data->task, g_steal_pointer(&error));
|
||
|
else
|
||
|
- g_task_return_boolean(poll_get_data->task, TRUE);
|
||
|
+ g_task_return_boolean(poll_req_data->task, TRUE);
|
||
|
|
||
|
- g_object_unref(poll_get_data->task);
|
||
|
+ g_object_unref(poll_req_data->task);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
-nm_http_client_poll_get(NMHttpClient *self,
|
||
|
+nm_http_client_poll_req(NMHttpClient *self,
|
||
|
const char *uri,
|
||
|
int request_timeout_ms,
|
||
|
gssize request_max_data,
|
||
|
@@ -527,13 +527,13 @@ nm_http_client_poll_get(NMHttpClient *self,
|
||
|
int ratelimit_timeout_ms,
|
||
|
const char *const *http_headers,
|
||
|
GCancellable *cancellable,
|
||
|
- NMHttpClientPollGetCheckFcn check_fcn,
|
||
|
+ NMHttpClientPollReqCheckFcn check_fcn,
|
||
|
gpointer check_user_data,
|
||
|
GAsyncReadyCallback callback,
|
||
|
gpointer user_data)
|
||
|
{
|
||
|
nm_auto_pop_gmaincontext GMainContext *context = NULL;
|
||
|
- PollGetData *poll_get_data;
|
||
|
+ PollReqData *poll_req_data;
|
||
|
|
||
|
g_return_if_fail(NM_IS_HTTP_CLIENT(self));
|
||
|
g_return_if_fail(uri && uri[0]);
|
||
|
@@ -543,9 +543,9 @@ nm_http_client_poll_get(NMHttpClient *self,
|
||
|
g_return_if_fail(ratelimit_timeout_ms >= -1);
|
||
|
g_return_if_fail(!cancellable || G_CANCELLABLE(cancellable));
|
||
|
|
||
|
- poll_get_data = g_slice_new(PollGetData);
|
||
|
- *poll_get_data = (PollGetData){
|
||
|
- .task = nm_g_task_new(self, cancellable, nm_http_client_poll_get, callback, user_data),
|
||
|
+ poll_req_data = g_slice_new(PollReqData);
|
||
|
+ *poll_req_data = (PollReqData){
|
||
|
+ .task = nm_g_task_new(self, cancellable, nm_http_client_poll_req, callback, user_data),
|
||
|
.uri = g_strdup(uri),
|
||
|
.request_timeout_ms = request_timeout_ms,
|
||
|
.request_max_data = request_max_data,
|
||
|
@@ -556,13 +556,13 @@ nm_http_client_poll_get(NMHttpClient *self,
|
||
|
};
|
||
|
|
||
|
if (http_headers) {
|
||
|
- poll_get_data->http_headers =
|
||
|
+ poll_req_data->http_headers =
|
||
|
nm_strv_dup_packed(http_headers, -1) ?: g_new(const char *, 1);
|
||
|
}
|
||
|
|
||
|
- nmcs_wait_for_objects_register(poll_get_data->task);
|
||
|
+ nmcs_wait_for_objects_register(poll_req_data->task);
|
||
|
|
||
|
- g_task_set_task_data(poll_get_data->task, poll_get_data, _poll_get_data_free);
|
||
|
+ g_task_set_task_data(poll_req_data->task, poll_req_data, _poll_req_data_free);
|
||
|
|
||
|
context =
|
||
|
nm_g_main_context_push_thread_default_if_necessary(nm_http_client_get_main_context(self));
|
||
|
@@ -570,28 +570,28 @@ nm_http_client_poll_get(NMHttpClient *self,
|
||
|
nmcs_utils_poll(poll_timeout_ms,
|
||
|
ratelimit_timeout_ms,
|
||
|
0,
|
||
|
- _poll_get_probe_start_fcn,
|
||
|
- _poll_get_probe_finish_fcn,
|
||
|
- poll_get_data,
|
||
|
+ _poll_req_probe_start_fcn,
|
||
|
+ _poll_req_probe_finish_fcn,
|
||
|
+ poll_req_data,
|
||
|
cancellable,
|
||
|
- _poll_get_done_cb,
|
||
|
- poll_get_data);
|
||
|
+ _poll_req_done_cb,
|
||
|
+ poll_req_data);
|
||
|
}
|
||
|
|
||
|
gboolean
|
||
|
-nm_http_client_poll_get_finish(NMHttpClient *self,
|
||
|
+nm_http_client_poll_req_finish(NMHttpClient *self,
|
||
|
GAsyncResult *result,
|
||
|
long *out_response_code,
|
||
|
GBytes **out_response_data,
|
||
|
GError **error)
|
||
|
{
|
||
|
- PollGetData *poll_get_data;
|
||
|
+ PollReqData *poll_req_data;
|
||
|
GTask *task;
|
||
|
gboolean success;
|
||
|
gs_free_error GError *local_error = NULL;
|
||
|
|
||
|
g_return_val_if_fail(NM_HTTP_CLIENT(self), FALSE);
|
||
|
- g_return_val_if_fail(nm_g_task_is_valid(result, self, nm_http_client_poll_get), FALSE);
|
||
|
+ g_return_val_if_fail(nm_g_task_is_valid(result, self, nm_http_client_poll_req), FALSE);
|
||
|
|
||
|
task = G_TASK(result);
|
||
|
|
||
|
@@ -606,10 +606,10 @@ nm_http_client_poll_get_finish(NMHttpClient *self,
|
||
|
return FALSE;
|
||
|
}
|
||
|
|
||
|
- poll_get_data = g_task_get_task_data(task);
|
||
|
+ poll_req_data = g_task_get_task_data(task);
|
||
|
|
||
|
- NM_SET_OUT(out_response_code, poll_get_data->response_code);
|
||
|
- NM_SET_OUT(out_response_data, g_steal_pointer(&poll_get_data->response_data));
|
||
|
+ NM_SET_OUT(out_response_code, poll_req_data->response_code);
|
||
|
+ NM_SET_OUT(out_response_data, g_steal_pointer(&poll_req_data->response_data));
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
diff --git a/src/nm-cloud-setup/nm-http-client.h b/src/nm-cloud-setup/nm-http-client.h
|
||
|
index 6cc08ba97c..c8d3ffb458 100644
|
||
|
--- a/src/nm-cloud-setup/nm-http-client.h
|
||
|
+++ b/src/nm-cloud-setup/nm-http-client.h
|
||
|
@@ -27,12 +27,12 @@ GMainContext *nm_http_client_get_main_context(NMHttpClient *self);
|
||
|
|
||
|
/*****************************************************************************/
|
||
|
|
||
|
-typedef gboolean (*NMHttpClientPollGetCheckFcn)(long response_code,
|
||
|
+typedef gboolean (*NMHttpClientPollReqCheckFcn)(long response_code,
|
||
|
GBytes *response_data,
|
||
|
gpointer check_user_data,
|
||
|
GError **error);
|
||
|
|
||
|
-void nm_http_client_poll_get(NMHttpClient *self,
|
||
|
+void nm_http_client_poll_req(NMHttpClient *self,
|
||
|
const char *uri,
|
||
|
int request_timeout_ms,
|
||
|
gssize request_max_data,
|
||
|
@@ -40,12 +40,12 @@ void nm_http_client_poll_get(NMHttpClient *self,
|
||
|
int ratelimit_timeout_ms,
|
||
|
const char *const *http_headers,
|
||
|
GCancellable *cancellable,
|
||
|
- NMHttpClientPollGetCheckFcn check_fcn,
|
||
|
+ NMHttpClientPollReqCheckFcn check_fcn,
|
||
|
gpointer check_user_data,
|
||
|
GAsyncReadyCallback callback,
|
||
|
gpointer user_data);
|
||
|
|
||
|
-gboolean nm_http_client_poll_get_finish(NMHttpClient *self,
|
||
|
+gboolean nm_http_client_poll_req_finish(NMHttpClient *self,
|
||
|
GAsyncResult *result,
|
||
|
long *out_response_code,
|
||
|
GBytes **out_response_data,
|
||
|
diff --git a/src/nm-cloud-setup/nmcs-provider-aliyun.c b/src/nm-cloud-setup/nmcs-provider-aliyun.c
|
||
|
index 34ab5ecc87..93f26e7505 100644
|
||
|
--- a/src/nm-cloud-setup/nmcs-provider-aliyun.c
|
||
|
+++ b/src/nm-cloud-setup/nmcs-provider-aliyun.c
|
||
|
@@ -77,7 +77,7 @@ _detect_get_meta_data_done_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
gs_free_error GError *get_error = NULL;
|
||
|
gs_free_error GError *error = NULL;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(get_error)) {
|
||
|
g_task_return_error(task, g_steal_pointer(&get_error));
|
||
|
@@ -104,7 +104,7 @@ detect(NMCSProvider *provider, GTask *task)
|
||
|
|
||
|
http_client = nmcs_provider_get_http_client(provider);
|
||
|
|
||
|
- nm_http_client_poll_get(http_client,
|
||
|
+ nm_http_client_poll_req(http_client,
|
||
|
(uri = _aliyun_uri_concat(NM_ALIYUN_API_VERSION "/meta-data/")),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
256 * 1024,
|
||
|
@@ -144,7 +144,7 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
|
||
|
gsize i;
|
||
|
gsize len;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(http_client, result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(http_client, result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -308,7 +308,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
GHashTableIter h_iter;
|
||
|
NMHttpClient *http_client;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -362,7 +362,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
v_mac_data->path);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
http_client,
|
||
|
(uri1 = _aliyun_uri_interfaces(v_mac_data->path,
|
||
|
NM_STR_HAS_SUFFIX(v_mac_data->path, "/") ? "" : "/",
|
||
|
@@ -379,7 +379,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
config_iface_data);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
http_client,
|
||
|
(uri2 = _aliyun_uri_interfaces(v_mac_data->path,
|
||
|
NM_STR_HAS_SUFFIX(v_mac_data->path, "/") ? "" : "/",
|
||
|
@@ -396,7 +396,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
config_iface_data);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
http_client,
|
||
|
(uri3 = _aliyun_uri_interfaces(v_mac_data->path,
|
||
|
NM_STR_HAS_SUFFIX(v_mac_data->path, "/") ? "" : "/",
|
||
|
@@ -413,7 +413,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
config_iface_data);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
http_client,
|
||
|
(uri4 = _aliyun_uri_interfaces(v_mac_data->path,
|
||
|
NM_STR_HAS_SUFFIX(v_mac_data->path, "/") ? "" : "/",
|
||
|
@@ -430,7 +430,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
config_iface_data);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
http_client,
|
||
|
(uri5 = _aliyun_uri_interfaces(v_mac_data->path,
|
||
|
NM_STR_HAS_SUFFIX(v_mac_data->path, "/") ? "" : "/",
|
||
|
@@ -530,7 +530,7 @@ get_config(NMCSProvider *provider, NMCSProviderGetConfigTaskData *get_config_dat
|
||
|
* MAC addresses, then we poll until we see them. They might not yet be
|
||
|
* around from the start...
|
||
|
*/
|
||
|
- nm_http_client_poll_get(nmcs_provider_get_http_client(provider),
|
||
|
+ nm_http_client_poll_req(nmcs_provider_get_http_client(provider),
|
||
|
(uri = _aliyun_uri_interfaces()),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
256 * 1024,
|
||
|
diff --git a/src/nm-cloud-setup/nmcs-provider-azure.c b/src/nm-cloud-setup/nmcs-provider-azure.c
|
||
|
index 9b27af288a..b1f48f5c18 100644
|
||
|
--- a/src/nm-cloud-setup/nmcs-provider-azure.c
|
||
|
+++ b/src/nm-cloud-setup/nmcs-provider-azure.c
|
||
|
@@ -42,7 +42,7 @@ _detect_get_meta_data_done_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
gs_free_error GError *get_error = NULL;
|
||
|
gs_free_error GError *error = NULL;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(get_error)) {
|
||
|
g_task_return_error(task, g_steal_pointer(&get_error));
|
||
|
@@ -69,7 +69,7 @@ detect(NMCSProvider *provider, GTask *task)
|
||
|
|
||
|
http_client = nmcs_provider_get_http_client(provider);
|
||
|
|
||
|
- nm_http_client_poll_get(http_client,
|
||
|
+ nm_http_client_poll_req(http_client,
|
||
|
(uri = _azure_uri_concat("/metadata/instance")),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
256 * 1024,
|
||
|
@@ -121,7 +121,7 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
|
||
|
in_addr_t tmp_addr;
|
||
|
int tmp_prefix = -1;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(http_client, result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(http_client, result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -241,7 +241,7 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
|
||
|
gsize line_len;
|
||
|
char iface_idx_str[30];
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -283,7 +283,7 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
|
||
|
|
||
|
iface_data->n_iface_data_pending++;
|
||
|
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
NM_HTTP_CLIENT(source),
|
||
|
(uri = _azure_uri_interfaces(iface_idx_str,
|
||
|
"/ipv4/ipAddress/",
|
||
|
@@ -308,7 +308,7 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
|
||
|
gs_free char *uri = NULL;
|
||
|
|
||
|
iface_data->n_iface_data_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
NM_HTTP_CLIENT(source),
|
||
|
(uri = _azure_uri_interfaces(iface_idx_str, "/ipv4/subnet/0/address/")),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
@@ -325,7 +325,7 @@ _get_config_ips_prefix_list_cb(GObject *source, GAsyncResult *result, gpointer u
|
||
|
nm_clear_g_free(&uri);
|
||
|
|
||
|
iface_data->n_iface_data_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
NM_HTTP_CLIENT(source),
|
||
|
(uri = _azure_uri_interfaces(iface_idx_str, "/ipv4/subnet/0/prefix/")),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
@@ -357,7 +357,7 @@ _get_config_iface_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
gs_free const char *uri = NULL;
|
||
|
char buf[100];
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -408,7 +408,7 @@ _get_config_iface_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
|
||
|
nm_sprintf_buf(buf, "%" G_GSSIZE_FORMAT "/ipv4/ipAddress/", iface_data->intern_iface_idx);
|
||
|
|
||
|
- nm_http_client_poll_get(NM_HTTP_CLIENT(source),
|
||
|
+ nm_http_client_poll_req(NM_HTTP_CLIENT(source),
|
||
|
(uri = _azure_uri_interfaces(buf)),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
512 * 1024,
|
||
|
@@ -441,7 +441,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
|
||
|
guint i;
|
||
|
gssize extern_iface_idx_cnt = 0;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -508,7 +508,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
|
||
|
nm_sprintf_buf(buf, "%" G_GSSIZE_FORMAT "/macAddress", iface_data->intern_iface_idx);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(NM_HTTP_CLIENT(source),
|
||
|
+ nm_http_client_poll_req(NM_HTTP_CLIENT(source),
|
||
|
(uri = _azure_uri_interfaces(buf)),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
512 * 1024,
|
||
|
@@ -531,7 +531,7 @@ get_config(NMCSProvider *provider, NMCSProviderGetConfigTaskData *get_config_dat
|
||
|
{
|
||
|
gs_free const char *uri = NULL;
|
||
|
|
||
|
- nm_http_client_poll_get(nmcs_provider_get_http_client(provider),
|
||
|
+ nm_http_client_poll_req(nmcs_provider_get_http_client(provider),
|
||
|
(uri = _azure_uri_interfaces()),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
256 * 1024,
|
||
|
diff --git a/src/nm-cloud-setup/nmcs-provider-ec2.c b/src/nm-cloud-setup/nmcs-provider-ec2.c
|
||
|
index d6fa03118d..35f7176c4d 100644
|
||
|
--- a/src/nm-cloud-setup/nmcs-provider-ec2.c
|
||
|
+++ b/src/nm-cloud-setup/nmcs-provider-ec2.c
|
||
|
@@ -72,7 +72,7 @@ _detect_get_meta_data_done_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
gs_free_error GError *get_error = NULL;
|
||
|
gs_free_error GError *error = NULL;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(get_error)) {
|
||
|
g_task_return_error(task, g_steal_pointer(&get_error));
|
||
|
@@ -99,7 +99,7 @@ detect(NMCSProvider *provider, GTask *task)
|
||
|
|
||
|
http_client = nmcs_provider_get_http_client(provider);
|
||
|
|
||
|
- nm_http_client_poll_get(http_client,
|
||
|
+ nm_http_client_poll_req(http_client,
|
||
|
(uri = _ec2_uri_concat("latest/meta-data/")),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
256 * 1024,
|
||
|
@@ -126,7 +126,7 @@ _get_config_fetch_done_cb(NMHttpClient *http_client,
|
||
|
in_addr_t tmp_addr;
|
||
|
int tmp_prefix;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(http_client, result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(http_client, result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -204,7 +204,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
GHashTableIter h_iter;
|
||
|
NMHttpClient *http_client;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -254,7 +254,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
v_mac_data->path);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
http_client,
|
||
|
(uri1 = _ec2_uri_interfaces(v_mac_data->path,
|
||
|
NM_STR_HAS_SUFFIX(v_mac_data->path, "/") ? "" : "/",
|
||
|
@@ -271,7 +271,7 @@ _get_config_metadata_ready_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
config_iface_data);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(
|
||
|
+ nm_http_client_poll_req(
|
||
|
http_client,
|
||
|
(uri2 = _ec2_uri_interfaces(v_mac_data->path,
|
||
|
NM_STR_HAS_SUFFIX(v_mac_data->path, "/") ? "" : "/",
|
||
|
@@ -371,7 +371,7 @@ get_config(NMCSProvider *provider, NMCSProviderGetConfigTaskData *get_config_dat
|
||
|
* MAC addresses, then we poll until we see them. They might not yet be
|
||
|
* around from the start...
|
||
|
*/
|
||
|
- nm_http_client_poll_get(nmcs_provider_get_http_client(provider),
|
||
|
+ nm_http_client_poll_req(nmcs_provider_get_http_client(provider),
|
||
|
(uri = _ec2_uri_interfaces()),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
256 * 1024,
|
||
|
diff --git a/src/nm-cloud-setup/nmcs-provider-gcp.c b/src/nm-cloud-setup/nmcs-provider-gcp.c
|
||
|
index a325f31a17..571c0fb826 100644
|
||
|
--- a/src/nm-cloud-setup/nmcs-provider-gcp.c
|
||
|
+++ b/src/nm-cloud-setup/nmcs-provider-gcp.c
|
||
|
@@ -45,7 +45,7 @@ _detect_get_meta_data_done_cb(GObject *source, GAsyncResult *result, gpointer us
|
||
|
gs_free_error GError *get_error = NULL;
|
||
|
gs_free_error GError *error = NULL;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, NULL, &get_error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(get_error)) {
|
||
|
g_task_return_error(task, g_steal_pointer(&get_error));
|
||
|
@@ -72,7 +72,7 @@ detect(NMCSProvider *provider, GTask *task)
|
||
|
|
||
|
http_client = nmcs_provider_get_http_client(provider);
|
||
|
|
||
|
- nm_http_client_poll_get(http_client,
|
||
|
+ nm_http_client_poll_req(http_client,
|
||
|
(uri = _gcp_uri_concat("id")),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
256 * 1024,
|
||
|
@@ -114,7 +114,7 @@ _get_config_fip_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
NMIPRoute **routes_arr;
|
||
|
NMIPRoute *route_new;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -171,7 +171,7 @@ _get_config_ips_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
|
||
|
gsize line_len;
|
||
|
guint i;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -220,7 +220,7 @@ _get_config_ips_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
|
||
|
const char *str = uri_arr->pdata[i];
|
||
|
gs_free const char *uri = NULL;
|
||
|
|
||
|
- nm_http_client_poll_get(NM_HTTP_CLIENT(source),
|
||
|
+ nm_http_client_poll_req(NM_HTTP_CLIENT(source),
|
||
|
(uri = _gcp_uri_interfaces(str)),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
HTTP_REQ_MAX_DATA,
|
||
|
@@ -252,7 +252,7 @@ _get_config_iface_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
NMCSProviderGetConfigTaskData *get_config_data;
|
||
|
gboolean is_requested;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -306,7 +306,7 @@ _get_config_iface_cb(GObject *source, GAsyncResult *result, gpointer user_data)
|
||
|
|
||
|
nm_sprintf_buf(sbuf, "%" G_GSSIZE_FORMAT "/forwarded-ips/", iface_data->intern_iface_idx);
|
||
|
|
||
|
- nm_http_client_poll_get(NM_HTTP_CLIENT(source),
|
||
|
+ nm_http_client_poll_req(NM_HTTP_CLIENT(source),
|
||
|
(uri = _gcp_uri_interfaces(sbuf)),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
HTTP_REQ_MAX_DATA,
|
||
|
@@ -339,7 +339,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
|
||
|
guint i;
|
||
|
gssize extern_iface_idx_cnt = 0;
|
||
|
|
||
|
- nm_http_client_poll_get_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
+ nm_http_client_poll_req_finish(NM_HTTP_CLIENT(source), result, NULL, &response, &error);
|
||
|
|
||
|
if (nm_utils_error_is_cancelled(error))
|
||
|
return;
|
||
|
@@ -405,7 +405,7 @@ _get_net_ifaces_list_cb(GObject *source, GAsyncResult *result, gpointer user_dat
|
||
|
nm_sprintf_buf(sbuf, "%" G_GSSIZE_FORMAT "/mac", data->intern_iface_idx);
|
||
|
|
||
|
get_config_data->n_pending++;
|
||
|
- nm_http_client_poll_get(NM_HTTP_CLIENT(source),
|
||
|
+ nm_http_client_poll_req(NM_HTTP_CLIENT(source),
|
||
|
(uri = _gcp_uri_interfaces(sbuf)),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
HTTP_REQ_MAX_DATA,
|
||
|
@@ -428,7 +428,7 @@ get_config(NMCSProvider *provider, NMCSProviderGetConfigTaskData *get_config_dat
|
||
|
{
|
||
|
gs_free const char *uri = NULL;
|
||
|
|
||
|
- nm_http_client_poll_get(nmcs_provider_get_http_client(provider),
|
||
|
+ nm_http_client_poll_req(nmcs_provider_get_http_client(provider),
|
||
|
(uri = _gcp_uri_interfaces()),
|
||
|
HTTP_TIMEOUT_MS,
|
||
|
HTTP_REQ_MAX_DATA,
|
||
|
--
|
||
|
2.39.2
|
||
|
|