mongrel 1.1.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data.tar.gz.sig +4 -0
  2. data/CHANGELOG +18 -0
  3. data/COPYING +55 -0
  4. data/LICENSE +55 -0
  5. data/Manifest +69 -0
  6. data/README +74 -0
  7. data/TODO +5 -0
  8. data/bin/mongrel_rails +283 -0
  9. data/examples/builder.rb +29 -0
  10. data/examples/camping/README +3 -0
  11. data/examples/camping/blog.rb +294 -0
  12. data/examples/camping/tepee.rb +149 -0
  13. data/examples/httpd.conf +474 -0
  14. data/examples/mime.yaml +3 -0
  15. data/examples/mongrel.conf +9 -0
  16. data/examples/mongrel_simple_ctrl.rb +92 -0
  17. data/examples/mongrel_simple_service.rb +116 -0
  18. data/examples/monitrc +57 -0
  19. data/examples/random_thrash.rb +19 -0
  20. data/examples/simpletest.rb +52 -0
  21. data/examples/webrick_compare.rb +20 -0
  22. data/ext/http11/ext_help.h +14 -0
  23. data/ext/http11/extconf.rb +6 -0
  24. data/ext/http11/http11.c +402 -0
  25. data/ext/http11/http11_parser.c +1221 -0
  26. data/ext/http11/http11_parser.h +49 -0
  27. data/ext/http11/http11_parser.java.rl +170 -0
  28. data/ext/http11/http11_parser.rl +152 -0
  29. data/ext/http11/http11_parser_common.rl +54 -0
  30. data/ext/http11_java/Http11Service.java +13 -0
  31. data/ext/http11_java/org/jruby/mongrel/Http11.java +266 -0
  32. data/ext/http11_java/org/jruby/mongrel/Http11Parser.java +572 -0
  33. data/lib/http11.so +0 -0
  34. data/lib/mongrel.rb +355 -0
  35. data/lib/mongrel/camping.rb +107 -0
  36. data/lib/mongrel/cgi.rb +181 -0
  37. data/lib/mongrel/command.rb +222 -0
  38. data/lib/mongrel/configurator.rb +388 -0
  39. data/lib/mongrel/const.rb +110 -0
  40. data/lib/mongrel/debug.rb +203 -0
  41. data/lib/mongrel/gems.rb +22 -0
  42. data/lib/mongrel/handlers.rb +468 -0
  43. data/lib/mongrel/header_out.rb +28 -0
  44. data/lib/mongrel/http_request.rb +155 -0
  45. data/lib/mongrel/http_response.rb +163 -0
  46. data/lib/mongrel/init.rb +10 -0
  47. data/lib/mongrel/mime_types.yml +616 -0
  48. data/lib/mongrel/rails.rb +185 -0
  49. data/lib/mongrel/stats.rb +89 -0
  50. data/lib/mongrel/tcphack.rb +18 -0
  51. data/lib/mongrel/uri_classifier.rb +76 -0
  52. data/mongrel-public_cert.pem +20 -0
  53. data/mongrel.gemspec +242 -0
  54. data/setup.rb +1585 -0
  55. data/test/mime.yaml +3 -0
  56. data/test/mongrel.conf +1 -0
  57. data/test/test_cgi_wrapper.rb +26 -0
  58. data/test/test_command.rb +86 -0
  59. data/test/test_conditional.rb +107 -0
  60. data/test/test_configurator.rb +88 -0
  61. data/test/test_debug.rb +25 -0
  62. data/test/test_handlers.rb +126 -0
  63. data/test/test_http11.rb +156 -0
  64. data/test/test_redirect_handler.rb +45 -0
  65. data/test/test_request_progress.rb +100 -0
  66. data/test/test_response.rb +127 -0
  67. data/test/test_stats.rb +35 -0
  68. data/test/test_uriclassifier.rb +261 -0
  69. data/test/test_ws.rb +115 -0
  70. data/test/testhelp.rb +79 -0
  71. data/tools/trickletest.rb +45 -0
  72. metadata +197 -0
  73. metadata.gz.sig +1 -0
@@ -0,0 +1,572 @@
1
+ // line 1 "http11_parser.java.rl"
2
+ package org.jruby.mongrel;
3
+
4
+ import org.jruby.util.ByteList;
5
+
6
+ public class Http11Parser {
7
+
8
+ /** Machine **/
9
+
10
+ // line 64 "http11_parser.java.rl"
11
+
12
+
13
+ /** Data **/
14
+
15
+ // line 16 "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
16
+ private static void init__http_parser_actions_0( byte[] r )
17
+ {
18
+ r[0]=0; r[1]=1; r[2]=0; r[3]=1; r[4]=1; r[5]=1; r[6]=2; r[7]=1;
19
+ r[8]=3; r[9]=1; r[10]=4; r[11]=1; r[12]=5; r[13]=1; r[14]=6; r[15]=1;
20
+ r[16]=7; r[17]=1; r[18]=8; r[19]=1; r[20]=10; r[21]=1; r[22]=11; r[23]=1;
21
+ r[24]=12; r[25]=2; r[26]=9; r[27]=6; r[28]=2; r[29]=11; r[30]=6; r[31]=3;
22
+ r[32]=8; r[33]=9; r[34]=6;
23
+ }
24
+
25
+ private static byte[] create__http_parser_actions( )
26
+ {
27
+ byte[] r = new byte[35];
28
+ init__http_parser_actions_0( r );
29
+ return r;
30
+ }
31
+
32
+ private static final byte _http_parser_actions[] = create__http_parser_actions();
33
+
34
+
35
+ private static void init__http_parser_key_offsets_0( short[] r )
36
+ {
37
+ r[0]=0; r[1]=0; r[2]=8; r[3]=17; r[4]=27; r[5]=29; r[6]=30; r[7]=31;
38
+ r[8]=32; r[9]=33; r[10]=34; r[11]=36; r[12]=39; r[13]=41; r[14]=44; r[15]=45;
39
+ r[16]=61; r[17]=62; r[18]=78; r[19]=80; r[20]=81; r[21]=90; r[22]=99; r[23]=105;
40
+ r[24]=111; r[25]=121; r[26]=130; r[27]=136; r[28]=142; r[29]=153; r[30]=159; r[31]=165;
41
+ r[32]=175; r[33]=181; r[34]=187; r[35]=196; r[36]=205; r[37]=211; r[38]=217; r[39]=226;
42
+ r[40]=235; r[41]=244; r[42]=253; r[43]=262; r[44]=271; r[45]=280; r[46]=289; r[47]=298;
43
+ r[48]=307; r[49]=316; r[50]=325; r[51]=334; r[52]=343; r[53]=352; r[54]=361; r[55]=370;
44
+ r[56]=379; r[57]=380;
45
+ }
46
+
47
+ private static short[] create__http_parser_key_offsets( )
48
+ {
49
+ short[] r = new short[58];
50
+ init__http_parser_key_offsets_0( r );
51
+ return r;
52
+ }
53
+
54
+ private static final short _http_parser_key_offsets[] = create__http_parser_key_offsets();
55
+
56
+
57
+ private static void init__http_parser_trans_keys_0( char[] r )
58
+ {
59
+ r[0]=36; r[1]=95; r[2]=45; r[3]=46; r[4]=48; r[5]=57; r[6]=65; r[7]=90;
60
+ r[8]=32; r[9]=36; r[10]=95; r[11]=45; r[12]=46; r[13]=48; r[14]=57; r[15]=65;
61
+ r[16]=90; r[17]=42; r[18]=43; r[19]=47; r[20]=58; r[21]=45; r[22]=57; r[23]=65;
62
+ r[24]=90; r[25]=97; r[26]=122; r[27]=32; r[28]=35; r[29]=72; r[30]=84; r[31]=84;
63
+ r[32]=80; r[33]=47; r[34]=48; r[35]=57; r[36]=46; r[37]=48; r[38]=57; r[39]=48;
64
+ r[40]=57; r[41]=13; r[42]=48; r[43]=57; r[44]=10; r[45]=13; r[46]=33; r[47]=124;
65
+ r[48]=126; r[49]=35; r[50]=39; r[51]=42; r[52]=43; r[53]=45; r[54]=46; r[55]=48;
66
+ r[56]=57; r[57]=65; r[58]=90; r[59]=94; r[60]=122; r[61]=10; r[62]=33; r[63]=58;
67
+ r[64]=124; r[65]=126; r[66]=35; r[67]=39; r[68]=42; r[69]=43; r[70]=45; r[71]=46;
68
+ r[72]=48; r[73]=57; r[74]=65; r[75]=90; r[76]=94; r[77]=122; r[78]=13; r[79]=32;
69
+ r[80]=13; r[81]=32; r[82]=37; r[83]=60; r[84]=62; r[85]=127; r[86]=0; r[87]=31;
70
+ r[88]=34; r[89]=35; r[90]=32; r[91]=37; r[92]=60; r[93]=62; r[94]=127; r[95]=0;
71
+ r[96]=31; r[97]=34; r[98]=35; r[99]=48; r[100]=57; r[101]=65; r[102]=70; r[103]=97;
72
+ r[104]=102; r[105]=48; r[106]=57; r[107]=65; r[108]=70; r[109]=97; r[110]=102; r[111]=43;
73
+ r[112]=58; r[113]=45; r[114]=46; r[115]=48; r[116]=57; r[117]=65; r[118]=90; r[119]=97;
74
+ r[120]=122; r[121]=32; r[122]=34; r[123]=35; r[124]=37; r[125]=60; r[126]=62; r[127]=127;
75
+ r[128]=0; r[129]=31; r[130]=48; r[131]=57; r[132]=65; r[133]=70; r[134]=97; r[135]=102;
76
+ r[136]=48; r[137]=57; r[138]=65; r[139]=70; r[140]=97; r[141]=102; r[142]=32; r[143]=34;
77
+ r[144]=35; r[145]=37; r[146]=59; r[147]=60; r[148]=62; r[149]=63; r[150]=127; r[151]=0;
78
+ r[152]=31; r[153]=48; r[154]=57; r[155]=65; r[156]=70; r[157]=97; r[158]=102; r[159]=48;
79
+ r[160]=57; r[161]=65; r[162]=70; r[163]=97; r[164]=102; r[165]=32; r[166]=34; r[167]=35;
80
+ r[168]=37; r[169]=60; r[170]=62; r[171]=63; r[172]=127; r[173]=0; r[174]=31; r[175]=48;
81
+ r[176]=57; r[177]=65; r[178]=70; r[179]=97; r[180]=102; r[181]=48; r[182]=57; r[183]=65;
82
+ r[184]=70; r[185]=97; r[186]=102; r[187]=32; r[188]=34; r[189]=35; r[190]=37; r[191]=60;
83
+ r[192]=62; r[193]=127; r[194]=0; r[195]=31; r[196]=32; r[197]=34; r[198]=35; r[199]=37;
84
+ r[200]=60; r[201]=62; r[202]=127; r[203]=0; r[204]=31; r[205]=48; r[206]=57; r[207]=65;
85
+ r[208]=70; r[209]=97; r[210]=102; r[211]=48; r[212]=57; r[213]=65; r[214]=70; r[215]=97;
86
+ r[216]=102; r[217]=32; r[218]=36; r[219]=95; r[220]=45; r[221]=46; r[222]=48; r[223]=57;
87
+ r[224]=65; r[225]=90; r[226]=32; r[227]=36; r[228]=95; r[229]=45; r[230]=46; r[231]=48;
88
+ r[232]=57; r[233]=65; r[234]=90; r[235]=32; r[236]=36; r[237]=95; r[238]=45; r[239]=46;
89
+ r[240]=48; r[241]=57; r[242]=65; r[243]=90; r[244]=32; r[245]=36; r[246]=95; r[247]=45;
90
+ r[248]=46; r[249]=48; r[250]=57; r[251]=65; r[252]=90; r[253]=32; r[254]=36; r[255]=95;
91
+ r[256]=45; r[257]=46; r[258]=48; r[259]=57; r[260]=65; r[261]=90; r[262]=32; r[263]=36;
92
+ r[264]=95; r[265]=45; r[266]=46; r[267]=48; r[268]=57; r[269]=65; r[270]=90; r[271]=32;
93
+ r[272]=36; r[273]=95; r[274]=45; r[275]=46; r[276]=48; r[277]=57; r[278]=65; r[279]=90;
94
+ r[280]=32; r[281]=36; r[282]=95; r[283]=45; r[284]=46; r[285]=48; r[286]=57; r[287]=65;
95
+ r[288]=90; r[289]=32; r[290]=36; r[291]=95; r[292]=45; r[293]=46; r[294]=48; r[295]=57;
96
+ r[296]=65; r[297]=90; r[298]=32; r[299]=36; r[300]=95; r[301]=45; r[302]=46; r[303]=48;
97
+ r[304]=57; r[305]=65; r[306]=90; r[307]=32; r[308]=36; r[309]=95; r[310]=45; r[311]=46;
98
+ r[312]=48; r[313]=57; r[314]=65; r[315]=90; r[316]=32; r[317]=36; r[318]=95; r[319]=45;
99
+ r[320]=46; r[321]=48; r[322]=57; r[323]=65; r[324]=90; r[325]=32; r[326]=36; r[327]=95;
100
+ r[328]=45; r[329]=46; r[330]=48; r[331]=57; r[332]=65; r[333]=90; r[334]=32; r[335]=36;
101
+ r[336]=95; r[337]=45; r[338]=46; r[339]=48; r[340]=57; r[341]=65; r[342]=90; r[343]=32;
102
+ r[344]=36; r[345]=95; r[346]=45; r[347]=46; r[348]=48; r[349]=57; r[350]=65; r[351]=90;
103
+ r[352]=32; r[353]=36; r[354]=95; r[355]=45; r[356]=46; r[357]=48; r[358]=57; r[359]=65;
104
+ r[360]=90; r[361]=32; r[362]=36; r[363]=95; r[364]=45; r[365]=46; r[366]=48; r[367]=57;
105
+ r[368]=65; r[369]=90; r[370]=32; r[371]=36; r[372]=95; r[373]=45; r[374]=46; r[375]=48;
106
+ r[376]=57; r[377]=65; r[378]=90; r[379]=32; r[380]=0;
107
+ }
108
+
109
+ private static char[] create__http_parser_trans_keys( )
110
+ {
111
+ char[] r = new char[381];
112
+ init__http_parser_trans_keys_0( r );
113
+ return r;
114
+ }
115
+
116
+ private static final char _http_parser_trans_keys[] = create__http_parser_trans_keys();
117
+
118
+
119
+ private static void init__http_parser_single_lengths_0( byte[] r )
120
+ {
121
+ r[0]=0; r[1]=2; r[2]=3; r[3]=4; r[4]=2; r[5]=1; r[6]=1; r[7]=1;
122
+ r[8]=1; r[9]=1; r[10]=0; r[11]=1; r[12]=0; r[13]=1; r[14]=1; r[15]=4;
123
+ r[16]=1; r[17]=4; r[18]=2; r[19]=1; r[20]=5; r[21]=5; r[22]=0; r[23]=0;
124
+ r[24]=2; r[25]=7; r[26]=0; r[27]=0; r[28]=9; r[29]=0; r[30]=0; r[31]=8;
125
+ r[32]=0; r[33]=0; r[34]=7; r[35]=7; r[36]=0; r[37]=0; r[38]=3; r[39]=3;
126
+ r[40]=3; r[41]=3; r[42]=3; r[43]=3; r[44]=3; r[45]=3; r[46]=3; r[47]=3;
127
+ r[48]=3; r[49]=3; r[50]=3; r[51]=3; r[52]=3; r[53]=3; r[54]=3; r[55]=3;
128
+ r[56]=1; r[57]=0;
129
+ }
130
+
131
+ private static byte[] create__http_parser_single_lengths( )
132
+ {
133
+ byte[] r = new byte[58];
134
+ init__http_parser_single_lengths_0( r );
135
+ return r;
136
+ }
137
+
138
+ private static final byte _http_parser_single_lengths[] = create__http_parser_single_lengths();
139
+
140
+
141
+ private static void init__http_parser_range_lengths_0( byte[] r )
142
+ {
143
+ r[0]=0; r[1]=3; r[2]=3; r[3]=3; r[4]=0; r[5]=0; r[6]=0; r[7]=0;
144
+ r[8]=0; r[9]=0; r[10]=1; r[11]=1; r[12]=1; r[13]=1; r[14]=0; r[15]=6;
145
+ r[16]=0; r[17]=6; r[18]=0; r[19]=0; r[20]=2; r[21]=2; r[22]=3; r[23]=3;
146
+ r[24]=4; r[25]=1; r[26]=3; r[27]=3; r[28]=1; r[29]=3; r[30]=3; r[31]=1;
147
+ r[32]=3; r[33]=3; r[34]=1; r[35]=1; r[36]=3; r[37]=3; r[38]=3; r[39]=3;
148
+ r[40]=3; r[41]=3; r[42]=3; r[43]=3; r[44]=3; r[45]=3; r[46]=3; r[47]=3;
149
+ r[48]=3; r[49]=3; r[50]=3; r[51]=3; r[52]=3; r[53]=3; r[54]=3; r[55]=3;
150
+ r[56]=0; r[57]=0;
151
+ }
152
+
153
+ private static byte[] create__http_parser_range_lengths( )
154
+ {
155
+ byte[] r = new byte[58];
156
+ init__http_parser_range_lengths_0( r );
157
+ return r;
158
+ }
159
+
160
+ private static final byte _http_parser_range_lengths[] = create__http_parser_range_lengths();
161
+
162
+
163
+ private static void init__http_parser_index_offsets_0( short[] r )
164
+ {
165
+ r[0]=0; r[1]=0; r[2]=6; r[3]=13; r[4]=21; r[5]=24; r[6]=26; r[7]=28;
166
+ r[8]=30; r[9]=32; r[10]=34; r[11]=36; r[12]=39; r[13]=41; r[14]=44; r[15]=46;
167
+ r[16]=57; r[17]=59; r[18]=70; r[19]=73; r[20]=75; r[21]=83; r[22]=91; r[23]=95;
168
+ r[24]=99; r[25]=106; r[26]=115; r[27]=119; r[28]=123; r[29]=134; r[30]=138; r[31]=142;
169
+ r[32]=152; r[33]=156; r[34]=160; r[35]=169; r[36]=178; r[37]=182; r[38]=186; r[39]=193;
170
+ r[40]=200; r[41]=207; r[42]=214; r[43]=221; r[44]=228; r[45]=235; r[46]=242; r[47]=249;
171
+ r[48]=256; r[49]=263; r[50]=270; r[51]=277; r[52]=284; r[53]=291; r[54]=298; r[55]=305;
172
+ r[56]=312; r[57]=314;
173
+ }
174
+
175
+ private static short[] create__http_parser_index_offsets( )
176
+ {
177
+ short[] r = new short[58];
178
+ init__http_parser_index_offsets_0( r );
179
+ return r;
180
+ }
181
+
182
+ private static final short _http_parser_index_offsets[] = create__http_parser_index_offsets();
183
+
184
+
185
+ private static void init__http_parser_indicies_0( byte[] r )
186
+ {
187
+ r[0]=0; r[1]=0; r[2]=0; r[3]=0; r[4]=0; r[5]=1; r[6]=2; r[7]=3;
188
+ r[8]=3; r[9]=3; r[10]=3; r[11]=3; r[12]=1; r[13]=4; r[14]=5; r[15]=6;
189
+ r[16]=7; r[17]=5; r[18]=5; r[19]=5; r[20]=1; r[21]=8; r[22]=9; r[23]=1;
190
+ r[24]=10; r[25]=1; r[26]=11; r[27]=1; r[28]=12; r[29]=1; r[30]=13; r[31]=1;
191
+ r[32]=14; r[33]=1; r[34]=15; r[35]=1; r[36]=16; r[37]=15; r[38]=1; r[39]=17;
192
+ r[40]=1; r[41]=18; r[42]=17; r[43]=1; r[44]=19; r[45]=1; r[46]=20; r[47]=21;
193
+ r[48]=21; r[49]=21; r[50]=21; r[51]=21; r[52]=21; r[53]=21; r[54]=21; r[55]=21;
194
+ r[56]=1; r[57]=22; r[58]=1; r[59]=23; r[60]=24; r[61]=23; r[62]=23; r[63]=23;
195
+ r[64]=23; r[65]=23; r[66]=23; r[67]=23; r[68]=23; r[69]=1; r[70]=26; r[71]=27;
196
+ r[72]=25; r[73]=26; r[74]=28; r[75]=29; r[76]=31; r[77]=1; r[78]=1; r[79]=1;
197
+ r[80]=1; r[81]=1; r[82]=30; r[83]=29; r[84]=33; r[85]=1; r[86]=1; r[87]=1;
198
+ r[88]=1; r[89]=1; r[90]=32; r[91]=34; r[92]=34; r[93]=34; r[94]=1; r[95]=32;
199
+ r[96]=32; r[97]=32; r[98]=1; r[99]=35; r[100]=36; r[101]=35; r[102]=35; r[103]=35;
200
+ r[104]=35; r[105]=1; r[106]=8; r[107]=1; r[108]=9; r[109]=37; r[110]=1; r[111]=1;
201
+ r[112]=1; r[113]=1; r[114]=36; r[115]=38; r[116]=38; r[117]=38; r[118]=1; r[119]=36;
202
+ r[120]=36; r[121]=36; r[122]=1; r[123]=39; r[124]=1; r[125]=41; r[126]=42; r[127]=43;
203
+ r[128]=1; r[129]=1; r[130]=44; r[131]=1; r[132]=1; r[133]=40; r[134]=45; r[135]=45;
204
+ r[136]=45; r[137]=1; r[138]=40; r[139]=40; r[140]=40; r[141]=1; r[142]=8; r[143]=1;
205
+ r[144]=9; r[145]=47; r[146]=1; r[147]=1; r[148]=48; r[149]=1; r[150]=1; r[151]=46;
206
+ r[152]=49; r[153]=49; r[154]=49; r[155]=1; r[156]=46; r[157]=46; r[158]=46; r[159]=1;
207
+ r[160]=50; r[161]=1; r[162]=52; r[163]=53; r[164]=1; r[165]=1; r[166]=1; r[167]=1;
208
+ r[168]=51; r[169]=54; r[170]=1; r[171]=56; r[172]=57; r[173]=1; r[174]=1; r[175]=1;
209
+ r[176]=1; r[177]=55; r[178]=58; r[179]=58; r[180]=58; r[181]=1; r[182]=55; r[183]=55;
210
+ r[184]=55; r[185]=1; r[186]=2; r[187]=59; r[188]=59; r[189]=59; r[190]=59; r[191]=59;
211
+ r[192]=1; r[193]=2; r[194]=60; r[195]=60; r[196]=60; r[197]=60; r[198]=60; r[199]=1;
212
+ r[200]=2; r[201]=61; r[202]=61; r[203]=61; r[204]=61; r[205]=61; r[206]=1; r[207]=2;
213
+ r[208]=62; r[209]=62; r[210]=62; r[211]=62; r[212]=62; r[213]=1; r[214]=2; r[215]=63;
214
+ r[216]=63; r[217]=63; r[218]=63; r[219]=63; r[220]=1; r[221]=2; r[222]=64; r[223]=64;
215
+ r[224]=64; r[225]=64; r[226]=64; r[227]=1; r[228]=2; r[229]=65; r[230]=65; r[231]=65;
216
+ r[232]=65; r[233]=65; r[234]=1; r[235]=2; r[236]=66; r[237]=66; r[238]=66; r[239]=66;
217
+ r[240]=66; r[241]=1; r[242]=2; r[243]=67; r[244]=67; r[245]=67; r[246]=67; r[247]=67;
218
+ r[248]=1; r[249]=2; r[250]=68; r[251]=68; r[252]=68; r[253]=68; r[254]=68; r[255]=1;
219
+ r[256]=2; r[257]=69; r[258]=69; r[259]=69; r[260]=69; r[261]=69; r[262]=1; r[263]=2;
220
+ r[264]=70; r[265]=70; r[266]=70; r[267]=70; r[268]=70; r[269]=1; r[270]=2; r[271]=71;
221
+ r[272]=71; r[273]=71; r[274]=71; r[275]=71; r[276]=1; r[277]=2; r[278]=72; r[279]=72;
222
+ r[280]=72; r[281]=72; r[282]=72; r[283]=1; r[284]=2; r[285]=73; r[286]=73; r[287]=73;
223
+ r[288]=73; r[289]=73; r[290]=1; r[291]=2; r[292]=74; r[293]=74; r[294]=74; r[295]=74;
224
+ r[296]=74; r[297]=1; r[298]=2; r[299]=75; r[300]=75; r[301]=75; r[302]=75; r[303]=75;
225
+ r[304]=1; r[305]=2; r[306]=76; r[307]=76; r[308]=76; r[309]=76; r[310]=76; r[311]=1;
226
+ r[312]=2; r[313]=1; r[314]=1; r[315]=0;
227
+ }
228
+
229
+ private static byte[] create__http_parser_indicies( )
230
+ {
231
+ byte[] r = new byte[316];
232
+ init__http_parser_indicies_0( r );
233
+ return r;
234
+ }
235
+
236
+ private static final byte _http_parser_indicies[] = create__http_parser_indicies();
237
+
238
+
239
+ private static void init__http_parser_trans_targs_wi_0( byte[] r )
240
+ {
241
+ r[0]=2; r[1]=0; r[2]=3; r[3]=38; r[4]=4; r[5]=24; r[6]=28; r[7]=25;
242
+ r[8]=5; r[9]=20; r[10]=6; r[11]=7; r[12]=8; r[13]=9; r[14]=10; r[15]=11;
243
+ r[16]=12; r[17]=13; r[18]=14; r[19]=15; r[20]=16; r[21]=17; r[22]=57; r[23]=17;
244
+ r[24]=18; r[25]=19; r[26]=14; r[27]=18; r[28]=19; r[29]=5; r[30]=21; r[31]=22;
245
+ r[32]=21; r[33]=22; r[34]=23; r[35]=24; r[36]=25; r[37]=26; r[38]=27; r[39]=5;
246
+ r[40]=28; r[41]=20; r[42]=29; r[43]=31; r[44]=34; r[45]=30; r[46]=31; r[47]=32;
247
+ r[48]=34; r[49]=33; r[50]=5; r[51]=35; r[52]=20; r[53]=36; r[54]=5; r[55]=35;
248
+ r[56]=20; r[57]=36; r[58]=37; r[59]=39; r[60]=40; r[61]=41; r[62]=42; r[63]=43;
249
+ r[64]=44; r[65]=45; r[66]=46; r[67]=47; r[68]=48; r[69]=49; r[70]=50; r[71]=51;
250
+ r[72]=52; r[73]=53; r[74]=54; r[75]=55; r[76]=56;
251
+ }
252
+
253
+ private static byte[] create__http_parser_trans_targs_wi( )
254
+ {
255
+ byte[] r = new byte[77];
256
+ init__http_parser_trans_targs_wi_0( r );
257
+ return r;
258
+ }
259
+
260
+ private static final byte _http_parser_trans_targs_wi[] = create__http_parser_trans_targs_wi();
261
+
262
+
263
+ private static void init__http_parser_trans_actions_wi_0( byte[] r )
264
+ {
265
+ r[0]=1; r[1]=0; r[2]=11; r[3]=0; r[4]=1; r[5]=1; r[6]=1; r[7]=1;
266
+ r[8]=13; r[9]=13; r[10]=1; r[11]=0; r[12]=0; r[13]=0; r[14]=0; r[15]=0;
267
+ r[16]=0; r[17]=0; r[18]=19; r[19]=0; r[20]=0; r[21]=3; r[22]=23; r[23]=0;
268
+ r[24]=5; r[25]=7; r[26]=9; r[27]=7; r[28]=0; r[29]=15; r[30]=1; r[31]=1;
269
+ r[32]=0; r[33]=0; r[34]=0; r[35]=0; r[36]=0; r[37]=0; r[38]=0; r[39]=28;
270
+ r[40]=0; r[41]=28; r[42]=0; r[43]=21; r[44]=21; r[45]=0; r[46]=0; r[47]=0;
271
+ r[48]=0; r[49]=0; r[50]=31; r[51]=17; r[52]=31; r[53]=17; r[54]=25; r[55]=0;
272
+ r[56]=25; r[57]=0; r[58]=0; r[59]=0; r[60]=0; r[61]=0; r[62]=0; r[63]=0;
273
+ r[64]=0; r[65]=0; r[66]=0; r[67]=0; r[68]=0; r[69]=0; r[70]=0; r[71]=0;
274
+ r[72]=0; r[73]=0; r[74]=0; r[75]=0; r[76]=0;
275
+ }
276
+
277
+ private static byte[] create__http_parser_trans_actions_wi( )
278
+ {
279
+ byte[] r = new byte[77];
280
+ init__http_parser_trans_actions_wi_0( r );
281
+ return r;
282
+ }
283
+
284
+ private static final byte _http_parser_trans_actions_wi[] = create__http_parser_trans_actions_wi();
285
+
286
+
287
+ static final int http_parser_start = 1;
288
+ static final int http_parser_first_final = 57;
289
+ static final int http_parser_error = 0;
290
+
291
+ static final int http_parser_en_main = 1;
292
+
293
+ // line 68 "http11_parser.java.rl"
294
+
295
+ public static interface ElementCB {
296
+ public void call(Object data, int at, int length);
297
+ }
298
+
299
+ public static interface FieldCB {
300
+ public void call(Object data, int field, int flen, int value, int vlen);
301
+ }
302
+
303
+ public static class HttpParser {
304
+ int cs;
305
+ int body_start;
306
+ int content_len;
307
+ int nread;
308
+ int mark;
309
+ int field_start;
310
+ int field_len;
311
+ int query_start;
312
+
313
+ Object data;
314
+ ByteList buffer;
315
+
316
+ public FieldCB http_field;
317
+ public ElementCB request_method;
318
+ public ElementCB request_uri;
319
+ public ElementCB fragment;
320
+ public ElementCB request_path;
321
+ public ElementCB query_string;
322
+ public ElementCB http_version;
323
+ public ElementCB header_done;
324
+
325
+ public void init() {
326
+ cs = 0;
327
+
328
+
329
+ // line 330 "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
330
+ {
331
+ cs = http_parser_start;
332
+ }
333
+ // line 103 "http11_parser.java.rl"
334
+
335
+ body_start = 0;
336
+ content_len = 0;
337
+ mark = 0;
338
+ nread = 0;
339
+ field_len = 0;
340
+ field_start = 0;
341
+ }
342
+ }
343
+
344
+ public final HttpParser parser = new HttpParser();
345
+
346
+ public int execute(ByteList buffer, int off) {
347
+ int p, pe;
348
+ int cs = parser.cs;
349
+ int len = buffer.realSize;
350
+ assert off<=len : "offset past end of buffer";
351
+
352
+ p = off;
353
+ pe = len;
354
+ byte[] data = buffer.bytes;
355
+ parser.buffer = buffer;
356
+
357
+
358
+ // line 359 "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
359
+ {
360
+ int _klen;
361
+ int _trans;
362
+ int _acts;
363
+ int _nacts;
364
+ int _keys;
365
+
366
+ if ( p != pe ) {
367
+ if ( cs != 0 ) {
368
+ _resume: while ( true ) {
369
+ _again: do {
370
+ _match: do {
371
+ _keys = _http_parser_key_offsets[cs];
372
+ _trans = _http_parser_index_offsets[cs];
373
+ _klen = _http_parser_single_lengths[cs];
374
+ if ( _klen > 0 ) {
375
+ int _lower = _keys;
376
+ int _mid;
377
+ int _upper = _keys + _klen - 1;
378
+ while (true) {
379
+ if ( _upper < _lower )
380
+ break;
381
+
382
+ _mid = _lower + ((_upper-_lower) >> 1);
383
+ if ( data[p] < _http_parser_trans_keys[_mid] )
384
+ _upper = _mid - 1;
385
+ else if ( data[p] > _http_parser_trans_keys[_mid] )
386
+ _lower = _mid + 1;
387
+ else {
388
+ _trans += (_mid - _keys);
389
+ break _match;
390
+ }
391
+ }
392
+ _keys += _klen;
393
+ _trans += _klen;
394
+ }
395
+
396
+ _klen = _http_parser_range_lengths[cs];
397
+ if ( _klen > 0 ) {
398
+ int _lower = _keys;
399
+ int _mid;
400
+ int _upper = _keys + (_klen<<1) - 2;
401
+ while (true) {
402
+ if ( _upper < _lower )
403
+ break;
404
+
405
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
406
+ if ( data[p] < _http_parser_trans_keys[_mid] )
407
+ _upper = _mid - 2;
408
+ else if ( data[p] > _http_parser_trans_keys[_mid+1] )
409
+ _lower = _mid + 2;
410
+ else {
411
+ _trans += ((_mid - _keys)>>1);
412
+ break _match;
413
+ }
414
+ }
415
+ _trans += _klen;
416
+ }
417
+ } while (false);
418
+
419
+ _trans = _http_parser_indicies[_trans];
420
+ cs = _http_parser_trans_targs_wi[_trans];
421
+
422
+ if ( _http_parser_trans_actions_wi[_trans] == 0 )
423
+ break _again;
424
+
425
+ _acts = _http_parser_trans_actions_wi[_trans];
426
+ _nacts = (int) _http_parser_actions[_acts++];
427
+ while ( _nacts-- > 0 )
428
+ {
429
+ switch ( _http_parser_actions[_acts++] )
430
+ {
431
+ case 0:
432
+ // line 13 "http11_parser.java.rl"
433
+ {parser.mark = p; }
434
+ break;
435
+ case 1:
436
+ // line 15 "http11_parser.java.rl"
437
+ { parser.field_start = p; }
438
+ break;
439
+ case 2:
440
+ // line 16 "http11_parser.java.rl"
441
+ {
442
+ parser.field_len = p-parser.field_start;
443
+ }
444
+ break;
445
+ case 3:
446
+ // line 20 "http11_parser.java.rl"
447
+ { parser.mark = p; }
448
+ break;
449
+ case 4:
450
+ // line 21 "http11_parser.java.rl"
451
+ {
452
+ if(parser.http_field != null) {
453
+ parser.http_field.call(parser.data, parser.field_start, parser.field_len, parser.mark, p-parser.mark);
454
+ }
455
+ }
456
+ break;
457
+ case 5:
458
+ // line 26 "http11_parser.java.rl"
459
+ {
460
+ if(parser.request_method != null)
461
+ parser.request_method.call(parser.data, parser.mark, p-parser.mark);
462
+ }
463
+ break;
464
+ case 6:
465
+ // line 30 "http11_parser.java.rl"
466
+ {
467
+ if(parser.request_uri != null)
468
+ parser.request_uri.call(parser.data, parser.mark, p-parser.mark);
469
+ }
470
+ break;
471
+ case 7:
472
+ // line 34 "http11_parser.java.rl"
473
+ {
474
+ if(parser.fragment != null)
475
+ parser.fragment.call(parser.data, parser.mark, p-parser.mark);
476
+ }
477
+ break;
478
+ case 8:
479
+ // line 39 "http11_parser.java.rl"
480
+ {parser.query_start = p; }
481
+ break;
482
+ case 9:
483
+ // line 40 "http11_parser.java.rl"
484
+ {
485
+ if(parser.query_string != null)
486
+ parser.query_string.call(parser.data, parser.query_start, p-parser.query_start);
487
+ }
488
+ break;
489
+ case 10:
490
+ // line 45 "http11_parser.java.rl"
491
+ {
492
+ if(parser.http_version != null)
493
+ parser.http_version.call(parser.data, parser.mark, p-parser.mark);
494
+ }
495
+ break;
496
+ case 11:
497
+ // line 50 "http11_parser.java.rl"
498
+ {
499
+ if(parser.request_path != null)
500
+ parser.request_path.call(parser.data, parser.mark, p-parser.mark);
501
+ }
502
+ break;
503
+ case 12:
504
+ // line 55 "http11_parser.java.rl"
505
+ {
506
+ parser.body_start = p + 1;
507
+ if(parser.header_done != null)
508
+ parser.header_done.call(parser.data, p + 1, pe - p - 1);
509
+ if (true) break _resume;
510
+ }
511
+ break;
512
+ // line 513 "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
513
+ }
514
+ }
515
+
516
+ } while (false);
517
+ if ( cs == 0 )
518
+ break _resume;
519
+ if ( ++p == pe )
520
+ break _resume;
521
+ }
522
+ } }
523
+ }
524
+ // line 127 "http11_parser.java.rl"
525
+
526
+ parser.cs = cs;
527
+ parser.nread += (p - off);
528
+
529
+ assert p <= pe : "buffer overflow after parsing execute";
530
+ assert parser.nread <= len : "nread longer than length";
531
+ assert parser.body_start <= len : "body starts after buffer end";
532
+ assert parser.mark < len : "mark is after buffer end";
533
+ assert parser.field_len <= len : "field has length longer than whole buffer";
534
+ assert parser.field_start < len : "field starts after buffer end";
535
+
536
+ if(parser.body_start>0) {
537
+ /* final \r\n combo encountered so stop right here */
538
+
539
+ // line 540 "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
540
+ // line 141 "http11_parser.java.rl"
541
+ parser.nread++;
542
+ }
543
+
544
+ return parser.nread;
545
+ }
546
+
547
+ public int finish() {
548
+ int cs = parser.cs;
549
+
550
+
551
+ // line 552 "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java"
552
+ // line 151 "http11_parser.java.rl"
553
+
554
+ parser.cs = cs;
555
+
556
+ if(has_error()) {
557
+ return -1;
558
+ } else if(is_finished()) {
559
+ return 1;
560
+ } else {
561
+ return 0;
562
+ }
563
+ }
564
+
565
+ public boolean has_error() {
566
+ return parser.cs == http_parser_error;
567
+ }
568
+
569
+ public boolean is_finished() {
570
+ return parser.cs == http_parser_first_final;
571
+ }
572
+ }