Thread (51 messages) flat view 51 messages, 2 authors, 2016-06-15

Re: [PATCH 14/18] gitweb: add print_transient_header() function for central header printing

From: "J.H." <warthog9@eaglescrag.net>
Date: 2016-06-15 22:50:13

quoted
+sub print_transient_header {
+	print $::cgi->header(
Why you use $::cgi->header() instead of equivalent $cgi->header()?
Note that $::cgi->header() is $main::cgi->header(), and is not
CGI::header().
Because $main::cgi already was setup.  Since I'm not redefining $cgi
anywhere they evaluate to the same thing since cgi is already a global
variable coming from gitweb itself.

The way I have it now is it's more explicit to being the parent (main).
 It doesn't really matter either way, but I can change it if you like.
quoted
+				-type=>'text/html',
+				-charset => 'utf-8',
+				-status=> 200,
+				-expires => 'now',
+				# HTTP/1.0
+				-Pragma => 'no-cache',
+				# HTTP/1.1
+				-Cache_Control => join(
+							', ',
+							qw(
+								private
+								no-cache
+								no-store
+								must-revalidate
+								max-age=0
+								pre-check=0
+								post-check=0
+							)
+						)
+				);
+	return;
+}
Why not use

	our %no_cache = (
		# HTTP/1.0
		-Pragma => 'no-cache',
		# HTTP/1.1
		-Cache_Control => join(', ', qw(private no-cache no-store must-revalidate
		                                max-age=0 pre-check=0 post-check=0)),
	);

(or something like that).  This way you can reuse it even if content
type is different (e.g. 'text/plain').

But that is just a proposal.
Finer grained control, though they have the same basic setup.  Probably
will add that, though it's not that big of a deal.

- John 'Warthog9' Hawley
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help