Hello Wise, Venerable Monks,
I come again seeking out your wisdom on all things perl. I am using a webserver as a front end for my perl applications and need to make sure that it is secure. I only want it to accept connections locally and ignore all outside requests. Below I only define the local requests but I'm unsure if this is enough to prevent outside connections.
Unfortunately I only have one pc on this network also to test. Any information from someone with more experience working with HTTP::Daemon would be greatly appreciated. Thank you!
use HTTP::Daemon;
use HTTP::Status;
require 'C:\\rrships\\default.cgi';
my $d = HTTP::Daemon->new(Listen => 5,
LocalAddr => 'localhost',
LocalPort => 80,
Proto => 'tcp') or die "Can't bin
+d : $@\n";
# print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
# print $r->url->path . "\n";
if ($r->method eq 'GET') {
my $response = HTTP::Response->new(200);
$response->content(&Hello_World($r->url->path, $r->url->
+query));
$response->header("Content-Type" => "text/html");
$c->send_response($response);
}
else {
$c->send_error(RC_FORBIDDEN)
}
}
$c->close;
undef($c);
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.