cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit 8bd9b3d70b01095348ca0439dec744b6f811f93f
parent 5b0eb29d22b18f2d3cb10b836c0073a6f9cb9d96
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 16 Feb 2014 19:35:13 +0100

better parse-query-string

Diffstat:
Muri.lisp | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/uri.lisp b/uri.lisp @@ -46,7 +46,15 @@ (str (rw:till r '(#\&))))))))))) (defun parse-query-string (x) - (when x - (rw:till (rw:peek-reader (query-string-pair-reader (rw:reader x)))))) + (let ((r (rw:peek-reader (rw:reader x)))) + (values (rw:till r '(#\?)) + (when (eql #\? (rw:peek r)) + (rw:next r) + (rw:till (rw:peek-reader (query-string-pair-reader (rw:reader (rw:till r '(#\#))))))) + (when (eql #\# (rw:peek r)) + (rw:next r) + (rw:till r))))) -;;(parse-query-string "s=24rb7pccnd&a=0&c=") +;;(parse-query-string "?s=24rb7pccnd&a=0&c=") +;;(parse-query-string "/foo?s=24rb7pccnd&a=0&c=") +;;(parse-query-string "/foo?s=24rb7pccnd&a=0&c=#123")