[gambit-list] open-tcp-server
Marc Feeley
feeley at iro.umontreal.ca
Thu Mar 8 17:07:44 EST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 8-Mar-07, at 4:57 PM, Marc Feeley wrote:
> Did you try (close-port p) ?
Actually the fundamental problem is that you are not obeying the HTTP/
1.1 protocol. You should do something like:
(define s (open-tcp-server (list port-number: 8080 eol-encoding: 'cr-
lf)))
(define p (read s))
(pp (read-line p))
(display "HTTP/1.1 200 OK\n" p)
(display "Content-Length: 14\n" p)
(display "Content-Type: text/plain\n" p)
(display "\n" p)
(display "Hello World!\n" p)
(force-output p)
For completeness you should check the HTTP version on the first
request line and act accordingly.
This is just friendly advice... I'm not an HTTP protocol expert.
Marc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFF8Ikw//V9Zc2T/v4RAgH5AKC2jYEwQn/EiqW7ugQSS6SLcjTLAgCfWKCT
O3Hmu5cH4eHy+Sx7oNsz4Vk=
=kVzz
-----END PGP SIGNATURE-----
More information about the Gambit-list
mailing list