Here are a handful of the flaws of this code:

print "Content-type:text/html\n\n";

\n\n is the incorrect header terminator. \r\n\r\n is usually closer, but I admit that I don't know the proper set of characters off-hand, because I never send them directly.

if ($ENV{'REQUEST_METHOD'} eq "GET") {

Not technically incorrect, but there are HTTP verbs other than GET and POST.

read(STDIN, $request,$ENV{'CONTENT_LENGTH'})

There's no sanitizing of the CONTENT_LENGTH variable, leaving this script wide open to a denial of service attack by either blocking and waiting for more input than is available, or eating up all of the memory if someone sends a long stream of garbage. (I'm not positive that everything is vulnerable to the blocking attack.)

@parameter_list = split(/&/,$request);

; is also a key/value pair separator in HTTP.

$name =~ s/%([0-9A-F][0-9A-F])/pack("c",hex($1))/ge;

I believe there's a flaw in here related to invalid hex values, but I can't prove it right now.

$passed{$name} .= ":$value";

This makes no sense. I've used the colon in both keys and values before. An earlier version of similar code at least used null bytes; that seemed somewhat more sane.


In reply to Re^2: get parameter from html page by chromatic
in thread get parameter from html page by pritoshpandey

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.