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
many small bug fixes, mostly related to install

thanks to Pratik Naik for his help.
Ryan Dahl (author)
2 months ago
commit  9d780efaa4771ddf4f3fda30f7353188aaafa0e3
tree    5f01bf85dec5cc2bf25bf16a78daa6d734d502a4
parent  6f1a46c3f1ebc9b6f8b73e8c053a8047d058dc8d
...
1
2
3
4
5
6
7
8
 
9
10
11
...
20
21
22
 
23
24
25
 
26
27
 
28
29
30
...
73
74
75
76
77
 
 
78
79
80
81
82
 
 
83
84
85
86
87
...
111
112
113
114
115
 
...
1
2
 
 
3
4
5
 
6
7
8
9
...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
...
74
75
76
 
 
77
78
79
80
81
 
 
82
83
84
 
85
86
87
...
111
112
113
 
114
115
0
@@ -1,11 +1,9 @@
0
 # A Web Server Called *Ebb*
0
 
0
-## Intended Use
0
-
0
 Ebb aims to be a very small and fast web server specifically for hosting
0
 web frameworks like Rails, Merb, and in the future Django.
0
 
0
-It is *not* meant to be a full featured web server like Lighttpd, Apache, or
0
+It is not meant to be a full featured web server like Lighttpd, Apache, or
0
 Nginx. Rather it should be used in multiplicity behind a load balancer and
0
 a front-end server. It is not meant to serve static files in production.
0
 
0
@@ -20,11 +18,14 @@ web server is written in C and uses the
0
 Connections are processed as follows:
0
 
0
 1. libev loops and waits for incoming connections.
0
+
0
 2. When Ebb receives a connection, it passes the request into the
0
    [mongrel state machine](http://mongrel.rubyforge.org/browser/tags/rel_1-0-1/ext/http11/http11_parser.rl)
0
    which securely parses the headers.
0
+
0
 3. When the request is complete, Ebb passes the information to a user
0
    supplied callback.
0
+
0
 4. The Ruby binding supplying this callback transforms the
0
    request into a [Rack](http://rack.rubyforge.org/) compatible `env` hash
0
    and passes it on a Rack adapter.
0
@@ -73,15 +74,14 @@ be made here.)
0
 
0
 
0
 Contributions (patches, criticism, advice) are very welcome! The source code
0
-it hosted at [repo.or.cz](http://repo.or.cz/w/ebb.git) can be gotten by
0
-executing
0
+is hosted at [repo.or.cz](http://repo.or.cz/w/ebb.git). It can be retrieved
0
+by executing
0
 
0
 `git clone http://repo.or.cz/r/ebb.git`
0
 
0
-I intend to keep the C code base very small. Do email me before writing any
0
-large additions. Here are some features that I want to add:
0
+I intend to keep the C code base very small, so do email me before writing any
0
+large additions. Here are some features that I would like to add:
0
 
0
-### Todo
0
 * Multipart parser
0
 * Streaming responses
0
 * Optimize and clean up upload handling
0
@@ -111,4 +111,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
0
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
0
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
0
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
-</div>
0
\ No newline at end of file
0
+</div>
...
25
26
27
28
 
29
30
31
...
25
26
27
 
28
29
30
31
0
@@ -25,7 +25,7 @@ trials = {
0
     size = (l * 1024).to_i
0
     fn = "/tmp/ebb_post_trial_#{size}"
0
     File.open(fn, 'w+') { |f| f.write("C"*size) } unless FileTest.exists?(fn)
0
- [l, "ab -t 6 -q -c 50 -p #{fn} http://0.0.0.0:PORT/test_post_length}"]
0
+ [l, "ab -t 6 -q -c 50 -p #{fn} http://0.0.0.0:PORT/test_post_length"]
0
   },
0
   'concurrency' => [1,2,5,10,20,30,50,75,100].map { |c|
0
     [c, "ab -t 3 -c #{c} http://0.0.0.0:PORT/bytes/1"]
...
12
13
14
 
15
16
17
18
19
 
20
21
22
...
104
105
106
 
 
107
108
109
...
12
13
14
15
16
17
18
19
20
21
22
23
24
...
106
107
108
109
110
111
112
113
0
@@ -12,11 +12,13 @@ require Ebb::LIBDIR + '/daemonizable'
0
 module Ebb
0
   class Client
0
     BASE_ENV = {
0
+ 'SCRIPT_NAME' => '',
0
       'SERVER_SOFTWARE' => "Ebb #{Ebb::VERSION}",
0
       'SERVER_PROTOCOL' => 'HTTP/1.1',
0
       'GATEWAY_INTERFACE' => 'CGI/1.2',
0
       'rack.version' => [0, 1],
0
       'rack.errors' => STDERR,
0
+ 'rack.url_scheme' => 'http',
0
       'rack.multithread' => false,
0
       'rack.multiprocess' => false,
0
       'rack.run_once' => false
0
@@ -104,6 +106,8 @@ module Ebb
0
     end
0
     
0
     def process_client(client)
0
+ puts "Request: #{client.env.inspect}\n"
0
+
0
       begin
0
         status, headers, body = @app.call(client.env)
0
       rescue
...
21
22
23
24
 
25
26
27
...
21
22
23
 
24
25
26
27
0
@@ -21,7 +21,7 @@
0
 #include <glib.h>
0
 
0
 #define EV_STANDALONE 1
0
-#include "../libev/ev.c"
0
+#include <ev.c>
0
 
0
 #include "parser.h"
0
 #include "ebb.h"
...
10
11
12
13
 
14
15
16
...
99
100
101
102
103
 
...
10
11
12
 
13
14
15
16
...
99
100
101
 
102
103
0
@@ -10,7 +10,7 @@
0
 #include <glib.h>
0
 
0
 #define EV_STANDALONE 1
0
-#include "ev.h"
0
+#include <ev.h>
0
 
0
 #include "parser.h"
0
 
0
@@ -99,4 +99,4 @@ struct ebb_server {
0
   ebb_request_cb request_cb;
0
 };
0
 
0
-#endif
0
\ No newline at end of file
0
+#endif
...
236
237
238
239
 
240
241
242
...
236
237
238
 
239
240
241
242
0
@@ -236,7 +236,7 @@ void Init_ebb_ext()
0
   DEF_GLOBAL(server_name, "SERVER_NAME");
0
   DEF_GLOBAL(server_port, "SERVER_PORT");
0
   DEF_GLOBAL(path_info, "PATH_INFO");
0
- DEF_GLOBAL(content_length, "HTTP_CONTENT_LENGTH");
0
+ DEF_GLOBAL(content_length, "CONTENT_LENGTH");
0
   DEF_GLOBAL(http_host, "HTTP_HOST");
0
   
0
   cServer = rb_define_class_under(mEbb, "Server", rb_cObject);
...
31
32
33
34
 
 
 
 
 
35
36
37
...
31
32
33
 
34
35
36
37
38
39
40
41
0
@@ -31,7 +31,11 @@ if have_header('sys/inotify.h')
0
   flags << '-DEV_USE_INOTIFY'
0
 end
0
 
0
-$CFLAGS << ' ' << flags.join(' ')
0
+dir = File.dirname(__FILE__)
0
+libev_dir = File.expand_path(dir + '/../libev')
0
+
0
+$LDFLAGS << " -lpthread "
0
+$CFLAGS << " -I#{libev_dir} " << flags.join(' ')
0
 $defs << "-DRUBY_VERSION_CODE=#{RUBY_VERSION.gsub(/\D/, '')}"
0
 
0
 

Comments

    No one has commented yet.