mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-28 20:20:34 +01:00
cloud-setup: make nm_http_client_req() accept a method argument
We'll need to be able to issue PUT calls. Conflicts: code formatting, missing nmcs-provider-aliyun, azure and gcp. Missing commit494819bbbf("cloud-setup: move common code for get_config() to base class and improve cancellation") (cherry picked from commitcd74d75002) (cherry picked from commiteff4372045) (cherry picked from commitaaf66e9174) (cherry picked from commit3d94f4fdf9) (cherry picked from commit181466c6da) (cherry picked from commit7243307bb8) (cherry picked from commit1aa88024cb) (cherry picked from commit59b5a8fdcb) (cherry picked from commit0962b6e23d) (cherry picked from commitb31caa6d6a) (cherry picked from commit10ff5f0957)
This commit is contained in:
parent
b512f77a01
commit
eef7c66762
3 changed files with 12 additions and 0 deletions
|
|
@ -265,6 +265,7 @@ nm_http_client_req (NMHttpClient *self,
|
|||
int timeout_msec,
|
||||
gssize max_data,
|
||||
const char *const *http_headers,
|
||||
const char * http_method,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
|
|
@ -326,6 +327,9 @@ nm_http_client_req (NMHttpClient *self,
|
|||
curl_easy_setopt (edata->ehandle, CURLOPT_HTTPHEADER, edata->headers);
|
||||
}
|
||||
|
||||
if (http_method)
|
||||
curl_easy_setopt(edata->ehandle, CURLOPT_CUSTOMREQUEST, http_method);
|
||||
|
||||
if (timeout_msec > 0) {
|
||||
edata->timeout_source = _source_attach (self,
|
||||
nm_g_timeout_source_new (timeout_msec,
|
||||
|
|
@ -387,6 +391,7 @@ typedef struct {
|
|||
GTask *task;
|
||||
char *uri;
|
||||
const char *const *http_headers;
|
||||
const char *http_method;
|
||||
NMHttpClientPollReqCheckFcn check_fcn;
|
||||
gpointer check_user_data;
|
||||
GBytes *response_data;
|
||||
|
|
@ -424,6 +429,7 @@ _poll_req_probe_start_fcn (GCancellable *cancellable,
|
|||
poll_req_data->request_timeout_ms,
|
||||
poll_req_data->request_max_data,
|
||||
poll_req_data->http_headers,
|
||||
poll_req_data->http_method,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
|
|
@ -504,6 +510,7 @@ nm_http_client_poll_req (NMHttpClient *self,
|
|||
int poll_timeout_ms,
|
||||
int ratelimit_timeout_ms,
|
||||
const char *const *http_headers,
|
||||
const char *http_method,
|
||||
GCancellable *cancellable,
|
||||
NMHttpClientPollReqCheckFcn check_fcn,
|
||||
gpointer check_user_data,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ void nm_http_client_poll_req (NMHttpClient *self,
|
|||
int poll_timeout_ms,
|
||||
int ratelimit_timeout_ms,
|
||||
const char *const *http_headers,
|
||||
const char *http_method,
|
||||
GCancellable *cancellable,
|
||||
NMHttpClientPollReqCheckFcn check_fcn,
|
||||
gpointer check_user_data,
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ detect (NMCSProvider *provider,
|
|||
7000,
|
||||
1000,
|
||||
NULL,
|
||||
NULL,
|
||||
g_task_get_cancellable (task),
|
||||
_detect_get_meta_data_check_cb,
|
||||
NULL,
|
||||
|
|
@ -398,6 +399,7 @@ _get_config_metadata_ready_cb (GObject *source,
|
|||
10000,
|
||||
1000,
|
||||
NULL,
|
||||
NULL,
|
||||
iface_data->cancellable,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
@ -416,6 +418,7 @@ _get_config_metadata_ready_cb (GObject *source,
|
|||
10000,
|
||||
1000,
|
||||
NULL,
|
||||
NULL,
|
||||
iface_data->cancellable,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
@ -533,6 +536,7 @@ get_config (NMCSProvider *provider,
|
|||
15000,
|
||||
1000,
|
||||
NULL,
|
||||
NULL,
|
||||
g_task_get_cancellable (get_config_data->task),
|
||||
_get_config_metadata_ready_check,
|
||||
metadata_data,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue