File Coverage

blib/lib/Mojolicious/Plugin/DigestAuth/Util.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::DigestAuth::Util;
2              
3 1     1   23363 use strict;
  1         2  
  1         35  
4 1     1   5 use warnings;
  1         2  
  1         31  
5              
6 1     1   5421 use Mojo::Util qw{md5_sum unquote};
  0            
  0            
7             use base 'Exporter';
8              
9             our @EXPORT_OK = qw{checksum parse_header};
10              
11             sub checksum
12             {
13             md5_sum join ':', grep(defined, @_);
14             }
15              
16             sub parse_header
17             {
18             my $header = shift;
19             my $parsed;
20              
21             # TODO: I think there's a browser with a quoting issue that might affect this
22             if($header && $header =~ s/^Digest\s//) {
23             while($header =~ /([a-zA-Z]+)=(".*?"|[^,]+)/g){
24             $parsed->{$1} = unquote($2);
25             }
26             }
27              
28             $parsed;
29             }
30              
31              
32             1;