Result:
found more than 542 distributions - search limited to the first 2001 files matching your query ( run in 1.249 )


Apache-Keywords

 view release on metacpan or  search on metacpan

lib/Apache/Keywords.pm  view on Meta::CPAN

4
5
6
7
8
9
10
11
12
13
14
#
# This library is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
 
use Apache::Constants qw(:common);
 
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
require Exporter;
require AutoLoader;

lib/Apache/Keywords.pm  view on Meta::CPAN

31
32
33
34
35
36
37
38
39
40
41
    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

200
201
202
203
204
205
206
207
208
209
210
# 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

254
255
256
257
258
259
260
261
262
263
264
    $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

360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# 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 all matches for this distribution


Apache-LangPrefCookie

 view release on metacpan or  search on metacpan

lib/Apache/LangPrefCookie.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
use strict;
 
use Apache::Constants qw(OK DECLINED);
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

59
60
61
62
63
64
65
66
67
68
        } ( $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

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
1;
__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

120
121
122
123
124
125
126
127
128
129
130
This 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

148
149
150
151
152
153
154
155
156
157
158
159
=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 all matches for this distribution


Apache-Log-Spread

 view release on metacpan or  search on metacpan

Spread.pm  view on Meta::CPAN

179
180
181
182
183
184
185
186
187
188
189
use strict;
 
 
use vars qw( @ISA);
@ISA = qw(Logger::Spread);
 
sub handler($$)

Spread.pm  view on Meta::CPAN

193
194
195
196
197
198
199
200
201
202
    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 all matches for this distribution


Apache-MIMEMapper

 view release on metacpan or  search on metacpan

MIMEMapper.pm  view on Meta::CPAN

187
188
189
190
191
192
193
194
195
196
197
This 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 all matches for this distribution


Apache-MP3-Skin

 view release on metacpan or  search on metacpan

Skin.pm  view on Meta::CPAN

21
22
23
24
25
26
27
28
29
30
31
sub 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}++;

Skin.pm  view on Meta::CPAN

73
74
75
76
77
78
79
80
81
82
83
84
85
  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 all matches for this distribution


Apache-MP3

 view release on metacpan or  search on metacpan

MP3/Playlist.pm  view on Meta::CPAN

95
96
97
98
99
100
101
102
103
104
  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 all matches for this distribution


Apache-Motd

 view release on metacpan or  search on metacpan

Motd.pm  view on Meta::CPAN

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##       $Id: Motd.pm,v 1.2 2002/11/01 00:39:57 ramirezc Exp $
 
use strict;
use vars qw($VERSION);
use Apache;
use Apache::Constants qw(:common REDIRECT);
 
$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

Motd.pm  view on Meta::CPAN

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## 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;

Motd.pm  view on Meta::CPAN

120
121
122
123
124
125
126
127
128
129
130
131
132
133
in 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

Motd.pm  view on Meta::CPAN

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
This 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

Motd.pm  view on Meta::CPAN

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
Future 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

Motd.pm  view on Meta::CPAN

318
319
320
321
322
323
324
325
326
327
328
=back
  
 
=head1 REQUIREMENTS
 
 L<mod_perl>, L<Apache::Cookie>
 
 
=head1 CREDITS
 
Fixes, Bug Reports, Optimizations and Ideas have been generously provided by:

 view all matches for this distribution


Apache-NNTPGateway

 view release on metacpan or  search on metacpan

NNTPGateway.pm  view on Meta::CPAN

20
21
22
23
24
25
26
27
28
29
30
use Apache::URI qw();
use Apache::Request qw();
use Apache::Log qw();
 
#use CGI qw/:standard/;
use CGI::Cookie qw();
 
# Net::NNTP @ISA Net::Cmd, IO::Socket
use Net::Cmd qw(CMD_REJECT CMD_ERROR);
use Net::NNTP qw();

NNTPGateway.pm  view on Meta::CPAN

396
397
398
399
400
401
402
403
404
405
406
my $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

583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
my $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

1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
 
### 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

1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
# 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

1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
}
$The_GroupDescription = $r->dir_config( 'NNTPGatewayGroupDescription' ) || '&nbsp;';
$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

1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
  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

2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
* 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

2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
** 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 all matches for this distribution


Apache-PAR

 view release on metacpan or  search on metacpan

PAR/PerlRun.pm  view on Meta::CPAN

14
15
16
17
18
19
20
21
22
23
24
25
@ISA = qw(Exporter);
 
$VERSION = '0.30';
 
unless ($mod_perl::VERSION < 1.99) {
        @ISA = qw(Exporter Apache::PAR::RegistryCooker);
        require Apache::PAR::RegistryCooker;
        require Apache::Const;
        import Apache::Const qw(OK);
}
else {
        @ISA = qw(Exporter Apache::PAR::ScriptBase Apache::PerlRun);

PAR/PerlRun.pm  view on Meta::CPAN

27
28
29
30
31
32
33
34
35
36
37
        require Apache::PAR::ScriptBase;
        require Apache::Constants;
        import Apache::Constants qw(OK);
}
 
my $parent = 'Apache::PAR::RegistryCooker';
 
my %aliases = (
        new             => 'new',
        init            => 'init',
        default_handler => 'default_handler',

 view all matches for this distribution


Apache-PSP

 view release on metacpan or  search on metacpan

lib/Template/PSP/Tags.psp  view on Meta::CPAN

95
96
97
98
99
100
101
102
103
104
105
  </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 all matches for this distribution


Apache-PageKit

 view release on metacpan or  search on metacpan

lib/Apache/PageKit.pm  view on Meta::CPAN

22
23
24
25
26
27
28
29
30
31
32
use strict;
 
# CPAN Modules required for pagekit
use Apache::URI ();
use Apache::Util ();
use File::Find ();

lib/Apache/PageKit.pm  view on Meta::CPAN

567
568
569
570
571
572
573
574
575
576
577
    $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

1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
my $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

1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
my ($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

1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
sub 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

1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
}
 
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

1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
# 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

1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
my $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

1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
Russell D. Weiss
Paul Flinders
Bill Karwin
Daniel Gardner
Andy Massey
Michael Cook
Michael Pheasant
John Moose
Sheldon Hearn
Vladimir Sekissov
Tomasz Konefal

 view all matches for this distribution


Apache-ParseFormData

 view release on metacpan or  search on metacpan

ParseFormData.pm  view on Meta::CPAN

105
106
107
108
109
110
111
112
113
114
115
                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 all matches for this distribution


Apache-ParseLog

 view release on metacpan or  search on metacpan

ParseLog.pm  view on Meta::CPAN

3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
cc: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 all matches for this distribution


Apache-ProxyRewrite

 view release on metacpan or  search on metacpan

ProxyRewrite.pm  view on Meta::CPAN

662
663
664
665
666
667
668
669
670
671
672
# 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 all matches for this distribution


Apache-Recorder

 view release on metacpan or  search on metacpan

Recorder.pm  view on Meta::CPAN

36
37
38
39
40
41
42
43
44
45
46
$VERSION = '0.07';
 
 
use Apache::Constants qw(:common);
#use Apache::File;
 
sub handler {
    my $r = shift;
    my $id = get_id( $r );

Recorder.pm  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
}
 
sub get_id {
    my $r = shift;
 
    my %cookies = CGI::Cookie->parse( $r->header_in( 'Cookie' ) );
    if (exists( $cookies{ 'HTTPRecorderID' } ) ) {
        return $cookies{ 'HTTPRecorderID' }->value;
    }
}

 view all matches for this distribution


Apache-RequestNotes

 view release on metacpan or  search on metacpan

RequestNotes.pm  view on Meta::CPAN

11
12
13
14
15
16
17
18
19
20
21
#---------------------------------------------------------------------
 
use 5.004;
use mod_perl 1.21;
use Apache::Constants qw( OK );
use strict;
 
$Apache::RequestNotes::VERSION = '0.06';

RequestNotes.pm  view on Meta::CPAN

48
49
50
51
52
53
54
55
56
57
58
#---------------------------------------------------------------------
# grab the cookies
#---------------------------------------------------------------------
 
  my %cookiejar = Apache::Cookie->new($r)->parse;
 
  foreach (sort keys %cookiejar) {
    my $cookie = $cookiejar{$_};
 
    $cookies{$cookie->name} = $cookie->value;

 view all matches for this distribution


Apache-ReverseProxy

 view release on metacpan or  search on metacpan

lib/Apache/ReverseProxy.pm  view on Meta::CPAN

293
294
295
296
297
298
299
300
301
302
303
 
 
=head1 TO-DO
 
  1. Cookie header translation.
  2. Verbose/debug logging.
 
=head1 REQUIREMENTS
 
 This module requires LWP, available at:

 view all matches for this distribution


Apache-RewritingProxy

 view release on metacpan or  search on metacpan

RewritingProxy.pm  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
use strict;
use Apache::Constants qw(:common);
use vars '$req';
use vars '$res';
use vars '$proxiedCookieJar';
use vars '$replayCookies';
use vars '$serverCookies';
use vars '$jar';
use vars '$textHandlerSub';
use vars qw($VERSION @ISA @EXPORT);
$|=1;

RewritingProxy.pm  view on Meta::CPAN

76
77
78
79
80
81
82
83
84
85
86
# and rewrite them to be absolute links passing through this module
# again.
use Apache::Util qw(:all);
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

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# 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

140
141
142
143
144
145
146
147
148
149
150
if ($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

155
156
157
158
159
160
161
162
163
164
165
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

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
      {sleep(1);}
open (LOCK, ">$Apache::RewritingProxy::cacheRoot/cookies/$cookieKey.lock");
print 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

218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
  # 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 all matches for this distribution


Apache-SSI

 view release on metacpan or  search on metacpan

t/lib/Apache/test.pm  view on Meta::CPAN

271
272
273
274
275
276
277
278
279
280
281
           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

660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
values 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 all matches for this distribution


Apache-SWIT

 view release on metacpan or  search on metacpan

lib/Apache/SWIT/Maker.pm  view on Meta::CPAN

163
164
165
166
167
168
169
170
171
172
173
RewriteRule ^/\$ $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

311
312
313
314
315
316
317
318
319
320
321
<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 all matches for this distribution


Apache-SdnFw

 view release on metacpan or  search on metacpan

lib/Apache/SdnFw.pm  view on Meta::CPAN

23
24
25
26
27
28
29
30
31
32
33
34
$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

114
115
116
117
118
119
120
121
122
123
124
        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 all matches for this distribution


Apache-SecSess

 view release on metacpan or  search on metacpan

SecSess.pm  view on Meta::CPAN

352
353
354
355
356
357
358
359
360
361
362
        };
}
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;

SecSess.pm  view on Meta::CPAN

437
438
439
440
441
442
443
444
445
446
447
=head1 SYNOPSIS
 
  In startup.pl,
 
    $My::obj = Apache::SecSess::Cookie::X509->new(...)
 
  In httpd.conf,
 
    <Location /protected>
      PerlAuthenHandler $My::obj->authen

SecSess.pm  view on Meta::CPAN

466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
=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:

SecSess.pm  view on Meta::CPAN

487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
->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

SecSess.pm  view on Meta::CPAN

506
507
508
509
510
511
512
513
514
515
516
Credentials 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.

SecSess.pm  view on Meta::CPAN

601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
check 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

SecSess.pm  view on Meta::CPAN

679
680
681
682
683
684
685
686
687
688
      ]
 
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.

SecSess.pm  view on Meta::CPAN

703
704
705
706
707
708
709
710
711
712
instructions 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':

SecSess.pm  view on Meta::CPAN

721
722
723
724
725
726
727
728
729
730
731
732
733
734
On 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 => {

SecSess.pm  view on Meta::CPAN

788
789
790
791
792
793
794
795
796
797
798
799
800
      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',

SecSess.pm  view on Meta::CPAN

803
804
805
806
807
808
809
810
811
812
813
    defaultURL => 'https://noam.acme.org/protected',
    renewURL => 'https://noam.acme.org/renew',
  );
   
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

SecSess.pm  view on Meta::CPAN

818
819
820
821
822
823
824
825
826
827
828
  </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,

SecSess.pm  view on Meta::CPAN

838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
  );
 
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

 view all matches for this distribution


Apache-Session-Wrapper

 view release on metacpan or  search on metacpan

lib/Apache/Session/Wrapper.pm  view on Meta::CPAN

539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
my $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' ) )
{
    require CGI::Cookie;
    $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

649
650
651
652
653
654
655
656
657
658
659
{
    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

733
734
735
736
737
738
739
740
741
742
743
my $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

748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
          ),
          -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

1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
Try this session id first and use it if it exist. If the session does
not 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

1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
Corresponds 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

1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
=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 all matches for this distribution


Apache-Session

 view release on metacpan or  search on metacpan

lib/Apache/Session.pm  view on Meta::CPAN

216
217
218
219
220
221
222
223
224
225
use 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

235
236
237
238
239
240
241
242
243
244
};
 
 #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 all matches for this distribution


Apache-SessionManager

 view release on metacpan or  search on metacpan

SessionManager.pm  view on Meta::CPAN

45
46
47
48
49
50
51
52
53
54
55
56
57
        require Apache::Constants;
        Apache::Constants->import(qw(DECLINED REDIRECT));
        require Apache::URI;
}
# Test libapreq modules
eval { require Apache::Cookie; Apache::Cookie->can('bake'); Apache::Cookie->can('fetch') };
if ($@) {
        require CGI::Cookie;
        $libapreq = 0;
}
else {
        $libapreq = 1;
}

SessionManager.pm  view on Meta::CPAN

64
65
66
67
68
69
70
71
72
73
74
return (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

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# 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

253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
        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

626
627
628
629
630
631
632
633
634
635
636
637
638
=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

800
801
802
803
804
805
806
807
808
809
   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

828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
=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

1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
=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 all matches for this distribution


Apache-SiteControl

 view release on metacpan or  search on metacpan

lib/Apache/SiteControl.pm  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use 5.008;
use strict;
use Carp;
 
our $VERSION = "1.01";
 
 
our %managers = ();
 
sub getCurrentUser
{

lib/Apache/SiteControl.pm  view on Meta::CPAN

19
20
21
22
23
24
25
26
27
28
29
my $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 all matches for this distribution


Apache-StickyQuery

 view release on metacpan or  search on metacpan

lib/Apache/StickyQuery.pm  view on Meta::CPAN

89
90
91
92
93
94
95
96
97
98
It 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 all matches for this distribution


Apache-TaintRequest

 view release on metacpan or  search on metacpan

TaintRequest.pm  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
83
=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

116
117
118
119
120
121
122
123
124
125
126
This 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 all matches for this distribution


Apache-Test

 view release on metacpan or  search on metacpan

lib/Apache/TestMB.pm  view on Meta::CPAN

234
235
236
237
238
239
240
241
242
243
This 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,
its use can be exactly the same. Consult the
L<Module::Build|Module::Build> documentation for more information on
how to use it; L<Module::Build::Cookbook|Module::Build::Cookbook> may
be especially useful for those looking to migrate from
C<ExtUtils::MakeMaker>.
 
=head1 INTERFACE

 view all matches for this distribution


Apache-Usertrack

 view release on metacpan or  search on metacpan

Usertrack.pm  view on Meta::CPAN

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  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
        }
  }

 view all matches for this distribution


( run in 1.249 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )