aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2015-01-23 12:45:51 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2015-01-23 13:08:19 +0200
commit0ed8a2275a3a6cda553b82e9e0222b9d3b8b3ff2 (patch)
tree2b617611ddeb6f97d9f316750496ac13c5ce59ad /src/config.c
parentb1824338b366e25756e4c64f04e535684529832d (diff)
downloadeclat-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/config.c')
-rw-r--r--src/config.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index 548b11a..49b47f9 100644
--- a/src/config.c
+++ b/src/config.c
@@ -296,8 +296,8 @@ cb_authentication_provider(enum grecs_callback_command cmd,
}
if (strcmp(type, "file") == 0) {
- if (arg) {
- grecs_error(locus, 0, "requered argument missing");
+ if (!arg) {
+ grecs_error(locus, 0, "required argument missing");
return 1;
}
authentication_provider = authp_file;
@@ -337,6 +337,29 @@ cb_access_file(enum grecs_callback_command cmd,
*(char**)varptr = grecs_strdup(value->v.string);
return 0;
}
+
+static int
+cb_http_method(enum grecs_callback_command cmd,
+ grecs_locus_t *locus,
+ void *varptr,
+ grecs_value_t *value,
+ void *cb_data)
+{
+ if (cmd != grecs_callback_set_value) {
+ grecs_error(locus, 0, "Unexpected block statement");
+ return 1;
+ }
+ if (!value || value->type != GRECS_TYPE_STRING) {
+ grecs_error(locus, 0, "expected string value");
+ return 1;
+ }
+ if (strcasecmp(value->v.string, "post") == 0)
+ use_post = 1;
+ else if (strcasecmp(value->v.string, "get"))
+ grecs_error(&value->locus, 0, "invalid http method");
+ return 0;
+}
+
static struct grecs_keyword instance_store_kw[] = {
{ "base-url", "URL",
@@ -387,6 +410,9 @@ static struct grecs_keyword eclat_kw[] = {
grecs_type_section, GRECS_DFLT,
NULL, 0,
cb_ssl, NULL, ssl_kw },
+ { "http-method", "arg: post|get",
+ "Define HTTP method to use",
+ grecs_type_string, GRECS_DFLT, NULL, 0, cb_http_method },
{ "format", "<command: string> <format: string>",
"Set default format for <command>",
grecs_type_string, GRECS_MULT, NULL, 0, cb_format },
@@ -465,6 +491,9 @@ config_finish(struct grecs_node *tree)
exit(EX_CONFIG);
if (grecs_error_count || run_config_finish_hooks())
exit(EX_CONFIG);
+
+ if (use_post)
+ signature_version = "4";
}

Return to:

Send suggestions and report system problems to the System administrator.