From: Nicolas Boisselier Date: Sun, 26 Nov 2023 10:18:39 +0000 (+0100) Subject: lib/perl/NB/CGI.pm X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=8fd96e50993c3f8d27dec5cb80a9c6b4b777bdc1;p=nb.git lib/perl/NB/CGI.pm --- diff --git a/lib/perl/NB/CGI.pm b/lib/perl/NB/CGI.pm index fa18070b..2fc46067 100644 --- a/lib/perl/NB/CGI.pm +++ b/lib/perl/NB/CGI.pm @@ -1,8 +1,12 @@ # NB 22.11.23 package NB::CGI; use strict; -our $PARAM_UTF8 = 1 unless defined $PARAM_UTF8; +#our $PARAM_UTF8 = 1 unless defined $PARAM_UTF8; +#$CGI::PARAM_UTF8 = 1 unless defined $CGI::PARAM_UTF8; use parent qw/CGI/; +$CGI::PARAM_UTF8 = 1; +#$CGI::PARAM_UTF8 = 1 unless defined $CGI::PARAM_UTF8; +#&CGI::init; &CGI::charset('utf-8') if $CGI::PARAM_UTF8; my $isTextOutput = 0; @@ -82,25 +86,40 @@ sub textOutput {{ }} sub header { + my($self,@p) = &CGI::self_or_default(@_); my $status = '200 OK'; - if (!CGI::nph()) + if (!&CGI::nph()) { - for (my $i=0;$i<@_-1;$i++) + for (my $i=0;$i<@p-1;$i++) { - next if $_[$i] ne '-status'; - $status = $_[$i+1]; - splice(@_,$i,2); + next if $p[$i] ne '-status'; + $status = $p[$i+1]; + splice(@p,$i,2); } } + + # NB 26.11.23 for (my $i=0;$i<@_-1;$i++) + # NB 26.11.23 { + # NB 26.11.23 next if $_[$i] ne '-type'; + # NB 26.11.23 #$status = $_[$i+1]; + # NB 26.11.23 #splice(@_,$i,2); + # NB 26.11.23 } + my @head = (); $ENV{SERVER_PROTOCOL} ||= 'HTTP/1.1'; - push @head,$ENV{SERVER_PROTOCOL}." $status\r\n"; + #push @head,$ENV{SERVER_PROTOCOL}." $status\r\n"; + push @head,$ENV{SERVER_PROTOCOL}." $status"; #delete $_->{'status'}; - push @head,CGI::header(@_); - return join('',@head); + push @head,&CGI::header(@p); + return join($CGI::CRLF,@head); } +# NB 26.11.23 sub init { + # NB 26.11.23 &CGI::init; + # NB 26.11.23 &CGI::charset('utf-8') if $CGI::PARAM_UTF8; +# NB 26.11.23 } + sub start_html { local $_ = &CGI::start_html(@_); s///s;