summaryrefslogtreecommitdiffabout
path: root/src/util.cc
Side-by-side diff
Diffstat (limited to 'src/util.cc') (more/less context) (show whitespace changes)
-rw-r--r--src/util.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index 48e486a..76e684f 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -1,24 +1,25 @@
+#include <cstring>
#include "kingate/util.h"
#include "kingate/exception.h"
namespace kingate {
static const char *safeChars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"_-" ;
string url_encode(const string& str) {
string rv = str;
string::size_type screwed = 0;
for(;;) {
screwed = rv.find_first_not_of(safeChars,screwed);
if(screwed == string::npos)
break;
while(screwed<rv.length() && !strchr(safeChars,rv.at(screwed))) {
char danger = rv.at(screwed);
if(danger==' ') {
rv.replace(screwed++,1,1,'+');
}else{
static char tmp[4] = {'%',0,0,0};