From 20d28792b3781e2ca4fd31f4978fc7a0adfbab9a Mon Sep 17 00:00:00 2001 From: Ian Price Date: Mon, 19 Aug 2013 03:43:48 +0100 Subject: `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. --- module/web/http.scm | 9 +++------ test-suite/tests/web-http.test | 4 ++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/module/web/http.scm b/module/web/http.scm index 21d2964b4..af04259cc 100644 --- a/module/web/http.scm +++ b/module/web/http.scm @@ -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)) diff --git a/test-suite/tests/web-http.test b/test-suite/tests/web-http.test index b2c5c2c2b..e24a268ec 100644 --- a/test-suite/tests/web-http.test +++ b/test-suite/tests/web-http.test @@ -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 -- cgit v1.2.3 From 1fcf690929d3cd5221f4fe95ed79f356be382a43 Mon Sep 17 00:00:00 2001 From: Ian Price Date: Mon, 19 Aug 2013 22:25:41 +0100 Subject: doc: `get-string-all' takes only one argument. * doc/ref/api-io.texi (R6RS Textual Input): Remove `count' argument. --- doc/ref/api-io.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi index 4c42de8d0..a0619df05 100644 --- a/doc/ref/api-io.texi +++ b/doc/ref/api-io.texi @@ -1956,7 +1956,7 @@ exact integer object. If no characters can be read before an end of file, the end-of-file object is returned. @end deffn -@deffn {Scheme Procedure} get-string-all textual-input-port count +@deffn {Scheme Procedure} get-string-all textual-input-port Reads from @var{textual-input-port} until an end of file, decoding characters in the same manner as @code{get-string-n} and @code{get-string-n!}. -- cgit v1.2.3 From df3acd296e7149630fd6030aced6331ae6dd424b Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Mon, 19 Aug 2013 19:30:42 -0400 Subject: Improve error checking in 'define-public' and 'module-add!'. * module/ice-9/boot-9.scm (module-add!): Check that the symbol argument is actually a symbol. (define-public): Expand into 'define' in such a way that curried definitions will immediately fail. --- module/ice-9/boot-9.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index c825b3530..3cd3bdc12 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2248,6 +2248,8 @@ VALUE." (define (module-add! m v var) (if (not (variable? var)) (error "Bad variable to module-add!" var)) + (if (not (symbol? v)) + (error "Bad symbol to module-add!" v)) (module-obarray-set! (module-obarray m) v var) (module-modified m)) @@ -3582,7 +3584,7 @@ CONV is not applied to the initial value." (syntax-rules () ((_ (name . args) . body) (begin - (define name (lambda args . body)) + (define (name . args) . body) (export name))) ((_ name val) (begin -- cgit v1.2.3 From 0ac084bf2b0b0d7dcae4c5f27477f5af0374d6e5 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Fri, 23 Aug 2013 01:57:50 -0400 Subject: Fix 'define-public' from (ice-9 curried-definitions). * module/ice-9/curried-definitions.scm (cdefine, cdefine*): Simplify, and improve error reporting by making the patterns more strict. (define-public): Fix bug in generated 'export' form. --- module/ice-9/curried-definitions.scm | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/module/ice-9/curried-definitions.scm b/module/ice-9/curried-definitions.scm index 8c684a18c..fa369906c 100644 --- a/module/ice-9/curried-definitions.scm +++ b/module/ice-9/curried-definitions.scm @@ -1,4 +1,4 @@ -;;; Copyright (C) 2010 Free Software Foundation, Inc. +;;; Copyright (C) 2010, 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 @@ -21,32 +21,25 @@ (define-syntax cdefine (syntax-rules () - ((_ ((head . tail) . rest) body body* ...) - (cdefine (head . tail) - (lambda rest body body* ...))) ((_ (head . rest) body body* ...) - (define head + (cdefine head (lambda rest body body* ...))) - ((_ . rest) - (define . rest)))) + ((_ name val) + (define name val)))) (define-syntax cdefine* (syntax-rules () - ((_ ((head . tail) . rest) body body* ...) - (cdefine* (head . tail) - (lambda* rest body body* ...))) ((_ (head . rest) body body* ...) - (define* head + (cdefine* head (lambda* rest body body* ...))) - ((_ . rest) - (define* . rest)))) + ((_ name val) + (define* name val)))) (define-syntax define-public (syntax-rules () - ((_ (name . args) . body) - (begin - (cdefine (name . args) . body) - (export name))) + ((_ (head . rest) body body* ...) + (define-public head + (lambda rest body body* ...))) ((_ name val) (begin (define name val) -- cgit v1.2.3