Show More
@@ -179,13 +179,13 b' test http authentication' | |||||
179 | > import base64 |
|
179 | > import base64 | |
180 | > from mercurial.hgweb import common |
|
180 | > from mercurial.hgweb import common | |
181 | > def perform_authentication(hgweb, req, op): |
|
181 | > def perform_authentication(hgweb, req, op): | |
182 | > auth = req.headers.get('Authorization') |
|
182 | > auth = req.headers.get(b'Authorization') | |
183 | > if not auth: |
|
183 | > if not auth: | |
184 | > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who', |
|
184 | > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', | |
185 | > [('WWW-Authenticate', 'Basic Realm="mercurial"')]) |
|
185 | > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) | |
186 | > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', |
|
186 | > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', | |
187 | > b'pass']: |
|
187 | > b'pass']: | |
188 | > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no') |
|
188 | > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') | |
189 | > def extsetup(): |
|
189 | > def extsetup(): | |
190 | > common.permhooks.insert(0, perform_authentication) |
|
190 | > common.permhooks.insert(0, perform_authentication) | |
191 | > EOT |
|
191 | > EOT |
General Comments 0
You need to be logged in to leave comments.
Login now