File: test.pl

package info (click to toggle)
libapache2-mod-rpaf 0.5-3%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 112 kB
  • ctags: 53
  • sloc: ansic: 235; makefile: 28; perl: 16
file content (26 lines) | stat: -rw-r--r-- 581 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w

use strict;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Headers;

my $ip = shift || '10.0.0.1';

my $ua = LWP::UserAgent->new;
my $headers = HTTP::Headers->new();

$headers->header('X-Forwarded-For' => "192.168.0.1, " . $ip);
$headers->header('X-Host' => 'localhost');

my $request = HTTP::Request->new('GET', 'http://localhost:8080/', $headers);

my $response = $ua->request($request);

if ($response->is_success) {
    print "Ok! Please check your server log for a supposed connection from $ip\n";
} else {
    print "Something went wrong\n";
}

__END__