passenger 4.0.3 → 4.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (46) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +30 -0
  3. data/build/agents.rb +3 -0
  4. data/build/apache2.rb +2 -3
  5. data/build/basics.rb +20 -0
  6. data/build/common_library.rb +15 -0
  7. data/build/cxx_tests.rb +4 -1
  8. data/build/packaging.rb +22 -32
  9. data/doc/Packaging.html +792 -0
  10. data/doc/Users guide Nginx.html +2 -2
  11. data/doc/Users guide Nginx.txt +2 -2
  12. data/ext/apache2/Configuration.cpp +34 -62
  13. data/ext/apache2/Configuration.hpp +1 -14
  14. data/ext/apache2/DirectoryMapper.h +134 -104
  15. data/ext/apache2/Hooks.cpp +33 -19
  16. data/ext/common/AgentsStarter.cpp +22 -22
  17. data/ext/common/AgentsStarter.h +25 -25
  18. data/ext/common/ApplicationPool2/AppTypes.cpp +6 -6
  19. data/ext/common/ApplicationPool2/AppTypes.h +61 -9
  20. data/ext/common/ApplicationPool2/Implementation.cpp +14 -2
  21. data/ext/common/Constants.h +54 -23
  22. data/ext/common/Constants.h.erb +42 -0
  23. data/ext/common/ServerInstanceDir.h +6 -11
  24. data/ext/common/Utils/CachedFileStat.cpp +10 -9
  25. data/ext/common/Utils/CachedFileStat.h +8 -8
  26. data/ext/common/Utils/LargeFiles.cpp +12 -4
  27. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -0
  28. data/ext/common/agents/Watchdog/Main.cpp +2 -2
  29. data/ext/nginx/Configuration.c +1 -1
  30. data/ext/nginx/Configuration.h +0 -1
  31. data/ext/nginx/ContentHandler.c +15 -15
  32. data/ext/nginx/ngx_http_passenger_module.c +48 -48
  33. data/ext/nginx/ngx_http_passenger_module.h +7 -9
  34. data/helper-scripts/wsgi-loader.py +2 -2
  35. data/lib/phusion_passenger.rb +1 -3
  36. data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -11
  37. data/lib/phusion_passenger/constants.rb +42 -0
  38. data/lib/phusion_passenger/packaging.rb +8 -6
  39. data/lib/phusion_passenger/platform_info.rb +11 -6
  40. data/lib/phusion_passenger/standalone/command.rb +4 -2
  41. data/lib/phusion_passenger/standalone/runtime_installer.rb +1 -1
  42. data/resources/templates/standalone/config.erb +14 -2
  43. data/test/ruby/admin_tools_spec.rb +14 -16
  44. metadata +4 -3
  45. metadata.gz.asc +7 -7
  46. data/lib/phusion_passenger/wsgi/request_handler.py +0 -199
metadata.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJRn9OxAAoJECrHRaUKISqM/UAH/282HhIyLkr616LFhFf7KWTQ
6
- OQnu9P8NlHQaUw/yJDZonQDMnMjlPuUYdgJ3xgqFEpLpcAspmJdhlO1G4z4jdhtV
7
- G5kTA9LCCuBAbpml0d17grFOEO/23VhJaNjU2uOQKnxS2Q6zVazffCj8AQwRugNc
8
- PXCshWCE909zln9HgpC3Rs+W0kJHGsrkX/lFHQPWQvVuTQYxYYBuHsafj+TcAzjg
9
- wB7TRZIsBV4SzGuaQDlmDhwDo38LEOHhg3d7wFej0sGaUaqmrBgcgBt8UKPI2nr5
10
- U43eiJEitSfaNxCtLtfIQDGxvSVcY2Qh2yJ/+L4UguStJbxlQ5dgNswD3P1yc5w=
11
- =zaV0
5
+ iQEcBAABAgAGBQJRo8yCAAoJECrHRaUKISqMSDkH/RxWUudgepdJIx2wDNN1YwMG
6
+ QiHESwcQu9ZcgtSdHsc6BeexfFRTKs8PUatUHikJoOtZI4AOIpozk6RWC+qxC5uO
7
+ 5OetfgbH1sDc+TnwJP2Ev49DEcNFAvbSTC5/dw6c8yvACwiwU/uwI+6RDIZ1B0kT
8
+ F2iq6LIqxtRsOdd8RWPDnFkrgA9YWtHwcjbXxG3mrL/i2pYghkRukKEkmDpR7P6a
9
+ 6SV6wtqWm2IfcGskLIEd/rGNKnZUiRRpLTjY5wuxArUJSr6h6J5W0c9XOv3xQSHL
10
+ d40LIN7xtSZ5Ju/1K1G+6E+UZwrM0JVyN8td7wbQKLYX+449/WbAwJJueuG3wBQ=
11
+ =kL76
12
12
  -----END PGP SIGNATURE-----
@@ -1,199 +0,0 @@
1
- #!/usr/bin/env python
2
- # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2010 Phusion
4
- #
5
- # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
-
25
- import socket, os, random, sys, struct, select, imp
26
- import exceptions, traceback
27
-
28
- from socket import _fileobject
29
-
30
- class RequestHandler:
31
- def __init__(self, socket_file, server, owner_pipe, app):
32
- self.socket_file = socket_file
33
- self.server = server
34
- self.owner_pipe = owner_pipe
35
- self.app = app
36
-
37
- def cleanup(self):
38
- self.server.close()
39
- try:
40
- os.remove(self.socket_file)
41
- except:
42
- pass
43
-
44
- def main_loop(self):
45
- done = False
46
- try:
47
- while not done:
48
- client, address = self.accept_connection()
49
- if not client:
50
- done = True
51
- break
52
- try:
53
- try:
54
- env, input_stream = self.parse_request(client)
55
- if env:
56
- if env['REQUEST_METHOD'] == 'ping':
57
- self.process_ping(env, input_stream, client)
58
- else:
59
- self.process_request(env, input_stream, client)
60
- else:
61
- done = True
62
- except KeyboardInterrupt:
63
- done = True
64
- except Exception, e:
65
- traceback.print_tb(sys.exc_info()[2])
66
- sys.stderr.write(str(e.__class__) + ": " + e.message + "\n")
67
- finally:
68
- try:
69
- client.close()
70
- except:
71
- pass
72
- except KeyboardInterrupt:
73
- pass
74
-
75
- def accept_connection(self):
76
- result = select.select([self.owner_pipe, self.server.fileno()], [], [])[0]
77
- if self.server.fileno() in result:
78
- return self.server.accept()
79
- else:
80
- return (None, None)
81
-
82
- def parse_request(self, client):
83
- buf = ''
84
- while len(buf) < 4:
85
- tmp = client.recv(4 - len(buf))
86
- if len(tmp) == 0:
87
- return (None, None)
88
- buf += tmp
89
- header_size = struct.unpack('>I', buf)[0]
90
-
91
- buf = ''
92
- while len(buf) < header_size:
93
- tmp = client.recv(header_size - len(buf))
94
- if len(tmp) == 0:
95
- return (None, None)
96
- buf += tmp
97
-
98
- headers = buf.split("\0")
99
- headers.pop() # Remove trailing "\0"
100
- env = {}
101
- i = 0
102
- while i < len(headers):
103
- env[headers[i]] = headers[i + 1]
104
- i += 2
105
-
106
- return (env, client)
107
-
108
- def process_request(self, env, input_stream, output_stream):
109
- # The WSGI speculation says that the input paramter object passed needs to
110
- # implement a few file-like methods. This is the reason why we "wrap" the socket._socket
111
- # into the _fileobject to solve this.
112
- #
113
- # Otherwise, the POST data won't be correctly retrieved by Django.
114
- #
115
- # See: http://www.python.org/dev/peps/pep-0333/#input-and-error-streams
116
- env['wsgi.input'] = _fileobject(input_stream,'r',512)
117
- env['wsgi.errors'] = sys.stderr
118
- env['wsgi.version'] = (1, 0)
119
- env['wsgi.multithread'] = False
120
- env['wsgi.multiprocess'] = True
121
- env['wsgi.run_once'] = True
122
- if env.get('HTTPS','off') in ('on', '1'):
123
- env['wsgi.url_scheme'] = 'https'
124
- else:
125
- env['wsgi.url_scheme'] = 'http'
126
-
127
-
128
- # The following environment variables are required by WSCI PEP #333
129
- # see: http://www.python.org/dev/peps/pep-0333/#environ-variables
130
- if 'HTTP_CONTENT_LENGTH' in env:
131
- env['CONTENT_LENGTH'] = env.get('HTTP_CONTENT_LENGTH')
132
-
133
-
134
- headers_set = []
135
- headers_sent = []
136
-
137
- def write(data):
138
- if not headers_set:
139
- raise AssertionError("write() before start_response()")
140
- elif not headers_sent:
141
- # Before the first output, send the stored headers.
142
- status, response_headers = headers_sent[:] = headers_set
143
- output_stream.send('Status: %s\r\n' % status)
144
- for header in response_headers:
145
- output_stream.send('%s: %s\r\n' % header)
146
- output_stream.send('\r\n')
147
- output_stream.send(data)
148
-
149
- def start_response(status, response_headers, exc_info = None):
150
- if exc_info:
151
- try:
152
- if headers_sent:
153
- # Re-raise original exception if headers sent.
154
- raise exc_info[0], exc_info[1], exc_info[2]
155
- finally:
156
- # Avoid dangling circular ref.
157
- exc_info = None
158
- elif headers_set:
159
- raise AssertionError("Headers already set!")
160
-
161
- headers_set[:] = [status, response_headers]
162
- return write
163
-
164
- result = self.app(env, start_response)
165
- try:
166
- for data in result:
167
- # Don't send headers until body appears.
168
- if data:
169
- write(data)
170
- if not headers_sent:
171
- # Send headers now if body was empty.
172
- write('')
173
- finally:
174
- if hasattr(result, 'close'):
175
- result.close()
176
-
177
- def process_ping(self, env, input_stream, output_stream):
178
- output_stream.send("pong")
179
-
180
- def import_error_handler(environ, start_response):
181
- write = start_response('500 Import Error', [('Content-type', 'text/plain')])
182
- write("An error occurred importing your passenger_wsgi.py")
183
- raise KeyboardInterrupt # oh WEIRD.
184
-
185
- if __name__ == "__main__":
186
- socket_file = sys.argv[1]
187
- server = socket.fromfd(int(sys.argv[2]), socket.AF_UNIX, socket.SOCK_STREAM)
188
- owner_pipe = int(sys.argv[3])
189
-
190
- try:
191
- app_module = imp.load_source('passenger_wsgi', 'passenger_wsgi.py')
192
- handler = RequestHandler(socket_file, server, owner_pipe, app_module.application)
193
- except:
194
- handler = RequestHandler(socket_file, server, owner_pipe, import_error_handler)
195
-
196
- try:
197
- handler.main_loop()
198
- finally:
199
- handler.cleanup()