All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gitweb: don't use pathinfo for global actions
@ 2009-01-02 11:34 Giuseppe Bilotta
  2009-01-06 17:37 ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe Bilotta @ 2009-01-02 11:34 UTC (permalink / raw)
  To: git
  Cc: Jakub Narebski, Petr Baudis, Junio C Hamano, Devin Doucette,
	Giuseppe Bilotta

With PATH_INFO urls, actions for the projects list (e.g. opml,
project_index) were being put in the URL right after the base. The
resulting URL is not properly parsed by gitweb itself, since it expects
a project name as first component of the URL.

Accepting global actions in use_pathinfo is not a very robust solution
due to possible present and future conflicts between project names and
global actions, therefore we just refuse to create PATH_INFO URLs when
the project is not defined.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 99f71b4..fa7d8ad 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -830,7 +830,7 @@ sub href (%) {
 	}
 
 	my $use_pathinfo = gitweb_check_feature('pathinfo');
-	if ($use_pathinfo) {
+	if ($use_pathinfo and defined $params{'project'}) {
 		# try to put as many parameters as possible in PATH_INFO:
 		#   - project name
 		#   - action
@@ -845,7 +845,7 @@ sub href (%) {
 		$href =~ s,/$,,;
 
 		# Then add the project name, if present
-		$href .= "/".esc_url($params{'project'}) if defined $params{'project'};
+		$href .= "/".esc_url($params{'project'});
 		delete $params{'project'};
 
 		# since we destructively absorb parameters, we keep this
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: don't use pathinfo for global actions
  2009-01-02 11:34 [PATCH] gitweb: don't use pathinfo for global actions Giuseppe Bilotta
@ 2009-01-06 17:37 ` Jakub Narebski
  2009-01-07 21:19   ` Junio C Hamano
  2009-01-07 21:32   ` Giuseppe Bilotta
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Narebski @ 2009-01-06 17:37 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: git, Petr Baudis, Junio C Hamano, Devin Doucette

On Fri, 2 Jan 2009, Giuseppe Bilotta wrote:

> With PATH_INFO urls, actions for the projects list (e.g. opml,
> project_index) were being put in the URL right after the base. The
> resulting URL is not properly parsed by gitweb itself, since it expects
> a project name as first component of the URL.

Therefore it really needs to be in, as df63fb also by Giuseppe
(gitweb: use href() when generating URLs in OPML) is already in,
and I think gitweb would generate broken OPML and TXT links without
this patch.

> 
> Accepting global actions in use_pathinfo is not a very robust solution
> due to possible present and future conflicts between project names and
> global actions, therefore we just refuse to create PATH_INFO URLs when
> the project is not defined.

I think it is quite robust solution and it makes sense; we use
shortcuts http://git.example.com for projects_list page, and
http://git.example.com/path/to/repo.git for overview 'summary'
action for a project, therefore pathinfo has to look like the
following: http://git.example.com/repo/action/hash with "action"
_after_ "project".  And there is also matter of backward compatibility
of URL (URLs shouldn't break).

Anyway, we have $home_link for default project_list page, which
is path_info without project, and query without query string...

> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>

Acked-by: Jakub Narebski <jnareb@gmail.com>

> ---
>  gitweb/gitweb.perl |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 99f71b4..fa7d8ad 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -830,7 +830,7 @@ sub href (%) {
>  	}
>  
>  	my $use_pathinfo = gitweb_check_feature('pathinfo');
> -	if ($use_pathinfo) {
> +	if ($use_pathinfo and defined $params{'project'}) {
>  		# try to put as many parameters as possible in PATH_INFO:
>  		#   - project name
>  		#   - action
> @@ -845,7 +845,7 @@ sub href (%) {
>  		$href =~ s,/$,,;
>  
>  		# Then add the project name, if present
> -		$href .= "/".esc_url($params{'project'}) if defined $params{'project'};
> +		$href .= "/".esc_url($params{'project'});
>  		delete $params{'project'};
>  
>  		# since we destructively absorb parameters, we keep this

Nice.

> -- 
> 1.5.6.5
> 
> 

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: don't use pathinfo for global actions
  2009-01-06 17:37 ` Jakub Narebski
@ 2009-01-07 21:19   ` Junio C Hamano
  2009-01-07 21:32   ` Giuseppe Bilotta
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2009-01-07 21:19 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Giuseppe Bilotta, git, Petr Baudis, Devin Doucette

Jakub Narebski <jnareb@gmail.com> writes:

> Therefore it really needs to be in, as df63fb also by Giuseppe
> (gitweb: use href() when generating URLs in OPML) is already in,
> and I think gitweb would generate broken OPML and TXT links without
> this patch.
> ...
> Acked-by: Jakub Narebski <jnareb@gmail.com>

Thanks for reminding me.  Queued.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: don't use pathinfo for global actions
  2009-01-06 17:37 ` Jakub Narebski
  2009-01-07 21:19   ` Junio C Hamano
@ 2009-01-07 21:32   ` Giuseppe Bilotta
  1 sibling, 0 replies; 4+ messages in thread
From: Giuseppe Bilotta @ 2009-01-07 21:32 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git, Petr Baudis, Junio C Hamano, Devin Doucette

On Tue, Jan 6, 2009 at 6:37 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> On Fri, 2 Jan 2009, Giuseppe Bilotta wrote:
>> Accepting global actions in use_pathinfo is not a very robust solution
>> due to possible present and future conflicts between project names and
>> global actions, therefore we just refuse to create PATH_INFO URLs when
>> the project is not defined.
>
> I think it is quite robust solution and it makes sense; we use
> shortcuts http://git.example.com for projects_list page, and
> http://git.example.com/path/to/repo.git for overview 'summary'
> action for a project, therefore pathinfo has to look like the
> following: http://git.example.com/repo/action/hash with "action"
> _after_ "project".  And there is also matter of backward compatibility
> of URL (URLs shouldn't break).
>
> Anyway, we have $home_link for default project_list page, which
> is path_info without project, and query without query string...

Today I had this idea: a possible way to have global actions into the
path would be to use an invalid project name, but I'm not sure if
there ARE invalid project names at all. Maybe using something very
abstruse such as _projects_ (underscore "projects" underscore) or even
just _ (underscore).

The only thing I can think of for which global actions in path WOULD
be interesting would be that project tag paths would become something
like http://git.example.com/_/tag/sometagname which can be tagged by
the rel-tag microformat http://microformats.org/wiki/rel-tag ...

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-07 21:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-02 11:34 [PATCH] gitweb: don't use pathinfo for global actions Giuseppe Bilotta
2009-01-06 17:37 ` Jakub Narebski
2009-01-07 21:19   ` Junio C Hamano
2009-01-07 21:32   ` Giuseppe Bilotta

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.