/[suikacvs]/messaging/manakai/lib/Message/Header/HTTP.pm
Suika

Contents of /messaging/manakai/lib/Message/Header/HTTP.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Sat Jul 27 04:43:03 2002 UTC (22 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +29 -2 lines
2002-07-26  Wakaba <w@suika.fam.cx>

	* Default.pm (sort_good_practice): New.
	* Default.pm, RFC822.pm, HTTP.pm: Support good-practice order
	sorting.

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.4 $VERSION=do{my @r=(q$Revision: 1.3 $=~/\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     /, ## General-Headers
32     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     warning www-authenticate/, ## Response-Headers
38     qw/allow etag expires last-modified link
39     mime-version content-/, ## Entity-Headers
40     ) {
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    
60     date => ['Message::Field::Date'],
61     expires => ['Message::Field::Date'],
62     'if-modified-since' => ['Message::Field::Date'],
63     'last-modified' => ['Message::Field::Date'],
64    
65     man => ['Message::Field::CSV'],
66     opt => ['Message::Field::CSV'],
67     p3p => ['Message::Field::Params'],
68    
69     ## Numeric value
70     'mime-version' => ['Message::Field::Numval'],
71    
72     server => ['Message::Field::UA'],
73     'user-agent' => ['Message::Field::UA'],
74     'from' => ['Message::Field::Addresses'],
75    
76     link => ['Message::Field::CSV'],
77     uri => ['Message::Field::CSV'],
78    
79     location => ['Message::Field::URI'],
80     referer => ['Message::Field::URI'],
81     referrer => ['Message::Field::URI'],
82     };
83    
84     $OPTION{uri_mailto_safe} = {
85     ':default' => 1,
86     };
87    
88     $OPTION{field}->{ext} = { ## RFC 2774
89     empty_body => 1,
90     };
91    
92     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
93     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
94    
95     package Message::Header::HTTP::C;
96     our %OPTION = %Message::Header::HTTP::OPTION;
97     $OPTION{namespace_uri} = 'urn:x-suika-fam-cx:msgpm:header:http:c';
98     $OPTION{namespace_phname} = 'x-http-c';
99     $OPTION{namespace_phname_goodcase} = 'X-HTTP-C';
100    
101     $Message::Header::NS_phname2uri{$OPTION{namespace_phname}} = $OPTION{namespace_uri};
102     $Message::Header::NS_uri2phpackage{$OPTION{namespace_uri}} = __PACKAGE__;
103    
104 wakaba 1.2 package Message::Header::HTTP::CCPP;
105     ## CC/PP exchange protocol <http://www.w3.org/TR/NOTE-CCPPexchange>
106     our %OPTION = %Message::Header::HTTP::OPTION;
107     $OPTION{namespace_uri} = 'http://www.w3.org/1999/06/24-CCPPexchange';
108 wakaba 1.3
109     $OPTION{use_ph_namespace} = 0;
110 wakaba 1.2 $OPTION{namespace_phname} = '';
111     $OPTION{namespace_phname_goodcase} = '';
112 wakaba 1.3
113 wakaba 1.2 $OPTION{value_type} = {
114     ':default' => ['Message::Field::Unstructured'],
115     ## *-Profile-Diff-(1*DIGIT): field (field-body = application/XML)
116     profile => ['Message::Field::CSV'],
117     'profile-warning' => ['Message::Field::CSV',{
118     -is_quoted_string => 0,
119     }],
120     };
121    
122     $Message::Header::NS_uri2package{ $OPTION{namespace_uri} } = __PACKAGE__;
123    
124 wakaba 1.1 =head1 LICENSE
125    
126     Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
127    
128     This program is free software; you can redistribute it and/or modify
129     it under the terms of the GNU General Public License as published by
130     the Free Software Foundation; either version 2 of the License, or
131     (at your option) any later version.
132    
133     This program is distributed in the hope that it will be useful,
134     but WITHOUT ANY WARRANTY; without even the implied warranty of
135     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136     GNU General Public License for more details.
137    
138     You should have received a copy of the GNU General Public License
139     along with this program; see the file COPYING. If not, write to
140     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
141     Boston, MA 02111-1307, USA.
142    
143     =head1 CHANGE
144    
145     See F<ChangeLog>.
146 wakaba 1.4 $Date: 2002/07/08 11:47:20 $
147 wakaba 1.1
148     =cut
149    
150     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24