Port template fixes for SBCL

"Chun Tian (binghe)" <[email protected]> Tue, 21 Jun 2011 11:10:12 +0800
Newsgroups gmane.lisp.cl-http
Message-ID <[email protected]>
--Apple-Mail-26--393869008
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi, CL-HTTP

This is another small patch, for CL-HTTP on SBCL:

It's in contrib/kpoeck/port-template/allegro/tcpip.lisp, the function =
%whatever-to-hostname has been enhanced to support "vector ip address", =
i.e. #(127 0 0 1), used by SBCL networking API.

By using this patch, it's possible to call HTTP:SET-STANDARD-HTTP-PORT =
to set the running ports on SBCL, but it's not quite useful at this =
time, because port-template use functions in "simple-server.lisp" to =
start HTTP daemons, where the actual HTTP port is set up by the default =
keyword parameter of START-SERVING.

--binghe


--Apple-Mail-26--393869008
Content-Disposition: attachment;
	filename=cl-http-sbcl.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="cl-http-sbcl.patch"
Content-Transfer-Encoding: 7bit

Index: contrib/kpoeck/port-template/allegro/tcpip.lisp
===================================================================
--- contrib/kpoeck/port-template/allegro/tcpip.lisp	(revision 72)
+++ contrib/kpoeck/port-template/allegro/tcpip.lisp	(revision 73)
@@ -276,17 +276,20 @@
 |#
 
 (defun %whatever-to-hostname (host)
-  (if (integerp host)
-      (if (%resolve-hostnames)
-          (%ipaddr-to-hostname host)
-        (%dummy-hostname))
-    (if (http:ip-address-string-p host)
-        (if (%resolve-hostnames)
-            (%ipaddr-to-hostname (%dotted-to-ipaddr host))
-          host)
-      host)))
+  (cond ((integerp host)
+         (if (%resolve-hostnames)
+             (%ipaddr-to-hostname host)
+           (%dummy-hostname)))
+        ((vector-ip-adress-p host)
+         (%whatever-to-hostname
+           (format nil "~D.~D.~D.~D"
+                   (aref host 0) (aref host 1) (aref host 2) (aref host 3))))
+        ((http:ip-address-string-p host)
+         (if (%resolve-hostnames)
+             (%ipaddr-to-hostname (%dotted-to-ipaddr host))
+           host))
+        (t host)))
 
-
 ;;; borrowed from jkf
 (defun note-hostname (given-host)
   ;; we are starting cl-http and the user has specied that host

--Apple-Mail-26--393869008
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
WWW-CL mailing list
[email protected]
https://lists.csail.mit.edu/mailman/listinfo/www-cl

--Apple-Mail-26--393869008--