summaryrefslogtreecommitdiffabout
path: root/src
authorMichael Krelin <hacker@klever.net>2005-10-24 21:13:21 (UTC)
committer Michael Krelin <hacker@klever.net>2005-10-24 21:13:21 (UTC)
commit03b321d88a199c6390eb8ce51ac4b1a96b3535dd (patch) (unidiff)
treedb45823c37b204ec0d8028b26fede362b62cf4ac /src
parentdb69589bdc32c60b1fce6700a35d4126058bf7bc (diff)
downloadkingate-03b321d88a199c6390eb8ce51ac4b1a96b3535dd.zip
kingate-03b321d88a199c6390eb8ce51ac4b1a96b3535dd.tar.gz
kingate-03b321d88a199c6390eb8ce51ac4b1a96b3535dd.tar.bz2
fixed compilation withouth mimetic support
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/cgi_gateway.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cgi_gateway.cc b/src/cgi_gateway.cc
index 1706679..a2681aa 100644
--- a/src/cgi_gateway.cc
+++ b/src/cgi_gateway.cc
@@ -1,351 +1,352 @@
1#include <errno.h> 1#include <errno.h>
2#include <ctype.h> 2#include <ctype.h>
3#include <sstream> 3#include <sstream>
4#include "kingate/cgi_gateway.h" 4#include "kingate/cgi_gateway.h"
5#include "kingate/util.h" 5#include "kingate/util.h"
6#include "kingate/exception.h" 6#include "kingate/exception.h"
7#include "config.h" 7#include "config.h"
8#ifdef HAVE_MIMETIC 8#ifdef HAVE_MIMETIC
9# include <mimetic/mimeentity.h> 9# include <mimetic/mimeentity.h>
10# include <mimetic/parser/itparser.h> 10# include <mimetic/parser/itparser.h>
11#endif /* HAVE_MIMETIC */ 11#endif /* HAVE_MIMETIC */
12 12
13namespace kingate { 13namespace kingate {
14 using mimetic::MimeEntity;
15 14
16#ifdef HAVE_MIMETIC 15#ifdef HAVE_MIMETIC
16 using mimetic::MimeEntity;
17
17 struct TornMimeEntity : public MimeEntity { 18 struct TornMimeEntity : public MimeEntity {
18 typedef istreambuf_iterator<char> it_type; 19 typedef istreambuf_iterator<char> it_type;
19 typedef it_type::iterator_category it_cat; 20 typedef it_type::iterator_category it_cat;
20 struct IParser : public mimetic::IteratorParser<it_type,it_cat> { 21 struct IParser : public mimetic::IteratorParser<it_type,it_cat> {
21 typedef mimetic::IteratorParser<it_type,it_cat> BT; 22 typedef mimetic::IteratorParser<it_type,it_cat> BT;
22 IParser(MimeEntity& me) 23 IParser(MimeEntity& me)
23 : BT::IteratorParser<it_type,it_cat>(me) { } 24 : BT::IteratorParser<it_type,it_cat>(me) { }
24 void loadHeader(it_type bit,it_type eit) { 25 void loadHeader(it_type bit,it_type eit) {
25 m_bit = bit; m_eit = eit; 26 m_bit = bit; m_eit = eit;
26 BT::loadHeader(); 27 BT::loadHeader();
27 } 28 }
28 void loadBody(it_type bit,it_type eit) { 29 void loadBody(it_type bit,it_type eit) {
29 m_bit = bit; m_eit = eit; 30 m_bit = bit; m_eit = eit;
30 BT::loadBody(); 31 BT::loadBody();
31 } 32 }
32 }; 33 };
33 void load(istream& hs,istream& bs,int mask=0) { 34 void load(istream& hs,istream& bs,int mask=0) {
34 IParser prs(*this); 35 IParser prs(*this);
35 prs.iMask(mask); 36 prs.iMask(mask);
36 prs.loadHeader(it_type(hs),it_type()); 37 prs.loadHeader(it_type(hs),it_type());
37 prs.loadBody(it_type(bs),it_type()); 38 prs.loadBody(it_type(bs),it_type());
38 } 39 }
39 }; 40 };
40#endif /* HAVE_MIMETIC */ 41#endif /* HAVE_MIMETIC */
41 42
42 static string empty_string; 43 static string empty_string;
43 44
44 cgi_gateway::basic_file_t::~basic_file_t() { } 45 cgi_gateway::basic_file_t::~basic_file_t() { }
45 46
46 class string_file_t : public cgi_gateway::basic_file_t { 47 class string_file_t : public cgi_gateway::basic_file_t {
47 public: 48 public:
48 string _file_name; 49 string _file_name;
49 string _content_type; 50 string _content_type;
50 stringstream _content; 51 stringstream _content;
51 52
52 string_file_t(const string& fn,const string& ct,const string& s) 53 string_file_t(const string& fn,const string& ct,const string& s)
53 : _file_name(fn), _content_type(ct), _content(s,ios::in) { } 54 : _file_name(fn), _content_type(ct), _content(s,ios::in) { }
54 const string& filename() const { return _file_name; } 55 const string& filename() const { return _file_name; }
55 const string& content_type() const { return _content_type; } 56 const string& content_type() const { return _content_type; }
56 istream& content() { return _content; } 57 istream& content() { return _content; }
57 }; 58 };
58 59
59 cgi_gateway::cgi_gateway(cgi_interface& ci,bool parsebody) 60 cgi_gateway::cgi_gateway(cgi_interface& ci,bool parsebody)
60 : iface(ci), b_parsed_content(false) { 61 : iface(ci), b_parsed_content(false) {
61 // Fetch GET content 62 // Fetch GET content
62 try { 63 try {
63 string qs = get_meta("QUERY_STRING"); 64 string qs = get_meta("QUERY_STRING");
64 parse_query(qs,get); 65 parse_query(qs,get);
65 }catch(exception_notfound& enf) { } 66 }catch(exception_notfound& enf) { }
66 if(parsebody) 67 if(parsebody)
67 parse_request_body(); 68 parse_request_body();
68 // Parse cookies 69 // Parse cookies
69 try { 70 try {
70 cookies.parse_cookies(get_meta("HTTP_COOKIE")); 71 cookies.parse_cookies(get_meta("HTTP_COOKIE"));
71 }catch(exception_notfound& enf) { } 72 }catch(exception_notfound& enf) { }
72 } 73 }
73 74
74 cgi_gateway::~cgi_gateway() throw() { 75 cgi_gateway::~cgi_gateway() throw() {
75 for(files_t::iterator i=files.begin();i!=files.end();++i) 76 for(files_t::iterator i=files.begin();i!=files.end();++i)
76 delete i->second; 77 delete i->second;
77 files.clear(); 78 files.clear();
78 } 79 }
79 80
80 void cgi_gateway::parse_request_body() { 81 void cgi_gateway::parse_request_body() {
81 if(b_parsed_content) 82 if(b_parsed_content)
82 throw konforka::exception(CODEPOINT,"request body is already parsed"); 83 throw konforka::exception(CODEPOINT,"request body is already parsed");
83 // Fetch POST content 84 // Fetch POST content
84 if(!strncasecmp( 85 if(!strncasecmp(
85 content_type().c_str(), 86 content_type().c_str(),
86 "application/x-www-form-urlencoded", 87 "application/x-www-form-urlencoded",
87 sizeof("application/x-www-form-urlencoded")-1) ) { 88 sizeof("application/x-www-form-urlencoded")-1) ) {
88 unsigned long cl = content_length(); 89 unsigned long cl = content_length();
89 if(cl) { 90 if(cl) {
90 char * tmp = new char[cl]; 91 char * tmp = new char[cl];
91 iface.in().read(tmp,cl); 92 iface.in().read(tmp,cl);
92 string qs(tmp,cl); 93 string qs(tmp,cl);
93 delete tmp; 94 delete tmp;
94 parse_query(qs,post); 95 parse_query(qs,post);
95 } 96 }
96 b_parsed_content = true; 97 b_parsed_content = true;
97 } 98 }
98#ifdef HAVE_MIMETIC 99#ifdef HAVE_MIMETIC
99 else if(!strncasecmp( 100 else if(!strncasecmp(
100 content_type().c_str(), 101 content_type().c_str(),
101 "multipart/form-data", 102 "multipart/form-data",
102 sizeof("multipart/form-data")-1) ) { 103 sizeof("multipart/form-data")-1) ) {
103 stringstream h; 104 stringstream h;
104 h 105 h
105 << "Content-Type: " << content_type() << "\r\n" 106 << "Content-Type: " << content_type() << "\r\n"
106 << "Content-Length: " << content_length() << "\r\n\n"; 107 << "Content-Length: " << content_length() << "\r\n\n";
107 TornMimeEntity me; 108 TornMimeEntity me;
108 me.load(h,iface.in(),0); 109 me.load(h,iface.in(),0);
109 mimetic::MimeEntityList& parts = me.body().parts(); 110 mimetic::MimeEntityList& parts = me.body().parts();
110 for(mimetic::MimeEntityList::iterator i=parts.begin();i!=parts.end();++i) { 111 for(mimetic::MimeEntityList::iterator i=parts.begin();i!=parts.end();++i) {
111 MimeEntity *p = *i; 112 MimeEntity *p = *i;
112 const mimetic::ContentDisposition& cd = p->header().contentDisposition(); 113 const mimetic::ContentDisposition& cd = p->header().contentDisposition();
113 string n = cd.param("name"); 114 string n = cd.param("name");
114 string fn = cd.param("filename"); 115 string fn = cd.param("filename");
115 if(fn.empty()) { 116 if(fn.empty()) {
116 post.insert(params_t::value_type(n,p->body())); 117 post.insert(params_t::value_type(n,p->body()));
117 }else{ 118 }else{
118 const mimetic::ContentType& ct = p->header().contentType(); 119 const mimetic::ContentType& ct = p->header().contentType();
119 files.insert(files_t::value_type(n,new string_file_t(fn,ct.str(),p->body()))); 120 files.insert(files_t::value_type(n,new string_file_t(fn,ct.str(),p->body())));
120 } 121 }
121 } 122 }
122 b_parsed_content = true; 123 b_parsed_content = true;
123 } 124 }
124#endif /* HAVE_MIMETIC */ 125#endif /* HAVE_MIMETIC */
125 } 126 }
126 127
127 bool cgi_gateway::has_GET(const string& n) const { 128 bool cgi_gateway::has_GET(const string& n) const {
128 return get.find(n) != get.end(); 129 return get.find(n) != get.end();
129 } 130 }
130 const string& cgi_gateway::get_GET(const string& n) const { 131 const string& cgi_gateway::get_GET(const string& n) const {
131 params_t::const_iterator i = get.find(n); 132 params_t::const_iterator i = get.find(n);
132 if(i==get.end()) 133 if(i==get.end())
133 throw exception_notfound(CODEPOINT,"no such parameter"); 134 throw exception_notfound(CODEPOINT,"no such parameter");
134 return i->second; 135 return i->second;
135 } 136 }
136 bool cgi_gateway::has_POST(const string& n) const { 137 bool cgi_gateway::has_POST(const string& n) const {
137 return post.find(n) != post.end(); 138 return post.find(n) != post.end();
138 } 139 }
139 const string& cgi_gateway::get_POST(const string& n) const { 140 const string& cgi_gateway::get_POST(const string& n) const {
140 params_t::const_iterator i = post.find(n); 141 params_t::const_iterator i = post.find(n);
141 if(i==post.end()) 142 if(i==post.end())
142 throw exception_notfound(CODEPOINT,"no such parameter"); 143 throw exception_notfound(CODEPOINT,"no such parameter");
143 return i->second; 144 return i->second;
144 } 145 }
145 bool cgi_gateway::has_param(const string& n) const { 146 bool cgi_gateway::has_param(const string& n) const {
146 return has_GET(n) || has_POST(n); 147 return has_GET(n) || has_POST(n);
147 } 148 }
148 const string& cgi_gateway::get_param(const string& n) const { 149 const string& cgi_gateway::get_param(const string& n) const {
149 params_t::const_iterator i = get.find(n); 150 params_t::const_iterator i = get.find(n);
150 if(i!=get.end()) 151 if(i!=get.end())
151 return i->second; 152 return i->second;
152 i = post.find(n); 153 i = post.find(n);
153 if(i!=post.end()) 154 if(i!=post.end())
154 return i->second; 155 return i->second;
155 throw exception_notfound(CODEPOINT,"no such parameter"); 156 throw exception_notfound(CODEPOINT,"no such parameter");
156 } 157 }
157 bool cgi_gateway::has_file(const string& n) const { 158 bool cgi_gateway::has_file(const string& n) const {
158 return files.find(n) != files.end(); 159 return files.find(n) != files.end();
159 } 160 }
160 const cgi_gateway::file_t cgi_gateway::get_file(const string& n) const { 161 const cgi_gateway::file_t cgi_gateway::get_file(const string& n) const {
161 files_t::const_iterator i = files.find(n); 162 files_t::const_iterator i = files.find(n);
162 if(i==files.end()) 163 if(i==files.end())
163 throw exception_notfound(CODEPOINT,"no such parameter"); 164 throw exception_notfound(CODEPOINT,"no such parameter");
164 return i->second; 165 return i->second;
165 } 166 }
166 cgi_gateway::file_t cgi_gateway::get_file(const string& n) { 167 cgi_gateway::file_t cgi_gateway::get_file(const string& n) {
167 files_t::const_iterator i = files.find(n); 168 files_t::const_iterator i = files.find(n);
168 if(i==files.end()) 169 if(i==files.end())
169 throw exception_notfound(CODEPOINT,"no such parameter"); 170 throw exception_notfound(CODEPOINT,"no such parameter");
170 return i->second; 171 return i->second;
171 } 172 }
172 173
173 /* 174 /*
174 * deprecated stuff. 175 * deprecated stuff.
175 */ 176 */
176 const string& cgi_gateway::get_content_type() const { 177 const string& cgi_gateway::get_content_type() const {
177 if(!has_meta("CONTENT_TYPE")) 178 if(!has_meta("CONTENT_TYPE"))
178 return empty_string; 179 return empty_string;
179 return get_meta("CONTENT_TYPE"); 180 return get_meta("CONTENT_TYPE");
180 } 181 }
181 unsigned long cgi_gateway::get_content_length() const { 182 unsigned long cgi_gateway::get_content_length() const {
182 if(!has_meta("CONTENT_LENGTH")) 183 if(!has_meta("CONTENT_LENGTH"))
183 return 0; 184 return 0;
184 string cl = get_meta("CONTENT_LENGTH"); 185 string cl = get_meta("CONTENT_LENGTH");
185 return strtol(cl.c_str(),NULL,10); 186 return strtol(cl.c_str(),NULL,10);
186 } 187 }
187 /* 188 /*
188 * 189 *
189 */ 190 */
190 191
191 const string& cgi_gateway::http_request_header(const string& hn) const { 192 const string& cgi_gateway::http_request_header(const string& hn) const {
192 string mvn = "HTTP_"; 193 string mvn = "HTTP_";
193 for(const char* p=hn.c_str();*p;p++) { 194 for(const char* p=hn.c_str();*p;p++) {
194 if(*p=='-') 195 if(*p=='-')
195 mvn += '_'; 196 mvn += '_';
196 else 197 else
197 mvn += toupper(*p); 198 mvn += toupper(*p);
198 } 199 }
199 return get_meta(mvn); 200 return get_meta(mvn);
200 } 201 }
201 202
202 const string& cgi_gateway::auth_type() const { 203 const string& cgi_gateway::auth_type() const {
203 try { 204 try {
204 return get_meta("AUTH_TYPE"); 205 return get_meta("AUTH_TYPE");
205 }catch(exception_notfound& enf) { 206 }catch(exception_notfound& enf) {
206 return empty_string; 207 return empty_string;
207 } 208 }
208 } 209 }
209 unsigned long cgi_gateway::content_length() const { 210 unsigned long cgi_gateway::content_length() const {
210 try { 211 try {
211 const string& cl = get_meta("CONTENT_LENGTH"); 212 const string& cl = get_meta("CONTENT_LENGTH");
212 errno = 0; 213 errno = 0;
213 const char *clp = cl.c_str(); 214 const char *clp = cl.c_str();
214 unsigned long rv = strtol(clp,(char**)&clp,10); 215 unsigned long rv = strtol(clp,(char**)&clp,10);
215 if(errno || *clp) 216 if(errno || *clp)
216 throw server_error(CODEPOINT,"Invalid CONTENT_LENGTH value passed from server"); 217 throw server_error(CODEPOINT,"Invalid CONTENT_LENGTH value passed from server");
217 return rv; 218 return rv;
218 }catch(exception_notfound& enf) { 219 }catch(exception_notfound& enf) {
219 return 0; 220 return 0;
220 } 221 }
221 } 222 }
222 const string& cgi_gateway::content_type() const { 223 const string& cgi_gateway::content_type() const {
223 try { 224 try {
224 return get_meta("CONTENT_TYPE"); 225 return get_meta("CONTENT_TYPE");
225 }catch(exception_notfound& enf) { 226 }catch(exception_notfound& enf) {
226 return empty_string; 227 return empty_string;
227 } 228 }
228 } 229 }
229 const string& cgi_gateway::gateway_interface() const { 230 const string& cgi_gateway::gateway_interface() const {
230 try { 231 try {
231 return get_meta("GATEWAY_INTERFACE"); 232 return get_meta("GATEWAY_INTERFACE");
232 }catch(exception_notfound& enf) { 233 }catch(exception_notfound& enf) {
233 return empty_string; 234 return empty_string;
234 } 235 }
235 } 236 }
236 const string& cgi_gateway::path_info() const { 237 const string& cgi_gateway::path_info() const {
237 try { 238 try {
238 return get_meta("PATH_INFO"); 239 return get_meta("PATH_INFO");
239 }catch(exception_notfound& enf) { 240 }catch(exception_notfound& enf) {
240 return empty_string; 241 return empty_string;
241 } 242 }
242 } 243 }
243 const string& cgi_gateway::path_translated() const { 244 const string& cgi_gateway::path_translated() const {
244 try { 245 try {
245 return get_meta("PATH_TRANSLATED"); 246 return get_meta("PATH_TRANSLATED");
246 }catch(exception_notfound& enf) { 247 }catch(exception_notfound& enf) {
247 return empty_string; 248 return empty_string;
248 } 249 }
249 } 250 }
250 const string& cgi_gateway::query_string() const { 251 const string& cgi_gateway::query_string() const {
251 try { 252 try {
252 return get_meta("QUERY_STRING"); 253 return get_meta("QUERY_STRING");
253 }catch(exception_notfound& enf) { 254 }catch(exception_notfound& enf) {
254 return empty_string; 255 return empty_string;
255 } 256 }
256 } 257 }
257 const string& cgi_gateway::remote_addr() const { 258 const string& cgi_gateway::remote_addr() const {
258 try { 259 try {
259 return get_meta("REMOTE_ADDR"); 260 return get_meta("REMOTE_ADDR");
260 }catch(exception_notfound& enf) { 261 }catch(exception_notfound& enf) {
261 return empty_string; 262 return empty_string;
262 } 263 }
263 } 264 }
264 const string& cgi_gateway::remote_host() const { 265 const string& cgi_gateway::remote_host() const {
265 try { 266 try {
266 return get_meta("REMOTE_HOST"); 267 return get_meta("REMOTE_HOST");
267 }catch(exception_notfound& enf) { 268 }catch(exception_notfound& enf) {
268 return remote_addr(); 269 return remote_addr();
269 } 270 }
270 } 271 }
271 const string& cgi_gateway::remote_ident() const { 272 const string& cgi_gateway::remote_ident() const {
272 try { 273 try {
273 return get_meta("REMOTE_IDENT"); 274 return get_meta("REMOTE_IDENT");
274 }catch(exception_notfound& enf) { 275 }catch(exception_notfound& enf) {
275 return empty_string; 276 return empty_string;
276 } 277 }
277 } 278 }
278 const string& cgi_gateway::remote_user() const { 279 const string& cgi_gateway::remote_user() const {
279 try { 280 try {
280 return get_meta("REMOTE_USER"); 281 return get_meta("REMOTE_USER");
281 }catch(exception_notfound& enf) { 282 }catch(exception_notfound& enf) {
282 return empty_string; 283 return empty_string;
283 } 284 }
284 } 285 }
285 const string& cgi_gateway::request_method() const { 286 const string& cgi_gateway::request_method() const {
286 try { 287 try {
287 return get_meta("REQUEST_METHOD"); 288 return get_meta("REQUEST_METHOD");
288 }catch(exception_notfound& enf) { 289 }catch(exception_notfound& enf) {
289 throw server_error(CODEPOINT,"No REQUEST_METHOD passed from server"); 290 throw server_error(CODEPOINT,"No REQUEST_METHOD passed from server");
290 } 291 }
291 } 292 }
292 const string& cgi_gateway::script_name() const { 293 const string& cgi_gateway::script_name() const {
293 try { 294 try {
294 return get_meta("SCRIPT_NAME"); 295 return get_meta("SCRIPT_NAME");
295 }catch(exception_notfound& enf) { 296 }catch(exception_notfound& enf) {
296 throw server_error(CODEPOINT,"No SCRIPT_NAME passed from server"); 297 throw server_error(CODEPOINT,"No SCRIPT_NAME passed from server");
297 } 298 }
298 } 299 }
299 const string& cgi_gateway::server_name() const { 300 const string& cgi_gateway::server_name() const {
300 try { 301 try {
301 return get_meta("SERVER_NAME"); 302 return get_meta("SERVER_NAME");
302 }catch(exception_notfound& enf) { 303 }catch(exception_notfound& enf) {
303 throw server_error(CODEPOINT,"No SERVER_NAME passed from server"); 304 throw server_error(CODEPOINT,"No SERVER_NAME passed from server");
304 } 305 }
305 } 306 }
306 unsigned int cgi_gateway::server_port() const { 307 unsigned int cgi_gateway::server_port() const {
307 try { 308 try {
308 const string& sp = get_meta("SERVER_PORT"); 309 const string& sp = get_meta("SERVER_PORT");
309 errno = 0; 310 errno = 0;
310 const char *spp = sp.c_str(); 311 const char *spp = sp.c_str();
311 unsigned int rv = strtol(spp,(char**)&spp,10); 312 unsigned int rv = strtol(spp,(char**)&spp,10);
312 if(errno || *spp) 313 if(errno || *spp)
313 throw server_error(CODEPOINT,"Invalid SERVER_PORT value passed from server"); 314 throw server_error(CODEPOINT,"Invalid SERVER_PORT value passed from server");
314 return rv; 315 return rv;
315 }catch(exception_notfound& enf) { 316 }catch(exception_notfound& enf) {
316 throw server_error(CODEPOINT,"No SERVER_PORT passed from server"); 317 throw server_error(CODEPOINT,"No SERVER_PORT passed from server");
317 } 318 }
318 } 319 }
319 const string& cgi_gateway::server_protocol() const { 320 const string& cgi_gateway::server_protocol() const {
320 try { 321 try {
321 return get_meta("SERVER_PROTOCOL"); 322 return get_meta("SERVER_PROTOCOL");
322 }catch(exception_notfound& enf) { 323 }catch(exception_notfound& enf) {
323 throw server_error(CODEPOINT,"No SERVER_PROTOCOL passed from server"); 324 throw server_error(CODEPOINT,"No SERVER_PROTOCOL passed from server");
324 } 325 }
325 } 326 }
326 const string& cgi_gateway::server_software() const { 327 const string& cgi_gateway::server_software() const {
327 try { 328 try {
328 return get_meta("SERVER_SOFTWARE"); 329 return get_meta("SERVER_SOFTWARE");
329 }catch(exception_notfound& enf) { 330 }catch(exception_notfound& enf) {
330 throw server_error(CODEPOINT,"No SERVER_SOFTWARE passed from server"); 331 throw server_error(CODEPOINT,"No SERVER_SOFTWARE passed from server");
331 } 332 }
332 } 333 }
333 334
334 void cgi_gateway::parse_query(string& q,params_t& p) { 335 void cgi_gateway::parse_query(string& q,params_t& p) {
335 while(!q.empty()) { 336 while(!q.empty()) {
336 string::size_type amp = q.find('&'); 337 string::size_type amp = q.find('&');
337 string pp = (amp==string::npos)?q:q.substr(0,amp); 338 string pp = (amp==string::npos)?q:q.substr(0,amp);
338 if(amp==string::npos) 339 if(amp==string::npos)
339 q.clear(); 340 q.clear();
340 else 341 else
341 q.erase(0,amp+1); 342 q.erase(0,amp+1);
342 string::size_type eq = pp.find('='); 343 string::size_type eq = pp.find('=');
343 if(eq == string::npos) { 344 if(eq == string::npos) {
344 p.insert(params_t::value_type("",url_decode(pp))); 345 p.insert(params_t::value_type("",url_decode(pp)));
345 }else{ 346 }else{
346 p.insert(params_t::value_type(url_decode(pp.substr(0,eq)),url_decode(pp.substr(eq+1)))); 347 p.insert(params_t::value_type(url_decode(pp.substr(0,eq)),url_decode(pp.substr(eq+1))));
347 } 348 }
348 } 349 }
349 } 350 }
350 351
351} 352}