[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Axiom-developer] Re: Axiom HyperDoc Replacement
From: |
Bill Page |
Subject: |
RE: [Axiom-developer] Re: Axiom HyperDoc Replacement |
Date: |
Sat, 21 Apr 2007 16:04:36 -0400 |
On April 21, 2007 3:38 PM Martin Rubey wrote:
>
> "Bill Page" <address@hidden> writes:
>
> > Or we could just add a couple of extra lisp commands to
> > open and send the contents of the file ourselves.
>
> Well, that's what I have done now -- following the code in
> the sandboxsockets page. But it's nowhere as nice as the
> simple redirect.
Nice. Seems ok to me. Since this can be compiled, I expect
it to be pretty fast - for a single user it is probably
faster than the overhead of having more processes running.
>
> > It's not a big deal. The main thing is that you found a way
> > to call a Spad routine [...]
>
> > Do you have an explanation why you want/need to use the
> > *docfun* name format?
>
> > Oh, I didn't know that this was a problem. Hm, you did it
> > yourself with MySort(L,<$Integer)$Lisp, so I do not really
> > follow?
It did not work they way I originally wrote it. See bottom of
the page:
http://wiki.axiom-developer.org/SandBoxSocketsInSpad
>
> The only thing that was surprising is that the function needs
> to be compiled, i.e., defining a function in the interpreter
> does not work, for some reason.
Maybe a limitation of the SPADCALL macro?
>
> Thus, I modified bar as below. The only reason I made it a
> global was that I am lazy. You could just as well pass it
> to server as an argument.
In my code that's what I tried but I did not use it the same
way you did below:
>
> ;; try it with
>
> ;; )lisp (load "http-test.lisp")
> ;; BAR(8080, getDocumentation$HyperDoc)$Lisp
>
> (defvar *docfun*)
>
> ;; file: http-test.lisp
> (defun bar (p docfun)
> (setq *docfun* docfun)
> (let ((s (si::socket p :server #'server)))
> (tagbody l
> (when (si::listen s)
> (let ((w (si::accept s)))
> (server w)))
> (sleep 0.1)
> (go l))))
>
> (defun server (s)
> (let* ((get (read s nil 'eof))
> (fn (and (eq get 'get) (subseq (string-downcase
> (read s nil 'eof)) 1))))
> ; subseq removes the leading "/"
> (format t "Got ~S~%~%" fn)
> ;;; NOTYET tested
> (when (string= (char fn 1) "?")
> (setq fn (SPADCALL fn *docfun*)))
> ; *docfun* should return the name of an html file
> ; in case of an error, it will also return the name of an
> ; html file, which will contain the error message
> ;;; END NOTYET tested
>
> (when (string= (subseq fn (- (length fn) 4)) "html")
> (format s "HTTP/1.1 ~S~%" (if fn 200 403)))
>
; You should probably send an HTTP Content-type: header here
: before the file contents rather than embedding it in the
; HTML file, since that would make the file not readable
; directly by local file access
(format s "Content-type: text/html~%~%")
> (with-open-file (q fn) (si::copy-stream q s))
> (close s)))
>
>
> > I recall something about such mangled names being "global"
> > or in some other way special in scope.
>
> No, the stars are only a convention. defvar makes a variable
> "global".
>
Ok. Thanks.
> > Is that right? Is that why it works, incontrast to the
> > lambda function I tried?
>
> Huh? what lambda function did not work for you?
>
No, it didn't work. See the bottom of the page. That is the
main reason why I created the page - so I could document this
problem. Maybe it's a bug in GCL? Or maybe it is just I do
not understand how socket function calls server function
internally and that this failure is expected.
> > There is a way to chage the configuration of FireFox:
> >
> > http://kb.mozillazine.org/Links_to_local_pages_do_not_work
> >
> > And Konqueror is supposed to just give a warning. Did you
> > see that?
>
> No, he says access denied. But in any case, we cannot expect
> a user to fiddle with security settings.
Agreed.
>
> The "small" webservers, can they be installed without being
> root?
>
Yes, so long as you assign a non-standard port number >1024 and
don't have an aggressive firewall policy.
Regards,
Bill Page.
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, (continued)
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- RE: [Axiom-developer] Re: Axiom HyperDoc Replacement, Bill Page, 2007/04/21
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- RE: [Axiom-developer] Re: Axiom HyperDoc Replacement, Bill Page, 2007/04/21
- Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- RE: [Axiom-developer] Re: Axiom HyperDoc Replacement,
Bill Page <=
- Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/21
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Jay Belanger, 2007/04/21
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Alfredo Portes, 2007/04/21
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/22
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Alfredo Portes, 2007/04/22
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/22
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Alfredo Portes, 2007/04/22
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Martin Rubey, 2007/04/22
- Re: Please join! Re: [Axiom-developer] Re: Axiom HyperDoc Replacement, Alfredo Portes, 2007/04/22
- [Axiom-developer] Re: Please join!, Waldek Hebisch, 2007/04/22