PageRenderTime 69ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/src/kilim/http/HttpRequestParser.java

http://github.com/kilim/kilim
Java | 1719 lines | 1424 code | 163 blank | 132 comment | 103 complexity | 97bc913f5d21af721e51bc51b78bfc43 MD5 | raw file
Possible License(s): MIT
  1. // line 1 "HttpRequestParser.rl"
  2. /* Copyright (c) 2006, Sriram Srinivasan
  3. *
  4. * You may distribute this software under the terms of the license
  5. * specified in the file "License"
  6. */
  7. package kilim.http;
  8. /**
  9. * --- DO NOT EDIT -----
  10. * HttpRequestParser.java generated from RAGEL (http://www.complang.org/ragel/) from the
  11. * specification file HttpRequestParser.rl. All changes must be made in the .rl file.
  12. **/
  13. import java.util.TimeZone;
  14. import java.util.GregorianCalendar;
  15. import java.nio.charset.Charset;
  16. import java.nio.ByteBuffer;
  17. import java.io.UnsupportedEncodingException;
  18. import java.io.IOException;
  19. import java.net.URLDecoder;
  20. public class HttpRequestParser {
  21. public static final Charset UTF8 = Charset.forName("UTF-8");
  22. // line 135 "HttpRequestParser.rl"
  23. // line 34 "HttpRequestParser.java"
  24. private static byte[] init__http_parser_actions_0()
  25. {
  26. return new byte [] {
  27. 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1,
  28. 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1,
  29. 11, 1, 12, 1, 13, 2, 0, 3, 2, 0, 6, 2,
  30. 1, 5
  31. };
  32. }
  33. private static final byte _http_parser_actions[] = init__http_parser_actions_0();
  34. private static short[] init__http_parser_key_offsets_0()
  35. {
  36. return new short [] {
  37. 0, 0, 10, 12, 14, 16, 18, 20, 21, 31, 41, 50,
  38. 52, 53, 54, 55, 56, 58, 61, 63, 66, 67, 69, 70,
  39. 72, 73, 75, 84, 93, 99, 105, 111, 117, 121, 125, 135,
  40. 141, 147, 156, 165, 171, 177, 179, 181, 183, 185, 187, 189,
  41. 191, 193, 195, 197, 199, 203, 205, 207, 209
  42. };
  43. }
  44. private static final short _http_parser_key_offsets[] = init__http_parser_key_offsets_0();
  45. private static char[] init__http_parser_trans_keys_0()
  46. {
  47. return new char [] {
  48. 68, 71, 72, 79, 80, 100, 103, 104, 111, 112, 69, 101,
  49. 76, 108, 69, 101, 84, 116, 69, 101, 32, 32, 43, 47,
  50. 58, 45, 57, 65, 90, 97, 122, 43, 58, 45, 46, 48,
  51. 57, 65, 90, 97, 122, 32, 34, 35, 37, 60, 62, 127,
  52. 0, 31, 32, 72, 84, 84, 80, 47, 48, 57, 46, 48,
  53. 57, 48, 57, 13, 48, 57, 10, 13, 58, 58, 13, 32,
  54. 13, 10, 58, 32, 37, 60, 62, 127, 0, 31, 34, 35,
  55. 32, 37, 60, 62, 127, 0, 31, 34, 35, 48, 57, 65,
  56. 70, 97, 102, 48, 57, 65, 70, 97, 102, 48, 57, 65,
  57. 70, 97, 102, 48, 57, 65, 70, 97, 102, 32, 35, 59,
  58. 63, 32, 35, 59, 63, 32, 34, 35, 37, 60, 62, 63,
  59. 127, 0, 31, 48, 57, 65, 70, 97, 102, 48, 57, 65,
  60. 70, 97, 102, 32, 34, 35, 37, 60, 62, 127, 0, 31,
  61. 32, 34, 35, 37, 60, 62, 127, 0, 31, 48, 57, 65,
  62. 70, 97, 102, 48, 57, 65, 70, 97, 102, 69, 101, 84,
  63. 116, 69, 101, 65, 97, 68, 100, 80, 112, 84, 116, 73,
  64. 105, 79, 111, 78, 110, 83, 115, 79, 85, 111, 117, 83,
  65. 115, 84, 116, 84, 116, 58, 0
  66. };
  67. }
  68. private static final char _http_parser_trans_keys[] = init__http_parser_trans_keys_0();
  69. private static byte[] init__http_parser_single_lengths_0()
  70. {
  71. return new byte [] {
  72. 0, 10, 2, 2, 2, 2, 2, 1, 4, 2, 7, 2,
  73. 1, 1, 1, 1, 0, 1, 0, 1, 1, 2, 1, 2,
  74. 1, 2, 5, 5, 0, 0, 0, 0, 4, 4, 8, 0,
  75. 0, 7, 7, 0, 0, 2, 2, 2, 2, 2, 2, 2,
  76. 2, 2, 2, 2, 4, 2, 2, 2, 1
  77. };
  78. }
  79. private static final byte _http_parser_single_lengths[] = init__http_parser_single_lengths_0();
  80. private static byte[] init__http_parser_range_lengths_0()
  81. {
  82. return new byte [] {
  83. 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 1, 0,
  84. 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
  85. 0, 0, 2, 2, 3, 3, 3, 3, 0, 0, 1, 3,
  86. 3, 1, 1, 3, 3, 0, 0, 0, 0, 0, 0, 0,
  87. 0, 0, 0, 0, 0, 0, 0, 0, 0
  88. };
  89. }
  90. private static final byte _http_parser_range_lengths[] = init__http_parser_range_lengths_0();
  91. private static short[] init__http_parser_index_offsets_0()
  92. {
  93. return new short [] {
  94. 0, 0, 11, 14, 17, 20, 23, 26, 28, 36, 43, 52,
  95. 55, 57, 59, 61, 63, 65, 68, 70, 73, 75, 78, 80,
  96. 83, 85, 88, 96, 104, 108, 112, 116, 120, 125, 130, 140,
  97. 144, 148, 157, 166, 170, 174, 177, 180, 183, 186, 189, 192,
  98. 195, 198, 201, 204, 207, 212, 215, 218, 221
  99. };
  100. }
  101. private static final short _http_parser_index_offsets[] = init__http_parser_index_offsets_0();
  102. private static byte[] init__http_parser_indicies_0()
  103. {
  104. return new byte [] {
  105. 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 1, 6,
  106. 6, 1, 7, 7, 1, 8, 8, 1, 9, 9, 1, 10,
  107. 10, 1, 11, 1, 11, 12, 13, 14, 12, 12, 12, 1,
  108. 15, 16, 15, 15, 15, 15, 1, 17, 1, 18, 19, 1,
  109. 1, 1, 1, 16, 17, 20, 1, 21, 1, 22, 1, 23,
  110. 1, 24, 1, 25, 1, 26, 27, 1, 28, 1, 29, 28,
  111. 1, 30, 1, 32, 1, 31, 34, 33, 36, 37, 35, 39,
  112. 38, 40, 34, 33, 41, 43, 1, 1, 1, 1, 1, 42,
  113. 44, 46, 1, 1, 1, 1, 1, 45, 47, 47, 47, 1,
  114. 45, 45, 45, 1, 48, 48, 48, 1, 16, 16, 16, 1,
  115. 17, 18, 50, 51, 49, 52, 53, 54, 55, 49, 17, 1,
  116. 18, 56, 1, 1, 51, 1, 1, 50, 57, 57, 57, 1,
  117. 50, 50, 50, 1, 58, 1, 60, 61, 1, 1, 1, 1,
  118. 59, 62, 1, 64, 65, 1, 1, 1, 1, 63, 66, 66,
  119. 66, 1, 63, 63, 63, 1, 67, 67, 1, 68, 68, 1,
  120. 69, 69, 1, 70, 70, 1, 71, 71, 1, 72, 72, 1,
  121. 73, 73, 1, 74, 74, 1, 75, 75, 1, 76, 76, 1,
  122. 77, 77, 1, 78, 79, 78, 79, 1, 80, 80, 1, 81,
  123. 81, 1, 82, 82, 1, 34, 33, 0
  124. };
  125. }
  126. private static final byte _http_parser_indicies[] = init__http_parser_indicies_0();
  127. private static byte[] init__http_parser_trans_targs_0()
  128. {
  129. return new byte [] {
  130. 2, 0, 41, 43, 46, 52, 3, 4, 5, 6, 7, 8,
  131. 9, 32, 10, 9, 10, 11, 26, 30, 12, 13, 14, 15,
  132. 16, 17, 18, 17, 19, 20, 21, 22, 25, 22, 23, 24,
  133. 20, 23, 24, 20, 56, 11, 27, 28, 11, 27, 28, 29,
  134. 31, 33, 34, 37, 11, 26, 34, 37, 35, 36, 11, 38,
  135. 26, 39, 11, 38, 26, 39, 40, 42, 7, 44, 45, 7,
  136. 47, 48, 49, 50, 51, 7, 53, 55, 54, 7, 7
  137. };
  138. }
  139. private static final byte _http_parser_trans_targs[] = init__http_parser_trans_targs_0();
  140. private static byte[] init__http_parser_trans_actions_0()
  141. {
  142. return new byte [] {
  143. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0,
  144. 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  145. 0, 1, 0, 0, 0, 15, 0, 1, 1, 0, 5, 1,
  146. 29, 1, 0, 7, 0, 32, 1, 1, 13, 0, 0, 0,
  147. 0, 0, 0, 0, 9, 9, 9, 9, 0, 0, 35, 3,
  148. 35, 3, 11, 0, 11, 0, 0, 0, 17, 0, 0, 23,
  149. 0, 0, 0, 0, 0, 27, 0, 0, 0, 19, 25
  150. };
  151. }
  152. private static final byte _http_parser_trans_actions[] = init__http_parser_trans_actions_0();
  153. static final int http_parser_start = 1;
  154. static final int http_parser_first_final = 56;
  155. static final int http_parser_error = 0;
  156. static final int http_parser_en_main = 1;
  157. // line 138 "HttpRequestParser.rl"
  158. public static void err(String msg) throws IOException{
  159. throw new IOException(msg);
  160. }
  161. public static void initHeader(HttpRequest req, int headerLength) throws IOException {
  162. ByteBuffer bb = req.buffer;
  163. /* required variables */
  164. byte[] data = bb.array();
  165. int p = 0;
  166. int pe = headerLength;
  167. // int eof = pe;
  168. int cs = 0;
  169. // variables used by actions in http_req_parser machine above.
  170. int query_start = 0;
  171. int mark = 0;
  172. String field_name = "";
  173. // line 219 "HttpRequestParser.java"
  174. {
  175. cs = http_parser_start;
  176. }
  177. // line 158 "HttpRequestParser.rl"
  178. // line 226 "HttpRequestParser.java"
  179. {
  180. int _klen;
  181. int _trans = 0;
  182. int _acts;
  183. int _nacts;
  184. int _keys;
  185. int _goto_targ = 0;
  186. _goto: while (true) {
  187. switch ( _goto_targ ) {
  188. case 0:
  189. if ( p == pe ) {
  190. _goto_targ = 4;
  191. continue _goto;
  192. }
  193. if ( cs == 0 ) {
  194. _goto_targ = 5;
  195. continue _goto;
  196. }
  197. case 1:
  198. _match: do {
  199. _keys = _http_parser_key_offsets[cs];
  200. _trans = _http_parser_index_offsets[cs];
  201. _klen = _http_parser_single_lengths[cs];
  202. if ( _klen > 0 ) {
  203. int _lower = _keys;
  204. int _mid;
  205. int _upper = _keys + _klen - 1;
  206. while (true) {
  207. if ( _upper < _lower )
  208. break;
  209. _mid = _lower + ((_upper-_lower) >> 1);
  210. if ( data[p] < _http_parser_trans_keys[_mid] )
  211. _upper = _mid - 1;
  212. else if ( data[p] > _http_parser_trans_keys[_mid] )
  213. _lower = _mid + 1;
  214. else {
  215. _trans += (_mid - _keys);
  216. break _match;
  217. }
  218. }
  219. _keys += _klen;
  220. _trans += _klen;
  221. }
  222. _klen = _http_parser_range_lengths[cs];
  223. if ( _klen > 0 ) {
  224. int _lower = _keys;
  225. int _mid;
  226. int _upper = _keys + (_klen<<1) - 2;
  227. while (true) {
  228. if ( _upper < _lower )
  229. break;
  230. _mid = _lower + (((_upper-_lower) >> 1) & ~1);
  231. if ( data[p] < _http_parser_trans_keys[_mid] )
  232. _upper = _mid - 2;
  233. else if ( data[p] > _http_parser_trans_keys[_mid+1] )
  234. _lower = _mid + 2;
  235. else {
  236. _trans += ((_mid - _keys)>>1);
  237. break _match;
  238. }
  239. }
  240. _trans += _klen;
  241. }
  242. } while (false);
  243. _trans = _http_parser_indicies[_trans];
  244. cs = _http_parser_trans_targs[_trans];
  245. if ( _http_parser_trans_actions[_trans] != 0 ) {
  246. _acts = _http_parser_trans_actions[_trans];
  247. _nacts = (int) _http_parser_actions[_acts++];
  248. while ( _nacts-- > 0 )
  249. {
  250. switch ( _http_parser_actions[_acts++] )
  251. {
  252. case 0:
  253. // line 31 "HttpRequestParser.rl"
  254. {mark = p; }
  255. break;
  256. case 1:
  257. // line 33 "HttpRequestParser.rl"
  258. {query_start = p; }
  259. break;
  260. case 2:
  261. // line 35 "HttpRequestParser.rl"
  262. {
  263. field_name = kw_lookup(data, mark, p);
  264. if (field_name == null) {// not a known keyword
  265. field_name = req.extractRange(mark, p);
  266. }
  267. }
  268. break;
  269. case 3:
  270. // line 42 "HttpRequestParser.rl"
  271. {
  272. int value = encodeRange(mark, p);
  273. req.addField(field_name, value);
  274. }
  275. break;
  276. case 4:
  277. // line 47 "HttpRequestParser.rl"
  278. {
  279. req.uriPath = req.extractRange(mark, p);
  280. String s = req.uriPath;
  281. int len = s.length();
  282. boolean need_decode;
  283. // Scan the string to see if the string requires any conversion.
  284. for (int i = 0; i < len; i++) {
  285. char c = s.charAt(i);
  286. if (c == '%' || c > 0x7F) {
  287. try {
  288. // TODO: Correct this. URLDecoder is broken for path (upto
  289. // JDK1.6): it converts'+' to ' ', which should
  290. // be done only for the query part of the url.
  291. req.uriPath = URLDecoder.decode(req.uriPath, "UTF-8");
  292. break;
  293. } catch (UnsupportedEncodingException ignore){}
  294. }
  295. }
  296. }
  297. break;
  298. case 5:
  299. // line 72 "HttpRequestParser.rl"
  300. {
  301. req.queryStringRange = encodeRange(query_start, p);
  302. }
  303. break;
  304. case 6:
  305. // line 76 "HttpRequestParser.rl"
  306. {
  307. req.uriFragmentRange = encodeRange(mark, p);
  308. }
  309. break;
  310. case 7:
  311. // line 80 "HttpRequestParser.rl"
  312. {
  313. req.versionRange = encodeRange(mark, p);
  314. }
  315. break;
  316. case 8:
  317. // line 119 "HttpRequestParser.rl"
  318. {req.method = "GET";}
  319. break;
  320. case 9:
  321. // line 120 "HttpRequestParser.rl"
  322. {req.method = "POST";}
  323. break;
  324. case 10:
  325. // line 121 "HttpRequestParser.rl"
  326. {req.method = "DELETE";}
  327. break;
  328. case 11:
  329. // line 122 "HttpRequestParser.rl"
  330. {req.method = "HEAD";}
  331. break;
  332. case 12:
  333. // line 123 "HttpRequestParser.rl"
  334. {req.method = "PUT";}
  335. break;
  336. case 13:
  337. // line 124 "HttpRequestParser.rl"
  338. {req.method = "OPTIONS";}
  339. break;
  340. // line 394 "HttpRequestParser.java"
  341. }
  342. }
  343. }
  344. case 2:
  345. if ( cs == 0 ) {
  346. _goto_targ = 5;
  347. continue _goto;
  348. }
  349. if ( ++p != pe ) {
  350. _goto_targ = 1;
  351. continue _goto;
  352. }
  353. case 4:
  354. case 5:
  355. }
  356. break; }
  357. }
  358. // line 159 "HttpRequestParser.rl"
  359. if (cs == http_parser_error) {
  360. throw new IOException("Malformed HTTP Header. p = " + p +", cs = " + cs);
  361. }
  362. }
  363. /**
  364. * encode the start pos and length as ints;
  365. */
  366. public static int encodeRange(int start, int end) {
  367. return (start << 16) + end ;
  368. }
  369. // line 429 "HttpRequestParser.java"
  370. private static byte[] init__http_keywords_actions_0()
  371. {
  372. return new byte [] {
  373. 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1,
  374. 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1,
  375. 11, 1, 12, 1, 13, 1, 14, 1, 15, 1, 16, 1,
  376. 17, 1, 18, 1, 19, 1, 20, 1, 21, 1, 22, 1,
  377. 23, 1, 24, 1, 25, 1, 26, 1, 27, 1, 28, 1,
  378. 29, 1, 30, 1, 31, 1, 32, 1, 33, 1, 34, 1,
  379. 35, 1, 36, 1, 37, 1, 38, 1, 39, 1, 40, 1,
  380. 41, 1, 42, 1, 43, 1, 44, 1, 45, 1, 46, 1,
  381. 47, 1, 48, 1, 49, 1, 50
  382. };
  383. }
  384. private static final byte _http_keywords_actions[] = init__http_keywords_actions_0();
  385. private static short[] init__http_keywords_key_offsets_0()
  386. {
  387. return new short [] {
  388. 0, 0, 8, 10, 12, 14, 16, 24, 26, 28, 30, 32,
  389. 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56,
  390. 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80,
  391. 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104,
  392. 108, 110, 112, 114, 115, 117, 119, 121, 123, 125, 127, 129,
  393. 131, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 154,
  394. 164, 166, 168, 170, 172, 174, 176, 178, 184, 186, 188, 190,
  395. 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214,
  396. 216, 218, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237,
  397. 239, 243, 245, 247, 249, 253, 255, 257, 259, 261, 263, 265,
  398. 267, 269, 271, 273, 275, 277, 278, 286, 290, 292, 294, 296,
  399. 298, 300, 302, 304, 306, 308, 309, 311, 313, 315, 317, 319,
  400. 321, 323, 325, 326, 328, 330, 332, 334, 336, 338, 340, 342,
  401. 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 363, 365,
  402. 367, 369, 371, 373, 377, 379, 381, 382, 384, 386, 388, 390,
  403. 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414,
  404. 415, 417, 419, 421, 423, 425, 427, 429, 431, 433, 437, 439,
  405. 441, 443, 445, 447, 448, 450, 452, 454, 456, 460, 462, 464,
  406. 466, 468, 470, 472, 474, 476, 478, 480, 482, 484, 486, 488,
  407. 490, 494, 496, 498, 500, 504, 506, 508, 510, 512, 514, 516,
  408. 517, 519, 521, 523, 525, 527, 529, 531, 533, 535, 537, 541,
  409. 543, 547, 549, 551, 553, 555, 557, 559, 561, 562, 564, 566,
  410. 568, 570, 572, 574, 576, 578, 582, 584, 586, 588, 590, 592,
  411. 594, 596, 597, 599, 601, 603, 605, 607, 611, 613, 615, 617,
  412. 621, 623, 625, 627, 629, 631, 633, 634, 636, 638, 640, 642,
  413. 644, 646, 648, 650, 652, 654, 656, 658, 690
  414. };
  415. }
  416. private static final short _http_keywords_key_offsets[] = init__http_keywords_key_offsets_0();
  417. private static char[] init__http_keywords_trans_keys_0()
  418. {
  419. return new char [] {
  420. 67, 71, 76, 85, 99, 103, 108, 117, 67, 99, 69, 101,
  421. 80, 112, 84, 116, 67, 69, 76, 82, 99, 101, 108, 114,
  422. 72, 104, 65, 97, 82, 114, 83, 115, 69, 101, 84, 116,
  423. 78, 110, 67, 99, 79, 111, 68, 100, 73, 105, 78, 110,
  424. 71, 103, 65, 97, 78, 110, 71, 103, 85, 117, 65, 97,
  425. 71, 103, 69, 101, 65, 97, 78, 110, 71, 103, 69, 101,
  426. 83, 115, 69, 101, 76, 108, 79, 111, 87, 119, 84, 116,
  427. 72, 104, 79, 111, 82, 114, 73, 105, 90, 122, 65, 97,
  428. 84, 116, 73, 105, 79, 111, 78, 110, 65, 79, 97, 111,
  429. 67, 99, 72, 104, 69, 101, 45, 67, 99, 79, 111, 78,
  430. 110, 84, 116, 82, 114, 79, 111, 76, 108, 78, 110, 78,
  431. 84, 110, 116, 69, 101, 67, 99, 84, 116, 73, 105, 79,
  432. 111, 78, 110, 69, 101, 78, 110, 84, 116, 45, 69, 76,
  433. 77, 82, 84, 101, 108, 109, 114, 116, 78, 110, 67, 99,
  434. 79, 111, 68, 100, 73, 105, 78, 110, 71, 103, 65, 69,
  435. 79, 97, 101, 111, 78, 110, 71, 103, 85, 117, 65, 97,
  436. 71, 103, 69, 101, 78, 110, 71, 103, 84, 116, 72, 104,
  437. 67, 99, 65, 97, 84, 116, 73, 105, 79, 111, 78, 110,
  438. 68, 100, 53, 65, 97, 78, 110, 71, 103, 69, 101, 89,
  439. 121, 80, 112, 69, 101, 65, 97, 84, 116, 69, 101, 84,
  440. 88, 116, 120, 65, 97, 71, 103, 80, 112, 69, 73, 101,
  441. 105, 67, 99, 84, 116, 82, 114, 69, 101, 83, 115, 82,
  442. 114, 79, 111, 77, 109, 79, 111, 83, 115, 84, 116, 70,
  443. 102, 45, 77, 78, 82, 85, 109, 110, 114, 117, 65, 79,
  444. 97, 111, 84, 116, 67, 99, 72, 104, 68, 100, 73, 105,
  445. 70, 102, 73, 105, 69, 101, 68, 100, 45, 83, 115, 73,
  446. 105, 78, 110, 67, 99, 69, 101, 79, 111, 78, 110, 69,
  447. 101, 45, 77, 109, 65, 97, 84, 116, 67, 99, 72, 104,
  448. 65, 97, 78, 110, 71, 103, 69, 101, 78, 110, 77, 109,
  449. 79, 111, 68, 100, 73, 105, 70, 102, 73, 105, 69, 101,
  450. 68, 100, 45, 83, 115, 73, 105, 78, 110, 67, 99, 69,
  451. 101, 65, 79, 97, 111, 83, 115, 84, 116, 45, 77, 109,
  452. 79, 111, 68, 100, 73, 105, 70, 102, 73, 105, 69, 101,
  453. 68, 100, 67, 99, 65, 97, 84, 116, 73, 105, 79, 111,
  454. 78, 110, 65, 97, 88, 120, 45, 70, 102, 79, 111, 82,
  455. 114, 87, 119, 65, 97, 82, 114, 68, 100, 83, 115, 82,
  456. 114, 65, 79, 97, 111, 71, 103, 77, 109, 65, 97, 88,
  457. 120, 89, 121, 45, 65, 97, 85, 117, 84, 116, 72, 104,
  458. 69, 79, 101, 111, 78, 110, 84, 116, 73, 105, 67, 99,
  459. 65, 97, 84, 116, 69, 101, 82, 114, 73, 105, 90, 122,
  460. 65, 97, 84, 116, 73, 105, 79, 111, 78, 110, 65, 69,
  461. 97, 101, 78, 110, 71, 103, 69, 101, 70, 84, 102, 116,
  462. 69, 101, 82, 114, 69, 101, 82, 114, 82, 114, 89, 121,
  463. 45, 65, 97, 70, 102, 84, 116, 69, 101, 82, 114, 69,
  464. 101, 82, 114, 86, 118, 69, 101, 82, 114, 69, 82, 101,
  465. 114, 65, 97, 73, 78, 105, 110, 76, 108, 69, 101, 82,
  466. 114, 83, 115, 70, 102, 69, 101, 82, 114, 45, 69, 101,
  467. 78, 110, 67, 99, 79, 111, 68, 100, 73, 105, 78, 110,
  468. 71, 103, 80, 83, 112, 115, 71, 103, 82, 114, 65, 97,
  469. 68, 100, 69, 101, 69, 101, 82, 114, 45, 65, 97, 71,
  470. 103, 69, 101, 78, 110, 84, 116, 65, 73, 97, 105, 82,
  471. 114, 89, 121, 65, 97, 65, 87, 97, 119, 82, 114, 78,
  472. 110, 73, 105, 78, 110, 71, 103, 87, 119, 45, 65, 97,
  473. 85, 117, 84, 116, 72, 104, 69, 101, 78, 110, 84, 116,
  474. 73, 105, 67, 99, 65, 97, 84, 116, 69, 101, 65, 67,
  475. 68, 69, 70, 72, 73, 76, 77, 80, 82, 83, 84, 85,
  476. 86, 87, 97, 99, 100, 101, 102, 104, 105, 108, 109, 112,
  477. 114, 115, 116, 117, 118, 119, 45, 0
  478. };
  479. }
  480. private static final char _http_keywords_trans_keys[] = init__http_keywords_trans_keys_0();
  481. private static byte[] init__http_keywords_single_lengths_0()
  482. {
  483. return new byte [] {
  484. 0, 8, 2, 2, 2, 2, 8, 2, 2, 2, 2, 2,
  485. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  486. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  487. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4,
  488. 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2,
  489. 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 10,
  490. 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2,
  491. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  492. 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  493. 4, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2,
  494. 2, 2, 2, 2, 2, 1, 8, 4, 2, 2, 2, 2,
  495. 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2,
  496. 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  497. 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2,
  498. 2, 2, 2, 4, 2, 2, 1, 2, 2, 2, 2, 2,
  499. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
  500. 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2,
  501. 2, 2, 2, 1, 2, 2, 2, 2, 4, 2, 2, 2,
  502. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  503. 4, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 1,
  504. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2,
  505. 4, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2,
  506. 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2,
  507. 2, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 4,
  508. 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2,
  509. 2, 2, 2, 2, 2, 2, 2, 32, 1
  510. };
  511. }
  512. private static final byte _http_keywords_single_lengths[] = init__http_keywords_single_lengths_0();
  513. private static byte[] init__http_keywords_range_lengths_0()
  514. {
  515. return new byte [] {
  516. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  517. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  518. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  519. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  520. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  521. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  522. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  523. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  524. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  525. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  526. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  527. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  528. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  529. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  530. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  531. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  532. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  533. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  534. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  535. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  536. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  537. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  538. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  539. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  540. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  541. 0, 0, 0, 0, 0, 0, 0, 0, 0
  542. };
  543. }
  544. private static final byte _http_keywords_range_lengths[] = init__http_keywords_range_lengths_0();
  545. private static short[] init__http_keywords_index_offsets_0()
  546. {
  547. return new short [] {
  548. 0, 0, 9, 12, 15, 18, 21, 30, 33, 36, 39, 42,
  549. 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78,
  550. 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114,
  551. 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150,
  552. 155, 158, 161, 164, 166, 169, 172, 175, 178, 181, 184, 187,
  553. 190, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 224,
  554. 235, 238, 241, 244, 247, 250, 253, 256, 263, 266, 269, 272,
  555. 275, 278, 281, 284, 287, 290, 293, 296, 299, 302, 305, 308,
  556. 311, 314, 316, 319, 322, 325, 328, 331, 334, 337, 340, 343,
  557. 346, 351, 354, 357, 360, 365, 368, 371, 374, 377, 380, 383,
  558. 386, 389, 392, 395, 398, 401, 403, 412, 417, 420, 423, 426,
  559. 429, 432, 435, 438, 441, 444, 446, 449, 452, 455, 458, 461,
  560. 464, 467, 470, 472, 475, 478, 481, 484, 487, 490, 493, 496,
  561. 499, 502, 505, 508, 511, 514, 517, 520, 523, 526, 528, 531,
  562. 534, 537, 540, 543, 548, 551, 554, 556, 559, 562, 565, 568,
  563. 571, 574, 577, 580, 583, 586, 589, 592, 595, 598, 601, 604,
  564. 606, 609, 612, 615, 618, 621, 624, 627, 630, 633, 638, 641,
  565. 644, 647, 650, 653, 655, 658, 661, 664, 667, 672, 675, 678,
  566. 681, 684, 687, 690, 693, 696, 699, 702, 705, 708, 711, 714,
  567. 717, 722, 725, 728, 731, 736, 739, 742, 745, 748, 751, 754,
  568. 756, 759, 762, 765, 768, 771, 774, 777, 780, 783, 786, 791,
  569. 794, 799, 802, 805, 808, 811, 814, 817, 820, 822, 825, 828,
  570. 831, 834, 837, 840, 843, 846, 851, 854, 857, 860, 863, 866,
  571. 869, 872, 874, 877, 880, 883, 886, 889, 894, 897, 900, 903,
  572. 908, 911, 914, 917, 920, 923, 926, 928, 931, 934, 937, 940,
  573. 943, 946, 949, 952, 955, 958, 961, 964, 997
  574. };
  575. }
  576. private static final short _http_keywords_index_offsets[] = init__http_keywords_index_offsets_0();
  577. private static short[] init__http_keywords_trans_targs_0()
  578. {
  579. return new short [] {
  580. 2, 32, 33, 36, 2, 32, 33, 36, 0, 3, 3, 0,
  581. 4, 4, 0, 5, 5, 0, 308, 308, 0, 7, 13, 20,
  582. 27, 7, 13, 20, 27, 307, 8, 8, 307, 9, 9, 307,
  583. 10, 10, 307, 11, 11, 307, 12, 12, 307, 307, 307, 307,
  584. 14, 14, 307, 15, 15, 307, 16, 16, 307, 17, 17, 307,
  585. 18, 18, 307, 19, 19, 307, 307, 307, 307, 21, 21, 307,
  586. 22, 22, 307, 23, 23, 307, 24, 24, 307, 25, 25, 307,
  587. 26, 26, 307, 307, 307, 307, 28, 28, 307, 29, 29, 307,
  588. 30, 30, 307, 31, 31, 307, 307, 307, 307, 307, 307, 0,
  589. 34, 34, 0, 35, 35, 0, 307, 307, 0, 37, 37, 0,
  590. 38, 38, 0, 39, 39, 0, 40, 40, 0, 41, 41, 0,
  591. 42, 42, 0, 43, 43, 0, 44, 44, 0, 45, 45, 0,
  592. 46, 46, 0, 307, 307, 0, 48, 59, 48, 59, 0, 49,
  593. 49, 0, 50, 50, 0, 51, 51, 0, 52, 0, 53, 53,
  594. 0, 54, 54, 0, 55, 55, 0, 56, 56, 0, 57, 57,
  595. 0, 58, 58, 0, 307, 307, 0, 60, 60, 0, 61, 67,
  596. 61, 67, 0, 62, 62, 0, 63, 63, 0, 64, 64, 0,
  597. 65, 65, 0, 66, 66, 0, 307, 307, 0, 68, 68, 0,
  598. 69, 69, 0, 70, 70, 0, 71, 0, 72, 79, 96, 98,
  599. 102, 72, 79, 96, 98, 102, 0, 73, 73, 0, 74, 74,
  600. 0, 75, 75, 0, 76, 76, 0, 77, 77, 0, 78, 78,
  601. 0, 307, 307, 0, 80, 86, 90, 80, 86, 90, 0, 81,
  602. 81, 0, 82, 82, 0, 83, 83, 0, 84, 84, 0, 85,
  603. 85, 0, 307, 307, 0, 87, 87, 0, 88, 88, 0, 89,
  604. 89, 0, 307, 307, 0, 91, 91, 0, 92, 92, 0, 93,
  605. 93, 0, 94, 94, 0, 95, 95, 0, 307, 307, 0, 97,
  606. 97, 0, 307, 0, 99, 99, 0, 100, 100, 0, 101, 101,
  607. 0, 307, 307, 0, 103, 103, 0, 104, 104, 0, 307, 307,
  608. 0, 106, 106, 0, 107, 107, 0, 307, 307, 0, 109, 111,
  609. 109, 111, 0, 110, 110, 0, 307, 307, 0, 112, 112, 0,
  610. 113, 115, 113, 115, 0, 114, 114, 0, 307, 307, 0, 116,
  611. 116, 0, 117, 117, 0, 307, 307, 0, 119, 119, 0, 120,
  612. 120, 0, 307, 307, 0, 122, 122, 0, 123, 123, 0, 307,
  613. 307, 0, 125, 125, 0, 126, 0, 127, 143, 152, 156, 127,
  614. 143, 152, 156, 0, 128, 131, 128, 131, 0, 129, 129, 0,
  615. 130, 130, 0, 307, 307, 0, 132, 132, 0, 133, 133, 0,
  616. 134, 134, 0, 135, 135, 0, 136, 136, 0, 137, 137, 0,
  617. 138, 0, 139, 139, 0, 140, 140, 0, 141, 141, 0, 142,
  618. 142, 0, 307, 307, 0, 144, 144, 0, 145, 145, 0, 146,
  619. 146, 0, 147, 0, 148, 148, 0, 149, 149, 0, 150, 150,
  620. 0, 151, 151, 0, 307, 307, 0, 153, 153, 0, 154, 154,
  621. 0, 155, 155, 0, 307, 307, 0, 157, 157, 0, 158, 158,
  622. 0, 159, 159, 0, 160, 160, 0, 161, 161, 0, 162, 162,
  623. 0, 163, 163, 0, 164, 164, 0, 165, 165, 0, 166, 0,
  624. 167, 167, 0, 168, 168, 0, 169, 169, 0, 170, 170, 0,
  625. 307, 307, 0, 172, 183, 172, 183, 0, 173, 173, 0, 174,
  626. 174, 0, 175, 0, 176, 176, 0, 177, 177, 0, 178, 178,
  627. 0, 179, 179, 0, 180, 180, 0, 181, 181, 0, 182, 182,
  628. 0, 307, 307, 0, 184, 184, 0, 185, 185, 0, 186, 186,
  629. 0, 187, 187, 0, 188, 188, 0, 307, 307, 0, 190, 190,
  630. 0, 191, 191, 0, 192, 0, 193, 193, 0, 194, 194, 0,
  631. 195, 195, 0, 196, 196, 0, 197, 197, 0, 198, 198, 0,
  632. 199, 199, 0, 307, 307, 0, 201, 201, 0, 202, 205, 202,
  633. 205, 0, 203, 203, 0, 204, 204, 0, 307, 307, 0, 206,
  634. 206, 0, 207, 207, 0, 208, 0, 209, 209, 0, 210, 210,
  635. 0, 211, 211, 0, 212, 212, 0, 213, 220, 213, 220, 0,
  636. 214, 214, 0, 215, 215, 0, 216, 216, 0, 217, 217, 0,
  637. 218, 218, 0, 219, 219, 0, 307, 307, 0, 221, 221, 0,
  638. 222, 222, 0, 223, 223, 0, 224, 224, 0, 225, 225, 0,
  639. 226, 226, 0, 227, 227, 0, 307, 307, 0, 229, 232, 229,
  640. 232, 0, 230, 230, 0, 231, 231, 0, 307, 307, 0, 233,
  641. 237, 233, 237, 0, 234, 234, 0, 235, 235, 0, 236, 236,
  642. 0, 307, 307, 0, 238, 238, 0, 239, 239, 0, 240, 0,
  643. 241, 241, 0, 242, 242, 0, 243, 243, 0, 244, 244, 0,
  644. 307, 307, 0, 246, 246, 0, 247, 247, 0, 248, 248, 0,
  645. 249, 249, 0, 307, 307, 0, 307, 251, 307, 251, 0, 252,
  646. 252, 0, 253, 256, 253, 256, 0, 254, 254, 0, 255, 255,
  647. 0, 307, 307, 0, 257, 257, 0, 258, 258, 0, 259, 259,
  648. 0, 260, 260, 0, 261, 0, 262, 262, 0, 263, 263, 0,
  649. 264, 264, 0, 265, 265, 0, 266, 266, 0, 267, 267, 0,
  650. 268, 268, 0, 307, 307, 0, 270, 275, 270, 275, 0, 271,
  651. 271, 0, 272, 272, 0, 273, 273, 0, 274, 274, 0, 307,
  652. 307, 0, 276, 276, 0, 277, 277, 0, 278, 0, 279, 279,
  653. 0, 280, 280, 0, 281, 281, 0, 282, 282, 0, 307, 307,
  654. 0, 284, 286, 284, 286, 0, 285, 285, 0, 307, 307, 0,
  655. 307, 307, 0, 288, 293, 288, 293, 0, 289, 289, 0, 290,
  656. 290, 0, 291, 291, 0, 292, 292, 0, 307, 307, 0, 294,
  657. 294, 0, 295, 0, 296, 296, 0, 297, 297, 0, 298, 298,
  658. 0, 299, 299, 0, 300, 300, 0, 301, 301, 0, 302, 302,
  659. 0, 303, 303, 0, 304, 304, 0, 305, 305, 0, 306, 306,
  660. 0, 307, 307, 0, 1, 47, 105, 108, 118, 121, 124, 171,
  661. 189, 200, 228, 245, 250, 269, 283, 287, 1, 47, 105, 108,
  662. 118, 121, 124, 171, 189, 200, 228, 245, 250, 269, 283, 287,
  663. 0, 6, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307,
  664. 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307,
  665. 307, 307, 307, 307, 307, 307, 0
  666. };
  667. }
  668. private static final short _http_keywords_trans_targs[] = init__http_keywords_trans_targs_0();
  669. private static byte[] init__http_keywords_trans_actions_0()
  670. {
  671. return new byte [] {
  672. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  673. 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0,
  674. 0, 0, 0, 0, 0, 101, 0, 0, 101, 0, 0, 101,
  675. 0, 0, 101, 0, 0, 101, 0, 0, 101, 7, 7, 101,
  676. 0, 0, 101, 0, 0, 101, 0, 0, 101, 0, 0, 101,
  677. 0, 0, 101, 0, 0, 101, 9, 9, 101, 0, 0, 101,
  678. 0, 0, 101, 0, 0, 101, 0, 0, 101, 0, 0, 101,
  679. 0, 0, 101, 11, 11, 101, 0, 0, 101, 0, 0, 101,
  680. 0, 0, 101, 0, 0, 101, 13, 13, 101, 15, 15, 0,
  681. 0, 0, 0, 0, 0, 0, 17, 17, 0, 0, 0, 0,
  682. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  683. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  684. 0, 0, 0, 19, 19, 0, 0, 0, 0, 0, 0, 0,
  685. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  686. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  687. 0, 0, 0, 0, 21, 21, 0, 0, 0, 0, 0, 0,
  688. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  689. 0, 0, 0, 0, 0, 0, 23, 23, 0, 0, 0, 0,
  690. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  691. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  692. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  693. 0, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  694. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  695. 0, 0, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0,
  696. 0, 0, 29, 29, 0, 0, 0, 0, 0, 0, 0, 0,
  697. 0, 0, 0, 0, 0, 0, 0, 0, 31, 31, 0, 0,
  698. 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  699. 0, 35, 35, 0, 0, 0, 0, 0, 0, 0, 37, 37,
  700. 0, 0, 0, 0, 0, 0, 0, 39, 39, 0, 0, 0,
  701. 0, 0, 0, 0, 0, 0, 41, 41, 0, 0, 0, 0,
  702. 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 0, 0,
  703. 0, 0, 0, 0, 0, 45, 45, 0, 0, 0, 0, 0,
  704. 0, 0, 47, 47, 0, 0, 0, 0, 0, 0, 0, 49,
  705. 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  706. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  707. 0, 0, 0, 51, 51, 0, 0, 0, 0, 0, 0, 0,
  708. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  709. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  710. 0, 0, 53, 53, 0, 0, 0, 0, 0, 0, 0, 0,
  711. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  712. 0, 0, 0, 0, 55, 55, 0, 0, 0, 0, 0, 0,
  713. 0, 0, 0, 0, 57, 57, 0, 0, 0, 0, 0, 0,
  714. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  715. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  716. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  717. 59, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  718. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  719. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  720. 0, 61, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  721. 0, 0, 0, 0, 0, 0, 0, 63, 63, 0, 0, 0,
  722. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  723. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  724. 0, 0, 0, 65, 65, 0, 0, 0, 0, 0, 0, 0,
  725. 0, 0, 0, 0, 0, 0, 0, 0, 67, 67, 0, 0,
  726. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  727. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  728. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  729. 0, 0, 0, 0, 0, 0, 69, 69, 0, 0, 0, 0,
  730. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  731. 0, 0, 0, 0, 0, 0, 71, 71, 0, 0, 0, 0,
  732. 0, 0, 0, 0, 0, 0, 0, 0, 73, 73, 0, 0,
  733. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  734. 0, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  735. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  736. 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  737. 0, 0, 0, 79, 79, 0, 81, 0, 81, 0, 0, 0,
  738. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  739. 0, 83, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  740. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  741. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  742. 0, 0, 0, 85, 85, 0, 0, 0, 0, 0, 0, 0,
  743. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87,
  744. 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  745. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89,
  746. 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 91, 0,
  747. 93, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  748. 0, 0, 0, 0, 0, 0, 0, 0, 95, 95, 0, 0,
  749. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  750. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  751. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  752. 0, 97, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  753. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  754. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  755. 0, 0, 99, 101, 101, 101, 101, 101, 101, 101, 101, 101,
  756. 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
  757. 101, 101, 101, 101, 101, 99, 0
  758. };
  759. }
  760. private static final byte _http_keywords_trans_actions[] = init__http_keywords_trans_actions_0();
  761. private static byte[] init__http_keywords_to_state_actions_0()
  762. {
  763. return new byte [] {
  764. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  765. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  766. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  767. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  768. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  769. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  770. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  771. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  772. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  773. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  774. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  775. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  776. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  777. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  778. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  779. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  780. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  781. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  782. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  783. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  784. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  785. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  786. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  787. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  788. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  789. 0, 0, 0, 0, 0, 0, 0, 1, 0
  790. };
  791. }
  792. private static final byte _http_keywords_to_state_actions[] = init__http_keywords_to_state_actions_0();
  793. private static byte[] init__http_keywords_from_state_actions_0()
  794. {
  795. return new byte [] {
  796. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  797. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  798. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  799. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  800. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  801. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  802. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  803. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  804. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  805. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  806. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  807. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  808. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  809. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  810. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  811. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  812. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  813. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  814. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  815. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  816. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  817. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  818. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  819. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  820. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  821. 0, 0, 0, 0, 0, 0, 0, 3, 0
  822. };
  823. }
  824. private static final byte _http_keywords_from_state_actions[] = init__http_keywords_from_state_actions_0();
  825. private static short[] init__http_keywords_eof_trans_0()
  826. {
  827. return new short [] {
  828. 0, 0, 0, 0, 0, 0, 1025, 1025, 1025, 1025, 1025, 1025,
  829. 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025,
  830. 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 0, 0, 0, 0,
  831. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  832. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  833. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  834. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  835. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  836. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  837. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  838. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  839. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  840. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  841. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  842. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  843. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  844. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  845. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  846. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  847. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  848. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  849. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  850. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  851. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  852. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  853. 0, 0, 0, 0, 0, 0, 0, 0, 1026
  854. };
  855. }
  856. private static final short _http_keywords_eof_trans[] = init__http_keywords_eof_trans_0();
  857. static final int http_keywords_start = 307;
  858. static final int http_keywords_first_final = 307;
  859. static final int http_keywords_error = 0;
  860. static final int http_keywords_en_main = 307;
  861. // line 226 "HttpRequestParser.rl"
  862. @SuppressWarnings("unused")
  863. public static String kw_lookup(byte[] data, int start, int len) {
  864. // String req = null;
  865. int ts, te, act;
  866. // int wb = 0;
  867. int p = start;
  868. int pe = start + len;
  869. int eof = pe;
  870. int cs;
  871. String kw = null;
  872. // line 972 "HttpRequestParser.java"
  873. {
  874. cs = http_keywords_start;
  875. ts = -1;
  876. te = -1;
  877. act = 0;
  878. }
  879. // line 240 "HttpRequestParser.rl"
  880. // line 982 "HttpRequestParser.java"
  881. {
  882. int _klen;
  883. int _trans = 0;
  884. int _acts;
  885. int _nacts;
  886. int _keys;
  887. int _goto_targ = 0;
  888. _goto: while (true) {
  889. switch ( _goto_targ ) {
  890. case 0:
  891. if ( p == pe ) {
  892. _goto_targ = 4;
  893. continue _goto;
  894. }
  895. if ( cs == 0 ) {
  896. _goto_targ = 5;
  897. continue _goto;
  898. }
  899. case 1:
  900. _acts = _http_keywords_from_state_actions[cs];
  901. _nacts = (int) _http_keywords_actions[_acts++];
  902. while ( _nacts-- > 0 ) {
  903. switch ( _http_keywords_actions[_acts++] ) {
  904. case 1:
  905. // line 1 "HttpRequestParser.rl"
  906. {ts = p;}
  907. break;
  908. // line 1011 "HttpRequestParser.java"
  909. }
  910. }
  911. _match: do {
  912. _keys = _http_keywords_key_offsets[cs];
  913. _trans = _http_keywords_index_offsets[cs];
  914. _klen = _http_keywords_single_lengths[cs];
  915. if ( _klen > 0 ) {
  916. int _lower = _keys;
  917. int _mid;
  918. int _upper = _keys + _klen - 1;
  919. while (true) {
  920. if ( _upper < _lower )
  921. break;
  922. _mid = _lower + ((_upper-_lower) >> 1);
  923. if ( data[p] < _http_keywords_trans_keys[_mid] )
  924. _upper = _mid - 1;
  925. else if ( data[p] > _http_keywords_trans_keys[_mid] )
  926. _lower = _mid + 1;
  927. else {
  928. _trans += (_mid - _keys);
  929. break _match;
  930. }
  931. }
  932. _keys += _klen;
  933. _trans += _klen;
  934. }
  935. _klen = _http_keywords_range_lengths[cs];
  936. if ( _klen > 0 ) {
  937. int _lower = _keys;
  938. int _mid;
  939. int _upper = _keys + (_klen<<1) - 2;
  940. while (true) {
  941. if ( _upper < _lower )
  942. break;
  943. _mid = _lower + (((_upper-_lower) >> 1) & ~1);
  944. if ( data[p] < _http_keywords_trans_keys[_mid] )
  945. _upper = _mid - 2;
  946. else if ( data[p] > _http_keywords_trans_keys[_mid+1] )
  947. _lower = _mid + 2;
  948. else {
  949. _trans += ((_mid - _keys)>>1);
  950. break _match;
  951. }
  952. }
  953. _trans += _klen;
  954. }
  955. } while (false);
  956. case 3:
  957. cs = _http_keywords_trans_targs[_trans];
  958. if ( _http_keywords_trans_actions[_trans] != 0 ) {
  959. _acts = _http_keywords_trans_actions[_trans];
  960. _nacts = (int) _http_keywords_actions[_acts++];
  961. while ( _nacts-- > 0 )
  962. {
  963. switch ( _http_keywords_actions[_acts++] )
  964. {
  965. case 2:
  966. // line 1 "HttpRequestParser.rl"
  967. {te = p+1;}
  968. break;
  969. case 3:
  970. // line 177 "HttpRequestParser.rl"
  971. {te = p+1;{ kw = "Accept-Charset";}}
  972. break;
  973. case 4:
  974. // line 178 "HttpRequestParser.rl"
  975. {te = p+1;{ kw = "Accept-Encoding";}}
  976. break;
  977. case 5:
  978. // line 179 "HttpRequestParser.rl"
  979. {te = p+1;{ kw = "Accept-Language";}}
  980. break;
  981. case 6:
  982. // line 180 "HttpRequestParser.rl"
  983. {te = p+1;{ kw = "Accept-Ranges";}}
  984. break;
  985. case 7:
  986. // line 181 "HttpRequestParser.rl"
  987. {te = p+1;{ kw = "Age";}}
  988. break;
  989. case 8:
  990. // line 182 "HttpRequestParser.rl"
  991. {te = p+1;{ kw = "Allow";}}
  992. break;
  993. case 9:
  994. // line 183 "HttpRequestParser.rl"
  995. {te = p+1;{ kw = "Authorization";}}
  996. break;
  997. case 10:
  998. // line 184 "HttpRequestParser.rl"
  999. {te = p+1;{ kw = "Cache-Control";}}
  1000. break;
  1001. case 11:
  1002. // line 185 "HttpRequestParser.rl"
  1003. {te = p+1;{ kw = "Connection";}}
  1004. break;
  1005. case 12:
  1006. // line 186 "HttpRequestParser.rl"
  1007. {te = p+1;{ kw = "Content-Encoding";}}
  1008. break;
  1009. case 13:
  1010. // line 187 "HttpRequestParser.rl"
  1011. {te = p+1;{ kw = "Content-Language";}}
  1012. break;
  1013. case 14:
  1014. // line 188 "HttpRequestParser.rl"
  1015. {te = p+1;{ kw = "Content-Length";}}
  1016. break;
  1017. case 15:
  1018. // line 189 "HttpRequestParser.rl"
  1019. {te = p+1;{ kw = "Content-Location";}}
  1020. break;
  1021. case 16:
  1022. // line 190 "HttpRequestParser.rl"
  1023. {te = p+1;{ kw = "Content-MD5";}}
  1024. break;
  1025. case 17:
  1026. // line 191 "HttpRequestParser.rl"
  1027. {te = p+1;{ kw = "Content-Range";}}
  1028. break;
  1029. case 18:
  1030. // line 192 "HttpRequestParser.rl"
  1031. {te = p+1;{ kw = "Content-Type";}}
  1032. break;
  1033. case 19:
  1034. // line 193 "HttpRequestParser.rl"
  1035. {te = p+1;{ kw = "Date";}}
  1036. break;
  1037. case 20:
  1038. // line 194 "HttpRequestParser.rl"
  1039. {te = p+1;{ kw = "ETag";}}
  1040. break;
  1041. case 21:
  1042. // line 195 "HttpRequestParser.rl"
  1043. {te = p+1;{ kw = "Expect";}}
  1044. break;
  1045. case 22:
  1046. // line 196 "HttpRequestParser.rl"
  1047. {te = p+1;{ kw = "Expires";}}
  1048. break;
  1049. case 23:
  1050. // line 197 "HttpRequestParser.rl"
  1051. {te = p+1;{ kw = "From";}}
  1052. break;
  1053. case 24:
  1054. // line 198 "HttpRequestParser.rl"
  1055. {te = p+1;{ kw = "Host";}}
  1056. break;
  1057. case 25:
  1058. // line 199 "HttpRequestParser.rl"
  1059. {te = p+1;{ kw = "If-Match";}}
  1060. break;
  1061. case 26:
  1062. // line 200 "HttpRequestParser.rl"
  1063. {te = p+1;{ kw = "If-Modified-Since";}}
  1064. break;
  1065. case 27:
  1066. // line 201 "HttpRequestParser.rl"
  1067. {te = p+1;{ kw = "If-None-Match";}}
  1068. break;
  1069. case 28:
  1070. // line 202 "HttpRequestParser.rl"
  1071. {te = p+1;{ kw = "If-Range";}}
  1072. break;
  1073. case 29:
  1074. // line 203 "HttpRequestParser.rl"
  1075. {te = p+1;{ kw = "If-Unmodified-Since";}}
  1076. break;
  1077. case 30:
  1078. // line 204 "HttpRequestParser.rl"
  1079. {te = p+1;{ kw = "Last-Modified";}}
  1080. break;
  1081. case 31:
  1082. // line 205 "HttpRequestParser.rl"
  1083. {te = p+1;{ kw = "Location";}}
  1084. break;
  1085. case 32:
  1086. // line 206 "HttpRequestParser.rl"
  1087. {te = p+1;{ kw = "Max-Forwards";}}
  1088. break;
  1089. case 33:
  1090. // line 207 "HttpRequestParser.rl"
  1091. {te = p+1;{ kw = "Pragma";}}
  1092. break;
  1093. case 34:
  1094. // line 208 "HttpRequestParser.rl"
  1095. {te = p+1;{ kw = "Proxy-Authenticate";}}
  1096. break;
  1097. case 35:
  1098. // line 209 "HttpRequestParser.rl"
  1099. {te = p+1;{ kw = "Proxy-Authorization";}}
  1100. break;
  1101. case 36:
  1102. // line 210 "HttpRequestParser.rl"
  1103. {te = p+1;{ kw = "Range";}}
  1104. break;
  1105. case 37:
  1106. // line 211 "HttpRequestParser.rl"
  1107. {te = p+1;{ kw = "Referer";}}
  1108. break;
  1109. case 38:
  1110. // line 212 "HttpRequestParser.rl"
  1111. {te = p+1;{ kw = "Retry-After";}}
  1112. break;
  1113. case 39:
  1114. // line 213 "HttpRequestParser.rl"
  1115. {te = p+1;{ kw = "Server";}}
  1116. break;
  1117. case 40:
  1118. // line 214 "HttpRequestParser.rl"
  1119. {te = p+1;{ kw = "TE";}}
  1120. break;
  1121. case 41:
  1122. // line 215 "HttpRequestParser.rl"
  1123. {te = p+1;{ kw = "Trailer";}}
  1124. break;
  1125. case 42:
  1126. // line 216 "HttpRequestParser.rl"
  1127. {te = p+1;{ kw = "Transfer-Encoding";}}
  1128. break;
  1129. case 43:
  1130. // line 217 "HttpRequestParser.rl"
  1131. {te = p+1;{ kw = "Upgrade";}}
  1132. break;
  1133. case 44:
  1134. // line 218 "HttpRequestParser.rl"
  1135. {te = p+1;{ kw = "User-Agent";}}
  1136. break;
  1137. case 45:
  1138. // line 219 "HttpRequestParser.rl"
  1139. {te = p+1;{ kw = "Vary";}}
  1140. break;
  1141. case 46:
  1142. // line 220 "HttpRequestParser.rl"
  1143. {te = p+1;{ kw = "Via";}}
  1144. break;
  1145. case 47:
  1146. // line 221 "HttpRequestParser.rl"
  1147. {te = p+1;{ kw = "Warning";}}
  1148. break;
  1149. case 48:
  1150. // line 222 "HttpRequestParser.rl"
  1151. {te = p+1;{ kw = "WWW-Authenticate";}}
  1152. break;
  1153. case 49:
  1154. // line 176 "HttpRequestParser.rl"
  1155. {te = p;p--;{ kw = "Accept";}}
  1156. break;
  1157. case 50:
  1158. // line 176 "HttpRequestParser.rl"
  1159. {{p = ((te))-1;}{ kw = "Accept";}}
  1160. break;
  1161. // line 1270 "HttpRequestParser.java"
  1162. }
  1163. }
  1164. }
  1165. case 2:
  1166. _acts = _http_keywords_to_state_actions[cs];
  1167. _nacts = (int) _http_keywords_actions[_acts++];
  1168. while ( _nacts-- > 0 ) {
  1169. switch ( _http_keywords_actions[_acts++] ) {
  1170. case 0:
  1171. // line 1 "HttpRequestParser.rl"
  1172. {ts = -1;}
  1173. break;
  1174. // line 1284 "HttpRequestParser.java"
  1175. }
  1176. }
  1177. if ( cs == 0 ) {
  1178. _goto_targ = 5;
  1179. continue _goto;
  1180. }
  1181. if ( ++p != pe ) {
  1182. _goto_targ = 1;
  1183. continue _goto;
  1184. }
  1185. case 4:
  1186. if ( p == eof )
  1187. {
  1188. if ( _http_keywords_eof_trans[cs] > 0 ) {
  1189. _trans = _http_keywords_eof_trans[cs] - 1;
  1190. _goto_targ = 3;
  1191. continue _goto;
  1192. }
  1193. }
  1194. case 5:
  1195. }
  1196. break; }
  1197. }
  1198. // line 241 "HttpRequestParser.rl"
  1199. return kw;
  1200. }
  1201. // line 1317 "HttpRequestParser.java"
  1202. private static byte[] init__http_date_actions_0()
  1203. {
  1204. return new byte [] {
  1205. 0, 1, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1,
  1206. 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1,
  1207. 11, 1, 12, 1, 13, 1, 14, 1, 15, 1, 16
  1208. };
  1209. }
  1210. private static final byte _http_date_actions[] = init__http_date_actions_0();
  1211. private static short[] init__http_date_key_offsets_0()
  1212. {
  1213. return new short [] {
  1214. 0, 0, 5, 6, 7, 9, 18, 20, 21, 22, 25, 28,
  1215. 31, 34, 36, 39, 41, 44, 47, 48, 49, 50, 51, 52,
  1216. 54, 55, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67,
  1217. 70, 74, 83, 85, 86, 87, 90, 93, 96, 99, 101, 104,
  1218. 106, 109, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121,
  1219. 123, 124, 126, 127, 128, 129, 130, 131, 132, 140, 142, 143,
  1220. 144, 146, 147, 148, 149, 150, 151, 153, 154, 156, 157, 159,
  1221. 160, 161, 162, 163, 164, 165, 166, 167, 169, 170, 172, 173,
  1222. 174, 175, 176, 178
  1223. };
  1224. }
  1225. private static final short _http_date_key_offsets[] = init__http_date_key_offsets_0();
  1226. private static char[] init__http_date_trans_keys_0()
  1227. {
  1228. return new char [] {
  1229. 70, 77, 83, 84, 87, 114, 105, 32, 44, 32, 65, 68,
  1230. 70, 74, 77, 78, 79, 83, 112, 117, 114, 32, 32, 48,
  1231. 57, 32, 48, 57, 32, 48, 57, 58, 48, 57, 48, 57,
  1232. 58, 48, 57, 48, 57, 32, 48, 57, 32, 48, 57, 103,
  1233. 101, 99, 101, 98, 97, 117, 110, 108, 110, 97, 114, 121,
  1234. 111, 118, 99, 116, 101, 112, 32, 32, 48, 57, 32, 45,
  1235. 48, 57, 32, 65, 68, 70, 74, 77, 78, 79, 83, 112,
  1236. 117, 114, 32, 32, 48, 57, 32, 48, 57, 32, 48, 57,
  1237. 58, 48, 57, 48, 57, 58, 48, 57, 48, 57, 32, 48,
  1238. 57, 32, 71, 77, 84, 103, 101, 99, 101, 98, 97, 117,
  1239. 110, 108, 110, 97, 114, 121, 111, 118, 99, 116, 101, 112,
  1240. 65, 68, 70, 74, 77, 78, 79, 83, 112, 117, 114, 45,
  1241. 48, 57, 103, 101, 99, 101, 98, 97, 117, 110, 108, 110,
  1242. 97, 114, 121, 111, 118, 99, 116, 101, 112, 111, 110, 97,
  1243. 117, 116, 104, 117, 117, 101, 101, 100, 48, 57, 0
  1244. };
  1245. }
  1246. private static final char _http_date_trans_keys[] = init__http_date_trans_keys_0();
  1247. private static byte[] init__http_date_single_lengths_0()
  1248. {
  1249. return new byte [] {
  1250. 0, 5, 1, 1, 2, 9, 2, 1, 1, 1, 1, 1,
  1251. 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2,
  1252. 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
  1253. 2, 9, 2, 1, 1, 1, 1, 1, 1, 0, 1, 0,
  1254. 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2,
  1255. 1, 2, 1, 1, 1, 1, 1, 1, 8, 2, 1, 1,
  1256. 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1,
  1257. 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1,
  1258. 1, 1, 0, 0
  1259. };
  1260. }
  1261. private static final byte _http_date_single_lengths[] = init__http_date_single_lengths_0();
  1262. private static byte[] init__http_date_range_lengths_0()
  1263. {
  1264. return new byte [] {
  1265. 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
  1266. 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
  1267. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
  1268. 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
  1269. 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1270. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1271. 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1272. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1273. 0, 0, 1, 0
  1274. };
  1275. }
  1276. private static final byte _http_date_range_lengths[] = init__http_date_range_lengths_0();
  1277. private static short[] init__http_date_index_offsets_0()
  1278. {
  1279. return new short [] {
  1280. 0, 0, 6, 8, 10, 13, 23, 26, 28, 30, 33, 36,
  1281. 39, 42, 44, 47, 49, 52, 55, 57, 59, 61, 63, 65,
  1282. 68, 70, 73, 75, 78, 80, 82, 84, 86, 88, 90, 92,
  1283. 95, 99, 109, 112, 114, 116, 119, 122, 125, 128, 130, 133,
  1284. 135, 138, 141, 143, 145, 147, 149, 151, 153, 155, 158, 160,
  1285. 163, 165, 168, 170, 172, 174, 176, 178, 180, 189, 192, 194,
  1286. 196, 198, 200, 202, 204, 206, 208, 211, 213, 216, 218, 221,
  1287. 223, 225, 227, 229, 231, 233, 235, 237, 240, 242, 245, 247,
  1288. 249, 251, 253, 255
  1289. };
  1290. }
  1291. private static final short _http_date_index_offsets[] = init__http_date_index_offsets_0();
  1292. private static byte[] init__http_date_trans_targs_0()
  1293. {
  1294. return new byte [] {
  1295. 2, 89, 91, 93, 96, 0, 3, 0, 4, 0, 5, 34,
  1296. 0, 5, 6, 19, 21, 23, 26, 28, 30, 32, 0, 7,
  1297. 18, 0, 8, 0, 9, 0, 9, 10, 0, 11, 10, 0,
  1298. 11, 12, 0, 13, 12, 0, 14, 0, 15, 14, 0, 16,
  1299. 0, 17, 16, 0, 17, 98, 0, 8, 0, 20, 0, 8,
  1300. 0, 22, 0, 8, 0, 24, 25, 0, 8, 0, 8, 8,
  1301. 0, 27, 0, 8, 8, 0, 29, 0, 8, 0, 31, 0,
  1302. 8, 0, 33, 0, 8, 0, 35, 0, 35, 36, 0, 37,
  1303. 68, 36, 0, 37, 38, 53, 55, 57, 60, 62, 64, 66,
  1304. 0, 39, 52, 0, 40, 0, 41, 0, 41, 42, 0, 43,
  1305. 42, 0, 43, 44, 0, 45, 44, 0, 46, 0, 47, 46,
  1306. 0, 48, 0, 49, 48, 0, 49, 50, 0, 51, 0, 99,
  1307. 0, 40, 0, 54, 0, 40, 0, 56, 0, 40, 0, 58,
  1308. 59, 0, 40, 0, 40, 40, 0, 61, 0, 40, 40, 0,
  1309. 63, 0, 40, 0, 65, 0, 40, 0, 67, 0, 40, 0,
  1310. 69, 74, 76, 78, 81, 83, 85, 87, 0, 70, 73, 0,
  1311. 71, 0, 72, 0, 42, 0, 71, 0, 75, 0, 71, 0,
  1312. 77, 0, 71, 0, 79, 80, 0, 71, 0, 71, 71, 0,
  1313. 82, 0, 71, 71, 0, 84, 0, 71, 0, 86, 0, 71,
  1314. 0, 88, 0, 71, 0, 90, 0, 4, 0, 92, 90, 0,
  1315. 4, 0, 94, 95, 0, 4, 0, 4, 0, 97, 0, 4,
  1316. 0, 98, 0, 0, 0
  1317. };
  1318. }
  1319. private static final byte _http_date_trans_targs[] = init__http_date_trans_targs_0();
  1320. private static byte[] init__http_date_trans_actions_0()
  1321. {
  1322. return new byte [] {
  1323. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1324. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1325. 0, 0, 17, 0, 0, 0, 0, 1, 0, 0, 1, 0,
  1326. 0, 5, 0, 0, 5, 0, 7, 0, 0, 7, 0, 9,
  1327. 0, 0, 9, 0, 0, 3, 0, 25, 0, 0, 0, 33,
  1328. 0, 0, 0, 13, 0, 0, 0, 0, 11, 0, 23, 21,
  1329. 0, 0, 0, 15, 19, 0, 0, 0, 31, 0, 0, 0,
  1330. 29, 0, 0, 0, 27, 0, 0, 0, 0, 1, 0, 0,
  1331. 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1332. 0, 0, 0, 0, 17, 0, 0, 0, 0, 3, 0, 0,
  1333. 3, 0, 0, 5, 0, 0, 5, 0, 7, 0, 0, 7,
  1334. 0, 9, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
  1335. 0, 25, 0, 0, 0, 33, 0, 0, 0, 13, 0, 0,
  1336. 0, 0, 11, 0, 23, 21, 0, 0, 0, 15, 19, 0,
  1337. 0, 0, 31, 0, 0, 0, 29, 0, 0, 0, 27, 0,
  1338. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1339. 17, 0, 0, 0, 3, 0, 25, 0, 0, 0, 33, 0,
  1340. 0, 0, 13, 0, 0, 0, 0, 11, 0, 23, 21, 0,
  1341. 0, 0, 15, 19, 0, 0, 0, 31, 0, 0, 0, 29,
  1342. 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0,
  1343. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1344. 0, 3, 0, 0, 0
  1345. };
  1346. }
  1347. private static final byte _http_date_trans_actions[] = init__http_date_trans_actions_0();
  1348. static final int http_date_start = 1;
  1349. static final int http_date_first_final = 98;
  1350. static final int http_date_error = 0;
  1351. static final int http_date_en_main = 1;
  1352. // line 285 "HttpRequestParser.rl"
  1353. public static TimeZone GMT = TimeZone.getTimeZone("GMT");
  1354. public static long parseDate(byte[] data, int pos, int len) {
  1355. int p = 0;
  1356. int pe = len;
  1357. // int eof = pe;
  1358. int cs;
  1359. // int wkday = 0;
  1360. int day = 0, month = 0, year = 0;
  1361. int hh = 0, mm = 0, ss = 0;
  1362. // line 1510 "HttpRequestParser.java"
  1363. {
  1364. cs = http_date_start;
  1365. }
  1366. // line 299 "HttpRequestParser.rl"
  1367. // line 1517 "HttpRequestParser.java"
  1368. {
  1369. int _klen;
  1370. int _trans = 0;
  1371. int _acts;
  1372. int _nacts;
  1373. int _keys;
  1374. int _goto_targ = 0;
  1375. _goto: while (true) {
  1376. switch ( _goto_targ ) {
  1377. case 0:
  1378. if ( p == pe ) {
  1379. _goto_targ = 4;
  1380. continue _goto;
  1381. }
  1382. if ( cs == 0 ) {
  1383. _goto_targ = 5;
  1384. continue _goto;
  1385. }
  1386. case 1:
  1387. _match: do {
  1388. _keys = _http_date_key_offsets[cs];
  1389. _trans = _http_date_index_offsets[cs];
  1390. _klen = _http_date_single_lengths[cs];
  1391. if ( _klen > 0 ) {
  1392. int _lower = _keys;
  1393. int _mid;
  1394. int _upper = _keys + _klen - 1;
  1395. while (true) {
  1396. if ( _upper < _lower )
  1397. break;
  1398. _mid = _lower + ((_upper-_lower) >> 1);
  1399. if ( data[p] < _http_date_trans_keys[_mid] )
  1400. _upper = _mid - 1;
  1401. else if ( data[p] > _http_date_trans_keys[_mid] )
  1402. _lower = _mid + 1;
  1403. else {
  1404. _trans += (_mid - _keys);
  1405. break _match;
  1406. }
  1407. }
  1408. _keys += _klen;
  1409. _trans += _klen;
  1410. }
  1411. _klen = _http_date_range_lengths[cs];
  1412. if ( _klen > 0 ) {
  1413. int _lower = _keys;
  1414. int _mid;
  1415. int _upper = _keys + (_klen<<1) - 2;
  1416. while (true) {
  1417. if ( _upper < _lower )
  1418. break;
  1419. _mid = _lower + (((_upper-_lower) >> 1) & ~1);
  1420. if ( data[p] < _http_date_trans_keys[_mid] )
  1421. _upper = _mid - 2;
  1422. else if ( data[p] > _http_date_trans_keys[_mid+1] )
  1423. _lower = _mid + 2;
  1424. else {
  1425. _trans += ((_mid - _keys)>>1);
  1426. break _match;
  1427. }
  1428. }
  1429. _trans += _klen;
  1430. }
  1431. } while (false);
  1432. cs = _http_date_trans_targs[_trans];
  1433. if ( _http_date_trans_actions[_trans] != 0 ) {
  1434. _acts = _http_date_trans_actions[_trans];
  1435. _nacts = (int) _http_date_actions[_acts++];
  1436. while ( _nacts-- > 0 )
  1437. {
  1438. switch ( _http_date_actions[_acts++] )
  1439. {
  1440. case 0:
  1441. // line 254 "HttpRequestParser.rl"
  1442. {day = day * 10 + (data[p] - 48);}
  1443. break;
  1444. case 1:
  1445. // line 255 "HttpRequestParser.rl"
  1446. {year = year * 10 + (data[p] - 48);}
  1447. break;
  1448. case 2:
  1449. // line 256 "HttpRequestParser.rl"
  1450. {hh = hh * 10 + (data[p] - 48) ;}
  1451. break;
  1452. case 3:
  1453. // line 257 "HttpRequestParser.rl"
  1454. {mm = mm * 10 + (data[p] - 48) ;}
  1455. break;
  1456. case 4:
  1457. // line 258 "HttpRequestParser.rl"
  1458. {ss = ss * 10 + (data[p] - 48) ;}
  1459. break;
  1460. case 5:
  1461. // line 262 "HttpRequestParser.rl"
  1462. { month = 0;}
  1463. break;
  1464. case 6:
  1465. // line 263 "HttpRequestParser.rl"
  1466. { month = 1;}
  1467. break;
  1468. case 7:
  1469. // line 264 "HttpRequestParser.rl"
  1470. { month = 2;}
  1471. break;
  1472. case 8:
  1473. // line 265 "HttpRequestParser.rl"
  1474. { month = 3;}
  1475. break;
  1476. case 9:
  1477. // line 266 "HttpRequestParser.rl"
  1478. { month = 4;}
  1479. break;
  1480. case 10:
  1481. // line 267 "HttpRequestParser.rl"
  1482. { month = 5;}
  1483. break;
  1484. case 11:
  1485. // line 268 "HttpRequestParser.rl"
  1486. { month = 6;}
  1487. break;
  1488. case 12:
  1489. // line 269 "HttpRequestParser.rl"
  1490. { month = 7;}
  1491. break;
  1492. case 13:
  1493. // line 270 "HttpRequestParser.rl"
  1494. { month = 8;}
  1495. break;
  1496. case 14:
  1497. // line 271 "HttpRequestParser.rl"
  1498. { month = 90;}
  1499. break;
  1500. case 15:
  1501. // line 272 "HttpRequestParser.rl"
  1502. { month = 10;}
  1503. break;
  1504. case 16:
  1505. // line 273 "HttpRequestParser.rl"
  1506. { month = 11;}
  1507. break;
  1508. // line 1664 "HttpRequestParser.java"
  1509. }
  1510. }
  1511. }
  1512. case 2:
  1513. if ( cs == 0 ) {
  1514. _goto_targ = 5;
  1515. continue _goto;
  1516. }
  1517. if ( ++p != pe ) {
  1518. _goto_targ = 1;
  1519. continue _goto;
  1520. }
  1521. case 4:
  1522. case 5:
  1523. }
  1524. break; }
  1525. }
  1526. // line 300 "HttpRequestParser.rl"
  1527. if (year < 100) {year += 1900;}
  1528. GregorianCalendar gc = new GregorianCalendar();
  1529. gc.set(year, month, day, hh, mm, ss);
  1530. gc.setTimeZone(GMT);
  1531. return gc.getTimeInMillis();
  1532. }
  1533. public static String crlf = "\r\n";
  1534. public static void main(String args[]) throws Exception {
  1535. /// Testing
  1536. String s =
  1537. "GET /favicon.ico#test HTTP/1.1\r\n" +
  1538. "Host: localhost:7262\r\n" +
  1539. "User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10 Ubiquity/0.1.5\r\n" +
  1540. "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" +
  1541. "Accept-Language: en-us,en;q=0.5\r\n" +
  1542. "Accept-Encoding: gzip,deflate\r\n" +
  1543. "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n" +
  1544. "Keep-Alive: 300\r\n" +
  1545. "Connection: keep-alive\r\n\r\n";
  1546. System.out.println("Input Request: (" + s.length() + " bytes)");System.out.println(s);
  1547. byte[] data = s.getBytes();
  1548. int len = data.length;
  1549. System.out.println("=============================================================");
  1550. HttpRequest req = new HttpRequest();
  1551. req.buffer = ByteBuffer.allocate(2048);
  1552. req.buffer.put(data);
  1553. initHeader(req, len);
  1554. System.out.println(req);
  1555. }
  1556. }