view release on metacpan or search on metacpan
lib/Aozora2Epub/CachedGet.pm view on Meta::CPAN
my $r = HTTP::Tiny->new->get($url);
croak "$url: $r->{status} $r->{reason}" unless $r->{success};
$content = $r->{content};
my $encoding = 'utf-8';
my $content_type = $r->{headers}{'content-type'};
unless ($content_type =~ m{text/}) {
$CACHE->set($url, $content);
return $content; # binary
}
if ($content_type =~ /charset=([^;]+)/) {
$encoding = $1;
} elsif ($content =~ m{<meta http-equiv="content-type" content="[^"]+;charset=(\w+)"}i) {
$encoding = $1;
}
$content = Encode::decode($encoding, $content);
$CACHE->set($url, $content);
return $content;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/ASP/CGI.pm view on Meta::CPAN
$self->sent_header(1);
my(@left);
for(split(/\n/, $header)) {
my($name, $value) = split(/\:\s*/, $_, 2);
if($name =~ /content-type/i) {
$self->content_type($value);
} else {
push(@left, $_);
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
examples/htdocs/login.html view on Meta::CPAN
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>
AppSamurai Login
</title>
<meta http-equiv="content-type" content="text/html; charset=us-ascii" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
<style type="text/css">
/*<![CDATA[*/
<!--
view all matches for this distribution
view release on metacpan or search on metacpan
=over 4
=item * accept
=item * content-type
=item * accept-charset
=item * accept-encoding
view all matches for this distribution
view release on metacpan or search on metacpan
t/02cgi.t
t/02perl.t
t/03envdir-cgi.t
t/03envdir.t
t/cgi/all.pl.PL
t/cgi/content-type.pl.PL
t/cgi/env.pl.PL
t/conf/extra.conf.in
t/htdocs/index.html
t/TEST.PL
t/03envdir-include.t
view all matches for this distribution
view release on metacpan or search on metacpan
Resumable.pm view on Meta::CPAN
### headers!
$req->header_out('Accept-Ranges', 'bytes');
$req->header_out('Last-Modified', formattime ($mtime)) ;
$req->header_out('Content-Length', $size) ;
### Setup the content-type
if ($file =~ /\.zip$/i) {
$req->content_type('application/zip');
}
elsif ($file =~ /\.Z$/i) {
$req->content_type('Content-type: application/compress');
view all matches for this distribution
view release on metacpan or search on metacpan
handler() was called as a function instead of a method.
[thumper@bsi.menlo-park.ca.us]
Version: 1.014 Date: 2000/11/06 20:41:00
Previous filters can set content-type via
$r->send_http_header('text/blah'), and the value they set will be used
as the default for subsequent filters. [gyoung@laserlink.net (Geoffrey Young)]
Content-length wasn't being set correctly in send_http_header(). Fixed.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/FilteringProxy.pm view on Meta::CPAN
foreach $strip_cookie (@strip_cookies) {
$Apache::FilteringProxy::strip_cookies{$strip_cookie->getString()} = 1;
$r->warn("config: strip cookie: ".$strip_cookie->getString()) unless ($Apache::FilteringProxy::logging < 1);
}
# get all of the content-type translations we need to perform
# e.g. translating "text-html" to "text/html"
undef %Apache::FilteringProxy::type_translations;
my $type_translation;
foreach $type_translation (@type_translations) {
if ($type_translation->match()->getString() && $type_translation->replace()->getString()) {
lib/Apache/FilteringProxy.pm view on Meta::CPAN
if (($name =~ /^pragma$/i) and ($new_value =~ /^no-cache$/i)) {
$r->warn("setting no_cache(1) since we recieved a pragma='no-cache' header") unless ($Apache::FilteringProxy::logging < 2);
# indirectly set the no-cache headers for the client
$r->no_cache(1);
} elsif ($name =~ m/^(location|content-type|transfer-encoding|last-modified|set-cookie)$/i) {
$r->warn("setting CGI header '$name'='$new_value'") unless ($Apache::FilteringProxy::logging < 2);
$r->cgi_header_out($name, $new_value);
} else {
$r->warn("setting header '$name'='$new_value'") unless ($Apache::FilteringProxy::logging < 2);
lib/Apache/FilteringProxy.pm view on Meta::CPAN
if ($name =~ m/^(location|content-location|content-base|uri|refresh|)$/i) {
# filter redirects so we don't get shot off to a server not proxies
# by us unintentionally and any other data containing domains or URLs
my $val_ref = filter_data($r, \$value);
} elsif ($name =~ m/^content-type$/i) {
# here we are going to see if we need to translate any content-types
# since it is the easiest place to do it
my $content_type = "";
my $charset = "";
if (defined($value)) {
lib/Apache/FilteringProxy.pm view on Meta::CPAN
if ($content_type =~ s/(;.*)//) {
$charset = $1;
}
}
$r->warn("determining if content-type '".$content_type."' needs to be translated...") unless ($Apache::FilteringProxy::logging < 1);
if (exists($Apache::FilteringProxy::type_translations{$content_type})) {
$r->warn("content-type '".$content_type."' needs to be translated") unless ($Apache::FilteringProxy::logging < 1);
if (defined($Apache::FilteringProxy::type_translations{$content_type})) {
$r->warn("caught and translated type '".$content_type.$charset."' to '".$Apache::FilteringProxy::type_translations{$content_type}.$charset."'") unless ($Apache::FilteringProxy::logging < 1);
$r->content_type($Apache::FilteringProxy::type_translations{$content_type}.$charset);
$value = $Apache::FilteringProxy::type_translations{$content_type}.$charset;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/GD/Graph.pm view on Meta::CPAN
=head1 IMPLEMENTATION
This module is implemented as a simple Apache mod_perl handler that generates
and returns a png format graph (using Martien Verbruggen's GD::Graph module)
based on the arguments passed in via a query string. It responds with the
content-type "image/png" (or whatever is set via C<PerlSetVar ImageType>), and
sends a Expires: header of 30 days (or whatever is set via C<PerlSetVar
Expires>, or expires in the query string, in days) ahead.
In addition, it keeps a server-side cache in the file system using DeWitt
Clinton's File::Cache module, whose size can be specified via C<PerlSetVar
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/JAF.pm view on Meta::CPAN
# 4: template variables
# 9: loading additional handlers
# 10: processed template
$self->{debug_level} = $self->{r}->dir_config('Apache_JAF_Debug') || 0;
# Default response status and content-type
$self->{status} = NOT_FOUND;
$self->{type} = 'text/html';
# Default template and includes extensions
$self->{template_ext} = '.html';
lib/Apache/JAF.pm view on Meta::CPAN
Default handler status is C<NOT_FOUND>.
=item type
Default content-type is C<text/html>. You can call C<$self-E<gt>download_type()>
for set unexisting MIME-type to force browser download content instead of viewing it.
=item template_ext, include_ext
Default template extension is C<.html>.
view all matches for this distribution
view release on metacpan or search on metacpan
=head1 DESCRIPTION
An XML Content-Type sniffer. This module reads the encoding
attribute in the xml declaration and returns an appropriate
content-type heading. If no encoding declaration is found it
returns utf-8 or utf-16 depending on the specific encoding.
=head1 CONFIGURATION
There are a few small configuration options for this module,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Mojo.pm view on Meta::CPAN
next unless @value;
$r->headers_out->set($key => shift @value);
$r->headers_out->add($key => $_) foreach (@value);
}
# content-type gets ignored in headers_out()
$r->content_type($headers->header('Content-Type'));
# Response body
my $offset = 0;
while (1) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/PageKit.pm view on Meta::CPAN
$quality[$pos] =~ /^q=(\d+(?:\.\d+)?)/;
push @charsets, [ $_, $1 || '0.1', $pos++ ];
}
@charsets = sort {$b->[1] <=> $a->[1] || $a->[2] <=> $b->[2] } @charsets;
# set a content-type perhaps we overwrite this later if we know about the charset for the output pages
$apr->content_type("text/html");
}
} elsif ($output_media eq 'application/pdf'){
my $fop_command = $config->get_server_attr('fop_command')
view all matches for this distribution
view release on metacpan or search on metacpan
ParseFormData.pm view on Meta::CPAN
my $args = shift;
my $buf = "";
$r->setup_client_block;
$r->should_client_block or return '';
my $ct = $r->headers_in->get('content-type');
if($args->{'disable_uploads'} && index($ct, "multipart/form-data") > -1) {
my $error_str = "[Apache::ParseFormData] file upload forbidden";
$r->notes->set("error-notes" => $error_str);
$r->log_error($error_str);
ParseFormData.pm view on Meta::CPAN
(ref($_->{'values'}) eq "ARRAY") or next;
my ($fh, $path) = @{$_->{'values'}};
seek($fh, 0, 0);
my %hash = (
filename => "",
type => exists($_->{'headers'}->{'content-type'}) ? $_->{'headers'}->{'content-type'} : "",
size => ($fh->stat())[7],
);
my $param = "";
for(@a) {
my ($name, $value) = (/([^=]+)=\"([^\"]+)\"/);
ParseFormData.pm view on Meta::CPAN
$_ or next;
my ($h, $v) = split(/ *: */, $_, 2);
$hash{lc($h)} = $v;
}
$_[0] = \%hash;
return(exists($hash{'content-type'}));
}
sub output_data {
my $dest = shift;
my $data = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/ReverseProxy.pm view on Meta::CPAN
if (defined $origin_ua && length $origin_ua) {
$ua->agent($origin_ua)
}
# copy over the content type
my $content_type = $r->header_in('content-type');
if (defined $content_type && length $content_type) {
$request->header('content-type', $content_type);
}
# copy over the entity body as well
my $entity_body = $r->content();
if (defined $entity_body && length $entity_body) {
view all matches for this distribution
view release on metacpan or search on metacpan
0.3 Wed Aug 17 19:46:04 CEST 2005 (Oslo, Norway)
- added 'application/sparql-results+xml' content-type for DAWG-XML
results as latest spec v1.66 says http://www.w3.org/2001/sw/DataAccess/rf1/
0.2 Wed Apr 13 17:50:24 CEST 2005 (Monte San Savino, Tuscany)
- first query() method implementation using RDFStore SPARQL
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/js/tinymce/jscripts/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
SimpleReplace.pm view on Meta::CPAN
the template, it will insert the request for the first occurrence
only. All other replacement strings will just be stripped from the
template.
Currently, Apache::SimpleReplace will return DECLINED if the
content-type of the request is not 'text/html'.
=head1 SEE ALSO
perl(1), mod_perl(3), Apache(3), Apache::Filter(3)
view all matches for this distribution
view release on metacpan or search on metacpan
SimpleTemplate.pm view on Meta::CPAN
ends execution of the template and redirects browser to '/'.
=head3 <% $s->content_type('text/xml'); %>
sets our content-type to 'text/xml' instead of default 'text/html';
=head3 <%: _perl_code_ %> DEPRECATED
evaluates the perl code, and the block gets replaced by the last
value returned in the perl code, or $out if defined. (included
SimpleTemplate.pm view on Meta::CPAN
$s->cascade_status(0) from included templates
=head2 other methods/functions (mostly useful in templates):
$s->content_type('text/xml') -- set our content-type to something
(must be done before any call to flush().)
$s->status(302) -- set our status to something other than 200
(must be done before any call to flush().)
$s->header($name,$value) -- add an outgoing header. (can add multiple
of the same name.)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Tika/Connection.pm view on Meta::CPAN
}
sub process_response {
my ( $self, $params, $code, $msg, $body, $headers ) = @_;
my $mime_type = $headers->{"content-type"};
my $is_encoded = $mime_type && $mime_type !~ m!^text/plain\b!;
# Request is successful
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Tika.pod view on Meta::CPAN
# Extract text from a website
my $response = LWP::UserAgent->get('http://some.web.site');
my $text = $tika->tika(
$r->decoded_content('charset' => 'none'),
$r->headers->header('content-type')
);
=head1 DESCRIPTION
This module provide Apache Tika api support
lib/Apache/Tika.pod view on Meta::CPAN
=item $tika->language_stream($bytes)
=back
The $bytes parameter is always required and must contain the data to send to the server.
The $contentType is optional, but if know the $bytes content-type (p.e. "text/html; charset=iso-8") you can send it to improve the tika response.
=head1 SEE ALSO
L<Apache Tika|http://wiki.apache.org/tika/TikaJAXRS>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Soap.pm view on Meta::CPAN
$self->{'status'} = $self->{'mp'}->ok;
return {
'error' => 0,
'success' => 1,
'rawdata' => 1,
'content-type' => $e->content_type,
'headers' => $e->headers,
'data' => $e->data
};
}
elsif ($e->isa("Apache::Voodoo::Exception::Application::SessionTimeout")) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Wombat/Response.pm view on Meta::CPAN
return 1 if $self->isCommitted();
return 1 if $self->isIncluded();
my $match = lc $name;
if ($match eq 'content-type') {
$self->setContentLength($value);
} elsif ($match eq 'content-length') {
$self->setContentType($value);
} else {
$self->{apr}->header_out($name => $value);
view all matches for this distribution
view release on metacpan or search on metacpan
non-word characters could cause parsing errors
Fixed bug where Lookup would have a fatal error on the use of
a joiner
Handler now checks for a set content-type header before
defaulting to text/html
Fixed error reporting problem where unblessed references
could be unintentionally treated as objects
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/XPointer/RDQL/RDFStore.pm view on Meta::CPAN
=head1 OPTIONS
=head2 XPointerSendRangeAs
Return matches as one of the following content-types :
=over 4
=item * B<multipart/mixed>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/XPointer/XPath.pm view on Meta::CPAN
=head1 OPTIONS
=head2 XPointerSendRangeAs
Return matches as one of the following content-types :
=over 4
=item * B<multipart/mixed>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/iNcom.pm view on Meta::CPAN
# Request should never be cached
$r->header_out( 'Pragma', 'no-cache' );
$r->header_out( 'Cache-control', 'no-cache' );
$r->no_cache(1);
# Default content-type
$r->content_type( "text/html" );
return OK;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/API/Request.pm view on Meta::CPAN
sub content_type
{
my $self = shift( @_ );
my $ct = $self->headers( 'Content-Type' );
return( $ct ) if( !scalar( @_ ) );
$self->error( "Warning only: caller is trying to use ", ref( $self ), " to set the content-type. Use Apache2::API::Response for that instead." ) if( @_ );
return( $self->request->content_type( @_ ) );
}
# To get individual cookie sent. See APR::Request::Cookie
# APR::Request::Cookie
lib/Apache2/API/Request.pm view on Meta::CPAN
# same
my $is_head = $req->is_header_only;
my $content_type = $req->headers( 'Content-Type' );
# or (since it is case insensitive)
my $content_type = $req->headers( 'content-type' );
# or
my $content_type = $req->headers->{'Content-Type'};
$req->headers( 'Content-Type' => 'text/plain' );
# or
$req->headers->{'Content-Type'} = 'text/plain';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/ASP/ErrorHandler.pm view on Meta::CPAN
$Response->Write( $msg );
$Server->Mail(
To => $Config->errors->mail_errors_to,
From => $Config->errors->mail_errors_from,
Subject => "Apache2::ASP: Error in @{[ $ENV{HTTP_HOST} ]}@{[ $context->r->uri ]}",
'content-type' => 'text/html',
'content-transfer-encoding' => 'base64',
Message => encode_base64( $msg ),
smtp => $Config->errors->smtp_server,
);
view all matches for this distribution
view release on metacpan or search on metacpan
examples/demo-gate/gate.php view on Meta::CPAN
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>AuthAny Login</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="gate.css" />
</head>
<body id="gateBody">
<h1>Apache2::AuthAny Example GATE</h1>
view all matches for this distribution