equal
deleted
inserted
replaced
391 > l.prefix=lo |
391 > l.prefix=lo |
392 > l.username=user |
392 > l.username=user |
393 > l.password=pass |
393 > l.password=pass |
394 > EOF |
394 > EOF |
395 |
395 |
396 $ cat << EOF > userpass.py |
396 $ hg --config extensions.x=$TESTDIR/httpserverauth.py \ |
397 > import base64 |
|
398 > from mercurial.hgweb import common |
|
399 > def perform_authentication(hgweb, req, op): |
|
400 > auth = req.headers.get(b'Authorization') |
|
401 > if not auth: |
|
402 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', |
|
403 > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) |
|
404 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', |
|
405 > b'pass']: |
|
406 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') |
|
407 > def extsetup(ui): |
|
408 > common.permhooks.insert(0, perform_authentication) |
|
409 > EOF |
|
410 |
|
411 $ hg --config extensions.x=$TESTTMP/userpass.py \ |
|
412 > -R server serve -d -p $HGPORT1 --pid-file=hg.pid \ |
397 > -R server serve -d -p $HGPORT1 --pid-file=hg.pid \ |
413 > -A $TESTTMP/access.log -E $TESTTMP/errors.log |
398 > -A $TESTTMP/access.log -E $TESTTMP/errors.log |
414 $ mv hg.pid $DAEMON_PIDS |
399 $ mv hg.pid $DAEMON_PIDS |
415 |
400 |
416 $ hg clone --debug http://localhost:$HGPORT1 auth_clone | egrep '^[{}]| ' |
401 $ hg clone --debug http://localhost:$HGPORT1 auth_clone | egrep '^[{}]| ' |