summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2011-12-26 14:10:52 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2011-12-26 14:10:52 +0100
commit37e65a3c81d24eed2154b08e0c86e4cb44e167d3 (patch)
tree3d2fa291dc014dd3a23efab773948c44c5a8d490 /Bugzilla
parent6d02055deb5a8bbeff15459f150e129bbf725eab (diff)
downloadbugzilla-37e65a3c81d24eed2154b08e0c86e4cb44e167d3.tar.gz
bugzilla-37e65a3c81d24eed2154b08e0c86e4cb44e167d3.tar.xz
Bug 629326: Make it simpler to check ETags
r/a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/CGI.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm
index 9d8a1c48f..e1e6af6ae 100644
--- a/Bugzilla/CGI.pm
+++ b/Bugzilla/CGI.pm
@@ -214,6 +214,26 @@ sub clean_search_url {
}
}
+sub check_etag {
+ my ($self, $valid_etag) = @_;
+
+ # ETag support.
+ my $if_none_match = $self->http('If-None-Match');
+ return if !$if_none_match;
+
+ my @if_none = split(/[\s,]+/, $if_none_match);
+ foreach my $possible_etag (@if_none) {
+ # remove quotes from begin and end of the string
+ $possible_etag =~ s/^\"//g;
+ $possible_etag =~ s/\"$//g;
+ if ($possible_etag eq $valid_etag or $possible_etag eq '*') {
+ print $self->header(-ETag => $possible_etag,
+ -status => '304 Not Modified');
+ exit;
+ }
+ }
+}
+
# Overwrite to ensure nph doesn't get set, and unset HEADERS_ONCE
sub multipart_init {
my $self = shift;