this feels like the start of a chunked response.  something is awry with the
buffering in the response... or somesuch IIRC :)
For reference the relevant code is: $query is a CGI.pm object

sub guesscharset ($) {
    my($html) = @_;
    my $charset = undef;
    local($`, $&, $', $1, $2, $3);
    # FIXME... These regular expressions will miss a lot of valid tags!
if ($html =~ /<meta\s+http-equiv=(["']?)Content-Type\1\s+content=(["'])text\/html\s*;\s*charset=([^\2\s\r\n]+)\2\s*(?:\/?)>/is) {
        $charset = $3;
} elsif ($html =~ /<meta\s+content=(["'])text\/html\s*;\s*charset=([^\1\s\r\n]+)\1\s+http-equiv=(["']?)Content-Type\3\s*(?:\/?)>/is) {
        $charset = $2;
    }
    return $charset;
} # guess

sub guesstype ($) {
    my($html) = @_;
    my $charset = guesscharset($html);
    return defined $charset? "text/html; charset=$charset": "text/html";
}

=item output_html_with_http_headers

   &output_html_with_http_headers($query, $cookie, $html)

Outputs the HTML page $html with the appropriate HTTP headers,
with the authentication cookie $cookie and a Content-Type that
corresponds to the HTML page $html.

=cut

sub output_html_with_http_headers ($$$) {
    my($query, $cookie, $html) = @_;
    print $query->header(
    -type   => guesstype($html),
    -cookie => $cookie,
    ), $html;
}

--
END
------------------------------------------------------------
    What doesn't kill us can only make us stronger.
                Nothing is impossible.
                                
Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
       http://www.liquidation.com
       http://www.uksurplus.com
       http://www.govliquidation.com
       http://www.gowholesale.com

Reply via email to