diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-22 23:59:22 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-23 00:03:33 +0200 |
commit | b1824338b366e25756e4c64f04e535684529832d (patch) | |
tree | 2dcbf32e0b4fb06b1c4b0a992db882ba184bbd18 /lib/q2url.c | |
parent | 2beaaadb282bd4667e3af1ed65e3944960d1bd3e (diff) | |
download | eclat-b1824338b366e25756e4c64f04e535684529832d.tar.gz eclat-b1824338b366e25756e4c64f04e535684529832d.tar.bz2 |
Namespace fixup: use "request" consistently
Diffstat (limited to 'lib/q2url.c')
-rw-r--r-- | lib/q2url.c | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/lib/q2url.c b/lib/q2url.c deleted file mode 100644 index 6404f33..0000000 --- a/lib/q2url.c +++ /dev/null @@ -1,84 +0,0 @@ -/* This file is part of Eclat. - Copyright (C) 2012-2015 Sergey Poznyakoff. - - Eclat is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - Eclat is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ - -#include <config.h> -#include <string.h> -#include "libeclat.h" -#include "grecs.h" - -struct param_closure { - struct grecs_txtacc *acc; - int count; -}; - -static int -add_param(void *sym, void *data) -{ - struct ec2_param *p = sym; - struct param_closure *pc = data; - - if (pc->count) - grecs_txtacc_grow_char(pc->acc, '&'); - ++pc->count; - grecs_txtacc_grow_string(pc->acc, p->name); - if (p->value) { - grecs_txtacc_grow_char(pc->acc, '='); - grecs_txtacc_grow_string(pc->acc, p->value); - } - - return 0; -} - -char * -eclat_query_to_url(struct ec2_query *req, char **post_params) -{ - struct grecs_txtacc *acc; - char *ret = NULL, *p; - struct param_closure pc; - - acc = grecs_txtacc_create(); - - grecs_txtacc_grow(acc, "http", 4); - if (req->flags & EC2_QF_HTTPS) - grecs_txtacc_grow_char(acc, 's'); - grecs_txtacc_grow(acc, "://", 3); - grecs_txtacc_grow(acc, req->endpoint, strlen(req->endpoint)); - grecs_txtacc_grow(acc, req->uri, strlen(req->uri)); - - if (req->flags & EC2_QF_POST) { - grecs_txtacc_grow_char(acc, 0); - ret = grecs_txtacc_finish(acc, 1); - } else { - grecs_txtacc_grow_char(acc, '?'); - } - - /* Add other parameters */ - pc.acc = acc; - pc.count = 0; - grecs_symtab_enumerate(req->params, add_param, &pc); - - grecs_txtacc_grow_char(acc, 0); - - if (!ret) - ret = grecs_txtacc_finish(acc, 1); - else - *post_params = grecs_txtacc_finish(acc, 1); - - grecs_txtacc_free(acc); - - return ret; -} - |