Log sent headers in debug mode (#365)

This commit is contained in:
Clément Oudot 2011-10-05 14:33:05 +00:00
parent 110995f131
commit 9a1df7b401
5 changed files with 13 additions and 11 deletions

View File

@ -16,7 +16,7 @@ use base qw(Lemonldap::NG::Handler::SharedConf);
use utf8;
no utf8;
our $VERSION = '1.0.0';
our $VERSION = '1.1.2';
# We need just this constant, that's why Portal is 'required' but not 'used'
*PE_OK = *Lemonldap::NG::Portal::SharedConf::PE_OK;
@ -140,7 +140,7 @@ sub run ($$) {
$class->hideCookie;
# Hide user password
lmSetHeaderIn( $apacheRequest, Authorization => '' );
$class->lmSetHeaderIn( $apacheRequest, Authorization => '' );
OK;
}

View File

@ -138,7 +138,7 @@ sub run {
return $class->_returnError() unless $key;
# Header location
lmSetHeaderIn( $r, $secureTokenHeader => $key );
$class->lmSetHeaderIn( $r, $secureTokenHeader => $key );
# Remove token
eval 'use Apache2::Filter' unless ( $INC{"Apache2/Filter.pm"} );

View File

@ -240,13 +240,13 @@ sub regRemoteIp {
return $str;
}
## @rfn void lmSetHeaderIn(Apache2::RequestRec r, string h, string v)
## @rmethod void lmSetHeaderIn(Apache2::RequestRec r, string h, string v)
# Set an HTTP header in the HTTP request.
# @param $r Current request
# @param $h Name of the header
# @param $v Value of the header
sub lmSetHeaderIn {
my ( $r, %hdr ) = splice @_;
my ( $class, $r, %hdr ) = splice @_;
while ( my ( $h, $v ) = each %hdr ) {
if ( MP() == 2 ) {
$r->headers_in->set( $h => $v );
@ -254,6 +254,7 @@ sub lmSetHeaderIn {
elsif ( MP() == 1 ) {
$r->header_in( $h => $v );
}
$class->lmLog( "Send header $h with value $v", 'debug' );
}
}
@ -776,7 +777,7 @@ sub hideCookie {
$class->lmLog( "$class: removing cookie", 'debug' );
my $tmp = lmHeaderIn( $apacheRequest, 'Cookie' );
$tmp =~ s/$cookieName(?:http)?[^,;]*[,;]?//og;
lmSetHeaderIn( $apacheRequest, 'Cookie' => $tmp );
$class->lmSetHeaderIn( $apacheRequest, 'Cookie' => $tmp );
}
## @rmethod protected string encodeUrl(string url)
@ -1320,7 +1321,8 @@ qq{<html><body onload="document.getElementById('f').submit()"><form id="f" metho
## @rmethod protected void sendHeaders()
# Launch function compiled by forgeHeadersInit()
sub sendHeaders {
lmSetHeaderIn( $apacheRequest, &$forgeHeaders );
my ($class) = splice @_;
$class->lmSetHeaderIn( $apacheRequest, &$forgeHeaders );
}
## @rmethod protected boolean isProtected()

View File

@ -12,7 +12,7 @@ use Lemonldap::NG::Handler::SharedConf qw(:all);
use base qw(Lemonldap::NG::Handler::SharedConf);
use Digest::MD5;
our $VERSION = '1.0.0';
our $VERSION = '1.1.2';
# Shared variables
our ( $sympaSecret, $sympaMailKey );
@ -80,7 +80,7 @@ sub run {
$tmp = lmHeaderIn( $r, 'Cookie' );
$tmp =~ s/\bsympauser=[^,;]*[,;]?//;
$tmp .= $tmp ? ";$str" : $str;
lmSetHeaderIn( $r, 'Cookie' => $tmp );
$class->lmSetHeaderIn( $r, 'Cookie' => $tmp );
# Return SUPER::run() result
return $ret;

View File

@ -13,7 +13,7 @@ use Lemonldap::NG::Handler::Simple qw(:locationRules :headers :post :apache)
use MIME::Base64;
use constant SAFEWRAP => ( Safe->can("wrap_code_ref") ? 1 : 0 );
our $VERSION = '1.1.0';
our $VERSION = '1.1.2';
## @imethod protected void defaultValuesInit(hashRef args)
# Set default values for non-customized variables
@ -124,7 +124,7 @@ sub sendHeaders {
my $vhost;
$vhost = $apacheRequest->hostname;
if ( defined( $forgeHeaders->{$vhost} ) ) {
lmSetHeaderIn( $apacheRequest, &{ $forgeHeaders->{$vhost} } );
$class->lmSetHeaderIn( $apacheRequest, &{ $forgeHeaders->{$vhost} } );
}
}