From edi at agharta.de Tue Nov 10 09:00:18 2009 From: edi at agharta.de (Edi Weitz) Date: Tue, 10 Nov 2009 10:00:18 +0100 Subject: [drakma-devel] GET :PARAMETERS added again during redirects In-Reply-To: <6ba04de90910162312s179b6f48j2c00716e340a9177@mail.gmail.com> References: <6ba04de90910162312s179b6f48j2c00716e340a9177@mail.gmail.com> Message-ID: Thanks for the report and sorry for the delay. I've committed a fix to the BKNR repository. Edi. On Sat, Oct 17, 2009 at 7:12 AM, Eugene Ossintsev wrote: > I use DRAKMA 1.0, Clozure CL 1.4-dev (Ubuntu Linux x86). According to > the DRAKMA documentation, parameters is an alist of name/value pairs > (the car and the cdr each being a string) which denotes the parameters > which are added to the query part of the URI or (in the case of a POST > request) comprise the request body. > > In my example QUOTES1 sends a GET request passing the request > parameters in the URI, and QUOTES2 uses the :PARAMETERS instead. The > results, unfortunately, are not the same. > > > (defun quotes1 () > ? (multiple-value-bind (body code) > ????? (drakma:http-request > "http://finance.yahoo.com/d/quotes.csv?s=XIC.TO&f=sxl1d1t1") > ??? (when (= code 200) > ????? (split-sequence:split-sequence #\, body)))) > > ("\"XIC.TO\"" "\"Toronto\"" "18.03" "\"10/9/2009\"" "\"3:59pm\" ^M > ") ? ? ? ? ? ? ? ? <=== It's fine :-) > > > (defun quotes2 () > ? (multiple-value-bind (body code) > ????? (drakma:http-request "http://finance.yahoo.com/d/quotes.csv" > ?????????????????????????? :method :get > ?????????????????????????? :parameters '(("s" . "XIC.TO") > ???????????????????????????????????????? ("f" . "sxl1d1t1"))) > ??? (when (= code 200) > ????? (split-sequence:split-sequence #\, body)))) > > ("\"XIC.TO\"" "\"Toronto\"" "18.03" "\"10/9/2009\"" "\"3:59pm\"" > "\"XIC.TO\"" "\"XIC.TO\"" "\"XIC.TO\"" "\"Toronto\"" "18.03" > "\"10/9/2009\"" "\"3:59pm\" ^M > \"XIC.TO\"" "\"Toronto\"" "18.03" "\"10/9/2009\"" "\"3:59pm\"" > "\"XIC.TO\"" "\"XIC.TO\"" "\"XIC.TO\"" "\"Toronto\"" "18.03" > "\"10/9/2009\"" "\"3:59pm\" ^M > ") ? ? ? ? ? ? ? ? <=== It's a mess :-( > > > TRACE DRAKMA:HTTP-REQUEST shows that in case of redirects of GET > requests the parameters from :PARAMETERS are added again to the URI. > Thus, the same parameters may be added again and again, giving > unpredictable results. > > 0> Calling (DRAKMA:HTTP-REQUEST > "http://finance.yahoo.com/d/quotes.csv" :PARAMETERS (("s" . "XIC.TO") > ("f" . "sxl1d1t1"))) > ?1> Calling (DRAKMA:HTTP-REQUEST # http://download.finance.yahoo.com/d/quotes.csv?s=XIC.TO&f=sxl1d1t1> > :REDIRECT 4 :STREAM NIL :ADDITIONAL-HEADERS NIL :PARAMETERS (("s" . > "XIC.TO") ("f" . "sxl1d1t1"))) > ?<1 DRAKMA:HTTP-REQUEST returned 7 values : > ?<1????? #(34 88 73 67 46 84 79 34 44 34 84 111 114 111 110 116 111 34 > 44 49 55 46 57 56 44 34 49 48 .......... > ?<1????? 200 > ?<1????? ((:DATE . "Wed, 14 Oct 2009 05:00:51 GMT") (:P3P . > "policyref=\"http://p3p.yahoo.com/w3c/p3p.xml\", CP=\"CAO DSP COR CUR > ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi > PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE > GOV\"") (:CACHE-CONTROL . "private") (:CONNECTION . "close") > (:TRANSFER-ENCODING . "chunked") (:CONTENT-TYPE . > "application/octet-stream")) > ?<1????? # > ?<1????? # > ?<1????? T > ?<1????? "OK" > > > Is it what may be expected from such usage of :PARAMETERS in GET > requests? If not, is it worth fixing it? > > > - Eugene > > _______________________________________________ > drakma-devel mailing list > drakma-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > From netawater at gmail.com Thu Nov 12 02:05:07 2009 From: netawater at gmail.com (Xiangjun Wu) Date: Thu, 12 Nov 2009 10:05:07 +0800 Subject: [drakma-devel] redirect in http-request Message-ID: <6f8d23640911111805u26bac7ddpa5b279954b089627@mail.gmail.com> Hi, All, I'm building a oauth library with drakma, oauth specification need every request is signed with its token and token secret in additional-headers, but it also need a unique timestamp and nonce(a random string). It is OK when there is not redirect, but http-request will use the same additional-headers in the redirect request, so oauth server throw an error: "Invalid nonce/timestamp: This nonce has been used ..." I think there are two solutions, one is there is a option that http-request do not automatically follow redirect, the other is http-reqeust evaluate the additional-headers again when redirecting. Is it acceptable, thank you in advance. Plato Wu ?????????? -------------- next part -------------- An HTML attachment was scrubbed... URL: From eugoss at gmail.com Thu Nov 12 05:08:21 2009 From: eugoss at gmail.com (Eugene Ossintsev) Date: Thu, 12 Nov 2009 00:08:21 -0500 Subject: [drakma-devel] GET :PARAMETERS added again during redirects In-Reply-To: References: <6ba04de90910162312s179b6f48j2c00716e340a9177@mail.gmail.com> Message-ID: <6ba04de90911112108i1e3575e8h7d6ce3ad77c94d49@mail.gmail.com> Thanks a lot, Edi! Now it works fine :) - Eugene On Tue, Nov 10, 2009 at 4:00 AM, Edi Weitz wrote: > Thanks for the report and sorry for the delay. I've committed a fix > to the BKNR repository. > > Edi. > > > On Sat, Oct 17, 2009 at 7:12 AM, Eugene Ossintsev > wrote: > > I use DRAKMA 1.0, Clozure CL 1.4-dev (Ubuntu Linux x86). According to > > the DRAKMA documentation, parameters is an alist of name/value pairs > > (the car and the cdr each being a string) which denotes the parameters > > which are added to the query part of the URI or (in the case of a POST > > request) comprise the request body. > > > > In my example QUOTES1 sends a GET request passing the request > > parameters in the URI, and QUOTES2 uses the :PARAMETERS instead. The > > results, unfortunately, are not the same. > > > > > > (defun quotes1 () > > (multiple-value-bind (body code) > > (drakma:http-request > > "http://finance.yahoo.com/d/quotes.csv?s=XIC.TO&f=sxl1d1t1") > > (when (= code 200) > > (split-sequence:split-sequence #\, body)))) > > > > ("\"XIC.TO\"" "\"Toronto\"" "18.03" "\"10/9/2009\"" "\"3:59pm\" ^M > > ") <=== It's fine :-) > > > > > > (defun quotes2 () > > (multiple-value-bind (body code) > > (drakma:http-request "http://finance.yahoo.com/d/quotes.csv" > > :method :get > > :parameters '(("s" . "XIC.TO") > > ("f" . "sxl1d1t1"))) > > (when (= code 200) > > (split-sequence:split-sequence #\, body)))) > > > > ("\"XIC.TO\"" "\"Toronto\"" "18.03" "\"10/9/2009\"" "\"3:59pm\"" > > "\"XIC.TO\"" "\"XIC.TO\"" "\"XIC.TO\"" "\"Toronto\"" "18.03" > > "\"10/9/2009\"" "\"3:59pm\" ^M > > \"XIC.TO\"" "\"Toronto\"" "18.03" "\"10/9/2009\"" "\"3:59pm\"" > > "\"XIC.TO\"" "\"XIC.TO\"" "\"XIC.TO\"" "\"Toronto\"" "18.03" > > "\"10/9/2009\"" "\"3:59pm\" ^M > > ") <=== It's a mess :-( > > > > > > TRACE DRAKMA:HTTP-REQUEST shows that in case of redirects of GET > > requests the parameters from :PARAMETERS are added again to the URI. > > Thus, the same parameters may be added again and again, giving > > unpredictable results. > > > > 0> Calling (DRAKMA:HTTP-REQUEST > > "http://finance.yahoo.com/d/quotes.csv" :PARAMETERS (("s" . "XIC.TO") > > ("f" . "sxl1d1t1"))) > > 1> Calling (DRAKMA:HTTP-REQUEST # > http://download.finance.yahoo.com/d/quotes.csv?s=XIC.TO&f=sxl1d1t1> > > :REDIRECT 4 :STREAM NIL :ADDITIONAL-HEADERS NIL :PARAMETERS (("s" . > > "XIC.TO") ("f" . "sxl1d1t1"))) > > <1 DRAKMA:HTTP-REQUEST returned 7 values : > > <1 #(34 88 73 67 46 84 79 34 44 34 84 111 114 111 110 116 111 34 > > 44 49 55 46 57 56 44 34 49 48 .......... > > <1 200 > > <1 ((:DATE . "Wed, 14 Oct 2009 05:00:51 GMT") (:P3P . > > "policyref=\"http://p3p.yahoo.com/w3c/p3p.xml\", CP=\"CAO DSP COR CUR > > ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi > > PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE > > GOV\"") (:CACHE-CONTROL . "private") (:CONNECTION . "close") > > (:TRANSFER-ENCODING . "chunked") (:CONTENT-TYPE . > > "application/octet-stream")) > > <1 # http://download.finance.yahoo.com/d/quotes.csv?s=XIC.TO&f=sxl1d1t1&s=XIC.TO&f=sxl1d1t1 > > > > <1 # > > <1 T > > <1 "OK" > > > > > > Is it what may be expected from such usage of :PARAMETERS in GET > > requests? If not, is it worth fixing it? > > > > > > - Eugene > > > > _______________________________________________ > > drakma-devel mailing list > > drakma-devel at common-lisp.net > > http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > > > > _______________________________________________ > drakma-devel mailing list > drakma-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edi at agharta.de Thu Nov 12 11:08:32 2009 From: edi at agharta.de (Edi Weitz) Date: Thu, 12 Nov 2009 12:08:32 +0100 Subject: [drakma-devel] redirect in http-request In-Reply-To: <6f8d23640911111805u26bac7ddpa5b279954b089627@mail.gmail.com> References: <6f8d23640911111805u26bac7ddpa5b279954b089627@mail.gmail.com> Message-ID: I just made a very similar change two days ago: http://bknr.net/trac/changeset/4466/trunk/thirdparty/drakma Could you provide a patch along the lines of what you think is needed? See also here: http://weitz.de/patches.html Thanks, Edi. On Thu, Nov 12, 2009 at 3:05 AM, Xiangjun Wu wrote: > Hi, All, > > I'm building a oauth library with drakma, oauth specification need > every request is signed with its token and token secret in > additional-headers, but it also need a unique timestamp and nonce(a random > string). > > It is OK when there is not redirect, but http-request will use the same > additional-headers in the redirect request, so oauth server throw an error: > "Invalid nonce/timestamp: This nonce has been used ..." > > I think there are two solutions, one is there is a option that > http-request do not automatically follow redirect, the other is > http-reqeust evaluate the additional-headers again when redirecting. > > Is it acceptable, thank you in advance. > > > Plato Wu > ?????????? > > _______________________________________________ > drakma-devel mailing list > drakma-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > > From netawater at gmail.com Fri Nov 13 05:23:43 2009 From: netawater at gmail.com (Xiangjun Wu) Date: Fri, 13 Nov 2009 13:23:43 +0800 Subject: [drakma-devel] redirect in http-request In-Reply-To: References: <6f8d23640911111805u26bac7ddpa5b279954b089627@mail.gmail.com> Message-ID: <6f8d23640911122123m276278bbh8ac335f8767a138a@mail.gmail.com> OK, I have made a patch, Please check it. Besides, launchpad.net need a new http method called patch, I also provide a patch, is it OK? Best regards, Plato Wu ?????????? On Thu, Nov 12, 2009 at 7:08 PM, Edi Weitz wrote: > I just made a very similar change two days ago: > > http://bknr.net/trac/changeset/4466/trunk/thirdparty/drakma > > Could you provide a patch along the lines of what you think is needed? > > See also here: > > http://weitz.de/patches.html > > Thanks, > Edi. > > On Thu, Nov 12, 2009 at 3:05 AM, Xiangjun Wu wrote: > > Hi, All, > > > > I'm building a oauth library with drakma, oauth specification need > > every request is signed with its token and token secret in > > additional-headers, but it also need a unique timestamp and nonce(a > random > > string). > > > > It is OK when there is not redirect, but http-request will use the same > > additional-headers in the redirect request, so oauth server throw an > error: > > "Invalid nonce/timestamp: This nonce has been used ..." > > > > I think there are two solutions, one is there is a option that > > http-request do not automatically follow redirect, the other is > > http-reqeust evaluate the additional-headers again when redirecting. > > > > Is it acceptable, thank you in advance. > > > > > > Plato Wu > > ?????????? > > > > _______________________________________________ > > drakma-devel mailing list > > drakma-devel at common-lisp.net > > http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > > > > > > _______________________________________________ > drakma-devel mailing list > drakma-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: additional-headers.patch Type: application/octet-stream Size: 2242 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: method.patch Type: application/octet-stream Size: 511 bytes Desc: not available URL: From edi at agharta.de Wed Nov 25 17:29:03 2009 From: edi at agharta.de (Edi Weitz) Date: Wed, 25 Nov 2009 18:29:03 +0100 Subject: [drakma-devel] redirect in http-request In-Reply-To: <6f8d23640911122123m276278bbh8ac335f8767a138a@mail.gmail.com> References: <6f8d23640911111805u26bac7ddpa5b279954b089627@mail.gmail.com> <6f8d23640911122123m276278bbh8ac335f8767a138a@mail.gmail.com> Message-ID: On Fri, Nov 13, 2009 at 6:23 AM, Xiangjun Wu wrote: > OK, I have made a patch, Please check it. > > Besides, launchpad.net need a new http method called patch, I also provide a > patch, is it OK? Sorry for the delay. I've applied the patch for the new http method and cleaned it up afterwards because it contained TABs: http://bknr.net/trac/changeset/4475/trunk/thirdparty/drakma http://bknr.net/trac/changeset/4476/trunk/thirdparty/drakma In the other patch, I don't understand the docstring. I think this is not what you meant. And if you change the docstring, the HTML documentation also has to be updated. http://weitz.de/patches.html Thanks, Edi. From netawater at gmail.com Thu Nov 26 03:04:57 2009 From: netawater at gmail.com (Xiangjun Wu) Date: Thu, 26 Nov 2009 11:04:57 +0800 Subject: [drakma-devel] redirect in http-request In-Reply-To: References: <6f8d23640911111805u26bac7ddpa5b279954b089627@mail.gmail.com> <6f8d23640911122123m276278bbh8ac335f8767a138a@mail.gmail.com> Message-ID: <6f8d23640911251904o4161fc7nf335c113ff5e571e@mail.gmail.com> Very sorry for TABs, I thought emacs have done for me, now I have configure .emacs correctly, thanks for pointing out. The other patch add a type to parameters of additional-headers, it can be a function of no arguments and it will get evaluated in every request, so different request could send different parameters. I am greatly embarrassed I do not write a fluent proper technological document in English that confuses you, Please guide me, thanks very much. After we clear this issue, I will re-made a patch. Best Wishes Plato Wu ?????????? On Thu, Nov 26, 2009 at 1:29 AM, Edi Weitz wrote: > On Fri, Nov 13, 2009 at 6:23 AM, Xiangjun Wu wrote: > > OK, I have made a patch, Please check it. > > > > Besides, launchpad.net need a new http method called patch, I also > provide a > > patch, is it OK? > > Sorry for the delay. I've applied the patch for the new http method > and cleaned it up afterwards because it contained TABs: > > http://bknr.net/trac/changeset/4475/trunk/thirdparty/drakma > http://bknr.net/trac/changeset/4476/trunk/thirdparty/drakma > > In the other patch, I don't understand the docstring. I think this is > not what you meant. And if you change the docstring, the HTML > documentation also has to be updated. > > http://weitz.de/patches.html > > Thanks, > Edi. > > _______________________________________________ > drakma-devel mailing list > drakma-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From netawater at gmail.com Sun Nov 29 03:14:28 2009 From: netawater at gmail.com (Xiangjun Wu) Date: Sun, 29 Nov 2009 11:14:28 +0800 Subject: [drakma-devel] redirect in http-request In-Reply-To: <6f8d23640911251904o4161fc7nf335c113ff5e571e@mail.gmail.com> References: <6f8d23640911111805u26bac7ddpa5b279954b089627@mail.gmail.com> <6f8d23640911122123m276278bbh8ac335f8767a138a@mail.gmail.com> <6f8d23640911251904o4161fc7nf335c113ff5e571e@mail.gmail.com> Message-ID: <6f8d23640911281914v221c202ao3f35c6ab4c7d74bf@mail.gmail.com> I have remake the patch, Please check it, Thank you!. ?????????? On Thu, Nov 26, 2009 at 11:04 AM, Xiangjun Wu wrote: > Very sorry for TABs, I thought emacs have done for me, now I have configure > .emacs correctly, > thanks for pointing out. > > The other patch add a type to parameters of additional-headers, it can be a > function of no > arguments and it will get evaluated in every request, so different request > could send different > parameters. > > I am greatly embarrassed? I do not write a fluent proper technological > document in English that > confuses you, Please guide me, thanks very much. > > After we clear this issue, I will re-made a patch. > > Best Wishes > Plato Wu > ?????????? > > > On Thu, Nov 26, 2009 at 1:29 AM, Edi Weitz wrote: >> >> On Fri, Nov 13, 2009 at 6:23 AM, Xiangjun Wu wrote: >> > OK, I have made a patch, Please check it. >> > >> > Besides, launchpad.net need a new http method called patch, I also >> > provide a >> > patch, is it OK? >> >> Sorry for the delay. ?I've applied the patch for the new http method >> and cleaned it up afterwards because it contained TABs: >> >> ?http://bknr.net/trac/changeset/4475/trunk/thirdparty/drakma >> ?http://bknr.net/trac/changeset/4476/trunk/thirdparty/drakma >> >> In the other patch, I don't understand the docstring. ?I think this is >> not what you meant. ?And if you change the docstring, the HTML >> documentation also has to be updated. >> >> ?http://weitz.de/patches.html >> >> Thanks, >> Edi. >> >> _______________________________________________ >> drakma-devel mailing list >> drakma-devel at common-lisp.net >> http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel > > -------------- next part -------------- A non-text attachment was scrubbed... Name: additional-headers.patch Type: application/octet-stream Size: 1800 bytes Desc: not available URL: