[Ecls-list] why doesn't my stupid mini http-server run?

Dan Knapp dankna at accela.net
Wed Nov 9 14:13:03 UTC 2005


   Just at a wild guess, are you sure that you're sending CRLF at the  
end of lines, not just LF?  It doesn't look like you are.  Also, I  
note that you don't finish reading the headers the client sends...  
but that probably doesn't matter... unless your response goes out  
before it's done, perhaps?

   Well, I hope that helps.  I'm curious if that's it, so let us know.

On Nov 10, 2005, at 1:16 AM, fBechmann at t-online.de wrote:

> I couldn't get it smaller than this:
>
> ===
>
> (in-package :cl-user)
>
> (load "sys:sockets")
> (use-package :sb-bsd-sockets)
>
> (defmethod handle-client ((socket inet-socket))
>    "Handle a client request."
>    (let* ( (client-stream (socket-make-stream socket :input  
> t :output t :element-type 'character :buffering :full))
>            (message (read-line client-stream))
>            (response (format nil
>                "~A ~D ~A~%~%<html><head><title>foo</title></ 
> head><body>bar!</body></html>~%"
>                "HTTP/1.0" 200 "OK"
>                )))
>            (write-line message)
>            (write-line response)
>            (write-line response client-stream))
>    (write-line "Closing client connection.")
>    (socket-close socket))
>   (defun run-http-server (host port)
>    (let ((s (make-instance 'inet- 
> socket :type :stream :protocol :tcp)))
>        (socket-bind s (make-inet-address host) port)
>        (socket-listen s 5)
>        (do ((client-socket (socket-accept s) (socket-accept s)))
>            (nil)  ; infinite loop
>            (write-line "New client")
>            (let ((client-socket client-socket))
>                (handle-client client-socket)))))
>
> (run-http-server "127.0.0.1" 1975)
> ;; http://127.0.0.1:1975/foo/bar?bazz=123
>
> ===
>
> accessing the URL w/ IE doesn't work at all (no http error, just  
> 'The page cannot be displayed').
> accessing the URL w/ firefox brings up the page about 4 of 5 times,  
> but I also get some 'The document contains no data.'.
> the log output is always displayed in the server console.
> I'm running ECL fresh from CVS on win2k.
>
> I have no idea what's happening here, anyone else?
>
> TIA and regards,
>   frank
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.  
> Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>

-- Dan Knapp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20051109/440b4310/attachment.html>


More information about the ecl-devel mailing list