public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
Add more doc to Connection
macournoyer (author)
Sun Feb 10 18:26:09 -0800 2008
commit  8d3f1db0b9bc18a214d69202a312523bb30b28bf
tree    038269d29761a7d39366d970e3533c3865b99bc4
parent  5d8d6a703c0d3de3256aaf74537eb01435c65914
...
2
3
4
 
 
5
6
7
8
...
11
12
13
 
14
15
16
17
18
 
19
20
21
...
25
26
27
 
 
28
29
30
...
32
33
34
35
 
36
37
38
39
...
57
58
59
 
 
60
61
62
63
 
 
64
65
66
...
2
3
4
5
6
7
8
9
10
...
13
14
15
16
17
18
19
20
21
22
23
24
25
...
29
30
31
32
33
34
35
36
...
38
39
40
 
41
42
43
44
45
...
63
64
65
66
67
68
69
70
71
72
73
74
75
76
0
@@ -2,6 +2,8 @@
0
 
0
 module Thin
0
   # Connection between the server and client.
0
+ # This class is instanciated by EventMachine on each new connection
0
+ # that is opened.
0
   class Connection < EventMachine::Connection
0
     include Logging
0
     
0
0
@@ -11,11 +13,13 @@
0
     # Connector to the server
0
     attr_accessor :connector
0
     
0
+ # Get the connection ready to process a request.
0
     def post_init
0
       @request = Request.new
0
       @response = Response.new
0
     end
0
     
0
+ # Called when data is received from the client.
0
     def receive_data(data)
0
       trace { data }
0
       process if @request.parse(data)
0
@@ -25,6 +29,8 @@
0
       close_connection
0
     end
0
     
0
+ # Called when all data was received and the request
0
+ # is ready to being processed.
0
     def process
0
       # Add client info to the request env
0
       @request.remote_address = remote_address
0
@@ -32,7 +38,7 @@
0
       # Process the request
0
       @response.status, @response.headers, @response.body = @app.call(@request.env)
0
       
0
- # Tell the client the connection is persistent if requested
0
+ # Make the response persistent if requested by the client
0
       @response.persistent! if @request.persistent?
0
       
0
       # Send the response
0
0
@@ -57,10 +63,14 @@
0
       post_init if persistent?
0
     end
0
     
0
+ # Called when the connection is unbinded from the socket
0
+ # and can no longer be used to process requests.
0
     def unbind
0
       @connector.connection_finished(self)
0
     end
0
     
0
+ # Return +true+ if the connection must be left open
0
+ # and ready to be reused for another request.
0
     def persistent?
0
       @response.persistent?
0
     end

Comments

    No one has commented yet.