passenger 5.0.8 → 5.0.9

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 (168) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.editorconfig +20 -0
  5. data/CHANGELOG +21 -0
  6. data/bin/passenger-install-apache2-module +3 -1
  7. data/build/agents.rb +7 -5
  8. data/build/basics.rb +3 -3
  9. data/build/common_library.rb +52 -30
  10. data/build/cxx_tests.rb +20 -13
  11. data/build/misc.rb +5 -5
  12. data/doc/Design and Architecture.html +1 -1
  13. data/doc/Design and Architecture.txt +1 -1
  14. data/doc/Packaging.html +4 -4
  15. data/doc/Packaging.txt.md +4 -4
  16. data/doc/Users guide Apache.html +22 -9
  17. data/doc/Users guide Apache.idmap.txt +4 -2
  18. data/doc/Users guide Apache.txt +2 -0
  19. data/doc/Users guide Nginx.html +22 -9
  20. data/doc/Users guide Nginx.idmap.txt +4 -2
  21. data/doc/Users guide Nginx.txt +2 -0
  22. data/doc/Users guide Standalone.html +14 -9
  23. data/doc/Users guide Standalone.idmap.txt +4 -2
  24. data/doc/users_guide_snippets/installation.txt +10 -6
  25. data/ext/apache2/Hooks.cpp +13 -2
  26. data/ext/common/ApplicationPool2/Pool/Inspection.h +8 -3
  27. data/ext/common/BackgroundEventLoop.cpp +249 -67
  28. data/ext/common/BackgroundEventLoop.h +5 -5
  29. data/ext/common/Constants.h +1 -1
  30. data/ext/common/InstanceDirectory.h +8 -6
  31. data/ext/common/ServerKit/Context.h +8 -2
  32. data/ext/common/ServerKit/FileBufferedChannel.h +262 -226
  33. data/ext/common/ServerKit/HeaderTable.h +28 -3
  34. data/ext/common/ServerKit/HttpHeaderParser.h +37 -13
  35. data/ext/common/ServerKit/HttpServer.h +17 -1
  36. data/ext/common/ServerKit/Implementation.cpp +2 -0
  37. data/ext/common/ServerKit/Server.h +25 -28
  38. data/ext/common/Utils/IOUtils.cpp +11 -0
  39. data/ext/common/Utils/ProcessMetricsCollector.h +4 -0
  40. data/ext/common/Utils/StrIntUtils.cpp +11 -7
  41. data/ext/common/Utils/StrIntUtils.h +1 -1
  42. data/ext/common/Utils/StrIntUtilsNoStrictAliasing.cpp +21 -16
  43. data/ext/common/agents/Base.cpp +6 -0
  44. data/ext/common/agents/Base.h +2 -0
  45. data/ext/common/agents/HelperAgent/AdminServer.h +25 -25
  46. data/ext/common/agents/HelperAgent/Main.cpp +37 -12
  47. data/ext/common/agents/HelperAgent/RequestHandler.h +18 -20
  48. data/ext/common/agents/HelperAgent/RequestHandler/AppResponse.h +4 -0
  49. data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +10 -6
  50. data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +2 -0
  51. data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +1 -1
  52. data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +1 -1
  53. data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +9 -2
  54. data/ext/common/agents/HelperAgent/ResponseCache.h +11 -11
  55. data/ext/common/agents/LoggingAgent/AdminServer.h +8 -8
  56. data/ext/common/agents/LoggingAgent/Main.cpp +6 -5
  57. data/ext/common/agents/Watchdog/AdminServer.h +13 -13
  58. data/ext/common/agents/Watchdog/Main.cpp +8 -3
  59. data/ext/libuv/.gitignore +72 -0
  60. data/ext/libuv/AUTHORS +199 -0
  61. data/ext/libuv/ChangeLog +2023 -0
  62. data/ext/libuv/LICENSE +46 -0
  63. data/ext/libuv/Makefile.am +336 -0
  64. data/ext/libuv/README.md +197 -0
  65. data/ext/libuv/checksparse.sh +233 -0
  66. data/ext/libuv/common.gypi +210 -0
  67. data/ext/libuv/configure.ac +67 -0
  68. data/ext/libuv/gyp_uv.py +96 -0
  69. data/ext/libuv/include/android-ifaddrs.h +54 -0
  70. data/ext/libuv/include/pthread-fixes.h +72 -0
  71. data/ext/libuv/include/tree.h +768 -0
  72. data/ext/libuv/include/uv-aix.h +32 -0
  73. data/ext/libuv/include/uv-bsd.h +34 -0
  74. data/ext/libuv/include/uv-darwin.h +61 -0
  75. data/ext/libuv/include/uv-errno.h +418 -0
  76. data/ext/libuv/include/uv-linux.h +34 -0
  77. data/ext/libuv/include/uv-sunos.h +44 -0
  78. data/ext/libuv/include/uv-threadpool.h +37 -0
  79. data/ext/libuv/include/uv-unix.h +383 -0
  80. data/ext/libuv/include/uv-version.h +39 -0
  81. data/ext/libuv/include/uv.h +1455 -0
  82. data/ext/libuv/libuv.pc.in +11 -0
  83. data/ext/libuv/m4/.gitignore +4 -0
  84. data/ext/libuv/m4/as_case.m4 +21 -0
  85. data/ext/libuv/m4/libuv-check-flags.m4 +319 -0
  86. data/ext/libuv/src/fs-poll.c +255 -0
  87. data/ext/libuv/src/heap-inl.h +245 -0
  88. data/ext/libuv/src/inet.c +313 -0
  89. data/ext/libuv/src/queue.h +92 -0
  90. data/ext/libuv/src/threadpool.c +303 -0
  91. data/ext/libuv/src/unix/aix.c +1240 -0
  92. data/ext/libuv/src/unix/android-ifaddrs.c +703 -0
  93. data/ext/libuv/src/unix/async.c +284 -0
  94. data/ext/libuv/src/unix/atomic-ops.h +60 -0
  95. data/ext/libuv/src/unix/core.c +985 -0
  96. data/ext/libuv/src/unix/darwin-proctitle.c +206 -0
  97. data/ext/libuv/src/unix/darwin.c +331 -0
  98. data/ext/libuv/src/unix/dl.c +83 -0
  99. data/ext/libuv/src/unix/freebsd.c +435 -0
  100. data/ext/libuv/src/unix/fs.c +1189 -0
  101. data/ext/libuv/src/unix/fsevents.c +899 -0
  102. data/ext/libuv/src/unix/getaddrinfo.c +202 -0
  103. data/ext/libuv/src/unix/getnameinfo.c +120 -0
  104. data/ext/libuv/src/unix/internal.h +314 -0
  105. data/ext/libuv/src/unix/kqueue.c +418 -0
  106. data/ext/libuv/src/unix/linux-core.c +876 -0
  107. data/ext/libuv/src/unix/linux-inotify.c +257 -0
  108. data/ext/libuv/src/unix/linux-syscalls.c +471 -0
  109. data/ext/libuv/src/unix/linux-syscalls.h +158 -0
  110. data/ext/libuv/src/unix/loop-watcher.c +63 -0
  111. data/ext/libuv/src/unix/loop.c +135 -0
  112. data/ext/libuv/src/unix/netbsd.c +368 -0
  113. data/ext/libuv/src/unix/openbsd.c +384 -0
  114. data/ext/libuv/src/unix/pipe.c +288 -0
  115. data/ext/libuv/src/unix/poll.c +113 -0
  116. data/ext/libuv/src/unix/process.c +551 -0
  117. data/ext/libuv/src/unix/proctitle.c +102 -0
  118. data/ext/libuv/src/unix/pthread-fixes.c +103 -0
  119. data/ext/libuv/src/unix/signal.c +465 -0
  120. data/ext/libuv/src/unix/spinlock.h +53 -0
  121. data/ext/libuv/src/unix/stream.c +1598 -0
  122. data/ext/libuv/src/unix/sunos.c +763 -0
  123. data/ext/libuv/src/unix/tcp.c +327 -0
  124. data/ext/libuv/src/unix/thread.c +519 -0
  125. data/ext/libuv/src/unix/timer.c +172 -0
  126. data/ext/libuv/src/unix/tty.c +265 -0
  127. data/ext/libuv/src/unix/udp.c +833 -0
  128. data/ext/libuv/src/uv-common.c +544 -0
  129. data/ext/libuv/src/uv-common.h +214 -0
  130. data/ext/libuv/src/version.c +49 -0
  131. data/ext/libuv/uv.gyp +487 -0
  132. data/ext/nginx/ContentHandler.c +21 -10
  133. data/ext/nginx/ngx_http_passenger_module.c +7 -0
  134. data/ext/oxt/implementation.cpp +9 -2
  135. data/ext/oxt/initialize.hpp +5 -1
  136. data/lib/phusion_passenger.rb +3 -3
  137. data/lib/phusion_passenger/admin_tools/instance.rb +10 -6
  138. data/lib/phusion_passenger/admin_tools/instance_registry.rb +6 -2
  139. data/lib/phusion_passenger/packaging.rb +3 -4
  140. data/lib/phusion_passenger/platform_info.rb +13 -1
  141. data/lib/phusion_passenger/platform_info/apache.rb +15 -4
  142. data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -1
  143. data/lib/phusion_passenger/rack/thread_handler_extension.rb +184 -99
  144. data/lib/phusion_passenger/request_handler/thread_handler.rb +13 -6
  145. data/lib/phusion_passenger/standalone/start_command.rb +2 -2
  146. data/resources/templates/apache2/apache_install_broken.txt.erb +2 -1
  147. metadata +99 -22
  148. metadata.gz.asc +7 -7
  149. data/ext/libeio/Changes +0 -76
  150. data/ext/libeio/LICENSE +0 -36
  151. data/ext/libeio/Makefile.am +0 -15
  152. data/ext/libeio/Makefile.in +0 -694
  153. data/ext/libeio/aclocal.m4 +0 -9418
  154. data/ext/libeio/autogen.sh +0 -3
  155. data/ext/libeio/config.guess +0 -1540
  156. data/ext/libeio/config.h.in +0 -136
  157. data/ext/libeio/config.sub +0 -1779
  158. data/ext/libeio/configure +0 -14822
  159. data/ext/libeio/configure.ac +0 -22
  160. data/ext/libeio/demo.c +0 -194
  161. data/ext/libeio/ecb.h +0 -714
  162. data/ext/libeio/eio.c +0 -2818
  163. data/ext/libeio/eio.h +0 -414
  164. data/ext/libeio/install-sh +0 -520
  165. data/ext/libeio/libeio.m4 +0 -195
  166. data/ext/libeio/ltmain.sh +0 -9636
  167. data/ext/libeio/missing +0 -376
  168. data/ext/libeio/xthread.h +0 -166
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDM2NTNjMzUzYmRhZmI2YzFmNTkyNTQ4OTQ0OWM3YjBhZTljYTVhYg==
4
+ ZTFhY2FmOWRiZWQ2ZjZkZmZjMTMzMjY1YTdmMjIyMTdjMjY5Njg5MA==
5
5
  data.tar.gz: !binary |-
6
- ZjQ0NTUwNjQ1ZDNlZThlNzEwODUzOTJkOTM3N2QwNjQ5YTVlNjBhZQ==
6
+ NTU2MGZmMWFhZmE1ZWI1MDQ3MWU5NjBjMmE1MGEyNjNkMTBjYzllYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzQwMjVkYmUyMDAyMTllYzYwNmRkNGJmZDE2ZmM0OGY1ZDVjMmE2Mjk2YTRh
10
- NDNkODliZGM4NjQwNWY4OTYwNWFmNTVlMzczNWZkN2I3MzZmYjM1ODNkZmVh
11
- ZDJlNDQzY2M0ODY1Mjk2Y2U5ZTZhNmU3MzI1ZWNiYTczZmM5OWE=
9
+ Mjg3NTEyMzgzYTU4Yjk3OGExMGYxZDkwZjlhODc0OGIyMjUxNDI1N2JiY2I5
10
+ MWE2ODM1OTRiMGQwZWU2MGE2MDg1MzVkM2RmOTUwNjUwOGNmYTAxNTZiODI0
11
+ M2FiM2RkNWUyYjRiZmU3MGYwODE1YjllNzlmOGU1YWNhNDFkODM=
12
12
  data.tar.gz: !binary |-
13
- NGQ0OGNmYTAwMDI4MDg5YTQ3MzhhZTlkOGMwNmUyMzE4Y2UxNzFmMTY3NWQ4
14
- NjExNGI4MzhhNjYyMDEzZjUwNmFhZTRmYjY5NmZmYWRjYzI0NTAzZWZhM2E1
15
- NjliZTBiNmNkMWMwYmRlMzA4M2VkOTM0ZTNmNGVkZDk2MjFkOTE=
13
+ YWFmZjI1MzI3ZmRiZjgxMTZjYjFkZGE3NGUyYWZkYThiNmI4YjYyNTY5NWJl
14
+ NDYxMDRlNzU1NGQyNWZkN2JmNjVmNTc3ODBkNWMxOTE3YmJiYjNlNjA4ZTE1
15
+ Yzc0ZGJiOTQ0MzQ4ZTZiZTY4Yjg4YmU5MzYwYjIwOTQ3YTIwOWQ=
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJVXENEAAoJECrHRaUKISqM1yIH/3iiP55teXIQdypzsniSos6Q
6
- lDKqr0KDOAK1HRthLmc1xyTYPqzrHNqdJelH0Hj2SEw70aM5SSJ1miwTZPuwEThT
7
- kzwk4+rSAoeUumxr5kqW5BHrcGj5KD5lVXDpYZbwP+Ggz/UJpC0mZ0g4AxbB9//R
8
- azlnpXIjOcek1GmxvsTOsesFYX9DCKfHpC50Droc5biUtUm7x+GHzTwALazNyUkn
9
- chlYoAzrORXkt9N2m5l/D3qOtYKZ9MMc4ZWFGrziGgdrwiRg8lon/V4xjcKdF2JB
10
- tppn5PEczG5co6cJ69rrKFr88nH6xqnvipxjqiGRz5jou4OTBcy46F3YKYZi/CI=
11
- =A3tu
5
+ iQEcBAABAgAGBQJVb0YJAAoJECrHRaUKISqMfcIIAIii/TpyNGySvg08YS36RVU5
6
+ wJi6g3Y8UZ04Kjd9Ccdn8c1JXJbOR3JYY1Dl+8MP8ZIqBuIx0MnVXcj4Vn1RxFjj
7
+ GSIBKpRtpiIpajeqsULfsHOOyc0sZqZJzISh6WFgYhAZC0x7gEJoB217PJd2YK2h
8
+ PxegmOj2+2EGB86T9LhG9u8QIdoQgvydnnE4mNfnNBAKDMFrG9f86HqetlBy2PK5
9
+ EqmV1nysqM4w8F/tLhiwB34/t4zUFVLsGfw1Ek+hHCyKmAMJRsBchrWF40ZJdlB0
10
+ O7Tv52czrajhazEYsNajvj9HmN2eQL1Wv3H7Tm0pChB/TRweahmVAXYG40PBsR4=
11
+ =QFWp
12
12
  -----END PGP SIGNATURE-----
data.tar.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
- iQEcBAABAgAGBQJVXENEAAoJECrHRaUKISqMJu8H/j+UFpo8bgsMoBBAQmb9VFG8
6
- A6l0wsFtxEnd1pFNkI4+KFT4olD/rpksJAUUAt2s3yXhfreTP1lkjO/eCSX2PBBp
7
- DQc03J7XM05SHsoJ1Vo3HqWB0gIdZQ79xn0R0DAmlZQ2EubvqtskNUsb4Eu+0qIk
8
- /sjt8yKGt2Q+ZSxfxQGWaA85ZCIIfXQOR7ZZG0Da/v917WZ5vWEO64yOT31eAR7p
9
- KIUzyp8o/Cit5Z1+f7iX0IhhlUZJhcVgqXTm1dNuNyW8MOlRQU+N7nbT9Rk7Jhy5
10
- ST6vX+Ay0nqi65wU5IkXmLwJe1n+bJBXnocLigfb6tYjGfLElYtYlCbyl61PCSo=
11
- =gIJk
5
+ iQEcBAABAgAGBQJVb0YJAAoJECrHRaUKISqMPRsIAIdmYwKUqKv0J9nS3gFUBBGa
6
+ BPOS+uxmWtItdk3QfbxSlIZlCKehSB/tnn/L64fspxIx+cPUDh+h4A2/dKlSRl8z
7
+ fhn1gOOBdaidK+pvMiqjHja3ssXwfD2S2zANWrBFU8zJgjx0/DvE/lqsb1JkOQRT
8
+ Tukdj/vitrhySTaKvbOjE0lXljuAD+AFMI92yypBsiTXdb3Dg2VKd0NhcedI0+2m
9
+ LSvCXKgP+/X6iqSRuIoLfWKzSdnoGeZqNDYwc8nm9TxbWAlpQ1DVS6vQgCsAztA2
10
+ dDeJxWdS8V4pirjoddT/TpvEqrPRSjiS3uPRXwH4u2i/6uCl98xZ5t2v9q7+svQ=
11
+ =1sKu
12
12
  -----END PGP SIGNATURE-----
@@ -96,6 +96,26 @@ indent_style = space
96
96
  indent_size = 2
97
97
  trim_trailing_whitespace = false
98
98
 
99
+ [ext/libuv/src/*.c]
100
+ indent_style = space
101
+ indent_size = 2
102
+ trim_trailing_whitespace = false
103
+
104
+ [ext/libuv/src/*.h]
105
+ indent_style = space
106
+ indent_size = 2
107
+ trim_trailing_whitespace = false
108
+
109
+ [ext/libuv/src/unix/*.c]
110
+ indent_style = space
111
+ indent_size = 2
112
+ trim_trailing_whitespace = false
113
+
114
+ [ext/libuv/src/unix/*.h]
115
+ indent_style = space
116
+ indent_size = 2
117
+ trim_trailing_whitespace = false
118
+
99
119
  [resources/templates/standalone/config.erb]
100
120
  indent_style = space
101
121
  indent_size = 4
data/CHANGELOG CHANGED
@@ -1,3 +1,24 @@
1
+ Release 5.0.9
2
+ -------------
3
+
4
+ * The casing of original headers as generated by the application are now preserved, instead of being downcased. This fixes compatibility issues with broken HTTP clients. Closes GH-1436.
5
+ * Internal refactoring: we've replaced libeio with libuv. This makes some of our code simpler. Closes GH-1428.
6
+ * When the passenger-status tool tries to cleanup a stale instance directory, it will no longer abort with an error when it fails to do that. It will now merely print a warning. Fixes [StackOverflow question 30354732](http://stackoverflow.com/questions/30354732/cap-aborted-capistrano-aborts-rails-deploy-while-attempting-to-chown-tmp-p/30357100#30357100).
7
+ * Fixes compilation problems on Solaris.
8
+ * The Ruby handler has been made more robust. Previously, it was possible for applications to corrupt connections by returning incorrect Rack responses. This may cause connections to get stuck. The Rack handler has been hardened to ensure that connections will never get corrupted or stuck. Closes GH-1512.
9
+ * The Ruby handler now closes the Rack response body even when the socket connection is hijacked by the application. The Rack specification is unclear about what to do in this case, and different Ruby app servers do different things. We have found that by closing the body object anyway, we maximize compatibility with existing Rack middlewares and apps, such as Rack::Lock. Background information about this issue can be found at https://github.com/ngauthier/tubesock/issues/10#issuecomment-72539461.
10
+ * Fixes a crash that could occur if some HTTP request headers are present, but have the empty value. Closes GH-1524.
11
+ * Fixes a permission problem that prevents the web server from communicating with Passenger when user switching is off. Closes GH-1520.
12
+ * Fixes a few small one-time memory leaks in the Passenger agent. This wraps up the workitems discovered in valgrind runs on earlier versions.
13
+ * Fixes use of uninitialized metrics. This could happen for a brief moment after spawning.
14
+ * [Apache] If you pass the `--apxs2-path` parameter to `passenger-install-apache2-module`, and the apxs2 path that you specified is not in PATH, then the installer would think that Apache installation is broken. This has been fixed.
15
+ * [Apache] A `Connection: close` header that was used for internal communication between Passenger processes was being leaked to the client, which breaks HTTP keep-alive connections. This has been fixed. Closes GH-1516.
16
+ * [Nginx] The preferred Nginx version is now 1.8.0. It was previously 1.6.3.
17
+ * [Nginx] Passenger now passes to the application the raw URI as sent by the client, as long as Nginx didn't modify the URI (e.g. as part of rewrite rules). This means that escaped slashes (%2F) in the URI now work correctly and out-of-the-box as long as there are no applicable rewrite rules.
18
+ * [Nginx] Fixes that crash that would occur if Nginx is configured to log to syslog. And to prevent log messages from disappearing into a black hole, Passenger will now ask you to set `passenger_log_file` if Nginx is configured to log to syslog. Closes GH-1514.
19
+ * [Standalone] Prevents an existing instance from being shut down if starting a new instance fails.
20
+
21
+
1
22
  Release 5.0.8
2
23
  -------------
3
24
 
@@ -39,7 +39,8 @@ PhusionPassenger.locate_directories
39
39
  # the 'sbin' folders to $PATH just in case. On some systems
40
40
  # 'sbin' isn't in $PATH unless the user is logged in as root from
41
41
  # the start (i.e. not via 'su' or 'sudo').
42
- ENV["PATH"] += ":/usr/sbin:/sbin:/usr/local/sbin"
42
+ EXTRA_INSTALLER_PATHS = ":/usr/sbin:/sbin:/usr/local/sbin"
43
+ ENV["PATH"] += EXTRA_INSTALLER_PATHS
43
44
 
44
45
  require 'optparse'
45
46
  require 'stringio'
@@ -231,6 +232,7 @@ private
231
232
  if Process.uid == 0
232
233
  render_template 'apache2/apache_install_broken',
233
234
  :apxs2 => PlatformInfo.apxs2,
235
+ :extra_paths => EXTRA_INSTALLER_PATHS,
234
236
  :sudo_s_e => PhusionPassenger::PlatformInfo.ruby_sudo_shell_command("-E"),
235
237
  :ruby => PhusionPassenger::PlatformInfo.ruby_command,
236
238
  :passenger_config => "#{PhusionPassenger.bin_dir}/passenger-config"
@@ -123,7 +123,9 @@ AGENT_OBJECTS.each_pair do |agent_object, agent_dependencies|
123
123
  "-o #{full_agent_object} " <<
124
124
  "#{EXTRA_PRE_CXXFLAGS} " <<
125
125
  "-Iext -Iext/common " <<
126
- "#{AGENT_CFLAGS} #{LIBEV_CFLAGS} #{LIBEIO_CFLAGS} " <<
126
+ "#{AGENT_CFLAGS} #{LIBEV_CFLAGS} #{LIBUV_CFLAGS} " <<
127
+ "#{PlatformInfo.curl_flags} " <<
128
+ "#{PlatformInfo.zlib_flags} " <<
127
129
  "#{EXTRA_CXXFLAGS}")
128
130
  end
129
131
  end
@@ -138,7 +140,7 @@ dependencies = agent_objects + [
138
140
  LIBBOOST_OXT,
139
141
  agent_libs.link_objects,
140
142
  LIBEV_TARGET,
141
- LIBEIO_TARGET
143
+ LIBUV_TARGET
142
144
  ].flatten.compact
143
145
  file AGENT_OUTPUT_DIR + AGENT_EXE => dependencies do
144
146
  agent_objects_as_string = agent_objects.join(" ")
@@ -147,7 +149,7 @@ file AGENT_OUTPUT_DIR + AGENT_EXE => dependencies do
147
149
  "-o #{AGENT_OUTPUT_DIR}#{AGENT_EXE}.o " <<
148
150
  "#{EXTRA_PRE_CXXFLAGS} " <<
149
151
  "-Iext -Iext/common " <<
150
- "#{AGENT_CFLAGS} #{LIBEV_CFLAGS} #{LIBEIO_CFLAGS} " <<
152
+ "#{AGENT_CFLAGS} #{LIBEV_CFLAGS} #{LIBUV_CFLAGS} " <<
151
153
  "#{PlatformInfo.curl_flags} " <<
152
154
  "#{PlatformInfo.zlib_flags} " <<
153
155
  "#{EXTRA_CXXFLAGS}")
@@ -157,8 +159,8 @@ file AGENT_OUTPUT_DIR + AGENT_EXE => dependencies do
157
159
  "#{agent_objects_as_string} " <<
158
160
  "#{LIBBOOST_OXT_LINKARG} " <<
159
161
  "#{EXTRA_PRE_CXX_LDFLAGS} " <<
160
- "#{LIBEV_LIBS} " <<
161
- "#{LIBEIO_LIBS} " <<
162
+ "#{libev_libs} " <<
163
+ "#{libuv_libs} " <<
162
164
  "#{PlatformInfo.curl_libs} " <<
163
165
  "#{PlatformInfo.zlib_libs} " <<
164
166
  "#{PlatformInfo.portability_cxx_ldflags} " <<
@@ -202,7 +202,7 @@ AGENT_OUTPUT_DIR = string_option('AGENT_OUTPUT_DIR', OUTPUT_DIR + "supp
202
202
  COMMON_OUTPUT_DIR = string_option('COMMON_OUTPUT_DIR', OUTPUT_DIR + "common") + "/"
203
203
  APACHE2_OUTPUT_DIR = string_option('APACHE2_OUTPUT_DIR', OUTPUT_DIR + "apache2") + "/"
204
204
  LIBEV_OUTPUT_DIR = string_option('LIBEV_OUTPUT_DIR', OUTPUT_DIR + "libev") + "/"
205
- LIBEIO_OUTPUT_DIR = string_option('LIBEIO_OUTPUT_DIR', OUTPUT_DIR + "libeio") + "/"
205
+ LIBUV_OUTPUT_DIR = string_option('LIBUV_OUTPUT_DIR', OUTPUT_DIR + "libuv") + "/"
206
206
  ruby_extension_archdir = PlatformInfo.ruby_extension_binary_compatibility_id
207
207
  RUBY_EXTENSION_OUTPUT_DIR = string_option('RUBY_EXTENSION_OUTPUT_DIR',
208
208
  OUTPUT_DIR + "ruby/" + ruby_extension_archdir) + "/"
@@ -211,5 +211,5 @@ PKG_DIR = string_option('PKG_DIR', "pkg")
211
211
 
212
212
  # Whether to use the vendored libev or the system one.
213
213
  USE_VENDORED_LIBEV = boolean_option("USE_VENDORED_LIBEV", true)
214
- # Whether to use the vendored libeio or the system one.
215
- USE_VENDORED_LIBEIO = boolean_option("USE_VENDORED_LIBEIO", true)
214
+ # Whether to use the vendored libuv or the system one.
215
+ USE_VENDORED_LIBUV = boolean_option("USE_VENDORED_LIBUV", true)
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  # Phusion Passenger - https://www.phusionpassenger.com/
2
3
  # Copyright (c) 2010-2015 Phusion
3
4
  #
@@ -98,8 +99,7 @@ end
98
99
  if USE_VENDORED_LIBEV
99
100
  LIBEV_SOURCE_DIR = File.expand_path("../ext/libev", File.dirname(__FILE__)) + "/"
100
101
  LIBEV_CFLAGS = "-Iext/libev"
101
- LIBEV_LIBS = LIBEV_OUTPUT_DIR + ".libs/libev.a"
102
- LIBEV_TARGET = LIBEV_LIBS
102
+ LIBEV_TARGET = LIBEV_OUTPUT_DIR + ".libs/libev.a"
103
103
 
104
104
  task :libev => LIBEV_TARGET
105
105
 
@@ -140,33 +140,42 @@ if USE_VENDORED_LIBEV
140
140
  end
141
141
 
142
142
  task :clean => 'libev:clean'
143
+
144
+ def libev_libs
145
+ la_contents = File.open(LIBEV_OUTPUT_DIR + ".libs/libev.la", "r") do |f|
146
+ f.read
147
+ end
148
+ la_contents =~ /dependency_libs='(.+)'/
149
+ "#{LIBEV_OUTPUT_DIR}.libs/libev.a #{$1}".strip
150
+ end
143
151
  else
144
152
  LIBEV_CFLAGS = string_option('LIBEV_CFLAGS', '-I/usr/include/libev')
145
- LIBEV_LIBS = string_option('LIBEV_LIBS', '-lev')
146
153
  LIBEV_TARGET = nil
147
154
  task :libev # do nothing
155
+
156
+ def libev_libs
157
+ string_option('LIBEV_LIBS', '-lev')
158
+ end
148
159
  end
149
160
 
150
161
  # Apple Clang 4.2 complains about ambiguous member templates in ev++.h.
151
162
  LIBEV_CFLAGS << " -Wno-ambiguous-member-template" if PlatformInfo.compiler_supports_wno_ambiguous_member_template?
152
163
 
153
164
 
154
- ########## libeio ##########
165
+ ########## libuv ##########
155
166
 
156
- if USE_VENDORED_LIBEIO
157
- LIBEIO_SOURCE_DIR = File.expand_path("../ext/libeio", File.dirname(__FILE__)) + "/"
158
- LIBEIO_CFLAGS = "-Iext/libeio"
159
- LIBEIO_LIBS = LIBEIO_OUTPUT_DIR + ".libs/libeio.a"
160
- LIBEIO_TARGET = LIBEIO_LIBS
167
+ if USE_VENDORED_LIBUV
168
+ LIBUV_SOURCE_DIR = File.expand_path("../ext/libuv", File.dirname(__FILE__)) + "/"
169
+ LIBUV_CFLAGS = "-Iext/libuv/include"
170
+ LIBUV_TARGET = LIBUV_OUTPUT_DIR + ".libs/libuv.a"
161
171
 
162
- task :libeio => LIBEIO_TARGET
172
+ task :libuv => LIBUV_TARGET
163
173
 
164
174
  dependencies = [
165
- "ext/libeio/configure",
166
- "ext/libeio/config.h.in",
167
- "ext/libeio/Makefile.am"
175
+ "ext/libuv/configure",
176
+ "ext/libuv/Makefile.am"
168
177
  ]
169
- file LIBEIO_OUTPUT_DIR + "Makefile" => dependencies do
178
+ file LIBUV_OUTPUT_DIR + "Makefile" => dependencies do
170
179
  cc = CC
171
180
  cxx = CXX
172
181
  if OPTIMIZE && LTO
@@ -176,34 +185,47 @@ if USE_VENDORED_LIBEIO
176
185
  # Disable all warnings. The author has a clear standpoint on that:
177
186
  # http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#COMPILER_WARNINGS
178
187
  cflags = "#{EXTRA_CFLAGS} -w"
179
- sh "mkdir -p #{LIBEIO_OUTPUT_DIR}" if !File.directory?(LIBEIO_OUTPUT_DIR)
180
- sh "cd #{LIBEIO_OUTPUT_DIR} && sh #{LIBEIO_SOURCE_DIR}configure " +
188
+ sh "mkdir -p #{LIBUV_OUTPUT_DIR}" if !File.directory?(LIBUV_OUTPUT_DIR)
189
+ # Prevent 'make' from regenerating autotools files
190
+ sh "cd #{LIBUV_SOURCE_DIR} && (touch aclocal.m4 configure Makefile.in || true)"
191
+ sh "cd #{LIBUV_OUTPUT_DIR} && sh #{LIBUV_SOURCE_DIR}configure " +
181
192
  "--disable-shared --enable-static " +
182
- # libeio's configure script may select a different default compiler than we
193
+ # libuv's configure script may select a different default compiler than we
183
194
  # do, so we force our compiler choice.
184
- "CC='#{cc}' CXX='#{cxx}' CFLAGS='#{cflags}'"
195
+ "CC='#{cc}' CXX='#{cxx}' CFLAGS='#{cflags}' AM_V_CC= AM_V_CCLD="
185
196
  end
186
197
 
187
- libeio_sources = Dir["ext/libeio/{*.c,*.h}"]
188
- file LIBEIO_OUTPUT_DIR + ".libs/libeio.a" => [LIBEIO_OUTPUT_DIR + "Makefile"] + libeio_sources do
189
- sh "rm -f #{LIBEIO_OUTPUT_DIR}/libeio.la"
190
- sh "cd #{LIBEIO_OUTPUT_DIR} && make libeio.la"
198
+ libuv_sources = Dir["ext/libuv/**/{*.c,*.h}"]
199
+ file LIBUV_OUTPUT_DIR + ".libs/libuv.a" => [LIBUV_OUTPUT_DIR + "Makefile"] + libuv_sources do
200
+ sh "rm -f #{LIBUV_OUTPUT_DIR}/libuv.la"
201
+ sh "cd #{LIBUV_OUTPUT_DIR} && make -j2 libuv.la"
191
202
  end
192
203
 
193
- task 'libeio:clean' do
204
+ task 'libuv:clean' do
194
205
  patterns = %w(Makefile config.h config.log config.status libtool
195
- stamp-h1 *.o *.lo *.la .libs .deps)
206
+ stamp-h1 src test *.o *.lo *.la *.pc .libs .deps)
196
207
  patterns.each do |pattern|
197
- sh "rm -rf #{LIBEIO_OUTPUT_DIR}#{pattern}"
208
+ sh "rm -rf #{LIBUV_OUTPUT_DIR}#{pattern}"
198
209
  end
199
210
  end
200
211
 
201
- task :clean => 'libeio:clean'
212
+ task :clean => 'libuv:clean'
213
+
214
+ def libuv_libs
215
+ la_contents = File.open(LIBUV_OUTPUT_DIR + ".libs/libuv.la", "r") do |f|
216
+ f.read
217
+ end
218
+ la_contents =~ /dependency_libs='(.+)'/
219
+ "#{LIBUV_OUTPUT_DIR}.libs/libuv.a #{$1}".strip
220
+ end
202
221
  else
203
- LIBEIO_CFLAGS = string_option('LIBEIO_CFLAGS', '-I/usr/include/libeio')
204
- LIBEIO_LIBS = string_option('LIBEIO_LIBS', '-leio')
205
- LIBEIO_TARGET = nil
206
- task :libeio # do nothing
222
+ LIBUV_CFLAGS = string_option('LIBUV_CFLAGS', '-I/usr/include/libuv')
223
+ LIBUV_TARGET = nil
224
+ task :libuv # do nothing
225
+
226
+ def libuv_libs
227
+ string_option('LIBUV_LIBS', '-luv')
228
+ end
207
229
  end
208
230
 
209
231
 
@@ -25,19 +25,26 @@
25
25
 
26
26
  TEST_CXX_CFLAGS = "-Iext -Iext/common " <<
27
27
  "#{EXTRA_PRE_CXXFLAGS} " <<
28
- "#{LIBEV_CFLAGS} #{LIBEIO_CFLAGS} #{PlatformInfo.curl_flags} -Itest/cxx -Itest/support " <<
28
+ "#{LIBEV_CFLAGS} #{LIBUV_CFLAGS} #{PlatformInfo.curl_flags} -Itest/cxx -Itest/support " <<
29
29
  "#{TEST_COMMON_CFLAGS}"
30
30
  TEST_CXX_CFLAGS << " #{PlatformInfo.adress_sanitizer_flag}" if USE_ASAN
31
- TEST_CXX_LDFLAGS = "#{EXTRA_PRE_CXX_LDFLAGS} " <<
32
- "#{TEST_COMMON_LIBRARY.link_objects_as_string} " <<
33
- "#{TEST_BOOST_OXT_LIBRARY} #{LIBEV_LIBS} #{LIBEIO_LIBS} " <<
34
- "#{PlatformInfo.curl_libs} " <<
35
- "#{PlatformInfo.zlib_libs} " <<
36
- "#{PlatformInfo.portability_cxx_ldflags}"
37
- TEST_CXX_LDFLAGS << " #{PlatformInfo.dmalloc_ldflags}" if USE_DMALLOC
38
- TEST_CXX_LDFLAGS << " #{PlatformInfo.adress_sanitizer_flag}" if USE_ASAN
39
- TEST_CXX_LDFLAGS << " #{EXTRA_CXX_LDFLAGS}"
40
- TEST_CXX_LDFLAGS.strip!
31
+
32
+ def test_cxx_ldflags
33
+ @test_cxx_ldflags ||= begin
34
+ result = "#{EXTRA_PRE_CXX_LDFLAGS} " <<
35
+ "#{TEST_COMMON_LIBRARY.link_objects_as_string} " <<
36
+ "#{TEST_BOOST_OXT_LIBRARY} #{libev_libs} #{libuv_libs} " <<
37
+ "#{PlatformInfo.curl_libs} " <<
38
+ "#{PlatformInfo.zlib_libs} " <<
39
+ "#{PlatformInfo.portability_cxx_ldflags}"
40
+ result << " #{PlatformInfo.dmalloc_ldflags}" if USE_DMALLOC
41
+ result << " #{PlatformInfo.adress_sanitizer_flag}" if USE_ASAN
42
+ result << " #{EXTRA_CXX_LDFLAGS}"
43
+ result.strip!
44
+ result
45
+ end
46
+ end
47
+
41
48
  TEST_CXX_OBJECTS = {
42
49
  'test/cxx/CxxTestMain.o' => %w(
43
50
  test/cxx/CxxTestMain.cpp),
@@ -293,14 +300,14 @@ end
293
300
  dependencies = [
294
301
  TEST_CXX_OBJECTS.keys,
295
302
  LIBEV_TARGET,
296
- LIBEIO_TARGET,
303
+ LIBUV_TARGET,
297
304
  TEST_BOOST_OXT_LIBRARY,
298
305
  TEST_COMMON_LIBRARY.link_objects,
299
306
  'ext/common/Constants.h'
300
307
  ].flatten.compact
301
308
  file 'test/cxx/CxxTestMain' => dependencies.flatten do
302
309
  objects = TEST_CXX_OBJECTS.keys.join(' ')
303
- create_executable("test/cxx/CxxTestMain", objects, TEST_CXX_LDFLAGS)
310
+ create_executable("test/cxx/CxxTestMain", objects, test_cxx_ldflags)
304
311
  end
305
312
 
306
313
  deps = [
@@ -172,7 +172,7 @@ dependencies = [
172
172
  COMMON_LIBRARY.link_objects,
173
173
  LIBBOOST_OXT,
174
174
  LIBEV_TARGET,
175
- LIBEIO_TARGET
175
+ LIBUV_TARGET
176
176
  ].flatten.compact
177
177
  task :compile_app => dependencies do
178
178
  source = ENV['SOURCE'] || ENV['FILE'] || ENV['F']
@@ -191,16 +191,16 @@ task :compile_app => dependencies do
191
191
  begin
192
192
  compile_cxx(source,
193
193
  "-DSTANDALONE -o #{object} " <<
194
- "-Iext -Iext/common #{LIBEV_CFLAGS} #{LIBEIO_CFLAGS} " <<
194
+ "-Iext -Iext/common #{LIBEV_CFLAGS} #{LIBUV_CFLAGS} " <<
195
195
  "#{EXTRA_CXXFLAGS}")
196
196
  create_executable(exe, object,
197
197
  "-DSTANDALONE " <<
198
- "-Iext -Iext/common #{LIBEV_CFLAGS} #{LIBEIO_CFLAGS} " <<
198
+ "-Iext -Iext/common #{LIBEV_CFLAGS} #{LIBUV_CFLAGS} " <<
199
199
  "#{EXTRA_CXXFLAGS} " <<
200
200
  "#{COMMON_LIBRARY.link_objects_as_string} " <<
201
201
  "#{LIBBOOST_OXT_LINKARG} " <<
202
- "#{LIBEV_LIBS} " <<
203
- "#{LIBEIO_LIBS} " <<
202
+ "#{libev_libs} " <<
203
+ "#{libuv_libs} " <<
204
204
  "#{PlatformInfo.portability_cxx_ldflags} " <<
205
205
  "#{EXTRA_CXX_LDFLAGS}")
206
206
  ensure
@@ -1392,7 +1392,7 @@ The Watchdog reports successful startup back to the Phusion Passenger module tha
1392
1392
  </div>
1393
1393
  <div class="sect3">
1394
1394
  <span class="anchor_helper" id="_i_o_model"></span><h4 data-anchor="_i_o_model">3.1.3. I/O model</h4>
1395
- <div class="paragraph"><p>The RequestHandler uses the <strong>evented I/O model</strong>. This means that the RequestHandler handles many clients (requests) at the same time, using a single thread, inside a single process. This is possible through the use of I/O event multiplexing mechanisms, which are provided by the OS. Examples of such mechanisms include the <span class="monospaced">select()</span>, <span class="monospaced">poll()</span>, <span class="monospaced">epoll()</span> and <span class="monospaced">kqueue()</span> system calls. But those mechanisms are very low-level and OS-specific, so the RequestHandler uses two libraries which abstract away the differences and provide a higher-level API: <a href="http://software.schmorp.de/pkg/libev.html">libev</a> and <a href="http://software.schmorp.de/pkg/libeio.html">libeio</a>.</p></div>
1395
+ <div class="paragraph"><p>The RequestHandler uses the <strong>evented I/O model</strong>. This means that the RequestHandler handles many clients (requests) at the same time, using a single thread, inside a single process. This is possible through the use of I/O event multiplexing mechanisms, which are provided by the OS. Examples of such mechanisms include the <span class="monospaced">select()</span>, <span class="monospaced">poll()</span>, <span class="monospaced">epoll()</span> and <span class="monospaced">kqueue()</span> system calls. But those mechanisms are very low-level and OS-specific, so the RequestHandler uses two libraries which abstract away the differences and provide a higher-level API: <a href="http://software.schmorp.de/pkg/libev.html">libev</a> and <a href="https://github.com/libuv/libuv">libuv</a>.</p></div>
1396
1396
  <div class="paragraph"><p>The evented I/O model is also used in Nginx. It is in contrast to the single-threaded multi-process model which handles 1 client per process (used by Apache with the prefork MPM), or the multi-threaded model which handles 1 client per thread (used by Apache with the worker MPM). You can learn more about evented I/O and the different I/O models through these resources:</p></div>
1397
1397
  <div class="ulist"><ul>
1398
1398
  <li>
@@ -193,7 +193,7 @@ If the ApplicationPool replied with an exception, the RequestHandler sends back
193
193
 
194
194
  ==== I/O model
195
195
 
196
- The RequestHandler uses the **evented I/O model**. This means that the RequestHandler handles many clients (requests) at the same time, using a single thread, inside a single process. This is possible through the use of I/O event multiplexing mechanisms, which are provided by the OS. Examples of such mechanisms include the `select()`, `poll()`, `epoll()` and `kqueue()` system calls. But those mechanisms are very low-level and OS-specific, so the RequestHandler uses two libraries which abstract away the differences and provide a higher-level API: link:http://software.schmorp.de/pkg/libev.html[libev] and link:http://software.schmorp.de/pkg/libeio.html[libeio].
196
+ The RequestHandler uses the **evented I/O model**. This means that the RequestHandler handles many clients (requests) at the same time, using a single thread, inside a single process. This is possible through the use of I/O event multiplexing mechanisms, which are provided by the OS. Examples of such mechanisms include the `select()`, `poll()`, `epoll()` and `kqueue()` system calls. But those mechanisms are very low-level and OS-specific, so the RequestHandler uses two libraries which abstract away the differences and provide a higher-level API: link:http://software.schmorp.de/pkg/libev.html[libev] and link:https://github.com/libuv/libuv[libuv].
197
197
 
198
198
  The evented I/O model is also used in Nginx. It is in contrast to the single-threaded multi-process model which handles 1 client per process (used by Apache with the prefork MPM), or the multi-threaded model which handles 1 client per thread (used by Apache with the worker MPM). You can learn more about evented I/O and the different I/O models through these resources:
199
199
 
@@ -422,19 +422,19 @@ directory instead of downloaded.</p>
422
422
 
423
423
  <h1>Vendoring of libraries</h1>
424
424
 
425
- <p>Phusion Passenger vendors libev and libeio in order to make installation easier
425
+ <p>Phusion Passenger vendors libev and libuv in order to make installation easier
426
426
  for users on operating systems without proper package management, like OS X.
427
427
  If you want Phusion Passenger to compile against the system-provided
428
- libev and/or libeio instead, then set the following environment variables
428
+ libev and/or libuv instead, then set the following environment variables
429
429
  before compiling:</p>
430
430
 
431
431
  <ul>
432
432
  <li><code>export USE_VENDORED_LIBEV=no</code></li>
433
- <li><code>export USE_VENDORED_LIBEIO=no</code></li>
433
+ <li><code>export USE_VENDORED_LIBUV=no</code></li>
434
434
  </ul>
435
435
 
436
436
 
437
- <p>Note that we require at least libev 4.11 and libeio 1.0.</p>
437
+ <p>Note that we require at least libev 4.11 and libuv 1.4.2.</p>
438
438
 
439
439
  <h1>Generating gem and tarball</h1>
440
440