Got authorization to work!

First, another patch to to raise 'Unauthorized' when 401 is
returned by PHP/Perl:

after line that starts with

   if ec==200


   if ec==401:
      raise 'Unauthorized'

Second, numerous changes to the external method that makes the request and
receives the response. Here's the whole thing

def ServePHP(self):
    req = self.REQUEST
    (username, password) = req._authUserPW()

    headers = {}
    if req.environ.has_key('HTTP_COOKIE'):
        headers = {'Cookie' : req.environ['HTTP_COOKIE']}
    if req.environ.has_key('HTTP_USER_AGENT'):
        headers = {'User-Agent' : req.environ['HTTP_USER_AGENT']}
    if req.environ['REQUEST_METHOD'] == 'POST':
        rTuple =  apply(, (req['phpScript'], username, password, headers), 
        rTuple =['phpScript'], username, password, headers)
    resp = req['RESPONSE']
    # the first element of the return tuple is dervied from rfc822
    for cookie in rTuple[0].getallmatchingheaders('Set-Cookie'):
        cookie = cookie[:-1] # remove \n - is there an idiom for this?
        apply(resp.setHeader, split(cookie, ':', 1))
    # not a particularly strong test, maybe Client should pass back status
    if rTuple[0].has_key('location'):
        # override base so that relative references work
        resp.base = rTuple[0]['location']
        raise 'Redirect', resp.base
    #override base so that relative references work
    resp.base = '' + req['origScript']
    return rTuple[1]

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to