NAME
Apache2::ClickPath::Decode - Decode Apache2::ClickPath session IDs
SYNOPSIS
use Apache2::ClickPath::Decode;
my $decoder=Apache2::ClickPath::Decode->new;
$decoder->tag='-';
my $time=$decoder
->parse( 'http://bla.com/-PtVOR9:dxAredNNqtcus9NNNOdM/' )
->creation_time;
DESCRIPTION
Apache2::ClickPath::Decode provides an OO interface for decoding Apache2::ClickPath session identifiers.
Methods
This module uses Class::Member(3) to implement member functions. Thus, all member functions are lvalues, eg $decoder->tag='-'.
- new
-
The constructor. If called as instance method it creates a new instance that inherits the
friendly_session,tagandserver_mapattributes if they are not overridden be parameters.new()accepts named parameters asNAME => VALUEpairs. The following parameters are recognized:- friendly_session
- tag
- server_map
- secret
- secret_iv
-
for these 3 see the appropriate member functions below.
- session
-
if a session is given,
parse()is called immediately. So, the result is directly accessible.
- parse
-
parse()is called with an optional parameter containing the actual session identifier. If ommitted the internally stored session identifier is used.If the object's
tagattribute is set the session can actually contain an URL or an arbitrary string containing a session identifier that is preceded with the tag and ended with a slash (/). After parsing thesessionmember function returns the found session without surrounding characters.After
parsethe session information can be fetched bycreation_timeserver_pid,seq_number,connection_id,remote_session,remote_session_hostandserver_idmember functions.If the
friendly_sessionattribute is given and the session contains a friendly session then theremote_sessionandremote_session_hostmember functions will return the remote session.If the
server_mapattribute is set theserver_idmember function will return the machine's name according to theApache2::ClickPaths'sClickPathMachinedirective. Currently this attribute must be assigned an emtpy string or left undefined. Otherwize a warning is issued. If defined the sessions server-id part is directly assigned toserver_id. If not defined it indicates that theClickPathMachinedirective was not given in yourhttpd.confand the server-id is to be interpreted as IP address.parsereturns the object itself on success orundef.
Member Functions
- tag
-
this member function matches
Apache2::ClickPath'sClickPathSessionPrefixdirective. If given the module can identify session identifiers in URLs. So,parse()can be called directly with an URL. If not given the whole string passed toparse()is tried as session identifier. - friendly_session
-
this matches
Apache2::ClickPath'sClickPathFriendlySessionscontainer directive. It can be set to a string consiting of lines each describing a friendly session as the directive in yourhttpd.confdoes. - server_map
-
if left undefined
parse()will interpret the server-id part of a session identifier as IP address. If set to an empty string it will not. If set to a non-empty string it will be interpreted the same way asApache2::ClickPathinterprets aClickPathMachineTable. This table is then used to map a server name to a server_id (IP address).Also a HASH can be given instead of a string. Then this hash maps the server_name to a server_id.
- secret
- secret_iv
-
these 2 functions correspond to the
ClickPathSecretandClickPathSecretIVconfiguration directives of Apache2::ClickPath. Syntax and semantic are the same. - session
-
is initialized with a session identifier or an URL. After
parse()is called it contains the session identifier. - remote_session
- remote_session_host
- server_id
- server_name
- creation_time
- server_pid
- seq_number
- connection_id
-
These members are initialized be
parse()to hold the components of the parsed session. For the first 3 seeparse()above and Apache2::ClickPath(3).creation_timereturns the sessions creation time in seconds since 1/1/1970 00:00 GMT,server_pidthe WEB server's process id,seq_numbera 16-bit number that is incremented for each new session a WEB server process creates. At process start up is is initialized with a random number. So it does not indicate how much sessions a server process has created.connection_idcontains the Apache's connection ID. Refer to Apache's source code an docs for more information.
SEE ALSO
Apache2::ClickPath(3), http://httpd.apache.org
AUTHOR
Torsten Foertsch, <torsten.foertsch@gmx.net>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Torsten Foertsch
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.