This file is indexed.

/usr/share/doc/libpoe-component-server-simplehttp-perl/examples/stream.pl is in libpoe-component-server-simplehttp-perl 2.20-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use POE;
use POE::Component::Server::SimpleHTTP;
use Sys::Hostname qw( hostname );

# Start the server!
POE::Component::Server::SimpleHTTP->new(
	'ALIAS'		=>	'HTTPD',
	'ADDRESS'	=>	127.0.0.1,
	'PORT'		=>	8080,
	'HANDLERS'	=>	[
		{
			'DIR'		=>	'.*',
			'SESSION'	=>	'HTTP_GET',
			'EVENT'		=>	'GOT_MAIN',
		},
	],
	'HEADERS'	=>	{
		'Server'	=>	'My Own Server',
	},
) or die 'Unable to create the HTTP Server';

# Create our own session to receive events from SimpleHTTP
POE::Session->create(
	inline_states => {
		'_start'	=>	sub { $_[KERNEL]->alias_set( 'HTTP_GET' ) },
		'GOT_MAIN'	   =>	\&GOT_REQ,
		'GOT_STREAM'	=>	\&GOT_STREAM,
	},
);

# Start POE!
POE::Kernel->run();

# We're done!
exit;

sub GOT_REQ {
	# ARG0 = HTTP::Request object, ARG1 = HTTP::Response object, ARG2 = the DIR that matched
	my( $request, $response, $dirmatch ) = @_[ ARG0 .. ARG2 ];

	# Do our stuff to HTTP::Response
	$response->code( 200 );
   
   $response->content_type("text/plain");
   
   # sets the response as streamed within our session with the stream event
   $response->stream(
      session  => 'HTTP_GET',
      event    => 'GOT_STREAM'
   );   

	# We are done!
	$_[KERNEL]->post( 'HTTPD', 'DONE', $response );
}

sub GOT_STREAM {
   my ( $kernel, $heap, $stream ) = @_[KERNEL, HEAP, ARG0];
   
   # the stream hash contains the wheel, the request, the response 
   # and an id associated the the wheel
   $stream->{'wheel'}->put("Hello World\n");

   # lets go on streaming ...
   POE::Kernel->delay('GOT_STREAM', 1, $stream );
}