++ Ovid.
This is the code that I usually run whenever I install perl on a new machine or update CGI.pm (I like to have my cake and eat it.)
use CGI;
use strict;
{
my %CGI_Patch;
local ($^I, @ARGV) = ('.bak', $INC{'CGI.pm'});
while (<>)
{
s/^(\s*\$POST_MAX\s*=\s*)([^;]*);/${1}1024 * 100;/
&& $CGI_Patch{POSTMAX}++;
s/^(\s*\$DISABLE_UPLOADS\s*=\s*)([^;]*);/${1}1;/
&& $CGI_Patch{NOUPLOADS}++;
# I'll have my cake and eat it too!...
my $cake = '\$query_string .= \(length\(\$query_string\)
+'.
'\? \'&\' : \'\'\) . \$ENV{\'QUERY_STRING\'}'.
' if defined \$ENV{\'QUERY_STRING\'};';
s/(\s*)#(\s*)($cake)/$1$2$3/ && $CGI_Patch{CAKE}++;
print;
close ARGV if eof;
}
print "CGI.pm ($INC{'CGI.pm'}) patch results...\n";
print '$POSTMAX updated...........' , $CGI_Patch{POSTMAX} , "\n";
print '$DISABLE_UPLOADS updated...' , $CGI_Patch{NOUPLOADS} , "\n"
+;
print 'Have your cake and eat it..' , $CGI_Patch{CAKE} , "\n";
}
Admittedly, this code is likely to break when CGI changes dramatically, so it's not as robust as CGI::Safe. I like to edit the source, so I make sure that everyone else's code on the server is a bit more secure.
Error: Keyboard not attached. Press F1 to continue.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|