#include <stdlib.h>
#include <string.h>
+//#define STRICT_FORMVAR 0
+
void CGIForm::parseURLEncoded (const ustring& query) {
ustring::size_type s, e, t;
uiterator ib, ie;
int CGIForm::insert (map_t& mp, const ustring& name, const ustring& value) {
int ans = -1;
- if (checkName (name)) {
- map_t::iterator it = mp.find (name);
- std::vector<int>* v;
-
- if (it == mp.end ()) {
- v = insertName (mp, name);
- } else {
- v = &index.at (it->second);
- }
- if (v) {
- ans = values.size ();
- values.push_back (value);
- v->push_back (ans);
+#ifdef STRICT_FORMVAR
+ if (checkName (name))
+#else
+ if (name.length () > 0 && name.length () < 64)
+#endif
+ {
+ map_t::iterator it = mp.find (name);
+ std::vector<int>* v;
+
+ if (it == mp.end ()) {
+ v = insertName (mp, name);
+ } else {
+ v = &index.at (it->second);
+ }
+ if (v) {
+ ans = values.size ();
+ values.push_back (value);
+ v->push_back (ans);
+ }
}
- }
return ans;
}