puma 8.1.0-java → 8.1.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +10 -0
  3. data/README.md +16 -381
  4. data/docs/binding.md +135 -0
  5. data/docs/cluster_mode.md +241 -0
  6. data/docs/configuration.md +78 -0
  7. data/docs/{stats.md → control_server.md} +23 -3
  8. data/docs/{deployment.md → deployment/README.md} +20 -4
  9. data/docs/{kubernetes.md → deployment/kubernetes.md} +1 -1
  10. data/docs/plugins.md +61 -2
  11. data/docs/puma_support.md +15 -1
  12. data/docs/restart.md +5 -1
  13. data/docs/signals.md +2 -0
  14. data/docs/{5.0-Upgrade.md → upgrading/5.0-Upgrade.md} +3 -3
  15. data/docs/{6.0-Upgrade.md → upgrading/6.0-Upgrade.md} +2 -2
  16. data/docs/{7.0-Upgrade.md → upgrading/7.0-Upgrade.md} +2 -2
  17. data/docs/{8.0-Upgrade.md → upgrading/8.0-Upgrade.md} +2 -2
  18. data/lib/puma/cluster.rb +0 -1
  19. data/lib/puma/const.rb +1 -1
  20. data/lib/puma/minissl.rb +1 -4
  21. data/lib/puma/puma_http11.jar +0 -0
  22. metadata +17 -35
  23. data/docs/fork_worker.md +0 -71
  24. data/docs/grpc.md +0 -62
  25. data/docs/jungle/README.md +0 -9
  26. data/docs/testing_benchmarks_local_files.md +0 -150
  27. data/docs/testing_test_rackup_ci_files.md +0 -36
  28. data/ext/puma_http11/PumaHttp11Service.java +0 -17
  29. data/ext/puma_http11/extconf.rb +0 -67
  30. data/ext/puma_http11/http11_parser.c +0 -1061
  31. data/ext/puma_http11/http11_parser.h +0 -65
  32. data/ext/puma_http11/http11_parser.java.rl +0 -131
  33. data/ext/puma_http11/http11_parser.rl +0 -149
  34. data/ext/puma_http11/http11_parser_common.rl +0 -57
  35. data/ext/puma_http11/mini_ssl.c +0 -863
  36. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -15
  37. data/ext/puma_http11/org/jruby/puma/EnvKey.java +0 -241
  38. data/ext/puma_http11/org/jruby/puma/Http11.java +0 -321
  39. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +0 -441
  40. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +0 -519
  41. data/ext/puma_http11/puma_http11.c +0 -524
  42. data/tools/Dockerfile +0 -26
  43. data/tools/trickletest.rb +0 -44
  44. /data/docs/{nginx.md → deployment/nginx.md} +0 -0
  45. /data/docs/{jungle → deployment}/rc.d/README.md +0 -0
  46. /data/docs/{jungle → deployment}/rc.d/puma +0 -0
  47. /data/docs/{jungle → deployment}/rc.d/puma.conf +0 -0
  48. /data/docs/{systemd.md → deployment/systemd.md} +0 -0
@@ -1,524 +0,0 @@
1
- /**
2
- * Copyright (c) 2005 Zed A. Shaw
3
- * You can redistribute it and/or modify it under the same terms as Ruby.
4
- * License 3-clause BSD
5
- */
6
-
7
- #define RSTRING_NOT_MODIFIED 1
8
-
9
- #include "ruby.h"
10
- #include "ruby/encoding.h"
11
- #include <assert.h>
12
- #include <string.h>
13
- #include <ctype.h>
14
- #include "http11_parser.h"
15
-
16
- #ifdef HAVE_PRCTL
17
- #include <sys/prctl.h>
18
- #endif
19
-
20
- #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
21
-
22
- static VALUE eHttpParserError;
23
-
24
- #define HTTP_PREFIX "HTTP_"
25
- #define HTTP_PREFIX_LEN (sizeof(HTTP_PREFIX) - 1)
26
-
27
- static VALUE global_request_method;
28
- static VALUE global_request_uri;
29
- static VALUE global_fragment;
30
- static VALUE global_query_string;
31
- static VALUE global_server_protocol;
32
- static VALUE global_request_path;
33
-
34
- /** Defines common length and error messages for input length validation. */
35
- #define QUOTE(s) #s
36
- #define EXPAND_MAX_LENGTH_VALUE(s) QUOTE(s)
37
- #define DEF_MAX_LENGTH(N,length) const size_t MAX_##N##_LENGTH = length; const char *MAX_##N##_LENGTH_ERR = "HTTP element " # N " is longer than the " EXPAND_MAX_LENGTH_VALUE(length) " allowed length (was %d)"
38
-
39
- /** Validates the max length of given input and throws an HttpParserError exception if over. */
40
- #define VALIDATE_MAX_LENGTH(len, N) if(len > MAX_##N##_LENGTH) { rb_raise(eHttpParserError, MAX_##N##_LENGTH_ERR, len); }
41
-
42
- /** Defines global strings in the init method. */
43
- static inline void DEF_GLOBAL(VALUE *var, const char *cstr)
44
- {
45
- rb_global_variable(var);
46
- *var = rb_enc_interned_str_cstr(cstr, rb_utf8_encoding());
47
- }
48
-
49
- /* Defines the maximum allowed lengths for various input elements.*/
50
- #ifndef PUMA_REQUEST_URI_MAX_LENGTH
51
- #define PUMA_REQUEST_URI_MAX_LENGTH (1024 * 12)
52
- #endif
53
-
54
- #ifndef PUMA_REQUEST_PATH_MAX_LENGTH
55
- #define PUMA_REQUEST_PATH_MAX_LENGTH (8192)
56
- #endif
57
-
58
- #ifndef PUMA_QUERY_STRING_MAX_LENGTH
59
- #define PUMA_QUERY_STRING_MAX_LENGTH (1024 * 10)
60
- #endif
61
-
62
- DEF_MAX_LENGTH(FIELD_NAME, 256);
63
- DEF_MAX_LENGTH(FIELD_VALUE, 80 * 1024);
64
- DEF_MAX_LENGTH(REQUEST_URI, PUMA_REQUEST_URI_MAX_LENGTH);
65
- DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewhere or not */
66
- DEF_MAX_LENGTH(REQUEST_PATH, PUMA_REQUEST_PATH_MAX_LENGTH);
67
- DEF_MAX_LENGTH(QUERY_STRING, PUMA_QUERY_STRING_MAX_LENGTH);
68
- DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32)));
69
-
70
- struct common_field {
71
- const size_t len;
72
- const char *name;
73
- int raw;
74
- VALUE value;
75
- };
76
-
77
- /*
78
- * A list of common HTTP headers we expect to receive.
79
- * This allows us to avoid repeatedly creating identical string
80
- * objects to be used with rb_hash_aset().
81
- */
82
- static struct common_field common_http_fields[] = {
83
- # define f(N) { (sizeof(N) - 1), N, 0, Qnil }
84
- # define fr(N) { (sizeof(N) - 1), N, 1, Qnil }
85
- f("ACCEPT"),
86
- f("ACCEPT_CHARSET"),
87
- f("ACCEPT_ENCODING"),
88
- f("ACCEPT_LANGUAGE"),
89
- f("ALLOW"),
90
- f("AUTHORIZATION"),
91
- f("CACHE_CONTROL"),
92
- f("CONNECTION"),
93
- f("CONTENT_ENCODING"),
94
- fr("CONTENT_LENGTH"),
95
- fr("CONTENT_TYPE"),
96
- f("COOKIE"),
97
- f("DATE"),
98
- f("EXPECT"),
99
- f("FROM"),
100
- f("HOST"),
101
- f("IF_MATCH"),
102
- f("IF_MODIFIED_SINCE"),
103
- f("IF_NONE_MATCH"),
104
- f("IF_RANGE"),
105
- f("IF_UNMODIFIED_SINCE"),
106
- f("KEEP_ALIVE"), /* Firefox sends this */
107
- f("MAX_FORWARDS"),
108
- f("PRAGMA"),
109
- f("PROXY_AUTHORIZATION"),
110
- f("RANGE"),
111
- f("REFERER"),
112
- f("TE"),
113
- f("TRAILER"),
114
- f("TRANSFER_ENCODING"),
115
- f("UPGRADE"),
116
- f("USER_AGENT"),
117
- f("VIA"),
118
- f("X_FORWARDED_FOR"), /* common for proxies */
119
- f("X_REAL_IP"), /* common for proxies */
120
- f("WARNING")
121
- # undef f
122
- };
123
-
124
- static void init_common_fields(void)
125
- {
126
- unsigned i;
127
- struct common_field *cf = common_http_fields;
128
- char tmp[256]; /* MAX_FIELD_NAME_LENGTH */
129
- memcpy(tmp, HTTP_PREFIX, HTTP_PREFIX_LEN);
130
-
131
- for(i = 0; i < ARRAY_SIZE(common_http_fields); cf++, i++) {
132
- rb_global_variable(&cf->value);
133
- if(cf->raw) {
134
- cf->value = rb_enc_interned_str(cf->name, cf->len, rb_utf8_encoding());
135
- } else {
136
- memcpy(tmp + HTTP_PREFIX_LEN, cf->name, cf->len + 1);
137
- cf->value = rb_enc_interned_str(tmp, HTTP_PREFIX_LEN + cf->len, rb_utf8_encoding());
138
- }
139
- }
140
- }
141
-
142
- static VALUE find_common_field_value(const char *field, size_t flen)
143
- {
144
- unsigned i;
145
- struct common_field *cf = common_http_fields;
146
- for(i = 0; i < ARRAY_SIZE(common_http_fields); i++, cf++) {
147
- if (cf->len == flen && !memcmp(cf->name, field, flen))
148
- return cf->value;
149
- }
150
- return Qnil;
151
- }
152
-
153
- static int is_ows(const char c) {
154
- return c == ' ' || c == '\t';
155
- }
156
-
157
- static void http_field(puma_parser* hp, const char *field, size_t flen,
158
- const char *value, size_t vlen)
159
- {
160
- VALUE f = Qnil;
161
- VALUE v;
162
-
163
- VALIDATE_MAX_LENGTH(flen, FIELD_NAME);
164
- VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE);
165
-
166
- f = find_common_field_value(field, flen);
167
-
168
- if (f == Qnil) {
169
- /*
170
- * We got a strange header that we don't have a memoized value for.
171
- * Fallback to creating a new string to use as a hash key.
172
- */
173
-
174
- size_t new_size = HTTP_PREFIX_LEN + flen;
175
- assert(new_size < BUFFER_LEN);
176
-
177
- memcpy(hp->buf, HTTP_PREFIX, HTTP_PREFIX_LEN);
178
- memcpy(hp->buf + HTTP_PREFIX_LEN, field, flen);
179
-
180
- f = rb_enc_interned_str(hp->buf, new_size, rb_utf8_encoding());
181
- }
182
-
183
- while (vlen > 0 && is_ows(value[vlen - 1])) vlen--;
184
- while (vlen > 0 && is_ows(value[0])) {
185
- vlen--;
186
- value++;
187
- }
188
-
189
- /* check for duplicate header */
190
- v = rb_hash_aref(hp->request, f);
191
-
192
- if (v == Qnil) {
193
- v = rb_str_new(value, vlen);
194
- rb_hash_aset(hp->request, f, v);
195
- } else {
196
- /* if duplicate header, normalize to comma-separated values */
197
- rb_str_cat2(v, ", ");
198
- rb_str_cat(v, value, vlen);
199
- }
200
- }
201
-
202
- static void request_method(puma_parser* hp, const char *at, size_t length)
203
- {
204
- VALUE val = Qnil;
205
-
206
- val = rb_str_new(at, length);
207
- rb_hash_aset(hp->request, global_request_method, val);
208
- }
209
-
210
- static void request_uri(puma_parser* hp, const char *at, size_t length)
211
- {
212
- VALUE val = Qnil;
213
-
214
- VALIDATE_MAX_LENGTH(length, REQUEST_URI);
215
-
216
- val = rb_str_new(at, length);
217
- rb_hash_aset(hp->request, global_request_uri, val);
218
- }
219
-
220
- static void fragment(puma_parser* hp, const char *at, size_t length)
221
- {
222
- VALUE val = Qnil;
223
-
224
- VALIDATE_MAX_LENGTH(length, FRAGMENT);
225
-
226
- val = rb_str_new(at, length);
227
- rb_hash_aset(hp->request, global_fragment, val);
228
- }
229
-
230
- static void request_path(puma_parser* hp, const char *at, size_t length)
231
- {
232
- VALUE val = Qnil;
233
-
234
- VALIDATE_MAX_LENGTH(length, REQUEST_PATH);
235
-
236
- val = rb_str_new(at, length);
237
- rb_hash_aset(hp->request, global_request_path, val);
238
- }
239
-
240
- static void query_string(puma_parser* hp, const char *at, size_t length)
241
- {
242
- VALUE val = Qnil;
243
-
244
- VALIDATE_MAX_LENGTH(length, QUERY_STRING);
245
-
246
- val = rb_str_new(at, length);
247
- rb_hash_aset(hp->request, global_query_string, val);
248
- }
249
-
250
- static void server_protocol(puma_parser* hp, const char *at, size_t length)
251
- {
252
- VALUE val = rb_str_new(at, length);
253
- rb_hash_aset(hp->request, global_server_protocol, val);
254
- }
255
-
256
- /** Finalizes the request header to have a bunch of stuff that's
257
- needed. */
258
-
259
- static void header_done(puma_parser* hp, const char *at, size_t length)
260
- {
261
- hp->body = rb_str_new(at, length);
262
- }
263
-
264
-
265
- static void HttpParser_mark(void *ptr) {
266
- puma_parser *hp = ptr;
267
- rb_gc_mark_movable(hp->request);
268
- rb_gc_mark_movable(hp->body);
269
- }
270
-
271
- static size_t HttpParser_size(const void *ptr) {
272
- return sizeof(puma_parser);
273
- }
274
-
275
- static void HttpParser_compact(void *ptr) {
276
- puma_parser *hp = ptr;
277
- hp->request = rb_gc_location(hp->request);
278
- hp->body = rb_gc_location(hp->body);
279
- }
280
-
281
- static const rb_data_type_t HttpParser_data_type = {
282
- .wrap_struct_name = "Puma::HttpParser",
283
- .function = {
284
- .dmark = HttpParser_mark,
285
- .dfree = RUBY_TYPED_DEFAULT_FREE,
286
- .dsize = HttpParser_size,
287
- .dcompact = HttpParser_compact,
288
- },
289
- .flags = RUBY_TYPED_FREE_IMMEDIATELY,
290
- };
291
-
292
- static VALUE HttpParser_alloc(VALUE klass)
293
- {
294
- puma_parser *hp = ALLOC_N(puma_parser, 1);
295
- hp->http_field = http_field;
296
- hp->request_method = request_method;
297
- hp->request_uri = request_uri;
298
- hp->fragment = fragment;
299
- hp->request_path = request_path;
300
- hp->query_string = query_string;
301
- hp->server_protocol = server_protocol;
302
- hp->header_done = header_done;
303
- hp->request = Qnil;
304
-
305
- puma_parser_init(hp);
306
-
307
- return TypedData_Wrap_Struct(klass, &HttpParser_data_type, hp);
308
- }
309
-
310
- static inline puma_parser *HttpParser_unwrap(VALUE self)
311
- {
312
- puma_parser *http;
313
- TypedData_Get_Struct(self, puma_parser, &HttpParser_data_type, http);
314
- if (http == NULL) {
315
- rb_raise(rb_eArgError, "%s", "NULL http_parser found");
316
- }
317
- return http;
318
- }
319
-
320
- /**
321
- * call-seq:
322
- * parser.new -> parser
323
- *
324
- * Creates a new parser.
325
- */
326
- static VALUE HttpParser_init(VALUE self)
327
- {
328
- puma_parser *http = HttpParser_unwrap(self);
329
- puma_parser_init(http);
330
-
331
- return self;
332
- }
333
-
334
-
335
- /**
336
- * call-seq:
337
- * parser.reset -> nil
338
- *
339
- * Resets the parser to it's initial state so that you can reuse it
340
- * rather than making new ones.
341
- */
342
- static VALUE HttpParser_reset(VALUE self)
343
- {
344
- puma_parser *http = HttpParser_unwrap(self);
345
- puma_parser_init(http);
346
-
347
- return Qnil;
348
- }
349
-
350
-
351
- /**
352
- * call-seq:
353
- * parser.finish -> true/false
354
- *
355
- * Finishes a parser early which could put in a "good" or bad state.
356
- * You should call reset after finish it or bad things will happen.
357
- */
358
- static VALUE HttpParser_finish(VALUE self)
359
- {
360
- puma_parser *http = HttpParser_unwrap(self);
361
- puma_parser_finish(http);
362
-
363
- return puma_parser_is_finished(http) ? Qtrue : Qfalse;
364
- }
365
-
366
-
367
- /**
368
- * call-seq:
369
- * parser.execute(req_hash, data, start) -> Integer
370
- *
371
- * Takes a Hash and a String of data, parses the String of data filling in the Hash
372
- * returning an Integer to indicate how much of the data has been read. No matter
373
- * what the return value, you should call HttpParser#finished? and HttpParser#error?
374
- * to figure out if it's done parsing or there was an error.
375
- *
376
- * This function now throws an exception when there is a parsing error. This makes
377
- * the logic for working with the parser much easier. You can still test for an
378
- * error, but now you need to wrap the parser with an exception handling block.
379
- *
380
- * The third argument allows for parsing a partial request and then continuing
381
- * the parsing from that position. It needs all of the original data as well
382
- * so you have to append to the data buffer as you read.
383
- */
384
- static VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data, VALUE start)
385
- {
386
- puma_parser *http = HttpParser_unwrap(self);
387
- int from = 0;
388
- char *dptr = NULL;
389
- long dlen = 0;
390
-
391
- from = FIX2INT(start);
392
- dptr = RSTRING_PTR(data);
393
- dlen = (long)RSTRING_LEN(data);
394
-
395
- if(from >= dlen) {
396
- rb_raise(eHttpParserError, "%s", "Requested start is after data buffer end.");
397
- } else {
398
- http->request = req_hash;
399
- puma_parser_execute(http, dptr, dlen, from);
400
-
401
- VALIDATE_MAX_LENGTH(puma_parser_nread(http), HEADER);
402
-
403
- if(puma_parser_has_error(http)) {
404
- rb_raise(eHttpParserError, "%s", "Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?");
405
- } else {
406
- return SIZET2NUM(puma_parser_nread(http));
407
- }
408
- }
409
- }
410
-
411
-
412
-
413
- /**
414
- * call-seq:
415
- * parser.error? -> true/false
416
- *
417
- * Tells you whether the parser is in an error state.
418
- */
419
- static VALUE HttpParser_has_error(VALUE self)
420
- {
421
- puma_parser *http = HttpParser_unwrap(self);
422
-
423
- return puma_parser_has_error(http) ? Qtrue : Qfalse;
424
- }
425
-
426
-
427
- /**
428
- * call-seq:
429
- * parser.finished? -> true/false
430
- *
431
- * Tells you whether the parser is finished or not and in a good state.
432
- */
433
- static VALUE HttpParser_is_finished(VALUE self)
434
- {
435
- puma_parser *http = HttpParser_unwrap(self);
436
-
437
- return puma_parser_is_finished(http) ? Qtrue : Qfalse;
438
- }
439
-
440
-
441
- /**
442
- * call-seq:
443
- * parser.nread -> Integer
444
- *
445
- * Returns the amount of data processed so far during this processing cycle. It is
446
- * set to 0 on initialize or reset calls and is incremented each time execute is called.
447
- */
448
- static VALUE HttpParser_nread(VALUE self)
449
- {
450
- puma_parser *http = HttpParser_unwrap(self);
451
-
452
- return SIZET2NUM(http->nread);
453
- }
454
-
455
- /**
456
- * call-seq:
457
- * parser.body -> nil or String
458
- *
459
- * If the request included a body, returns it.
460
- */
461
- static VALUE HttpParser_body(VALUE self) {
462
- puma_parser *http = HttpParser_unwrap(self);
463
-
464
- return http->body;
465
- }
466
-
467
- /**
468
- * call-seq:
469
- * Puma.enable_child_subreaper -> true or false
470
- *
471
- * Marks the calling process as a child subreaper so that orphaned descendants
472
- * are reparented to it. Returns false where this is unsupported.
473
- */
474
- static VALUE Puma_enable_child_subreaper(VALUE self) {
475
- #ifdef HAVE_PRCTL
476
- if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) {
477
- rb_sys_fail("prctl(PR_SET_CHILD_SUBREAPER)");
478
- }
479
- return Qtrue;
480
- #else
481
- return Qfalse;
482
- #endif
483
- }
484
-
485
- #ifdef HAVE_OPENSSL_BIO_H
486
- void Init_mini_ssl(VALUE mod);
487
- #endif
488
-
489
- RUBY_FUNC_EXPORTED void Init_puma_http11(void)
490
- {
491
- #ifdef HAVE_RB_EXT_RACTOR_SAFE
492
- rb_ext_ractor_safe(true);
493
- #endif
494
-
495
- VALUE mPuma = rb_define_module("Puma");
496
- VALUE cHttpParser = rb_define_class_under(mPuma, "HttpParser", rb_cObject);
497
-
498
- DEF_GLOBAL(&global_request_method, "REQUEST_METHOD");
499
- DEF_GLOBAL(&global_request_uri, "REQUEST_URI");
500
- DEF_GLOBAL(&global_fragment, "FRAGMENT");
501
- DEF_GLOBAL(&global_query_string, "QUERY_STRING");
502
- DEF_GLOBAL(&global_server_protocol, "SERVER_PROTOCOL");
503
- DEF_GLOBAL(&global_request_path, "REQUEST_PATH");
504
-
505
- rb_global_variable(&eHttpParserError);
506
- eHttpParserError = rb_define_class_under(mPuma, "HttpParserError", rb_eStandardError);
507
-
508
- rb_define_singleton_method(mPuma, "enable_child_subreaper", Puma_enable_child_subreaper, 0);
509
-
510
- rb_define_alloc_func(cHttpParser, HttpParser_alloc);
511
- rb_define_method(cHttpParser, "initialize", HttpParser_init, 0);
512
- rb_define_method(cHttpParser, "reset", HttpParser_reset, 0);
513
- rb_define_method(cHttpParser, "finish", HttpParser_finish, 0);
514
- rb_define_method(cHttpParser, "execute", HttpParser_execute, 3);
515
- rb_define_method(cHttpParser, "error?", HttpParser_has_error, 0);
516
- rb_define_method(cHttpParser, "finished?", HttpParser_is_finished, 0);
517
- rb_define_method(cHttpParser, "nread", HttpParser_nread, 0);
518
- rb_define_method(cHttpParser, "body", HttpParser_body, 0);
519
- init_common_fields();
520
-
521
- #ifdef HAVE_OPENSSL_BIO_H
522
- Init_mini_ssl(mPuma);
523
- #endif
524
- }
data/tools/Dockerfile DELETED
@@ -1,26 +0,0 @@
1
- # Use this Dockerfile to create minimal reproductions of issues
2
- # Build (MRI): docker build -f tools/Dockerfile .
3
- # Build (JRuby): docker build -f tools/Dockerfile --build-arg RUBY_IMAGE=jruby:9.4 .
4
-
5
- ARG RUBY_IMAGE=ruby:latest
6
- FROM ${RUBY_IMAGE}
7
-
8
- # Set BUNDLE_FROZEN=false if you need to update Gemfile.lock during a build.
9
- ARG BUNDLE_FROZEN=true
10
-
11
- RUN apt-get update \
12
- && apt-get install -y --no-install-recommends ragel procps git \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Only freeze Bundler and compile native extensions when using MRI.
16
- RUN if [ "$(ruby -e 'print RUBY_ENGINE')" = "ruby" ] && [ "${BUNDLE_FROZEN}" = "true" ]; then bundle config --global frozen 1; fi
17
-
18
- WORKDIR /usr/src/app
19
-
20
- COPY . .
21
-
22
- RUN bundle install
23
- RUN if [ "$(ruby -e 'print RUBY_ENGINE')" = "ruby" ]; then bundle exec rake compile; fi
24
-
25
- EXPOSE 9292
26
- CMD ["bundle", "exec", "bin/puma", "test/rackup/hello.ru"]
data/tools/trickletest.rb DELETED
@@ -1,44 +0,0 @@
1
- require 'socket'
2
- require 'stringio'
3
-
4
- def do_test(st, chunk)
5
- s = TCPSocket.new('127.0.0.1',ARGV[0].to_i);
6
- req = StringIO.new(st)
7
- nout = 0
8
- randstop = rand(st.length / 10)
9
- STDERR.puts "stopping after: #{randstop}"
10
-
11
- begin
12
- while data = req.read(chunk)
13
- nout += s.write(data)
14
- s.flush
15
- sleep 0.1
16
- if nout > randstop
17
- STDERR.puts "BANG! after #{nout} bytes."
18
- break
19
- end
20
- end
21
- rescue Object => e
22
- STDERR.puts "ERROR: #{e}"
23
- ensure
24
- s.close
25
- end
26
- end
27
-
28
- content = "-" * (1024 * 240)
29
- st = "GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\nContent-Length: #{content.length}\r\n\r\n#{content}"
30
-
31
- puts "length: #{content.length}"
32
-
33
- threads = []
34
- ARGV[1].to_i.times do
35
- t = Thread.new do
36
- size = 100
37
- puts ">>>> #{size} sized chunks"
38
- do_test(st, size)
39
- end
40
-
41
- threads << t
42
- end
43
-
44
- threads.each {|t| t.join}
File without changes
File without changes
File without changes
File without changes
File without changes