unicorn 3.6.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -0
- data/.manifest +13 -0
- data/ChangeLog +783 -1
- data/DESIGN +0 -8
- data/Documentation/GNUmakefile +1 -1
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +2 -2
- data/HACKING +11 -0
- data/KNOWN_ISSUES +2 -2
- data/LATEST +24 -24
- data/Links +53 -0
- data/NEWS +66 -0
- data/PHILOSOPHY +49 -49
- data/Sandbox +13 -4
- data/TODO +0 -2
- data/TUNING +31 -9
- data/bin/unicorn +2 -1
- data/bin/unicorn_rails +2 -1
- data/examples/big_app_gc.rb +2 -33
- data/examples/nginx.conf +17 -4
- data/ext/unicorn_http/ext_help.h +16 -0
- data/ext/unicorn_http/extconf.rb +1 -0
- data/ext/unicorn_http/global_variables.h +9 -3
- data/ext/unicorn_http/unicorn_http.c +357 -259
- data/ext/unicorn_http/unicorn_http.rl +148 -50
- data/lib/unicorn/configurator.rb +36 -8
- data/lib/unicorn/const.rb +5 -3
- data/lib/unicorn/http_request.rb +1 -3
- data/lib/unicorn/http_server.rb +82 -95
- data/lib/unicorn/oob_gc.rb +61 -50
- data/lib/unicorn/socket_helper.rb +23 -8
- data/lib/unicorn/worker.rb +45 -4
- data/lib/unicorn.rb +8 -6
- data/script/isolate_for_tests +4 -2
- data/t/broken-app.ru +12 -0
- data/t/heartbeat-timeout.ru +12 -0
- data/t/oob_gc.ru +21 -0
- data/t/oob_gc_path.ru +21 -0
- data/t/t0001-reload-bad-config.sh +1 -0
- data/t/t0002-parser-error.sh +64 -1
- data/t/t0004-heartbeat-timeout.sh +69 -0
- data/t/t0009-broken-app.sh +56 -0
- data/t/t0019-max_header_len.sh +49 -0
- data/t/t0020-at_exit-handler.sh +49 -0
- data/t/t9001-oob_gc.sh +47 -0
- data/t/t9002-oob_gc-path.sh +75 -0
- data/test/benchmark/stack.ru +8 -0
- data/test/unit/test_droplet.rb +28 -0
- data/test/unit/test_http_parser.rb +60 -4
- data/test/unit/test_http_parser_ng.rb +54 -0
- data/test/unit/test_response.rb +1 -1
- data/test/unit/test_server.rb +1 -1
- data/test/unit/test_signals.rb +1 -1
- data/test/unit/test_socket_helper.rb +8 -0
- data/test/unit/test_upload.rb +1 -1
- data/unicorn.gemspec +3 -2
- metadata +44 -16
data/ext/unicorn_http/ext_help.h
CHANGED
@@ -36,6 +36,22 @@ static void rb_18_str_set_len(VALUE str, long len)
|
|
36
36
|
# endif
|
37
37
|
#endif /* ! defined(OFFT2NUM) */
|
38
38
|
|
39
|
+
#if !defined(SIZET2NUM)
|
40
|
+
# if SIZEOF_SIZE_T == SIZEOF_LONG
|
41
|
+
# define SIZET2NUM(n) ULONG2NUM(n)
|
42
|
+
# else
|
43
|
+
# define SIZET2NUM(n) ULL2NUM(n)
|
44
|
+
# endif
|
45
|
+
#endif /* ! defined(SIZET2NUM) */
|
46
|
+
|
47
|
+
#if !defined(NUM2SIZET)
|
48
|
+
# if SIZEOF_SIZE_T == SIZEOF_LONG
|
49
|
+
# define NUM2SIZET(n) ((size_t)NUM2ULONG(n))
|
50
|
+
# else
|
51
|
+
# define NUM2SIZET(n) ((size_t)NUM2ULL(n))
|
52
|
+
# endif
|
53
|
+
#endif /* ! defined(NUM2SIZET) */
|
54
|
+
|
39
55
|
#ifndef HAVE_RB_STR_MODIFY
|
40
56
|
# define rb_str_modify(x) do {} while (0)
|
41
57
|
#endif /* ! defined(HAVE_RB_STR_MODIFY) */
|
data/ext/unicorn_http/extconf.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'mkmf'
|
3
3
|
|
4
4
|
have_macro("SIZEOF_OFF_T", "ruby.h") or check_sizeof("off_t", "sys/types.h")
|
5
|
+
have_macro("SIZEOF_SIZE_T", "ruby.h") or check_sizeof("size_t", "sys/types.h")
|
5
6
|
have_macro("SIZEOF_LONG", "ruby.h") or check_sizeof("long", "sys/types.h")
|
6
7
|
have_func("rb_str_set_len", "ruby.h")
|
7
8
|
have_func("gmtime_r", "time.h")
|
@@ -1,6 +1,8 @@
|
|
1
1
|
#ifndef global_variables_h
|
2
2
|
#define global_variables_h
|
3
3
|
static VALUE eHttpParserError;
|
4
|
+
static VALUE e413;
|
5
|
+
static VALUE e414;
|
4
6
|
|
5
7
|
static VALUE g_rack_url_scheme;
|
6
8
|
static VALUE g_request_method;
|
@@ -35,7 +37,7 @@ static VALUE g_http_11;
|
|
35
37
|
static const char * const MAX_##N##_LENGTH_ERR = \
|
36
38
|
"HTTP element " # N " is longer than the " # length " allowed length."
|
37
39
|
|
38
|
-
NORETURN(static void
|
40
|
+
NORETURN(static void parser_raise(VALUE klass, const char *));
|
39
41
|
|
40
42
|
/**
|
41
43
|
* Validates the max length of given input and throws an HttpParserError
|
@@ -43,7 +45,12 @@ NORETURN(static void parser_error(const char *));
|
|
43
45
|
*/
|
44
46
|
#define VALIDATE_MAX_LENGTH(len, N) do { \
|
45
47
|
if (len > MAX_##N##_LENGTH) \
|
46
|
-
|
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); \
|
47
54
|
} while (0)
|
48
55
|
|
49
56
|
/** Defines global strings in the init method. */
|
@@ -59,7 +66,6 @@ DEF_MAX_LENGTH(REQUEST_URI, 1024 * 12);
|
|
59
66
|
DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewhere or not */
|
60
67
|
DEF_MAX_LENGTH(REQUEST_PATH, 1024);
|
61
68
|
DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10));
|
62
|
-
DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32)));
|
63
69
|
|
64
70
|
static void init_globals(void)
|
65
71
|
{
|