view release on metacpan or search on metacpan
if( $$ofr =~ m/\G[ \t]+($nctl)$lcrlf/gmco )
{
$val .= $1;
next;
}
if( $name =~ m/content-type/i )
{
$content = 'text/html' if $val=~ m/\btext\/html\b/sio;
$content = 'text/plain' if $val=~ m/\btext\/plain\b/sio;
}
Import: header => 'control'
Controls that the HTTP-header is correct.
This control will follow the HTTP RFC to the point. It reports if the
header is ok, if the content-type is text/html, and the length of the
HTTP-body. That information will be used by other parts of
CGI::Debug. This is done by redirecting STDOUT to a temporary file.
This is the only control that must be set in the beginning of the
program. All other controls can be changed during before the end of
the program.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Easy/Headers.pm view on Meta::CPAN
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'.
view all matches for this distribution
view release on metacpan or search on metacpan
200,
[
'Content-Type' => 'text/html; charset=utf-8',
],
],
'the responder should get a 200 status and content-type header',
);
$post_fh = select;
is($post_fh,$fh,'SelectSaver worked after headers');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Ex.pm view on Meta::CPAN
in itself as the hash.
=item C<-E<gt>content_type>
Can be called multiple times during the same session. Will only
print content-type once. (Useful if you don't know if something
else already printed content-type). Calling this sends the Content-type
header. Trying to print -E<gt>content_type is an error. For clarity,
the method -E<gt>print_content_type is available.
$cgix->print_content_type;
lib/CGI/Ex.pm view on Meta::CPAN
Arguments are the same as those to CGI->new->cookie({}).
Uses CGI's cookie method to create a cookie, but then, depending on
if content has already been sent to the browser will either print
a Set-cookie header, or will add a <meta http-equiv='set-cookie'>
tag (this is supported on most major browsers). This is useful if
you don't know if something else already printed content-type.
=item C<-E<gt>location_bounce>
Depending on if content has already been sent to the browser will either print
a Location header, or will add a <meta http-equiv='refresh'>
tag (this is supported on all major browsers). This is useful if
you don't know if something else already printed content-type. Takes
single argument of a url.
=item C<-E<gt>last_modified>
Depending on if content has already been sent to the browser will either print
a Last-Modified header, or will add a <meta http-equiv='Last-Modified'>
tag (this is supported on most major browsers). This is useful if
you don't know if something else already printed content-type. Takes an
argument of either a time (may be a CGI -expires style time) or a filename.
=item C<-E<gt>expires>
Depending on if content has already been sent to the browser will either print
a Expires header, or will add a <meta http-equiv='Expires'>
tag (this is supported on most major browsers). This is useful if
you don't know if something else already printed content-type. Takes an
argument of a time (may be a CGI -expires style time).
=item C<-E<gt>send_status>
Send a custom status. Works in both CGI and mod_perl. Arguments are
view all matches for this distribution
view release on metacpan or search on metacpan
t/00_internal.t view on Meta::CPAN
my @have = hash_sort $c->_munge_headers('content/foo', '123 blah', 42);
is_deeply \@have, \@want, "First form"
or diag explain "Want:", \@want, "Have:", \@have;
# Second CGI-like form, content-type override
@want = hash_sort (
'-type' => 'content/foo',
'-content_length' => 123,
'-charset' => 'utf-8',
'-status' => '321 bleh',
t/00_internal.t view on Meta::CPAN
);
is_deeply \@have, \@want, "Second form",
or diag explain "Want:", \@want, "Have:", \@have;
# Third CGI-like form, both content-type and status are overridden
@want = hash_sort (
'-type' => 'content/foo',
'-content_length' => 321,
'-charset' => 'utf-8',
'-status' => '111 blerg',
view all matches for this distribution
view release on metacpan or search on metacpan
t/2a-test04.html view on Meta::CPAN
<!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">
<head>
<title>Test</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<!-- JavaScript validation code -->
</head>
<body>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Framework.pm view on Meta::CPAN
=item return_template($scalar)
This method accepts a scalar template name, and returns the content parsed from that template suitable for sending to the client. Internally it takes care of language substitution, and the <cgi_framework_header>, <cgi_framework_footer> tags.
In scalar context it returns the content suitable for sending to the client. In array context it returns the content and the content-type.
=item session($scalar [, $scalar])
This method accepts a scalar key as it's first argument and an optional scalar value as it's second. If a value is supplied, it saves the key+value pair into the session for future retrieval. If no value is supplied, it returns the previously-saved...
lib/CGI/Framework.pm view on Meta::CPAN
}
#
# Takes a template name
# returns scalar output string containing parsed template, with lang and tags substitution
# In array mode also returns a second element which is the content-type
#
sub return_template {
my $self = _getself(\@_);
my $template_name = shift || croak "Template name not supplied";
my $template;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/lib/CGI/Redirect.pm view on Meta::CPAN
$self;
}
sub _build_alias {
+{
'content-type' => 'type',
'cookie' => 'cookies',
'uri' => 'location',
'url' => 'location',
};
}
view all matches for this distribution
view release on metacpan or search on metacpan
bin/testjson.pl view on Meta::CPAN
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $req = HTTP::Request->new(POST => 'https://localhost/cgi-bin/info.pl');
$req->header('content-type' => 'application/json');
$req->content('{ "first": "Nigel", "last": "Horne" }');
my $resp = $ua->request($req);
if($resp->is_success()) {
print "Reply:\n\t", $resp->decoded_content, "\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/Inspect/htdocs/js/jquery.js view on Meta::CPAN
* Sizzle CSS Selector Engine - v0.9.3
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/JSONRPC/Base.js view on Meta::CPAN
if (hdrName != null) {
this._headers[this._headers.length] = {h:hdrName, v:hdrValue};
switch (hdrName.toLowerCase()) {
case 'content-encoding': gotContentEncoding = true; break;
case 'content-length' : gotContentLength = true; break;
case 'content-type' : gotContentType = true; break;
case 'date' : gotDate = true; break;
case 'expires' : gotExpiration = true; break;
case 'last-modified' : gotLastModified = true; break;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CGI/OptimalQuery/SaveSearchTool.pm view on Meta::CPAN
my %email = (
to => $$rec{email_to},
from => $$rec{email_from} || $opts{email_from},
'Reply-To' => $$rec{'email_Reply-To'} || $opts{'email_Reply-To'},
subject => "$$rec{OQ_TITLE} - $$rec{USER_TITLE}",
'content-type' => 'text/html; charset="iso-8859-1"'
);
$email{subject} .= " ($total_new added)" if $total_new > 0;
$email{body} =
"<html>
view all matches for this distribution
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
fields => [qw( name date author version status maturity download_url checksum_sha256 )],
_source => JSON::PP::false,
};
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