[drakma-devel] http-request fails because of puri...
Edi Weitz
edi at agharta.de
Sat Feb 7 19:24:03 UTC 2009
On Fri, Feb 6, 2009 at 7:15 PM, Andrei Stebakov <lispercat at gmail.com> wrote:
> I have a link like
> "http://www.test.com/aaa.aspx?par1=http://www.test2.com/bbb.aspx?par2=http://www.test3.com"
> (I changed names but the structure is the same)
> For me it's a completely legit request as those nested requests create
> the right cookie environment for the subsequent calls.
> If I paste it in a browser, it'll give me the right page with the
> right cookies set.
> When I use (http-request link) with the link
> puri complains:
> Parse error:URI
> "http://www.test.com/aaa.aspx?par1=http://www.test2.com/bbb.aspx?par2=http://www.test3.com"
> contains illegal character #\? at position 63.
> [Condition of type PURI:URI-PARSE-ERROR]
>
> I can repro this error with:
> (puri:parse-uri
> "http://www.test.com/aaa.aspx?par1=http://www.test2.com/bbb.aspx?par2=http://www.test3.com")
>
> Apparently puri doesn't like the "?" in the parameter section of the
> first request (before par2). Does it make the whole request invalid?
> How can I get around this issue?
This is really just a Puri question and not a Drakma question, but
here goes: You should be able to get around the issue by properly
escaping the question mark (or better the whole parameter). There are
numerous Lisp functions called URL-ESCAPE or similar flying around.
The URL is accepted by browsers because they try to err on the liberal
side as far as human input is concerned. I think a library like Puri
should not follow their example and it's behaviour seems correct to
me.
HTH,
Edi.
More information about the Drakma-devel
mailing list