[drakma-devel] Bug report: Overeager encoding of parameters

Eric Benson eric_a_benson at yahoo.com
Mon Jul 7 14:28:13 UTC 2008


It appears that drakma is encoding plus signs (+) in query parameters, turning them into %2B when they should be left alone. This confuses the server in this case. You can see that if I use the :parameters keyword the request fails, but if I include the same parameters as part of the URL the request succeeds.



* (setq drakma:*header-stream* *standard-output*)

#<SYNONYM-STREAM :SYMBOL SB-SYS:*STDOUT* {91260B9}>
* (drakma:http-request "http://freedb.org/~cddb/cddb.cgi" :parameters '(("cmd" . "cddb+lscat") ("hello" . "user+host+freedb+1.0") ("proto" . "6")))
GET /~cddb/cddb.cgi?cmd=cddb%2Blscat&hello=user%2Bhost%2Bfreedb%2B1.0&proto=6 HTTP/1.1
Host: freedb.org
User-Agent: Drakma/0.11.5 (SBCL 1.0.11.debian; Linux; 2.6.24-19-generic; http://weitz.de/drakma/)
Accept: */*
Connection: close

HTTP/1.1 200 OK
Date: Mon, 07 Jul 2008 14:17:36 GMT
Server: Apache/2.0.54 (Debian GNU/Linux)
Expires: Mon Jul  7 16:17:37 2008
Connection: close
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8

"500 Command syntax error: incorrect arg count forhandshake. 
"
200
((:DATE . "Mon, 07 Jul 2008 14:17:36 GMT")
 (:SERVER . "Apache/2.0.54 (Debian GNU/Linux)")
 (:EXPIRES . "Mon Jul  7 16:17:37 2008") (:CONNECTION . "close")
 (:TRANSFER-ENCODING . "chunked") (:CONTENT-TYPE . "text/plain; charset=UTF-8"))
#<PURI:URI http://freedb.org/~cddb/cddb.cgi?cmd=cddb%2Blscat&hello=user%2Bhost%2Bfreedb%2B1.0&proto=6>
#<FLEXI-STREAMS:FLEXI-IO-STREAM {BA65021}>
T
"OK"
* (drakma:http-request "http://freedb.org/~cddb/cddb.cgi?cmd=cddb+lscat&hello=user+host+freedb+1.0&proto=6")
GET /~cddb/cddb.cgi?cmd=cddb+lscat&hello=user+host+freedb+1.0&proto=6 HTTP/1.1
Host: freedb.org
User-Agent: Drakma/0.11.5 (SBCL 1.0.11.debian; Linux; 2.6.24-19-generic; http://weitz.de/drakma/)
Accept: */*
Connection: close

HTTP/1.1 200 OK
Date: Mon, 07 Jul 2008 14:17:42 GMT
Server: Apache/2.0.54 (Debian GNU/Linux)
Expires: Mon Jul  7 16:17:42 2008
Connection: close
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8

"210 OK, category list follows (until terminating `.') 
data 
folk 
jazz 
misc 
rock 
country 
blues 
newage 
reggae 
classical 
soundtrack 
. 
"
200
((:DATE . "Mon, 07 Jul 2008 14:17:42 GMT")
 (:SERVER . "Apache/2.0.54 (Debian GNU/Linux)")
 (:EXPIRES . "Mon Jul  7 16:17:42 2008") (:CONNECTION . "close")
 (:TRANSFER-ENCODING . "chunked") (:CONTENT-TYPE . "text/plain; charset=UTF-8"))
#<PURI:URI http://freedb.org/~cddb/cddb.cgi?cmd=cddb+lscat&hello=user+host+freedb+1.0&proto=6>
#<FLEXI-STREAMS:FLEXI-IO-STREAM {BAAA461}>
T
"OK"
* 




More information about the Drakma-devel mailing list