view release on metacpan or search on metacpan
lib/Apache/Solr/JSON.pm view on Meta::CPAN
sub request($$;$$)
{ my ($self, $url, $result, $body, $body_ct) = @_;
if(ref $body && ref $body ne 'SCALAR')
{ $body_ct ||= 'application/json; charset=utf-8';
$body = \$self->json->encode($body);
}
# Solr server 3.6.2 seems not to detect the JSON input from the
# body content, so requires this work-around
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TS/AdminClient.pm view on Meta::CPAN
proxy.config.http.cache.guaranteed_min_lifetime
proxy.config.http.cache.heuristic_lm_factor
proxy.config.http.cache.heuristic_max_lifetime
proxy.config.http.cache.heuristic_min_lifetime
proxy.config.http.cache.http
proxy.config.http.cache.ignore_accept_charset_mismatch
proxy.config.http.cache.ignore_accept_encoding_mismatch
proxy.config.http.cache.ignore_accept_language_mismatch
proxy.config.http.cache.ignore_accept_mismatch
proxy.config.http.cache.ignore_authentication
proxy.config.http.cache.ignore_client_cc_max_age
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Tika.pm view on Meta::CPAN
);
# Check for errors
# TODO
return decode_utf8($response->decoded_content(charset => 'none'));
}
sub meta {
my ($self, $bytes, $contentType) = @_;
my $meta = $self->_request(
view all matches for this distribution
view release on metacpan or search on metacpan
examples/templates/layout 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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>mysite.com :: [% title %]</title>
<link rel="shortcut icon" href="/images/favicon.png" type="image/png"/>
<link rel="stylesheet" href="/css.css" title="Simple" />
</head>
<body>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/UploadMeter/Resources/JavaScript.pm view on Meta::CPAN
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
};
if (this.method == 'post') {
headers['Content-type'] = this.options.contentType +
(this.options.encoding ? '; charset=' + this.options.encoding : '');
/* Force "Connection: close" for older Mozilla browsers to work
* around a bug where XMLHttpRequest sends an incorrect
* Content-length header. See Mozilla Bugzilla #246651.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/WebDAV.pm view on Meta::CPAN
# Update: this happens if you connect with a regular browser, or if you
# connect using IE but don't check the Web Folder box. So just print a
# warning.
elsif($handler->test('d', $path))
{
$r->content_type('text/html; charset="utf-8"');
$r->send_http_header();
$r->print("If you are using IE, please use File -> Open and check the
Open As Web Folder box.");
}
else
lib/Apache/WebDAV.pm view on Meta::CPAN
{
$r->header_out('Last-Modified', $handler->modtime($path));
}
elsif($handler->test('d', $path))
{
$r->content_type('text/html; charset="utf-8"');
$r->send_http_header();
}
else
{
return NOT_FOUND;
lib/Apache/WebDAV.pm view on Meta::CPAN
{
return NOT_FOUND;
}
$r->status(207);
$r->content_type('text/xml; charset="utf-8"');
my @files;
if($depth == 0)
{
lib/Apache/WebDAV.pm view on Meta::CPAN
$multistat->addChild($response);
}
$r->status(207);
$r->content_type('text/xml; charset="utf-8"');
$r->send_http_header();
if(!$r->header_only())
{
$r->print($doc->toString(1));
view all matches for this distribution
view release on metacpan or search on metacpan
Wyrd/Form.pm view on Meta::CPAN
$default =~ s/\/$remove_form$//;
$default .= "/" . $self->{'_current_form'} unless ($self->_flags->no_grow);
my $action = ($self->{'_action_index'}->{$self->{'_current_form'}} || $self->{'action'} || $default);
my $method = ($self->{'method'} || 'post');
my $extra_attributes = '';
foreach my $attribute (qw(enctype accept-charset onsubmit)) {
my $attribute_value = $self->{$attribute};
if ($attribute_value) {
$extra_attributes .= qq( $attribute="$attribute_value");
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/XPointer/RDQL/RDFStore.pm view on Meta::CPAN
=over 4
=item * B<multipart/mixed>
--match
Content-type: text/xml; charset=UTF-8
<rdf:RDF
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:rdfstore='http://rdfstore.sourceforge.net/contexts/'
xmlns:voc0='http://purl.org/rss/1.0/'>
lib/Apache/XPointer/RDQL/RDFStore.pm view on Meta::CPAN
<voc0:link>http://feeds.feedburner.com/BenHammersleysDangerousPrecedent?m=1</voc0:link>
</rdf:Description>
</rdf:RDF>
--match
Content-type: text/xml; charset=UTF-8
<rdf:RDF
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:rdfstore='http://rdfstore.sourceforge.net/contexts/'
xmlns:voc0='http://purl.org/rss/1.0/'>
lib/Apache/XPointer/RDQL/RDFStore.pm view on Meta::CPAN
$model->add($factory->createStatement($subject,$property,$object));
} @{$res->{'bind'}};
$apache->print(qq(--match\n));
$apache->print(sprintf("Content-type: text/xml; charset=%s\n\n","UTF-8"));
$apache->print(sprintf("%s\n",$model->serialize()));
}
$apache->print(qq(--match--\n));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/XPointer/XPath.pm view on Meta::CPAN
=over 4
=item * B<multipart/mixed>
--match
Content-type: text/xml; charset=UTF-8
<foo xmlns="x-urn:example:foo" xmlns:baz="x-urn:example:baz">
<baz:bar>hello</baz:bar>
</foo>
--match
Content-type: text/xml; charset=UTF-8
<foo xmlns="x-urn:example:foo" xmlns:baz="x-urn:example:baz">
<baz:bar>world</baz:bar>
</foo>
lib/Apache/XPointer/XPath.pm view on Meta::CPAN
$root->addChild($child);
}
$apache->print(qq(--match\n));
$apache->print(sprintf("Content-type: text/xml; charset=%s\n\n",$res->{'encoding'}));
$apache->print($root->toString(1,1));
$apache->print(qq(\n));
}
$apache->print(qq(--match--\n));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/API/Request.pm view on Meta::CPAN
$r = shift( @_ ) if( @_ % 2 );
$self->{request} = $r;
$self->{checkonly} = 0;
$self->SUPER::init( @_ ) || return( $self->pass_error );
$r ||= $self->{request};
$self->{accept_charset} = undef;
$self->{auth} = undef;
$self->{charset} = undef;
$self->{client_api_version} = undef;
$self->{_server_version} = undef;
# Which is an Apache2::Request, but inherits everything from Apache2::RequestRec and APR::Request::Apache2
unless( $self->{checkonly} )
{
lib/Apache2/API/Request.pm view on Meta::CPAN
$self->{apr} = APR::Request::Apache2->handle( $r );
my $headers = $self->headers;
# rfc 6750 <https://tools.ietf.org/html/rfc6750>
my $auth = $headers->{Authorization};
$self->auth( $auth ) if( length( $auth ) );
# Content-Type: application/json; charset=utf-8
my $ctype_raw = $self->content_type;
# Accept: application/json; version=1.0; charset=utf-8
my $accept_raw = $self->accept;
# Returns an array of Module::Generic::HeaderValue objects
my $accept_all = $self->acceptables;
my( $ctype_def, $ctype );
if( defined( $ctype_raw ) && CORE::length( $ctype_raw // '' ) )
{
$ctype_def = Module::Generic::HeaderValue->new_from_header( $ctype_raw );
$ctype = lc( $ctype_def->value->first // '' );
$self->type( $ctype );
my $enc = $ctype_def->param( 'charset' );
$self->charset( $enc ) if( defined( $enc ) && length( $enc ) );
}
if( defined( $accept_all ) && !$accept_all->is_empty )
{
my $accept_def = $accept_all->first;
$self->accept_type( $accept_def->value->first );
$self->client_api_version( $accept_def->param( 'version' ) );
$self->accept_charset( $accept_def->param( 'charset' ) );
}
my $json = $self->json;
my $payload = $self->data;
# An error occurred while reading the payload, because even empty, data would return an empty string.
lib/Apache2/API/Request.pm view on Meta::CPAN
sub aborted { return( shift->_try( 'connection', 'aborted' ) ); }
# e.g. text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
sub accept { return( shift->headers->{ 'Accept' } ); }
sub accept_charset { return( shift->_set_get_scalar( 'accept_charset', @_ ) ); }
# e.g. gzip, deflate, br
sub accept_encoding { return( shift->headers->{ 'Accept-Encoding' } ); }
# e.g.: en-GB,fr-FR;q=0.8,fr;q=0.6,ja;q=0.4,en;q=0.2
lib/Apache2/API/Request.pm view on Meta::CPAN
sub brigade_limit { return( shift->_try( 'apr', 'brigade_limit', @_ ) ); }
sub call { return( shift->_try( 'request', @_ ) ); }
sub charset { return( shift->_set_get_scalar( 'charset', @_ ) ); }
sub checkonly { return( shift->_set_get_scalar( 'checkonly', @_ ) ); }
sub child_terminate { return( shift->_try( 'request', 'child_terminate' ) ); }
lib/Apache2/API/Request.pm view on Meta::CPAN
# try-catch
local $@;
eval
{
# This is set during the init() phase
my $charset = $self->charset;
if( defined( $charset ) && $charset )
{
$payload = Encode::decode( $charset, $payload, Encode::FB_CROAK );
}
else
{
$payload = Encode::decode_utf8( $payload, Encode::FB_CROAK );
}
lib/Apache2/API/Request.pm view on Meta::CPAN
# Something like text/html, text/plain or application/json, etc...
$self->{type} = shift( @_ );
}
elsif( !CORE::length( $self->{type} ) )
{
# Content-Type: application/json; charset=utf-8
my $ctype_raw = $self->content_type;
if( defined( $ctype_raw ) )
{
my $ctype_def = Module::Generic::HeaderValue->new_from_header( $ctype_raw ) ||
return( $self->pass_error( Module::Generic::HeaderValue->error ) );
# Accept: application/json; version=1.0; charset=utf-8
my $ctype = lc( $ctype_def->value->first // '' );
$self->{type} = $ctype if( $ctype );
my $enc = $ctype_def->param( 'charset' );
$enc = lc( $enc ) if( defined( $enc ) );
$self->charset( $enc );
}
}
return( $self->{type} );
}
lib/Apache2/API/Request.pm view on Meta::CPAN
$req->acceptable( $array_ref );
# Returns an array object
my $all = $req->acceptables;
my $charset = $req->accept_charset;
# e.g.: gzip, deflate, br
my $encoding = $req->accept_encoding;
# en-GB,fr-FR;q=0.8,fr;q=0.6,ja;q=0.4,en;q=0.2
lib/Apache2/API/Request.pm view on Meta::CPAN
my $status = $req->body_status;
my $limit = $req->brigade_limit;
my $charset = $req->charset;
$req->child_terminate;
my $api_version = $req->client_api_version;
lib/Apache2/API/Request.pm view on Meta::CPAN
Returns the HTTP C<Accept> header value, such as C<text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8>
See also L</headers>
=head2 accept_charset
Sets or gets the acceptable character set. This is computed upon object instantiation by looking at the C<Accept> header:
Accept: application/json; version=1.0; charset=utf-8
Here, it would be C<utf-8>
=head2 accept_encoding
lib/Apache2/API/Request.pm view on Meta::CPAN
=head2 accept_type
Sets or gets the acceptable content type. This is computed upon object instantiation by looking at the C<Accept> header:
Accept: application/json; version=1.0; charset=utf-8
Here, it would be C<application/json>
=head2 accept_version
Sets or gets the version of the api being queried. This is computed upon object instantiation by looking at the C<Accept> header:
Accept: application/json; version=1.0; charset=utf-8
Here, it would be C<1.0>
=head2 acceptable
lib/Apache2/API/Request.pm view on Meta::CPAN
my $bitmask = $req->call( 'allow_override_opts' );
It returns whatever value this call returns.
=head2 charset
Returns the charset, if any, found in the HTTP request received and processed upon initialisation of this module object.
So for example, if the HTTP request C<Content-type> is
Content-Type: application/json; charset=utf-8
Then, L</charset> would return C<utf-8>
See also L</type> to retrieve only the content type, i.e without other information such as charset.
See also L</client_api_version> which would contain the requested api version, if any.
See also L<charset> for the charset provided, if any. For example C<utf-8>
=head2 checkonly
This is also an object initialisation property.
lib/Apache2/API/Request.pm view on Meta::CPAN
Returns the client api version requested, if provided. This is set during the object initialisation phase.
An example header to require api version C<1.0> would be:
Accept: application/json; version=1.0; charset=utf-8
In this case, this would return C<1.0>
=head2 close
lib/Apache2/API/Request.pm view on Meta::CPAN
Retrieves the value of the C<Content-type> header value. See L<Apache2::RequestRec> for more information.
For example:
application/json; charset=utf-8
See also L</type> to retrieve only the content type, i.e without other information such as charset.
See also L</client_api_version> which would contain the requested api version, if any.
See also L<charset> for the charset provided, if any. For example C<utf-8>
=head2 cookie
Returns the current value for the given cookie name, which may be C<undef> if nothing is found.
lib/Apache2/API/Request.pm view on Meta::CPAN
The maximum size of the data that can be transmitted to us over HTTP. By default, there is no limit.
=back
Finally, if a charset is specified, this will also decode it from its encoded charset into perl internal utf8.
This is specifically designed for C<JSON> payload.
It returns a string of data upon success, or sets an L<error|Module::Generic/error> and return C<undef> or an empty list depending on the context.
lib/Apache2/API/Request.pm view on Meta::CPAN
Returns the content type of the request received. This value is set at object initiation phase.
So for example, if the HTTP request C<Content-type> is
Content-Type: application/json; charset=utf-8
Then, L</type> would return C<application/json>
=head2 unparsed_uri
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/ASP/ErrorHandler.pm view on Meta::CPAN
my $msg = <<"ERROR";
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>500 Server Error</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
HTML,BODY {
background-color: #FFFFFF;
}
HTML,BODY,P,DIV {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/Ajax.pm view on Meta::CPAN
the I<Content-Type>, for which I<text/html> is used.
If additional headers are required, they may
be passed as an optional argument in the
form of a hash reference, as in
my $header = {'Content-Type' => 'text/html; charset=utf-8',
'X-err_header_out' => 'err_headers_out',
};
my $ajax = Apache2::Ajax->new($r);
my $html = $ajax->build_html(header => $header);
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
view release on metacpan or search on metacpan
alive request.
0.15 9. Apr 2002
- Added patch from Brian Paulsen which causes correct handling of
non unicode charset (needed for some versions of win9x) and
more verbose debugging output (decoded flags)
0.14 26. Feb 2002
- fixed a problem that page content of Perl sometimes goes to the
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/AutoIndex/XSLT.pm view on Meta::CPAN
}
# Send the appropriate content type
my $content_type = $render
? 'text/html'
: 'text/xml; charset="utf-8"';
$r->content_type($content_type);
return Apache2::Const::OK if $r->header_only;
# The dir_xml subroutine will actually print and output
# all the XML DTD and XML, returning an OK if everything
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/Autocomplete.pm view on Meta::CPAN
the I<Content-Type>, for which I<text/html> is used.
If additional headers are required, they may
be passed as an optional argument into I<run()>in the
form of a hash reference, as in
my $header = {'Content-Type' => 'text/html; charset=utf-8',
'X-err_header_out' => 'err_headers_out',
};
$ac->run($header);
=item * my $r = $ac-E<gt>r;
view all matches for this distribution
view release on metacpan or search on metacpan
t/session/003output_body.t view on Meta::CPAN
open F, ">t/htdocs/tmp/y.html" and print F <<"EOF";
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<meta HTTP-EQUIV=REFRESH CONTENT="0; URL=/klaus/view/index.shtml">
</head>
<body>
<center>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/DirBasedHandler/TT.pm view on Meta::CPAN
return $self->process_template(
$r,
$$args{'tt'},
$$args{'vars'},
qq[blurb.tmpl],
qq[text/plain; charset=utf-8],
);
}
sub super_page {
my $self = shift;
lib/Apache2/DirBasedHandler/TT.pm view on Meta::CPAN
return $self->process_template(
$r,
$$args{'tt'},
$$args{'vars'},
qq[blurb.tmpl],
qq[text/plain; charset=utf-8],
);
}
sub super_dooper_page {
my $self = shift;
lib/Apache2/DirBasedHandler/TT.pm view on Meta::CPAN
return $self->process_template(
$r,
$$args{'tt'},
$$args{'vars'},
qq[blurb.tmpl],
qq[text/plain; charset=utf-8],
);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/DirBasedHandler.pm view on Meta::CPAN
sub root_index {
return (
Apache2::Const::OK,
q[you might want to override "root_index"],
'text/html; charset=utf-8'
);
}
sub set_debug {
$debug = shift;
lib/Apache2/DirBasedHandler.pm view on Meta::CPAN
}
return (
Apache2::Const::OK,
qq[this is the index],
qq[text/plain; charset=utf-8]
);
}
sub super_page {
my $self = shift;
my ($r,$uri_args,$args) = @_;
return (
Apache2::Const::OK,
qq[this is $location/super and all it's contents],
qq[text/plain; charset=utf-8]
);
}
sub super_dooper_page {
my $self = shift;
my ($r,$uri_args,$args) = @_;
return (
Apache2::Const::OK,
qq[this is $location/super/dooper and all it's contents],
qq[text/plain; charset=utf-8]
);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/EmbedMP3.pm view on Meta::CPAN
} else {
return Apache2::Const::FORBIDDEN;
}
} else {
my $md5 = md5_hex($r->filename);
$r->content_type("text/html; charset=utf-8");
my $template = $r->dir_config('template');
my $wpaudioplayer = $r->dir_config("wpaudioplayer");
my $t = Apache2::EmbedMP3::Template->new($template);
view all matches for this distribution
view release on metacpan or search on metacpan
t/MY/CharsetHandler.pm view on Meta::CPAN
use File::Spec::Functions qw(catfile);
use File::Slurp qw(slurp);
sub handler {
my $r = shift;
$r->content_type('text/css; charset=iso-8859-1');
$r->print( slurp(catfile($r->document_root,'test.css')) );
return Apache2::Const::OK;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
t/MY/CharsetHandler.pm view on Meta::CPAN
use File::Spec::Functions qw(catfile);
use File::Slurp qw(slurp);
sub handler {
my $r = shift;
$r->content_type('text/javascript; charset=iso-8859-1');
$r->print( slurp(catfile($r->document_root,'test.js')) );
return Apache2::Const::OK;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/HTML/Detergent.pm view on Meta::CPAN
my $ctx;
unless ($ctx = $f->ctx) {
# turns out some things don't have a type!
my $x = $r->content_type || '';
my ($t, $c) =
($x =~ /^\s*([^;]*)(?:;.*?charset\s*=\s*['"]*([^'"]+)['"]*?)?/i);
$ctx = [$t || 'application/octet-stream', ''];
$f->ctx($ctx);
}
lib/Apache2/HTML/Detergent.pm view on Meta::CPAN
# application/xml is the most reliable content type to
# deliver to browsers that use XSLT.
if ($config->xslt) {
$r->log->debug("forcing $type -> application/xml");
$r->content_type('application/xml; charset=utf-8');
}
# XXX will we need to restore $r->status == 200 to this condition?
if ($r->is_initial_req) {
# BEGIN BUCKET
lib/Apache2/HTML/Detergent.pm view on Meta::CPAN
$doc->insertBefore($pi, $root);
}
}
}
else {
$r->content_type(sprintf '%s; charset=utf-8', $type);
}
#$r->log->debug($r->content_encoding || 'identity');
#$r->log->debug($r->headers_in->get('Content-Encoding'));
# reuse content
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/HttpEquiv.pm view on Meta::CPAN
my $content_type;
while ($token = $p->get_token) {
if ($token->[0] eq 'meta') {
if ($header = $token->[1]{'charset'} and not defined $content_type) {
$content_type = "text/html; charset=$header";
} # end if <meta charset=...>
elsif ($header = $token->[1]{'http-equiv'}) {
if ($header eq 'Content-Type' and not defined $content_type) {
$content_type = $token->[1]{content};
# text/xhtml is not a valid content type:
$content_type =~ s!^text/xhtml(?=\s|;|\z)!text/html!i;
lib/Apache2/HttpEquiv.pm view on Meta::CPAN
=head1 DESCRIPTION
Apache2::HttpEquiv provides a PerlFixupHandler for mod_perl 2 that turns
C<< <meta http-equiv="Header-Name" content="Header Value"> >> into an actual
HTTP header. It also looks for C<< <meta charset="..."> >> and uses it to
set the Content-Type to C<text/html; charset=...>.
If the file claims its Content-Type is 'text/xhtml', the Content-Type
is set to 'text/html' instead. 'text/xhtml' is not a valid
Content-Type, and any file that claims it is probably too broken to
parse as 'application/xhtml+xml'.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/xml2_test.html view on Meta::CPAN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- $Id: xml2_test.html 31 2011-10-25 19:24:53Z jo $ -->
<HTML
xmlns:ns="http://nonsense/"><HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Unix)">
<META NAME="AUTHOR" CONTENT="jo ">
<META NAME="CREATED" CONTENT="20110629;13131700">
<META NAME="CHANGEDBY" CONTENT="jo ">
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/POST200.pm view on Meta::CPAN
$r->status( Apache2::Const::REDIRECT );
$r->status_line( Apache2::RequestUtil::get_status_line(Apache2::Const::REDIRECT) );
$r->headers_out->clear;
$r->err_headers_out->clear;
$r->content_type( 'text/html; charset=iso-8859-1' );
$r->headers_out->{'Content-Length'}=length $msg;
$r->headers_out->{'Location'}=$loc;
$f->ctx( {
dbh=>$dbh,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/PageKit.pm view on Meta::CPAN
my $browser_cache = $config->get_page_attr($page_id,'browser_cache') || $pk->{browser_cache} || 'yes';
$apr->headers_out->{'Expires'} = '-1' if $apr->param('pkit_logout') || $browser_cache eq 'no' || $apr->user;
my $content_type = $output_media;
my $default_output_charset = $view->{default_output_charset};
my @charsets = ();
if($output_media eq 'text/html'){
# first get accepted charsets from incoming Accept-Charset HTTP header
if(my $accept_charset = $apr->headers_in->{'Accept-Charset'}){
my @quality = split(/\s*;\s*/, $accept_charset);
my @accept_charsets = split(/\s*,\s*/, shift @quality);
my $pos = 0;
for ( @accept_charsets ) {
s/^(iso|utf)/\U$1/;
s/^(us\-)?ascii/US-ASCII/;
$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
}
} elsif ($output_media eq 'application/pdf'){
my $fop_command = $config->get_server_attr('fop_command')
|| $config->get_global_attr('fop_command');
lib/Apache2/PageKit.pm view on Meta::CPAN
# call output filter, if applicable
$model->pkit_output_filter($output_ref)
if $model->can('pkit_output_filter');
my ( $converted_data, $retcharset );
if ($output_media eq 'text/html'){
my $data;
while (@charsets){
$retcharset = (shift @charsets)->[0];
eval {
$converted_data = Encode::encode($retcharset, $$output_ref, Encode::FB_CROAK );
};
last unless ($@);
$retcharset = undef;
}
## here no action is needed, if we did not convert the data to anything usefull.
## we deliver in our default_output_charset.
# correct the header
if ($retcharset) {
$content_type = "text/html; charset=$retcharset";
}
else {
$content_type = "text/html; charset=$default_output_charset";
$converted_data = Encode::encode( $default_output_charset, $$output_ref,Encode::FB_DEFAULT );
}
# it is already "text/html"
}
# only pages with propper $retcharset are tranfered gzipped.
# this can maybe changed!? Needs some tests
my $send_gzipped = ( $retcharset && $pk->{use_gzip} eq 'all' );
$apr->content_encoding('gzip') if ($send_gzipped);
$apr->content_type($content_type) unless $apr->main;
if ($send_gzipped) {
lib/Apache2/PageKit.pm view on Meta::CPAN
}
$self->{dbh} = $model->pkit_dbi_connect if $model->can('pkit_dbi_connect');
my $default_lang = $config->get_global_attr('default_lang') || 'en';
my $default_input_charset = $config->get_global_attr('default_input_charset') || 'ISO-8859-1';
my $default_output_charset = $config->get_global_attr('default_output_charset') || 'ISO-8859-1';
my $html_clean_level = $config->get_server_attr('html_clean_level') || 0;
my $can_edit = $config->get_server_attr('can_edit') || 'no';
my $reload = $config->get_server_attr('reload') || 'no';
my $cache_dir = $config->get_global_attr('cache_dir');
lib/Apache2/PageKit.pm view on Meta::CPAN
root_dir => $pkit_root,
view_dir => "$pkit_root/View",
content_dir => "$pkit_root/Content",
cache_dir => $view_cache_dir,
default_lang => $default_lang,
default_input_charset => $default_input_charset,
default_output_charset => $default_output_charset,
reload => $reload,
html_clean_level => $html_clean_level,
input_param_object => $apr,
output_param_object => $self->{output_param_object},
can_edit => $can_edit,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/PodBrowser.pm view on Meta::CPAN
:());
<<"EOF";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>$title</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
<link rel="stylesheet" type="text/css" title="pod_stylesheet" href="$style">
</head>
<body class='podindex'>
$uplink<h1>$title</h1>
lib/Apache2/PodBrowser.pm view on Meta::CPAN
You'll probably need that only for plain text output with the
L<Pod::Simple::Text> parser. Here one can set the content type
of the output.
PerlSetVar CONTENTTYPE "text/plain; charset=UTF-8"
=head3 PARSER and LINKBASE
C<PARSER> sets the POD-to-HTML converter class that is used. It should
support at least the interface that L<Pod::Simple::Text> provides.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/Proxy.pm view on Meta::CPAN
$res->scan( sub { $headers{ $_[0] } = $_[1]; } );
$r->log->debug(
sprintf( "$$ not cookie/auth headers: %s", Dumper( \%headers ) ) )
if VERBOSE_DEBUG;
## Set the response content type from the request, preserving charset
$r->content_type( $headers{'Content-Type'} );
delete $headers{'Content-Type'};
# need to encode content if utf-8
my $charset = $class->response_charset($r, $res);
$r->log->debug("$$ charset is $charset") if DEBUG;
if (($charset ne 'ISO-8859-1') && ($r->content_type !~ m/image|video/)) {
$$response_content_ref = Encode::encode($charset,
$$response_content_ref);
}
#############################
## Content languages
lib/Apache2/Proxy.pm view on Meta::CPAN
$r->no_cache(1);
return 1;
}
# figure out what charset a response was made in, code adapted from
# HTTP::Message::decoded_content
sub response_charset {
my ( $class, $r, $response ) = @_;
# pull apart Content-Type header and extract charset
my $charset;
my @ct = HTTP::Headers::Util::split_header_words(
$response->header("Content-Type") );
if (@ct) {
my ( undef, undef, %ct_param ) = @{ $ct[-1] };
$charset = $ct_param{charset};
}
# if the charset wasn't in the http header look for meta-equiv
unless ($charset) {
# default charset for HTTP::Message - if it couldn't guess it will
# have decoded as 8859-1, so we need to match that when
# re-encoding
return $charset || "ISO-8859-1";
}
}
sub resolve {
my ( $class, $hostname ) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/SSI.pm view on Meta::CPAN
{
$r->log->error( "${class} [PerlOutputFilterHandler]: Failed to decode data from utf8: $@" );
return( &Apache2::Const::DECLINED );
}
#W We just add that the charset is utf-8
$main->content_type( 'text/html; charset=utf-8' ) unless( $main->content_type =~ /\bcharset\n/i );
my $params =
{
apache_filter => $f,
apache_request => $r,
lib/Apache2/SSI.pm view on Meta::CPAN
return( $self->errmsg );
}
# TODO This needs to be improved, as we should not assume the file encoding is utf8
# It could be binary or some other text encoding like iso-2022-jp
# So we should slurp it, parse the meta tags if this is an html and decode if the charset attribute is set or default to utf8
# But this complicates things quite a bit, so for now, it is just utf8 simply
my $html = $f->slurp_utf8;
if( !defined( $html ) )
{
$self->error( "Unable to get html data of included file \"", $f->filename, "\": ", $f->error );
lib/Apache2/SSI.pm view on Meta::CPAN
=head1 Encoding
At present time, the html data are treated as utf8 data and decoded and encoded back as such.
If there is a need to broaden support for other charsets, let me know.
=head1 SSI Directives
This is taken from Apache documentation and summarised here for convenience and clarity to the perl community.
view all matches for this distribution