[PATCH 0 of 1] Patch to fix a small "bug" and improve support for custom auth extensions.

Dirkjan Ochtman dirkjan at ochtman.nl
Sat Feb 7 10:15:03 CST 2009


On Sat, Feb 7, 2009 at 12:44, Sune Foldager <cryo at cyanite.org> wrote:
> This patch does two things, both minor and both have no effect on existing functionality.
>
> 1. Fixes a small "bug" in hgweb/hgweb_mod.py:
>   The request.response function accepts ErrorResponse instances, but the two places in hgweb_mod.py where
>   such instances are caught and request.respond is called, the instance is unwrapped instead of just passed
>   along. I fixed that (by removing '.code' from two places, basically). Less code, same function :-).
> 2. Extends the ErrorResponse class with a 'headers' argument to the constuctor. This allows for ErrorResponses
>   with additional HTTP headers. It's not used by mercurial, but extensions might use it.

The patch looks good, though I'll probably split it up into two
patches along these lines before I push it.

> So why do this? Well, I have an extension (actually a patch right now) which wraps check_perms and does some
> custom authorization. For that I need to send back 401 challenges. With this patch it's as simple as raising
> an ErrorResponse with the correct WWW-Authenticate header :-).

I'm curious to hear a little more about your authn/authz needs, as I'm
thinking about abstracting hgweb's model in that department a bit.

Cheers,

Dirkjan


More information about the Mercurial-devel mailing list