[Gd-chatter] r11493 - trunk/libraries/network/koala/sources/koala
hannes at gwydiondylan.org
hannes at gwydiondylan.org
Sat Nov 17 03:33:32 CET 2007
Author: hannes
Date: Sat Nov 17 03:33:31 2007
New Revision: 11493
Modified:
trunk/libraries/network/koala/sources/koala/headers.dylan
trunk/libraries/network/koala/sources/koala/server.dylan
Log:
Job: koala
add support for multiple selection forms
Modified: trunk/libraries/network/koala/sources/koala/headers.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/headers.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/headers.dylan Sat Nov 17 03:33:31 2007
@@ -13,7 +13,9 @@
// Make it largish though, since cookies come in via a header
define variable *max-single-header-size* :: false-or(<integer>) = 16384;
-// Grow header buffer by this much
+// Grow header buffer by this much -- is this chosen arbitrary? is there
+// any reasoning behing the 1024? I'd expect a bigger number to lower the
+// amount of copying the whole header around -- Hannes 16.11.2007
define variable *header-buffer-growth-amount* :: limited(<integer>, min: 1) = 1024;
// Max size of data in a POST.
Modified: trunk/libraries/network/koala/sources/koala/server.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/server.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/server.dylan Sat Nov 17 03:33:31 2007
@@ -1113,12 +1113,30 @@
values(decode-url(buffer, beg, fin), #t)
end if;
end;
+ method insert-key/val (key :: <string>, val :: <string>)
+ let hashtable-value = element(queries, key, default: #f);
+ if (hashtable-value)
+ //for multiple selection option boxes, arguments are passed this way:
+ // "foo=2&foo=3&foo=4", that's why we first do a lookup in the hash-table
+ // and generate a <stretchy-vector> on the fly -- hannes, 17.11.2007
+ if (instance?(hashtable-value, <string>))
+ let vec = make(<stretchy-vector>);
+ add!(vec, hashtable-value);
+ add!(vec, val);
+ queries[key] := vec;
+ else
+ add!(hashtable-value, val);
+ end;
+ else
+ queries[key] := val;
+ end;
+ end;
iterate loop (start :: <integer> = bpos)
when (start < epos)
let _end = char-position('&', buffer, start, epos) | epos;
let (key, val) = extract-key/val(start, _end);
when (key & val)
- queries[key] := val;
+ insert-key/val(key, val);
end;
loop(_end + 1);
end;
More information about the chatter
mailing list