Commit 36d238e3 authored by Martijn Pieters's avatar Martijn Pieters

Don't mask authorization exceptions for XML-RPC calls, slightly modified

patch from Brad Clements (fixes Zope Collector issue #525).
parent cd906440
......@@ -19,10 +19,12 @@ See http://www.xmlrpc.com/ and http://linux.userland.com/ for more
information about XML-RPC and Zope.
"""
import sys
import sys, types
from HTTPResponse import HTTPResponse
import xmlrpclib
from zExceptions import Unauthorized
def parse_input(data):
"""Parse input data and return a method path and argument tuple
......@@ -120,6 +122,13 @@ class Response:
if type(info) is type(()) and len(info)==3: t,v,tb = info
else: t,v,tb = sys.exc_info()
# Don't mask 404 respnses, as some XML-RPC libraries rely on the HTTP
# mechanisms for detecting when authentication is required. Fixes Zope
# Collector issue 525.
if t == 'Unauthorized' or (isinstance(t, types.ClassType)
and issubclass(t, Unauthorized)):
return self._real.exception(fatal=fatal, info=info)
# Create an appropriate Fault object. Unfortunately, we throw away
# most of the debugging information. More useful error reporting is
# left as an exercise for the reader.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment