puma-simon 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +7 -0
  2. data/.github/issue_template.md +20 -0
  3. data/.gitignore +18 -0
  4. data/.hoeignore +12 -0
  5. data/.travis.yml +29 -0
  6. data/DEPLOYMENT.md +91 -0
  7. data/Gemfile +12 -0
  8. data/History.md +1254 -0
  9. data/LICENSE +26 -0
  10. data/Manifest.txt +78 -0
  11. data/README.md +353 -0
  12. data/Rakefile +158 -0
  13. data/Release.md +9 -0
  14. data/bin/puma +10 -0
  15. data/bin/puma-wild +31 -0
  16. data/bin/pumactl +12 -0
  17. data/docs/nginx.md +80 -0
  18. data/docs/signals.md +43 -0
  19. data/docs/systemd.md +197 -0
  20. data/examples/CA/cacert.pem +23 -0
  21. data/examples/CA/newcerts/cert_1.pem +19 -0
  22. data/examples/CA/newcerts/cert_2.pem +19 -0
  23. data/examples/CA/private/cakeypair.pem +30 -0
  24. data/examples/CA/serial +1 -0
  25. data/examples/config.rb +200 -0
  26. data/examples/plugins/redis_stop_puma.rb +46 -0
  27. data/examples/puma/cert_puma.pem +19 -0
  28. data/examples/puma/client-certs/ca.crt +19 -0
  29. data/examples/puma/client-certs/ca.key +27 -0
  30. data/examples/puma/client-certs/client.crt +19 -0
  31. data/examples/puma/client-certs/client.key +27 -0
  32. data/examples/puma/client-certs/client_expired.crt +19 -0
  33. data/examples/puma/client-certs/client_expired.key +27 -0
  34. data/examples/puma/client-certs/client_unknown.crt +19 -0
  35. data/examples/puma/client-certs/client_unknown.key +27 -0
  36. data/examples/puma/client-certs/generate.rb +78 -0
  37. data/examples/puma/client-certs/keystore.jks +0 -0
  38. data/examples/puma/client-certs/server.crt +19 -0
  39. data/examples/puma/client-certs/server.key +27 -0
  40. data/examples/puma/client-certs/server.p12 +0 -0
  41. data/examples/puma/client-certs/unknown_ca.crt +19 -0
  42. data/examples/puma/client-certs/unknown_ca.key +27 -0
  43. data/examples/puma/csr_puma.pem +11 -0
  44. data/examples/puma/keystore.jks +0 -0
  45. data/examples/puma/puma_keypair.pem +15 -0
  46. data/examples/qc_config.rb +13 -0
  47. data/ext/puma_http11/PumaHttp11Service.java +17 -0
  48. data/ext/puma_http11/ext_help.h +15 -0
  49. data/ext/puma_http11/extconf.rb +15 -0
  50. data/ext/puma_http11/http11_parser.c +1069 -0
  51. data/ext/puma_http11/http11_parser.h +65 -0
  52. data/ext/puma_http11/http11_parser.java.rl +161 -0
  53. data/ext/puma_http11/http11_parser.rl +147 -0
  54. data/ext/puma_http11/http11_parser_common.rl +54 -0
  55. data/ext/puma_http11/io_buffer.c +155 -0
  56. data/ext/puma_http11/mini_ssl.c +457 -0
  57. data/ext/puma_http11/org/jruby/puma/Http11.java +234 -0
  58. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +473 -0
  59. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +339 -0
  60. data/ext/puma_http11/puma_http11.c +500 -0
  61. data/gemfiles/2.1-Gemfile +12 -0
  62. data/lib/puma.rb +15 -0
  63. data/lib/puma/accept_nonblock.rb +23 -0
  64. data/lib/puma/app/status.rb +66 -0
  65. data/lib/puma/binder.rb +402 -0
  66. data/lib/puma/cli.rb +220 -0
  67. data/lib/puma/client.rb +434 -0
  68. data/lib/puma/cluster.rb +510 -0
  69. data/lib/puma/commonlogger.rb +106 -0
  70. data/lib/puma/compat.rb +14 -0
  71. data/lib/puma/configuration.rb +364 -0
  72. data/lib/puma/const.rb +224 -0
  73. data/lib/puma/control_cli.rb +259 -0
  74. data/lib/puma/convenient.rb +23 -0
  75. data/lib/puma/daemon_ext.rb +31 -0
  76. data/lib/puma/delegation.rb +11 -0
  77. data/lib/puma/detect.rb +13 -0
  78. data/lib/puma/dsl.rb +486 -0
  79. data/lib/puma/events.rb +152 -0
  80. data/lib/puma/io_buffer.rb +7 -0
  81. data/lib/puma/java_io_buffer.rb +45 -0
  82. data/lib/puma/jruby_restart.rb +83 -0
  83. data/lib/puma/launcher.rb +410 -0
  84. data/lib/puma/minissl.rb +221 -0
  85. data/lib/puma/null_io.rb +42 -0
  86. data/lib/puma/plugin.rb +115 -0
  87. data/lib/puma/plugin/tmp_restart.rb +35 -0
  88. data/lib/puma/rack/backports/uri/common_193.rb +33 -0
  89. data/lib/puma/rack/builder.rb +298 -0
  90. data/lib/puma/rack/urlmap.rb +91 -0
  91. data/lib/puma/rack_default.rb +7 -0
  92. data/lib/puma/reactor.rb +210 -0
  93. data/lib/puma/runner.rb +171 -0
  94. data/lib/puma/server.rb +949 -0
  95. data/lib/puma/single.rb +112 -0
  96. data/lib/puma/state_file.rb +29 -0
  97. data/lib/puma/tcp_logger.rb +39 -0
  98. data/lib/puma/thread_pool.rb +297 -0
  99. data/lib/puma/util.rb +128 -0
  100. data/lib/rack/handler/puma.rb +78 -0
  101. data/puma.gemspec +52 -0
  102. data/test/ab_rs.rb +22 -0
  103. data/test/config.rb +2 -0
  104. data/test/config/app.rb +9 -0
  105. data/test/config/plugin.rb +1 -0
  106. data/test/config/settings.rb +2 -0
  107. data/test/config/state_file_testing_config.rb +14 -0
  108. data/test/hello-bind.ru +2 -0
  109. data/test/hello-delay.ru +3 -0
  110. data/test/hello-map.ru +3 -0
  111. data/test/hello-post.ru +4 -0
  112. data/test/hello-stuck.ru +1 -0
  113. data/test/hello-tcp.ru +5 -0
  114. data/test/hello.ru +1 -0
  115. data/test/hijack.ru +6 -0
  116. data/test/hijack2.ru +5 -0
  117. data/test/lobster.ru +4 -0
  118. data/test/shell/run.sh +24 -0
  119. data/test/shell/t1.rb +19 -0
  120. data/test/shell/t1_conf.rb +3 -0
  121. data/test/shell/t2.rb +17 -0
  122. data/test/shell/t2_conf.rb +6 -0
  123. data/test/shell/t3.rb +25 -0
  124. data/test/shell/t3_conf.rb +5 -0
  125. data/test/slow.ru +4 -0
  126. data/test/ssl_config.rb +4 -0
  127. data/test/test_app_status.rb +93 -0
  128. data/test/test_binder.rb +31 -0
  129. data/test/test_cli.rb +209 -0
  130. data/test/test_config.rb +95 -0
  131. data/test/test_events.rb +161 -0
  132. data/test/test_helper.rb +50 -0
  133. data/test/test_http10.rb +27 -0
  134. data/test/test_http11.rb +186 -0
  135. data/test/test_integration.rb +247 -0
  136. data/test/test_iobuffer.rb +39 -0
  137. data/test/test_minissl.rb +29 -0
  138. data/test/test_null_io.rb +49 -0
  139. data/test/test_persistent.rb +245 -0
  140. data/test/test_puma_server.rb +626 -0
  141. data/test/test_puma_server_ssl.rb +222 -0
  142. data/test/test_rack_handler.rb +57 -0
  143. data/test/test_rack_server.rb +138 -0
  144. data/test/test_tcp_logger.rb +39 -0
  145. data/test/test_tcp_rack.rb +36 -0
  146. data/test/test_thread_pool.rb +250 -0
  147. data/test/test_unix_socket.rb +35 -0
  148. data/test/test_web_server.rb +88 -0
  149. data/tools/jungle/README.md +9 -0
  150. data/tools/jungle/init.d/README.md +59 -0
  151. data/tools/jungle/init.d/puma +421 -0
  152. data/tools/jungle/init.d/run-puma +18 -0
  153. data/tools/jungle/upstart/README.md +61 -0
  154. data/tools/jungle/upstart/puma-manager.conf +31 -0
  155. data/tools/jungle/upstart/puma.conf +69 -0
  156. data/tools/trickletest.rb +45 -0
  157. metadata +297 -0
@@ -0,0 +1,19 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDCTCCAfGgAwIBAgIBBDANBgkqhkiG9w0BAQUFADA4MRMwEQYKCZImiZPyLGQB
3
+ GRYDbmV0MRQwEgYKCZImiZPyLGQBGRYEcHVtYTELMAkGA1UEAwwCY2EwHhcNMTQw
4
+ MjAyMjAwODI3WhcNMTQwODA0MDgwODI3WjBEMRMwEQYKCZImiZPyLGQBGRYDbmV0
5
+ MRQwEgYKCZImiZPyLGQBGRYEcHVtYTEXMBUGA1UEAwwOY2xpZW50LWV4cGlyZWQw
6
+ ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZQSVfI4KNwus/+9gE9Rww
7
+ +cehxzw80fNi4tmruSApitTIk1u1r1rYVexkBkVTtl6Fg/aNAAdsI4aATan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DGO+NwMa8xaaPvn/k6bg5avx2
25
+ 8by3BSWhc/YEK7qtVcO1sDr7m9dHtqxrk8+2CC+ZI6wfc359xB9uImrbs9Jqz3VZ
26
+ +Ji2VOirgm/oZNzhpi2l7yG2atXg0PqLMkS/ft6gWyAjzy/Q8WDSjQ==
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,78 @@
1
+ require "bundler/setup"
2
+ require "puma"
3
+ require "puma/minissl"
4
+
5
+ case ARGV[0]
6
+
7
+ when "s"
8
+
9
+ app = proc {|env|
10
+ p env['puma.peercert']
11
+ [200, {}, [ env['puma.peercert'] ]]
12
+ }
13
+ events = Puma::Events.new($stdout, $stderr)
14
+ server = Puma::Server.new(app, events)
15
+
16
+ context = Puma::MiniSSL::Context.new
17
+ context.key = "certs/server.key"
18
+ context.cert = "certs/server.crt"
19
+ context.ca = "certs/ca.crt"
20
+ #context.verify_mode = Puma::MiniSSL::VERIFY_NONE
21
+ #context.verify_mode = Puma::MiniSSL::VERIFY_PEER
22
+ context.verify_mode = Puma::MiniSSL::VERIFY_PEER | Puma::MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT
23
+
24
+ server.add_ssl_listener("127.0.0.1", 4000, context)
25
+
26
+ server.run
27
+ sleep
28
+ #server.stop(true)
29
+
30
+ when "g"
31
+
32
+ def issue_cert(dn, key, serial, not_before, not_after, extensions, issuer, issuer_key, digest)
33
+ cert = OpenSSL::X509::Certificate.new
34
+ issuer = cert unless issuer
35
+ issuer_key = key unless issuer_key
36
+ cert.version = 2
37
+ cert.serial = serial
38
+ cert.subject = dn
39
+ cert.issuer = issuer.subject
40
+ cert.public_key = key.public_key
41
+ cert.not_before = not_before
42
+ cert.not_after = not_after
43
+ ef = OpenSSL::X509::ExtensionFactory.new
44
+ ef.subject_certificate = cert
45
+ ef.issuer_certificate = issuer
46
+ extensions.each{|oid, value, critical|
47
+ cert.add_extension(ef.create_extension(oid, value, critical))
48
+ }
49
+ cert.sign(issuer_key, digest)
50
+ cert
51
+ end
52
+
53
+ @ca_key = OpenSSL::PKey::RSA.generate(2048)
54
+ @svr_key = OpenSSL::PKey::RSA.generate(2048)
55
+ @cli_key = OpenSSL::PKey::RSA.generate(2048)
56
+ @ca = OpenSSL::X509::Name.parse("/DC=net/DC=client-cbhq/CN=CA")
57
+ @svr = OpenSSL::X509::Name.parse("/DC=net/DC=client-cbhq/CN=localhost")
58
+ @cli = OpenSSL::X509::Name.parse("/DC=net/DC=client-cbhq/CN=localhost")
59
+ now = Time.at(Time.now.to_i)
60
+ ca_exts = [
61
+ ["basicConstraints","CA:TRUE",true],
62
+ ["keyUsage","cRLSign,keyCertSign",true],
63
+ ]
64
+ ee_exts = [
65
+ #["keyUsage","keyEncipherment,digitalSignature",true],
66
+ ["keyUsage","keyEncipherment,dataEncipherment,digitalSignature",true],
67
+ ]
68
+ @ca_cert = issue_cert(@ca, @ca_key, 1, now, now+3600_000, ca_exts, nil, nil, OpenSSL::Digest::SHA1.new)
69
+ @svr_cert = issue_cert(@svr, @svr_key, 2, now, now+1800_000, ee_exts, @ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
70
+ @cli_cert = issue_cert(@cli, @cli_key, 3, now, now+1800_000, ee_exts, @ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
71
+
72
+ File.open("ca.crt","wb"){|f| f.print @ca_cert.to_pem }
73
+ File.open("ca.key","wb"){|f| f.print @ca_key.to_pem }
74
+ File.open("server.crt","wb"){|f| f.print @svr_cert.to_pem }
75
+ File.open("server.key","wb"){|f| f.print @svr_key.to_pem }
76
+ File.open("client1.crt","wb"){|f| f.print @cli_cert.to_pem }
77
+ File.open("client1.key","wb"){|f| f.print @cli_key.to_pem }
78
+ end
@@ -0,0 +1,19 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDBjCCAe6gAwIBAgIBAjANBgkqhkiG9w0BAQUFADA4MRMwEQYKCZImiZPyLGQB
3
+ GRYDbmV0MRQwEgYKCZImiZPyLGQBGRYEcHVtYTEL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eG
10
+ hDJxQlIHhZa7Xvw=
11
+ -----END CERTIFICATE REQUEST-----
@@ -0,0 +1,15 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIICXQIBAAKBgQCvF80yn6D+kqGwMSQHcpHUwCRt+c39Qoy99fCWdenPthfUscec
3
+ y62Ij8+rKYCnoE9y766a5baowdDKqq3IBOZn2Ove3zfueGbHAbWehFopG2xySf0U
4
+ PjdmWk+DRDlCeFLig6xfAnOKWo+N0MViso3dNK8gYzb6FWqlWgZgAcMpswIDAQAB
5
+ AoGAHv/UyZivdULas4oPue3T2dnm2T239ZXZuywW21ym96pij7ql/6Gj6KClgMVJ
6
+ TOQ6DLxYqn3vF/OwlqEfQWF0tTUYY+xNbEDE1YsbrS5/FSzbaEYYOHzRl/vMmnsf
7
+ aNgYaSjOIecin7L71Wzq0piMIxg8BLb6IVECBku9EQNzxuECQQDZsbRgg1XZGj+r
8
+ XAu/qXTNKQ/r7k+iPN5bXON6ApBomG+4Q7VVITL3tkGzLOphRZ37Q28FrN4B4gtC
9
+ Xb9il5lDAkEAzecTSopPi2VdcME4WWmwn1rbTp/jJNt4dGZLsNfj9RejVDd32i/L
10
+ P7wCpoPDaaVcoF2HgvCs39qatyVg6ecu0QJBALN4q+q9nDMGTuNpWU5D2EWjyrqJ
11
+ mCF66R6NcASQxJlWwxQ4zfBHFIvgOD4Nk5VqHZqet5MIN2d6AipOu4/+x50CQHDp
12
+ jf+rd1GHBcXGf8MwnUXWCjvEnEhi/lw+mLVivsRx8QRG4rfIy9monX949Flj8DaU
13
+ 87IPj422kG9s1QeP2nECQQCkg+RUcoQm7SiM8OXuXNeHQlvQNp65geFRxzKAXxT/
14
+ +1Mbtwnd3AXXZBekFDDpE9U3ZQjahoe7oc1oUBuw5hXL
15
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,13 @@
1
+ full_hostname = `hostname`.strip
2
+ domainname = full_hostname.split('.')[1..-1].join('.')
3
+ hostname = full_hostname.split('.')[0]
4
+
5
+ CA[:hostname] = hostname
6
+ CA[:domainname] = domainname
7
+ CA[:CA_dir] = File.join Dir.pwd, "CA"
8
+ CA[:password] = 'puma'
9
+
10
+ CERTS << {
11
+ :type => 'server',
12
+ :hostname => 'puma'
13
+ }
@@ -0,0 +1,17 @@
1
+ package puma;
2
+
3
+ import java.io.IOException;
4
+
5
+ import org.jruby.Ruby;
6
+ import org.jruby.runtime.load.BasicLibraryService;
7
+
8
+ import org.jruby.puma.Http11;
9
+ import org.jruby.puma.MiniSSL;
10
+
11
+ public class PumaHttp11Service implements BasicLibraryService {
12
+ public boolean basicLoad(final Ruby runtime) throws IOException {
13
+ Http11.createHttp11(runtime);
14
+ MiniSSL.createMiniSSL(runtime);
15
+ return true;
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ #ifndef ext_help_h
2
+ #define ext_help_h
3
+
4
+ #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "%s", "NULL found for " # T " when shouldn't be.");
5
+ #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name);
6
+ #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "%s", "Wrong argument type for " # V " required " # T);
7
+ #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
8
+
9
+ #ifdef DEBUG
10
+ #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
11
+ #else
12
+ #define TRACE()
13
+ #endif
14
+
15
+ #endif
@@ -0,0 +1,15 @@
1
+ require 'mkmf'
2
+
3
+ dir_config("puma_http11")
4
+
5
+ unless ENV["DISABLE_SSL"]
6
+ dir_config("openssl")
7
+
8
+ if %w'crypto libeay32'.find {|crypto| have_library(crypto, 'BIO_read')} and
9
+ %w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')}
10
+
11
+ have_header "openssl/bio.h"
12
+ end
13
+ end
14
+
15
+ create_makefile("puma/puma_http11")
@@ -0,0 +1,1069 @@
1
+
2
+ #line 1 "ext/puma_http11/http11_parser.rl"
3
+ /**
4
+ * Copyright (c) 2005 Zed A. Shaw
5
+ * You can redistribute it and/or modify it under the same terms as Ruby.
6
+ * License 3-clause BSD
7
+ */
8
+ #include "http11_parser.h"
9
+ #include <stdio.h>
10
+ #include <assert.h>
11
+ #include <stdlib.h>
12
+ #include <ctype.h>
13
+ #include <string.h>
14
+
15
+ /*
16
+ * capitalizes all lower-case ASCII characters,
17
+ * converts dashes to underscores.
18
+ */
19
+ static void snake_upcase_char(char *c)
20
+ {
21
+ if (*c >= 'a' && *c <= 'z')
22
+ *c &= ~0x20;
23
+ else if (*c == '-')
24
+ *c = '_';
25
+ }
26
+
27
+ #define LEN(AT, FPC) (FPC - buffer - parser->AT)
28
+ #define MARK(M,FPC) (parser->M = (FPC) - buffer)
29
+ #define PTR_TO(F) (buffer + parser->F)
30
+
31
+ /** Machine **/
32
+
33
+
34
+ #line 78 "ext/puma_http11/http11_parser.rl"
35
+
36
+
37
+ /** Data **/
38
+
39
+ #line 39 "ext/puma_http11/http11_parser.c"
40
+ static const int puma_parser_start = 1;
41
+ static const int puma_parser_first_final = 47;
42
+ static const int puma_parser_error = 0;
43
+
44
+ static const int puma_parser_en_main = 1;
45
+
46
+
47
+ #line 82 "ext/puma_http11/http11_parser.rl"
48
+
49
+ int puma_parser_init(puma_parser *parser) {
50
+ int cs = 0;
51
+
52
+ #line 52 "ext/puma_http11/http11_parser.c"
53
+ {
54
+ cs = puma_parser_start;
55
+ }
56
+
57
+ #line 86 "ext/puma_http11/http11_parser.rl"
58
+ parser->cs = cs;
59
+ parser->body_start = 0;
60
+ parser->content_len = 0;
61
+ parser->mark = 0;
62
+ parser->nread = 0;
63
+ parser->field_len = 0;
64
+ parser->field_start = 0;
65
+ parser->request = Qnil;
66
+ parser->body = Qnil;
67
+
68
+ return 1;
69
+ }
70
+
71
+
72
+ /** exec **/
73
+ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len, size_t off) {
74
+ const char *p, *pe;
75
+ int cs = parser->cs;
76
+
77
+ assert(off <= len && "offset past end of buffer");
78
+
79
+ p = buffer+off;
80
+ pe = buffer+len;
81
+
82
+ /* assert(*pe == '\0' && "pointer does not end on NUL"); */
83
+ assert(pe - p == len - off && "pointers aren't same distance");
84
+
85
+
86
+ #line 86 "ext/puma_http11/http11_parser.c"
87
+ {
88
+ if ( p == pe )
89
+ goto _test_eof;
90
+ switch ( cs )
91
+ {
92
+ case 1:
93
+ switch( (*p) ) {
94
+ case 36: goto tr0;
95
+ case 95: goto tr0;
96
+ }
97
+ if ( (*p) < 48 ) {
98
+ if ( 45 <= (*p) && (*p) <= 46 )
99
+ goto tr0;
100
+ } else if ( (*p) > 57 ) {
101
+ if ( 65 <= (*p) && (*p) <= 90 )
102
+ goto tr0;
103
+ } else
104
+ goto tr0;
105
+ goto st0;
106
+ st0:
107
+ cs = 0;
108
+ goto _out;
109
+ tr0:
110
+ #line 34 "ext/puma_http11/http11_parser.rl"
111
+ { MARK(mark, p); }
112
+ goto st2;
113
+ st2:
114
+ if ( ++p == pe )
115
+ goto _test_eof2;
116
+ case 2:
117
+ #line 117 "ext/puma_http11/http11_parser.c"
118
+ switch( (*p) ) {
119
+ case 32: goto tr2;
120
+ case 36: goto st28;
121
+ case 95: goto st28;
122
+ }
123
+ if ( (*p) < 48 ) {
124
+ if ( 45 <= (*p) && (*p) <= 46 )
125
+ goto st28;
126
+ } else if ( (*p) > 57 ) {
127
+ if ( 65 <= (*p) && (*p) <= 90 )
128
+ goto st28;
129
+ } else
130
+ goto st28;
131
+ goto st0;
132
+ tr2:
133
+ #line 47 "ext/puma_http11/http11_parser.rl"
134
+ {
135
+ parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
136
+ }
137
+ goto st3;
138
+ st3:
139
+ if ( ++p == pe )
140
+ goto _test_eof3;
141
+ case 3:
142
+ #line 142 "ext/puma_http11/http11_parser.c"
143
+ switch( (*p) ) {
144
+ case 42: goto tr4;
145
+ case 43: goto tr5;
146
+ case 47: goto tr6;
147
+ case 58: goto tr7;
148
+ }
149
+ if ( (*p) < 65 ) {
150
+ if ( 45 <= (*p) && (*p) <= 57 )
151
+ goto tr5;
152
+ } else if ( (*p) > 90 ) {
153
+ if ( 97 <= (*p) && (*p) <= 122 )
154
+ goto tr5;
155
+ } else
156
+ goto tr5;
157
+ goto st0;
158
+ tr4:
159
+ #line 34 "ext/puma_http11/http11_parser.rl"
160
+ { MARK(mark, p); }
161
+ goto st4;
162
+ st4:
163
+ if ( ++p == pe )
164
+ goto _test_eof4;
165
+ case 4:
166
+ #line 166 "ext/puma_http11/http11_parser.c"
167
+ switch( (*p) ) {
168
+ case 32: goto tr8;
169
+ case 35: goto tr9;
170
+ }
171
+ goto st0;
172
+ tr8:
173
+ #line 50 "ext/puma_http11/http11_parser.rl"
174
+ {
175
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
176
+ }
177
+ goto st5;
178
+ tr31:
179
+ #line 34 "ext/puma_http11/http11_parser.rl"
180
+ { MARK(mark, p); }
181
+ #line 53 "ext/puma_http11/http11_parser.rl"
182
+ {
183
+ parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
184
+ }
185
+ goto st5;
186
+ tr33:
187
+ #line 53 "ext/puma_http11/http11_parser.rl"
188
+ {
189
+ parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
190
+ }
191
+ goto st5;
192
+ tr37:
193
+ #line 66 "ext/puma_http11/http11_parser.rl"
194
+ {
195
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
196
+ }
197
+ #line 50 "ext/puma_http11/http11_parser.rl"
198
+ {
199
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
200
+ }
201
+ goto st5;
202
+ tr44:
203
+ #line 57 "ext/puma_http11/http11_parser.rl"
204
+ { MARK(query_start, p); }
205
+ #line 58 "ext/puma_http11/http11_parser.rl"
206
+ {
207
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
208
+ }
209
+ #line 50 "ext/puma_http11/http11_parser.rl"
210
+ {
211
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
212
+ }
213
+ goto st5;
214
+ tr47:
215
+ #line 58 "ext/puma_http11/http11_parser.rl"
216
+ {
217
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
218
+ }
219
+ #line 50 "ext/puma_http11/http11_parser.rl"
220
+ {
221
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
222
+ }
223
+ goto st5;
224
+ st5:
225
+ if ( ++p == pe )
226
+ goto _test_eof5;
227
+ case 5:
228
+ #line 228 "ext/puma_http11/http11_parser.c"
229
+ if ( (*p) == 72 )
230
+ goto tr10;
231
+ goto st0;
232
+ tr10:
233
+ #line 34 "ext/puma_http11/http11_parser.rl"
234
+ { MARK(mark, p); }
235
+ goto st6;
236
+ st6:
237
+ if ( ++p == pe )
238
+ goto _test_eof6;
239
+ case 6:
240
+ #line 240 "ext/puma_http11/http11_parser.c"
241
+ if ( (*p) == 84 )
242
+ goto st7;
243
+ goto st0;
244
+ st7:
245
+ if ( ++p == pe )
246
+ goto _test_eof7;
247
+ case 7:
248
+ if ( (*p) == 84 )
249
+ goto st8;
250
+ goto st0;
251
+ st8:
252
+ if ( ++p == pe )
253
+ goto _test_eof8;
254
+ case 8:
255
+ if ( (*p) == 80 )
256
+ goto st9;
257
+ goto st0;
258
+ st9:
259
+ if ( ++p == pe )
260
+ goto _test_eof9;
261
+ case 9:
262
+ if ( (*p) == 47 )
263
+ goto st10;
264
+ goto st0;
265
+ st10:
266
+ if ( ++p == pe )
267
+ goto _test_eof10;
268
+ case 10:
269
+ if ( 48 <= (*p) && (*p) <= 57 )
270
+ goto st11;
271
+ goto st0;
272
+ st11:
273
+ if ( ++p == pe )
274
+ goto _test_eof11;
275
+ case 11:
276
+ if ( (*p) == 46 )
277
+ goto st12;
278
+ if ( 48 <= (*p) && (*p) <= 57 )
279
+ goto st11;
280
+ goto st0;
281
+ st12:
282
+ if ( ++p == pe )
283
+ goto _test_eof12;
284
+ case 12:
285
+ if ( 48 <= (*p) && (*p) <= 57 )
286
+ goto st13;
287
+ goto st0;
288
+ st13:
289
+ if ( ++p == pe )
290
+ goto _test_eof13;
291
+ case 13:
292
+ if ( (*p) == 13 )
293
+ goto tr18;
294
+ if ( 48 <= (*p) && (*p) <= 57 )
295
+ goto st13;
296
+ goto st0;
297
+ tr18:
298
+ #line 62 "ext/puma_http11/http11_parser.rl"
299
+ {
300
+ parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
301
+ }
302
+ goto st14;
303
+ tr26:
304
+ #line 43 "ext/puma_http11/http11_parser.rl"
305
+ { MARK(mark, p); }
306
+ #line 44 "ext/puma_http11/http11_parser.rl"
307
+ {
308
+ parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
309
+ }
310
+ goto st14;
311
+ tr29:
312
+ #line 44 "ext/puma_http11/http11_parser.rl"
313
+ {
314
+ parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
315
+ }
316
+ goto st14;
317
+ st14:
318
+ if ( ++p == pe )
319
+ goto _test_eof14;
320
+ case 14:
321
+ #line 321 "ext/puma_http11/http11_parser.c"
322
+ if ( (*p) == 10 )
323
+ goto st15;
324
+ goto st0;
325
+ st15:
326
+ if ( ++p == pe )
327
+ goto _test_eof15;
328
+ case 15:
329
+ switch( (*p) ) {
330
+ case 13: goto st16;
331
+ case 33: goto tr21;
332
+ case 124: goto tr21;
333
+ case 126: goto tr21;
334
+ }
335
+ if ( (*p) < 45 ) {
336
+ if ( (*p) > 39 ) {
337
+ if ( 42 <= (*p) && (*p) <= 43 )
338
+ goto tr21;
339
+ } else if ( (*p) >= 35 )
340
+ goto tr21;
341
+ } else if ( (*p) > 46 ) {
342
+ if ( (*p) < 65 ) {
343
+ if ( 48 <= (*p) && (*p) <= 57 )
344
+ goto tr21;
345
+ } else if ( (*p) > 90 ) {
346
+ if ( 94 <= (*p) && (*p) <= 122 )
347
+ goto tr21;
348
+ } else
349
+ goto tr21;
350
+ } else
351
+ goto tr21;
352
+ goto st0;
353
+ st16:
354
+ if ( ++p == pe )
355
+ goto _test_eof16;
356
+ case 16:
357
+ if ( (*p) == 10 )
358
+ goto tr22;
359
+ goto st0;
360
+ tr22:
361
+ #line 70 "ext/puma_http11/http11_parser.rl"
362
+ {
363
+ parser->body_start = p - buffer + 1;
364
+ parser->header_done(parser, p + 1, pe - p - 1);
365
+ {p++; cs = 47; goto _out;}
366
+ }
367
+ goto st47;
368
+ st47:
369
+ if ( ++p == pe )
370
+ goto _test_eof47;
371
+ case 47:
372
+ #line 372 "ext/puma_http11/http11_parser.c"
373
+ goto st0;
374
+ tr21:
375
+ #line 37 "ext/puma_http11/http11_parser.rl"
376
+ { MARK(field_start, p); }
377
+ #line 38 "ext/puma_http11/http11_parser.rl"
378
+ { snake_upcase_char((char *)p); }
379
+ goto st17;
380
+ tr23:
381
+ #line 38 "ext/puma_http11/http11_parser.rl"
382
+ { snake_upcase_char((char *)p); }
383
+ goto st17;
384
+ st17:
385
+ if ( ++p == pe )
386
+ goto _test_eof17;
387
+ case 17:
388
+ #line 388 "ext/puma_http11/http11_parser.c"
389
+ switch( (*p) ) {
390
+ case 33: goto tr23;
391
+ case 58: goto tr24;
392
+ case 124: goto tr23;
393
+ case 126: goto tr23;
394
+ }
395
+ if ( (*p) < 45 ) {
396
+ if ( (*p) > 39 ) {
397
+ if ( 42 <= (*p) && (*p) <= 43 )
398
+ goto tr23;
399
+ } else if ( (*p) >= 35 )
400
+ goto tr23;
401
+ } else if ( (*p) > 46 ) {
402
+ if ( (*p) < 65 ) {
403
+ if ( 48 <= (*p) && (*p) <= 57 )
404
+ goto tr23;
405
+ } else if ( (*p) > 90 ) {
406
+ if ( 94 <= (*p) && (*p) <= 122 )
407
+ goto tr23;
408
+ } else
409
+ goto tr23;
410
+ } else
411
+ goto tr23;
412
+ goto st0;
413
+ tr24:
414
+ #line 39 "ext/puma_http11/http11_parser.rl"
415
+ {
416
+ parser->field_len = LEN(field_start, p);
417
+ }
418
+ goto st18;
419
+ tr27:
420
+ #line 43 "ext/puma_http11/http11_parser.rl"
421
+ { MARK(mark, p); }
422
+ goto st18;
423
+ st18:
424
+ if ( ++p == pe )
425
+ goto _test_eof18;
426
+ case 18:
427
+ #line 427 "ext/puma_http11/http11_parser.c"
428
+ switch( (*p) ) {
429
+ case 13: goto tr26;
430
+ case 32: goto tr27;
431
+ }
432
+ goto tr25;
433
+ tr25:
434
+ #line 43 "ext/puma_http11/http11_parser.rl"
435
+ { MARK(mark, p); }
436
+ goto st19;
437
+ st19:
438
+ if ( ++p == pe )
439
+ goto _test_eof19;
440
+ case 19:
441
+ #line 441 "ext/puma_http11/http11_parser.c"
442
+ if ( (*p) == 13 )
443
+ goto tr29;
444
+ goto st19;
445
+ tr9:
446
+ #line 50 "ext/puma_http11/http11_parser.rl"
447
+ {
448
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
449
+ }
450
+ goto st20;
451
+ tr38:
452
+ #line 66 "ext/puma_http11/http11_parser.rl"
453
+ {
454
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
455
+ }
456
+ #line 50 "ext/puma_http11/http11_parser.rl"
457
+ {
458
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
459
+ }
460
+ goto st20;
461
+ tr45:
462
+ #line 57 "ext/puma_http11/http11_parser.rl"
463
+ { MARK(query_start, p); }
464
+ #line 58 "ext/puma_http11/http11_parser.rl"
465
+ {
466
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
467
+ }
468
+ #line 50 "ext/puma_http11/http11_parser.rl"
469
+ {
470
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
471
+ }
472
+ goto st20;
473
+ tr48:
474
+ #line 58 "ext/puma_http11/http11_parser.rl"
475
+ {
476
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
477
+ }
478
+ #line 50 "ext/puma_http11/http11_parser.rl"
479
+ {
480
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
481
+ }
482
+ goto st20;
483
+ st20:
484
+ if ( ++p == pe )
485
+ goto _test_eof20;
486
+ case 20:
487
+ #line 487 "ext/puma_http11/http11_parser.c"
488
+ switch( (*p) ) {
489
+ case 32: goto tr31;
490
+ case 60: goto st0;
491
+ case 62: goto st0;
492
+ case 127: goto st0;
493
+ }
494
+ if ( (*p) > 31 ) {
495
+ if ( 34 <= (*p) && (*p) <= 35 )
496
+ goto st0;
497
+ } else if ( (*p) >= 0 )
498
+ goto st0;
499
+ goto tr30;
500
+ tr30:
501
+ #line 34 "ext/puma_http11/http11_parser.rl"
502
+ { MARK(mark, p); }
503
+ goto st21;
504
+ st21:
505
+ if ( ++p == pe )
506
+ goto _test_eof21;
507
+ case 21:
508
+ #line 508 "ext/puma_http11/http11_parser.c"
509
+ switch( (*p) ) {
510
+ case 32: goto tr33;
511
+ case 60: goto st0;
512
+ case 62: goto st0;
513
+ case 127: goto st0;
514
+ }
515
+ if ( (*p) > 31 ) {
516
+ if ( 34 <= (*p) && (*p) <= 35 )
517
+ goto st0;
518
+ } else if ( (*p) >= 0 )
519
+ goto st0;
520
+ goto st21;
521
+ tr5:
522
+ #line 34 "ext/puma_http11/http11_parser.rl"
523
+ { MARK(mark, p); }
524
+ goto st22;
525
+ st22:
526
+ if ( ++p == pe )
527
+ goto _test_eof22;
528
+ case 22:
529
+ #line 529 "ext/puma_http11/http11_parser.c"
530
+ switch( (*p) ) {
531
+ case 43: goto st22;
532
+ case 58: goto st23;
533
+ }
534
+ if ( (*p) < 48 ) {
535
+ if ( 45 <= (*p) && (*p) <= 46 )
536
+ goto st22;
537
+ } else if ( (*p) > 57 ) {
538
+ if ( (*p) > 90 ) {
539
+ if ( 97 <= (*p) && (*p) <= 122 )
540
+ goto st22;
541
+ } else if ( (*p) >= 65 )
542
+ goto st22;
543
+ } else
544
+ goto st22;
545
+ goto st0;
546
+ tr7:
547
+ #line 34 "ext/puma_http11/http11_parser.rl"
548
+ { MARK(mark, p); }
549
+ goto st23;
550
+ st23:
551
+ if ( ++p == pe )
552
+ goto _test_eof23;
553
+ case 23:
554
+ #line 554 "ext/puma_http11/http11_parser.c"
555
+ switch( (*p) ) {
556
+ case 32: goto tr8;
557
+ case 34: goto st0;
558
+ case 35: goto tr9;
559
+ case 60: goto st0;
560
+ case 62: goto st0;
561
+ case 127: goto st0;
562
+ }
563
+ if ( 0 <= (*p) && (*p) <= 31 )
564
+ goto st0;
565
+ goto st23;
566
+ tr6:
567
+ #line 34 "ext/puma_http11/http11_parser.rl"
568
+ { MARK(mark, p); }
569
+ goto st24;
570
+ st24:
571
+ if ( ++p == pe )
572
+ goto _test_eof24;
573
+ case 24:
574
+ #line 574 "ext/puma_http11/http11_parser.c"
575
+ switch( (*p) ) {
576
+ case 32: goto tr37;
577
+ case 34: goto st0;
578
+ case 35: goto tr38;
579
+ case 59: goto tr39;
580
+ case 60: goto st0;
581
+ case 62: goto st0;
582
+ case 63: goto tr40;
583
+ case 127: goto st0;
584
+ }
585
+ if ( 0 <= (*p) && (*p) <= 31 )
586
+ goto st0;
587
+ goto st24;
588
+ tr39:
589
+ #line 66 "ext/puma_http11/http11_parser.rl"
590
+ {
591
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
592
+ }
593
+ goto st25;
594
+ st25:
595
+ if ( ++p == pe )
596
+ goto _test_eof25;
597
+ case 25:
598
+ #line 598 "ext/puma_http11/http11_parser.c"
599
+ switch( (*p) ) {
600
+ case 32: goto tr8;
601
+ case 34: goto st0;
602
+ case 35: goto tr9;
603
+ case 60: goto st0;
604
+ case 62: goto st0;
605
+ case 63: goto st26;
606
+ case 127: goto st0;
607
+ }
608
+ if ( 0 <= (*p) && (*p) <= 31 )
609
+ goto st0;
610
+ goto st25;
611
+ tr40:
612
+ #line 66 "ext/puma_http11/http11_parser.rl"
613
+ {
614
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
615
+ }
616
+ goto st26;
617
+ st26:
618
+ if ( ++p == pe )
619
+ goto _test_eof26;
620
+ case 26:
621
+ #line 621 "ext/puma_http11/http11_parser.c"
622
+ switch( (*p) ) {
623
+ case 32: goto tr44;
624
+ case 34: goto st0;
625
+ case 35: goto tr45;
626
+ case 60: goto st0;
627
+ case 62: goto st0;
628
+ case 127: goto st0;
629
+ }
630
+ if ( 0 <= (*p) && (*p) <= 31 )
631
+ goto st0;
632
+ goto tr43;
633
+ tr43:
634
+ #line 57 "ext/puma_http11/http11_parser.rl"
635
+ { MARK(query_start, p); }
636
+ goto st27;
637
+ st27:
638
+ if ( ++p == pe )
639
+ goto _test_eof27;
640
+ case 27:
641
+ #line 641 "ext/puma_http11/http11_parser.c"
642
+ switch( (*p) ) {
643
+ case 32: goto tr47;
644
+ case 34: goto st0;
645
+ case 35: goto tr48;
646
+ case 60: goto st0;
647
+ case 62: goto st0;
648
+ case 127: goto st0;
649
+ }
650
+ if ( 0 <= (*p) && (*p) <= 31 )
651
+ goto st0;
652
+ goto st27;
653
+ st28:
654
+ if ( ++p == pe )
655
+ goto _test_eof28;
656
+ case 28:
657
+ switch( (*p) ) {
658
+ case 32: goto tr2;
659
+ case 36: goto st29;
660
+ case 95: goto st29;
661
+ }
662
+ if ( (*p) < 48 ) {
663
+ if ( 45 <= (*p) && (*p) <= 46 )
664
+ goto st29;
665
+ } else if ( (*p) > 57 ) {
666
+ if ( 65 <= (*p) && (*p) <= 90 )
667
+ goto st29;
668
+ } else
669
+ goto st29;
670
+ goto st0;
671
+ st29:
672
+ if ( ++p == pe )
673
+ goto _test_eof29;
674
+ case 29:
675
+ switch( (*p) ) {
676
+ case 32: goto tr2;
677
+ case 36: goto st30;
678
+ case 95: goto st30;
679
+ }
680
+ if ( (*p) < 48 ) {
681
+ if ( 45 <= (*p) && (*p) <= 46 )
682
+ goto st30;
683
+ } else if ( (*p) > 57 ) {
684
+ if ( 65 <= (*p) && (*p) <= 90 )
685
+ goto st30;
686
+ } else
687
+ goto st30;
688
+ goto st0;
689
+ st30:
690
+ if ( ++p == pe )
691
+ goto _test_eof30;
692
+ case 30:
693
+ switch( (*p) ) {
694
+ case 32: goto tr2;
695
+ case 36: goto st31;
696
+ case 95: goto st31;
697
+ }
698
+ if ( (*p) < 48 ) {
699
+ if ( 45 <= (*p) && (*p) <= 46 )
700
+ goto st31;
701
+ } else if ( (*p) > 57 ) {
702
+ if ( 65 <= (*p) && (*p) <= 90 )
703
+ goto st31;
704
+ } else
705
+ goto st31;
706
+ goto st0;
707
+ st31:
708
+ if ( ++p == pe )
709
+ goto _test_eof31;
710
+ case 31:
711
+ switch( (*p) ) {
712
+ case 32: goto tr2;
713
+ case 36: goto st32;
714
+ case 95: goto st32;
715
+ }
716
+ if ( (*p) < 48 ) {
717
+ if ( 45 <= (*p) && (*p) <= 46 )
718
+ goto st32;
719
+ } else if ( (*p) > 57 ) {
720
+ if ( 65 <= (*p) && (*p) <= 90 )
721
+ goto st32;
722
+ } else
723
+ goto st32;
724
+ goto st0;
725
+ st32:
726
+ if ( ++p == pe )
727
+ goto _test_eof32;
728
+ case 32:
729
+ switch( (*p) ) {
730
+ case 32: goto tr2;
731
+ case 36: goto st33;
732
+ case 95: goto st33;
733
+ }
734
+ if ( (*p) < 48 ) {
735
+ if ( 45 <= (*p) && (*p) <= 46 )
736
+ goto st33;
737
+ } else if ( (*p) > 57 ) {
738
+ if ( 65 <= (*p) && (*p) <= 90 )
739
+ goto st33;
740
+ } else
741
+ goto st33;
742
+ goto st0;
743
+ st33:
744
+ if ( ++p == pe )
745
+ goto _test_eof33;
746
+ case 33:
747
+ switch( (*p) ) {
748
+ case 32: goto tr2;
749
+ case 36: goto st34;
750
+ case 95: goto st34;
751
+ }
752
+ if ( (*p) < 48 ) {
753
+ if ( 45 <= (*p) && (*p) <= 46 )
754
+ goto st34;
755
+ } else if ( (*p) > 57 ) {
756
+ if ( 65 <= (*p) && (*p) <= 90 )
757
+ goto st34;
758
+ } else
759
+ goto st34;
760
+ goto st0;
761
+ st34:
762
+ if ( ++p == pe )
763
+ goto _test_eof34;
764
+ case 34:
765
+ switch( (*p) ) {
766
+ case 32: goto tr2;
767
+ case 36: goto st35;
768
+ case 95: goto st35;
769
+ }
770
+ if ( (*p) < 48 ) {
771
+ if ( 45 <= (*p) && (*p) <= 46 )
772
+ goto st35;
773
+ } else if ( (*p) > 57 ) {
774
+ if ( 65 <= (*p) && (*p) <= 90 )
775
+ goto st35;
776
+ } else
777
+ goto st35;
778
+ goto st0;
779
+ st35:
780
+ if ( ++p == pe )
781
+ goto _test_eof35;
782
+ case 35:
783
+ switch( (*p) ) {
784
+ case 32: goto tr2;
785
+ case 36: goto st36;
786
+ case 95: goto st36;
787
+ }
788
+ if ( (*p) < 48 ) {
789
+ if ( 45 <= (*p) && (*p) <= 46 )
790
+ goto st36;
791
+ } else if ( (*p) > 57 ) {
792
+ if ( 65 <= (*p) && (*p) <= 90 )
793
+ goto st36;
794
+ } else
795
+ goto st36;
796
+ goto st0;
797
+ st36:
798
+ if ( ++p == pe )
799
+ goto _test_eof36;
800
+ case 36:
801
+ switch( (*p) ) {
802
+ case 32: goto tr2;
803
+ case 36: goto st37;
804
+ case 95: goto st37;
805
+ }
806
+ if ( (*p) < 48 ) {
807
+ if ( 45 <= (*p) && (*p) <= 46 )
808
+ goto st37;
809
+ } else if ( (*p) > 57 ) {
810
+ if ( 65 <= (*p) && (*p) <= 90 )
811
+ goto st37;
812
+ } else
813
+ goto st37;
814
+ goto st0;
815
+ st37:
816
+ if ( ++p == pe )
817
+ goto _test_eof37;
818
+ case 37:
819
+ switch( (*p) ) {
820
+ case 32: goto tr2;
821
+ case 36: goto st38;
822
+ case 95: goto st38;
823
+ }
824
+ if ( (*p) < 48 ) {
825
+ if ( 45 <= (*p) && (*p) <= 46 )
826
+ goto st38;
827
+ } else if ( (*p) > 57 ) {
828
+ if ( 65 <= (*p) && (*p) <= 90 )
829
+ goto st38;
830
+ } else
831
+ goto st38;
832
+ goto st0;
833
+ st38:
834
+ if ( ++p == pe )
835
+ goto _test_eof38;
836
+ case 38:
837
+ switch( (*p) ) {
838
+ case 32: goto tr2;
839
+ case 36: goto st39;
840
+ case 95: goto st39;
841
+ }
842
+ if ( (*p) < 48 ) {
843
+ if ( 45 <= (*p) && (*p) <= 46 )
844
+ goto st39;
845
+ } else if ( (*p) > 57 ) {
846
+ if ( 65 <= (*p) && (*p) <= 90 )
847
+ goto st39;
848
+ } else
849
+ goto st39;
850
+ goto st0;
851
+ st39:
852
+ if ( ++p == pe )
853
+ goto _test_eof39;
854
+ case 39:
855
+ switch( (*p) ) {
856
+ case 32: goto tr2;
857
+ case 36: goto st40;
858
+ case 95: goto st40;
859
+ }
860
+ if ( (*p) < 48 ) {
861
+ if ( 45 <= (*p) && (*p) <= 46 )
862
+ goto st40;
863
+ } else if ( (*p) > 57 ) {
864
+ if ( 65 <= (*p) && (*p) <= 90 )
865
+ goto st40;
866
+ } else
867
+ goto st40;
868
+ goto st0;
869
+ st40:
870
+ if ( ++p == pe )
871
+ goto _test_eof40;
872
+ case 40:
873
+ switch( (*p) ) {
874
+ case 32: goto tr2;
875
+ case 36: goto st41;
876
+ case 95: goto st41;
877
+ }
878
+ if ( (*p) < 48 ) {
879
+ if ( 45 <= (*p) && (*p) <= 46 )
880
+ goto st41;
881
+ } else if ( (*p) > 57 ) {
882
+ if ( 65 <= (*p) && (*p) <= 90 )
883
+ goto st41;
884
+ } else
885
+ goto st41;
886
+ goto st0;
887
+ st41:
888
+ if ( ++p == pe )
889
+ goto _test_eof41;
890
+ case 41:
891
+ switch( (*p) ) {
892
+ case 32: goto tr2;
893
+ case 36: goto st42;
894
+ case 95: goto st42;
895
+ }
896
+ if ( (*p) < 48 ) {
897
+ if ( 45 <= (*p) && (*p) <= 46 )
898
+ goto st42;
899
+ } else if ( (*p) > 57 ) {
900
+ if ( 65 <= (*p) && (*p) <= 90 )
901
+ goto st42;
902
+ } else
903
+ goto st42;
904
+ goto st0;
905
+ st42:
906
+ if ( ++p == pe )
907
+ goto _test_eof42;
908
+ case 42:
909
+ switch( (*p) ) {
910
+ case 32: goto tr2;
911
+ case 36: goto st43;
912
+ case 95: goto st43;
913
+ }
914
+ if ( (*p) < 48 ) {
915
+ if ( 45 <= (*p) && (*p) <= 46 )
916
+ goto st43;
917
+ } else if ( (*p) > 57 ) {
918
+ if ( 65 <= (*p) && (*p) <= 90 )
919
+ goto st43;
920
+ } else
921
+ goto st43;
922
+ goto st0;
923
+ st43:
924
+ if ( ++p == pe )
925
+ goto _test_eof43;
926
+ case 43:
927
+ switch( (*p) ) {
928
+ case 32: goto tr2;
929
+ case 36: goto st44;
930
+ case 95: goto st44;
931
+ }
932
+ if ( (*p) < 48 ) {
933
+ if ( 45 <= (*p) && (*p) <= 46 )
934
+ goto st44;
935
+ } else if ( (*p) > 57 ) {
936
+ if ( 65 <= (*p) && (*p) <= 90 )
937
+ goto st44;
938
+ } else
939
+ goto st44;
940
+ goto st0;
941
+ st44:
942
+ if ( ++p == pe )
943
+ goto _test_eof44;
944
+ case 44:
945
+ switch( (*p) ) {
946
+ case 32: goto tr2;
947
+ case 36: goto st45;
948
+ case 95: goto st45;
949
+ }
950
+ if ( (*p) < 48 ) {
951
+ if ( 45 <= (*p) && (*p) <= 46 )
952
+ goto st45;
953
+ } else if ( (*p) > 57 ) {
954
+ if ( 65 <= (*p) && (*p) <= 90 )
955
+ goto st45;
956
+ } else
957
+ goto st45;
958
+ goto st0;
959
+ st45:
960
+ if ( ++p == pe )
961
+ goto _test_eof45;
962
+ case 45:
963
+ switch( (*p) ) {
964
+ case 32: goto tr2;
965
+ case 36: goto st46;
966
+ case 95: goto st46;
967
+ }
968
+ if ( (*p) < 48 ) {
969
+ if ( 45 <= (*p) && (*p) <= 46 )
970
+ goto st46;
971
+ } else if ( (*p) > 57 ) {
972
+ if ( 65 <= (*p) && (*p) <= 90 )
973
+ goto st46;
974
+ } else
975
+ goto st46;
976
+ goto st0;
977
+ st46:
978
+ if ( ++p == pe )
979
+ goto _test_eof46;
980
+ case 46:
981
+ if ( (*p) == 32 )
982
+ goto tr2;
983
+ goto st0;
984
+ }
985
+ _test_eof2: cs = 2; goto _test_eof;
986
+ _test_eof3: cs = 3; goto _test_eof;
987
+ _test_eof4: cs = 4; goto _test_eof;
988
+ _test_eof5: cs = 5; goto _test_eof;
989
+ _test_eof6: cs = 6; goto _test_eof;
990
+ _test_eof7: cs = 7; goto _test_eof;
991
+ _test_eof8: cs = 8; goto _test_eof;
992
+ _test_eof9: cs = 9; goto _test_eof;
993
+ _test_eof10: cs = 10; goto _test_eof;
994
+ _test_eof11: cs = 11; goto _test_eof;
995
+ _test_eof12: cs = 12; goto _test_eof;
996
+ _test_eof13: cs = 13; goto _test_eof;
997
+ _test_eof14: cs = 14; goto _test_eof;
998
+ _test_eof15: cs = 15; goto _test_eof;
999
+ _test_eof16: cs = 16; goto _test_eof;
1000
+ _test_eof47: cs = 47; goto _test_eof;
1001
+ _test_eof17: cs = 17; goto _test_eof;
1002
+ _test_eof18: cs = 18; goto _test_eof;
1003
+ _test_eof19: cs = 19; goto _test_eof;
1004
+ _test_eof20: cs = 20; goto _test_eof;
1005
+ _test_eof21: cs = 21; goto _test_eof;
1006
+ _test_eof22: cs = 22; goto _test_eof;
1007
+ _test_eof23: cs = 23; goto _test_eof;
1008
+ _test_eof24: cs = 24; goto _test_eof;
1009
+ _test_eof25: cs = 25; goto _test_eof;
1010
+ _test_eof26: cs = 26; goto _test_eof;
1011
+ _test_eof27: cs = 27; goto _test_eof;
1012
+ _test_eof28: cs = 28; goto _test_eof;
1013
+ _test_eof29: cs = 29; goto _test_eof;
1014
+ _test_eof30: cs = 30; goto _test_eof;
1015
+ _test_eof31: cs = 31; goto _test_eof;
1016
+ _test_eof32: cs = 32; goto _test_eof;
1017
+ _test_eof33: cs = 33; goto _test_eof;
1018
+ _test_eof34: cs = 34; goto _test_eof;
1019
+ _test_eof35: cs = 35; goto _test_eof;
1020
+ _test_eof36: cs = 36; goto _test_eof;
1021
+ _test_eof37: cs = 37; goto _test_eof;
1022
+ _test_eof38: cs = 38; goto _test_eof;
1023
+ _test_eof39: cs = 39; goto _test_eof;
1024
+ _test_eof40: cs = 40; goto _test_eof;
1025
+ _test_eof41: cs = 41; goto _test_eof;
1026
+ _test_eof42: cs = 42; goto _test_eof;
1027
+ _test_eof43: cs = 43; goto _test_eof;
1028
+ _test_eof44: cs = 44; goto _test_eof;
1029
+ _test_eof45: cs = 45; goto _test_eof;
1030
+ _test_eof46: cs = 46; goto _test_eof;
1031
+
1032
+ _test_eof: {}
1033
+ _out: {}
1034
+ }
1035
+
1036
+ #line 114 "ext/puma_http11/http11_parser.rl"
1037
+
1038
+ if (!puma_parser_has_error(parser))
1039
+ parser->cs = cs;
1040
+ parser->nread += p - (buffer + off);
1041
+
1042
+ assert(p <= pe && "buffer overflow after parsing execute");
1043
+ assert(parser->nread <= len && "nread longer than length");
1044
+ assert(parser->body_start <= len && "body starts after buffer end");
1045
+ assert(parser->mark < len && "mark is after buffer end");
1046
+ assert(parser->field_len <= len && "field has length longer than whole buffer");
1047
+ assert(parser->field_start < len && "field starts after buffer end");
1048
+
1049
+ return(parser->nread);
1050
+ }
1051
+
1052
+ int puma_parser_finish(puma_parser *parser)
1053
+ {
1054
+ if (puma_parser_has_error(parser) ) {
1055
+ return -1;
1056
+ } else if (puma_parser_is_finished(parser) ) {
1057
+ return 1;
1058
+ } else {
1059
+ return 0;
1060
+ }
1061
+ }
1062
+
1063
+ int puma_parser_has_error(puma_parser *parser) {
1064
+ return parser->cs == puma_parser_error;
1065
+ }
1066
+
1067
+ int puma_parser_is_finished(puma_parser *parser) {
1068
+ return parser->cs >= puma_parser_first_final;
1069
+ }