#use warnings;
use utf8;
use feature 'state';
+use experimental 'regex_sets';
use Encode::Locale;
use Encode ('encode', 'decode');
use Exporter;
-our $VERSION = '1.1.3';
+our $VERSION = '1.1.4';
our @ISA = qw(Exporter);
our @EXPORT = ();
our @EXPORT_OK = (
}
}
# Line starts with a name followed by colon/equal sign. Save the value
- elsif ($line =~ /^([ -9;-<>-~]+)((:[ \t])|=)/s) {
+ elsif ($line =~ /^((?[[\ -~]-[:=]])+)((:[ \t])|=)/s) {
$name = lc($1);
$value = $';
return 1;
}
-# read_list_file() reads a list file and returns an arral with the data values.
+# read_list_file() reads a list file and returns an array with the data values.
#
# $file is the path to the file to read.
# file will be opened, read, and closed.
sub http_header_line {
(my $name, my $value, my $single_line) = @_;
if (
- ($name !~ /^[\x21\x23-\x27\x2a\x2b\x2d\x2e\x30-\x39\x3d\x41-\x5a\x5e-\x7a\x7c\x7e]+$/s) ||
+ ($name !~ /^(?[[\x21-\x7e]-["\(\),\/:;<>\?\[\\\]\{\|\}]])+$/s) ||
($value !~ /^([^\x00-\x1f\x7f]|((\r?\n)?[ \t]))*$/s)
) {
# name: 'token'
sub http_header_content_disposition {
(my $type, my $filename) = @_;
- if ($type !~ /^[\x21\x23-\x27\x2a\x2b\x2d\x2e\x30-\x39\x3d\x41-\x5a\x5e-\x7a\x7c\x7e]+$/s) {
+ if ($type !~ /^(?[[\x21-\x7e]-["\(\),\/:;<>\?\[\\\]\{\}]])+$/s) {
return '';
}
my $value = lc($type);
if ($filename ne '') {
$value .= '; filename';
- if ($filename =~ /^[\x21\x23-\x27\x2a\x2b\x2d\x2e\x30-\x39\x3d\x41-\x5a\x5e-\x7a\x7c\x7e]+$/s) {
+ if ($filename =~ /^(?[[\x21-\x7e]-["\(\),\/:;<>\?\[\\\]\{\}]])+$/s) {
# token
$value .= '='.$filename;
}
- elsif ($filename =~ /^[\x20-\x21\x23-\x5b\x5d-\x7e]*$/s) {
+ elsif ($filename =~ /^(?[[\x20-\x7e]-["\\]])*$/s) {
# quoted-string
$value .= '="'.$filename.'"';
}
# sub http_header_content_type {
# (my $media_type, my $parameters) = @_;
- # if ($media_type !~ /^[\x21\x23-\x27\x2a\x2b\x2d\x2e\x30-\x39\x3d\x41-\x5a\x5e-\x7a\x7c\x7e]+\/[\x21\x23-\x27\x2a\x2b\x2d\x2e\x30-\x39\x3d\x41-\x5a\x5e-\x7a\x7c\x7e]+$/s) {
+ # if ($media_type !~ /^(?[[\x21-\x7e]-["\(\),\/:;<>\?\[\\\]\{\}])+$/s) {
# return ''
# }
# my $value = media_type;