I want to get the redirect url of a HTTP-request using drakma. If I pass in "http://lisp.org/", I want "http://lisp.org/index.html" back. Looking at the docs, it looks like I want the headers as an alist and drakma:http-request
should give me an alist.
The function returns SEVEN values - the body of the reply (but see below), the status code as an integer, an alist of the headers sent by the server where for each element the car (the name of the header) is a keyword and the cdr (the value of the header) is a string....
When I run drakma:http-request
I get the message body and headers are shown if I do (setf drakma:*header-stream* *standard-output*)
. I'm lost when it comes to getting the headers in usable form.
Edit: To get the redirect url of "http://lisp.org/":
(nth-value 3 (drakma:http-request "http://lisp.org/"))
Result: #<PURI:URI http://lisp.org/index.html>