CGI-Easy

 view release on metacpan or  search on metacpan

lib/CGI/Easy/Headers.pm  view on Meta::CPAN

If %headers given, it will be appended to default keys and so may
overwrite default values.

See compose() below about special values in 'Date' and 'Set-Cookie' fields.

While you're free to add/modify/delete any fields in this object/hash,
HTTP headers is case-insensitive, and thus it's possible to accidentally
create different keys in this hash for same HTTP header:

    $h->{'Content-Type'} = 'text/plain';
    $h->{'content-type'} = 'image/png';

To protect against this, compose() allow only keys named in 'Content-Type'
way and will throw exception if it found keys named in other way. There
few exceptions from this rule: 'ETag', 'WWW-Authenticate' and 'Digest-MD5'.

Return created CGI::Easy::Headers object.

=head2 add_cookie

    $h->add_cookie( \%cookie );

lib/CGI/Easy/Util.pm  view on Meta::CPAN


		my ($header, $data) = split /\r\n\r\n/ms, $pair, 2;

		# parse the header
		$header =~ s/\r\n/\n/msg;
		my @headerlines = split /\n/ms, $header;
		my ($name, $filename, $mimetype);

		foreach my $headfield (@headerlines) {
			my ($fname, $fdata) = split /: /ms, $headfield, 2;
			if (lc $fname eq 'content-type') {
				$mimetype = $fdata;
			}
			if (lc $fname eq 'content-disposition') {
				my @dispositionlist = split /; /ms, $fdata;
				foreach my $dispitem (@dispositionlist) {
					next if $dispitem eq 'form-data';
					my ($dispfield,$dispdata) = split /=/ms, $dispitem, 2;
					$dispdata =~ s/\A\"//ms;
					$dispdata =~ s/\"\z//ms;
					if ($dispfield eq 'name') {



( run in 2.761 seconds using v1.01-cache-2.11-cpan-524268b4103 )