[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Re: [Gcl-devel] Simple web server code for GCLfor
From: |
Camm Maguire |
Subject: |
Re: [Axiom-developer] Re: [Gcl-devel] Simple web server code for GCLfor Windows |
Date: |
03 May 2005 09:55:42 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Greetings!
"Page, Bill" <address@hidden> writes:
> On Thursday, April 28, 2005 7:38 PM Mike Thomas wrote:
>
> > Camm wrote:
> >
> > > Greetings! Here's a quick way to get started:
> > > ==================================================================
> > > address@hidden:/fix/t1/camm/debian/gcl/gcl-2.6.6$ diff -u
> > > ../gcl-2.6.5/o/file.d o/file.d
> > > --- ../gcl-2.6.5/o/file.d 2004-05-07 21:48:58.000000000 +0000
> > > +++ o/file.d 2005-04-28 16:21:33.000000000 +0000
> > >
> > ...
> >
> > > >(bar 8080 #'foo)
> > > ==================================================================
> > > Then point your browser to localhost:8080. You should be able to get
> > > directory listings and files.
> >
> > I modified the test program to print stuff out and using port 8085
> > to get around IIS I was able to get a web page back with the following
> > text:
> >
> > /TMP /win32app /WINDOWS
> >
> >from the following input into my browser:
> >
> > http://localhost:8085/dir
> >
> > So it looks like your patch works on Windows Camm to a first
> > approximation - you truly are a wunderkind Camm!
>
> Using Version_2_6_7pre compiled on Windows I am not able
> to reproduce this success. I tried:
>
> ---------
>
> address@hidden ~/axiom--windows--1/gcl/unixport
> $ saved_gcl
> GCL (GNU Common Lisp) 2.6.7 CLtL1 May 3 2005 03:46:01
> Source License: LGPL(gcl,gmp), GPL(unexec,bfd)
> Binary License: GPL due to GPL'ed components: (UNEXEC)
> Modifications of this banner must retain notice of a compatible license
> Dedicated to the memory of W. Schelter
>
> Use (help) to get some basic information on how to use GCL.
>
> (defun foo (s)
> (let* ((get (read s nil 'eof))
> (fn (and (eq get 'get) (string-downcase (read s nil 'eof))))
> (fn (when (probe-file fn) fn)))
> (format s "HTTP/1.1 ~S~%~%" (if fn 404 500))
> (when fn
> (if (pathname-name (pathname fn))
> (with-open-file (q fn) (si::copy-stream q s))
> (dolist (l (directory fn)) (format s "~a~%" (namestring l)))))
> (close s))
>
> )
>
> (defun bar (p fn)
> (let ((s (si::socket p :server fn)))
> (tagbody l
> (when (si::listen s)
> (let ((w (si::accept s)))
> (foo w)))
> (sleep 3)
> (go l))))
>
> (bar 8085 #'foo)
>
> ---------
>
> Sits there and spins. If I go to my browser (FireFox 1.0.3) and
> enter the url
>
> http://localhost:8085/dir
>
> after a short pause the browser returns with no error
> but the page is empty.
>
> Any ideas? Mike, could you send me your "modified test program
> that prints stuff out"?
>
What this will send to the gcl function 'foo' is 'get /dir' #'foo
must find a file or directory by that name to produce output, which
I'm guessing does not exist on your system. You can add a diagnostic
like:
(defun foo (s)
(let* ((get (read s nil 'eof))
(fn (and (eq get 'get) (string-downcase (read s nil 'eof))))
(fn (when (probe-file fn) fn)))
(format s "HTTP/1.1 ~S~%~%" (if fn 404 500))
(format t "get ~a fn ~a~%" get fn)
(when fn
(if (pathname-name (pathname fn))
(with-open-file (q fn) (si::copy-stream q s))
(dolist (l (directory fn)) (format s "~a~%" (namestring l)))))
(close s))
)
You can also do 'telnet localhost 8085' and type 'get /dir' to see the
output, which I think is likely '404' in my pseudo html error code
example.
Take care,
> Regards,
> Bill Page.
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah