[Gd-chatter] r11200 - trunk/libraries/network/koala/sources/koala

turbo24prg at gwydiondylan.org turbo24prg at gwydiondylan.org
Wed Feb 21 20:51:09 CET 2007


Author: turbo24prg
Date: Wed Feb 21 20:51:07 2007
New Revision: 11200

Modified:
   trunk/libraries/network/koala/sources/koala/library-unix.dylan
   trunk/libraries/network/koala/sources/koala/library.dylan
   trunk/libraries/network/koala/sources/koala/server.dylan
Log:
Job: koala
 - make request's content-type available


Modified: trunk/libraries/network/koala/sources/koala/library-unix.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/library-unix.dylan	(original)
+++ trunk/libraries/network/koala/sources/koala/library-unix.dylan	Wed Feb 21 20:51:07 2007
@@ -277,6 +277,11 @@
     koala-main,
     *argument-list-parser*;
 
+  create request-content,
+    request-content-type,
+    request-content-setter,
+    process-request-content;
+
 end module koala;
 
 // Additional interface for extending the server

Modified: trunk/libraries/network/koala/sources/koala/library.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/library.dylan	(original)
+++ trunk/libraries/network/koala/sources/koala/library.dylan	Wed Feb 21 20:51:07 2007
@@ -263,11 +263,25 @@
   create
     static-file-responder;
 
+  create <avalue>,
+    avalue-value,
+    avalue-alist;
+
+  create <http-file>,
+    http-file-filename,
+    http-file-content,
+    http-file-mime-type;
+
   // main() function
   create
     koala-main,
     *argument-list-parser*;
 
+  create request-content,
+    request-content-type,
+    request-content-setter,
+    process-request-content;
+
 end module koala;
 
 // Additional interface for extending the server

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	Wed Feb 21 20:51:07 2007
@@ -702,13 +702,16 @@
     let n = kludge-read-into!(request-socket(request), content-length, buffer);
     assert(n == content-length, "Unexpected incomplete read");
     request-content(request)
-      := process-request-content(as(<symbol>,
-                                    first(split(get-header(request, "content-type"),
-                                                separator: ";"))),
-                                 request, buffer, content-length);
+      := process-request-content(request-content-type(request), buffer, content-length);
   end
 end read-request-content;
 
+define inline function request-content-type (request :: <request>)
+  let content-type-header = get-header(request, "content-type");
+  as(<symbol>, if (content-type-header)
+      first(split(content-type-header, separator: ";"))
+    else "" end if)
+end;
 
 // Gary, in the trunk sources (1) below should now be fixed.  (read was passing the
 // wrong arguments to next-method).



More information about the chatter mailing list