Revision: 4681 Author: edi URL: http://bknr.net/trac/changeset/4681
URL-encoding problem
U trunk/thirdparty/drakma/CHANGELOG.txt U trunk/thirdparty/drakma/request.lisp U trunk/thirdparty/drakma/util.lisp
Modified: trunk/thirdparty/drakma/CHANGELOG.txt =================================================================== --- trunk/thirdparty/drakma/CHANGELOG.txt 2011-08-31 12:23:17 UTC (rev 4680) +++ trunk/thirdparty/drakma/CHANGELOG.txt 2011-08-31 13:44:01 UTC (rev 4681) @@ -1,6 +1,8 @@ +Make sure GET parameters are always URL-encoded +Add :RANGE keyword argument (Hans Hübner) Better handling of optional filenames when uploading (Stas Boukarev) Don't funcall symbols that aren't FBOUNDP (Faré Rideau) -Allowed disabling of SSL when building (Marko Kocic) +Allow disabling of SSL when building (Marko Kocic)
Version 1.2.3 2010-08-05
Modified: trunk/thirdparty/drakma/request.lisp =================================================================== --- trunk/thirdparty/drakma/request.lisp 2011-08-31 12:23:17 UTC (rev 4680) +++ trunk/thirdparty/drakma/request.lisp 2011-08-31 13:44:01 UTC (rev 4681) @@ -533,13 +533,11 @@ (comm:attach-ssl raw-http-stream :ssl-side :client) #-:lispworks (setq http-stream (wrap-stream (make-ssl-stream raw-http-stream)))) - (when (and (not parameters-used-p) - parameters) + (when-let (all-get-parameters + (append (dissect-query (uri-query uri)) + (and (not parameters-used-p) parameters))) (setf (uri-query uri) - ;; append parameters to existing query of URI - (format nil "~@[~A~]~:*~:[~;&~]~A" - (uri-query uri) - (alist-to-url-encoded-string parameters external-format-out)))) + (alist-to-url-encoded-string all-get-parameters external-format-out))) (when (eq method :options*) ;; special pseudo-method (setf method :options
Modified: trunk/thirdparty/drakma/util.lisp =================================================================== --- trunk/thirdparty/drakma/util.lisp 2011-08-31 12:23:17 UTC (rev 4680) +++ trunk/thirdparty/drakma/util.lisp 2011-08-31 13:44:01 UTC (rev 4681) @@ -339,3 +339,11 @@ :close-callback (lambda () (close s)))) #+:drakma-no-ssl (error "SSL not supported. Remove :drakma-no-ssl from *features* to enable SSL")) + +(defun dissect-query (query-string) + "Accepts a query string as in PURI:URI-QUERY and returns a +corresponding alist of name/value pairs." + (when query-string + (loop for parameter-pair in (split-string query-string "&") + for (name value) = (split-string parameter-pair "=") + collect (cons name value)))) \ No newline at end of file