view release on metacpan or search on metacpan
lib/CGI/Prototype/Mecha.pm view on Meta::CPAN
$request->headers->scan
(sub {
my ($header, $value) = @_;
if (lc $header eq "content-length") {
$ENV{CONTENT_LENGTH} = $value;
} elsif (lc $header eq "content-type") {
$ENV{CONTENT_TYPE} = $value;
} else {
(my $env = uc "HTTP_$header") =~ tr/-/_/;
## warn "setting \$ENV{$env} to $value\n";
$ENV{$env} = $value;
view all matches for this distribution
view release on metacpan or search on metacpan
t/100.set-cookie.t view on Meta::CPAN
my $cgi = CGI::Simple->new;
like(
$cgi->header(
'-content-type', 'foo/fum', '-set-cookie', [ 'a=b', 'b=c' ]
),
qr/Set-cookie: a=b\s+Set-cookie: b=c/si,
'Set-Cookie'
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Template.pm view on Meta::CPAN
my $redirect = 0;
foreach my $i (keys %passed_hash){
if( $i =~ /-cookie/ ){
$header .= "Set-Cookie: " . $passed_hash{$i} . "\n";
} elsif( $i =~ /-content-type/ ) {
$header =~ s/text\/html/$passed_hash{$i}/;
} elsif( $i =~ /-redirect/ ) {
$header =~ s/Content-type: .*?\n/Status: 302 Found\nLocation: $passed_hash{$i}\n/m;
$redirect++;
lib/CGI/Template.pm view on Meta::CPAN
Returns an HTTP Content-type header. By default, the mimetype returned is C<text/html> but this can be specified. C<header()> accepts options in the form of key/value pairs:
=over 4
=item -content-type
Sets the MIME type value in the header. Some examples:
print $t->header( -content-type => "image/png" );
print $t->header( -content-type => "text/plain" );
=item -redirect
Causes header() to return a HTTP C<Location> header that will redirect the user to a new page. Example:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Test.pm view on Meta::CPAN
{
$env->{$key} = $value unless exists $env->{$key};
}
#
# Object types to create depending on returned content-type.
# If not listed here, "Other" is assummed.
#
$this->{_obj_type} = {'text/plain' => 'Text',
'text/html' => 'HTML',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Tiny.pm view on Meta::CPAN
seek $file, 0, 0;
$value = do { local $/; readline $file };
seek $file, 0, 0;
}
my $value_charset;
if (defined $headers->{'content-type'}) {
if (my ($charset_quoted, $charset_unquoted) = $headers->{'content-type'} =~ m/;\s*charset=(?:"((?:\\[\\"]|[^"])+)"|([^";]+))/i) {
$charset_quoted =~ s/\\([\\"])/$1/g if defined $charset_quoted;
$value_charset = defined $charset_quoted ? $charset_quoted : $charset_unquoted;
}
}
if (defined $value_charset or !defined $headers->{'content-type'} or $headers->{'content-type'} =~ m/^text\/plain\b/i) {
require Encode;
if (defined $value_charset) {
$value = Encode::decode($value_charset, "$value");
} elsif (length $default_charset) {
$value = Encode::decode($default_charset, "$value");
lib/CGI/Tiny.pm view on Meta::CPAN
$filename = Encode::decode($default_charset, "$filename");
}
my $upload = {
filename => $filename,
size => $size,
content_type => $headers->{'content-type'},
};
$upload->{file} = $file if defined $file;
$upload->{content} = $content if defined $content;
push @names, $name unless exists $keyed{$name};
push @ordered, [$name, $upload];
lib/CGI/Tiny.pm view on Meta::CPAN
$headers_str = "Content-Disposition: $value\r\n$headers_str" unless lc $value eq 'inline';
}
if (!$headers_set{location} and $type eq 'redirect') {
$headers_str = "Location: $location\r\n$headers_str";
}
if (!$headers_set{'content-type'} and $type ne 'redirect') {
my $content_type = $self->{response_type};
my $charset = $self->{response_charset};
$charset = 'UTF-8' unless defined $charset;
$content_type =
$type eq 'text' ? "text/plain;charset=$charset"
view all matches for this distribution
view release on metacpan or search on metacpan
UploadEasy.pm view on Meta::CPAN
if ( my $status = $self->{cgi}->cgi_error ) {
_error($self, $status, "Post too large: Maxsize $self->{maxsize} KiB exceeded.");
}
if ( $ENV{REQUEST_METHOD} eq 'POST' and $ENV{CONTENT_TYPE} !~ /^multipart\/form-data\b/i ) {
_error($self, '400 Bad Request', 'The content-type at file uploads shall be '
. "'multipart/form-data'.<br />\nMake sure that the 'FORM' tag includes the "
. 'attribute: enctype="multipart/form-data"');
}
$self->{files} = _upload($self);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Utils.pm view on Meta::CPAN
content type is assumed to be 'text/html'. The charset defaults
to ISO-8859-1. A hash reference can also be passed. E.g.,
print $cgi_obj->getHeader({ content_type => 'text/html', expires => '+3d' });
The names 'content-type', and 'type' are aliases for
'content_type'. The arguments may also be passed CGI.pm style
with a '-' in front, e.g.
print $cgi_obj->getHeader( -content_type => 'text/html', -expires => '+3d' );
lib/CGI/Utils.pm view on Meta::CPAN
my $arg_count = scalar(@args);
if ($arg_count == 0) {
return "Content-Type: text/html\r\n\r\n";
}
if ($arg_count == 1 and ref($args[0]) ne 'HASH') {
# content-type provided
return "Content-Type: $args[0]\r\n\r\n";
}
my $map_list = [ [ 'type', 'content-type', 'content_type' ],
'status',
[ 'cookie', 'cookies' ],
'target', 'expires', 'nph', 'charset', 'attachment',
'mod_perl',
];
lib/CGI/Utils.pm view on Meta::CPAN
}
return 1;
}
if ($arg_count == 1 and ref($args[0]) ne 'HASH') {
# content-type provided
if ($mod_perl) {
$r->err_header_out('Content-Type' => $args[0]);
} else {
print STDOUT "Content-Type: $args[0]\r\n\r\n";
}
lib/CGI/Utils.pm view on Meta::CPAN
my $end_char = substr($eol, -1, 1);
my $buf = '';
my $buf2 = '';
my $file_name = $$disposition_fields{filename};
my $info = { 'Content-Type' => $$headers{'content-type'} };
$$self{_upload_info}{$file_name} = $info;
my $out_fh = CGI::Utils::UploadFile->new_tmpfile($file_name);
while (my $size = $self->_read($fh, $buf, 4096, 0, $end_char)) {
view all matches for this distribution
view release on metacpan or search on metacpan
improvements by Andy Murren <amurren@users.sourceforge.net>
=head1 CREDITS
=item Wilbert Smits <wilbert@telegraafnet.nl> for the header()
function content-type override.
=head1 CHANGES
See Changes file distributed with the module.
view all matches for this distribution
view release on metacpan or search on metacpan
} else {
# Èíà÷å âñå â ïîðÿäêå
$hash{headers}=\%Headers;
$hash{file}=$temp;
$hash{size}=-s $temp;
$hash{type}=$Headers{'content-type'} if $Headers{'content-type'};
}
# Äîáàâëÿåì ïàðàìåòð.
_processPar($name,\%hash,"post");
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
if (!$HeadersSent && IsWebMode()) {
my $ContType="text/html";
unshift(@Headers,"X-Powered-By: CGI::WebOut v$VERSION (http://www.dklab.ru/chicken/4.html), (C) by Dmitry Koterov");
# Èùåì Content-type, ÷òîáû ïîòîì îòïðàâèòü åãî â êîíöå
for (my $i=0; $i<@Headers; $i++) {
if ($Headers[$i]=~/^content-type: *(.*)$/i) {
$ContType = $1; splice(@Headers, $i, 1); $i--;
next;
}
if ($Headers[$i]=~m/^location: /i) {
$Redirected = 1;
view all matches for this distribution
view release on metacpan or search on metacpan
XMLApplication.pm view on Meta::CPAN
debug_msg( 3, "Broken Transformation:\n". $@ ."\n" );
$self->setPanicMsg( "Broken Transformation:\n". $@ );
return -2;
}
# override content-type with the correct content-type
# of the style (is this ok?)
$header{-type} = $style->media_type;
$header{-charset} = $style->output_encoding;
debug_msg( 10, "serialization do output" );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CIPP/Runtime/NewSpirit.pm view on Meta::CPAN
$self->get_utf8 ) {
$mime_type = "text/html; charset=utf-8";
}
if ( $mime_type ne 'cipp/dynamic' ) {
$self->get_http_header->{'content-type'} = $mime_type;
$self->SUPER::print_http_header(@_);
}
1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
Cog/examples/index.html view on Meta::CPAN
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>cog</title>
</head>
<body>
<h1>Profile Cutting Gear Wheels<br>
</h1>
view all matches for this distribution
view release on metacpan or search on metacpan
CachingProxy.pm view on Meta::CPAN
$more_headers{content_range} = "bytes $start-$end/$len";
$more_headers{content_length} = $new;
}
}
print $cgi->header(-status=>$status, -charset=>"", -type=>$res->header( 'content-type' ), %more_headers);
return $start;
}
# }}}
view all matches for this distribution
view release on metacpan or search on metacpan
corpus/dists/Email-MIME-ContentType.changes view on Meta::CPAN
1.012 2006-11-25
- allow carp-avoidance through (ugh) package variable; bug 14076
1.011 2006-10-12
- clearer special case for undef/empty content-type
(thanks, JESSE!)
1.01
- typo fix in documentation by John Linderman.
- new author, Casey West.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPAN/Perl/Releases/MetaCPAN.pm view on Meta::CPAN
sort => [ { date => 'desc' } ],
fields => [qw( name date author version status maturity download_url checksum_sha256 )],
};
my $res = $self->{http}->post($uri, {
content => $self->{json}->encode($query),
headers => { 'content-type' => 'application/json' },
});
if (!$res->{success}) {
my $message = $res->{status} == 599 ? ", $res->{content}" : "";
chomp $message;
$message =~ s/\n/ /g;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPAN/SQLite/Index.pm view on Meta::CPAN
if (my $response =
HTTP::Tiny->new->mirror($ENV{'CPAN_SQLITE_DOWNLOAD_URL'} => catfile($self->{'db_dir'}, $self->{'db_name'})))
{
if ($response->{'success'} and $response->{'status'} and $response->{'status'} eq '200') {
if (my $type = $response->{'headers'}->{'content-type'}) {
if ($type eq 'application/x-sqlite3') {
return 1;
}
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
htdocs/faq.html.es view on Meta::CPAN
<html><meta http-equiv="content-type" content="text/html; charset=UTF-8"><base href="http://cpan.uwinnipeg.ca/htdocs/faqs/faq.html">
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- removed -->
<meta http-equiv="Content-Type" content="text/html ; CHARSET=UTF-8"><head>
<link rel="stylesheet" href="/htdocs/style.css" type="text/css">
<title>FAQ De la Búsqueda de CPAN</title>
view all matches for this distribution
view release on metacpan or search on metacpan
t/ctgetreports.t view on Meta::CPAN
(
"t/var/nntp-testers/$id",
$dumpvars,
%Opt,
);
is $extract->{'fail:t/20-content-types.t'}, 1;
}
{
BEGIN {
$plan += 2;
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/html/index.html view on Meta::CPAN
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>CPAN Testers Administration System</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="0;url=/cgi-bin/pages.cgi" />
</head>
<body>
<p>1..2...1..2...check...check
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/html/js/tiny_mce/plugins/fullpage/js/fullpage.js view on Meta::CPAN
selectByValue(f, 'metarobots', tinymce.trim(va), true, true);
return;
}
switch (eq.toLowerCase()) {
case "content-type":
tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1);
// Override XML encoding
if (tmp != "")
xmlEnc = tmp;
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/html/index.html view on Meta::CPAN
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb">
<head>
<title>The CPAN Testers Preferences Website</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="0;url=/cgi-bin/pages.cgi" />
</head>
<body>
<p>1..2...1..2...check...check
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/html/index.html view on Meta::CPAN
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb">
<head>
<title>CPAN Testers Reports</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="refresh" content="0;url=/cgi-bin/pages.cgi" />
</head>
<body>
<p>1..2...1..2...check...check
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/html/js/tiny_mce/plugins/fullpage/js/fullpage.js view on Meta::CPAN
selectByValue(f, 'metarobots', tinymce.trim(va), true, true);
return;
}
switch (eq.toLowerCase()) {
case "content-type":
tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1);
// Override XML encoding
if (tmp != "")
xmlEnc = tmp;
view all matches for this distribution
view release on metacpan or search on metacpan
html/Base.html view on Meta::CPAN
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Base.pm</title>
<link rel="stylesheet" href="../html/docs.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
view all matches for this distribution
view release on metacpan or search on metacpan
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
#pod
#pod $response = $http->post_form($url, $form_data);
#pod $response = $http->post_form($url, $form_data, \%options);
#pod
#pod This method executes a C<POST> request and sends the key/value pairs from a
#pod form data hash or array reference to the given URL with a C<content-type> of
#pod C<application/x-www-form-urlencoded>. If data is provided as an array
#pod reference, the order is preserved; if provided as a hash reference, the terms
#pod are sorted by key for consistency. See documentation for the
#pod C<www_form_urlencode> method for details on the encoding.
#pod
#pod The URL must have unsafe characters escaped and international domain names
#pod encoded. See C<request()> for valid options and a description of the response.
#pod Any C<content-type> header or content in the options hashref will be ignored.
#pod
#pod The C<success> field of the response will be true if the status code is 2XX.
#pod
#pod =cut
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
# normalized version below.
%$args,
content => $self->www_form_urlencode($data),
headers => {
%$headers,
'content-type' => 'application/x-www-form-urlencoded'
},
}
);
}
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
#pod
#pod If the C<content> option is a code reference, it will be called iteratively
#pod to provide the content body of the request. It should return the empty
#pod string or undef when the iterator is exhausted.
#pod
#pod If the C<content> option is the empty string, no C<content-type> or
#pod C<content-length> headers will be generated.
#pod
#pod If the C<data_callback> option is provided, it will be called iteratively until
#pod the entire response body is received. The first argument will be a string
#pod containing a chunk of the response body, the second argument will be the
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
success => q{},
status => 599,
reason => 'Internal Exception',
content => $e,
headers => {
'content-type' => 'text/plain',
'content-length' => length $e,
},
( @{$args->{_redirects} || []} ? (redirects => delete $args->{_redirects}) : () ),
};
}
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
if ( ref $args->{content} eq 'CODE' ) {
if ( exists $request->{'content-length'} && $request->{'content-length'} == 0 ) {
$request->{cb} = sub { "" };
}
else {
$request->{headers}{'content-type'} ||= "application/octet-stream";
$request->{headers}{'transfer-encoding'} = 'chunked'
unless exists $request->{headers}{'content-length'}
|| $request->{headers}{'transfer-encoding'};
$request->{cb} = $args->{content};
}
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
my $content = $args->{content};
if ( $] ge '5.008' ) {
utf8::downgrade($content, 1)
or die(qq/Wide character in request message body\n/);
}
$request->{headers}{'content-type'} ||= "application/octet-stream";
$request->{headers}{'content-length'} = length $content
unless $request->{headers}{'content-length'}
|| $request->{headers}{'transfer-encoding'};
$request->{cb} = sub { substr $content, 0, length $content, '' };
}
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
$response = $http->post_form($url, $form_data);
$response = $http->post_form($url, $form_data, \%options);
This method executes a C<POST> request and sends the key/value pairs from a
form data hash or array reference to the given URL with a C<content-type> of
C<application/x-www-form-urlencoded>. If data is provided as an array
reference, the order is preserved; if provided as a hash reference, the terms
are sorted by key for consistency. See documentation for the
C<www_form_urlencode> method for details on the encoding.
The URL must have unsafe characters escaped and international domain names
encoded. See C<request()> for valid options and a description of the response.
Any C<content-type> header or content in the options hashref will be ignored.
The C<success> field of the response will be true if the status code is 2XX.
=head2 mirror
inc/bundle/HTTP/Tiny.pm view on Meta::CPAN
If the C<content> option is a code reference, it will be called iteratively
to provide the content body of the request. It should return the empty
string or undef when the iterator is exhausted.
If the C<content> option is the empty string, no C<content-type> or
C<content-length> headers will be generated.
If the C<data_callback> option is provided, it will be called iteratively until
the entire response body is received. The first argument will be a string
containing a chunk of the response body, the second argument will be the
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CSS/Inliner.pm view on Meta::CPAN
treated as ASCII.
Input Parameters:
content - scalar presumably containing both html and css
charset - (optional) programmer specified charset for the passed content
ctcharset - (optional) content-type specified charset for content retrieved via a url
=cut
sub detect_charset {
my ($self,$params) = @_;
lib/CSS/Inliner.pm view on Meta::CPAN
my $meta_charset;
if ($head) {
# pull key header meta elements
my $meta_charset_elem = $head->look_down('_tag','meta','charset',qr/./);
my $meta_equiv_charset_elem = $head->look_down('_tag','meta','http-equiv',qr/content-type/i,'content',qr/./);
# assign meta charset, we give precedence to meta http_equiv content type
if ($meta_equiv_charset_elem) {
my $meta_equiv_content = $meta_equiv_charset_elem->attr('content');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CTK/Util.pm view on Meta::CPAN
Subject => $subject, # to_base64($subject),
Type => $type,
Encoding => 'base64',
Data => Encode::encode('UTF-8', $message)
);
$msg->attr('content-type.charset' => 'UTF-8');
$msg->attr('Content-Transfer-Encoding' => 'base64');
# Attaches
if ($att) {
if (ref($att) =~ /HASH/i) {
view all matches for this distribution
view release on metacpan or search on metacpan
bin/cgi_cvs_evolr view on Meta::CPAN
my $filename;
if ($file->{state} eq 'dead') {
$filename = basename($file->{filename});
}
else {
$filename = "<a class='filename' href='" . $viewcvs . $module . $file->{filename} . "?rev=" . $file->{revision} . "\&content-type=text\%2Fplain\&root=cvs:" . $repository . "'>" . basename($file->{filename}) . "</a>";
}
push @files, {
filename => $filename,
revision => $file->{revision},
date => $file->{date},
view all matches for this distribution
view release on metacpan or search on metacpan
html/ApplicationService.html view on Meta::CPAN
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CaCORE::ApplicationService</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body style="background-color: white">
view all matches for this distribution