public
Rubygem
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Click here to lend your support to: thin and make a donation at www.pledgie.com !
Strip trailing whitespace and untabify response.rb.
Sat Aug 02 06:18:31 -0700 2008
macournoyer (committer)
Sat Aug 02 07:43:14 -0700 2008
commit  8c45ab4a2fef3d090978935b0af0ae3a2abafbe5
tree    297010d6ae59a42ab53ae3a8a27aa4a3d98f3ccc
parent  692307873c71858036a810d839a61f3e79ac6ea7
...
6
7
8
9
 
10
11
12
 
13
14
15
 
16
17
18
 
19
20
21
22
23
24
 
25
26
27
28
29
30
31
 
32
33
34
 
35
36
37
38
39
40
 
41
42
 
43
44
45
...
69
70
71
72
 
73
74
75
76
77
 
78
79
80
...
84
85
86
87
 
88
89
90
91
92
 
93
94
95
96
97
 
98
99
...
6
7
8
 
9
10
11
 
12
13
14
 
15
16
17
 
18
19
20
21
22
23
 
24
25
26
27
28
29
30
 
31
32
33
 
34
35
36
37
38
39
 
40
41
 
42
43
44
45
...
69
70
71
 
72
73
74
75
76
 
77
78
79
80
...
84
85
86
 
87
88
89
90
91
 
92
93
94
95
96
 
97
98
99
0
@@ -6,40 +6,40 @@ module Thin
0
     KEEP_ALIVE     = 'keep-alive'.freeze
0
     SERVER         = 'Server'.freeze
0
     CONTENT_LENGTH = 'Content-Length'.freeze
0
-    
0
+
0
     # Status code
0
     attr_accessor :status
0
-    
0
+
0
     # Response body, must respond to +each+.
0
     attr_accessor :body
0
-    
0
+
0
     # Headers key-value hash
0
     attr_reader   :headers
0
-    
0
+
0
     def initialize
0
       @headers    = Headers.new
0
       @status     = 200
0
       @persistent = false
0
     end
0
-    
0
+
0
     # String representation of the headers
0
     # to be sent in the response.
0
     def headers_output
0
       # Set default headers
0
       @headers[CONNECTION] = persistent? ? KEEP_ALIVE : CLOSE
0
       @headers[SERVER]     = Thin::SERVER
0
-      
0
+
0
       @headers.to_s
0
     end
0
-        
0
+
0
     # Top header of the response,
0
     # containing the status code and response headers.
0
     def head
0
       "HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status.to_i]}\r\n#{headers_output}\r\n"
0
     end
0
-    
0
+
0
     if Thin.ruby_18?
0
-      
0
+
0
       # Ruby 1.8 implementation.
0
       # Respects Rack specs.
0
       #
0
@@ -69,12 +69,12 @@ module Thin
0
       end
0
 
0
     end
0
-    
0
+
0
     # Close any resource used by the response
0
     def close
0
       @body.close if @body.respond_to?(:close)
0
     end
0
-    
0
+
0
     # Yields each chunk of the response.
0
     # To control the size of each chunk
0
     # define your own +each+ method on +body+.
0
@@ -84,16 +84,16 @@ module Thin
0
         yield chunk
0
       end
0
     end
0
-    
0
+
0
     # Tell the client the connection should stay open
0
     def persistent!
0
       @persistent = true
0
     end
0
-    
0
+
0
     # Persistent connection must be requested as keep-alive
0
     # from the server and have a Content-Length.
0
     def persistent?
0
       @persistent && @headers.has_key?(CONTENT_LENGTH)
0
-    end    
0
+    end
0
   end
0
 end

Comments