/[pub]/suikawiki/script/lib/SuikaWiki/Output/HTTP.pm
Suika

Diff of /suikawiki/script/lib/SuikaWiki/Output/HTTP.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by wakaba, Sat Oct 18 07:08:34 2003 UTC revision 1.4 by wakaba, Fri Dec 26 06:48:09 2003 UTC
# Line 131  sub append_to_body ($$) { Line 131  sub append_to_body ($$) {
131    
132  sub output ($;%) {  sub output ($;%) {
133    my ($self, %opt) = @_;    my ($self, %opt) = @_;
134      ## Note: CGI/1.1 draft 3 recommends ("SHOULD") that
135      ##       "\x0A" should be used as new line in AmigaDOS and Un*x environments.
136    my $nl = $opt{output} eq 'http-cgi' ? "\n" : "\x0D\x0A";    my $nl = $opt{output} eq 'http-cgi' ? "\n" : "\x0D\x0A";
137    binmode STDOUT;    binmode STDOUT;
138    $| = 1;    $| = 1;
# Line 195  sub output ($;%) { Line 197  sub output ($;%) {
197      } elsif ($self->{wiki}->{var}->{client}->{user_agent_name}      } elsif ($self->{wiki}->{var}->{client}->{user_agent_name}
198               =~ m#Mozilla/0\.|Infomosaic#) {               =~ m#Mozilla/0\.|Infomosaic#) {
199      } else {      } else {
200        print qq(; charset="$charset");        print qq(; charset=).$self->___quote_word ($charset);
201      }      }
202    }    }
203    print $nl;    print $nl;
# Line 208  sub output ($;%) { Line 210  sub output ($;%) {
210    print $body;    print $body;
211  }  }
212    
213    ## Note: CGI/1.1 draft 3 does not allow HTTP Header Fields
214    ##       when Location: field is outputed.  This module does
215    ##       NOT follow that requirement.  The draft allows
216    ##       message-body explicitly, even if there is Location:.
217    ##       Therefore at least entity-header fields should be allowed.
218    
219    ## TODO: REDIRECT_URI support
220    
221    =item $self->exit
222    
223    Declares the instance ($self) no longer considered useful.
224    
225    =cut
226    
227    sub exit ($) {
228      my $self = shift;
229      delete $self->{wiki};
230      delete $self->{view};
231      delete $self->{viewobj};
232      $self->{exited} = 1;
233    }
234    
235    sub DESTROY ($) {
236      my $self = shift;
237      $self->exit unless $self->{exited};
238    }
239    
240    sub ___quote_word ($$) {
241      my ($self, $s) = @_;
242      if ($s =~ /[^0-9A-Za-z_.+-]/) {
243        $s =~ s/([\\"])/\\$1/g;
244        return qq<"$s">;
245      } else {
246        return $s;
247      }
248    }
249    
250  =item $self->{entity}->{charset}  =item $self->{entity}->{charset}
251  =item $self->{entity}->{language} = [...]  =item $self->{entity}->{language} = [...]
252  =item $self->{entity}->{media_type}  =item $self->{entity}->{media_type}

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24