view release on metacpan or search on metacpan
lib/Apache/Keywords.pm view on Meta::CPAN
4567891011121314#
# This library is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
use
Apache::Cookie;
require
Exporter;
require
AutoLoader;
lib/Apache/Keywords.pm view on Meta::CPAN
3132333435363738394041
README
MANIFEST
=head1 PREREQUISITES
You need Apache::Constants and Apache::Cookie to use Apache::Keywords.
=head1 INSTALLATION
tar zxf Apache-Keywords-0.1.tar.gz
perl Makefile.PL
lib/Apache/Keywords.pm view on Meta::CPAN
200201202203204205206207208209210# profile and re-store it in the cookie
# Get old "keywords" cookie
if
(!
defined
(
$name
) ||
$name
eq
""
) {
$name
=
"Keywords"
;
}
my
$cookie
= Apache::Cookie->new(
$r
);
$keywords
=
$cookie
->get(
$name
);
# Make profile
$keywords
= make_profile(
$keywords
,
$new_keywords
);
if
(
defined
(
$expires
)) {
$cookie
->set(
-expires
=>
$expires
);
lib/Apache/Keywords.pm view on Meta::CPAN
254255256257258259260261262263264
$path
=
$self
->{PATH};
}
elsif
(
$r
) {
$path
=
$r
->dir_config(
'KeywordsPath'
);
}
# Get old "keywords" cookie
my
$cookie
= Apache::Cookie->new(
$r
);
$keywords
=
$cookie
->get(
$name
);
# Make profile
$keywords
= make_profile(
$keywords
,
$new_keywords
);
# Replace the old cookie with a new one
if
(!
defined
(
$expires
) ||
length
(
$expires
) <= 0) {
lib/Apache/Keywords.pm view on Meta::CPAN
view all matches for this distribution
360361362363364365366367368369370371372373374375# Return the profile in a hash
sub
profile {
my
(
$self
,
$r
) =
@_
;
my
(
$keywords
,
$cookie
,
@k
,
@item
,
$i
);
my
%ret
= ();
my
$cookie
= Apache::Cookie->new(
$r
);
my
$name
=
$self
->name;
if
(!
defined
(
$name
) ||
$name
eq
""
) {
$name
=
"Keywords"
;
}
$cookie
= Apache::Cookie->new(
$r
);
$keywords
=
$cookie
->get(
$name
);
@k
=
split
(/\,\s*/,
$keywords
);
for
(
$i
=0;
$i
<=
$#k
;
$i
++) {
@item
=
split
(/\:\s*/,
$k
[
$i
]);
$ret
{
$item
[0]} =
$item
[1];
view release on metacpan or search on metacpan
lib/Apache/LangPrefCookie.pm view on Meta::CPAN
123456789101112131415161718192021package
Apache::LangPrefCookie;
use
strict;
use
warnings;
use
Apache::Request;
use
Apache::Cookie;
use
Apache::Log ();
our
$VERSION
=
'1.03'
;
sub
handler {
my
$r
= Apache::Request->new(
shift
);
my
%cookies
= Apache::Cookie->new(
$r
)->parse;
my
$cookie_name
=
$r
->dir_config(
'LangPrefCookieName'
) ||
'prefer-language'
;
my
@ua_lang_prefs
;
# $r->log->debug("Looking for cookie: \"$cookie_name\"");
$r
->header_out(
'Vary'
,
lib/Apache/LangPrefCookie.pm view on Meta::CPAN
59606162636465666768
} (
$cookie_pref_lang
,
@ua_lang_prefs
);
$language_ranges
=~ s/,\s*$//;
return
DECLINED
unless
length
$language_ranges
;
$r
->header_in(
"Accept-Language"
,
$language_ranges
);
$r
->
log
->debug(
"Cookie \"$cookie_name\" requested \"$cookie_pref_lang\", set \"Accept-Language: $language_ranges\""
);
}
return
OK;
}
lib/Apache/LangPrefCookie.pm view on Meta::CPAN
9798991001011021031041051061071081091101111121131141151161171;
__END__
=head1 NAME
Apache::LangPrefCookie - implant a language-preference given by
cookie into httpd's representation of the Accept-Language HTTP-header.
=head1 SYNOPSIS
<Location />
PerlInitHandler Apache::LangPrefCookie
</Location>
<Location /foo>
# optionally set a custom cookie-name, default is "prefer-language"
PerlSetVar LangPrefCookieName "foo-pref"
</Location>
=head1 DESCRIPTION
lib/Apache/LangPrefCookie.pm view on Meta::CPAN
120121122123124125126127128129130This preference is then implanted into httpd's representation of the
C<Accept-Language> header, just as
if
the client had asked
for
it as
#1
choice. The original preferences are still present, albeit
with
lowered
q-
values
. The cookie's name is configurable, as described in the
examples. Setting/modifying/deleting such a cookie is to be handled
separately; F<Apache::LangPrefCookie> just consumes it.
After that, it
's up to httpd'
s mod_negotiation to choose the best
deliverable representation.
=head2 WHY?
lib/Apache/LangPrefCookie.pm view on Meta::CPAN
view all matches for this distribution
148149150151152153154155156157158159=head1 EXAMPLE COOKIE
C<prefer-language=x-klingon;expires=Saturday 31-Dec-05 24:00:00 GMT;path=/>
Optionally, the default cookie name C<prefer-language> can be overridden
by setting the C<LangPrefCookieName> variable:
C<PerlSetVar LangPrefCookieName "mypref">
C<mypref=x-klingon;expires=Saturday 31-Dec-05 24:00:00 GMT;path=/>
=head1 SEE ALSO
view release on metacpan or search on metacpan
179180181182183184185186187188189
view all matches for this distribution
193194195196197198199200201202
Apache::Log::Spread::handler(
$self
,
$ar
);
}
sub
_interpolate_log_string {
my
(
$self
,
$logref
) =
@_
;
my
$cookie
= My::Cookie->new();
$$logref
=~ s/%\{([\w-]+)\}cookie/
$cookie
->{$1} ||
'-'
/ego;
}
=back
view release on metacpan or search on metacpan
MIMEMapper.pm view on Meta::CPAN
view all matches for this distribution
187188189190191192193194195196197This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.
=head1 HISTORY
This code is derived from the I<Cookbook::MIMEMapper> module,
available as part of "The mod_perl Developer's Cookbook".
For more information, visit http://www.modperlcookbook.org/
=cut
view release on metacpan or search on metacpan
2122232425262728293031sub
process_playlist {
my
$self
=
shift
;
my
$r
=
$self
->r;
my
(
@playlist
,
$changed
);
if
(
my
$cookies
= CGI::Cookie->parse(
$r
->header_in(
'Cookie'
))) {
my
$playlist
=
$cookies
->{playlist};
@playlist
=
$playlist
->value
if
$playlist
;
if
(
$playlist
[-1] &&
$r
->lookup_uri(
$playlist
[-1])->content_type ne
'audio/mpeg'
) {
$self
->{possibly_truncated}++;
view all matches for this distribution
73747576777879808182838485
return
HTTP_NO_CONTENT
unless
@playlist
;
return
$self
->send_playlist(\
@playlist
);
}
if
(
$changed
) {
my
$c
= CGI::Cookie->new(
-name
=>
'playlist'
,
-value
=> \
@playlist
);
tied
(%{
$r
->err_headers_out})->add(
'Set-Cookie'
=>
$c
);
(
my
$uri
=
$r
->uri) =~ s!playlist\.m3u$!!;
$self
->path_escape(\
$uri
);
$r
->err_header_out(
Location
=>
$uri
);
return
REDIRECT;
}
view release on metacpan or search on metacpan
MP3/Playlist.pm view on Meta::CPAN
view all matches for this distribution
9596979899100101102103104
my
$session
=
$self
->session;
$session
->param(
playlist
=>[])
unless
$session
->param(
'playlist'
);
my
$playlist
=
$session
->param(
'playlist'
);
$r
->err_headers_out->add(
'Set-Cookie'
=> CGI::Cookie->new(
-name
=>
'apache_mp3'
,
-value
=>
$session
->id,
));
$playlist
;
}
view release on metacpan or search on metacpan
3456789101112131415161718192021222324## $Id: Motd.pm,v 1.2 2002/11/01 00:39:57 ramirezc Exp $
use
strict;
use
Apache;
use
Apache::Cookie;
$VERSION
=
'1.00'
;
sub
handler {
my
$r
=
shift
;
my
$uri
=
$r
->uri;
my
$cn
=
$r
->dir_config(
'CookieName'
) ||
'seenMOTD'
;
my
$exp
=
$r
->dir_config(
'ExpireCookie'
) ||
'+1d'
;
my
$file
=
$r
->dir_config(
'MessageFile'
) || 0;
my
$cookieless
=
$r
->dir_config(
'SupportCookieLess'
) || 1;
my
$port
= (
$r
->server->port eq
'80'
) ?
""
:
':'
.
$r
->server->port;
my
$tquery
=
$r
->args;
## If the request is the part of the cookie test redirect, then
## take out the ct=1 query_string value and make a note of it
353637383940414243444546474849505152535455565758## MessageFile appears to be missing, pass onto next phase
return
OK
unless
$file
;
return
OK
unless
-e
$file
;
## Look for cookie ($cn) and verify it's value
my
$cookies
= Apache::Cookie->new(
$r
)->parse;
if
(
my
$c
=
$cookies
->{
$cn
}) {
my
$cv
=
$c
->value;
return
OK
if
(
$ct_request
== 0 &&
$cv
eq
'1'
);
displayMotd(
$r
);
return
DONE;
}
## Prepare cookie information and add outgoing headers
my
$cookie
= Apache::Cookie->new(
$r
,
-name
=>
$cn
,
-value
=>
'1'
,
-expires
=>
$exp
);
$cookie
->bake;
## Handle Cookieless clients
if
(
$cookieless
) {
## Apparently this client does not like cookies, pass it on to
## next phase
$r
->log_error(
"Apache::Motd::Bypassed by "
.
$r
->connection->remote_ip)
if
$ct_request
;
120121122123124125126127128129130131132133in your httpd.conf
<Directive /path/>
PerlHeaderParserHandler Apache::Motd
PerlSetVar MessageFile /path/to/motd/message
PerlSetVar CookieName CookieName [
default
: seenMOTD]
PerlSetVar ExpireCookie CookieExpirationTime [
default
: +1d]
PerlSetVar RedirectInSecs N [
default
: 10]
PerlSetVar SupportCookieLess (1|0) [
default
: 1]
=head1 DESCRIPTION
This Apache Perl module provides a web administrator the ability to
configure a webserver with motd (Message of the Day) functionality, just
175176177178179180181182183184185186187188189190191192193194This sets the
wait
time
(in seconds)
before
the visitor is redirected to the
initally requested URI
=item B<CookieName> (default: seenMOTD)
Set the name of the cookie name
=item B<ExpireCookie> (default: +1d, 1 day)
Set the expiration time for the cookie
=item B<SupportCookieLess> (default: 1)
This option is set by default to handle clients that do not support
cookies or that have cookies turned off. It performs an external
redirect to the requested C<$uri> along with a C<ct=1> query_string to test
if the client accepts cookies. If the external redirect successfully sets
197198199200201202203204205206207208209210211212213214215216217Future versions will correctly support non-cookie clients via URL munging.
Setting this option to 0 is ideally used
for
when
you are totally certain
that all your visitors will
accept
cookies. This is usually much faster since
it elminates the external redirect. **
*Use
with
caution. Cookieless clients
will get the motd message and
*only
* the motd
if
this option is false.
=back
Example:
<Location />
PerlHeaderParserHandler Apache::Motd
PerlSetVar MessageFile /proj/www/motd.txt
PerlSetVar CookieName TermUsage
PerlSetVar RedirectInSecs 5
</Location>
The example above, sets a server wide message (/proj/www/motd.txt) that
view all matches for this distribution
318319320321322323324325326327328=back
=head1 REQUIREMENTS
L<mod_perl>, L<Apache::Cookie>
=head1 CREDITS
Fixes, Bug Reports, Optimizations and Ideas have been generously provided by:
view release on metacpan or search on metacpan
NNTPGateway.pm view on Meta::CPAN
2021222324252627282930
NNTPGateway.pm view on Meta::CPAN
396397398399400401402403404405406my
$Base
=
'/'
;
my
$StyleSheet
=
''
;
my
$Anonymous_Post_Allowed
= 0;
my
$Organization
=
$DEFAULT_ORGANIZATION
;
my
$Templates_Dir
=
$DEFAULT_TEMPLATES_DIR
;
my
$Catchup_Cookie_Name
=
undef
;
my
$The_User
=
''
;
# Subs decl --------------------------------------------------------------
NNTPGateway.pm view on Meta::CPAN
583584585586587588589590591592593594595596597598599600601602my
$catchupid
=
$Args
->{last_art};
my
$catchupdate
=
$NNTP
->date();
my
$newnewsok
=
$NNTP
->newnews(
$catchupdate
,
$The_Newsgroup
)?1:0;
# Build the catchup cookie
my
$cookie
= new CGI::Cookie
(
-name
=>
$Catchup_Cookie_Name
,
-value
=>
"Id=${catchupid},Date=${catchupdate}"
,
# 10 years should be enough as expiration date.
-expires
=>
'+10y'
,
-domain
=>
$COOKIE_DOMAIN
,
-path
=>
$Base
);
$r
->header_out(
'Set-Cookie'
=>
$cookie
);
# Print html header
&print_html_head
(
$r
, 1 );
# Print menu
&print_html_menu
(
$r
);
NNTPGateway.pm view on Meta::CPAN
14771478147914801481148214831484148514861487### Sub get_args() ###
# status = &get_args( request ):
# - Description: Fill in the global hash Args. The args are processed
# in this order: Cookies, path_info, environment variables, GET then
# POST args, each arg overriding previous one if already defined.
# - Arguments : the Apache request
# - Return : 1=ok, 0=failure
###
sub
get_args ( $ ) {
NNTPGateway.pm view on Meta::CPAN
1489149014911492149314941495149614971498149915001501# Empty Args...
$Args
= {};
# Get cookies vals
my
%cookies
= CGI::Cookie->parse(
$r
->header_in(
'Cookie'
));
my
$catchupval
=
$cookies
{
$Catchup_Cookie_Name
}->value()
if
$cookies
{
$Catchup_Cookie_Name
};
$r
->
log
->notice(
"Got cookie $Catchup_Cookie_Name: $catchupval"
)
if
$DEBUG
;
# See action_catchup for settings of cookies
if
(
$catchupval
=~ /^(Id)=(\d+),\s*(Date)=(\d+)$/ ) {
$Args
->{catchup_id} = $2;
$Args
->{catchup_date} = $4;
}
NNTPGateway.pm view on Meta::CPAN
15671568156915701571157215731574157515761577}
$The_GroupDescription
=
$r
->dir_config(
'NNTPGatewayGroupDescription'
) ||
' '
;
$NNTP_Server
=
$r
->dir_config(
'NNTPGatewayNewsServer'
) ||
$DEFAULT_NEWS_SERVER
;
$NewsUrl
=
"news://${NNTP_Server}/${The_Newsgroup}"
;
$DEFAULT_ACTION_NAME
=
$r
->dir_config(
'NNTPGatewayDefaultAction'
) ||
$DEFAULT_ACTION_NAME
;
$Catchup_Cookie_Name
=
'NNTPGatewayCatchup.'
.
$The_Newsgroup
;
$Organization
=
$r
->dir_config(
'NNTPGatewayOrganization'
) ||
$Organization
;
$Title
=
$r
->dir_config(
'NNTPGatewayTitle'
) ||
"NNTPGateway: $NewsUrl"
;
$StyleSheet
=
$r
->dir_config(
'NNTPGatewayStyleSheet'
) ||
undef
;
# Anonymous posts configuration
NNTPGateway.pm view on Meta::CPAN
1820182118221823182418251826182718281829
List articles, all articles from the current newsgroup or only unread
articles
if
the user/client already did a B<catchup>.
=item catchup
Mark all current articles as read. This use a Cookie.
=item last
Read the last article available from the newsserver.
NNTPGateway.pm view on Meta::CPAN
20122013201420152016201720182019202020212022* Call Net::Cmd functions in a clean manner to make perl 5.6 happy (end of
that Bareword
"CMD_ERROR"
install bug).
=item v0.8
* Cookie domain better handled for catchup.
* NNTPGatewayNewsGroupTest removed. Set up a new Location and set
NNTPGatewayNewsGroup to the test group and NNTPGatewayDebug on to achieve
the same functionality.
* Some more directives to control users checking
(NNTPGatewayUsersNamesCaseInsensitive, NNTPGatewayNonLocalPostOk).
NNTPGateway.pm view on Meta::CPAN
view all matches for this distribution
20272028202920302031203220332034203520362037** CPAN Enabled distrib (Makefile.PL, .tar.gz dist, README file, CPAN ID
...).
=item v0.7
* The configuration directive B<NNTPGatewayCatchupCookieName> do not exists anymore.
* Disconnections to news server start to be better handled.
=item v0.6
First public release
view release on metacpan or search on metacpan
PAR/PerlRun.pm view on Meta::CPAN
141516171819202122232425@ISA
=
qw(Exporter)
;
$VERSION
=
'0.30'
;
unless
(
$mod_perl::VERSION
< 1.99) {
@ISA
=
qw(Exporter Apache::PAR::RegistryCooker)
;
import
Apache::Const
qw(OK)
;
}
else
{
@ISA
=
qw(Exporter Apache::PAR::ScriptBase Apache::PerlRun)
;
PAR/PerlRun.pm view on Meta::CPAN
view all matches for this distribution
2728293031323334353637
import
Apache::Constants
qw(OK)
;
}
my
$parent
=
'Apache::PAR::RegistryCooker'
;
my
%aliases
= (
new
=>
'new'
,
init
=>
'init'
,
default_handler
=>
'default_handler'
,
view release on metacpan or search on metacpan
lib/Template/PSP/Tags.psp view on Meta::CPAN
view all matches for this distribution
9596979899100101102103104105
</perl>
</tag>
<tag name=
"cookie"
global=
"1"
accepts=
"name,value,expires,path"
>
<perl>
SetCookie(
$name
,
$value
,
$expires
,
$path
);
</perl>
</tag>
<tag name=
"ldap"
global=
"1"
body=
"1"
accepts=
"name,host,port,username,password,timeout,action,base,sort,attributes"
>
view release on metacpan or search on metacpan
lib/Apache/PageKit.pm view on Meta::CPAN
2223242526272829303132use
strict;
# CPAN Modules required for pagekit
use
Apache::URI ();
use
Apache::Cookie ();
use
Apache::Request ();
use
Apache::SessionX ();
use
Apache::Util ();
use
Compress::Zlib ();
use
File::Find ();
lib/Apache/PageKit.pm view on Meta::CPAN
567568569570571572573574575576577
$pk
->{browser_cache} =
'no'
;
}
else
{
# display login page with error message
$pk
->{page_id} =
$config
->get_global_attr(
'login_page'
);
$model
->pkit_gettext_message(
'Cookies must be enabled in your browser.'
,
is_error
=> 1);
}
}
my
$require_login
=
$config
->get_page_attr(
$pk
->{page_id},
'require_login'
);
if
(
defined
(
$require_login
) &&
$require_login
=~ /^(yes|recent)$/){
lib/Apache/PageKit.pm view on Meta::CPAN
10921093109410951096109710981099110011011102my
$pkit_id
=
'pkit_id'
. (
$config
->get_server_attr(
'cookie_postfix'
) ||
''
);
my
$cookie_domain_str
=
$config
->get_server_attr(
'cookie_domain'
);
my
@cookie_domains
=
defined
(
$cookie_domain_str
) ?
split
(
' '
,
$cookie_domain_str
) : (
undef
);
for
my
$cookie_domain
(
@cookie_domains
){
my
$cookie
= Apache::Cookie->new(
$apr
,
-name
=>
$pkit_id
,
-value
=>
$ses_key
,
-path
=>
"/"
);
$cookie
->domain(
$cookie_domain
)
if
$cookie_domain
;
if
(
$remember
){
lib/Apache/PageKit.pm view on Meta::CPAN
11361137113811391140114111421143114411451146my
(
$pk
) =
@_
;
my
$apr
=
$pk
->{apr};
my
$model
=
$pk
->{model};
my
%cookies
= Apache::Cookie->fetch;
my
$cookie_pkit_id
=
'pkit_id'
. (
$pk
->{config}->get_server_attr(
'cookie_postfix'
) ||
''
);
return
unless
$cookies
{
$cookie_pkit_id
};
my
%ticket
=
$cookies
{
$cookie_pkit_id
}->value;
lib/Apache/PageKit.pm view on Meta::CPAN
1165116611671168116911701171117211731174sub
logout {
my
(
$pk
) =
@_
;
my
$config
=
$pk
->{config};
my
%cookies
= Apache::Cookie->fetch;
my
$cookie_postfix
=
$config
->get_server_attr(
'cookie_postfix'
) ||
''
;
my
$pkit_id
=
'pkit_id'
.
$cookie_postfix
;
my
$pkit_session_id
=
'pkit_session_id'
.
$cookie_postfix
;
lib/Apache/PageKit.pm view on Meta::CPAN
1206120712081209121012111212121312141215}
my
$apr
=
$pk
->{apr};
my
$config
=
$pk
->{config};
my
%cookies
= Apache::Cookie->fetch;
my
$pkit_session_id
=
'pkit_session_id'
. (
$config
->get_server_attr(
'cookie_postfix'
) ||
''
);
my
$session_id
;
lib/Apache/PageKit.pm view on Meta::CPAN
12721273127412751276127712781279128012811282# unset cookie for old session
my
$cookie_domain_str
=
$pk
->{config}->get_server_attr(
'cookie_domain'
);
my
@cookie_domains
=
defined
(
$cookie_domain_str
) ?
split
(
' '
,
$cookie_domain_str
) : (
undef
);
for
my
$cookie_domain
(
@cookie_domains
){
my
$cookie
= Apache::Cookie->new(
$apr
,
-name
=>
$pkit_session_id
,
-value
=>
""
,
-path
=>
"/"
);
$cookie
->domain(
$cookie_domain
)
if
$cookie_domain
;
$cookie
->expires(
'-5y'
);
lib/Apache/PageKit.pm view on Meta::CPAN
13011302130313041305130613071308130913101311my
$pkit_session_id
=
'pkit_session_id'
. (
$pk
->{config}->get_server_attr(
'cookie_postfix'
) ||
''
);
my
$expires
=
$pk
->{config}->get_global_attr(
'session_expires'
);
my
$cookie_domain_str
=
$pk
->{config}->get_server_attr(
'cookie_domain'
);
my
@cookie_domains
=
defined
(
$cookie_domain_str
) ?
split
(
' '
,
$cookie_domain_str
) : (
undef
);
for
my
$cookie_domain
(
@cookie_domains
){
my
$cookie
= Apache::Cookie->new(
$apr
,
-name
=>
$pkit_session_id
,
-value
=>
$session_id
,
-path
=>
"/"
);
$cookie
->domain(
$cookie_domain
)
if
$cookie_domain
;
$cookie
->expires(
$expires
)
if
$expires
;
lib/Apache/PageKit.pm view on Meta::CPAN
view all matches for this distribution
15551556155715581559156015611562156315641565Russell D. Weiss
Paul Flinders
Bill Karwin
Daniel Gardner
Andy Massey
Michael Cook
Michael Pheasant
John Moose
Sheldon Hearn
Vladimir Sekissov
Tomasz Konefal
view release on metacpan or search on metacpan
ParseFormData.pm view on Meta::CPAN
view all matches for this distribution
105106107108109110111112113114115
join
(
"="
,
"path"
,
$args
->{
'path'
}),
);
push
(
@a
,
join
(
"="
,
"expires"
,
&cookie_expire
(
$args
->{
'expires'
})))
if
(
$args
->{
'expires'
});
push
(
@a
,
join
(
"="
,
"secure"
,
$args
->{
'secure'
}))
if
(
$args
->{
'secure'
});
push
(
@a
,
join
(
"="
,
"domain"
,
$args
->{
'domain'
}))
if
(
$args
->{
'domain'
});
$self
->headers_out->{
'Set-Cookie'
} =
join
(
";"
,
@a
);
$self
->param(
$args
->{
'name'
} =>
$args
->{
'value'
});
return
();
}
sub
cookie_expire {
view release on metacpan or search on metacpan
ParseLog.pm view on Meta::CPAN
view all matches for this distribution
30693070307130723073307430753076307730783079cc:Cocos (Keeling) Islands
cf:Central African Republic
cg:Congo
ch:Switzerland
ci:Cote D'Ivoire (Ivory Coast)
ck:Cook Islands
cl:Chile
cm:Cameroon
cn:China
co:Colombia
cr:Costa Rica
view release on metacpan or search on metacpan
ProxyRewrite.pm view on Meta::CPAN
view all matches for this distribution
662663664665666667668669670671672# feed reponse back into our request_record
$response
->scan(
sub
{
my
(
$header
,
$value
) =
@_
;
$r
->
log
->debug(
"respond: OUT $header: $value"
);
if
(
$header
=~ /^Set-Cookie/i) {
$value
=~ /path=([^;]+)/i;
my
$cookie_path
= $1;
&rewrite_url
(
$r
,
$remote_site
, \
$cookie_path
,
$mapref
);
# Handle the special case of when the value
# begins with a port
view release on metacpan or search on metacpan
Recorder.pm view on Meta::CPAN
3637383940414243444546$VERSION
=
'0.07'
;
#use Apache::File;
use
CGI::Cookie;
use
Apache::URI;
sub
handler {
my
$r
=
shift
;
my
$id
= get_id(
$r
);
Recorder.pm view on Meta::CPAN
view all matches for this distribution
72737475767778798081}
sub
get_id {
my
$r
=
shift
;
my
%cookies
= CGI::Cookie->parse(
$r
->header_in(
'Cookie'
) );
if
(
exists
(
$cookies
{
'HTTPRecorderID'
} ) ) {
return
$cookies
{
'HTTPRecorderID'
}->value;
}
}
view release on metacpan or search on metacpan
RequestNotes.pm view on Meta::CPAN
1112131415161718192021#---------------------------------------------------------------------
use
5.004;
use
mod_perl 1.21;
use
Apache::Cookie;
use
Apache::Log;
use
Apache::Request;
use
strict;
$Apache::RequestNotes::VERSION
=
'0.06'
;
RequestNotes.pm view on Meta::CPAN
view all matches for this distribution
4849505152535455565758#---------------------------------------------------------------------
# grab the cookies
#---------------------------------------------------------------------
my
%cookiejar
= Apache::Cookie->new(
$r
)->parse;
foreach
(
sort
keys
%cookiejar
) {
my
$cookie
=
$cookiejar
{
$_
};
$cookies
{
$cookie
->name} =
$cookie
->value;
view release on metacpan or search on metacpan
lib/Apache/ReverseProxy.pm view on Meta::CPAN
view all matches for this distribution
293294295296297298299300301302303# /french/news/index?a=b -> http://www.news.com/index?language=french&a=b
=head1 TO-DO
1. Cookie header translation.
2. Verbose/debug logging.
=head1 REQUIREMENTS
This module requires LWP, available at:
view release on metacpan or search on metacpan
RewritingProxy.pm view on Meta::CPAN
RewritingProxy.pm view on Meta::CPAN
7677787980818283848586# and rewrite them to be absolute links passing through this module
# again.
use
LWP::UserAgent;
use
HTML::TokeParser;
use
HTTP::Cookies;
use
CGI;
my
$r
=
shift
;
my
$url
=
shift
;
my
$ua
= new LWP::UserAgent;
# As we form the request to go to the remote server,
RewritingProxy.pm view on Meta::CPAN
919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129# in the request after yanking out our own URL from
# the cookies.
# Fetch a cookie named RewritingProxy from the client.
my
$cookieKey
;
my
$clientCookies
=
$r
->header_in(
'Cookie'
);
my
@clientCookiePairs
=
split
(/; /,
$clientCookies
);
my
$thisClientCookiePair
;
foreach
$thisClientCookiePair
(
@clientCookiePairs
)
{
my
(
$name
,
$value
) =
split
(/=/,
$thisClientCookiePair
);
$cookieKey
=
$value
if
(
$name
eq
"RewritingProxyCookieJar"
);
}
# Set the cookie to be the client's current IP (doesn' really matter).
# Set the cookie to expire in 6 months.
# TODO: Make this thing refresh if a client keeps using the proxy.
if
(!
$cookieKey
)
{
$cookieKey
=
$r
->get_remote_host();
my
$cookieString
=
"RewritingProxyCookieJar=$cookieKey; expires="
.
ht_time(
time
+518400).
"; path=/; domain="
.
$r
->get_server_name;
$r
->header_out(
'Set-Cookie'
=>
$cookieString
);
}
# We now need to open the User's cookie jar and see if any cookies
# need to be sent to this particular server.
$jar
=
"$Apache::RewritingProxy::cacheRoot/cookies/$cookieKey"
;
$serverCookies
= HTTP::Cookies->new(
File
=>
"$jar"
,
ignore_discard
=>1,
AutoSave
=>1);
# Load the cookies into memory...
$serverCookies
->load()
if
(-e
$jar
);
# Let's take care of Referer also.
my
$referer
=
$r
->header_in(
'Referer'
);
my
$script_name
=
$r
->location;
$referer
=~ s/(.
*$script_name
\/)//i;
RewritingProxy.pm view on Meta::CPAN
140141142143144145146147148149150if
(
$r
->method eq
'GET'
)
{
$req
= new HTTP::Request
'GET'
=>
"$rurl"
;
$req
->header(
'Referer'
=>
"$referer"
);
$serverCookies
->add_cookie_header(
$req
);
# This needs to be a simple request or else the redirects will
# not work very nicely. LWP is too smart sometimes.
$res
=
$ua
->simple_request(
$req
);
}
elsif
(
$r
->method eq
'POST'
)
RewritingProxy.pm view on Meta::CPAN
155156157158159160161162163164165use
URI::URL;
my
%FORM
;
$req
= new HTTP::Request
'POST'
=>
"$rurl"
;
$req
->header(
'Referer'
=>
"$referer"
);
$req
->content_type(
'application/x-www-form-urlencoded'
);
$serverCookies
->add_cookie_header(
$req
);
# $req->content('$buffer');
my
$pair
;
my
@pairs
=
split
(/&/,
$r
->content);
# TODO: This next bit more efficiently.
# It works for the occasional cgi, but not for constant
RewritingProxy.pm view on Meta::CPAN
191192193194195196197198199200201202203204205206207208209
{
sleep
(1);}
open
(LOCK,
">$Apache::RewritingProxy::cacheRoot/cookies/$cookieKey.lock"
);
LOCK
" "
;
close
LOCK;
# New cookies sent by the server...
my
$responseCookies
= HTTP::Cookies->new;
$responseCookies
->extract_cookies(
$res
);
$responseCookies
->scan(\
&storeCookies
);
# Store the old plus the new...
# $proxiedCookieJar->save();
unlink
(
"$Apache::RewritingProxy::cacheRoot/cookies/$cookieKey.lock"
);
sub
storeCookies
{
my
$version
=
shift
;
my
$key
=
shift
;
my
$val
=
shift
;
my
$path
=
shift
;
RewritingProxy.pm view on Meta::CPAN
view all matches for this distribution
218219220221222223224225226227228229230231232233234235
# if (!$expires )
# {
# $expires = ht_time(time+3600, '%Y-%m-%d %H:%M:%S',0);
# }
my
$proxiedCookieJar
= HTTP::Cookies->new(
File
=>
"$jar"
,
ignore_discard
=>1,
AutoSave
=>1);
$proxiedCookieJar
->load();
$proxiedCookieJar
->set_cookie(
$version
,
$key
,
$val
,
$path
,
$domain
,
$port
,
$path_spec
,
$secure
,
$expires
);
$proxiedCookieJar
->save();
}
if
(
$res
->code =~ /^3/)
{
# This means it was a server redirect.
view release on metacpan or search on metacpan
t/lib/Apache/test.pm view on Meta::CPAN
271272273274275276277278279280281
return
$net::callback_hooks
{PERL_TABLE_API};
}
},
);
for
(
qw(Apache::Cookie Apache::Request)
) {
$really_have
{
$_
} =
$really_have
{
'Apache::Table'
};
}
sub
have_module {
my
$mod
=
shift
;
t/lib/Apache/test.pm view on Meta::CPAN
view all matches for this distribution
660661662663664665666667668669670671672673674675676677678679680681values
are all 1.
=head1 EXAMPLES
No good examples yet. Example submissions are welcome. In the meantime, see
I'm retrofitting to use Apache::test.
=head1 TO DO
The MM_test method doesn't try to be very smart, it just writes the
text that seems to work in my configuration. I am morally against
using the 'make' command for installing Perl modules (though of course
I do it anyway), so I haven't looked into this very much. Send bug
reports or better (patches).
I've got lots of code in my Apache::AuthCookie module (etc.) that
assists in actually making the queries of the running server. I plan
to add that to this module, but first I need to compare what's already
here that does the same stuff.
=head1 KUDOS
view release on metacpan or search on metacpan
lib/Apache/SWIT/Maker.pm view on Meta::CPAN
163164165166167168169170171172173RewriteRule ^/\$
$rl
/
index
/r [R]
Alias
$rl
/www \
@ServerRoot
\@/public_html
Alias /html-tested-javascript /usr/
local
/share/libhtml-tested-javascript-perl
# Format is:
# Remote IP, time, request, status, duration, referer, user agent
# PID, Cookie, total bytes in request, total bytes in response
LogFormat
"%a %t \\"
%r
\\
" %>s %D \\"
%{Referer}i\\
" \\"
%{User-Agent}i\\
" %P %{$an}C %I %O"
switlog
ENDM
}
sub
add_test {
lib/Apache/SWIT/Maker.pm view on Meta::CPAN
view all matches for this distribution
311312313314315316317318319320321<IfModule !mod_deflate.c>
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
</IfModule>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript application/xhtml+xml image/svg+xml
PerlModule Apache2::Request Apache2::Cookie Apache2::Upload Apache2::SubRequest
ENDS
}
sub
regenerate_httpd_conf {
my
$self
=
shift
;
view release on metacpan or search on metacpan
lib/Apache/SdnFw.pm view on Meta::CPAN
232425262728293031323334$options
{uri} =
$r
->uri();
$options
{args} =
$r
->args();
$options
{remote_addr} =
$r
->get_remote_host();
my
%headers
=
$r
->headers_in();
if
(
$headers
{Cookie}) {
foreach
my
$kv
(
split
'; '
,
$headers
{Cookie}) {
my
(
$k
,
$v
) =
split
'='
,
$kv
;
$options
{cookies}{
$k
} =
$v
;
}
}
$options
{server_name} =
$headers
{Host};
lib/Apache/SdnFw.pm view on Meta::CPAN
view all matches for this distribution
114115116117118119120121122123124
return
error(
$r
,
"Unknown return_code: $s->{r}{return_code}"
);
}
# add cookies
foreach
my
$cookie
(@{
$s
->{r}{set_cookie}}) {
$r
->err_headers_out->add(
'Set-Cookie'
=>
$cookie
);
}
#return error($r,"Missing content_type") unless($s->{r}{content_type});
# compress the data?
view release on metacpan or search on metacpan
352353354355356357358359360361362
};
}
if
(
$t
>
$ts
+ 60*(
$idle
+
$renew
)) {
# idle timeout
$uri
=
$self
->timeoutURL;
return
{
message
=>
"Cookie idle too long '$uid'."
,
uri
=>
"$uri?type=idle"
};
}
if
(
$t
>
$ts
+ 60
*$renew
) {
# renew
$uri
=
$self
->renewURL;
437438439440441442443444445446447=head1 SYNOPSIS
In startup.pl,
$My::obj = Apache::SecSess::Cookie::X509->new(...)
In httpd.conf,
<Location /protected>
PerlAuthenHandler $My::obj->authen
466467468469470471472473474475476477478479480481482=head1 CLASS HIERARCHY
Below is a diagram of the class hierarchy
SecSess
`+-Cookie
| `+--BasicAuth (for debugging)
| +--LoginForm
| +--X509
| +--X509PIN
| `--URL
`-URL
`---Cookie
SecSess contains (in addition to common code) all Apache phase handlers
(Currently only PerlAuthenHandler are needed). At this level credentials
and status are considered opaque objects. The important methods are:
487488489490491492493494495496497498499500501502503504->renew() Will re-issue credentials
if
proper conditions are satisfied
->
delete
() Will
delete
credentials where relevant (i.e. deletes cookies).
At one level beneath SecSess (SecSess::Cookie.pm and SecSess::URL.pm),
are the methods
for
interpreting and manipulating credentials.
At the lowest level, are subclasses which
"know"
how to interpret the
*initial
* identifying information during the issuance of credentials.
So, *::Cookie::LoginForm presents the client
with
a user/password
login form
for
identification. And thus the difference between
*::Cookie::URL and *::URL::Cookie is that the former will issue cookies
after
validating an URL credential, and the latter will
"issue"
an URL
credential (typically it will redirect to a resource
with
realm=cred in
the URL)
after
validating a cookie.
=head1 CREDENTIAL FORMAT
506507508509510511512513514515516Credentials in Apache::SecSess have a similar
format
:
URL Credentials (
defined
in Apache::SecSess::URL):
realm=E_k(md5(hash),hash)
Cookie Credentials: (
defined
in Apache::SecSess::Cookie):
realm:qop,authqop=E_k(md5(hash),hash)
The string
'realm'
is any symbol (without obvious special characters
':'
,
'='
, etc) which is used to identify cooperating security services,
thus providing a way to put credentials into their own namespace.
601602603604605606607608609610611612613614615616617618619620621622623check your assumptions about your
local
site's openssl
with
the script
utils/minstren which prints the weakest cipher strength
for
common
SSLCipherSuite arguments. At
my
site, I was surprised to find
ALL:!ADH:!EXP:!
EXP56
=> 56 bits.
=head2 Cookie Domain Argument
cookieDomain => <hashref>
The cookieDomain argument expects a hash reference of the form:
{ 'qop,authqop' => 'domain_string', ... }
where 'domain_string' is literally the HTTP Set-Cookie domain string, and
where the integers 'qop' and 'authqop' serve to define the session and
authentication qualities of protections as described above. A cookie will
be issued with the given domain and of the given strengths for each entry
in this hash. The HTTP Set-Cookie secure flag is set if and only if 'qop'
is nonzero. As a convenient shorthand,
int => 'domain_string'
is equivalent to
679680681682683684685686687688
]
says that
when
URL credentials are issued, the client will be redirected
to
each
of the specified sites, in turn. Each of these is expected to
be protected by a PerlAuthenHandler of type Apache::SecSess::Cookie::URL,
which will issue
local
cookies.
The argument issueURL is used to
tell
the remote sites (listed in chainURLS
arg) where to redirect the client back to, in order to
continue
chaining.
703704705706707708709710711712instructions in INSTALL to get it to work. Read db/*
for
more
info.
=head1 EXAMPLES
=head2 A Simple Cookie Example
Assuming all resources under directory /protected on one or more hosts
in a DNS domain need to be protected, place the following directive
into 'httpd.conf':
721722723724725726727728729730731732733734On
each
such host, the secure session object
$Acme::obj
must be instantiated
from a
'startup.pl'
file as in the following example, which uses an X.509
certificate
for
the original identification and authentication:
## X.509 certificate authentication, issuing multiple cookies
$Acme::obj
= Apache::SecSess::Cookie::X509->new(
dbo
=> SecSessDBI->new( ... ),
secretFile
=>
'ckysec.txt'
,
lifeTime
=> 1440,
idleTime
=> 60,
renewRate
=> 5,
authRealm
=>
'Acme'
,
cookieDomain
=> {
788789790791792793794795796797798799800
PerlAuthenHandler
$Acme::noam
->authen
...
</Location>
where the authen() method is of an object of class
Apache::SecSess::Cookie::URL instantiated as:
$Acme::noam
= Apache::SecSess::Cookie::URL->new(
dbo
=> Apache::SecSess::DBI->new(...),
secretFile
=>
'ckysec.txt'
,
lifeTime
=> 1440,
idleTime
=> 60,
renewRate
=> 5,
minSessQOP
=> 128,
minAuthQOP
=> 128,
authRealm
=>
'Acme'
,
803804805806807808809810811812813
);
Like any other subclass of Apache::SecSess::Cookie, URL.pm will
issue cookies based on the presentation of some identifying information,
and authenURL defines where to go to get that information. The difference
is that it now points to a new DNS domain: stu.transacme.com.
That
'remote login'
is protected by
818819820821822823824825826827828
</Location>
i.e., the issue() method of the object
$Acme::chain
which is instantiated
as
$Acme::chain
= Apache::SecSess::URL::Cookie->new(
dbo
=> Apache::SecSess::DBI->new(...),
secretFile
=>
'ckysec.txt'
,
lifeTime
=> 1440,
idleTime
=> 60,
renewRate
=> 5,
sessQOP
=> 128,
authQOP
=> 128,
minSessQOP
=> 128,
minAuthQOP
=> 128,
view all matches for this distribution
838839840841842843844845846847848849850851852853854855
);
If
no
cookies are present, the client will be redirected again to
https://stu.transacme.com/authen or the issue() method of a standard
Cookie-based login:
<Location /authen>
PerlAuthenHandler
$Acme::stu
->issue
...
</Location>
where
$Acme::stu
is an instance of,
say
Apache::SecSess::Cookie::X509,
just as in the previous example.
But
if
and
when
cookies are present,
$Acme::chain
->issue will walk
through the URL's listed in the chainURLS argument eventually getting
to https://noam.acme.org/authen protected by
view release on metacpan or search on metacpan
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
539540541542543544545546547548549550551552553554555556557558559560561562563my
$cookie_class
;
if
(
$MOD_PERL
)
{
$cookie_class
=
$MOD_PERL
== 2 ?
'Apache2::Cookie'
:
'Apache::Cookie'
;
eval
"require $cookie_class"
unless
$cookie_class
->can(
'new'
);
}
unless
(
$cookie_class
&&
$cookie_class
->can(
'new'
) )
{
$cookie_class
=
'CGI::Cookie'
;
}
$self
->{cookie_class} =
$cookie_class
;
if
(
$self
->{cookie_class} eq
'CGI::Cookie'
)
{
$self
->{new_cookie_args} = [];
$self
->{fetch_cookie_args} = [];
}
else
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
649650651652653654655656657658659{
my
$self
=
shift
;
if
(
$MOD_PERL
== 2 )
{
my
$jar
= Apache2::Cookie::Jar->new( @{
$self
->{fetch_cookie_args} } );
my
$c
=
$jar
->cookies(
$self
->{cookie_name} );
return
$c
->value
if
$c
;
}
else
{
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
733734735736737738739740741742743my
$cookie
=
$self
->{cookie_class}->new
( @{
$self
->{new_cookie_args} },
-name
=>
$self
->{cookie_name},
# Apache2::Cookie will return undef if we pass undef for
# -value.
-value
=> (
$self
->{session_id} ||
''
),
(
defined
$expires
? (
-expires
=>
$expires
)
: ()
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
748749750751752753754755756757758759760761762763764765766767768769770771
),
-path
=>
$self
->{cookie_path},
-secure
=>
$self
->{cookie_secure},
);
# If not running under mod_perl, CGI::Cookie->bake() will call
# print() to send a cookie header right now, which may not be what
# the user wants.
if
(
$cookie
->can(
'bake'
) && !
$cookie
->isa(
'CGI::Cookie'
) )
{
$cookie
->bake( @{
$self
->{bake_cookie_args} } );
}
else
{
my
$header_object
=
$self
->{header_object};
for
my
$meth
(
@HeaderMethods
)
{
if
(
$header_object
->can(
$meth
) )
{
$header_object
->
$meth
->add(
'Set-Cookie'
=>
$cookie
);
last
;
}
}
}
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
1015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039not exist, it will ignore this parameter and make a new session.
=back
=head2 Cookie-Related Parameters
=over 4
=item * use_cookie => boolean
If true, then this module will use one of C<Apache::Cookie>,
C<Apache2::Cookie> or C<CGI::Cookie> (as appropriate) to set and read
cookies that contain the session id.
=item * cookie_name => name
This is the name of the cookie that this module will set. This
defaults to "Apache-Session-Wrapper-cookie".
Corresponds to the C<Apache::Cookie> "-name" constructor parameter.
=item * cookie_expires => expiration
How long before the cookie expires. This defaults to 1 day, "+1d".
Corresponds to the "-expires" parameter.
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
12161217121812191220122112221223122412251226Corresponds to the C<SemaphoreKey> parameter passed to
C<Apache::Session::Lock::Semaphore>.
=item * mod_usertrack_cookie_name => name
Corresponds to the C<ModUsertrackCookieName> parameter passed to
C<Apache::Session::Generate::ModUsertrack>.
=item * save_path => path
Corresponds to the C<SavePath> parameter passed to
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
view all matches for this distribution
1229123012311232123312341235123612371238123912401241124212431244124512461247=back
=head1 HOW COOKIES ARE HANDLED
When run under mod_perl, this module attempts to first use
C<Apache::Cookie> for cookie-handling. Otherwise it uses
C<CGI::Cookie> as a fallback.
If it ends up using C<CGI::Cookie> then you must provide a
"header_object" parameter. This object must have an
C<err_headers_out()> or C<headers_out()> method. It looks for these
methods in that order. The method is expected to return an object with
an API like C<Apache::Table>. It calls C<add()> on the returned method
to add a "Set-Cookie" header.
=head1 REGISTERING CLASSES
In order to support any C<Apache::Session> subclasses, this module
provides a simple registration mechanism.
view release on metacpan or search on metacpan
lib/Apache/Session.pm view on Meta::CPAN
216217218219220221222223224225use
strict;
#read in the cookie if this is an old session
my
$r
= Apache->request;
my
$cookie
=
$r
->header_in(
'Cookie'
);
$cookie
=~ s/SESSION_ID=(\w*)/$1/;
#create a session object based on the cookie we got from the browser,
#or a new session if we got no cookie
lib/Apache/Session.pm view on Meta::CPAN
view all matches for this distribution
235236237238239240241242243244};
#Might be a new session, so lets give them their cookie back
my
$session_cookie
=
"SESSION_ID=$session{_session_id};"
;
$r
->header_out(
"Set-Cookie"
=>
$session_cookie
);
#program continues...
=head1 SEE ALSO
view release on metacpan or search on metacpan
SessionManager.pm view on Meta::CPAN
45464748495051525354555657
Apache::Constants->
import
(
qw(DECLINED REDIRECT)
);
}
# Test libapreq modules
if
($@) {
$libapreq
= 0;
}
else
{
$libapreq
= 1;
}
SessionManager.pm view on Meta::CPAN
6465666768697071727374return
(MP2 ? Apache::DECLINED : Apache::Constants::DECLINED)
unless
$r
->is_initial_req;
my
$debug_prefix
=
'['
.
$r
->connection->remote_ip .
"] SessionManager ($$): "
;
$session_config
{
'SessionManagerDebug'
} =
$r
->dir_config(
'SessionManagerDebug'
) || 0;
foreach
(
qw/SessionManagerURITracking SessionManagerTracking SessionManagerEnableModBackhand
SessionManagerStoreArgs SessionManagerCookieArgs SessionManagerSetEnv SessionManagerExpire
SessionManagerHeaderExclude SessionManagerIPExclude/
) {
$session_config
{
$_
} =
$r
->dir_config(
$_
);
}
$r
->log_error(
$debug_prefix
.
'---START REQUEST: '
.
$r
->uri .
' ---'
)
if
$session_config
{
'SessionManagerDebug'
} > 0;
SessionManager.pm view on Meta::CPAN
144145146147148149150151152153154155156157158159160161162163164165# Get session ID from cookie
unless
(
$session_config
{
'SessionManagerURITracking'
} eq
'On'
) {
if
(
$libapreq
) {
# Test libapreq 1 or 2 version to use correct 'fetch' API
my
%cookies
=
$Apache::Request::VERSION
>= 2 ? Apache::Cookie->fetch(
$r
) : Apache::Cookie->fetch;
$session_id
=
$cookies
{
$session_config
{
'SessionManagerName'
}}->value
if
defined
$cookies
{
$session_config
{
'SessionManagerName'
}};
$r
->log_error(
$debug_prefix
.
'Apache::Cookie fetch'
)
if
$session_config
{
'SessionManagerDebug'
} >= 5;
#print STDERR "$debug_prefix Apache::Cookie fetch\n" if $session_config{'SessionManagerDebug'} >= 5;
}
# Fetch cookies with CGI::Cookie
else
{
# At this phase (HeaderParser | Translation), no $ENV{'COOKIE'} var is set, so we use CGI::Cookie parse method by passing 'Cookie' HTTP header
my
%cookies
= CGI::Cookie->parse(
$r
->headers_in->{
'Cookie'
});
$session_id
=
$cookies
{
$session_config
{
'SessionManagerName'
}}->value
if
defined
$cookies
{
$session_config
{
'SessionManagerName'
}};
$r
->log_error(
$debug_prefix
.
'CGI::Cookie fetch'
)
if
$session_config
{
'SessionManagerDebug'
} >= 5;
#print STDERR "$debug_prefix CGI::Cookie fetch\n" if $session_config{'SessionManagerDebug'} >= 5;
}
}
# Prepare Apache::Session::Flex options parameters call
my
%apache_session_flex_options
= (
SessionManager.pm view on Meta::CPAN
253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
else
{
$r
->log_error(
$debug_prefix
.
'sending cookie...'
)
if
$session_config
{
'SessionManagerDebug'
} > 0;
#print STDERR "$debug_prefix sending cookie...\n" if $session_config{'SessionManagerDebug'} > 0;
# Load cookie specific parameters
foreach
my
$arg
(
split
(/\s*,\s*/,
$session_config
{
'SessionManagerCookieArgs'
}) ) {
my
(
$key
,
$value
) =
split
(/\s*=>\s*/,
$arg
);
$cookie_options
{
'-'
.
lc
(
$key
)} =
$value
if
$key
=~ /^(expires|domain|path|secure)$/i;
}
# Set default cookie path
$cookie_options
{
'-path'
} =
'/'
unless
$cookie_options
{
'-path'
};
if
(
$session_config
{
'SessionManagerDebug'
} >= 5 ) {
$r
->log_error(
$debug_prefix
.
'Cookie options:'
);
#print STDERR "$debug_prefix Cookie options\n";
foreach
(
sort
keys
%cookie_options
) {
$r
->log_error(
$debug_prefix
.
' '
x 8 .
"$_ = $cookie_options{$_}"
);
#print STDERR "\t$_ = $cookie_options{$_}\n";
}
}
# Set cookie with Apache::Cookie
if
(
$libapreq
) {
my
$cookie
= Apache::Cookie->new(
$r
,
name
=>
$session_config
{
'SessionManagerName'
},
value
=>
$session_id
,
%cookie_options
);
$cookie
->bake;
$r
->log_error(
$debug_prefix
.
'Apache::Cookie bake '
.
$cookie
->as_string)
if
$session_config
{
'SessionManagerDebug'
} >= 5;
#print STDERR ("$debug_prefix Apache::Cookie bake " . $cookie->as_string . "\n") if $session_config{'SessionManagerDebug'} >= 5;
}
# Set cookie with CGI::Cookie
else
{
my
$cookie
= CGI::Cookie->new(
-name
=>
$session_config
{
'SessionManagerName'
},
-value
=>
$session_id
,
%cookie_options
);
$r
->err_headers_out->{
'Set-Cookie'
} =
"$cookie"
;
$r
->log_error(
$debug_prefix
.
"CGI::Cookie bake $cookie"
)
if
$session_config
{
'SessionManagerDebug'
} >= 5;
#print STDERR "$debug_prefix CGI::Cookie bake $cookie\n" if $session_config{'SessionManagerDebug'} >= 5;
}
}
}
$r
->log_error(
$debug_prefix
.
'---END REQUEST---'
)
if
$session_config
{
'SessionManagerDebug'
} > 0;
SessionManager.pm view on Meta::CPAN
626627628629630631632633634635636637638=item * mod_perl 1.0 or 2.0 is required (of course) with the appropriate
call-back hooks (PERL_TRANS=1 PERL_HEADER_PARSER=1)
=item * Apache::Session >= 0.53 is required
=item * Apache::Cookie >= 0.33 (libapreq) is preferred but not required
(CGI::Cookie will be used instead)
=item * CGI::Cookie (used only if Apache::Request isn't installed)
=back
Installation as usual:
SessionManager.pm view on Meta::CPAN
800801802803804805806807808809
PerlSetVar SessionManagerName PSESSID
The
default
value is C<PERLSESSIONID>
=item C<SessionManagerCookieArgs>
With this directive you can provide optional arguments for cookie attributes
setting. The arguments are passed as comma-separated list of name/value pairs.
The only attributes accepted are:
SessionManager.pm view on Meta::CPAN
828829830831832833834835836837838839840841842843=back
For instance:
PerlSetVar SessionManagerCookieArgs "Path => /some-path, \
Domain => .yourdomain.com, \
Secure => 1"
Please see the documentation for L<Apache::Cookie|Apache::Cookie> or
L<CGI::Cookie|CGI::Cookie> in order to see more cookie arguments details.
=item C<SessionManagerStore> datastore
This single directive sets the session datastore used by
L<Apache::Session|Apache::Session> framework
SessionManager.pm view on Meta::CPAN
view all matches for this distribution
121512161217121812191220122112221223122412251226=head1 SEE ALSO
L<Apache::SessionManager::cookpod|Apache::SessionManager::cookpod>,
L<Apache::Session|Apache::Session>, L<Apache::Session::Flex|Apache::Session::Flex>,
L<Apache::Request|Apache::Request>, L<Apache::Cookie|Apache::Cookie>,
L<CGI::Cookie|CGI::Cookie>, L<Apache|Apache>, perl(1)
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2001-2004 Enrico Sorcinelli. All rights reserved.
This program is free software; you can redistribute it and/or modify it under
view release on metacpan or search on metacpan
lib/Apache/SiteControl.pm view on Meta::CPAN
234567891011121314151617use
5.008;
use
strict;
use
warnings;
use
Carp;
use
Apache::AuthCookie;
our
$VERSION
=
"1.01"
;
our
%managers
= ();
sub
getCurrentUser
{
lib/Apache/SiteControl.pm view on Meta::CPAN
view all matches for this distribution
1920212223242526272829my
$r
=
shift
;
my
$debug
=
$r
->dir_config(
"SiteControlDebug"
) || 0;
my
$factory
=
$r
->dir_config(
"SiteControlUserFactory"
) ||
"Apache::SiteControl::UserFactory"
;
my
$auth_type
=
$r
->auth_type;
my
$auth_name
=
$r
->auth_name;
my
(
$ses_key
) = (
$r
->header_in(
"Cookie"
) ||
""
) =~ /
$auth_type
\_
$auth_name
=([^;]+)/;
$r
->log_error(
"Session cookie: "
. (
$ses_key
?
$ses_key
:
"UNSET"
))
if
$debug
;
$r
->log_error(
"Loading module $factory"
)
if
$debug
;
eval
"require $factory"
or
$r
->log_error(
"Could not load $factory: $@"
);
$r
->log_error(
"Using user factory $factory"
)
if
$debug
;
view release on metacpan or search on metacpan
lib/Apache/StickyQuery.pm view on Meta::CPAN
view all matches for this distribution
89909192939495969798It is difficult to keep sid query parameter between two cgis without
cookies (or mod_rewrite hacks).
Apache::StickyQuery is a filter that rewrites all links in HTML file
using
"sticky query"
. It would be useful in keeping state (ie. like
Session IDs) without using Cookies. See L<HTML::StickyQuery>
for
details.
This module is Filter aware, meaning that it can work within
Apache::Filter framework without modification.
view release on metacpan or search on metacpan
TaintRequest.pm view on Meta::CPAN
727374757677787980818283=over 15
=item Note:
This code is derived from the I<Cookbook::TaintRequest> module,
available as part of "The mod_perl Developer's Cookbook".
=back
One of the harder problems facing web developers involves dealing with
potential cross site scripting attacks. Frequently this involves many
TaintRequest.pm view on Meta::CPAN
view all matches for this distribution
116117118119120121122123124125126This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.
=head1 HISTORY
This code is derived from the I<Cookbook::TaintRequest> module,
available as part of "The mod_perl Developer's Cookbook".
For more information, visit http://www.modperlcookbook.org/
=cut
view release on metacpan or search on metacpan
lib/Apache/TestMB.pm view on Meta::CPAN
view all matches for this distribution
234235236237238239240241242243This is identical to how C<Module::Build> is used. Not all target
systems may have C<Apache::Test> (and therefore C<Apache::TestMB>
installed, so we test
for
it to be installed, first. But otherwise,
L<Module::Build|Module::Build> documentation
for
more information on
be especially useful
for
those looking to migrate from
C<ExtUtils::MakeMaker>.
=head1 INTERFACE
view release on metacpan or search on metacpan
Usertrack.pm view on Meta::CPAN
view all matches for this distribution
121314151617181920212223242526272829
my
$remotename
=
$r
->connection->remote_host ||
$r
->connection->remote_ip;
my
(
$secs
,
$msecs
) = Time::HiRes::gettimeofday;
$msecs
/= 1000;
my
$cookie
=
"Apache=$remotename.$$"
.
"$secs$msecs; path=/"
;
$r
->notes(
"cookie"
,
$cookie
);
$r
->err_headers_out->add(
"Set-Cookie"
=>
$cookie
);
return
OK;
}
sub
handler {
my
$r
=
shift
;
return
DECLINED
unless
(
$r
->dir_config(
'Usertrack'
));
if
(
my
$cookies
=
$r
->header_in(
"Cookie"
)) {
if
(
my
$cookie
= (
$cookies
=~ m/Apache=([^\s;]+)/)[0]) {
$r
->notes(
"cookie"
,
$cookie
);
return
DECLINED;
# Theres already a cookie, no new one
}
}