tests/test-largefiles-wireproto.t
changeset 36877 02bea04b4c54
parent 36760 7bf80d9d9543
child 37348 f4e84dfc06fd
equal deleted inserted replaced
36876:97f44b0720e2 36877:02bea04b4c54
   422   $ cd ..
   422   $ cd ..
   423   $ cat << EOT > userpass.py
   423   $ cat << EOT > userpass.py
   424   > import base64
   424   > import base64
   425   > from mercurial.hgweb import common
   425   > from mercurial.hgweb import common
   426   > def perform_authentication(hgweb, req, op):
   426   > def perform_authentication(hgweb, req, op):
   427   >     auth = req.env.get('HTTP_AUTHORIZATION')
   427   >     auth = req.headers.get('Authorization')
   428   >     if not auth:
   428   >     if not auth:
   429   >         raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
   429   >         raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
   430   >                 [('WWW-Authenticate', 'Basic Realm="mercurial"')])
   430   >                 [('WWW-Authenticate', 'Basic Realm="mercurial"')])
   431   >     if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
   431   >     if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
   432   >         raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
   432   >         raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')