git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: remove PATH_INFO from $my_url and $my_uri
@ 2008-08-03 18:02 Giuseppe Bilotta
  2008-08-03 19:10 ` Petr Baudis
  0 siblings, 1 reply; 6+ messages in thread
From: Giuseppe Bilotta @ 2008-08-03 18:02 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Petr Baudis, Giuseppe Bilotta

This patch (combined with appropriate server configuration) allows usage
of the gitweb CGI script as DirectoryIndex for the server root even when
the pathinfo feature is enabled.

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ba1f71b..9c8bcab 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -26,6 +26,10 @@ our $cgi = new CGI;
 our $version = "++GIT_VERSION++";
 our $my_url = $cgi->url();
 our $my_uri = $cgi->url(-absolute => 1);
+if (my $path_info = $ENV{"PATH_INFO"}) {
+	$my_url =~ s,$path_info$,,;
+	$my_uri =~ s,$path_info$,,;
+}
 
 # core git executable to use
 # this can just be "git" if your webserver has a sensible PATH
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* gitweb pathinfo improvements
@ 2008-09-03  9:57 Giuseppe Bilotta
  2008-09-03  9:57 ` [PATCH] gitweb: action in path with use_pathinfo Giuseppe Bilotta
  0 siblings, 1 reply; 6+ messages in thread
From: Giuseppe Bilotta @ 2008-09-03  9:57 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Petr Baudis, Lea Wiemann


The following patchset improves on gitweb's support for PATH_INFO
by supporting paths in the form project/action/[parent..]hash,
both in generating them and in accepting them. The old path info
style project/hash is still supported as long as it doesn't
conflict with the new style

For those that prefer git trees to patch bombs, my git tree is
available for gitweb browsing at http://git.oblomov.eu/git and for
git cloning at git://git.oblomov.eu/git/git

The changes are very local to the PATH_INFO parsing and creation,
so I hope they don't conflict with Lea's cache work.

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH] gitweb: remove PATH_INFO from $my_url and $my_uri
@ 2008-09-29 13:07 Giuseppe Bilotta
  2008-09-29 13:39 ` Jakub Narebski
  2008-10-02 14:22 ` Petr Baudis
  0 siblings, 2 replies; 6+ messages in thread
From: Giuseppe Bilotta @ 2008-09-29 13:07 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Junio C Hamano, Shawn O. Pearce, Giuseppe Bilotta

This patch fixes PATH_INFO handling by removing the relevant part from
$my_url and $my_uri, thus making it unnecessary to specify them by hand
in the gitweb configuration.

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index da474d0..ffe3dbf 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -27,6 +27,13 @@ our $version = "++GIT_VERSION++";
 our $my_url = $cgi->url();
 our $my_uri = $cgi->url(-absolute => 1);
 
+# if we're called with PATH_INFO, we have to strip that
+# from the URL to find our real URL
+if (my $path_info = $ENV{"PATH_INFO"}) {
+	$my_url =~ s,\Q$path_info\E$,,;
+	$my_uri =~ s,\Q$path_info\E$,,;
+}
+
 # core git executable to use
 # this can just be "git" if your webserver has a sensible PATH
 our $GIT = "++GIT_BINDIR++/git";
-- 
1.5.6.5

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

end of thread, other threads:[~2008-10-02 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-03 18:02 [PATCH] gitweb: remove PATH_INFO from $my_url and $my_uri Giuseppe Bilotta
2008-08-03 19:10 ` Petr Baudis
  -- strict thread matches above, loose matches on Subject: below --
2008-09-03  9:57 gitweb pathinfo improvements Giuseppe Bilotta
2008-09-03  9:57 ` [PATCH] gitweb: action in path with use_pathinfo Giuseppe Bilotta
2008-09-03  9:57   ` [PATCH] gitweb: use_pathinfo filenames start with / Giuseppe Bilotta
2008-09-03  9:57     ` [PATCH] gitweb: parse parent..current syntax from pathinfo Giuseppe Bilotta
2008-09-03  9:57       ` [PATCH] gitweb: use_pathinfo creates parent..current paths Giuseppe Bilotta
2008-09-03  9:57         ` [PATCH] gitweb: remove PATH_INFO from $my_url and $my_uri Giuseppe Bilotta
2008-09-29 13:07 Giuseppe Bilotta
2008-09-29 13:39 ` Jakub Narebski
2008-10-02 14:22 ` Petr Baudis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).