ebb 0.2.0 → 0.2.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.
data/src/ebb.c CHANGED
@@ -42,12 +42,12 @@ void env_add(ebb_client *client, const char *field, int flen, const char *value,
42
42
  client->parser.overflow_error = TRUE;
43
43
  return;
44
44
  }
45
- client->env[client->env_size].type = -1;
46
- client->env[client->env_size].field = field;
47
- client->env[client->env_size].field_length = flen;
48
- client->env[client->env_size].value = value;
49
- client->env[client->env_size].value_length = vlen;
50
- client->env_size += 1;
45
+ struct ebb_env_item * const item = &client->env[client->env_size++];
46
+ item->type = -1;
47
+ item->field_length = flen;
48
+ item->value_length = vlen;
49
+ item->field = field;
50
+ item->value = value;
51
51
  }
52
52
 
53
53
 
@@ -57,12 +57,12 @@ void env_add_const(ebb_client *client, int type, const char *value, int vlen)
57
57
  client->parser.overflow_error = TRUE;
58
58
  return;
59
59
  }
60
- client->env[client->env_size].type = type;
61
- client->env[client->env_size].field = NULL;
62
- client->env[client->env_size].field_length = -1;
63
- client->env[client->env_size].value = value;
64
- client->env[client->env_size].value_length = vlen;
65
- client->env_size += 1;
60
+ struct ebb_env_item * const item = &client->env[client->env_size++];
61
+ item->type = type;
62
+ item->field_length = -1;
63
+ item->value_length = vlen;
64
+ item->field = NULL;
65
+ item->value = value;
66
66
  }
67
67
 
68
68
 
@@ -226,7 +226,7 @@ static void client_init(ebb_client *client)
226
226
  */
227
227
  if(!client->open) {
228
228
  /* DO SOCKET STUFF */
229
- socklen_t len;
229
+ socklen_t len = sizeof(struct sockaddr);
230
230
  int fd = accept(client->server->fd, (struct sockaddr*)&(client->sockaddr), &len);
231
231
  if(fd < 0) {
232
232
  perror("accept()");
@@ -276,7 +276,7 @@ static void client_init(ebb_client *client)
276
276
  ev_io_start(client->server->loop, &client->read_watcher);
277
277
 
278
278
  client->timeout_watcher.data = client;
279
- ev_timer_init(&client->timeout_watcher, on_timeout, EBB_TIMEOUT, EBB_TIMEOUT);
279
+ ev_timer_init(&client->timeout_watcher, on_timeout, EBB_TIMEOUT, 0);
280
280
  ev_timer_start(client->server->loop, &client->timeout_watcher);
281
281
  }
282
282
 
@@ -299,7 +299,7 @@ static void on_request(struct ev_loop *loop, ev_io *watcher, int revents)
299
299
  * until the request is complete and parsed.
300
300
  */
301
301
  int i;
302
- ebb_client *client;
302
+ ebb_client *client = NULL;
303
303
  /* Get next availible peer */
304
304
  for(i=0; i < EBB_MAX_CLIENTS; i++)
305
305
  if(!server->clients[i].in_use && !server->clients[i].open) {
data/src/ebb.h CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  typedef struct ebb_server ebb_server;
15
15
  typedef struct ebb_client ebb_client;
16
- #define EBB_VERSION "0.2.0"
16
+ #define EBB_VERSION "0.2.1"
17
17
  #define EBB_BUFFERSIZE (1024 * (80 + 33))
18
18
  #define EBB_MAX_CLIENTS 1024
19
19
  #define EBB_TIMEOUT 30.0
@@ -35,10 +35,10 @@ void ebb_client_write_body(ebb_client*, const char *data, int length);
35
35
 
36
36
  struct ebb_env_item {
37
37
  int type;
38
- const char *field;
39
38
  int field_length;
40
- const char *value;
41
39
  int value_length;
40
+ const char *field;
41
+ const char *value;
42
42
  };
43
43
 
44
44
  struct ebb_client {
@@ -58,7 +58,7 @@ static void detach_idle_watcher()
58
58
  }
59
59
 
60
60
 
61
- void request_cb(ebb_client *client, void *data)
61
+ static void request_cb(ebb_client *client, void *data)
62
62
  {
63
63
  VALUE rb_client = Data_Wrap_Struct(cClient, 0, 0, client);
64
64
 
@@ -71,21 +71,21 @@ void request_cb(ebb_client *client, void *data)
71
71
  attach_idle_watcher();
72
72
  }
73
73
 
74
- VALUE server_listen_on_fd(VALUE _, VALUE sfd)
74
+ static VALUE server_listen_on_fd(VALUE _, VALUE sfd)
75
75
  {
76
76
  if(ebb_server_listen_on_fd(server, FIX2INT(sfd)) < 0)
77
77
  rb_sys_fail("Problem listening on FD");
78
78
  return Qnil;
79
79
  }
80
80
 
81
- VALUE server_listen_on_port(VALUE _, VALUE port)
81
+ static VALUE server_listen_on_port(VALUE _, VALUE port)
82
82
  {
83
83
  if(ebb_server_listen_on_port(server, FIX2INT(port)) < 0)
84
84
  rb_sys_fail("Problem listening on port");
85
85
  return Qnil;
86
86
  }
87
87
 
88
- VALUE server_listen_on_unix_socket(VALUE _, VALUE socketfile)
88
+ static VALUE server_listen_on_unix_socket(VALUE _, VALUE socketfile)
89
89
  {
90
90
  if(ebb_server_listen_on_unix_socket(server, StringValuePtr(socketfile)) < 0)
91
91
  rb_sys_fail("Problem listening on unix socket");
@@ -93,7 +93,7 @@ VALUE server_listen_on_unix_socket(VALUE _, VALUE socketfile)
93
93
  }
94
94
 
95
95
 
96
- static struct timeval idle_timeout = { tv_sec: 0, tv_usec: 50000 };
96
+ static struct timeval idle_timeout = { 0, 50000 };
97
97
 
98
98
  static void
99
99
  idle_cb (struct ev_loop *loop, struct ev_idle *w, int revents) {
@@ -132,7 +132,7 @@ idle_cb (struct ev_loop *loop, struct ev_idle *w, int revents) {
132
132
  }
133
133
  }
134
134
 
135
- VALUE server_process_connections(VALUE _)
135
+ static VALUE server_process_connections(VALUE _)
136
136
  {
137
137
  TRAP_BEG;
138
138
  ev_loop(loop, EVLOOP_ONESHOT);
@@ -141,23 +141,23 @@ VALUE server_process_connections(VALUE _)
141
141
  }
142
142
 
143
143
 
144
- VALUE server_unlisten(VALUE _)
144
+ static VALUE server_unlisten(VALUE _)
145
145
  {
146
146
  ebb_server_unlisten(server);
147
147
  return Qnil;
148
148
  }
149
149
 
150
- VALUE server_open(VALUE _)
150
+ static VALUE server_open(VALUE _)
151
151
  {
152
152
  return server->open ? Qtrue : Qfalse;
153
153
  }
154
154
 
155
- VALUE server_waiting_clients(VALUE _)
155
+ static VALUE server_waiting_clients(VALUE _)
156
156
  {
157
157
  return waiting_clients;
158
158
  }
159
159
 
160
- VALUE env_field(struct ebb_env_item *item)
160
+ static VALUE env_field(struct ebb_env_item *item)
161
161
  {
162
162
  if(item->field) {
163
163
  VALUE f = rb_str_new(NULL, RSTRING_LEN(global_http_prefix) + item->field_length);
@@ -188,7 +188,7 @@ VALUE env_field(struct ebb_env_item *item)
188
188
  }
189
189
 
190
190
 
191
- VALUE env_value(struct ebb_env_item *item)
191
+ static VALUE env_value(struct ebb_env_item *item)
192
192
  {
193
193
  if(item->value_length > 0)
194
194
  return rb_str_new(item->value, item->value_length);
@@ -197,16 +197,18 @@ VALUE env_value(struct ebb_env_item *item)
197
197
  }
198
198
 
199
199
 
200
- VALUE client_env(VALUE _, VALUE rb_client)
200
+ static VALUE client_env(VALUE _, VALUE rb_client)
201
201
  {
202
202
  ebb_client *client;
203
203
  VALUE field, value, env = rb_hash_new();
204
204
  int i;
205
+ struct ebb_env_item *item;
205
206
 
206
207
  Data_Get_Struct(rb_client, ebb_client, client);
207
208
  for(i=0; i < client->env_size; i++) {
208
- field = env_field(&client->env[i]);
209
- value = env_value(&client->env[i]);
209
+ item = &client->env[i];
210
+ field = env_field(item);
211
+ value = env_value(item);
210
212
  rb_hash_aset(env, field, value);
211
213
  }
212
214
 
@@ -220,7 +222,7 @@ VALUE client_env(VALUE _, VALUE rb_client)
220
222
  return env;
221
223
  }
222
224
 
223
- VALUE client_write_status(VALUE _, VALUE client, VALUE status, VALUE reason_phrase)
225
+ static VALUE client_write_status(VALUE _, VALUE client, VALUE status, VALUE reason_phrase)
224
226
  {
225
227
  ebb_client *_client;
226
228
  Data_Get_Struct(client, ebb_client, _client);
@@ -228,7 +230,7 @@ VALUE client_write_status(VALUE _, VALUE client, VALUE status, VALUE reason_phra
228
230
  return Qnil;
229
231
  }
230
232
 
231
- VALUE client_write_header(VALUE _, VALUE client, VALUE field, VALUE value)
233
+ static VALUE client_write_header(VALUE _, VALUE client, VALUE field, VALUE value)
232
234
  {
233
235
  ebb_client *_client;
234
236
  Data_Get_Struct(client, ebb_client, _client);
@@ -236,7 +238,7 @@ VALUE client_write_header(VALUE _, VALUE client, VALUE field, VALUE value)
236
238
  return Qnil;
237
239
  }
238
240
 
239
- VALUE client_write_body(VALUE _, VALUE client, VALUE string)
241
+ static VALUE client_write_body(VALUE _, VALUE client, VALUE string)
240
242
  {
241
243
  ebb_client *_client;
242
244
  Data_Get_Struct(client, ebb_client, _client);
@@ -245,7 +247,7 @@ VALUE client_write_body(VALUE _, VALUE client, VALUE string)
245
247
  }
246
248
 
247
249
 
248
- VALUE client_release(VALUE _, VALUE rb_client)
250
+ static VALUE client_release(VALUE _, VALUE rb_client)
249
251
  {
250
252
  ebb_client *client;
251
253
  Data_Get_Struct(rb_client, ebb_client, client);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ry dahl
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-19 00:00:00 +02:00
12
+ date: 2008-07-08 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -34,34 +34,34 @@ files:
34
34
  - src/ebb.h
35
35
  - src/parser.c
36
36
  - src/parser.h
37
- - libev/ev.c
38
- - libev/ev.h
39
37
  - libev/ev_epoll.c
40
- - libev/ev_kqueue.c
38
+ - libev/ev_select.c
39
+ - libev/ev.h
40
+ - libev/ev_wrap.h
41
41
  - libev/ev_poll.c
42
+ - libev/ev.c
42
43
  - libev/ev_port.c
43
- - libev/ev_select.c
44
- - libev/ev_vars.h
44
+ - libev/ev_kqueue.c
45
45
  - libev/ev_win32.c
46
- - libev/ev_wrap.h
46
+ - libev/ev_vars.h
47
47
  - README
48
48
  - src/ebb_ruby.c
49
49
  - src/extconf.rb
50
50
  - ruby_lib/ebb
51
+ - ruby_lib/ebb/runner.rb
51
52
  - ruby_lib/ebb/runner
52
53
  - ruby_lib/ebb/runner/rails.rb
53
- - ruby_lib/ebb/runner.rb
54
- - ruby_lib/ebb.rb
55
54
  - ruby_lib/rack
56
55
  - ruby_lib/rack/adapter
57
56
  - ruby_lib/rack/adapter/rails.rb
58
- - benchmark/application.rb
57
+ - ruby_lib/ebb.rb
59
58
  - benchmark/server_test.rb
59
+ - benchmark/application.rb
60
60
  - bin/ebb_rails
61
61
  - test/basic_test.rb
62
- - test/ebb_rails_test.rb
63
62
  - test/env_test.rb
64
63
  - test/helper.rb
64
+ - test/ebb_rails_test.rb
65
65
  has_rdoc: false
66
66
  homepage: http://ebb.rubyforge.org
67
67
  post_install_message:
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements: []
85
85
 
86
86
  rubyforge_project: ebb
87
- rubygems_version: 1.1.0
87
+ rubygems_version: 1.1.1
88
88
  signing_key:
89
89
  specification_version: 2
90
90
  summary: A Web Server