[Uri-template-devel] New uri-template version [Fwd: URI-TEMPLATE Regular expression patch]

Vladimir Sedach vsedach at gmail.com
Sat Aug 22 03:10:49 UTC 2009


Hi,

I've just released version 0.7 of uri-template. This fixes a bug where
query strings were not getting extracted correctly from URIs with no
path component (original bug report below).

Vladimir


---------- Forwarded message ----------
From: Роман Захаров <zahardzhan at gmail.com>
Date: 2009/8/21
Subject: URI-TEMPLATE Regular expression patch
To: vsedach at gmail.com


Please change regexp in destructure-uri.lisp in uri-template package from

"^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)(((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+))\\??([^#]*)?#?([#\\w\\-]+)?$"
to
"^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)(((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+))?\\??([^#]*)?#?([#\\w\\-]+)?$"
;;
         ^
;;
     add ? - question symbol here

because i have a problem when working with URL's like *my-uri*:

(defparameter *my-uri*
"http://files3.dsv.data.cod.ru/?WyIyNWQ3NWU5NTRmZDU1MWIzYmQ5NzVjNzJhZjRkZmNhZSIsMTI1MTA5NjMxNCwiXHUwNDEwXHUwNDNiXHUwNDRjXHUwNDRmXHUwNDNkXHUwNDQxIFx1MDQ0MVx1MDQzNVx1MDQ0MFx1MDQzZVx1MDQzYVx1MDQ0MFx1MDQ0Ylx1MDQzYlx1MDQ0Ylx1MDQ0NS5yYXIiLCJrTzNqSUo3bUN5WlBPenlBVGdcL0M3UkZVWHdXYkN6SWtEYzUweTl5a1lOVCtTRmlwVFdsN1UxWlVybGVLNjMyaGlYc0hvVDhGZitGWUt6eGVVRGxOVkxUN3R0MndLYjg4VGFjYmZSVnhrZjNYQXdZalpYemVEQXM4bmxzK0RCbnZEcnZQTmRMKytDS05pNjVJXC8yb2JnY0N1RmdyK1lpS0VSak8rNVZSeTIrcz0iXQ%3D%3D")

(defun test-bind-uri (uri)
  (bind-standard-uri-components uri
    (format t "PROTOCOL: ~a~%HOST: ~a~%PATH: ~a~%DIR: ~a~%FILE:
~a~%QUERY: ~a~%HASH: ~a~%"
            %uri-protocol %uri-host %uri-path %uri-directory %uri-file
%uri-query-string %uri-hash)))

(test-bind-uri my-uri) ;; Evaluation result before changing the regexp
in destructure-uri.lisp

PROTOCOL: NIL
HOST: NIL
PATH: NIL
DIR: NIL
FILE: NIL
QUERY: NIL
HASH: NIL

(test-bind-uri my-uri)  ;; Evaluation result after changing the regexp
in destructure-uri.lisp

PROTOCOL: http
HOST: files3.dsv.data.cod.ru
PATH: NIL
DIR: NIL
FILE: NIL
QUERY: /?WyIyNWQ3NWU5NTRmZDU1MWIzYmQ5NzVjNzJhZjRkZmNhZSIsMTI1MTA5NjMxNCwiXHUwNDEwXHUwNDNiXHUwNDRjXHUwNDRmXHUwNDNkXHUwNDQxIFx1MDQ0MVx1MDQzNVx1MDQ0MFx1MDQzZVx1MDQzYVx1MDQ0MFx1MDQ0Ylx1MDQzYlx1MDQ0Ylx1MDQ0NS5yYXIiLCJrTzNqSUo3bUN5WlBPenlBVGdcL0M3UkZVWHdXYkN6SWtEYzUweTl5a1lOVCtTRmlwVFdsN1UxWlVybGVLNjMyaGlYc0hvVDhGZitGWUt6eGVVRGxOVkxUN3R0MndLYjg4VGFjYmZSVnhrZjNYQXdZalpYemVEQXM4bmxzK0RCbnZEcnZQTmRMKytDS05pNjVJXC8yb2JnY0N1RmdyK1lpS0VSak8rNVZSeTIrcz0iXQ%3D%3D
HASH: NIL

URI-TEMPLATE package with changed regexp pass test successfully.

P.S. Send me reply when you got my letter.

P.P.S. A you from Russia? Если да, то ответ пишите по-русски плиз.




More information about the uri-template-devel mailing list