1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 22:10:21 +02:00

`write-request-line' always prints a path component.

* module/web/http.scm (write-request-line): Always write "/" when path
  is empty, regardless of query.
* test-suite/tests/web-http.test ("write-request-line"): Add test.
This commit is contained in:
Ian Price 2013-08-19 03:43:48 +01:00
parent 088cfb7d76
commit 20d28792b3
2 changed files with 7 additions and 6 deletions

View file

@ -1137,16 +1137,13 @@ three values: the method, the URI, and the version."
(display host-port port)))))
(let ((path (uri-path uri))
(query (uri-query uri)))
(if (not (string-null? path))
(if (string-null? path)
(display "/" port)
(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 query port))))
(display #\space port)
(write-http-version version port)
(display "\r\n" port))

View file

@ -173,6 +173,10 @@
(build-uri 'http
#:path "/pub/WWW/TheProject.html")
(1 . 1))
(pass-if-write-request-line "GET /?foo HTTP/1.1"
GET
(build-uri 'http #:query "foo")
(1 . 1))
(pass-if-write-request-line "HEAD /etc/hosts?foo=bar HTTP/1.1"
HEAD
(build-uri 'http