Nicely done. I appreciate your sense of humor. I realize you are joking when you say "replacing apache". Here's my attempt to deobfuscate it.

<SPOILER FOLLOWS>
# Modified a little to get the spacing right # and to use strict. # Some of this code looks like an example from # The Perl Cookbook by Tom Christiansen p.606 use strict; use IO::Socket; # Specify the server home directory, port, # and "page found" status my $home_dir="/tmp/"; my $port=1280; my $response="HTTP/1.1 200 OK\nServer: "; $response .= "PimpHTTPD\nConnection: close\n\n"; my $file_name; # Open a listener server on the port we specified my $server=new IO::Socket::INET->new(Listen=>1, LocalPort=>$port)||die("Can't listen: $!"); # Accept equests from the client while(my $client=$server->accept()) { # Read client requests into scalar while(my $request=<$client>) { # Parse the file name to read in from the # GET request $file_name=$1 if($request=~/^GET\s+(\S+)/i); # Request is finished if there is a blank line last if($request=~/^\r?\s*\r?$/); } # Unescape escaped characters in the file name $file_name=~s/%([0-9A-Fa-f][0-9A-Fa-f])/hex($1)/g; # Ignore requests that try to read from the # parent directory. if($file_name =~ /\.\.\//) { $response="INVALID URL" } else { # It's a good file name-- let's read it. # Open the in file and add it to the response. if(open(INFILE,"<$home_dir$file_name")) { while(<INFILE>) { $response.=$_; } close(INFILE); } else { # If we can't open the file, show the error. $response="$home_dir$file_name:$!" } } # Output the response to the client. print $client $response; # Close the client. $client->close; }
-- Zeno - Barcelona Perl Mongers http://barcelona.pm.org http://www.javamonks.org

In reply to Re: Replace Apache by zeno
in thread Replace Apache by Weathros

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.