From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH/RFC] gitweb: Preserve $base_url if it was set Date: Mon, 29 Nov 2010 09:57:21 -0800 Message-ID: <7vr5e457y6.fsf@alter.siamese.dyndns.org> References: <20101128081048.13668.67286.reportbug@sb74.startrek> <4CF2BBEE.2050808@nachtgeist.net> <20101128211054.GA20203@burratino> <201011282305.39975.jnareb@gmail.com> <20101129001908.GA26358@burratino> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jakub Narebski , Daniel Reichelt , Giuseppe Bilotta , git@vger.kernel.org To: Jonathan Nieder X-From: git-owner@vger.kernel.org Mon Nov 29 18:57:45 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PN7yy-0006h2-RF for gcvg-git-2@lo.gmane.org; Mon, 29 Nov 2010 18:57:45 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754913Ab0K2R5j (ORCPT ); Mon, 29 Nov 2010 12:57:39 -0500 Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:42097 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203Ab0K2R5i (ORCPT ); Mon, 29 Nov 2010 12:57:38 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id A677420D9; Mon, 29 Nov 2010 12:57:55 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=to:cc:subject :references:from:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=8+2Xj7k5fHkxUzF5GPT/gilEA30=; b=sD6WLm unX3A45Z/WTk9IQ5f7ZTFS/bzuqJKLJwzz1MQUO0g5jFBy3vUHQdZymktg28NQnX pFccn28rTbvVMdL5Fz0fHd8yj1LRqB8bLE8sLhoIsz6bI+uIa0/SwC5To3MbB3k6 vMAbwvW+fQvXV0FdEsZ/NrdCAwkAqX6/sRZno= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=to:cc:subject :references:from:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=re182ND+ZfY/haWvJZ1xdUDdXqnunbRd PXmrLTiW8p4R9HNBfryBDJFEpBg89pNmL3nYw1q1cshYLYHSx5/bpr67VC2ug7Ab RIqz3z9k6lwlUegy3fD0p1+THIeWhk5nEVoAApF196x+a01LbRWjKD7iosHmMo2E MCsJJpmYRTU= Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 53D6720D8; Mon, 29 Nov 2010 12:57:50 -0500 (EST) Received: from pobox.com (unknown [76.102.170.102]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 4835A20D7; Mon, 29 Nov 2010 12:57:41 -0500 (EST) In-Reply-To: <20101129001908.GA26358@burratino> (Jonathan Nieder's message of "Sun\, 28 Nov 2010 18\:19\:08 -0600") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-Pobox-Relay-ID: 2E564396-FBE2-11DF-BF01-CDEAE6EC64FC-77302942!a-pb-sasl-sd.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Jonathan Nieder writes: > Jakub Narebski wrote: > >> If $base_url was defined, then do not redefine it in evaluate_uri(). > > How about $my_uri and $my_url? > > What happens if $ENV{PATH_INFO} or $cgi->url(...) changes between > requests? This is partly my ignorance: perhaps FastCGI et al > guarantee that such configuration changes can't happen within a single > process? > > Maintaining backward compatibility while avoiding this last concern > seems hard.... > It is tempting to change the documentation now and worry about code > changes later. Something like this? > > Signed-off-by: Jonathan Nieder Sounds like a sensible thing to do; narrows an interface with two variables into a more flexible new interface with a single variable. > --- > diff --git a/gitweb/README b/gitweb/README > index 6646fda..a9421e0 100644 > --- a/gitweb/README > +++ b/gitweb/README > @@ -177,13 +177,15 @@ not include variables usually directly set during build): > * $my_url, $my_uri > Full URL and absolute URL of gitweb script; > in earlier versions of gitweb you might have need to set those > - variables, now there should be no need to do it. > + variables, now there should be no need to do it. See > + $per_request_config if you need to set them still. > * $base_url > Base URL for relative URLs in pages generated by gitweb, > (e.g. $logo, $favicon, @stylesheets if they are relative URLs), > needed and used only for URLs with nonempty PATH_INFO via > . Usually gitweb sets its value correctly, > and there is no need to set this variable, e.g. to $my_uri or "/". > + See $per_request_config if you need to set it anyway. > * $home_link > Target of the home link on top of all pages (the first part of view > "breadcrumbs"). By default set to absolute URI of a page ($my_uri). > @@ -252,7 +254,10 @@ not include variables usually directly set during build): > sub { $ENV{GL_USER} = $cgi->remote_user || "gitweb"; } > Otherwise it is treated as boolean value: if true gitweb would process > config file once per request, if false it would process config file only > - once. The default is true. > + once. Note: $my_url, $my_uri, and $base_url are overwritten with > + their default values before every request, so if you want to change > + them, be sure to set this variable to true or a code reference effecting > + the desired changes. The default is true. > > Projects list file format > ~~~~~~~~~~~~~~~~~~~~~~~~~