ry / ebb fork watch download tarball
public this repo is viewable by everyone
Description: web server
Homepage: http://ebb.rubyforge.org
Clone URL: git://github.com/ry/ebb.git
Separate binding version and ebb.c version.
ryah (author)
about 1 month ago
commit  3afab8fa81d2321e45f05addbb75a55d99a9a783
tree    168434fd9899d2ffb2e9eb38b6852c818b741375
parent  c44f2b57ebd5098a3cda708ac2dde2bdb44b46c6
...
3
4
5
 
 
 
 
 
 
6
7
8
...
23
24
25
26
27
28
29
30
31
32
...
90
91
92
93
 
94
95
96
...
3
4
5
6
7
8
9
10
11
12
13
14
...
29
30
31
 
 
 
 
32
33
34
...
92
93
94
 
95
96
97
98
0
@@ -3,6 +3,12 @@ require 'rake/testtask'
0
 require 'rake/gempackagetask'
0
 require 'rake/clean'
0
 
0
+def dir(path)
0
+ File.expand_path File.join(File.dirname(__FILE__), path)
0
+end
0
+
0
+require dir('ruby_lib/ebb')
0
+
0
 COMMON_DISTFILES = FileList.new('src/ebb.{c,h}', 'src/parser.{c,h}',
0
   'libev/*', 'README')
0
 
0
@@ -23,10 +29,6 @@ Rake::TestTask.new do |t|
0
   t.verbose = true
0
 end
0
 
0
-def dir(path)
0
- File.expand_path File.join(File.dirname(__FILE__), path)
0
-end
0
-
0
 task(:default => [:compile, :test])
0
 
0
 task(:compile => ['src/Makefile', 'src/ebb.c', 'src/ebb.h', 'src/ebb_ruby.c', 'src/parser.c', 'src/parser.h']) do
0
@@ -90,7 +92,7 @@ spec = Gem::Specification.new do |s|
0
   s.author = 'ry dahl'
0
   s.email = 'ry at tiny clouds dot org'
0
   s.homepage = 'http://ebb.rubyforge.org'
0
- s.version = `grep EBB_VERSION #{dir('src/ebb.h')}`.match(/\d.\d.\d/)[0]
0
+ s.version = Ebb::VERSION
0
   s.rubyforge_project = 'ebb'
0
   
0
   s.add_dependency('rack')
...
3
4
5
 
6
7
8
 
9
10
11
...
24
25
26
27
 
28
29
30
...
93
94
95
96
97
98
99
100
101
102
103
104
105
 
106
107
108
...
3
4
5
6
7
 
8
9
10
11
12
...
25
26
27
 
28
29
30
31
...
94
95
96
 
 
 
 
 
97
98
99
100
 
101
102
103
104
0
@@ -3,9 +3,10 @@
0
 # See README file for details.
0
 require 'stringio'
0
 module Ebb
0
+ VERSION = "0.2.0"
0
   LIBDIR = File.dirname(__FILE__)
0
- require Ebb::LIBDIR + '/../src/ebb_ext'
0
   autoload :Runner, LIBDIR + '/ebb/runner'
0
+ autoload :FFI, LIBDIR + '/../src/ebb_ext'
0
   
0
   def self.start_server(app, options={})
0
     if options.has_key?(:fileno)
0
@@ -24,7 +25,7 @@ module Ebb
0
     
0
     while @running
0
       FFI::server_process_connections()
0
- while client = FFI::waiting_clients.shift
0
+ while client = FFI::server_waiting_clients.shift
0
         if app.respond_to?(:spawn_thread?) and !app.spawn_thread?(client.env)
0
           process(app, client)
0
         else
0
@@ -93,16 +94,11 @@ module Ebb
0
     @@log
0
   end
0
   
0
- # This array is created and manipulated in the C extension.
0
- def FFI.waiting_clients
0
- @waiting_clients
0
- end
0
-
0
   class Client
0
     BASE_ENV = {
0
       'SERVER_NAME' => '0.0.0.0',
0
       'SCRIPT_NAME' => '',
0
- 'SERVER_SOFTWARE' => "Ebb #{Ebb::VERSION}",
0
+ 'SERVER_SOFTWARE' => "Ebb-Ruby #{Ebb::VERSION}",
0
       'SERVER_PROTOCOL' => 'HTTP/1.1',
0
       'rack.version' => [0, 1],
0
       'rack.errors' => STDERR,
...
82
83
84
85
 
86
87
88
...
82
83
84
 
85
86
87
88
0
@@ -82,7 +82,7 @@ module Ebb
0
         exit
0
       end
0
       @parser.on_tail('-v', '--version', "Show version") do
0
- Ebb.log.puts "Ebb #{Ebb::VERSION}"
0
+ Ebb.log.puts Ebb::Client::BASE_ENV['SERVER_SOFTWARE']
0
         exit
0
       end
0
       
...
15
16
17
18
19
 
 
20
21
22
...
15
16
17
 
 
18
19
20
21
22
0
@@ -15,8 +15,8 @@ ebb = Extension( "ebb"
0
                )
0
 
0
 setup( name = "Ebb"
0
- , description = "a wsgi web server"
0
- , version = "0.0.3"
0
+ , description = "a WSGI web server"
0
+ , version = "0.0.1"
0
      , author = "ry dahl"
0
      , author_email = "ry at tiny clouds dot org"
0
      , url = "http://ebb.rubyforge.org/"
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@
0
 
0
 typedef struct ebb_server ebb_server;
0
 typedef struct ebb_client ebb_client;
0
-#define EBB_VERSION "0.1.0"
0
+#define EBB_VERSION "0.2.0"
0
 #define EBB_BUFFERSIZE (1024 * (80 + 33))
0
 #define EBB_MAX_CLIENTS 1024
0
 #define EBB_TIMEOUT 30.0
...
11
12
13
 
 
14
15
16
...
65
66
67
68
69
70
71
...
85
86
87
88
 
89
90
91
...
144
145
146
 
 
 
 
 
147
148
149
...
269
270
271
272
 
273
274
275
...
292
293
294
 
295
296
297
...
308
309
310
311
 
312
313
314
...
11
12
13
14
15
16
17
18
...
67
68
69
 
70
71
72
...
86
87
88
 
89
90
91
92
...
145
146
147
148
149
150
151
152
153
154
155
...
275
276
277
 
278
279
280
281
...
298
299
300
301
302
303
304
...
315
316
317
 
318
319
320
321
0
@@ -11,6 +11,8 @@
0
 #include <ev.h>
0
 
0
 static VALUE cClient;
0
+static VALUE waiting_clients;
0
+
0
 static VALUE global_fragment;
0
 static VALUE global_path_info;
0
 static VALUE global_query_string;
0
@@ -65,7 +67,6 @@ static int clients_in_use_p()
0
 
0
 void request_cb(ebb_client *client, void *data)
0
 {
0
- VALUE waiting_clients = (VALUE)data;
0
   VALUE rb_client = Data_Wrap_Struct(cClient, 0, 0, client);
0
   rb_ary_push(waiting_clients, rb_client);
0
   attach_idle_watcher();
0
@@ -85,7 +86,7 @@ VALUE server_listen_on_port(VALUE _, VALUE port)
0
   return Qnil;
0
 }
0
 
0
-const struct timeval idle_timeout = { tv_sec: 0, tv_usec: 50000 };
0
+static struct timeval idle_timeout = { tv_sec: 0, tv_usec: 50000 };
0
 
0
 static void
0
 idle_cb (struct ev_loop *loop, struct ev_idle *w, int revents) {
0
@@ -144,6 +145,11 @@ VALUE server_open(VALUE _)
0
   return server->open ? Qtrue : Qfalse;
0
 }
0
 
0
+VALUE server_waiting_clients(VALUE _)
0
+{
0
+ return waiting_clients;
0
+}
0
+
0
 VALUE env_field(struct ebb_env_item *item)
0
 {
0
   if(item->field) {
0
@@ -269,7 +275,7 @@ void Init_ebb_ext()
0
   VALUE mEbb = rb_define_module("Ebb");
0
   VALUE mFFI = rb_define_module_under(mEbb, "FFI");
0
   
0
- rb_define_const(mEbb, "VERSION", rb_str_new2(EBB_VERSION));
0
+ rb_define_const(mFFI, "VERSION", rb_str_new2(EBB_VERSION));
0
   
0
   /** Defines global strings in the init method. */
0
 #define DEF_GLOBAL(N, val) global_##N = rb_obj_freeze(rb_str_new2(val)); rb_global_variable(&global_##N)
0
@@ -292,6 +298,7 @@ void Init_ebb_ext()
0
   rb_define_singleton_method(mFFI, "server_listen_on_port", server_listen_on_port, 1);
0
   rb_define_singleton_method(mFFI, "server_unlisten", server_unlisten, 0);
0
   rb_define_singleton_method(mFFI, "server_open?", server_open, 0);
0
+ rb_define_singleton_method(mFFI, "server_waiting_clients", server_waiting_clients, 0);
0
   
0
   cClient = rb_define_class_under(mEbb, "Client", rb_cObject);
0
   rb_define_singleton_method(mFFI, "client_read_input", client_read_input, 2);
0
@@ -308,7 +315,7 @@ void Init_ebb_ext()
0
   attach_idle_watcher();
0
   
0
   server = ebb_server_alloc();
0
- VALUE waiting_clients = rb_ary_new();
0
+ waiting_clients = rb_ary_new();
0
   rb_iv_set(mFFI, "@waiting_clients", waiting_clients);
0
   ebb_server_init(server, loop, request_cb, (void*)waiting_clients);
0
 }
...
1
2
3
4
5
6
...
1
2
 
3
4
5
0
@@ -1,6 +1,5 @@
0
 require 'mkmf'
0
 
0
-
0
 unless pkg_config('glib-2.0')
0
   abort "Ebb requires glib-2.0 and pkg_config"
0
 end

Comments

    No one has commented yet.