From 1c768744300916893c359ccf18cfe2dbb55b3978 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Fri, 2 Apr 2010 16:41:19 -0400 Subject: [PATCH] Add US-ASCII unprintable control characters to the exlusion list per RFC2396 2.4.3 http://www.ietf.org/rfc/rfc2396.txt Adds to *excluded-characters*, with a test --- src.lisp | 8 ++++++-- tests.lisp | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src.lisp b/src.lisp index ab13bad..d39d32b 100644 --- a/src.lisp +++ b/src.lisp @@ -355,10 +355,14 @@ ;; Parsing (defparameter *excluded-characters* - '(;; `delims' (except #\%, because it's handled specially): + (append + (loop for i from 0 to #x1f + collect (code-char i)) + '(;; `delims' (except #\%, because it's handled specially): #\< #\> #\" #\space #\# + ;; `unwise': - #\{ #\} #\| #\\ #\^ #\[ #\] #\`)) + #\{ #\} #\| #\\ #\^ #\[ #\] #\`))) (defun reserved-char-vector (chars &key except) (do* ((a (make-array 127 :element-type 'bit :initial-element 0)) diff --git a/tests.lisp b/tests.lisp index b5cbe37..77d1961 100644 --- a/tests.lisp +++ b/tests.lisp @@ -408,6 +408,16 @@ :condition-type 'uri-parse-error) res) + + ;;an escaped newline isn't rendered properly + (push + `(let ((weird-uri "https://example.com/q?foo%0abar%20baz")) + (test + weird-uri + (puri:render-uri (puri:parse-uri weird-uri) nil) + :test #'string=) + ) res) + `(progn ,@(nreverse res)))) (defun do-tests () -- 1.7.10.4