[Patches] [ python-Patches-624180 ] HTTP Auth support for xmlrpclib

noreply@sourceforge.net noreply@sourceforge.net
Fri, 01 Nov 2002 09:14:18 -0800


Patches item #624180, was opened at 2002-10-16 18:16
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=624180&group_id=5470

Category: Library (Lib)
Group: Python 2.3
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Phillip J. Eby (pje)
Assigned to: Fredrik Lundh (effbot)
Summary: HTTP Auth support for xmlrpclib

Initial Comment:
This patch adds code and docs to support the use of
HTTP/HTTPS "Basic Authorization" with xmlrpclib.  It
does this using the "http://user:pass@host:port/"
syntax, based on existing code in urllib and xmlrpclib.
 I have tested the code change with and without basic
auth on my own servers, but do not know how I could
create a reasonable addition to the test suite, since a
server connection would be required.

My patch includes a patch to Doc/lib/libxmlrpclib.tex,
but I'm not sure if I added the text in the best place.
 It may be that it should be a note in the 'seealso'
section on that page instead, but I wasn't sure if that
was correct style for the library documentation.  For
the code patch, I tried to match the style of the
surrounding code as closely as possible, including the
style used for code comments.

The patch is against current (as of this moment) Python
CVS.  Please let me know if there's any other info you
need or anything that I should change for this.  Thanks.


----------------------------------------------------------------------

Comment By: Phillip J. Eby (pje)
Date: 2002-10-23 19:23

Message:
Logged In: YES 
user_id=56214

Oops...  There's a (very small) bug in both my and your
versions of the patch.  I forgot to do
'urllib.unquote(auth)' before doing the base64 encode.  This
means that if 'user' is an e-mail address or contains a
colon, or 'password' contains an '@' sign, there's no way to
get them into the auth string.  adding:

auth = urllib.unquote(auth)

before the 'auth = base64.encodestring(auth)' statement does
the trick.  Thus, a 'user' of "pje@telecommunity.com" can be
encoded in the URL as "pje%40telecommunity.com", which is
awkward but usable.

I discovered this when trying to port a script from Perl's
RPC::XML, which supports this syntax, escapes included.

Thanks!

----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2002-10-20 14:54

Message:
Logged In: YES 
user_id=38376

looks good to me.

thanks /F

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=624180&group_id=5470