http-get: don't shutdown write end of socket
authorAndy Wingo <wingo@pobox.com>
Mon, 7 Jan 2013 22:21:16 +0000 (23:21 +0100)
committerAndy Wingo <wingo@pobox.com>
Mon, 7 Jan 2013 22:21:16 +0000 (23:21 +0100)
* module/web/http.scm ("Connection"): Write the "close" token in
  lower-case.

* module/web/client.scm (http-get): Don't shutdown the writing side of
  the pipe if we are not doing a keepalive, as this may prevent the
  request from being sent at all.  Prevented http://friendfeed.com/ from
  being correctly fetched.

module/web/client.scm
module/web/http.scm

index 6aedb75..d3502cc 100644 (file)
@@ -129,8 +129,6 @@ Otherwise it will be returned as a bytevector."
                                                 extra-headers)))))
     (write-request req port)
     (force-output port)
-    (if (not keep-alive?)
-        (shutdown port 1))
     (let* ((res (read-response port))
            (body (read-response-body res)))
       (if (not keep-alive?)
index 216fddd..976f0fb 100644 (file)
@@ -1,6 +1,6 @@
 ;;; HTTP messages
 
-;; Copyright (C)  2010, 2011, 2012 Free Software Foundation, Inc.
+;; Copyright (C)  2010, 2011, 2012, 2013 Free Software Foundation, Inc.
 
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -1307,9 +1307,19 @@ treated specially, and is just returned as a plain string."
 ;; Connection = "Connection" ":" 1#(connection-token)
 ;; connection-token  = token
 ;; e.g.
-;;     Connection: close, foo-header
+;;     Connection: close, Foo-Header
 ;; 
-(declare-header-list-header! "Connection")
+(declare-header! "Connection"
+  split-header-names
+  list-of-header-names?
+  (lambda (val port)
+    (write-list val port
+                (lambda (x port)
+                  (display (if (eq? x 'close)
+                               "close"
+                               (header->string x))
+                           port))
+                ", ")))
 
 ;; Date  = "Date" ":" HTTP-date
 ;; e.g.