summaryrefslogtreecommitdiffabout
path: root/lib/params.cc
blob: 6805516df7f7c7783fdd507b5499a3f39a11af02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <opkele/types.h>
#include <opkele/exception.h>
#include <opkele/util.h>
#include <openssl/sha.h>
#include <openssl/hmac.h>

#include "config.h"

namespace opkele {
    using namespace std;

    string params_t::append_query(const string& url,const char *prefix) const {
	string rv = url;
	bool p = true;
	if(rv.find('?')==string::npos) {
	    rv += '?'; p = false; }
	for(fields_iterator i=fields_begin();i!=fields_end();++i) {
	    if(p)
		rv += '&';
	    else
		p = true;
	    if(prefix) rv += prefix;
	    rv += *i;
	    rv += '=';
	    rv += util::url_encode(get_field(*i));
	}
	return rv;
    }

}