ruby-lsapi 5.8 → 5.9
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.
- checksums.yaml +4 -4
- data/README +11 -2
- data/examples/lsapi_with_cgi.rb +17 -2
- data/examples/testlsapi.rb +18 -1
- data/ext/lsapi/lsapilib.c +637 -198
- data/ext/lsapi/lsapilib.h +25 -4
- data/ext/lsapi/lsruby.c +388 -204
- data/lsapi.gemspec +2 -2
- data/rails/dispatch.lsapi +30 -2
- data/scripts/lsruby_runner.rb +33 -10
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f10920844cbc990bc8c86333ae9c906ac69fcf6de5dea66dd2c5aefc5c54dfbb
|
|
4
|
+
data.tar.gz: 16f8bb6da43c797709294552a7a2c90b159933eecc5481db4af2e69c26a08175
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66004fe6644e356b6992e877aaa3d5a6964d271066f50ee9603365b100d5ecb467a69dec5c215e80afb7ca239cb3de21d83a34ffacf21f05addabce381a98a2b
|
|
7
|
+
data.tar.gz: f1561515cd625f60689a8a55582e430f88e6686b80502d00c44299b7afaa12591bcaa44fbd4e795e71f8893bbb599e4c93740fadd73c761f2feb4ffff5693a7c
|
data/README
CHANGED
|
@@ -15,7 +15,8 @@ USAGE
|
|
|
15
15
|
General CGI scripts
|
|
16
16
|
^^^^^^^^^^^^^^^^^^^
|
|
17
17
|
The most efficient way to use LSAPI interface is to modify your CGI scripts.
|
|
18
|
-
|
|
18
|
+
For a single-process application (LSAPI_CHILDREN <= 1), add the following
|
|
19
|
+
code to your CGI scripts:
|
|
19
20
|
|
|
20
21
|
require 'lsapi'
|
|
21
22
|
|
|
@@ -26,6 +27,15 @@ You need to add the following code to your CGI scripts:
|
|
|
26
27
|
|
|
27
28
|
end
|
|
28
29
|
|
|
30
|
+
For self-managed prefork applications, use one of the bundled runners. They
|
|
31
|
+
load the Ruby application before accepting connections, then use Ruby's fork
|
|
32
|
+
method together with LSAPI.postfork_child and LSAPI.postfork_parent. This
|
|
33
|
+
preserves copy-on-write sharing without bypassing Ruby's fork hooks.
|
|
34
|
+
|
|
35
|
+
Ruby LSAPI refuses to start with an effective UID of 0. The web server must
|
|
36
|
+
select the final application UID before starting Ruby; the runner never starts
|
|
37
|
+
as root and does not perform an in-process UID transition.
|
|
38
|
+
|
|
29
39
|
There is no need to change the way that how CGI environment variables
|
|
30
40
|
are being accessed in your scripts.
|
|
31
41
|
|
|
@@ -162,4 +172,3 @@ Copyright
|
|
|
162
172
|
|
|
163
173
|
Copyright (C) 2006 Lite Speed Technologies Inc.
|
|
164
174
|
|
|
165
|
-
|
data/examples/lsapi_with_cgi.rb
CHANGED
|
@@ -3,12 +3,27 @@
|
|
|
3
3
|
require 'lsapi'
|
|
4
4
|
require 'cgi'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
while LSAPI.accept != nil
|
|
6
|
+
def handle_request
|
|
8
7
|
cgi = CGI.new
|
|
9
8
|
name = cgi['name']
|
|
10
9
|
puts cgi.header
|
|
11
10
|
puts "Hello #{name}! <br> " if name
|
|
12
11
|
puts "You are from #{cgi.remote_addr}<br>"
|
|
12
|
+
end
|
|
13
13
|
|
|
14
|
+
if LSAPI.respond_to?("accept_new_connection")
|
|
15
|
+
while LSAPI.accept_new_connection != nil
|
|
16
|
+
begin
|
|
17
|
+
fork do
|
|
18
|
+
LSAPI.postfork_child
|
|
19
|
+
handle_request while LSAPI.accept != nil
|
|
20
|
+
end
|
|
21
|
+
LSAPI.postfork_parent
|
|
22
|
+
rescue SystemCallError => e
|
|
23
|
+
LSAPI.postfork_failed
|
|
24
|
+
warn "ruby-lsapi: fork failed: #{e.message}"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
else
|
|
28
|
+
handle_request while LSAPI.accept != nil
|
|
14
29
|
end
|
data/examples/testlsapi.rb
CHANGED
|
@@ -4,8 +4,25 @@ require 'lsapi'
|
|
|
4
4
|
|
|
5
5
|
$count = 0;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
def handle_request
|
|
8
8
|
print "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\nHello World! \##{$count}<br>\r\n"
|
|
9
9
|
ENV.each_pair {|key, value| print "#{key} is #{value}<br>\r\n" }
|
|
10
10
|
$count = $count + 1
|
|
11
11
|
end
|
|
12
|
+
|
|
13
|
+
if LSAPI.respond_to?("accept_new_connection")
|
|
14
|
+
while LSAPI.accept_new_connection != nil
|
|
15
|
+
begin
|
|
16
|
+
fork do
|
|
17
|
+
LSAPI.postfork_child
|
|
18
|
+
handle_request while LSAPI.accept != nil
|
|
19
|
+
end
|
|
20
|
+
LSAPI.postfork_parent
|
|
21
|
+
rescue SystemCallError => e
|
|
22
|
+
LSAPI.postfork_failed
|
|
23
|
+
warn "ruby-lsapi: fork failed: #{e.message}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
handle_request while LSAPI.accept != nil
|
|
28
|
+
end
|