1 |
wakaba |
1.1 |
|
2 |
|
|
=head1 NAME |
3 |
|
|
|
4 |
|
|
Message::Header::RFC822 --- Internet Messages -- Definition |
5 |
|
|
for RFC822 Namespaces of Header Fields |
6 |
|
|
|
7 |
|
|
=cut |
8 |
|
|
|
9 |
|
|
require Message::Header::Default; |
10 |
|
|
package Message::Header::HTTP; |
11 |
|
|
use strict; |
12 |
|
|
use vars qw($VERSION); |
13 |
wakaba |
1.7 |
$VERSION=do{my @r=(q$Revision: 1.7 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
14 |
wakaba |
1.1 |
|
15 |
|
|
our %OPTION = %Message::Header::Default::OPTION; |
16 |
|
|
$OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:http'; |
17 |
|
|
$OPTION{namespace_phname} = 'x-http'; |
18 |
|
|
$OPTION{namespace_phname_goodcase} = 'X-HTTP'; |
19 |
|
|
|
20 |
|
|
$OPTION{case_sensible} = 0; |
21 |
|
|
$OPTION{to_be_goodcase} = \&Message::Header::Default::_goodcase; |
22 |
|
|
|
23 |
wakaba |
1.4 |
$OPTION{field_sort} = {qw/alphabetic 1 good-practice 1/}; |
24 |
|
|
$OPTION{field_sort_good_practice_order} = {}; |
25 |
|
|
{ |
26 |
|
|
my $i = 1; |
27 |
|
|
for ( |
28 |
wakaba |
1.7 |
qw/status x-cgi-/, ## CGI header |
29 |
wakaba |
1.4 |
qw/man c-man opt c-opt ext c-ext |
30 |
|
|
cache-control connection date pragma transfer-encoding upgrade trailer via |
31 |
wakaba |
1.5 |
keep-alive/, ## General-Headers |
32 |
wakaba |
1.4 |
qw/accept accept-charset accept-encoding accept-language |
33 |
|
|
authorization expect from host |
34 |
|
|
if-modified-since if-match if-none-match if-range if-unmodified-since |
35 |
|
|
max-forwards proxy-authorization range referer te user-agent/, ## Request-Headers |
36 |
|
|
qw/accept-ranges age location proxy-authenticate retry-after server vary |
37 |
wakaba |
1.5 |
warning www-authenticate alternates/, ## Response-Headers |
38 |
wakaba |
1.7 |
qw/allow etag expires last-modified base link window-target |
39 |
|
|
derived-from mime-version content-/, ## Entity-Headers |
40 |
wakaba |
1.4 |
) { |
41 |
|
|
$OPTION{field_sort_good_practice_order}->{$_} = $i++; |
42 |
|
|
} |
43 |
|
|
} |
44 |
|
|
|
45 |
wakaba |
1.1 |
$OPTION{goodcase} = { |
46 |
|
|
'pics-label' => 'PICS-Label', |
47 |
|
|
'message-id' => 'Message-ID', |
48 |
|
|
'mime-version' => 'MIME-Version', |
49 |
|
|
uri => 'URI', |
50 |
|
|
}; |
51 |
|
|
|
52 |
|
|
$OPTION{value_type} = { |
53 |
|
|
':default' => ['Message::Field::Unstructured'], |
54 |
wakaba |
1.5 |
status => ['Message::Field::Status'], |
55 |
wakaba |
1.1 |
|
56 |
wakaba |
1.7 |
## HTTP-Date / delta-econd |
57 |
|
|
age => ['Message::Field::Date'], ## ds |
58 |
|
|
date => ['Message::Field::Date'], ## hd |
59 |
|
|
expires => ['Message::Field::Date'], ## hd / ds |
60 |
wakaba |
1.1 |
'if-modified-since' => ['Message::Field::Date'], |
61 |
wakaba |
1.5 |
'if-unmodified-since' => ['Message::Field::Date'], |
62 |
wakaba |
1.7 |
'last-modified' => ['Message::Field::Date'], ## hd |
63 |
wakaba |
1.1 |
|
64 |
|
|
p3p => ['Message::Field::Params'], |
65 |
wakaba |
1.7 |
refresh => ['Message::Field::ValueParams'], |
66 |
wakaba |
1.5 |
'window-target' => ['Message::Field::ValueParams'], |
67 |
wakaba |
1.1 |
'mime-version' => ['Message::Field::Numval'], |
68 |
wakaba |
1.5 |
from => ['Message::Field::Addresses'], |
69 |
wakaba |
1.7 |
host => ['Message::Field::Domain',{ |
70 |
|
|
-format_ipv4 => '%vd', |
71 |
|
|
-format_ipv6 => '[%s]', |
72 |
|
|
-output_port => 1, |
73 |
|
|
-use_comment => 0, |
74 |
|
|
-use_port => 1, |
75 |
|
|
}], |
76 |
wakaba |
1.1 |
|
77 |
wakaba |
1.5 |
## product |
78 |
wakaba |
1.1 |
server => ['Message::Field::UA'], |
79 |
|
|
'user-agent' => ['Message::Field::UA'], |
80 |
|
|
|
81 |
wakaba |
1.5 |
## Comma Separated List |
82 |
wakaba |
1.7 |
accept => ['Message::Field::CSV',{ |
83 |
|
|
-is_quoted_string => 0, |
84 |
|
|
-use_comment => 0, |
85 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
86 |
|
|
}], |
87 |
|
|
'accept-charset' => ['Message::Field::CSV',{ |
88 |
|
|
-is_quoted_string => 0, |
89 |
|
|
-use_comment => 0, |
90 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
91 |
|
|
}], |
92 |
|
|
'accept-encoding' => ['Message::Field::CSV',{ |
93 |
|
|
-is_quoted_string => 0, |
94 |
|
|
-use_comment => 0, |
95 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
96 |
|
|
}], |
97 |
|
|
'accept-language' => ['Message::Field::CSV',{ |
98 |
|
|
-is_quoted_string => 0, |
99 |
|
|
-use_comment => 0, |
100 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
101 |
|
|
}], |
102 |
|
|
'accept-range' => ['Message::Field::CSV',{ |
103 |
|
|
-is_quoted_string => 0, |
104 |
|
|
-use_comment => 0, |
105 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
106 |
|
|
}], |
107 |
|
|
'cache-control' => ['Message::Field::CSV',{ |
108 |
|
|
-is_quoted_string => 0, |
109 |
|
|
-use_comment => 0, |
110 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
111 |
|
|
}], |
112 |
wakaba |
1.1 |
link => ['Message::Field::CSV'], |
113 |
wakaba |
1.7 |
man => ['Message::Field::CSV',{ |
114 |
|
|
-is_quoted_string => 0, |
115 |
|
|
-use_comment => 0, |
116 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
117 |
|
|
}], |
118 |
|
|
'c-man' => ['Message::Field::CSV',{ |
119 |
|
|
-is_quoted_string => 0, |
120 |
|
|
-use_comment => 0, |
121 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
122 |
|
|
}], |
123 |
|
|
opt => ['Message::Field::CSV',{ |
124 |
|
|
-is_quoted_string => 0, |
125 |
|
|
-use_comment => 0, |
126 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
127 |
|
|
}], |
128 |
|
|
'c-opt' => ['Message::Field::CSV',{ |
129 |
|
|
-is_quoted_string => 0, |
130 |
|
|
-use_comment => 0, |
131 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
132 |
|
|
}], |
133 |
|
|
te => ['Message::Field::CSV',{ |
134 |
|
|
-is_quoted_string => 0, |
135 |
|
|
-use_comment => 0, |
136 |
|
|
-value_type => {'*default' => ['Message::Field::ValueParams']}, |
137 |
|
|
}], |
138 |
|
|
trailer => ['Message::Field::CSV',{ |
139 |
|
|
-output_comment => 0, |
140 |
|
|
-value_case_sensible => 1, |
141 |
|
|
}], |
142 |
|
|
'transfer-encoding' => ['Message::Field::CSV',{ |
143 |
|
|
-output_comment => 0, |
144 |
|
|
-value_case_sensible => 1, |
145 |
|
|
}], |
146 |
|
|
upgrade => ['Message::Field::CSV'], ## 1#product |
147 |
wakaba |
1.1 |
uri => ['Message::Field::CSV'], |
148 |
wakaba |
1.7 |
vary => ['Message::Field::CSV',{ |
149 |
|
|
-output_comment => 0, |
150 |
|
|
-value_case_sensible => 1, |
151 |
|
|
}], |
152 |
wakaba |
1.6 |
warning => ['Message::Field::CSV',{ |
153 |
|
|
-is_quoted_string => 0, |
154 |
|
|
-use_comment => 0, |
155 |
|
|
-value_type => {'*default' => ['Message::Field::Warning']}, |
156 |
|
|
}], |
157 |
wakaba |
1.1 |
|
158 |
wakaba |
1.5 |
## A URI |
159 |
|
|
base => ['Message::Field::URI',{ |
160 |
|
|
-output_comment => 0, |
161 |
|
|
-output_display_name => 0, |
162 |
|
|
-value_pattern => 'URL:%s', |
163 |
|
|
}], |
164 |
wakaba |
1.1 |
location => ['Message::Field::URI'], |
165 |
wakaba |
1.5 |
referer => ['Message::Field::URI',{ |
166 |
|
|
-allow_fragment => 0, |
167 |
|
|
-output_angle_bracket => 0, |
168 |
|
|
-use_comment => 0, |
169 |
|
|
-use_display_name => 0, |
170 |
|
|
}], |
171 |
|
|
referrer => ['Message::Field::URI',{ |
172 |
|
|
-allow_fragment => 0, |
173 |
|
|
-output_angle_bracket => 0, |
174 |
|
|
-use_comment => 0, |
175 |
|
|
-use_display_name => 0, |
176 |
|
|
}], |
177 |
wakaba |
1.1 |
}; |
178 |
|
|
|
179 |
|
|
$OPTION{uri_mailto_safe} = { |
180 |
|
|
':default' => 1, |
181 |
|
|
}; |
182 |
|
|
|
183 |
|
|
$OPTION{field}->{ext} = { ## RFC 2774 |
184 |
|
|
empty_body => 1, |
185 |
|
|
}; |
186 |
|
|
|
187 |
|
|
$Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri}; |
188 |
|
|
$Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__; |
189 |
|
|
|
190 |
wakaba |
1.7 |
#package Message::Header::HTTP::C; |
191 |
|
|
#our %OPTION = %Message::Header::HTTP::OPTION; |
192 |
|
|
#$OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:http:c'; |
193 |
|
|
#$OPTION{namespace_phname} = 'x-http-c'; |
194 |
|
|
#$OPTION{namespace_phname_goodcase} = 'X-HTTP-C'; |
195 |
|
|
# |
196 |
|
|
#$Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri}; |
197 |
|
|
#$Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__; |
198 |
wakaba |
1.1 |
|
199 |
wakaba |
1.2 |
package Message::Header::HTTP::CCPP; |
200 |
|
|
## CC/PP exchange protocol <http://www.w3.org/TR/NOTE-CCPPexchange> |
201 |
|
|
our %OPTION = %Message::Header::HTTP::OPTION; |
202 |
|
|
$OPTION{namespace_uri} = 'http://www.w3.org/1999/06/24-CCPPexchange'; |
203 |
wakaba |
1.3 |
|
204 |
|
|
$OPTION{use_ph_namespace} = 0; |
205 |
wakaba |
1.2 |
$OPTION{namespace_phname} = ''; |
206 |
|
|
$OPTION{namespace_phname_goodcase} = ''; |
207 |
wakaba |
1.3 |
|
208 |
wakaba |
1.2 |
$OPTION{value_type} = { |
209 |
|
|
':default' => ['Message::Field::Unstructured'], |
210 |
|
|
## *-Profile-Diff-(1*DIGIT): field (field-body = application/XML) |
211 |
|
|
profile => ['Message::Field::CSV'], |
212 |
|
|
'profile-warning' => ['Message::Field::CSV',{ |
213 |
|
|
-is_quoted_string => 0, |
214 |
|
|
}], |
215 |
|
|
}; |
216 |
|
|
|
217 |
|
|
$Message::Header::NS_uri2package{ $OPTION{namespace_uri} } = __PACKAGE__; |
218 |
|
|
|
219 |
wakaba |
1.1 |
=head1 LICENSE |
220 |
|
|
|
221 |
|
|
Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>. |
222 |
|
|
|
223 |
|
|
This program is free software; you can redistribute it and/or modify |
224 |
|
|
it under the terms of the GNU General Public License as published by |
225 |
|
|
the Free Software Foundation; either version 2 of the License, or |
226 |
|
|
(at your option) any later version. |
227 |
|
|
|
228 |
|
|
This program is distributed in the hope that it will be useful, |
229 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
230 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
231 |
|
|
GNU General Public License for more details. |
232 |
|
|
|
233 |
|
|
You should have received a copy of the GNU General Public License |
234 |
|
|
along with this program; see the file COPYING. If not, write to |
235 |
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
236 |
|
|
Boston, MA 02111-1307, USA. |
237 |
|
|
|
238 |
|
|
=head1 CHANGE |
239 |
|
|
|
240 |
|
|
See F<ChangeLog>. |
241 |
wakaba |
1.7 |
$Date: 2002/08/05 09:40:54 $ |
242 |
wakaba |
1.1 |
|
243 |
|
|
=cut |
244 |
|
|
|
245 |
|
|
1; |