Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / apps / JAWS2 / HTTPU / http_headers.cpp
blob9ab14ed4d17f2baef16d9239af029252d36c8aa3
1 #include "ace/RB_Tree.h"
2 #include "HTTPU/http_headers.h"
4 HTTP_Hdr_Node HTTP_HCodes::HTTP ("HTTP", "HTTP%s %s");
5 HTTP_Hdr_Node HTTP_HCodes::ACCEPT ("Accept", "Accept: %s\r\n");
6 HTTP_Hdr_Node HTTP_HCodes::ACCEPTCHARSET ("Accept-Charset",
7 "Accept-Charset: %s\r\n");
8 HTTP_Hdr_Node HTTP_HCodes::ACCEPTENCODING ("Accept-Encoding",
9 "Accept-Encoding: %s\r\n");
10 HTTP_Hdr_Node HTTP_HCodes::ACCEPTLANGUAGE ("Accept-Language",
11 "Accept-Language: %s\r\n");
12 HTTP_Hdr_Node HTTP_HCodes::ACCEPTRANGES ("Accept-Ranges",
13 "Accept-Ranges: %s\r\n");
14 HTTP_Hdr_Node HTTP_HCodes::AGE ("Age", "Age: %s\r\n");
15 HTTP_Hdr_Node HTTP_HCodes::ALLOW ("Allow", "Allow: %s\r\n");
16 HTTP_Hdr_Node HTTP_HCodes::AUTHORIZATION ("Authorization",
17 "Authorization: %s\r\n");
18 HTTP_Hdr_Node HTTP_HCodes::CACHECONTROL ("Cache-Control",
19 "Cache-Control: %s\r\n");
20 HTTP_Hdr_Node HTTP_HCodes::CONNECTION ("Connection", "Connection: %s\r\n");
21 HTTP_Hdr_Node HTTP_HCodes::CONTENTENCODING ("Content-Encoding",
22 "Content-Encoding: %d\r\n");
23 HTTP_Hdr_Node HTTP_HCodes::CONTENTLENGTH ("Content-Length",
24 "Content-Length: %d\r\n");
25 HTTP_Hdr_Node HTTP_HCodes::CONTENTLOCATION ("Content-Location",
26 "Content-Location: %s\r\n");
27 HTTP_Hdr_Node HTTP_HCodes::CONTENTMD5 ("Content-MD5",
28 "Content-MD5: %s\r\n");
29 HTTP_Hdr_Node HTTP_HCodes::CONTENTRANGE ("Content-Range",
30 "Content-Range: %s\r\n");
31 HTTP_Hdr_Node HTTP_HCodes::CONTENTTYPE ("Content-Type",
32 "Content-Type: %s\r\n");
33 HTTP_Hdr_Node HTTP_HCodes::DATE ("Date", "Date: %s\r\n");
34 HTTP_Hdr_Node HTTP_HCodes::ETAG ("ETag", "ETag: %s\r\n");
35 HTTP_Hdr_Node HTTP_HCodes::EXPECT ("Expect", "Expect: %s\r\n");
36 HTTP_Hdr_Node HTTP_HCodes::EXPIRES ("Expires", "Expires: %s\r\n");
37 HTTP_Hdr_Node HTTP_HCodes::FROM ("From", "From: %s\r\n");
38 HTTP_Hdr_Node HTTP_HCodes::HOST ("Host", "Host: %s\r\n");
39 HTTP_Hdr_Node HTTP_HCodes::IFMATCH ("If-Match", "If-Match: %s\r\n");
40 HTTP_Hdr_Node HTTP_HCodes::IFMODIFIEDSINCE ("If-Modified-Since",
41 "If-Modified-Since: %s\r\n");
42 HTTP_Hdr_Node HTTP_HCodes::IFNONEMATCH ("If-None-Match",
43 "If-None-Match: %s\r\n");
44 HTTP_Hdr_Node HTTP_HCodes::IFRANGE ("If-Range", "If-Range: %s\r\n");
45 HTTP_Hdr_Node HTTP_HCodes::IFUNMODIFIEDSINCE ("If-Unmodified-Since",
46 "If-Unmodified-Since: %s\r\n");
47 HTTP_Hdr_Node HTTP_HCodes::LASTMODIFIED ("Last-Modified",
48 "Last-Modified: %s\r\n");
49 HTTP_Hdr_Node HTTP_HCodes::LOCATION ("Location", "Location: %s\r\n");
50 HTTP_Hdr_Node HTTP_HCodes::MAXFORWARDS ("Max-Forwards",
51 "Max-Forwards: %s\r\n");
52 HTTP_Hdr_Node HTTP_HCodes::PRAGMA ("Pragma", "Pragma: %s\r\n");
53 HTTP_Hdr_Node HTTP_HCodes::PROXYAUTHENTICATE ("Proxy-Authenticate",
54 "Proxy-Authenticate: %s\r\n");
55 HTTP_Hdr_Node HTTP_HCodes::PROXYAUTHORIZATION ("Proxy-Authorization",
56 "Proxy-Authorization: %s\r\n");
57 HTTP_Hdr_Node HTTP_HCodes::RANGE ("Range", "Range: %s\r\n");
58 HTTP_Hdr_Node HTTP_HCodes::REFERER ("Referer", "Referer: %s\r\n");
59 HTTP_Hdr_Node HTTP_HCodes::SERVER ("Server", "Server: %s\r\n");
60 HTTP_Hdr_Node HTTP_HCodes::TE ("TE", "TE: %s\r\n");
61 HTTP_Hdr_Node HTTP_HCodes::TRAILER ("Trailer", "Trailer: %s\r\n");
62 HTTP_Hdr_Node HTTP_HCodes::TRANSFERENCODING ("Transfer-Encoding",
63 "Transfer-Encoding: %s\r\n");
64 HTTP_Hdr_Node HTTP_HCodes::UPGRADE ("Ugrade", "Ugrade: %s\r\n");
65 HTTP_Hdr_Node HTTP_HCodes::USERAGENT ("User-Agent", "User-Agent: %s\r\n");
66 HTTP_Hdr_Node HTTP_HCodes::VARY ("Vary", "Vary: %s\r\n");
67 HTTP_Hdr_Node HTTP_HCodes::VIA ("Via", "Via: %s\r\n");
68 HTTP_Hdr_Node HTTP_HCodes::WARNING ("Warning", "Warning: %s\r\n");
69 HTTP_Hdr_Node HTTP_HCodes::WWWAUTHENTICATE ("WWW-Authenticate",
70 "WWW-Authenticate: %s\r\n");
71 HTTP_Hdr_Node HTTP_HCodes::GET ("GET", "GET %s HTTP/%s\r\n");
72 HTTP_Hdr_Node HTTP_HCodes::HEAD ("HEAD", "HEAD %s HTTP/%s\r\n");
73 HTTP_Hdr_Node HTTP_HCodes::POST ("POST", "POST %s HTTP/%s\r\n");
74 HTTP_Hdr_Node HTTP_HCodes::PUT ("PUT", "PUT %s HTTP/%s\r\n");
75 HTTP_Hdr_Node HTTP_HCodes::QUIT ("QUIT", "QUIT %s HTTP/%s\r\n");
76 HTTP_Hdr_Node HTTP_HCodes::DUNNO ("", "");
77 HTTP_Hdr_Node HTTP_HCodes::META ("<META", "<META %s>");
78 HTTP_Hdr_Node HTTP_HCodes::A ("<A", "<A %s>");
79 HTTP_Hdr_Node HTTP_HCodes::SCRIPT ("<SCRIPT", "<SCRIPT %s>");
80 HTTP_Hdr_Node HTTP_HCodes::APPLET ("<APPLET", "<APPLET %s>");
83 const int &HTTP_HCodes::NUM_HEADER_STRINGS
84 = HTTP_Header_Nodes_Singleton::instance ()->num_header_strings_;
86 HTTP_Header_Nodes::HTTP_Header_Nodes ()
87 : num_header_strings_ (0)
91 HTTP_Hdr_Node::HTTP_Hdr_Node (const char *token, const char *format)
92 : token_ (token),
93 format_ (format)
95 HTTP_Header_Nodes *header_nodes
96 = HTTP_Header_Nodes_Singleton::instance ();
98 this->index_ = header_nodes->num_header_strings_;
99 header_nodes->insert (this->index_, this);
100 header_nodes->num_header_strings_++;
103 HTTP_HCodes::HTTP_HCodes ()
104 : header_nodes_ (HTTP_Header_Nodes_Singleton::instance ())
108 HTTP_Headers::HTTP_Headers ()
112 const char *
113 HTTP_Headers::header (int name) const
115 return this->header_token (name);
118 const char *
119 HTTP_Headers::value (int index)
121 this->value_reset ();
122 return this->value_next (index);
125 const char *
126 HTTP_Headers::value_next (int index)
128 const char *hs = 0;
129 const char *hv = 0;
130 JAWS_Header_Data *data;
132 if (0 <= index && index < NUM_HEADER_STRINGS)
134 hs = this->header (index);
135 data = this->table ()->find_next (hs);
136 if (data != 0)
137 hv = data->header_value ();
140 return hv;
143 void
144 HTTP_Headers::value_reset ()
146 this->table ()->iter ().first ();
149 #if !defined (ACE_HAS_INLINED_OSCALLS)
150 # include "HTTPU/http_headers.inl"
151 # endif /* ACE_HAS_INLINED_OSCALLS */