agoo 0.9.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of agoo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/ext/agoo/con.c +7 -0
- data/ext/agoo/request.c +1 -1
- data/ext/agoo/response.c +2 -0
- data/ext/agoo/server.c +21 -0
- data/ext/agoo/server.h +1 -0
- data/lib/agoo/version.rb +1 -1
- data/test/base_handler_test.rb +1 -1
- data/test/rack_handler_test.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec0e1021cff3ef520275f242403861641910567fddf30d07d0df0f4d456e2d1f
|
4
|
+
data.tar.gz: 7a6058474e50a04e1e068cf4911762079d9a7ec0777087914b1a40faf61b2ff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03fa2278f4a6b70d1495577086ed15015f70ab7600a46dc02d6d4e91d996bfdcc1e818217a9043b83d3490c637ab53859402dead80524ea2bf0319812a536c2a
|
7
|
+
data.tar.gz: 2517add46e2130c993aee42e69fddc05b27b62d6582217c6f6f24cae585c53051536b9bca1b914e900deba6963dd2f70a53496a77993a7310308774e797149c5
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# agoo
|
2
2
|
|
3
3
|
[![Build Status](https://img.shields.io/travis/ohler55/agoo/master.svg)](http://travis-ci.org/ohler55/agoo?branch=master)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/agoo.svg)](https://badge.fury.io/rb/agoo)
|
4
5
|
|
5
6
|
A High Performance HTTP Server for Ruby
|
6
7
|
|
@@ -35,9 +36,9 @@ gem install agoo
|
|
35
36
|
Agoo is Japanese for a type of flying fish. This gem flies. It is a high
|
36
37
|
performance HTTP server that serves static resource at hundreds of thousands
|
37
38
|
of fetchs per second. A a simple hello world Ruby handler at over 100,000
|
38
|
-
requests per second on a desktop computer. That places Agoo at about
|
39
|
+
requests per second on a desktop computer. That places Agoo at about 85 times
|
39
40
|
faster than Sinatra and 1000 times faster than Rails. In both cases the
|
40
|
-
latency was
|
41
|
+
latency was two orders of magnitude lower or more. Checkout the benchmarks on <a
|
41
42
|
href="http://opo.technology/benchmarks.html#web_benchmarks">OpO
|
42
43
|
benchmarks</a>. Note that the benchmarks had to use a C program called _hose_
|
43
44
|
from the <a href="http://opo.technology/index.html">OpO</a> downloads to hit
|
data/ext/agoo/con.c
CHANGED
@@ -229,6 +229,12 @@ con_header_read(Con c) {
|
|
229
229
|
Res res;
|
230
230
|
|
231
231
|
if (NULL == p) {
|
232
|
+
if (NULL != server->hook404) {
|
233
|
+
// There would be too many parameters to pass to a
|
234
|
+
// separate function so just goto the hook processing.
|
235
|
+
hook = server->hook404;
|
236
|
+
goto HOOKED;
|
237
|
+
}
|
232
238
|
return bad_request(c, 404, __LINE__);
|
233
239
|
}
|
234
240
|
if (NULL == (res = res_create())) {
|
@@ -250,6 +256,7 @@ con_header_read(Con c) {
|
|
250
256
|
return true;
|
251
257
|
}
|
252
258
|
}
|
259
|
+
HOOKED:
|
253
260
|
// Create request and populate.
|
254
261
|
mlen = hend - c->buf + 4 + clen;
|
255
262
|
if (NULL == (c->req = (Req)malloc(mlen + sizeof(struct _Req) - 8 + 1))) {
|
data/ext/agoo/request.c
CHANGED
@@ -554,7 +554,7 @@ request_init(VALUE mod) {
|
|
554
554
|
rack_run_once_val = rb_str_new_cstr("rack.run_once"); rb_gc_register_address(&rack_run_once_val);
|
555
555
|
rack_url_scheme_val = rb_str_new_cstr("rack.url_scheme"); rb_gc_register_address(&rack_url_scheme_val);
|
556
556
|
rack_version_val = rb_str_new_cstr("rack.version"); rb_gc_register_address(&rack_version_val);
|
557
|
-
rack_version_val_val = rb_str_new_cstr("
|
557
|
+
rack_version_val_val = rb_str_new_cstr("1.3"); rb_gc_register_address(&rack_version_val_val);
|
558
558
|
request_method_val = rb_str_new_cstr("REQUEST_METHOD"); rb_gc_register_address(&request_method_val);
|
559
559
|
script_name_val = rb_str_new_cstr("SCRIPT_NAME"); rb_gc_register_address(&script_name_val);
|
560
560
|
server_name_val = rb_str_new_cstr("SERVER_NAME"); rb_gc_register_address(&server_name_val);
|
data/ext/agoo/response.c
CHANGED
data/ext/agoo/server.c
CHANGED
@@ -851,10 +851,30 @@ handle(VALUE self, VALUE method, VALUE pattern, VALUE handler) {
|
|
851
851
|
} else {
|
852
852
|
server->hooks = hook;
|
853
853
|
}
|
854
|
+
rb_gc_register_address(&hook->handler);
|
854
855
|
}
|
855
856
|
return Qnil;
|
856
857
|
}
|
857
858
|
|
859
|
+
/* Document-method: handle_not_found
|
860
|
+
*
|
861
|
+
* call-seq: not_found_handle(handler)
|
862
|
+
*
|
863
|
+
* Registers a handler to be called when no other hook is found and no static
|
864
|
+
* file is found.
|
865
|
+
*/
|
866
|
+
static VALUE
|
867
|
+
handle_not_found(VALUE self, VALUE handler) {
|
868
|
+
Server server = (Server)DATA_PTR(self);
|
869
|
+
|
870
|
+
if (NULL == (server->hook404 = hook_create(GET, "/", handler))) {
|
871
|
+
rb_raise(rb_eStandardError, "out of memory.");
|
872
|
+
}
|
873
|
+
rb_gc_register_address(&server->hook404->handler);
|
874
|
+
|
875
|
+
return Qnil;
|
876
|
+
}
|
877
|
+
|
858
878
|
/* Document-class: Agoo::Server
|
859
879
|
*
|
860
880
|
* An HTTP server that support the rack API as well as some other optimized
|
@@ -884,6 +904,7 @@ server_init(VALUE mod) {
|
|
884
904
|
rb_define_method(server_class, "log_flush", server_log_flush, 1);
|
885
905
|
|
886
906
|
rb_define_method(server_class, "handle", handle, 3);
|
907
|
+
rb_define_method(server_class, "handle_not_found", handle_not_found, 1);
|
887
908
|
|
888
909
|
call_id = rb_intern("call");
|
889
910
|
each_id = rb_intern("each");
|
data/ext/agoo/server.h
CHANGED
data/lib/agoo/version.rb
CHANGED
data/test/base_handler_test.rb
CHANGED
data/test/rack_handler_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -152,8 +152,8 @@ signing_key:
|
|
152
152
|
specification_version: 4
|
153
153
|
summary: An HTTP server
|
154
154
|
test_files:
|
155
|
-
- test/
|
156
|
-
- test/log_test.rb
|
155
|
+
- test/tests.rb
|
157
156
|
- test/rack_handler_test.rb
|
157
|
+
- test/base_handler_test.rb
|
158
158
|
- test/static_test.rb
|
159
|
-
- test/
|
159
|
+
- test/log_test.rb
|