On Fri, Feb 6, 2009 at 7:15 PM, Andrei Stebakov lispercat@gmail.com wrote:
I have a link like "http://www.test.com/aaa.aspx?par1=http://www.test2.com/bbb.aspx?par2=http://..." (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://..." 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://...")
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.