25 #ifndef __OmWebRequest__
26 #define __OmWebRequest__
31 static void inplaceRequestDecode(
char *r)
40 if(c ==
'%' && r[0] && r[1])
55 static const int kRequestLengthMax = 320;
58 std::vector<char *> query;
59 char request[kRequestLengthMax + 1];
67 void init(
const char *request)
72 for(
int ix = 0; ix <= kRequestLengthMax; ix++)
74 char c = request[rIx++];
75 this->request[ix] = c;
81 this->request[kRequestLengthMax] = 0;
84 this->path = this->request;
88 char *w = this->request;
97 this->query.push_back(w + 1);
103 inplaceRequestDecode(this->request);
104 for(
char *r : this->query)
106 inplaceRequestDecode(r);
110 const char *getValue(
const char *key)
112 for(
int ix = 0; ix < (int)this->query.size() - 1; ix += 2)
114 if(omStringEqual(key, this->query[ix]))
115 return this->query[ix + 1];
122 int k = (int)this->query.size() / 2;
125 const char *getQueryKey(
int ix)
127 if(ix < 0 || ix >= this->getQueryCount())
129 return this->query[ix * 2];
131 const char *getQueryValue(
int ix)
133 if(ix < 0 || ix >= this->getQueryCount())
135 return this->query[ix * 2 + 1];