$W->{"r"}=Apache->request();
$W->{"QUERY_STRING"}=$W->{"r"}->args() || "";
- if ($W->{"QUERY_STRING"}=~/[&]amp;have_ent/)
- { $W->{"have_ent"}=0; }
- elsif ($W->{"QUERY_STRING"}=~ /[&]have_ent/)
- { $W->{"have_ent"}=1; }
- else
- { delete $W->{"have_ent"}; }
- if ($W->{"detect_ent"} && !defined $W->{"have_ent"} && $W->{"r"}->method() eq "GET") {
- $W->{"head"}.='<meta http-equiv="Refresh" content="0; URL='
- .CGI::escapeHTML("http://".&{$W->{"web_hostname_sub"}}()."/".($W->{"r"}->uri()=~m#^/*(.*)$#)[0]
- ."?".($W->{"QUERY_STRING"} || "detect_ent_glue=1").'&have_ent=detect')
- .'" />'."\n";
+ if ($W->{"detect_ent"}) {
+ if ($W->{"QUERY_STRING"}=~/[&]amp;have_ent/)
+ { $W->{"have_ent"}=0; }
+ elsif ($W->{"QUERY_STRING"}=~ /[&]have_ent/)
+ { $W->{"have_ent"}=1; }
+ else
+ { delete $W->{"have_ent"}; }
+ if (!defined $W->{"have_ent"} && $W->{"r"}->method() eq "GET") {
+ $W->{"head"}.='<meta http-equiv="Refresh" content="0; URL='
+ .CGI::escapeHTML("http://".&{$W->{"web_hostname_sub"}}()."/".($W->{"r"}->uri()=~m#^/*(.*)$#)[0]
+ ."?".($W->{"QUERY_STRING"} || "detect_ent_glue=1").'&have_ent=detect')
+ .'" />'."\n";
+ }
}
$W->{"QUERY_STRING"}=~s/([&])amp;/$1/g;
$W->{"r"}->args($W->{"QUERY_STRING"});
+ # Workaround: &CGI::Vars behaves weird if strings passed both as POST data and in: $QUERY_STRING
+ do { $W->{"r"}->args(""); delete $ENV{"QUERY_STRING"}; } if $W->{"r"}->method() eq "POST";
# Do not: $W->{"r"}->args()
# as it parses only QUERY_STRING (not POST data).
$W->{"args"}={ CGI->new($W->{"r"})->Vars() };
- for (keys(%{$W->{"args"}})) {
- my @vals=split /\x00/,$W->{"args"}{$_};
+ for my $name (keys(%{$W->{"args"}})) {
+ my @vals=split /\x00/,$W->{"args"}{$name};
next if @vals<=1;
- $W->{"args"}{$_}=[@vals];
+ $W->{"args"}{$name}=[@vals];
}
do { $W->{$_}=$W->{"r"}->headers_in()->{"Accept"} if !defined $W->{$_}; } for ("accept");
{
my($url,%args)=@_;
- return if !url_is_local $url;
+ return $url if !url_is_local $url;
$url=top_dir($url,%args) if $url=~m#^/# || $args{"abs"};
my $uri=URI->new($url);
$contents=~s#<a\b[^>]*>##gi;
$contents=~s#</a>##gi;
- $url=url_out($url);
+ $url=url_out($url,%args);
my $r='<a href="';
my $urlent=CGI::escapeHTML($url);
$W->{"r"}->send_http_header("text/html; charset=$client_charset"); # "Content-type"; do not use header()
}
- return if $W->{"heading_done"}++;
exit if $W->{"r"}->header_only();
return if $W->{"header_only"};
+ # We still can append headers before we put out some text.
+ # FIXME: It is not clean to still append them without overwriting.
+ return if $W->{"heading_done"}++;
if (1) { # || !$msie_major || $msie_major>=4) # TODO:dyn
Wprint '<?xml version="1.0" encoding="'.$client_charset.'"?>'."\n";