chicken-janitors
[Top][All Lists]
Advanced

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

[Chicken-janitors] Re: [Chicken-bugs] #311: http-server and http-client


From: Chicken Scheme
Subject: [Chicken-janitors] Re: [Chicken-bugs] #311: http-server and http-client doesn't handle keep-alive very well.
Date: Wed, 31 Oct 2007 15:45:42 -0000

#311: http-server and http-client doesn't handle keep-alive very well.
-------------------+--------------------------------------------------------
Reporter:  daishi  |        Owner:  sjamaan   
    Type:  defect  |       Status:  assigned  
Priority:  minor   |    Component:  extensions
 Version:  2.6     |   Resolution:            
Keywords:          |  
-------------------+--------------------------------------------------------
Comment (by daishi):

 The first one, as I said, is easy to reproduce.

 Here is the code.

 {{{
 (use http-server)
 (use http-client)

 (http:request-method-handler
  'GET
  (lambda (req)
    (http:write-response-header 200 "OK")
    (printf "Content-Length: 3\r\nContent-Type: text/plain\r\n\r\n123")))

 (thread-start!
  (make-thread
   (lambda ()
     ((http:make-server 8899) #f))))

 (thread-sleep! 1)

 (print "apache HTTP/1.0")
 (let-values ([(header a i o) (http:send-request (http:make-request 'GET
 "http:/\
 /127.0.0.1:80/" '(("Connection" . "keep-alive")) '() "" 'HTTP/1.0))])
   (pp a))

 (print "chicken HTTP/1.0")
 (let-values ([(header a i o) (http:send-request (http:make-request 'GET
 "http:/\
 /127.0.0.1:8899/" '(("Connection" . "keep-alive")) '() "" 'HTTP/1.0))])
   (pp a))

 (print "apache HTTP/1.1")
 (let-values ([(header a i o) (http:send-request (http:make-request 'GET
 "http:/\
 /127.0.0.1:80/" '(("Connection" . "close")) '() "" 'HTTP/1.1))])
   (pp a))

 (print "chicken HTTP/1.1")
 (let-values ([(header a i o) (http:send-request (http:make-request 'GET
 "http:/\
 /127.0.0.1:8899/" '(("Connection" . "close")) '() "" 'HTTP/1.1))])
   (pp a))
 }}}

 and here is the result.

 {{{
 apache HTTP/1.0
 (("content-type" . "text/html")
  ("connection" . "Keep-Alive")
  ("keep-alive" . "timeout=15, max=100")
  ("content-length" . "44")
  ("accept-ranges" . "bytes")
  ("etag" . "\"4fc00f-2c-4c23b600\"")
  ("last-modified" . "Sat, 20 Nov 2004 20:16:24 GMT")
  ("server"
   .
   "Apache/2.2.6 (Debian) PHP/4.4.6-2+b1 mod_ssl/2.2.6 OpenSSL/0.9.8f")
  ("date" . "Wed, 31 Oct 2007 15:38:54 GMT"))
 chicken HTTP/1.0
 (("content-type" . "text/plain")
  ("content-length" . "3")
  ("location" . "localhost")
  ("server" . "ChickenRulesOK"))
 apache HTTP/1.1
 (("content-type" . "text/html")
  ("connection" . "close")
  ("content-length" . "44")
  ("accept-ranges" . "bytes")
  ("etag" . "\"4fc00f-2c-4c23b600\"")
  ("last-modified" . "Sat, 20 Nov 2004 20:16:24 GMT")
  ("server"
   .
   "Apache/2.2.6 (Debian) PHP/4.4.6-2+b1 mod_ssl/2.2.6 OpenSSL/0.9.8f")
  ("date" . "Wed, 31 Oct 2007 15:38:54 GMT"))
 chicken HTTP/1.1
 (("content-type" . "text/plain")
  ("content-length" . "3")
  ("location" . "localhost")
  ("server" . "ChickenRulesOK"))
 }}}

 You could see the connection header is not properly returned by chicken
 http server.

-- 
Ticket URL: <http://trac.callcc.org/ticket/311#comment:8>
Chicken Scheme <http://www.call-with-current-continuation.org/>
The CHICKEN Scheme-to-C compiler

reply via email to

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