comparison tests/test-http.t @ 41068:28a4fb793ba1

extensions: deprecate extsetup without a `ui` argument (API) 9.5 years should be enough time, but there were some tests for the old style still (which are now updated). Exthelper doesn't fallback to the old API, so this is for consistency. .. api:: The extension hook ``extsetup`` without a `ui` argument has been deprecated, and will be removed in the next version. Add a `ui` argument to avoid the deprecation warning.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 27 Dec 2018 21:46:03 -0500
parents 73da729ccfef
children 549af2fa089f
comparison
equal deleted inserted replaced
41067:f2601cbce209 41068:28a4fb793ba1
179 > if not auth: 179 > if not auth:
180 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who', 180 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, b'who',
181 > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')]) 181 > [(b'WWW-Authenticate', b'Basic Realm="mercurial"')])
182 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']: 182 > if base64.b64decode(auth.split()[1]).split(b':', 1) != [b'user', b'pass']:
183 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no') 183 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, b'no')
184 > def extsetup(): 184 > def extsetup(ui):
185 > common.permhooks.insert(0, perform_authentication) 185 > common.permhooks.insert(0, perform_authentication)
186 > EOT 186 > EOT
187 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \ 187 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
188 > --config server.preferuncompressed=True \ 188 > --config server.preferuncompressed=True \
189 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log 189 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
524 > def perform_authentication(hgweb, req, op): 524 > def perform_authentication(hgweb, req, op):
525 > cookie = req.headers.get(b'Cookie') 525 > cookie = req.headers.get(b'Cookie')
526 > if not cookie: 526 > if not cookie:
527 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie') 527 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'no-cookie')
528 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie) 528 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, b'Cookie: %s' % cookie)
529 > def extsetup(): 529 > def extsetup(ui):
530 > common.permhooks.insert(0, perform_authentication) 530 > common.permhooks.insert(0, perform_authentication)
531 > EOF 531 > EOF
532 532
533 $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid 533 $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid
534 $ cat pid > $DAEMON_PIDS 534 $ cat pid > $DAEMON_PIDS