diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-23 12:45:51 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-23 13:08:19 +0200 |
commit | 0ed8a2275a3a6cda553b82e9e0222b9d3b8b3ff2 (patch) | |
tree | 2b617611ddeb6f97d9f316750496ac13c5ce59ad /src/util.c | |
parent | b1824338b366e25756e4c64f04e535684529832d (diff) | |
download | eclat-0ed8a2275a3a6cda553b82e9e0222b9d3b8b3ff2.tar.gz eclat-0ed8a2275a3a6cda553b82e9e0222b9d3b8b3ff2.tar.bz2 |
Implement HTTP POST
* NEWS: Update.
* doc/eclat.conf.5: Document http-method. Reorganize description of
endpoints and regions.
* lib/libeclat.h (ec2_request) <postdata>: New member
(eclat_request_finalize): New proto.
* lib/req2url.c (eclat_request_to_url): Remove second argument.
All uses changed.
(eclat_request_finalize): New function.
* lib/reqfree.c: Free postdata.
* lib/reqsign.c (requestsign4): Implement post.
* src/config.c: New configuration statement http-method.
* src/eclat.c (use_post): New variable.
* src/eclat.h (use_post): New extern.
* src/util.c (eclat_send_request): Implement post.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -227,8 +227,15 @@ eclat_send_request(CURL *curl, struct ec2_request *req) struct curl_slist *headers = NULL; /* Prepare the request */ + if (req->flags & EC2_RF_POST) { + eclat_request_finalize(req); + curl_easy_setopt(curl, CURLOPT_POST, 1); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, req->postdata); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, + strlen(req->postdata)); + } eclat_request_sign(req, secret_key, signature_version); - url = eclat_request_to_url(req, NULL); + url = eclat_request_to_url(req); curl_easy_setopt(curl, CURLOPT_URL, url); debug(ECLAT_DEBCAT_MAIN, 1, ("using URL: %s", url)); free(url); @@ -263,6 +270,9 @@ eclat_send_request(CURL *curl, struct ec2_request *req) curl_easy_strerror(rc)); } + if (req->flags & EC2_RF_POST) + debug(ECLAT_DEBCAT_MAIN, 1, ("DATA: %s", req->postdata)); + if (dry_run_mode) debug(ECLAT_DEBCAT_MAIN, 1, ("not sending request")); else { |