git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 2/3] gitweb: Use underscore instead of hyphen to separate words in HTTP headers names
Date: Tue, 22 Aug 2006 16:55:34 +0200	[thread overview]
Message-ID: <200608221655.34246.jnareb@gmail.com> (raw)
In-Reply-To: <200608221651.19629.jnareb@gmail.com>

Use underscore (which will be turned into hyphen) to separate words in
HTTP header names, in keys to CGI header() method, consistently.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Sometimes using quites for header() keys and sometimes not was not
a good practice.

Excerpt from CGI(3pm):

       The last example shows the named argument style for passing arguments to
       the CGI methods using named parameters.  Recognized parameters are -type,
       -status, -expires, and -cookie.  Any other named parameters will be
       stripped of their initial hyphens and turned into header fields, allowing
       you to specify any HTTP header you desire.  Internal underscores will be
       turned into hyphens:

           print header(-Content_length=>3002);


 gitweb/gitweb.perl |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 182fe33..f59213e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2202,7 +2202,8 @@ sub git_blob_plain {
 		$save_as .= '.txt';
 	}
 
-	print $cgi->header(-type => "$type", '-content-disposition' => "inline; filename=\"$save_as\"");
+	print $cgi->header(-type => "$type",
+	                   -content_disposition => "inline; filename=\"$save_as\"");
 	undef $/;
 	binmode STDOUT, ':raw';
 	print <$fd>;
@@ -2386,8 +2387,8 @@ sub git_snapshot {
 	my $filename = basename($project) . "-$hash.tar.$suffix";
 
 	print $cgi->header(-type => 'application/x-tar',
-	                   -content-encoding => $ctype,
-	                  '-content-disposition' => "inline; filename=\"$filename\"",
+	                   -content_encoding => $ctype,
+	                   -content_disposition => "inline; filename=\"$filename\"",
 	                   -status => '200 OK');
 
 	open my $fd, "-|", "$GIT tar-tree $hash \'$project\' | $command" or
@@ -2705,7 +2706,7 @@ sub git_commitdiff_plain {
 
 	print $cgi->header(-type => "text/plain",
 	                   -charset => 'utf-8',
-	                  '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
+	                   -content_disposition => "inline; filename=\"git-$hash.patch\"");
 	my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
 	my $comment = $co{'comment'};
 	print "From: $co{'author'}\n" .
-- 
1.4.1.1

  parent reply	other threads:[~2006-08-22 14:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-22 14:51 [PATCH 0/3] gitweb: Yet another cleanup series Jakub Narebski
2006-08-22 14:52 ` [PATCH 1/3] gitweb: Whitespace cleanup: realign, reindent Jakub Narebski
2006-08-23  1:34   ` Junio C Hamano
2006-08-23  8:55     ` Jakub Narebski
2006-08-23  9:07       ` Andreas Ericsson
2006-08-23  9:55       ` Junio C Hamano
2006-08-22 14:55 ` Jakub Narebski [this message]
2006-08-22 14:59 ` [PATCH 3/3] gitweb: Route rest of action subroutines through %actions Jakub Narebski
2006-08-22 15:03 ` [PATCH 0/3] gitweb: Yet another cleanup series Jakub Narebski
2006-08-22 21:42 ` [PATCH 4/3] gitweb: Use here-doc Jakub Narebski
2006-08-22 21:54   ` Jakub Narebski
2006-08-23  1:34   ` Junio C Hamano

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=200608221655.34246.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /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 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).