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.6 |
$VERSION=do{my @r=(q$Revision: 1.5 $=~/\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 |
|
|
qw/status/, ## CGI header |
29 |
|
|
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 |
|
|
qw/allow etag expires last-modified link window-target |
39 |
|
|
mime-version derived-from base content-/, ## Entity-Headers |
40 |
wakaba |
1.4 |
) { |
41 |
|
|
$OPTION{field_sort_good_practice_order}->{$_} = $i++; |
42 |
|
|
} |
43 |
|
|
## default = 999 |
44 |
|
|
$i = 1000; |
45 |
|
|
for (qw/list- mime-version content- xref/) { |
46 |
|
|
$OPTION{field_sort_good_practice_order}->{$_} = $i++; |
47 |
|
|
} |
48 |
|
|
} |
49 |
|
|
|
50 |
wakaba |
1.1 |
$OPTION{goodcase} = { |
51 |
|
|
'pics-label' => 'PICS-Label', |
52 |
|
|
'message-id' => 'Message-ID', |
53 |
|
|
'mime-version' => 'MIME-Version', |
54 |
|
|
uri => 'URI', |
55 |
|
|
}; |
56 |
|
|
|
57 |
|
|
$OPTION{value_type} = { |
58 |
|
|
':default' => ['Message::Field::Unstructured'], |
59 |
wakaba |
1.5 |
status => ['Message::Field::Status'], |
60 |
wakaba |
1.1 |
|
61 |
wakaba |
1.5 |
## HTTP-Date / delta-second |
62 |
wakaba |
1.1 |
date => ['Message::Field::Date'], |
63 |
|
|
expires => ['Message::Field::Date'], |
64 |
|
|
'if-modified-since' => ['Message::Field::Date'], |
65 |
wakaba |
1.5 |
'if-unmodified-since' => ['Message::Field::Date'], |
66 |
wakaba |
1.1 |
'last-modified' => ['Message::Field::Date'], |
67 |
|
|
|
68 |
|
|
p3p => ['Message::Field::Params'], |
69 |
wakaba |
1.5 |
'window-target' => ['Message::Field::ValueParams'], |
70 |
wakaba |
1.1 |
'mime-version' => ['Message::Field::Numval'], |
71 |
wakaba |
1.5 |
from => ['Message::Field::Addresses'], |
72 |
wakaba |
1.1 |
|
73 |
wakaba |
1.5 |
## product |
74 |
wakaba |
1.1 |
server => ['Message::Field::UA'], |
75 |
|
|
'user-agent' => ['Message::Field::UA'], |
76 |
|
|
|
77 |
wakaba |
1.5 |
## Comma Separated List |
78 |
wakaba |
1.1 |
link => ['Message::Field::CSV'], |
79 |
|
|
uri => ['Message::Field::CSV'], |
80 |
wakaba |
1.5 |
man => ['Message::Field::CSV'], |
81 |
|
|
opt => ['Message::Field::CSV'], |
82 |
wakaba |
1.6 |
warning => ['Message::Field::CSV',{ |
83 |
|
|
-is_quoted_string => 0, |
84 |
|
|
-use_comment => 0, |
85 |
|
|
-value_type => {'*default' => ['Message::Field::Warning']}, |
86 |
|
|
}], |
87 |
wakaba |
1.1 |
|
88 |
wakaba |
1.5 |
## A URI |
89 |
|
|
base => ['Message::Field::URI',{ |
90 |
|
|
-output_comment => 0, |
91 |
|
|
-output_display_name => 0, |
92 |
|
|
-value_pattern => 'URL:%s', |
93 |
|
|
}], |
94 |
wakaba |
1.1 |
location => ['Message::Field::URI'], |
95 |
wakaba |
1.5 |
referer => ['Message::Field::URI',{ |
96 |
|
|
-allow_fragment => 0, |
97 |
|
|
-output_angle_bracket => 0, |
98 |
|
|
-use_comment => 0, |
99 |
|
|
-use_display_name => 0, |
100 |
|
|
}], |
101 |
|
|
referrer => ['Message::Field::URI',{ |
102 |
|
|
-allow_fragment => 0, |
103 |
|
|
-output_angle_bracket => 0, |
104 |
|
|
-use_comment => 0, |
105 |
|
|
-use_display_name => 0, |
106 |
|
|
}], |
107 |
wakaba |
1.1 |
}; |
108 |
|
|
|
109 |
|
|
$OPTION{uri_mailto_safe} = { |
110 |
|
|
':default' => 1, |
111 |
|
|
}; |
112 |
|
|
|
113 |
|
|
$OPTION{field}->{ext} = { ## RFC 2774 |
114 |
|
|
empty_body => 1, |
115 |
|
|
}; |
116 |
|
|
|
117 |
|
|
$Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri}; |
118 |
|
|
$Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__; |
119 |
|
|
|
120 |
|
|
package Message::Header::HTTP::C; |
121 |
|
|
our %OPTION = %Message::Header::HTTP::OPTION; |
122 |
|
|
$OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:http:c'; |
123 |
|
|
$OPTION{namespace_phname} = 'x-http-c'; |
124 |
|
|
$OPTION{namespace_phname_goodcase} = 'X-HTTP-C'; |
125 |
|
|
|
126 |
|
|
$Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri}; |
127 |
|
|
$Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__; |
128 |
|
|
|
129 |
wakaba |
1.2 |
package Message::Header::HTTP::CCPP; |
130 |
|
|
## CC/PP exchange protocol <http://www.w3.org/TR/NOTE-CCPPexchange> |
131 |
|
|
our %OPTION = %Message::Header::HTTP::OPTION; |
132 |
|
|
$OPTION{namespace_uri} = 'http://www.w3.org/1999/06/24-CCPPexchange'; |
133 |
wakaba |
1.3 |
|
134 |
|
|
$OPTION{use_ph_namespace} = 0; |
135 |
wakaba |
1.2 |
$OPTION{namespace_phname} = ''; |
136 |
|
|
$OPTION{namespace_phname_goodcase} = ''; |
137 |
wakaba |
1.3 |
|
138 |
wakaba |
1.2 |
$OPTION{value_type} = { |
139 |
|
|
':default' => ['Message::Field::Unstructured'], |
140 |
|
|
## *-Profile-Diff-(1*DIGIT): field (field-body = application/XML) |
141 |
|
|
profile => ['Message::Field::CSV'], |
142 |
|
|
'profile-warning' => ['Message::Field::CSV',{ |
143 |
|
|
-is_quoted_string => 0, |
144 |
|
|
}], |
145 |
|
|
}; |
146 |
|
|
|
147 |
|
|
$Message::Header::NS_uri2package{ $OPTION{namespace_uri} } = __PACKAGE__; |
148 |
|
|
|
149 |
wakaba |
1.1 |
=head1 LICENSE |
150 |
|
|
|
151 |
|
|
Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>. |
152 |
|
|
|
153 |
|
|
This program is free software; you can redistribute it and/or modify |
154 |
|
|
it under the terms of the GNU General Public License as published by |
155 |
|
|
the Free Software Foundation; either version 2 of the License, or |
156 |
|
|
(at your option) any later version. |
157 |
|
|
|
158 |
|
|
This program is distributed in the hope that it will be useful, |
159 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
160 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
161 |
|
|
GNU General Public License for more details. |
162 |
|
|
|
163 |
|
|
You should have received a copy of the GNU General Public License |
164 |
|
|
along with this program; see the file COPYING. If not, write to |
165 |
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
166 |
|
|
Boston, MA 02111-1307, USA. |
167 |
|
|
|
168 |
|
|
=head1 CHANGE |
169 |
|
|
|
170 |
|
|
See F<ChangeLog>. |
171 |
wakaba |
1.6 |
$Date: 2002/08/03 11:42:22 $ |
172 |
wakaba |
1.1 |
|
173 |
|
|
=cut |
174 |
|
|
|
175 |
|
|
1; |