thin 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of thin might be problematic. Click here for more details.
- data/README +47 -5
- data/Rakefile +33 -2
- data/doc/rdoc/classes/Kernel.html +182 -0
- data/doc/rdoc/classes/Process.html +175 -0
- data/doc/rdoc/classes/Thin.html +184 -0
- data/doc/rdoc/classes/Thin/CGIWrapper.html +438 -0
- data/doc/rdoc/classes/Thin/Cluster.html +392 -0
- data/doc/rdoc/classes/Thin/Command.html +221 -0
- data/doc/rdoc/classes/Thin/CommandError.html +154 -0
- data/doc/rdoc/classes/Thin/Commands.html +145 -0
- data/doc/rdoc/classes/Thin/Daemonizable.html +250 -0
- data/doc/rdoc/classes/Thin/Daemonizable/ClassMethods.html +203 -0
- data/doc/rdoc/classes/Thin/DirHandler.html +250 -0
- data/doc/rdoc/classes/Thin/Handler.html +195 -0
- data/doc/rdoc/classes/Thin/Headers.html +244 -0
- data/doc/rdoc/classes/Thin/InvalidRequest.html +150 -0
- data/doc/rdoc/classes/Thin/Logging.html +214 -0
- data/doc/rdoc/classes/Thin/RailsHandler.html +234 -0
- data/doc/rdoc/classes/Thin/RailsServer.html +175 -0
- data/doc/rdoc/classes/Thin/Request.html +379 -0
- data/doc/rdoc/classes/Thin/Response.html +311 -0
- data/doc/rdoc/classes/Thin/Server.html +381 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/README.html +260 -0
- data/doc/rdoc/files/bin/thin.html +188 -0
- data/doc/rdoc/files/bin/thin_cluster.html +175 -0
- data/doc/rdoc/files/lib/thin/cgi_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/cluster_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/command_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/consts_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/daemonizing_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/handler_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/headers_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/logging_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/mime_types_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/rails_rb.html +263 -0
- data/doc/rdoc/files/lib/thin/recipes_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/request_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/response_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/server_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/statuses_rb.html +171 -0
- data/doc/rdoc/files/lib/thin/version_rb.html +171 -0
- data/doc/rdoc/index.html +10 -0
- data/doc/rdoc/logo.gif +0 -0
- data/doc/rdoc/rdoc-style.css +86 -0
- data/lib/thin/commands/cluster/config.rb +2 -0
- data/lib/thin/consts.rb +4 -0
- data/lib/thin/request.rb +30 -11
- data/lib/thin/server.rb +1 -1
- data/lib/thin/version.rb +1 -1
- metadata +52 -1
data/README
CHANGED
@@ -1,22 +1,64 @@
|
|
1
1
|
== Thin
|
2
|
-
|
3
2
|
Tiny, fast & funny HTTP server
|
4
3
|
|
4
|
+
Thin is a web server written entirely in Ruby in the simplest way possible.
|
5
|
+
It does as little as possible to serve your Rails application,
|
6
|
+
which makes it one of the fastest Rails server out there.
|
7
|
+
|
5
8
|
=== Installation
|
9
|
+
For the latest stable version:
|
10
|
+
|
11
|
+
sudo gem install thin
|
12
|
+
|
13
|
+
For the risky but so much cooler alpha version:
|
6
14
|
|
7
15
|
sudo gem install thin --source http://code.macournoyer.com
|
8
16
|
|
9
|
-
Or
|
17
|
+
Or from source:
|
10
18
|
|
11
19
|
svn co http://code.macournoyer.com/svn/thin/trunk thin
|
20
|
+
cd thin
|
21
|
+
rake install
|
12
22
|
|
13
23
|
=== Usage
|
14
24
|
In your Rails app directory:
|
15
25
|
|
16
26
|
thin start
|
17
27
|
|
18
|
-
|
19
|
-
|
28
|
+
See http://code.macournoyer.com/thin/doc/files/bin/thin.html
|
29
|
+
|
30
|
+
=== Deployment
|
31
|
+
To deploy your Rails application using a cluster of thin servers. You can start it with:
|
32
|
+
|
33
|
+
thin_cluster start
|
34
|
+
|
35
|
+
To use the Capistrano recipes, add this to your Capfile:
|
36
|
+
|
37
|
+
require 'thin'
|
38
|
+
require 'thin/recipes'
|
39
|
+
|
40
|
+
and create a config file using:
|
41
|
+
|
42
|
+
thin_cluster config
|
43
|
+
|
44
|
+
See http://code.macournoyer.com/thin/doc/files/bin/thin_cluster.html
|
45
|
+
|
46
|
+
=== Security
|
47
|
+
Thin should never be used facing the internet directly, it should always be hidden behind a
|
48
|
+
proxy server!
|
49
|
+
|
50
|
+
Thin is faster because it doesn't do a lot of things that other Ruby web servers do
|
51
|
+
(use threads, validate the body length, be very strict about the request format, etc.)
|
52
|
+
but that a good proxy server do very well (and a lot faster then any Ruby code could possibly do).
|
53
|
+
So it is very important that you setup you proxy server correctly in order to secure Thin
|
54
|
+
from potential attacks.
|
55
|
+
|
56
|
+
Nginx comes with everything you need and can be used securely out of the box with thin.
|
57
|
+
|
58
|
+
Apache mod_proxy is not secure because it doesn't cache the request before sending it
|
59
|
+
to the backend, which open your server to easy DoS attacks.
|
60
|
+
You need to install mod_accel (http://sysoev.ru/en/) to make mod_proxy behave like Nginx
|
61
|
+
on that side.
|
20
62
|
|
21
63
|
=== License
|
22
64
|
Ruby License, http://www.ruby-lang.org/en/LICENSE.txt.
|
@@ -32,4 +74,4 @@ Copyright (c) 2006 Francois Beausoleil <francois@teksol.info>
|
|
32
74
|
|
33
75
|
Thin is copyright Marc-Andre Cournoyer <macournoyer@gmail.com>
|
34
76
|
|
35
|
-
Please report any bug
|
77
|
+
Please report any bug at http://code.macournoyer.com/thin/trac.fcgi/newticket
|
data/Rakefile
CHANGED
@@ -64,6 +64,13 @@ namespace :gem do
|
|
64
64
|
upload "pkg/#{spec.full_name}.gem", 'gems'
|
65
65
|
sh 'ssh macournoyer@macournoyer.com "cd code.macournoyer.com && index_gem_repository.rb"'
|
66
66
|
end
|
67
|
+
|
68
|
+
desc 'Upload gem to rubyforge.org'
|
69
|
+
task :upload_rubyforge => :gem do
|
70
|
+
sh 'rubyforge login'
|
71
|
+
sh "rubyforge add_release thin thin #{Thin::VERSION::STRING} pkg/thin-#{Thin::VERSION::STRING}.gem"
|
72
|
+
sh "rubyforge add_file thin thin #{Thin::VERSION::STRING} pkg/thin-#{Thin::VERSION::STRING}.gem"
|
73
|
+
end
|
67
74
|
end
|
68
75
|
|
69
76
|
desc 'Show some stats about the code'
|
@@ -92,8 +99,32 @@ namespace :site do
|
|
92
99
|
end
|
93
100
|
end
|
94
101
|
|
95
|
-
|
96
|
-
task :
|
102
|
+
namespace :deploy do
|
103
|
+
task :site => %w(site:upload rdoc:upload)
|
104
|
+
|
105
|
+
desc 'Deploy on code.macournoyer.com'
|
106
|
+
task :alpha => %w(gem:upload deploy:site)
|
107
|
+
|
108
|
+
desc 'Deploy on rubyforge'
|
109
|
+
task :public => %w(gem:upload_rubyforge deploy:site)
|
110
|
+
end
|
111
|
+
desc 'Deploy on all servers'
|
112
|
+
task :deploy => %w(deploy:alpha deploy:public)
|
113
|
+
|
114
|
+
task :install do
|
115
|
+
sh %{rake package}
|
116
|
+
sh %{sudo gem install pkg/#{Thin::NAME}-#{Thin::VERSION::STRING}}
|
117
|
+
end
|
118
|
+
|
119
|
+
task :uninstall => [:clean] do
|
120
|
+
sh %{sudo gem uninstall #{Thin::NAME}}
|
121
|
+
end
|
122
|
+
|
123
|
+
task :tag do
|
124
|
+
sh %Q{svn cp . http://code.macournoyer.com/svn/thin/tags/#{Thin::VERSION::STRING} -m "Tagging version #{Thin::VERSION::STRING}"}
|
125
|
+
end
|
126
|
+
|
127
|
+
# == Utilities
|
97
128
|
|
98
129
|
def upload(file, to, options={})
|
99
130
|
sh %{ssh macournoyer@macournoyer.com "rm -rf code.macournoyer.com/#{to}"} if options[:replace]
|
@@ -0,0 +1,182 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
thin » Module: Kernel
|
7
|
+
</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
<script language="JavaScript" type="text/javascript">
|
11
|
+
// <![CDATA[
|
12
|
+
|
13
|
+
function toggleSource( id )
|
14
|
+
{
|
15
|
+
var elem
|
16
|
+
var link
|
17
|
+
|
18
|
+
if( document.getElementById )
|
19
|
+
{
|
20
|
+
elem = document.getElementById( id )
|
21
|
+
link = document.getElementById( "l_" + id )
|
22
|
+
}
|
23
|
+
else if ( document.all )
|
24
|
+
{
|
25
|
+
elem = eval( "document.all." + id )
|
26
|
+
link = eval( "document.all.l_" + id )
|
27
|
+
}
|
28
|
+
else
|
29
|
+
return false;
|
30
|
+
|
31
|
+
if( elem.style.display == "block" )
|
32
|
+
{
|
33
|
+
elem.style.display = "none"
|
34
|
+
link.innerHTML = "show source"
|
35
|
+
}
|
36
|
+
else
|
37
|
+
{
|
38
|
+
elem.style.display = "block"
|
39
|
+
link.innerHTML = "hide source"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
function openCode( url )
|
44
|
+
{
|
45
|
+
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
|
46
|
+
}
|
47
|
+
// ]]>
|
48
|
+
</script>
|
49
|
+
</head>
|
50
|
+
<body>
|
51
|
+
<ul id="menu">
|
52
|
+
<li><a href="/thin/">home</a></li>
|
53
|
+
<li><a href="/thin/doc/">doc</a></li>
|
54
|
+
<li><a href="/thin/trac.fcgi/timeline">timeline</a></li>
|
55
|
+
<li><a href="/thin/trac.fcgi/browser">code</a></li>
|
56
|
+
<li><a href="/thin/trac.fcgi/report">tickets</a></li>
|
57
|
+
<li><a href="/thin/trac.fcgi/newticket">new ticket</a></li>
|
58
|
+
</ul>
|
59
|
+
<div id="sidebar">
|
60
|
+
<h2>Files</h2>
|
61
|
+
<ul class="list">
|
62
|
+
<li><a href="../files/README.html" value="File: README">README</a></li>
|
63
|
+
<li><a href="../files/lib/thin/cgi_rb.html" value="File: cgi.rb">lib/thin/cgi.rb</a></li>
|
64
|
+
<li><a href="../files/lib/thin/cluster_rb.html" value="File: cluster.rb">lib/thin/cluster.rb</a></li>
|
65
|
+
<li><a href="../files/lib/thin/command_rb.html" value="File: command.rb">lib/thin/command.rb</a></li>
|
66
|
+
<li><a href="../files/lib/thin/consts_rb.html" value="File: consts.rb">lib/thin/consts.rb</a></li>
|
67
|
+
<li><a href="../files/lib/thin/daemonizing_rb.html" value="File: daemonizing.rb">lib/thin/daemonizing.rb</a></li>
|
68
|
+
<li><a href="../files/lib/thin/handler_rb.html" value="File: handler.rb">lib/thin/handler.rb</a></li>
|
69
|
+
<li><a href="../files/lib/thin/headers_rb.html" value="File: headers.rb">lib/thin/headers.rb</a></li>
|
70
|
+
<li><a href="../files/lib/thin/logging_rb.html" value="File: logging.rb">lib/thin/logging.rb</a></li>
|
71
|
+
<li><a href="../files/lib/thin/mime_types_rb.html" value="File: mime_types.rb">lib/thin/mime_types.rb</a></li>
|
72
|
+
<li><a href="../files/lib/thin/rails_rb.html" value="File: rails.rb">lib/thin/rails.rb</a></li>
|
73
|
+
<li><a href="../files/lib/thin/recipes_rb.html" value="File: recipes.rb">lib/thin/recipes.rb</a></li>
|
74
|
+
<li><a href="../files/lib/thin/request_rb.html" value="File: request.rb">lib/thin/request.rb</a></li>
|
75
|
+
<li><a href="../files/lib/thin/response_rb.html" value="File: response.rb">lib/thin/response.rb</a></li>
|
76
|
+
<li><a href="../files/lib/thin/server_rb.html" value="File: server.rb">lib/thin/server.rb</a></li>
|
77
|
+
<li><a href="../files/lib/thin/statuses_rb.html" value="File: statuses.rb">lib/thin/statuses.rb</a></li>
|
78
|
+
<li><a href="../files/lib/thin/version_rb.html" value="File: version.rb">lib/thin/version.rb</a></li>
|
79
|
+
<li><a href="../files/bin/thin.html" value="File: thin">bin/thin</a></li>
|
80
|
+
<li><a href="../files/bin/thin_cluster.html" value="File: thin_cluster">bin/thin_cluster</a></li>
|
81
|
+
</ul>
|
82
|
+
|
83
|
+
<h2>Classes</h2>
|
84
|
+
<ul class="list">
|
85
|
+
<li><a href="../classes/Thin.html" title="Module: Thin">Thin</a></li>
|
86
|
+
<li><a href="../classes/Thin/Commands.html" title="Module: Thin::Commands">Thin::Commands</a></li>
|
87
|
+
<li><a href="../classes/Thin/Daemonizable.html" title="Module: Thin::Daemonizable">Thin::Daemonizable</a></li>
|
88
|
+
<li><a href="../classes/Thin/Daemonizable/ClassMethods.html" title="Module: Thin::Daemonizable::ClassMethods">Thin::Daemonizable::ClassMethods</a></li>
|
89
|
+
<li><a href="../classes/Thin/VERSION.html" title="Module: Thin::VERSION">Thin::VERSION</a></li>
|
90
|
+
<li><a href="../classes/Thin/Logging.html" title="Module: Thin::Logging">Thin::Logging</a></li>
|
91
|
+
<li><a href="../classes/Thin/DirHandler.html" title="Class: Thin::DirHandler">Thin::DirHandler</a></li>
|
92
|
+
<li><a href="../classes/Thin/InvalidRequest.html" title="Class: Thin::InvalidRequest">Thin::InvalidRequest</a></li>
|
93
|
+
<li><a href="../classes/Thin/CGIWrapper.html" title="Class: Thin::CGIWrapper">Thin::CGIWrapper</a></li>
|
94
|
+
<li><a href="../classes/Thin/Command.html" title="Class: Thin::Command">Thin::Command</a></li>
|
95
|
+
<li><a href="../classes/Thin/Response.html" title="Class: Thin::Response">Thin::Response</a></li>
|
96
|
+
<li><a href="../classes/Thin/Headers.html" title="Class: Thin::Headers">Thin::Headers</a></li>
|
97
|
+
<li><a href="../classes/Thin/Server.html" title="Class: Thin::Server">Thin::Server</a></li>
|
98
|
+
<li><a href="../classes/Thin/CommandError.html" title="Class: Thin::CommandError">Thin::CommandError</a></li>
|
99
|
+
<li><a href="../classes/Thin/Request.html" title="Class: Thin::Request">Thin::Request</a></li>
|
100
|
+
<li><a href="../classes/Thin/RailsServer.html" title="Class: Thin::RailsServer">Thin::RailsServer</a></li>
|
101
|
+
<li><a href="../classes/Thin/Cluster.html" title="Class: Thin::Cluster">Thin::Cluster</a></li>
|
102
|
+
<li><a href="../classes/Thin/RailsHandler.html" title="Class: Thin::RailsHandler">Thin::RailsHandler</a></li>
|
103
|
+
<li><a href="../classes/Thin/Handler.html" title="Class: Thin::Handler">Thin::Handler</a></li>
|
104
|
+
<li><a href="../classes/Process.html" title="Module: Process">Process</a></li>
|
105
|
+
<li><a href="../classes/Kernel.html" title="Module: Kernel">Kernel</a></li>
|
106
|
+
</ul>
|
107
|
+
</div>
|
108
|
+
<div id="container">
|
109
|
+
<div id="header">
|
110
|
+
<a href="/thin/" title="Home">
|
111
|
+
<img id="logo" src="../logo.gif" />
|
112
|
+
</a>
|
113
|
+
<h2 id="tag_line">A fast and very simple Ruby web server</h2>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div id="content">
|
117
|
+
<h2>Module: Kernel</h2>
|
118
|
+
|
119
|
+
|
120
|
+
<div id="Kernel" class="page_shade">
|
121
|
+
<div class="page">
|
122
|
+
<h3>Module Kernel < <a href="Handler.html">Object</a></h3>
|
123
|
+
|
124
|
+
<span class="path">(in files
|
125
|
+
<a href="../files/lib/thin/daemonizing_rb.html">lib/thin/daemonizing.rb</a>
|
126
|
+
)</span>
|
127
|
+
|
128
|
+
<p>
|
129
|
+
Handle a request and populate a response.
|
130
|
+
</p>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<h4>Includes</h4>
|
136
|
+
<ul>
|
137
|
+
<li><a href="Logging.html">Logging</a></li>
|
138
|
+
</ul>
|
139
|
+
|
140
|
+
<h2 class="ruled">Methods</h2>
|
141
|
+
<h4 class="ruled">
|
142
|
+
<span class="method-type" title="Public Instance method">Public Instance</span>
|
143
|
+
<strong><a name="M000073" href="#M000073" title="Permalink to Public Instance method: daemonize">daemonize()</a></strong>
|
144
|
+
</h4>
|
145
|
+
|
146
|
+
<p>
|
147
|
+
Turns the current script into a daemon process that detaches from the
|
148
|
+
console. It can be shut down with a TERM signal. Taken from ActiveSupport.
|
149
|
+
</p>
|
150
|
+
|
151
|
+
<div class="sourcecode">
|
152
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">show source</a> ]</p>
|
153
|
+
<div id="M000073_source" class="dyn-source">
|
154
|
+
<pre>
|
155
|
+
<span class="ruby-comment cmt"># File lib/thin/daemonizing.rb, line 7</span>
|
156
|
+
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">daemonize</span>
|
157
|
+
8: <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fork</span> <span class="ruby-comment cmt"># Parent exits, child continues.</span>
|
158
|
+
9: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">setsid</span> <span class="ruby-comment cmt"># Become session leader.</span>
|
159
|
+
10: <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fork</span> <span class="ruby-comment cmt"># Zap session leader. See [1].</span>
|
160
|
+
11: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span> <span class="ruby-value str">"/"</span> <span class="ruby-comment cmt"># Release old working directory.</span>
|
161
|
+
12: <span class="ruby-constant">File</span>.<span class="ruby-identifier">umask</span> <span class="ruby-value">0000</span> <span class="ruby-comment cmt"># Ensure sensible umask. Adjust as needed.</span>
|
162
|
+
13: <span class="ruby-constant">STDIN</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">"/dev/null"</span> <span class="ruby-comment cmt"># Free file descriptors and</span>
|
163
|
+
14: <span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-value str">"/dev/null"</span>, <span class="ruby-value str">"a"</span> <span class="ruby-comment cmt"># point them somewhere sensible.</span>
|
164
|
+
15: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">reopen</span> <span class="ruby-constant">STDOUT</span> <span class="ruby-comment cmt"># STDOUT/ERR should better go to a logfile.</span>
|
165
|
+
16: <span class="ruby-identifier">trap</span>(<span class="ruby-value str">"TERM"</span>) { <span class="ruby-identifier">exit</span> }
|
166
|
+
17: <span class="ruby-keyword kw">end</span>
|
167
|
+
</pre>
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
<div id="footer">
|
178
|
+
<hr />
|
179
|
+
© <a href="http://macournoyer.com">Marc-André Cournoyer</a>
|
180
|
+
</div>
|
181
|
+
</body>
|
182
|
+
</html>
|
@@ -0,0 +1,175 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>
|
6
|
+
thin » Module: Process
|
7
|
+
</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
<script language="JavaScript" type="text/javascript">
|
11
|
+
// <![CDATA[
|
12
|
+
|
13
|
+
function toggleSource( id )
|
14
|
+
{
|
15
|
+
var elem
|
16
|
+
var link
|
17
|
+
|
18
|
+
if( document.getElementById )
|
19
|
+
{
|
20
|
+
elem = document.getElementById( id )
|
21
|
+
link = document.getElementById( "l_" + id )
|
22
|
+
}
|
23
|
+
else if ( document.all )
|
24
|
+
{
|
25
|
+
elem = eval( "document.all." + id )
|
26
|
+
link = eval( "document.all.l_" + id )
|
27
|
+
}
|
28
|
+
else
|
29
|
+
return false;
|
30
|
+
|
31
|
+
if( elem.style.display == "block" )
|
32
|
+
{
|
33
|
+
elem.style.display = "none"
|
34
|
+
link.innerHTML = "show source"
|
35
|
+
}
|
36
|
+
else
|
37
|
+
{
|
38
|
+
elem.style.display = "block"
|
39
|
+
link.innerHTML = "hide source"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
function openCode( url )
|
44
|
+
{
|
45
|
+
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
|
46
|
+
}
|
47
|
+
// ]]>
|
48
|
+
</script>
|
49
|
+
</head>
|
50
|
+
<body>
|
51
|
+
<ul id="menu">
|
52
|
+
<li><a href="/thin/">home</a></li>
|
53
|
+
<li><a href="/thin/doc/">doc</a></li>
|
54
|
+
<li><a href="/thin/trac.fcgi/timeline">timeline</a></li>
|
55
|
+
<li><a href="/thin/trac.fcgi/browser">code</a></li>
|
56
|
+
<li><a href="/thin/trac.fcgi/report">tickets</a></li>
|
57
|
+
<li><a href="/thin/trac.fcgi/newticket">new ticket</a></li>
|
58
|
+
</ul>
|
59
|
+
<div id="sidebar">
|
60
|
+
<h2>Files</h2>
|
61
|
+
<ul class="list">
|
62
|
+
<li><a href="../files/README.html" value="File: README">README</a></li>
|
63
|
+
<li><a href="../files/lib/thin/cgi_rb.html" value="File: cgi.rb">lib/thin/cgi.rb</a></li>
|
64
|
+
<li><a href="../files/lib/thin/cluster_rb.html" value="File: cluster.rb">lib/thin/cluster.rb</a></li>
|
65
|
+
<li><a href="../files/lib/thin/command_rb.html" value="File: command.rb">lib/thin/command.rb</a></li>
|
66
|
+
<li><a href="../files/lib/thin/consts_rb.html" value="File: consts.rb">lib/thin/consts.rb</a></li>
|
67
|
+
<li><a href="../files/lib/thin/daemonizing_rb.html" value="File: daemonizing.rb">lib/thin/daemonizing.rb</a></li>
|
68
|
+
<li><a href="../files/lib/thin/handler_rb.html" value="File: handler.rb">lib/thin/handler.rb</a></li>
|
69
|
+
<li><a href="../files/lib/thin/headers_rb.html" value="File: headers.rb">lib/thin/headers.rb</a></li>
|
70
|
+
<li><a href="../files/lib/thin/logging_rb.html" value="File: logging.rb">lib/thin/logging.rb</a></li>
|
71
|
+
<li><a href="../files/lib/thin/mime_types_rb.html" value="File: mime_types.rb">lib/thin/mime_types.rb</a></li>
|
72
|
+
<li><a href="../files/lib/thin/rails_rb.html" value="File: rails.rb">lib/thin/rails.rb</a></li>
|
73
|
+
<li><a href="../files/lib/thin/recipes_rb.html" value="File: recipes.rb">lib/thin/recipes.rb</a></li>
|
74
|
+
<li><a href="../files/lib/thin/request_rb.html" value="File: request.rb">lib/thin/request.rb</a></li>
|
75
|
+
<li><a href="../files/lib/thin/response_rb.html" value="File: response.rb">lib/thin/response.rb</a></li>
|
76
|
+
<li><a href="../files/lib/thin/server_rb.html" value="File: server.rb">lib/thin/server.rb</a></li>
|
77
|
+
<li><a href="../files/lib/thin/statuses_rb.html" value="File: statuses.rb">lib/thin/statuses.rb</a></li>
|
78
|
+
<li><a href="../files/lib/thin/version_rb.html" value="File: version.rb">lib/thin/version.rb</a></li>
|
79
|
+
<li><a href="../files/bin/thin.html" value="File: thin">bin/thin</a></li>
|
80
|
+
<li><a href="../files/bin/thin_cluster.html" value="File: thin_cluster">bin/thin_cluster</a></li>
|
81
|
+
</ul>
|
82
|
+
|
83
|
+
<h2>Classes</h2>
|
84
|
+
<ul class="list">
|
85
|
+
<li><a href="../classes/Thin.html" title="Module: Thin">Thin</a></li>
|
86
|
+
<li><a href="../classes/Thin/Commands.html" title="Module: Thin::Commands">Thin::Commands</a></li>
|
87
|
+
<li><a href="../classes/Thin/Daemonizable.html" title="Module: Thin::Daemonizable">Thin::Daemonizable</a></li>
|
88
|
+
<li><a href="../classes/Thin/Daemonizable/ClassMethods.html" title="Module: Thin::Daemonizable::ClassMethods">Thin::Daemonizable::ClassMethods</a></li>
|
89
|
+
<li><a href="../classes/Thin/VERSION.html" title="Module: Thin::VERSION">Thin::VERSION</a></li>
|
90
|
+
<li><a href="../classes/Thin/Logging.html" title="Module: Thin::Logging">Thin::Logging</a></li>
|
91
|
+
<li><a href="../classes/Thin/DirHandler.html" title="Class: Thin::DirHandler">Thin::DirHandler</a></li>
|
92
|
+
<li><a href="../classes/Thin/InvalidRequest.html" title="Class: Thin::InvalidRequest">Thin::InvalidRequest</a></li>
|
93
|
+
<li><a href="../classes/Thin/CGIWrapper.html" title="Class: Thin::CGIWrapper">Thin::CGIWrapper</a></li>
|
94
|
+
<li><a href="../classes/Thin/Command.html" title="Class: Thin::Command">Thin::Command</a></li>
|
95
|
+
<li><a href="../classes/Thin/Response.html" title="Class: Thin::Response">Thin::Response</a></li>
|
96
|
+
<li><a href="../classes/Thin/Headers.html" title="Class: Thin::Headers">Thin::Headers</a></li>
|
97
|
+
<li><a href="../classes/Thin/Server.html" title="Class: Thin::Server">Thin::Server</a></li>
|
98
|
+
<li><a href="../classes/Thin/CommandError.html" title="Class: Thin::CommandError">Thin::CommandError</a></li>
|
99
|
+
<li><a href="../classes/Thin/Request.html" title="Class: Thin::Request">Thin::Request</a></li>
|
100
|
+
<li><a href="../classes/Thin/RailsServer.html" title="Class: Thin::RailsServer">Thin::RailsServer</a></li>
|
101
|
+
<li><a href="../classes/Thin/Cluster.html" title="Class: Thin::Cluster">Thin::Cluster</a></li>
|
102
|
+
<li><a href="../classes/Thin/RailsHandler.html" title="Class: Thin::RailsHandler">Thin::RailsHandler</a></li>
|
103
|
+
<li><a href="../classes/Thin/Handler.html" title="Class: Thin::Handler">Thin::Handler</a></li>
|
104
|
+
<li><a href="../classes/Process.html" title="Module: Process">Process</a></li>
|
105
|
+
<li><a href="../classes/Kernel.html" title="Module: Kernel">Kernel</a></li>
|
106
|
+
</ul>
|
107
|
+
</div>
|
108
|
+
<div id="container">
|
109
|
+
<div id="header">
|
110
|
+
<a href="/thin/" title="Home">
|
111
|
+
<img id="logo" src="../logo.gif" />
|
112
|
+
</a>
|
113
|
+
<h2 id="tag_line">A fast and very simple Ruby web server</h2>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div id="content">
|
117
|
+
<h2>Module: Process</h2>
|
118
|
+
|
119
|
+
|
120
|
+
<div id="Process" class="page_shade">
|
121
|
+
<div class="page">
|
122
|
+
<h3>Module Process < <a href="Handler.html">Object</a></h3>
|
123
|
+
|
124
|
+
<span class="path">(in files
|
125
|
+
<a href="../files/lib/thin/daemonizing_rb.html">lib/thin/daemonizing.rb</a>
|
126
|
+
)</span>
|
127
|
+
|
128
|
+
<p>
|
129
|
+
Handle a request and populate a response.
|
130
|
+
</p>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<h4>Includes</h4>
|
136
|
+
<ul>
|
137
|
+
<li><a href="Logging.html">Logging</a></li>
|
138
|
+
</ul>
|
139
|
+
|
140
|
+
<h2 class="ruled">Methods</h2>
|
141
|
+
<h4 class="ruled">
|
142
|
+
<span class="method-type" title="Public Instance method">Public Instance</span>
|
143
|
+
<strong><a name="M000072" href="#M000072" title="Permalink to Public Instance method: running?">running?(pid)</a></strong>
|
144
|
+
</h4>
|
145
|
+
|
146
|
+
<p>
|
147
|
+
Returns <tt>true</tt> the process identied by <tt>pid</tt> is running.
|
148
|
+
</p>
|
149
|
+
|
150
|
+
<div class="sourcecode">
|
151
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000072_source')" id="l_M000072_source">show source</a> ]</p>
|
152
|
+
<div id="M000072_source" class="dyn-source">
|
153
|
+
<pre>
|
154
|
+
<span class="ruby-comment cmt"># File lib/thin/daemonizing.rb, line 23</span>
|
155
|
+
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">running?</span>(<span class="ruby-identifier">pid</span>)
|
156
|
+
24: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">getpgid</span>(<span class="ruby-identifier">pid</span>) <span class="ruby-operator">!=</span> <span class="ruby-value">-1</span>
|
157
|
+
25: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ESRCH</span>
|
158
|
+
26: <span class="ruby-keyword kw">false</span>
|
159
|
+
27: <span class="ruby-keyword kw">end</span>
|
160
|
+
</pre>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
<div id="footer">
|
171
|
+
<hr />
|
172
|
+
© <a href="http://macournoyer.com">Marc-André Cournoyer</a>
|
173
|
+
</div>
|
174
|
+
</body>
|
175
|
+
</html>
|