summaryrefslogtreecommitdiffabout
path: root/src/util.cc
authorMichael Krelin <hacker@klever.net>2020-10-07 22:52:19 (UTC)
committer Michael Krelin <hacker@klever.net>2020-10-07 22:52:19 (UTC)
commitc561689bf162fb22997bd88f4392f222f151c950 (patch) (unidiff)
treece4656e92c379f7089f4bb72a4b10d781b61211e /src/util.cc
parent3a4530372bc95d728dbddbac788f2c1f2d03a030 (diff)
downloadkingate-c561689bf162fb22997bd88f4392f222f151c950.zip
kingate-c561689bf162fb22997bd88f4392f222f151c950.tar.gz
kingate-c561689bf162fb22997bd88f4392f222f151c950.tar.bz2
missing includesHEADmaster
Diffstat (limited to 'src/util.cc') (more/less context) (ignore 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 @@
1#include <cstring>
1#include "kingate/util.h" 2#include "kingate/util.h"
2#include "kingate/exception.h" 3#include "kingate/exception.h"
3 4
4namespace kingate { 5namespace kingate {
5 6
6 static const char *safeChars = 7 static const char *safeChars =
7 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 8 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
8 "abcdefghijklmnopqrstuvwxyz" 9 "abcdefghijklmnopqrstuvwxyz"
9 "0123456789" 10 "0123456789"
10 "_-" ; 11 "_-" ;
11 12
12 string url_encode(const string& str) { 13 string url_encode(const string& str) {
13 string rv = str; 14 string rv = str;
14 string::size_type screwed = 0; 15 string::size_type screwed = 0;
15 for(;;) { 16 for(;;) {
16 screwed = rv.find_first_not_of(safeChars,screwed); 17 screwed = rv.find_first_not_of(safeChars,screwed);
17 if(screwed == string::npos) 18 if(screwed == string::npos)
18 break; 19 break;
19 while(screwed<rv.length() && !strchr(safeChars,rv.at(screwed))) { 20 while(screwed<rv.length() && !strchr(safeChars,rv.at(screwed))) {
20 char danger = rv.at(screwed); 21 char danger = rv.at(screwed);
21 if(danger==' ') { 22 if(danger==' ') {
22 rv.replace(screwed++,1,1,'+'); 23 rv.replace(screwed++,1,1,'+');
23 }else{ 24 }else{
24 static char tmp[4] = {'%',0,0,0}; 25 static char tmp[4] = {'%',0,0,0};