Changeset 607
- Timestamp:
- 1999-09-21T23:30:39+12:00 (25 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/cgiutils.cpp
r533 r607 28 28 /* 29 29 $Log$ 30 Revision 1.9 1999/09/21 11:30:39 sjboddie 31 added ability to escape out '-' in saved args (currently 32 with a 'Z' ???) 33 30 34 Revision 1.8 1999/09/07 04:56:53 sjboddie 31 35 added GPL notice … … 144 148 145 149 // convert %xx and + to their appropriate equivalents 146 decode_cgi_arg (value); 150 if (key != "e") decode_cgi_arg (value); 151 147 152 value.setencoding(1); // other encoding 148 153 // store this key=value pair 149 154 if (!key.empty()) args.setarg (key, value, cgiarg_t::cgi_arg); 150 155 } 156 } 157 158 text_t minus_safe (const text_t &intext) { 159 160 text_t outtext; 161 162 text_t::const_iterator here = intext.begin (); 163 text_t::const_iterator end = intext.end (); 164 165 while (here != end) { 166 if (*here == '-') outtext += "Z-"; 167 else outtext.push_back (*here); 168 here ++; 169 } 170 return outtext; 151 171 } 152 172 … … 164 184 ((c >= 'A') && (c <= 'Z')) || 165 185 ((c >= '0') && (c <= '9')) || 166 (c == ' -') || (c == '+')) {186 (c == '+') || (c == '%')) { 167 187 // alphanumeric character 168 188 outtext.push_back(c); … … 189 209 text_t::const_iterator last, 190 210 text_t &argname) { 211 text_t::const_iterator sav = first; 191 212 first = getdelimitstr (first, last, '-', argname); 192 213 return first; … … 330 351 // found the argument information 331 352 if (argnameinfo->multiplechar) { 353 text_t::const_iterator sav = arg_ehere; 332 354 arg_ehere = getdelimitstr (arg_ehere, arg_eend, '-', argvalue); 355 // replace any '-' chars escaped with 'Z' 356 if (*(arg_ehere-2) == 'Z') { 357 argvalue.clear(); 358 arg_ehere = (findchar (arg_ehere, arg_eend, '-')) + 1; 359 while (sav != (arg_ehere-1)) { 360 if (!((*sav == 'Z') && (*(sav+1) == '-'))) argvalue.push_back (*sav); 361 sav ++; 362 } 363 } 364 333 365 argvalue.setencoding(1); // other encoding 334 366 if (!argvalue.empty()) args.setdefaultarg (argname, argvalue, cgiarg_t::compressed_arg); … … 404 436 // found the argument information 405 437 if (argnameinfo->multiplechar) { 406 // multiple character argument -- make sure it is cgi safe407 compressed_args += cgi_safe (outconvert.convert(args[argname]));438 // multiple character argument -- sort out any '-' chars 439 compressed_args += minus_safe (outconvert.convert(args[argname])); 408 440 if (saveconfhere != saveconfend) compressed_args.push_back ('-'); 409 441 -
trunk/gsdl/src/recpt/cgiutils.h
r533 r607 40 40 // split up the cgi arguments 41 41 void split_cgi_args (text_t argstr, cgiargsclass &args); 42 43 // turns any '-' in a cgi argument into "(-)" 44 text_t minus_safe (const text_t &intext); 42 45 43 46 // returns the encoded version of a cgi argument
Note:
See TracChangeset
for help on using the changeset viewer.