[Gd-chatter] r11698 - trunk/libraries/network/koala/sources/koala
turbo24prg at gwydiondylan.org
turbo24prg at gwydiondylan.org
Sun Feb 24 01:24:28 CET 2008
Author: turbo24prg
Date: Sun Feb 24 01:24:27 2008
New Revision: 11698
Modified:
trunk/libraries/network/koala/sources/koala/dsp.dylan
trunk/libraries/network/koala/sources/koala/server.dylan
Log:
Job: koala
replace '+' with ' ' in query
Modified: trunk/libraries/network/koala/sources/koala/dsp.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/dsp.dylan (original)
+++ trunk/libraries/network/koala/sources/koala/dsp.dylan Sun Feb 24 01:24:27 2008
@@ -86,14 +86,16 @@
end;
end process-page;
-define open generic respond-to (request-method :: <symbol>, page :: <page>);
+define open generic respond-to
+ (request-method :: <symbol>, page :: <page>);
-define method respond-to (request-method :: one-of(#"get", #"post"), page :: <page>)
- process-template(page);
-end;
-
-define method respond-to (request-method :: <symbol>, page :: <page>)
- unsupported-request-method-error();
+define method respond-to
+ (request-method :: <symbol>, page :: <page>)
+ if (member?(request-method, #(#"get", #"post")))
+ process-template(page);
+ else
+ unsupported-request-method-error();
+ end if;
end;
// Applications should call this to register a page for a particular URL.
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 Sun Feb 24 01:24:27 2008
@@ -750,9 +750,11 @@
// By the time we get here request-query-values has already
// been bound to a <string-table> containing the URL query
// values. Now we augment it with any form values.
- for (value keyed-by key in split-query(query))
+ let parsed-query = split-query(query, replacements: list(pair("\\+", " ")));
+ for (value keyed-by key in parsed-query)
request.request-query-values[key] := value;
end for;
+ log-debug("Form query = %s", request.request-query-values);
request-content(request) := query;
// ---TODO: Deal with content types intelligently.
// For now this'll have to do.
@@ -903,17 +905,13 @@
//
let arguments = make(<stretchy-vector>);
for (group keyed-by name in match.groups-by-name)
- add!(arguments, as(<symbol>, name));
- add!(arguments, group.group-text);
+ if (group)
+ add!(arguments, as(<symbol>, name));
+ add!(arguments, group.group-text);
+ end if;
end for;
do(method (action)
- select (action by instance?)
- <function> => apply(action, arguments);
- <dylan-server-page> =>
- respond-to(request.request-method, action);
- otherwise =>
- log-warning("Unknown action %= in action sequence.", action);
- end select
+ invoke-action(request, action, arguments);
end, action-sequence);
else
resource-not-found-error(url: url);
@@ -927,8 +925,37 @@
send-response(response);
end method invoke-handler;
-//define class <action-sequence-error> (<error>)
-//end;
+
+define generic invoke-action
+ (request :: <request>,
+ action :: <object>,
+ arguments :: <sequence>)
+ => ();
+
+define method invoke-action
+ (request :: <request>,
+ action :: <object>,
+ arguments :: <sequence>)
+ => ()
+ log-warning("Unknown action %= in action sequence.", action);
+end;
+
+define method invoke-action
+ (request :: <request>,
+ action :: <dylan-server-page>,
+ arguments :: <sequence>)
+ => ()
+ respond-to(request.request-method, action);
+end;
+
+define method invoke-action
+ (request :: <request>,
+ action :: <function>,
+ arguments :: <sequence>)
+ => ()
+ apply(action, arguments)
+end;
+
// Read a line of input from the stream, dealing with CRLF correctly.
//
More information about the chatter
mailing list