axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] RE: [Gcl-devel] Re: axiom porting


From: Camm Maguire
Subject: Re: [Axiom-developer] RE: [Gcl-devel] Re: axiom porting
Date: 04 May 2005 13:41:02 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

"Page, Bill" <address@hidden> writes:

> Mike,
> 
> On Tuesday, May 03, 2005 7:01 PM you wrote:
> 
> > Bill Page wrote:
> > |
> > | Hmmm... perhaps that explains why I don't seem to be able to
> > | get Version_2_6_7pre to run the web server program properly
> > | under windows?
> >
> > Looks like it Bill:
> >
> > $ ./unixport/saved_ansi_gcl.exe
> > GCL (GNU Common Lisp)  2.6.7 ANSI    May  3 2005 09:54:15
> > ...
> > >(load "c:/lang/source/gcl/gcl-2.6.6-ansi/http-test.lsp")
> >
> > Loading c:/lang/source/gcl/gcl-2.6.6-ansi/http-test.lsp
> > Error in LET [or a callee]: Error "No such file or directory"
> > on accepting connction to #<two-way stream 104d45c4>
> > ...
> 
> No it turns out that I was wrong. The attached file does run as
> expected on my windows Version_2_6_7pre gcl. But notice two
> things:
> 
> 1) I am not using the ANSI build.

OK, I've just tested on Linux under ANSI, and it works the same for
me (as it should).  If this is not the case on Windows, please someone
let me know asap.

> 2) The input from the browser is very picky and the server
>    code does *no* error checking.
> 
> The url path coincides with the root. To display a directory
> the url must end in / So on my system
> 
>   http://localhost:8085/msys/1.0/home/
> 
> displays the directory `c:\msys\1.0\home'. If the url does
> not end in / then it is assumed to be a file (html format in
> my version, or plain text by default). If the directory or
> file does not exist then the server program stops. It works
> but there is a lot of room for improvement.
> 

OK, I think I finally understand your earlier comment about
directory/filename distinction.  I've quickly scanned the hyperspec on
this and can't find the relevant section, so am referring this to our
resident expert Paul Dietz/  

Paul -- Can a compliant lisp implementation return some discernibly
special type of stream yielding directory entries on read, perhaps in
list form, when a path like /mydir or /mydir/ is supplied to open?
What is the best way to do this?

As for bombing when the file is not there, this would appear to be an
error in probe-file on Windows.  The 'server' example is supposed to
return a blank page and continue in this case.  Please let me know if
there is a bug here.  (si::use-fast-links nil) and :bt if thrown into
the debugger.  (I do get an error on Linux when the file exists but
cannot be opened due to permissions, for example.)

Looking at this has made me notice a bug -- one can apparently open
streams with directory pathnames, but reading of course fails.  I am
committing changes designed to fix this simply for now, by ensuring
that open_stream and probe-file (and file-write-length, file-author
...) fail (i.e. return nil) on directories.  Eventually we might want
to allow open to succeed, returning a 'user-defined' stream, and have
read thereon return stat structures for the files therein.  The only
standardized interface to directories under lisp I can find is
(directory ...), not surprisingly, so with this set of changes, this
will be the only thing you can do with a pathname that refers to a
directory, trailing slash or not.  I.e.

=============================================================================
>(open "/etc" :if-does-not-exist nil)

NIL

>(open "/etc/" :if-does-not-exist nil)

NIL

>(open "/etc/passwd" :if-does-not-exist nil)

#<input stream "/etc/passwd">

>(directory "/etc")

(#p"/etc")

>(directory "/etc/")

(#p"/etc/R" #p"/etc/X11" #p"/etc/adduser.conf" #p"/etc/adjtime"
 #p"/etc/aliases" #p"/etc/aliases.O" #p"/etc/alternatives" #p"/etc/apm"
 #p"/etc/apt" #p"/etc/at.deny" #p"/etc/autoconf2.13"
 #p"/etc/bash.bashrc" #p"/etc/bash_completion"
 #p"/etc/bash_completion.d" #p"/etc/bonobo-activation"
 #p"/etc/calendar" #p"/etc/chatscripts" #p"/etc/common-lisp"
 #p"/etc/console" #p"/etc/console-tools" #p"/etc/cron.d"
 #p"/etc/cron.daily" #p"/etc/cron.hourly" #p"/etc/cron.monthly"
 #p"/etc/cron.weekly" #p"/etc/crontab" #p"/etc/cups"
 #p"/etc/cvs-cron.conf" #p"/etc/cxref" #p"/etc/debconf.conf"
 #p"/etc/debian_version" #p"/etc/default" #p"/etc/defoma"
 #p"/etc/deluser.conf" #p"/etc/devscripts.conf"
 #p"/etc/dhclient-script" #p"/etc/dhclient.conf" #p"/etc/dhelp"
 #p"/etc/dictionaries-common" #p"/etc/dpkg" #p"/etc/dupload.conf"
 #p"/etc/emacs" #p"/etc/emacs21" #p"/etc/email-addresses"
 #p"/etc/esound" #p"/etc/exim" #p"/etc/exim4" #p"/etc/fdmount.conf"
 #p"/etc/fonts" #p"/etc/fstab" #p"/etc/gconf" #p"/etc/gnome-vfs-2.0"
 #p"/etc/gnome-vfs-mime-magic" #p"/etc/groff" #p"/etc/group"
 #p"/etc/group-" #p"/etc/gs-gpl" #p"/etc/gtk" #p"/etc/gtk-2.0"
 #p"/etc/host.conf" #p"/etc/hostname" #p"/etc/hosts.allow"
 #p"/etc/hosts.deny" #p"/etc/inetd.conf" #p"/etc/init.d"
 #p"/etc/inittab" #p"/etc/inputrc" #p"/etc/issue" #p"/etc/issue.net"
 #p"/etc/kernel-pkg.conf" #p"/etc/lam" #p"/etc/ld.so.cache"
 #p"/etc/ld.so.conf" #p"/etc/ldap" #p"/etc/lintianrc"
 #p"/etc/lisp-config.lisp" #p"/etc/locale.alias" #p"/etc/locale.gen"
 #p"/etc/localtime" #p"/etc/login.defs" #p"/etc/logrotate.conf"
 #p"/etc/logrotate.d" #p"/etc/lprng" #p"/etc/magic" #p"/etc/mail.rc"
 #p"/etc/mailcap" #p"/etc/mailcap.order" #p"/etc/mailname"
 #p"/etc/mailname.O" #p"/etc/manpath.config" #p"/etc/mediaprm"
 #p"/etc/mime.types" #p"/etc/mkinitrd" #p"/etc/modules"
 #p"/etc/modules.conf" #p"/etc/modutils" #p"/etc/motd"
 #p"/etc/mozilla-firefox" #p"/etc/mpich" #p"/etc/mtab" #p"/etc/nanorc"
 #p"/etc/network" #p"/etc/nsswitch.conf" #p"/etc/openoffice"
 #p"/etc/opt" #p"/etc/pam.conf" #p"/etc/pam.d" #p"/etc/pango"
 #p"/etc/papersize" #p"/etc/passwd" #p"/etc/passwd-" #p"/etc/perl"
 #p"/etc/ppp" #p"/etc/prelink.cache" #p"/etc/prelink.conf"
 #p"/etc/printcap" #p"/etc/profile" #p"/etc/protocols"
 #p"/etc/python2.3" #p"/etc/rc0.d" #p"/etc/rc1.d" #p"/etc/rc2.d"
 #p"/etc/rc3.d" #p"/etc/rc4.d" #p"/etc/rc5.d" #p"/etc/rc6.d"
 #p"/etc/rcS.d" #p"/etc/reportbug.conf" #p"/etc/resolv.conf"
 #p"/etc/rmt" #p"/etc/rpc" #p"/etc/securetty" #p"/etc/security"
 #p"/etc/services" #p"/etc/sgml" #p"/etc/shells" #p"/etc/skel"
 #p"/etc/sound" #p"/etc/ssh" #p"/etc/sysctl.conf" #p"/etc/syslog.conf"
 #p"/etc/terminfo" #p"/etc/texdoctk" #p"/etc/texmf" #p"/etc/ucf.conf"
 #p"/etc/updatedb.conf" #p"/etc/vga" #p"/etc/wgetrc" #p"/etc/xemacs21"
 #p"/etc/xml" #p"/etc/xpdf")

>(directory "/etc/passwd")

(#p"/etc/passwd" #p"/etc/passwd-")

(directory "/etc/passwd/")

NIL

=============================================================================

Here is a little modification to the server example:

(defun foo (s) 
  (let* ((get (read s nil 'eof)) 
         (fn (and (eq get 'get) (string-downcase (read s nil 'eof))))
         (dn (if (eql (aref fn (1- (length fn))) #\/) fn 
(si::string-concatenate fn "/")))
         (dir (directory dn))
         (file (unless dir (when (probe-file fn) fn))))
    (format s "HTTP/1.1 ~S~%" (if fn 404 500))
    (format s "Content-type: text/html~%~%")
    (format t "get ~a fn ~a dn ~a~%" get fn dn)
    (cond (file (with-open-file (q file) (si::copy-stream q s)))
          (dir  (dolist (l dir)
                  (let ((n (namestring l)))
                    (format s "<a href=\"~a\">~a</a> <a href=\"~a/\"> /... 
</a><br>~%" n n n)))))
    (close s)))

=============================================================================

These are just toys of course, just meant to illustrate my limited
understanding of how one can distinguish files from directories in
*standard* lisp.  We can add anything non-standard we might need, of
course. 




> > |
> > | I guess I should revert to applying your patches to gcl 2.6.6
> > | and see if I can at least get that to work on Windows...
> 
> I did not have to do this.
> 
> > Interestingly, today I can't get that to work properly either
> > insofar as getting the directory listsing you obtain.
> 
> I think you must have one too many simultaneous variables that
> are affecting your results ... :)
> 
> Here are a few links to other people doing http and html in lisp:
> 
> http://claws.sourceforge.net/
> 
> "The CLAWS is aimed to provide a complete framework for developing
> Web applications in Common Lisp. The project is in very early
> stage, so no actual code is released (though something can be found
> in CVS)."
> 
> http://www.franz.com/support/tutorials/
> http://www.franz.com/support/tutorials/aserve-tutorial.htm
> http://www.franz.com/support/documentation/7.0/doc/aserve/aserve.html
> http://opensource.franz.com/aserve/aserve-dist/doc/aserve.html
> 
> "AllegroServe is an HTTP server and HTML generator for Lisp. As
> with other HTTP servers, such as Apache (Unix) or the Internet
> Information Services (Windows), AllegroServe can be used to deliver
> web pages and other data over a TCP/IP network (such as the Internet)
> to internet browsers such as Firefox, Mozilla, and the Internet
> Explorer."
> 
> http://sourceforge.net/projects/portableaserve
> 
> "A free and portable Common Lisp Webserver. Portable AllegroServe
> is a variant of AllegroServe(tm) with an explicit emphasis on
> portability between Lispsystems and Operating Systems."
> 
> http://www.ai.mit.edu/projects/iiip/doc/cl-http/server.html
> http://www.ai.mit.edu/projects/iiip/doc/cl-http/home-page.html
> http://www.ai.mit.edu/projects/iiip/conferences/luv95/tutorial.html
> 
> "Major components include a mature HTTP 1.1 server, a robust
> caching proxy server, a programmatic client, a constraint-guided
> Web Walker, a full-text indexation & retrieval, along with a
> variety of Web-related tools and contributions."
> 

People have asked about allegro serve before, and it should work, but
I haven't had time to look at it.  It is likely overkill for the
purpose at hand.

Take care,

> etc. etc.
> 
> 
> Regards,
> Bill Page.
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]