git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 21, 2006, 15:03 UTC
Message-ID
<11509022191149-git-send-email-jnareb@gmail.com>
In-Reply-To
<11509012742493-git-send-email-jnareb@gmail.com>

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@gmail.com>
---
 gitweb/gitweb.cgi |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
63ffc79283d23aeedbdc259e3b069f1e97498e09
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..91698df 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -86,7 +86,8 @@ if (defined $order) {
 	}
 }
 
-my $project = $cgi->param('p');
+my $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
+$project =~ s|^/||; $project =~ s|/$||;
 if (defined $project) {
 	$project = validate_input($project);
 	if (!defined($project)) {
-- 
1.3.0
Previous: Jakub NarebskiNext: Jakub Narebski
Message 2 of 3 in “gitweb: Make use of $PATH_INFO for project parameter”
  1. gitweb: Make use of $PATH_INFO for project parameterJakub Narebski, Jun 21, 2006
  2. gitweb: Make use of $PATH_INFO for project parameterJakub Narebski, Jun 21, 2006
  3. gitweb: Make use of $PATH_INFO for project parameterJakub Narebski, Jun 21, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.