This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: HTTP Auth support for xmlrpclib
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: effbot Nosy List: effbot, pje
Priority: normal Keywords: patch

Created on 2002-10-16 16:16 by pje, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
authpatch pje, 2002-10-16 16:16 HTTP Basic Auth support for xmlrpclib (+doc)
Messages (3)
msg41392 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2002-10-16 16:16
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.
msg41393 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2002-10-20 12:54
Logged In: YES 
user_id=38376

looks good to me.

thanks /F
msg41394 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2002-10-23 17:23
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!
History
Date User Action Args
2022-04-10 16:05:45adminsetgithub: 37330
2002-10-16 16:16:20pjecreate