`write-request-line' writes absolute paths, not absolute URIs.
authorIan Price <ianprice90@googlemail.com>
Thu, 29 Sep 2011 02:12:00 +0000 (03:12 +0100)
committerAndy Wingo <wingo@pobox.com>
Sat, 7 Jan 2012 00:36:34 +0000 (01:36 +0100)
* module/web/http.scm (write-request-line): RFC 2616 says that absolute
  paths are used to identify resources on an origin server.

module/web/http.scm

index 1d52b9d..aa099fe 100644 (file)
@@ -1079,7 +1079,18 @@ three values: the method, the URI, and the version."
   "Write the first line of an HTTP request to @var{port}."
   (display method port)
   (display #\space port)
-  (write-uri uri port)
+  (let ((path (uri-path uri))
+        (query (uri-query uri)))
+    (if (not (string-null? path))
+        (display path port))
+    (if query
+        (begin
+          (display "?" port)
+          (display query port)))
+    (if (and (string-null? path)
+             (not query))
+        ;; Make sure we display something.
+        (display "/" port)))
   (display #\space port)
   (write-http-version version port)
   (display "\r\n" port))