The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Agent::TCLI::Package::Net::HTTPD

SYNOPSIS

From within a TCLI Agent session:

httpd uri add regex=^/good/.* response=OK200

DESCRIPTION

This module provides a package of commands for the TCLI environment. Currently one must use the TCLI environment (or browse the source) to see documentation for the commands it supports within the TCLI Agent.

This package starts a specialized HTTPD on the local system. It does not return files but does return 404 or 200 values for user defined URLs. It can also be set to completely ignore a request. URLs may be defined with regular expressions.

It can also log directly to the log being monitored by the Tail command in memory with no disk writes.

INTERFACE

This module must be loaded into a Agent::TCLI::Control by an Agent::TCLI::Transport in order for a user to interface with it.

ATTRIBUTES

The following attributes are accessible through standard <attribute> methods unless otherwise noted.

These attrbiutes are generally internal and are probably only useful to someone trying to enhance the functionality of this Package module.

ports

A hash of ports with HTTPD listeners running ports will only contain hash values.

handlers

The array of handlers for the SimpleHTTP server. handlers will only contain Array values.

METHODS

Most of these methods are for internal use within the TCLI system and may be of interest only to developers trying to enhance TCLI.

new ( hash of attributes )

Usually the only attributes that are useful on creation are the verbose and do_verbose attrbiutes that are inherited from Agent::TCLI::Base.

spawn

This POE event handler executes the spawn command to start a new HTTPD listener.

stop

This POE Event handler executes the stop command to shutdown a HTTPD listener.

uri

This POE Event handler excecutes the uri add and uri delete commands.

BeGone

This POE Event handler is used as a target event for URIs. It simply drops the connection. It will log the conenction if logging is turned on.

OK200

This POE Event handler is used as a target event for URIs. It will send an HTTP response code of 200 with the content 'OK'. It will log the conenction if logging is turned on.

NA404

This POE Event handler is used as a target event for URIs. It will send an HTTP response code of 404 with an error message. It will log the conenction if logging is turned on.

Log

This POE Event handler is used internally to provide the logging. It sends the time, remote ip:port, local ip:port, uri and optionally the SSL cipher to the Tail session.

INHERITED METHODS

This module is an Object::InsideOut object that inherits from Agent::TCLI::Package::Base. It inherits methods from both. Please refer to their documentation for more details.

AUTHOR

Eric Hacker <hacker at cpan.org>

BUGS

One cannot add uri's while a HTTPD server is running.

SHOULDS and MUSTS are currently not enforced.

Test scripts not thorough enough.

Probably many others.

LICENSE

Copyright (c) 2007, Alcatel Lucent, All rights resevred.

This package is free software; you may redistribute it and/or modify it under the same terms as Perl itself.