view release on metacpan or search on metacpan
lib/Apache/ReverseProxy.pm view on Meta::CPAN
and allows you to specify comma separated options for the mapping.
The only option that is currently supported is the B<exact> parameter,
which will make the reverse proxy use exact matching for the first
parameter instead of using regular expressions. This feature
is convenient when the first parameter contains characters
that may need to be escaped or quotemeta'ed. Exact options are
evaluated first. If there isn't an exact match, regular expression
matches are performed. Configuration files may contain comments,
which start with a pound sign. For example:
/news/ http://www.news.com/
view all matches for this distribution
view release on metacpan or search on metacpan
RewritingProxy.pm view on Meta::CPAN
my $r = shift;
my $string = shift;
return($string);
}
# We just escape the necessary crap in the URL we are given so that
# it can then be compared in a regex and all will be happy
sub regexEscape
{
my $url = shift;
# This silly little regex fixes (*&?+|) in the URL for me.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Roaming.pm view on Meta::CPAN
=cut
sub handler ($$) {
my($class, $r) = @_;
my $file = File::Spec->canonpath(URI::Escape::uri_unescape($r->filename()));
if ($file=~/IMAP$/) {
my $addon=$r->the_request();
$addon=~s/IMAP\s(.*)\s.*$/$1/;
$file="$file%20$addon";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SSI.pm view on Meta::CPAN
#
# } elsif ( /\G(\\\\)+/gc ) {
# $out .= '\\' x (length($1)/2);
#
# } elsif ( /\G\\([^\$])/gc ) {
# $out .= &escape_char($1);
#
# } elsif ( /\G\$(\w+)/gc ) {
# $out .= &lookup($1);
#
# } elsif ( /\G\$\{(\w+)\}/gc ) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $msg = shift;
# make sure we do not report errors to ourself, otherwise we go into a circular loop!
# if this was a croak, it means that we should record this error into the main error
# recording system
my $error = $s->escape($msg);
my $employee = '<employee>'.$s->escape("$s->{employee_id} $s->{employee}{name}").
'</employee>' if ($s->{employee_id});
my $in = $s->escape(Data::Dumper->Dump([\%{$s->{in}}]));
my $env = $s->escape(Data::Dumper->Dump([\%{$s->{env}}]));
my $session = $s->escape(Data::Dumper->Dump([\%{$s->{session_data}}]));
my $uri = $s->escape($s->{uri});
my $xml = <<END;
<?xml version="1.0" encoding="UTF-8"?>
<error>
<message>$error</message>
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_radio($key,$value,[$checked],[$desc],[$id]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $checked = shift;
my $desc = shift;
my $id = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_checkbox($key,$value,[$checked],[$desc],[$id]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $checked = shift;
my $desc = shift;
my $id = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_password($key,$value,[$size]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $size = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
my $str = qq(<input type="password" name="$key" value="$value" autocomplete="off");
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_upload($key,[$size],[$class],[$id]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $size = shift;
my $class = shift;
my $id = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_input_email($key,$value,[$size]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $size = shift;
my $class = shift;
my $id = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_input_number($key,$value,[$size]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $size = shift;
my $class = shift;
my $id = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_input($key,$value,[$size]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $size = shift;
my $class = shift;
my $id = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html = $s->html_input($key,$value,[$cols || 40],[$row || 3],[$class]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $cols = shift || 40;
my $rows = shift || 3;
my $class = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my $html $s->html_hidden($key,$value,[$desc],[$id]);
=cut
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
my $desc = shift;
my $id = shift;
$key = "$s->{acfb}::$key" if ($s->{acfb});
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
$str .= qq(\t\t</tr>\n\t</tbody>);
return $str;
}
sub escape {
my $s = shift;
my $string = shift;
$string =~ s/&([^#])/&$1/g;
$string =~ s/"/"/g;
$string =~ s/>/>/g;
$string =~ s/</</g;
# ' is a valid XML entity, but not a valid HTML entity.
# @todo: the ' character is valid HTML and shouldn't need to be escaped.
# However, a lot of the code uses value='' instead of "" so we need
# to leave this in for now.
$string =~ s/'/'/g;
return $string;
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
=head2 format_text
my $string = $s->format_text($string);
Converts newlines to <br>, tabs and 8 spaces to 4 nbsp;. Also does an escape.
=cut
my $s = shift;
my $string = shift;
$string = $s->escape($string);
$string =~ s/\n/<br>\n/g;
$string =~ s/\t/ /g;
$string =~ s/\s{8}/ /g;
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
my @rows = ();
$text =~ s/\s+$//s;
my $row = [];
while ($text=~ m/( (?!")[^,\r\n]* # Handle normal fields
| "(?:["\\]"|[^"])*?" # Handle quoted fields, escaped quotes as "" or \"
)(\r?\n|,|$)
/sgx) {
my $val = defined $1 ? $1 : '';
my $eol = $2;
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
params => "f=edit");
if ($s->{in}{f} eq 'edit') {
open F, "/data/$s->{obase}/template/help/$s->{function}.tt";
while (my $line = <F>) {
$s->{help_text} .= $s->escape($line);
}
close F;
$s->tt('help_edit.tt', { s => $s, });
return;
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
} else {
if ($s->{employee}{admin} && !($s->{object} =~ m/^(me|help)$/)) {
$s->{employee}{object}{$s->{object}}{permission} = 1;
(my $args = $s->{args}) =~ s/=/%3D/g;
$s->add_action(function => 'permission',
params => "return=$s->{function}&return_args=".$s->escape($args))
unless($s->{env}{HIDE_PERMISSION} || $s->{agent});
}
# if we are in autocommit still at this point
# then it probably means there was an error, so we need
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
return $s->html_a("$s->{ubase}/$object/display?$keyfield=$id",$name);
}
sub html_input_calendar {
my $s = shift;
my $key = $s->escape(shift);
my $value = $s->escape(shift);
$key = "$s->{acfb}::$key" if ($s->{acfb});
my $cal = $s->add_calendar($key);
my $str = qq(<input $cal name="$key" value="$value" autocomplete="off" size="12">);
view all matches for this distribution
view release on metacpan or search on metacpan
$requrl = $self->wrap_uri($u->unparse);
}
return $requrl;
}
## (un)wrap a URI, with more armor than Apache::Util::escape_uri
sub wrap_uri {
my $self = shift;
my($u) = @_;
$u = encode_base64($u, '');
$u =~ tr/\+\/\=/-._/;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Browseable/LDAP.pm view on Meta::CPAN
use Apache::Session::Lock::Null;
use Apache::Session::Browseable::Store::LDAP;
use Apache::Session::Generate::SHA256;
use Apache::Session::Serialize::JSON;
use Apache::Session::Browseable::_common;
use Net::LDAP::Util qw(escape_filter_value);
our $VERSION = '1.3.6';
our @ISA = qw(Apache::Session Apache::Session::Browseable::_common);
sub populate {
lib/Apache/Session/Browseable/LDAP.pm view on Meta::CPAN
my ( $class, $args, $selectField, $value, @fields ) = @_;
my $index =
ref( $args->{Index} ) ? $args->{Index} : [ split /\s+/, $args->{Index} ];
if ( grep { $_ eq $selectField } @$index ) {
( $selectField, $value ) = escape_filter_value( $selectField, $value );
return $class->_query( $args, $selectField, $value, @fields );
}
else {
return $class->SUPER::searchOn( $args, $selectField, $value, @fields );
}
lib/Apache/Session/Browseable/LDAP.pm view on Meta::CPAN
my ( $class, $args, $selectField, $value, @fields ) = @_;
my $index =
ref( $args->{Index} ) ? $args->{Index} : [ split /\s+/, $args->{Index} ];
if ( grep { $_ eq $selectField } @$index ) {
( $selectField, $value ) = escape_filter_value( $selectField, $value );
$value =~ s/\\2a/\*/gi;
return $class->_query( $args, $selectField, $value, @fields );
}
else {
return $class->SUPER::searchOn( $args, $selectField, $value, @fields );
view all matches for this distribution
view release on metacpan or search on metacpan
SetWWWTheme.pm view on Meta::CPAN
$newbody = $copyrightnotice . $newbody;
if ($topbar) # if we have a top links bar, we'll put it in
{
# first, we'll clean up the vars and remove all escapes before semicolons.
my $marker;
for ($marker = 0; $marker <= $#topbottomlinks; $marker++)
{
$topbottomlinks[$marker] =~ s/\\;/;/;
SetWWWTheme.pm view on Meta::CPAN
$newbody .= $Theme->MakeTopBottomBar();
}
if ($usenavbar) # This puts the top/bottom nav bars into the
{ # newly-created HTML
# first we have to remove the escapes from our strings.
$nextlink =~ s/\\;/;/g;
$lastlink =~ s/\\;/;/g;
$uplink =~ s/\\;/;/g;
SetWWWTheme.pm view on Meta::CPAN
}
$sidebarmenutitle =~ s/\\;/;/g;
$morelinkstitle =~ s/\\;/;/g;
# Ok, now we have cleaned up all the escaped semicolons. It's time to feed these to
# our module and have fun.
$Theme->SetBGColor($BGCOLOR) if ($BGCOLOR);
$Theme->SetBGPicture($bgpicture) if ($bgpicture);
SetWWWTheme.pm view on Meta::CPAN
=item Module directives
Directives consist of a series of tags within a text file, or within an html
comment block before the <BODY> tag. Valid directive tags are always
terminated with a semicolon. For tags that accept lists as values, elements
are separated by commas. Semicolons may be escaped within a tag. Any
semicolon preceded by a backslash will be considered text, and will not terminate
the directive. The final text will have the escaped semicolon replaced with
a bare semicolon.
@DIRECTIVE=Some string of text\; semicolons are escaped.;
The above directive would set a value of "Some string of text; semicolons
are escaped."
=item @ALINK
HTML and local configuration subject to server configuration
This tag is used to set the HTML BODY setting "alink". This is the
view all matches for this distribution
view release on metacpan or search on metacpan
SimpleTemplate.pm view on Meta::CPAN
my $i = 0;
for (; $i<$#pieces; $i++) {
if ($pieces[$i] =~
m/(.*?)$block_begin([\^\+\\\-\=\:]?)(.*?)\;?(\s*)$/gs) {
my $text = "e_escape($1);
my $encode = $2;
my $block = $3.$4;
if ($s->{debug} > 3) {
print STDERR "==================================TEXT $i:\n";
SimpleTemplate.pm view on Meta::CPAN
}
elsif ($encode eq '+') {
$eval .= '$$____st_out_ .= &Apache::SimpleTemplate::encode('.$block.'); ';
}
elsif ($encode eq '^') {
$eval .= '$$____st_out_ .= &Apache::SimpleTemplate::escape('.$block.'); ';
}
elsif ($encode eq '\\') {
$eval .= '$$____st_out_ .= &Apache::SimpleTemplate::js_escape('.$block.'); ';
}
elsif ($encode eq '-') {
$eval .= &blank_lines($block);
}
SimpleTemplate.pm view on Meta::CPAN
print STDERR "==================================TEXT $i:\n";
print STDERR "$pieces[$i]\n";
print STDERR "==================================\n";
}
$eval .= '$$____st_out_.=\''."e_escape($pieces[$i]).'\'; ';
$eval .= "return (\$____st_out_);\n}";
#if ($usepackage) { $eval .= "1;\n"; }
if ($s->{debug} > 2) {
SimpleTemplate.pm view on Meta::CPAN
return $s;
}
# html-escape a string ('<tag> & " ' becomes '<tag> & "')
sub escape {
my $s = shift;
if (ref $s) { $s = shift; }
return undef unless defined($s);
SimpleTemplate.pm view on Meta::CPAN
$s =~ s/\"/"/g;
return $s;
}
# escape single quotes (') and backslashes (\) with \' and \\
sub quote_escape {
my $s = shift;
if (ref $s) { $s = shift; }
return undef unless defined($s);
$s =~ s/([\'\\])/\\$1/gs;
return $s;
}
# escape single quotes (') and backslashes (\) with \' and \\, newlines and cr's with \n \r
sub js_escape {
my $s = shift;
if (ref $s) { $s = shift; }
return undef unless defined($s);
SimpleTemplate.pm view on Meta::CPAN
the expression's value.
'<%+ %>' is the same as '<%= %>', but the output gets url-encoded.
(mnemonic: '+' is a space in a url-encoded string.)
'<%^ %>'is the same as '<%= %>', but the output gets html-escaped.
(mnemonic: '^' looks like the '<' and '>' that get replaced.)
'<%\ %>'is the same as '<%= %>', except the string gets escaped for
use as a single-quoted javascript var. ("'", "\", NL, CR get escaped.)
=head3 <%- _a_comment_ %>
is ignored and replace by nothing.
(mnemonic: "-" as in "<!-- html comments -->".)
SimpleTemplate.pm view on Meta::CPAN
$s->encode($string) -- url-encode the $string.
&Apache::SimpleTemplate::encode($string)
$s->decode($string) -- url-decode the $string.
&Apache::SimpleTemplate::decode($string)
$s->escape($string) -- html-escape the $string.
&Apache::SimpleTemplate::escape($string)
$s->quote_escape($string) -- single-quote-escape the $string.
&Apache::SimpleTemplate::quote_escape($string)
$s->js_escape($string) -- single-quote and newline escape (for javascript)
&Apache::SimpleTemplate::quote_escape($string)
$s->preload($file) -- preload the template in $file, a full
path which must match the DOCUMENT_ROOT.
(for use in a startup.pl file.)
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
defined $2
? chr($2)
: defined $Pod::Escapes::Name2character_number{$1}
? chr($Pod::Escapes::Name2character_number{$1})
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) {
inc/Module/Install/Metadata.pm view on Meta::CPAN
defined $2
? chr($2)
: defined $mapping->{$1}
? $mapping->{$1}
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Status/DBI.pm view on Meta::CPAN
BEGIN {
if (MP2) {
require mod_perl2;
require Apache2::Module;
*escape_html = sub {
my $s = shift;
$s =~ s/&/&/g;
$s =~ s/</</g;
$s =~ s/>/>/g;
return $s;
}
}
else {
require Apache;
require Apache::Util;
Apache::Util->import(qw(escape_html));
}
}
my %apache_status_menu_items = (
DBI_handles => [ 'DBI Handles', \&apache_status_dbi_handles ],
lib/Apache/Status/DBI.pm view on Meta::CPAN
push @s, sprintf "%sAttributes: %s\n", $pad,
join ", ", grep { $h->{$_} } @boolean_attr;
push @s, sprintf "%sAttributes: %s\n", $pad,
join ", ", map { "$_=".DBI::neat($h->{$_}) } @scalar_attr;
if (my $sql = escape_html($h->{Statement} || '')) {
$sql =~ s/\n/ /g;
push @s, sprintf "%sStatement: <b>%s</b>\n", $pad, $sql;
my $ParamValues = $type eq 'st' && $h->{ParamValues};
push @s, sprintf "%sParamValues: %s\n", $pad,
join ", ", map { "$_=".DBI::neat($ParamValues->{$_}) } sort keys %$ParamValues
lib/Apache/Status/DBI.pm view on Meta::CPAN
push @s, sprintf "%sRows: %s\n", $pad, $h->rows
if $type eq 'st' || $h->rows != -1;
if (defined( my $err = $h->err )) {
push @s, sprintf "%s%s %s %s\n", $pad,
($err ? "Error" : length($err) ? "Warning" : "Information"),
$err, escape_html($h->errstr);
}
push @s, sprintf " sth: %d (%d cached, %d active)\n",
scalar @children, scalar keys %{$h->{CachedKids}||{}}, $h->{ActiveKids}
if @children;
push @s, "\n";
view all matches for this distribution
view release on metacpan or search on metacpan
TaintRequest.pm view on Meta::CPAN
use strict;
use warnings;
use Apache;
use Apache::Util qw(escape_html);
use Taint qw(tainted);
$Apache::TaintRequest::VERSION = '0.10';
@Apache::TaintRequest::ISA = qw(Apache);
TaintRequest.pm view on Meta::CPAN
foreach my $value (@data) {
# Dereference scalar references.
$value = $$value if ref $value eq 'SCALAR';
# Escape any HTML content if the data is tainted.
$value = escape_html($value) if tainted($value);
}
$self->SUPER::print(@data);
}
TaintRequest.pm view on Meta::CPAN
sub handler {
my $r = shift;
$r = Apache::TaintRequest->new($r);
my $querystring = $r->query_string();
$r->print($querystring); # html is escaped...
$querystring =~ s/<script>//;
$r->print($querystring); # html is NOT escaped...
}
=head1 DESCRIPTION
=over 15
TaintRequest.pm view on Meta::CPAN
=back
One of the harder problems facing web developers involves dealing with
potential cross site scripting attacks. Frequently this involves many
calls to Apache::Util::escape_html().
This module aims to automate this tedious process. It overrides the
print mechanism in the mod_perl Apache module. The new print method
tests each chunk of text for taintedness. If it is tainted we assume
the worst and html-escape it before printing.
Note that this module requires that you have the line
PerlTaintCheck on
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Template.pm view on Meta::CPAN
A pair of values can be used to indicate a START_TAG and END_TAG.
TT2Tags <!-- -->
Note that, unlike the Template Toolkit START_TAG and END_TAG
configuration options, these values are automatically escaped to
remove any special meaning within regular expressions.
TT2Tags [* *] # no need to escape [ or *
By default, the start and end tags are set to C<[%> and C<%]>
respectively. Thus, directives are embedded in the form:
[% INCLUDE my/file %].
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TestConfig.pm view on Meta::CPAN
return $cfg;
}
# make a string suitable for feed to shell calls (wrap in quotes and
# escape quotes)
sub shell_ready {
my $arg = shift;
$arg =~ s!\\?"!\\"!g;
return qq["$arg"];
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TopicMaps.pm view on Meta::CPAN
next unless ($param_types->{$p} eq 'Topic');
# maybe alter sidp string
}
$u .= '?'. join( '&' , map { uri_escape($_) .'='. uri_escape($params{$_} )} keys %params );
}
print STDERR $u , "\n";
getTM($result_tm, $u);
}
lib/Apache/TopicMaps.pm view on Meta::CPAN
next unless ($param_types->{$p} eq 'Topic');
# maybe alter sidp string
}
$u .= '?'. join( '&' , map { uri_escape($_) .'='. uri_escape($params->{$_} )} keys %$params );
}
print STDERR $u , "\n";
getTM($tm, $u);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/UploadMeter/Resources/JavaScript.pm view on Meta::CPAN
evalScripts: function() {
return this.extractScripts().map(function(script) { return eval(script) });
},
escapeHTML: function() {
var div = document.createElement('div');
var text = document.createTextNode(this);
div.appendChild(text);
return div.innerHTML;
},
unescapeHTML: function() {
var div = document.createElement('div');
div.innerHTML = this.stripTags();
return div.childNodes[0] ? (div.childNodes.length > 1 ?
$A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) :
div.childNodes[0].nodeValue) : '';
lib/Apache/UploadMeter/Resources/JavaScript.pm view on Meta::CPAN
dasherize: function() {
return this.gsub(/_/,'-');
},
inspect: function(useDoubleQuotes) {
var escapedString = this.replace(/\\/g, '\\\\');
if (useDoubleQuotes)
return '"' + escapedString.replace(/"/g, '\\"') + '"';
else
return "'" + escapedString.replace(/'/g, '\\\'') + "'";
}
});
String.prototype.gsub.prepareReplacement = function(replacement) {
if (typeof replacement == 'function') return replacement;
lib/Apache/UploadMeter/Resources/JavaScript.pm view on Meta::CPAN
_attributes: function(attributes) {
var attrs = [];
for(attribute in attributes)
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
'="' + attributes[attribute].toString().escapeHTML() + '"');
return attrs.join(" ");
},
_children: function(element, children) {
if(typeof children=='object') { // array can hold nodes and text
children.flatten().each( function(e) {
view all matches for this distribution
view release on metacpan or search on metacpan
UpnpImgBrowser.pm view on Meta::CPAN
(split('&', $r->args));
my $image = $in{image};
my $page = $in{page} || 1;
my $dir = $in{dir};
my $dev = uri_unescape($in{dev}) || $gDeviceList[0]->getudn;
$dev =~ s/\+/ /g;
# only rotate up to 360 degrees
if($in{'rot'} >= 360) { $in{'rot'} -= 360 };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/VMonitor.pm view on Meta::CPAN
# alert on workers that worked for a single request for more
# than 15 secs
lastreq_class = wrec.lastreq > 15 ? "alert" : "normal";
wrec.flastreq = "<span class=\"$lastreq_class\">${wrec.flastreq}</span>";
# escape HTML in request URI to prevent cross-site scripting attack
wrec.frequest = HTML.escape(wrec.request);
# line fill spacing (needed for coloured areas)
times = max_request_len - wrec.frequest.length;
line_fill = times > 0 ? space.repeat(times) : "";
lib/Apache/VMonitor.pm view on Meta::CPAN
format_item("Client IP or DNS", rec.client);
format_item("Virtual Host", rec.vhost) IF rec.vhost.length;
# escape HTML in request URI to prevent cross-site scripting attack
rec.frequest = HTML.escape(rec.request);
format_item("Request (first 64 chars)", rec.frequest);
format_item("", "");
USE format_cpu_header = format("%8s %8s %8s %8s %8s");
view all matches for this distribution
view release on metacpan or search on metacpan
VimColor.pm view on Meta::CPAN
our $Position = 0;
our $Cache = {};
return (1);
sub escape_html ($)
{
$_ = shift;
s/\&/&/g;
s/</</g;
VimColor.pm view on Meta::CPAN
s/( +)/' ' x length ($1)/ge;
return ($_);
}
sub escape_tabs ($$)
{
my $value = shift;
my $tabstop = shift;
my $retval = '';
VimColor.pm view on Meta::CPAN
for (my $i = 0; $i < scalar (@$elems); $i++)
{
my $type = $elems->[$i][0];
my $value = $elems->[$i][1];
$value = escape_tabs ($value, $options->{'tabstop'});
$value = escape_html ($value);
if ($type)
{
$output .= qq(<span class="$type">$value</span>);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Validate/varchar.pm view on Meta::CPAN
my $hex = '[a-fA-F\d]';
my $alpha = '[a-zA-Z]'; # No, no locale.
my $alphas = "(?:${alpha}+)";
my $alphanum = '[a-zA-Z\d]'; # Letter or digit.
my $xalphanum = "(?:${alphanum}|%(?:3\\d|[46]$hex|[57][Aa\\d]))";
# Letter or digit, or hex escaped letter/digit.
my $alphanums = "(?:${alphanum}+)";
my $escape = "(?:%$hex\{2})";
my $safe = '[$\-_.+]';
my $extra = "[!*'(),]";
my $reserved = '[;/?:@&=]';
my $uchar = "(?:${alphanum}|${safe}|${extra}|${escape})";
$uchar =~ s/\Q]|[\E//g; # Make string smaller, and speed up regex.
# URL schemeparts for ip based protocols:
my $user = "(?:(?:${uchar}|[;?&=])*)";
my $password = "(?:(?:${uchar}|[;?&=])*)";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/WebDAV.pm view on Meta::CPAN
our $VERSION = '0.01';
use Apache;
use Apache::Constants qw(:response :http);
use Apache::Util qw(unescape_uri escape_uri);
use Data::Dumper;
use Encode;
use File::Spec;
use File::Find::Rule::Filesys::Virtual;
use URI;
lib/Apache/WebDAV.pm view on Meta::CPAN
my $href = $doc->createElement('D:href');
$href->appendText(
File::Spec->catdir(
map { uri_escape encode_utf8 $_ } File::Spec->splitdir($path)
)
);
$resp->addChild($href);
view all matches for this distribution
view release on metacpan or search on metacpan
$processing = $self->dbl->self_path if ($_dbl);
$processing ||= "{COULD NOT PROCESS PATH TO PERL OBJECT}";#assume self_path could be erroneously null
my $id = "($processing -- $caller[0]:$caller[2])";
$value = join(':', $id, $value , "\n". $self->{'_as_html'} . "\n");
if ($_dbl) {
my $htmlvalue = join(':', $id, $value , "<BR>\n". Apache::Util::escape_html($self->{'_as_html'}) . "<BR>\n");
$_dbl->log_event($htmlvalue);
}
die $value;
};
Unlike (X)HTML, however, Wyrds are named like perl modules with the double-colon
syntax (BASENAME::SUBNAME::SUBSUBNAME) and these names are B<case-sensitive>.
Furthermore, either single or double quotes MUST be used around attributes, and
these quotes must match on either side of the enclosed attribute value. Single
quotes may be used, however, to enclose double quotes and vice-versa unless the
entire attribute value is quoted. When in doubt, escape quotes by preceding
them with a backslash (\). B<HTML tags should not appear inside attributes.>
See C<Apache::Wyrd::Template> and C<Apache::Wyrd::Attribute> for common ways
around this limitation.
Also unlike (X)HTML, one Wyrd of one type cannot be embedded in another of the
$self->_debug("$base_class is the base class\n");
$self->_debug("$class is the class\n");
$self->_debug("$params is the params\n");
$self->_debug("$data is the data\n");
my $match = 0;
my (%init, $init_ref, $unescape) = ();
$self->_error("Attempted recursion of $class") if ($data =~ /<$base_class\:\:$class[\s>]/);
#drop the nest identifier
$class =~ s/([^:]):([^:]+)$/$1/ && $self->_info("dropped the nest identifier $2");
#encode the escaped-out " and '
$params =~ s/\\'/<!apostrophe!>/g;
$params =~ s/\\"/<!quote!>/g;
#escape-out special characters when they are the only attribute
$params =~ s/\$/<!dollar!>/g;
$params =~ s/\@/<!at!>/g;
$params =~ s/\%/<!percent!>/g;
$params =~ s/\&/<!ampersand!>/g;
#nullify the blank attributes
view all matches for this distribution
view release on metacpan or search on metacpan
xsl/apache-xbel.xsl view on Meta::CPAN
====================================================================== -->
<!-- this is considered a bug until I can either
a) figure out the correct magic to prevent
JavaScript operators from being escaped.
b) move the JavaScript into a separate file
altogether -->
<xsl:output method = "html" />
<xsl:output indent = "yes" />
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/XPointer/XPath.pm view on Meta::CPAN
my $pointer = undef;
$range =~ s/^\s+//;
$range =~ s/\s+$//;
# FIX ME - hooks to deal with '^' escaped
# parens per the XPointer spec
while ($range =~ /\G\s*xmlns\(([^=]+)=([^\)]+)\)/mg) {
$ns{ $1 } = $2;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/iNcom/Request.pm view on Meta::CPAN
};
$odat ||= {};
$idat ||= {};
my $uri = join "&", map {
if ( exists $odat->{$_} ) {
Apache::Util::escape_uri( $_ ) . "=" .
Apache::Util::escape_uri( $odat->{$_} );
} elsif ( not exists $idat->{$_} ) {
Apache::Util::escape_uri( $_ ) . "=" .
Apache::Util::escape_uri( $fdat->{$_} );
}
} keys %$fdat;
{
no strict 'refs';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/iTunes.pm view on Meta::CPAN
use strict;
use vars qw($VERSION);
use Apache::Constants qw(:common);
use Apache::Util qw(unescape_uri);;
use Mac::iTunes;
use Text::Template;
$VERSION = 0.12;
lib/Apache/iTunes.pm view on Meta::CPAN
{
my $r = shift;
my( undef, $command, @path_info )= split m|/|, ( $r->path_info || '' );
$command = '' unless $command; # silence warning
@path_info = map { unescape_uri( $_ ) } @path_info;
my %params = $r->args;
if( exists $Commands{ $command } )
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/API/Query.pm view on Meta::CPAN
{
my $self = shift( @_ );
my $qs = shift( @_ );
for( split( /[&;]/, $qs ) )
{
my( $key, $value ) = map{ URI::Escape::uri_unescape( $_ ) } split( /=/, $_, 2 );
$key = Encode::decode_utf8( $key ) if( !utf8::is_utf8( $key ) );
$value = Encode::decode_utf8( $value ) if( !utf8::is_utf8( $value ) );
$self->{qq}->{$key} ||= [];
push( @{$self->{qq}->{$key}}, $value ) if( defined( $value ) && $value ne '' );
}
lib/Apache2/API/Query.pm view on Meta::CPAN
my( $self, $arrayref ) = @_;
while( @$arrayref )
{
my $key = shift( @$arrayref );
my $value = shift( @$arrayref );
my $key_unesc = URI::Escape::uri_unescape( $key );
$key_unesc = Encode::decode_utf8( $key_unesc ) if( !utf8::is_utf8( $key_unesc ) );
$self->{qq}->{$key_unesc} ||= [];
if( defined( $value ) && $value ne '' )
{
lib/Apache2/API/Query.pm view on Meta::CPAN
}
else
{
die( "Invalid value found: $value. Not string or arrayref!" );
}
# push @{$self->{qq}->{$key_unesc}}, map { uri_unescape($_) } @values;
for( @values )
{
$_ = URI::Escape::uri_unescape( $_ );
$_ = Encode::decode_utf8( $_ ) if( !utf8::is_utf8( $_ ) );
push( @{$self->{qq}->{$key_unesc}}, $_ );
}
}
}
lib/Apache2/API/Query.pm view on Meta::CPAN
$qq->strip_null;
# Replace all occurrences of the given parameters
$qq->replace(page => $page, foo => 'bar');
# Set the argument separator to use for output (default: unescaped '&')
$qq->separator(';');
# Output the current query string
print "$qq"; # OR $qq->stringify;
# Stringify with explicit argument separator
lib/Apache2/API/Query.pm view on Meta::CPAN
# where values are either scalars or arrayrefs of scalars
$qq = Apache2::API::Query->new($cgi->Vars);
Apache2::API::Query also handles L<CGI.pm>-style hashrefs, where multiple values are packed into a single string, separated by the "\0" (null) character.
All keys and values are URI unescaped at construction time, and are stored and referenced unescaped. So a query string like:
group=prod%2Cinfra%2Ctest&op%3Aset=x%3Dy
is stored as:
'group' => 'prod,infra,test'
'op:set' => 'x=y'
You should always use the unescaped/normal variants in methods i.e.
$qq->replace('op:set' => 'x=z');
NOT:
lib/Apache2/API/Query.pm view on Meta::CPAN
Return the current parameter set as a conventional param=value query string, using $separator as the separator if given. e.g.
foo=1&bar=2&bar=3
Note that all parameters and values are URI escaped by stringify(), so that query-string reserved characters do not occur within elements. For instance, a parameter set of:
'group' => 'prod,infra,test'
'op:set' => 'x=y'
will be stringified as:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/ASP/ModPerl2CGI.pm view on Meta::CPAN
return $s;
}# end new()
#==============================================================================
sub escape
{
my ($s, $str) = @_;
return Apache2::ASP::SimpleCGI->escape( $str );
}# end escape()
#==============================================================================
sub unescape
{
my ($s, $str) = @_;
return Apache2::ASP::SimpleCGI->unescape( $str );
}# end unescape()
#==============================================================================
sub AUTOLOAD
{
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
defined $2
? chr($2)
: defined $Pod::Escapes::Name2character_number{$1}
? chr($Pod::Escapes::Name2character_number{$1})
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) {
inc/Module/Install/Metadata.pm view on Meta::CPAN
defined $2
? chr($2)
: defined $mapping->{$1}
? $mapping->{$1}
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/AuthAny/AuthUtil.pm view on Meta::CPAN
sub goToGATE {
my $r = shift;
my $reason = shift;
my $subReason = shift;
my $request = uri_escape($r->unparsed_uri);
# prevent redirect loops
$request =~ s/aalogin/aadisabled/g;
my $dumped_subReason = $subReason ? ", subReason => " . Data::Dumper::Dumper($subReason) : '';
view all matches for this distribution