diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-08-09 19:55:53 +0200 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-08-09 19:55:53 +0200 |
commit | 460ae51fc0e70dd2d7fcef4bdb92308269327f1d (patch) | |
tree | 4d9eb74d49ec5fcdfb362345c5667c400c2cc2ea /Bugzilla/CGI.pm | |
parent | dbc5625130931706a14de0bb88ecc5d1d2bdf3fb (diff) | |
download | bugzilla-460ae51fc0e70dd2d7fcef4bdb92308269327f1d.tar.gz bugzilla-460ae51fc0e70dd2d7fcef4bdb92308269327f1d.tar.xz |
Bug 903514 - Backport upstream bug 569177 for etag support to bmo/4.2
Diffstat (limited to 'Bugzilla/CGI.pm')
-rw-r--r-- | Bugzilla/CGI.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 55b6a999c..ce7cdf429 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -235,6 +235,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 '*') { + return 1; + } + } + + return 0; +} + # Overwrite to ensure nph doesn't get set, and unset HEADERS_ONCE sub multipart_init { my $self = shift; |