[PATCH] hgweb: add remoteuser to template variables

FZiegler zarf at klacto.net
Fri Sep 17 07:04:47 CDT 2010


Dirkjan Ochtman wrote:
> On Fri, Sep 17, 2010 at 05:16, FZiegler <zarf at klacto.net> wrote:
>> mpm pointed out a side effect: currently, "If multiple different users hit
>> the same hgweb page through a proxy using existing user-less templates,
>> they'll get cached copies. The above change will mean they'll all get
>> uncached copies of the same bytes."
>>
>> If that is a concern, I guess we could try to make the ETag addition
>> conditional on some flag to be set in hgweb.config. As mpm said, "Dunno if
>> it's worth the trouble", I'm leaving this up for you to judge.
> 
> We could make it conditional on REMOTE_USER being set, that would
> sufficiently minimize the impact, I think.

I believe it already is, kind of. More precisely, if REMOTE_USER is not 
set then I'm only causing a one-time change of the ETag, '1283856267.0' 
--> '1283856267.0/'. So unless I misunderstand (that happened before) 
the only extra thing I could make conditional in that case is the slash.

You can try it by visiting this URL (same app but no auth middleware): 
http://sandbox.klacto.net/mathg_bare/Flask/MiniTwit/

> Actually, I wonder if we can leverage the HTTP Vary header to fix this
> instead of changing the ETag... Maybe you can check that out?

Reading on it as we speak, but still much confused. I have REMOTE_USER 
in the environment, but I'm not seeing it as a *request header* -- and 
apparently only those can go in the Vary header:

"The Vary header defines which request headers a cache mechanism should 
take into account when building its cache key." [1]

Then again, if we somehow get REMOTE_USER into this header instead of in 
the ETag, that would still turn caching off in mpm's scenario, right?

Francois
------
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44
http://docs.djangoproject.com/en/1.2/topics/cache/#using-vary-headers






More information about the Mercurial-devel mailing list