diff --git a/lib/http_server.pl b/lib/http_server.pl
index 5f8100d55..523d07809 100644
--- a/lib/http_server.pl
+++ b/lib/http_server.pl
@@ -328,12 +328,14 @@ sub http_process_request {
if ( $req_typ eq "POST" || $req_typ eq "PUT" ) {
my $cl = $Http{'Content-Length'}
|| $Http{'Content-length'}; # Netscape uses lower case l
- print "http POST query has $cl bytes of args\n" if $main::Debug{http};
+ print
+ "http POST query has $cl bytes of args\n"; # if $main::Debug{http};
my $buf;
read $socket, $buf, $cl;
# Save the body into the global var
$HTTP_BODY = $buf;
+ print "http POST buf=$buf get_arg=$get_arg\n" if $main::Debug{http};
# This is a bad practice to merge the body and arguments together as the
# body may not always contain an argument string. It may contain JSON
@@ -341,10 +343,17 @@ sub http_process_request {
# Since I can't figure out if any bad code relies on merging the body
# into the arguments, the following regex tests if the body is a valid
# argument string. If it is, the body is merged.
- if ( $buf =~ /^([-\+=&;%@.\w_]*)\s*$/ ) {
+ if ( $buf =~ /^([-\+=&;%@.*\w_]*)\s*$/ ) {
+ print "http POST in loop\n" if $main::Debug{http};
$get_arg .= "&" if ( $get_arg ne '' );
$get_arg .= $buf;
}
+ else {
+ &main::print_log(
+ "[http_server.pl]: Warning, invalid argument string detected ($buf)\n"
+ );
+ }
+ print "http POST get_arg=$get_arg\n" if $main::Debug{http};
# shutdown($socket->fileno(), 0); # "how": 0=no more receives, 1=sends, 2=both
}
@@ -422,23 +431,24 @@ sub http_process_request {
$get_arg =~ s/%([0-9a-fA-F]{2})/pack("C",hex($1))/ge;
- # print "http: gr=$get_req ga=$get_arg\n" if $main::Debug{http};
+ print "http: gr=$get_req ga=$get_arg\n" if $main::Debug{http};
# Store so that include files have access to parent args
$ENV{HTTP_QUERY_STRING} = $get_arg;
# Prompt for password (SET_PASSWORD) and allow for UNSET_PASSWORD
if ( $get_req =~ /SET_PASSWORD$/ ) {
- my ($mode) = ($Http{Referer} =~ /https?:\/\/\S+:?\D*\/(\S+)\//);
+ my ($mode) = ( $Http{Referer} =~ /https?:\/\/\S+:?\D*\/(\S+)\// );
if ( $config_parms{password_menu} eq 'html' ) {
my $html = &html_authorized;
if ( $get_req =~ /^\/UNSET_PASSWORD$/ ) {
$Authorized = 0;
$Cookie .= "Set-Cookie: password=xyz ; ; path=/;\n";
- $html .= "";
+ $html .= "";
}
- $html .= "
Refresh: Main Page\n" unless (lc $mode eq "ia7");
+ $html .= "
Refresh: Main Page\n"
+ unless ( lc $mode eq "ia7" );
$html .= &html_password('') . '
';
print $socket &html_page( undef, $html, undef, undef, undef,
undef );
@@ -446,7 +456,7 @@ sub http_process_request {
else {
my $html = &html_authorized;
$html .= "
Refresh: Main Page\n";
- $html .= "
set_password else Referrer: $Http{Referer}\n";
+ $html .= "
set_password else Referrer: $Http{Referer}\n";
# $html .= &html_reload_link('/', 'Refresh Main Page'); # Does not force reload?
my ( $name, $name_short ) = &net_domain_name('http');
@@ -474,7 +484,7 @@ sub http_process_request {
# Process the html password form
elsif ( $get_req =~ /\/SET_PASSWORD_FORM$/ ) {
- my ($mode) = ($Http{Referer} =~ /https?:\/\/\S+:?\D*\/(\S+)\//);
+ my ($mode) = ( $Http{Referer} =~ /https?:\/\/\S+:?\D*\/(\S+)\// );
my ($password) = $get_arg =~ /password=(\S+)/;
my ($html);
my ( $name, $name_short ) = &net_domain_name('http');
@@ -483,6 +493,7 @@ sub http_process_request {
$html .= &html_authorized;
$html .= "REMOVEME = get_arg = " . $get_arg . "
\n";
$html .= "
Refresh: Main Page\n";
+
# $html .= &html_reload_link('/', 'Refresh Main Page');
$html .= &html_password('');
if ($password_crypted) {
@@ -798,23 +809,28 @@ sub http_process_request {
sub html_password {
my ($menu) = @_;
$menu = $config_parms{password_menu} unless $menu;
- my ($mode) = ($Http{Referer} =~ /https?:\/\/\S+:?\D*\/(\S+)\//);
+ my ($mode) = ( $Http{Referer} =~ /https?:\/\/\S+:?\D*\/(\S+)\// );
# return $html_unauthorized unless $Authorized;
my $html;
if ( $menu eq 'html' ) {
- $html = qq[
This form is used for logging into MisterHouse.
For administration please see the documentation of set_password
This form is used for logging into MisterHouse.
For administration please see the documentation of set_password