mega-max-tool 0.0.1
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.
- checksums.yaml +7 -0
- data/mega-max-tool.gemspec +12 -0
- data/unicorn-6.1.0/Application_Timeouts +77 -0
- data/unicorn-6.1.0/CONTRIBUTORS +39 -0
- data/unicorn-6.1.0/COPYING +674 -0
- data/unicorn-6.1.0/DESIGN +95 -0
- data/unicorn-6.1.0/Documentation/unicorn.1 +222 -0
- data/unicorn-6.1.0/Documentation/unicorn_rails.1 +207 -0
- data/unicorn-6.1.0/FAQ +70 -0
- data/unicorn-6.1.0/GIT-VERSION-FILE +1 -0
- data/unicorn-6.1.0/GIT-VERSION-GEN +39 -0
- data/unicorn-6.1.0/GNUmakefile +313 -0
- data/unicorn-6.1.0/HACKING +112 -0
- data/unicorn-6.1.0/ISSUES +97 -0
- data/unicorn-6.1.0/KNOWN_ISSUES +79 -0
- data/unicorn-6.1.0/LATEST +24 -0
- data/unicorn-6.1.0/LICENSE +67 -0
- data/unicorn-6.1.0/Links +58 -0
- data/unicorn-6.1.0/NEWS +2890 -0
- data/unicorn-6.1.0/PHILOSOPHY +139 -0
- data/unicorn-6.1.0/README +151 -0
- data/unicorn-6.1.0/Rakefile +16 -0
- data/unicorn-6.1.0/SIGNALS +123 -0
- data/unicorn-6.1.0/Sandbox +104 -0
- data/unicorn-6.1.0/TODO +3 -0
- data/unicorn-6.1.0/TUNING +119 -0
- data/unicorn-6.1.0/archive/slrnpull.conf +4 -0
- data/unicorn-6.1.0/bin/unicorn +128 -0
- data/unicorn-6.1.0/bin/unicorn_rails +209 -0
- data/unicorn-6.1.0/examples/big_app_gc.rb +2 -0
- data/unicorn-6.1.0/examples/echo.ru +27 -0
- data/unicorn-6.1.0/examples/init.sh +102 -0
- data/unicorn-6.1.0/examples/logger_mp_safe.rb +25 -0
- data/unicorn-6.1.0/examples/logrotate.conf +44 -0
- data/unicorn-6.1.0/examples/nginx.conf +156 -0
- data/unicorn-6.1.0/examples/unicorn.conf.minimal.rb +13 -0
- data/unicorn-6.1.0/examples/unicorn.conf.rb +110 -0
- data/unicorn-6.1.0/examples/unicorn.socket +11 -0
- data/unicorn-6.1.0/examples/unicorn@.service +40 -0
- data/unicorn-6.1.0/ext/unicorn_http/CFLAGS +13 -0
- data/unicorn-6.1.0/ext/unicorn_http/c_util.h +116 -0
- data/unicorn-6.1.0/ext/unicorn_http/common_field_optimization.h +128 -0
- data/unicorn-6.1.0/ext/unicorn_http/epollexclusive.h +124 -0
- data/unicorn-6.1.0/ext/unicorn_http/ext_help.h +38 -0
- data/unicorn-6.1.0/ext/unicorn_http/extconf.rb +37 -0
- data/unicorn-6.1.0/ext/unicorn_http/global_variables.h +97 -0
- data/unicorn-6.1.0/ext/unicorn_http/httpdate.c +79 -0
- data/unicorn-6.1.0/ext/unicorn_http/unicorn_http.c +4319 -0
- data/unicorn-6.1.0/ext/unicorn_http/unicorn_http.rl +1025 -0
- data/unicorn-6.1.0/ext/unicorn_http/unicorn_http_common.rl +76 -0
- data/unicorn-6.1.0/lib/unicorn/app/old_rails/static.rb +59 -0
- data/unicorn-6.1.0/lib/unicorn/app/old_rails.rb +35 -0
- data/unicorn-6.1.0/lib/unicorn/cgi_wrapper.rb +147 -0
- data/unicorn-6.1.0/lib/unicorn/configurator.rb +743 -0
- data/unicorn-6.1.0/lib/unicorn/const.rb +21 -0
- data/unicorn-6.1.0/lib/unicorn/http_request.rb +201 -0
- data/unicorn-6.1.0/lib/unicorn/http_response.rb +61 -0
- data/unicorn-6.1.0/lib/unicorn/http_server.rb +893 -0
- data/unicorn-6.1.0/lib/unicorn/launcher.rb +62 -0
- data/unicorn-6.1.0/lib/unicorn/oob_gc.rb +81 -0
- data/unicorn-6.1.0/lib/unicorn/preread_input.rb +33 -0
- data/unicorn-6.1.0/lib/unicorn/select_waiter.rb +6 -0
- data/unicorn-6.1.0/lib/unicorn/socket_helper.rb +211 -0
- data/unicorn-6.1.0/lib/unicorn/stream_input.rb +147 -0
- data/unicorn-6.1.0/lib/unicorn/tee_input.rb +131 -0
- data/unicorn-6.1.0/lib/unicorn/tmpio.rb +33 -0
- data/unicorn-6.1.0/lib/unicorn/util.rb +90 -0
- data/unicorn-6.1.0/lib/unicorn/version.rb +1 -0
- data/unicorn-6.1.0/lib/unicorn/worker.rb +165 -0
- data/unicorn-6.1.0/lib/unicorn.rb +138 -0
- data/unicorn-6.1.0/man/man1/unicorn.1 +222 -0
- data/unicorn-6.1.0/man/man1/unicorn_rails.1 +207 -0
- data/unicorn-6.1.0/setup.rb +1586 -0
- data/unicorn-6.1.0/t/GNUmakefile +5 -0
- data/unicorn-6.1.0/t/README +42 -0
- data/unicorn-6.1.0/t/bin/content-md5-put +36 -0
- data/unicorn-6.1.0/t/bin/sha1sum.rb +17 -0
- data/unicorn-6.1.0/t/bin/unused_listen +40 -0
- data/unicorn-6.1.0/t/broken-app.ru +12 -0
- data/unicorn-6.1.0/t/detach.ru +11 -0
- data/unicorn-6.1.0/t/env.ru +3 -0
- data/unicorn-6.1.0/t/fails-rack-lint.ru +5 -0
- data/unicorn-6.1.0/t/heartbeat-timeout.ru +12 -0
- data/unicorn-6.1.0/t/listener_names.ru +4 -0
- data/unicorn-6.1.0/t/my-tap-lib.sh +201 -0
- data/unicorn-6.1.0/t/oob_gc.ru +20 -0
- data/unicorn-6.1.0/t/oob_gc_path.ru +20 -0
- data/unicorn-6.1.0/t/pid.ru +3 -0
- data/unicorn-6.1.0/t/preread_input.ru +17 -0
- data/unicorn-6.1.0/t/rack-input-tests.ru +21 -0
- data/unicorn-6.1.0/t/t0000-http-basic.sh +50 -0
- data/unicorn-6.1.0/t/t0001-reload-bad-config.sh +53 -0
- data/unicorn-6.1.0/t/t0002-config-conflict.sh +49 -0
- data/unicorn-6.1.0/t/t0002-parser-error.sh +94 -0
- data/unicorn-6.1.0/t/t0003-working_directory.sh +51 -0
- data/unicorn-6.1.0/t/t0004-heartbeat-timeout.sh +69 -0
- data/unicorn-6.1.0/t/t0004-working_directory_broken.sh +24 -0
- data/unicorn-6.1.0/t/t0005-working_directory_app.rb.sh +40 -0
- data/unicorn-6.1.0/t/t0006-reopen-logs.sh +83 -0
- data/unicorn-6.1.0/t/t0006.ru +13 -0
- data/unicorn-6.1.0/t/t0007-working_directory_no_embed_cli.sh +44 -0
- data/unicorn-6.1.0/t/t0008-back_out_of_upgrade.sh +110 -0
- data/unicorn-6.1.0/t/t0009-broken-app.sh +56 -0
- data/unicorn-6.1.0/t/t0009-winch_ttin.sh +59 -0
- data/unicorn-6.1.0/t/t0010-reap-logging.sh +55 -0
- data/unicorn-6.1.0/t/t0011-active-unix-socket.sh +79 -0
- data/unicorn-6.1.0/t/t0012-reload-empty-config.sh +86 -0
- data/unicorn-6.1.0/t/t0013-rewindable-input-false.sh +24 -0
- data/unicorn-6.1.0/t/t0013.ru +12 -0
- data/unicorn-6.1.0/t/t0014-rewindable-input-true.sh +24 -0
- data/unicorn-6.1.0/t/t0014.ru +12 -0
- data/unicorn-6.1.0/t/t0015-configurator-internals.sh +25 -0
- data/unicorn-6.1.0/t/t0018-write-on-close.sh +23 -0
- data/unicorn-6.1.0/t/t0019-max_header_len.sh +49 -0
- data/unicorn-6.1.0/t/t0020-at_exit-handler.sh +49 -0
- data/unicorn-6.1.0/t/t0021-process_detach.sh +29 -0
- data/unicorn-6.1.0/t/t0022-listener_names-preload_app.sh +32 -0
- data/unicorn-6.1.0/t/t0100-rack-input-tests.sh +124 -0
- data/unicorn-6.1.0/t/t0116-client_body_buffer_size.sh +80 -0
- data/unicorn-6.1.0/t/t0116.ru +16 -0
- data/unicorn-6.1.0/t/t0300-no-default-middleware.sh +20 -0
- data/unicorn-6.1.0/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
- data/unicorn-6.1.0/t/t0301.ru +13 -0
- data/unicorn-6.1.0/t/t9000-preread-input.sh +48 -0
- data/unicorn-6.1.0/t/t9001-oob_gc.sh +47 -0
- data/unicorn-6.1.0/t/t9002-oob_gc-path.sh +75 -0
- data/unicorn-6.1.0/t/test-lib.sh +129 -0
- data/unicorn-6.1.0/t/write-on-close.ru +11 -0
- data/unicorn-6.1.0/test/aggregate.rb +15 -0
- data/unicorn-6.1.0/test/benchmark/README +60 -0
- data/unicorn-6.1.0/test/benchmark/dd.ru +18 -0
- data/unicorn-6.1.0/test/benchmark/ddstream.ru +50 -0
- data/unicorn-6.1.0/test/benchmark/readinput.ru +40 -0
- data/unicorn-6.1.0/test/benchmark/stack.ru +8 -0
- data/unicorn-6.1.0/test/benchmark/uconnect.perl +66 -0
- data/unicorn-6.1.0/test/exec/README +5 -0
- data/unicorn-6.1.0/test/exec/test_exec.rb +1101 -0
- data/unicorn-6.1.0/test/test_helper.rb +306 -0
- data/unicorn-6.1.0/test/unit/test_ccc.rb +91 -0
- data/unicorn-6.1.0/test/unit/test_configurator.rb +175 -0
- data/unicorn-6.1.0/test/unit/test_droplet.rb +28 -0
- data/unicorn-6.1.0/test/unit/test_http_parser.rb +884 -0
- data/unicorn-6.1.0/test/unit/test_http_parser_ng.rb +714 -0
- data/unicorn-6.1.0/test/unit/test_request.rb +182 -0
- data/unicorn-6.1.0/test/unit/test_response.rb +111 -0
- data/unicorn-6.1.0/test/unit/test_server.rb +342 -0
- data/unicorn-6.1.0/test/unit/test_signals.rb +188 -0
- data/unicorn-6.1.0/test/unit/test_socket_helper.rb +201 -0
- data/unicorn-6.1.0/test/unit/test_stream_input.rb +203 -0
- data/unicorn-6.1.0/test/unit/test_tee_input.rb +304 -0
- data/unicorn-6.1.0/test/unit/test_upload.rb +301 -0
- data/unicorn-6.1.0/test/unit/test_util.rb +131 -0
- data/unicorn-6.1.0/test/unit/test_waiter.rb +34 -0
- data/unicorn-6.1.0/unicorn.gemspec +49 -0
- data/unicorn-6.1.0/unicorn_1 +1 -0
- data/unicorn-6.1.0/unicorn_rails_1 +1 -0
- metadata +196 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#ifndef global_variables_h
|
|
2
|
+
#define global_variables_h
|
|
3
|
+
static VALUE eHttpParserError;
|
|
4
|
+
static VALUE e413;
|
|
5
|
+
static VALUE e414;
|
|
6
|
+
|
|
7
|
+
static VALUE g_rack_url_scheme;
|
|
8
|
+
static VALUE g_request_method;
|
|
9
|
+
static VALUE g_request_uri;
|
|
10
|
+
static VALUE g_fragment;
|
|
11
|
+
static VALUE g_query_string;
|
|
12
|
+
static VALUE g_http_version;
|
|
13
|
+
static VALUE g_request_path;
|
|
14
|
+
static VALUE g_path_info;
|
|
15
|
+
static VALUE g_server_name;
|
|
16
|
+
static VALUE g_server_port;
|
|
17
|
+
static VALUE g_server_protocol;
|
|
18
|
+
static VALUE g_http_host;
|
|
19
|
+
static VALUE g_http_x_forwarded_proto;
|
|
20
|
+
static VALUE g_http_x_forwarded_ssl;
|
|
21
|
+
static VALUE g_http_transfer_encoding;
|
|
22
|
+
static VALUE g_content_length;
|
|
23
|
+
static VALUE g_http_trailer;
|
|
24
|
+
static VALUE g_http_connection;
|
|
25
|
+
static VALUE g_port_80;
|
|
26
|
+
static VALUE g_port_443;
|
|
27
|
+
static VALUE g_localhost;
|
|
28
|
+
static VALUE g_http;
|
|
29
|
+
static VALUE g_https;
|
|
30
|
+
static VALUE g_http_09;
|
|
31
|
+
static VALUE g_http_10;
|
|
32
|
+
static VALUE g_http_11;
|
|
33
|
+
|
|
34
|
+
/** Defines common length and error messages for input length validation. */
|
|
35
|
+
#define DEF_MAX_LENGTH(N, length) \
|
|
36
|
+
static const size_t MAX_##N##_LENGTH = length; \
|
|
37
|
+
static const char * const MAX_##N##_LENGTH_ERR = \
|
|
38
|
+
"HTTP element " # N " is longer than the " # length " allowed length."
|
|
39
|
+
|
|
40
|
+
NORETURN(static void parser_raise(VALUE klass, const char *));
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Validates the max length of given input and throws an HttpParserError
|
|
44
|
+
* exception if over.
|
|
45
|
+
*/
|
|
46
|
+
#define VALIDATE_MAX_LENGTH(len, N) do { \
|
|
47
|
+
if (len > MAX_##N##_LENGTH) \
|
|
48
|
+
parser_raise(eHttpParserError, MAX_##N##_LENGTH_ERR); \
|
|
49
|
+
} while (0)
|
|
50
|
+
|
|
51
|
+
#define VALIDATE_MAX_URI_LENGTH(len, N) do { \
|
|
52
|
+
if (len > MAX_##N##_LENGTH) \
|
|
53
|
+
parser_raise(e414, MAX_##N##_LENGTH_ERR); \
|
|
54
|
+
} while (0)
|
|
55
|
+
|
|
56
|
+
/** Defines global strings in the init method. */
|
|
57
|
+
#define DEF_GLOBAL(N, val) do { \
|
|
58
|
+
g_##N = str_new_dd_freeze(val, (long)sizeof(val) - 1); \
|
|
59
|
+
rb_gc_register_mark_object(g_##N); \
|
|
60
|
+
} while (0)
|
|
61
|
+
|
|
62
|
+
/* Defines the maximum allowed lengths for various input elements.*/
|
|
63
|
+
DEF_MAX_LENGTH(FIELD_NAME, 256);
|
|
64
|
+
DEF_MAX_LENGTH(FIELD_VALUE, 80 * 1024);
|
|
65
|
+
DEF_MAX_LENGTH(REQUEST_URI, 1024 * 15);
|
|
66
|
+
DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewhere or not */
|
|
67
|
+
DEF_MAX_LENGTH(REQUEST_PATH, 4096); /* common PATH_MAX on modern systems */
|
|
68
|
+
DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10));
|
|
69
|
+
|
|
70
|
+
static void init_globals(void)
|
|
71
|
+
{
|
|
72
|
+
DEF_GLOBAL(rack_url_scheme, "rack.url_scheme");
|
|
73
|
+
DEF_GLOBAL(request_method, "REQUEST_METHOD");
|
|
74
|
+
DEF_GLOBAL(request_uri, "REQUEST_URI");
|
|
75
|
+
DEF_GLOBAL(fragment, "FRAGMENT");
|
|
76
|
+
DEF_GLOBAL(query_string, "QUERY_STRING");
|
|
77
|
+
DEF_GLOBAL(http_version, "HTTP_VERSION");
|
|
78
|
+
DEF_GLOBAL(request_path, "REQUEST_PATH");
|
|
79
|
+
DEF_GLOBAL(path_info, "PATH_INFO");
|
|
80
|
+
DEF_GLOBAL(server_name, "SERVER_NAME");
|
|
81
|
+
DEF_GLOBAL(server_port, "SERVER_PORT");
|
|
82
|
+
DEF_GLOBAL(server_protocol, "SERVER_PROTOCOL");
|
|
83
|
+
DEF_GLOBAL(http_x_forwarded_proto, "HTTP_X_FORWARDED_PROTO");
|
|
84
|
+
DEF_GLOBAL(http_x_forwarded_ssl, "HTTP_X_FORWARDED_SSL");
|
|
85
|
+
DEF_GLOBAL(port_80, "80");
|
|
86
|
+
DEF_GLOBAL(port_443, "443");
|
|
87
|
+
DEF_GLOBAL(localhost, "localhost");
|
|
88
|
+
DEF_GLOBAL(http, "http");
|
|
89
|
+
DEF_GLOBAL(https, "https");
|
|
90
|
+
DEF_GLOBAL(http_11, "HTTP/1.1");
|
|
91
|
+
DEF_GLOBAL(http_10, "HTTP/1.0");
|
|
92
|
+
DEF_GLOBAL(http_09, "HTTP/0.9");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#undef DEF_GLOBAL
|
|
96
|
+
|
|
97
|
+
#endif /* global_variables_h */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#include <ruby.h>
|
|
2
|
+
#include <time.h>
|
|
3
|
+
#include <stdio.h>
|
|
4
|
+
|
|
5
|
+
static const size_t buf_capa = sizeof("Thu, 01 Jan 1970 00:00:00 GMT");
|
|
6
|
+
static VALUE buf;
|
|
7
|
+
static char *buf_ptr;
|
|
8
|
+
static const char week[] = "Sun\0Mon\0Tue\0Wed\0Thu\0Fri\0Sat";
|
|
9
|
+
static const char months[] = "Jan\0Feb\0Mar\0Apr\0May\0Jun\0"
|
|
10
|
+
"Jul\0Aug\0Sep\0Oct\0Nov\0Dec";
|
|
11
|
+
|
|
12
|
+
/* for people on wonky systems only */
|
|
13
|
+
#ifndef HAVE_GMTIME_R
|
|
14
|
+
# warning using fake gmtime_r
|
|
15
|
+
static struct tm * my_gmtime_r(time_t *now, struct tm *tm)
|
|
16
|
+
{
|
|
17
|
+
struct tm *global = gmtime(now);
|
|
18
|
+
if (global)
|
|
19
|
+
*tm = *global;
|
|
20
|
+
return tm;
|
|
21
|
+
}
|
|
22
|
+
# define gmtime_r my_gmtime_r
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* Returns a string which represents the time as rfc1123-date of HTTP-date
|
|
28
|
+
* defined by RFC 2616:
|
|
29
|
+
*
|
|
30
|
+
* day-of-week, DD month-name CCYY hh:mm:ss GMT
|
|
31
|
+
*
|
|
32
|
+
* Note that the result is always GMT.
|
|
33
|
+
*
|
|
34
|
+
* This method is identical to Time#httpdate in the Ruby standard library,
|
|
35
|
+
* except it is implemented in C for performance. We always saw
|
|
36
|
+
* Time#httpdate at or near the top of the profiler output so we
|
|
37
|
+
* decided to rewrite this in C.
|
|
38
|
+
*
|
|
39
|
+
* Caveats: it relies on a Ruby implementation with the global VM lock,
|
|
40
|
+
* a thread-safe version will be provided when a Unix-only, GVL-free Ruby
|
|
41
|
+
* implementation becomes viable.
|
|
42
|
+
*/
|
|
43
|
+
static VALUE httpdate(VALUE self)
|
|
44
|
+
{
|
|
45
|
+
static time_t last;
|
|
46
|
+
time_t now = time(NULL); /* not a syscall on modern 64-bit systems */
|
|
47
|
+
struct tm tm;
|
|
48
|
+
|
|
49
|
+
if (last == now)
|
|
50
|
+
return buf;
|
|
51
|
+
last = now;
|
|
52
|
+
gmtime_r(&now, &tm);
|
|
53
|
+
|
|
54
|
+
/* we can make this thread-safe later if our Ruby loses the GVL */
|
|
55
|
+
snprintf(buf_ptr, buf_capa,
|
|
56
|
+
"%s, %02d %s %4d %02d:%02d:%02d GMT",
|
|
57
|
+
week + (tm.tm_wday * 4),
|
|
58
|
+
tm.tm_mday,
|
|
59
|
+
months + (tm.tm_mon * 4),
|
|
60
|
+
tm.tm_year + 1900,
|
|
61
|
+
tm.tm_hour,
|
|
62
|
+
tm.tm_min,
|
|
63
|
+
tm.tm_sec);
|
|
64
|
+
|
|
65
|
+
return buf;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void init_unicorn_httpdate(void)
|
|
69
|
+
{
|
|
70
|
+
VALUE mod = rb_define_module("Unicorn");
|
|
71
|
+
mod = rb_define_module_under(mod, "HttpResponse");
|
|
72
|
+
|
|
73
|
+
buf = rb_str_new(0, buf_capa - 1);
|
|
74
|
+
rb_gc_register_mark_object(buf);
|
|
75
|
+
buf_ptr = RSTRING_PTR(buf);
|
|
76
|
+
httpdate(Qnil);
|
|
77
|
+
|
|
78
|
+
rb_define_method(mod, "httpdate", httpdate, 0);
|
|
79
|
+
}
|