From: "Giuseppe Bilotta" <giuseppe.bilotta@gmail.com>
To: "Jakub Narebski" <jnareb@gmail.com>
Cc: git@vger.kernel.org, "Petr Baudis" <pasky@ucw.cz>,
"Lea Wiemann" <lewiemann@gmail.com>
Subject: Re: [PATCH 1/6] gitweb: action in path with use_pathinfo
Date: Tue, 30 Sep 2008 12:40:36 +0200 [thread overview]
Message-ID: <cb7bb73a0809300340t79a497fey4ededd960223fcdd@mail.gmail.com> (raw)
In-Reply-To: <200809301048.40046.jnareb@gmail.com>
On Tue, Sep 30, 2008 at 10:48 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> On Tue, 30 Sep 2008, Giuseppe Bilotta wrote:
>> On Tue, Sep 30, 2008 at 2:21 AM, Jakub Narebski <jnareb@gmail.com> wrote:
>>> I think that gitweb should use single source, not CGI query parameters
>>> or variable saving [sanitized] value.
>>
>> The alternative I've been thinking about would be to have an
>> %input_parameters hash that holds all input parameters regardless of
>> hash; thus CGI query parameters and data extracted from PATH_INFO,
>> presently, but also command line options in the future, or whatever
>> else.
>>
>> This is somewhat different from your %action_vars alternative, in the
>> sense that it isolates _input_ data, whereas if I understand correctly
>> the approach you suggest would isolate _output_ data (in the sense of
>> data to be used during link creation and whatnot).
>>
>> Presently, the gitweb code defines some $variables from the input
>> parameters, and then overwrites them for output. Keeping the input
>> stuff clearly separate from the output stuff would mean that any
>> routine can retrieve the input data regardless of the subsequent
>> mangling and without any need to make ad-hoc backups or other tricks.
>>
>> So my proposal is that I implement this %input_params stuff as the
>> first patch for the pathinfo series, and use %input_params all around
>> where cgi parameters are used currently (of course, %input_params is
>> initialized with the CGI parameters at first). The next patch would be
>> the extraction of parameters from PATH_INFO. And thirdly the PATH_INFO
>> URL generation (with or without the /-before-filename thing, at your
>> preference)
>
> I presume that you would want to replace for example $hash_base
> everywhere by %input_params{'hash_base'}?
No. %input_params{'hash_base'} would only be the _input_ hash base.
$hash_base would be kept if it's supposed to indicate the value of
hash base that is being manipulated.
> I can think of yet another solution, namely to abstract getting
> parameters from CGI query string, from path_info, and possibly in the
> future also from command line options, and use this mechanism in
> the getting parameters and validation part.
>
> The %params hash would be filled from CGI parameters by using simply
> "%params = $cgi->Vars;", then added to in evaluate_path_info instead
> of directly modifying global parameters variables.
So far I agree.
> The input validation
> and dispatch part would be modified to use %params (taking care of
> multivalued parameters as described in CGI(3pm)), like below:
>
> our $action = $params{'a'} || $params{'action'};
Not too sure about that. The path_info (or whatever)-derived params
should be converted to use the same name as the CGI params. Or
conversely, CGI params should be mapped to the corresponding
full-form.
> That is just for consideration: each approach has its advantages and
> disadvantages. Your proposal, as I understand it, is similar to the
> way described in "Storing options in a hash" subsection of
> Getopt::Long(3pm) manpage.
I'll read that, although it probably is.
> Or we could just scrap and revert adding href(..., -replay=>1).
> There is much trouble with getting it right and performing well,
> and it is less useful than I thought (at least now).
Dunno, the idea in itself is not bad. We just have to get it right ;)
In a way, I actually think that -replay=>1 should be the default, I
suspect it makes sense in most cases.
--
Giuseppe "Oblomov" Bilotta
next prev parent reply other threads:[~2008-09-30 10:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-21 20:57 [PATCHv2 0/6] gitweb pathinfo improvements Giuseppe Bilotta
2008-09-21 20:57 ` [PATCH 1/6] gitweb: action in path with use_pathinfo Giuseppe Bilotta
2008-09-21 20:57 ` [PATCH 2/6] gitweb: use_pathinfo filenames start with / Giuseppe Bilotta
2008-09-21 20:57 ` [PATCH 3/6] gitweb: parse parent..current syntax from pathinfo Giuseppe Bilotta
2008-09-21 20:57 ` [PATCH 4/6] gitweb: use_pathinfo creates parent..current paths Giuseppe Bilotta
2008-09-21 20:57 ` [PATCH 5/6] gitweb: remove PATH_INFO from $my_url and $my_uri Giuseppe Bilotta
2008-09-21 20:57 ` [PATCH 6/6] gitweb: prevent double slashes in PATH_INFO hrefs Giuseppe Bilotta
2008-09-29 18:12 ` Jakub Narebski
2008-09-29 8:33 ` [PATCH 5/6] gitweb: remove PATH_INFO from $my_url and $my_uri Jakub Narebski
2008-09-29 13:05 ` Giuseppe Bilotta
2008-09-29 1:08 ` [PATCH 2/6] gitweb: use_pathinfo filenames start with / Jakub Narebski
2008-09-29 14:12 ` Giuseppe Bilotta
2008-09-29 23:20 ` Jakub Narebski
2008-09-30 7:48 ` Giuseppe Bilotta
2008-09-30 23:49 ` Jakub Narebski
2008-09-29 1:03 ` [PATCH 1/6] gitweb: action in path with use_pathinfo Jakub Narebski
2008-09-29 14:22 ` Giuseppe Bilotta
2008-09-30 0:21 ` Jakub Narebski
2008-09-30 8:05 ` Giuseppe Bilotta
2008-09-30 8:48 ` Jakub Narebski
2008-09-30 10:40 ` Giuseppe Bilotta [this message]
2008-09-30 11:22 ` Jakub Narebski
2008-09-30 12:53 ` Giuseppe Bilotta
2008-09-30 21:00 ` Jakub Narebski
2008-09-30 23:24 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb7bb73a0809300340t79a497fey4ededd960223fcdd@mail.gmail.com \
--to=giuseppe.bilotta@gmail.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=lewiemann@gmail.com \
--cc=pasky@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.