62 |
<dt>Request URI</dt> |
<dt>Request URI</dt> |
63 |
<dd><code class="URI" lang=""><<a href="@{[htescape $input->{request_uri}]}">@{[htescape $input->{request_uri}]}</a>></code></dd> |
<dd><code class="URI" lang=""><<a href="@{[htescape $input->{request_uri}]}">@{[htescape $input->{request_uri}]}</a>></code></dd> |
64 |
<dt>Document URI</dt> |
<dt>Document URI</dt> |
65 |
<dd><code class="URI" lang=""><<a href="@{[htescape $input->{uri}]}">@{[htescape $input->{uri}]}</a>></code></dd> |
<dd><code class="URI" lang=""><<a href="@{[htescape $input->{uri}]}" id=anchor-document-uri>@{[htescape $input->{uri}]}</a>></code> |
66 |
|
<script> |
67 |
|
document.title = '<' |
68 |
|
+ document.getElementById ('anchor-document-uri').href + '> \\u2014 ' |
69 |
|
+ document.title; |
70 |
|
</script></dd> |
71 |
]; # no </dl> yet |
]; # no </dl> yet |
72 |
push @nav, ['#document-info' => 'Information']; |
push @nav, ['#document-info' => 'Information']; |
73 |
|
|
79 |
<dd><code class="URI" lang=""><<a href="@{[htescape $input->{base_uri}]}">@{[htescape $input->{base_uri}]}</a>></code></dd> |
<dd><code class="URI" lang=""><<a href="@{[htescape $input->{base_uri}]}">@{[htescape $input->{base_uri}]}</a>></code></dd> |
80 |
<dt>Internet Media Type</dt> |
<dt>Internet Media Type</dt> |
81 |
<dd><code class="MIME" lang="en">@{[htescape $input->{media_type}]}</code> |
<dd><code class="MIME" lang="en">@{[htescape $input->{media_type}]}</code> |
82 |
@{[$input->{media_type_overridden} ? '<em>(overridden)</em>' : '']}</dd> |
@{[$input->{media_type_overridden} ? '<em>(overridden)</em>' : defined $input->{official_type} ? $input->{media_type} eq $input->{official_type} ? '' : '<em>(sniffed; official type is: <code class=MIME lang=en>'.htescape ($input->{official_type}).'</code>)' : '<em>(sniffed)</em>']}</dd> |
83 |
<dt>Character Encoding</dt> |
<dt>Character Encoding</dt> |
84 |
<dd>@{[defined $input->{charset} ? '<code class="charset" lang="en">'.htescape ($input->{charset}).'</code>' : '(none)']} |
<dd>@{[defined $input->{charset} ? '<code class="charset" lang="en">'.htescape ($input->{charset}).'</code>' : '(none)']} |
85 |
@{[$input->{charset_overridden} ? '<em>(overridden)</em>' : '']}</dd> |
@{[$input->{charset_overridden} ? '<em>(overridden)</em>' : '']}</dd> |
98 |
|
|
99 |
if ($input->{media_type} eq 'text/html') { |
if ($input->{media_type} eq 'text/html') { |
100 |
($doc, $el) = print_syntax_error_html_section ($input, $result); |
($doc, $el) = print_syntax_error_html_section ($input, $result); |
101 |
print_source_string_section (\($input->{s}), $input->{charset}); |
print_source_string_section |
102 |
|
(\($input->{s}), $input->{charset} || $doc->input_encoding); |
103 |
} elsif ({ |
} elsif ({ |
104 |
'text/xml' => 1, |
'text/xml' => 1, |
105 |
'application/atom+xml' => 1, |
'application/atom+xml' => 1, |
1003 |
|
|
1004 |
## TODO: More strict parsing... |
## TODO: More strict parsing... |
1005 |
my $ct = $res->header ('Content-Type'); |
my $ct = $res->header ('Content-Type'); |
|
if (defined $ct and $ct =~ m#^([0-9A-Za-z._+-]+/[0-9A-Za-z._+-]+)#) { |
|
|
$r->{media_type} = lc $1; |
|
|
} |
|
1006 |
if (defined $ct and $ct =~ /;\s*charset\s*=\s*"?([^\s;"]+)"?/i) { |
if (defined $ct and $ct =~ /;\s*charset\s*=\s*"?([^\s;"]+)"?/i) { |
1007 |
$r->{charset} = lc $1; |
$r->{charset} = lc $1; |
1008 |
$r->{charset} =~ tr/\\//d; |
$r->{charset} =~ tr/\\//d; |
1013 |
$r->{charset_overridden} |
$r->{charset_overridden} |
1014 |
= (not defined $r->{charset} or $r->{charset} ne $input_charset); |
= (not defined $r->{charset} or $r->{charset} ne $input_charset); |
1015 |
$r->{charset} = $input_charset; |
$r->{charset} = $input_charset; |
1016 |
} |
} |
1017 |
|
|
1018 |
|
## TODO: Support for HTTP Content-Encoding |
1019 |
|
|
1020 |
$r->{s} = ''.$res->content; |
$r->{s} = ''.$res->content; |
1021 |
|
|
1022 |
|
require Whatpm::ContentType; |
1023 |
|
($r->{official_type}, $r->{media_type}) |
1024 |
|
= Whatpm::ContentType->get_sniffed_type |
1025 |
|
(get_file_head => sub { |
1026 |
|
return substr $r->{s}, 0, shift; |
1027 |
|
}, |
1028 |
|
http_content_type_byte => $ct, |
1029 |
|
has_http_content_encoding => |
1030 |
|
defined $res->header ('Content-Encoding'), |
1031 |
|
supported_image_types => {}); |
1032 |
} else { |
} else { |
1033 |
$r->{uri} = $res->request->uri; |
$r->{uri} = $res->request->uri; |
1034 |
$r->{request_uri} = $request_uri; |
$r->{request_uri} = $request_uri; |
1050 |
$r->{charset} =~ s/\s+//g; |
$r->{charset} =~ s/\s+//g; |
1051 |
$r->{charset} = 'utf-8' if $r->{charset} eq ''; |
$r->{charset} = 'utf-8' if $r->{charset} eq ''; |
1052 |
$r->{header_field} = []; |
$r->{header_field} = []; |
1053 |
|
|
1054 |
|
require Whatpm::ContentType; |
1055 |
|
($r->{official_type}, $r->{media_type}) |
1056 |
|
= Whatpm::ContentType->get_sniffed_type |
1057 |
|
(get_file_head => sub { |
1058 |
|
return substr $r->{s}, 0, shift; |
1059 |
|
}, |
1060 |
|
http_content_type_byte => undef, |
1061 |
|
has_http_content_encoding => 0, |
1062 |
|
supported_image_types => {}); |
1063 |
} |
} |
1064 |
|
|
1065 |
my $input_format = $http->get_parameter ('i'); |
my $input_format = $http->get_parameter ('i'); |