[PATCH] gitweb: Make use of $PATH_INFO for project parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow to have project name in the path part of URL, just after the name of
script. For example instead of gitweb.cgi?p=git.git you can write
gitweb.cgi/git.git or gitweb.cgi/git.git/

Not used in URLs inside gitweb; it means that the above alternate syntax
must be generated by hand, at least for now.

Side effect: project name parameter is now stripped of leading and
trailing slash before validation.

Signed-off-by: Jakub Narebski <jnareb@xxxxxxxxx>

---
This is final, correct version of the patch.

 gitweb/gitweb.cgi |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

b9df055ae8d3aafe03744537026823dbaf7342ba
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..e2108de 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -86,8 +86,9 @@ if (defined $order) {
 	}
 }
 
-my $project = $cgi->param('p');
+my $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
 if (defined $project) {
+	$project =~ s|^/||; $project =~ s|/$||;
 	$project = validate_input($project);
 	if (!defined($project)) {
 		die_error(undef, "Invalid project parameter.");
-- 
1.3.0

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]