lua-xmlrpc icon indicating copy to clipboard operation
lua-xmlrpc copied to clipboard

Cookie support

Open CiaranG opened this issue 15 years ago • 2 comments

For some XMLRPC workflows, cookie support is required - e.g. for a service where you log in and the session information is preserved with cookies. Bugzilla prior to 3.3.6 requires this method of operation, and even where it doesn't the alternative is sending username/password in the URL in each request which is not a wise idea.

So, I think this library should support cookies. As a quick proof of concept, and because I needed it, I hacked in some quick support that works. The code is here:

https://github.com/CiaranG/lua-xmlrpc/commit/eb6fabadaa3fd138acf615995169fb53103b4070

I suggest this is just for reference, since a) it changes the API by adding another parameter, and b) it doesn't attempt to worry about expiry or which URL a cookie is for, it just deals with names and values and assumes you're talking to the same server.

You use it by just passing the same table in the cookies parameter with each 'call'. Cookies get added to that as the server supplies them, and are automatically returned to the server on subsequent requests.

CiaranG avatar Nov 19 '10 09:11 CiaranG

I agree that cookies would be a useful addition. Thanks for the proof-of-concept patch. I need to think about it, especially if (or better how) it can be done without changing the existing API. Also with cookies you can really screw up badly (especially security-wise), so that needs to get some more attention. If you are willing to work on it a bit more go for it! I recommend communicating a short proposal for discussion, addressing some of the mentioned issues.

timn avatar Nov 22 '10 05:11 timn

Em, I think the argument 'url' can use a table instead of a string, of course, we can use table and string both for compatible with existing codes.

The codes for reference is here: https://github.com/ifreedom/lua-xmlrpc/commit/6aa544516ad5ff69fe446d776462dba1ac495118

nomadalex avatar Nov 26 '10 15:11 nomadalex