passenger 4.0.44 → 4.0.45

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 (110) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG +31 -0
  6. data/CONTRIBUTING.md +70 -10
  7. data/CONTRIBUTORS +4 -0
  8. data/README.md +1 -1
  9. data/Vagrantfile +50 -0
  10. data/bin/passenger-install-nginx-module +7 -2
  11. data/build/basics.rb +4 -1
  12. data/build/documentation.rb +6 -0
  13. data/build/node_tests.rb +7 -1
  14. data/build/packaging.rb +5 -0
  15. data/build/test_basics.rb +3 -3
  16. data/debian.template/copyright +1 -1
  17. data/debian.template/passenger.manpages +0 -1
  18. data/dev/rack.test/config.ru +5 -0
  19. data/dev/rack.test/public/asset.txt +1 -0
  20. data/dev/vagrant/apache_default_site.conf +35 -0
  21. data/dev/vagrant/apache_passenger.conf +5 -0
  22. data/dev/vagrant/apache_passenger.load +1 -0
  23. data/dev/vagrant/apache_ports.conf +24 -0
  24. data/dev/vagrant/apache_rack_test.conf +9 -0
  25. data/dev/vagrant/bashrc +21 -0
  26. data/dev/vagrant/nginx.conf +39 -0
  27. data/dev/vagrant/nginx_rakefile +34 -0
  28. data/dev/vagrant/nginx_start +32 -0
  29. data/dev/vagrant/provision.sh +115 -0
  30. data/dev/vagrant/sudoers.conf +5 -0
  31. data/doc/Design and Architecture.txt +515 -0
  32. data/doc/DeveloperQuickstart.md +70 -0
  33. data/doc/Users guide Apache.idmap.txt +24 -18
  34. data/doc/Users guide Apache.txt +200 -62
  35. data/doc/Users guide Nginx.idmap.txt +53 -45
  36. data/doc/Users guide Nginx.txt +501 -360
  37. data/doc/Users guide Standalone.txt +8 -0
  38. data/doc/images/direct_spawning.png +0 -0
  39. data/doc/images/direct_spawning.svg +16 -13
  40. data/doc/images/helper_agent_core_architecture.png +0 -0
  41. data/doc/images/passenger_architecture_overview.png +0 -0
  42. data/doc/images/smart_spawning.png +0 -0
  43. data/doc/images/{smart.svg → smart_spawning.svg} +23 -20
  44. data/doc/images/spawning_preparation_work.png +0 -0
  45. data/doc/images/startup_sequence.png +0 -0
  46. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +82 -121
  47. data/doc/users_guide_snippets/environment_variables.txt +1 -1
  48. data/doc/users_guide_snippets/support_information.txt +2 -0
  49. data/doc/users_guide_snippets/tips.txt +117 -9
  50. data/ext/apache2/Configuration.hpp +4 -2
  51. data/ext/apache2/ConfigurationCommands.cpp +14 -0
  52. data/ext/apache2/ConfigurationFields.hpp +4 -0
  53. data/ext/apache2/ConfigurationSetters.cpp +22 -0
  54. data/ext/apache2/CreateDirConfig.cpp +2 -0
  55. data/ext/apache2/Hooks.cpp +30 -14
  56. data/ext/apache2/MergeDirConfig.cpp +14 -0
  57. data/ext/apache2/SetHeaders.cpp +8 -0
  58. data/ext/common/ApplicationPool2/AppTypes.cpp +6 -1
  59. data/ext/common/ApplicationPool2/Implementation.cpp +1 -1
  60. data/ext/common/ApplicationPool2/Session.h +1 -1
  61. data/ext/common/Constants.h +9 -7
  62. data/ext/common/Utils/HttpHeaderBufferer.h +23 -4
  63. data/ext/common/Utils/StrIntUtils.h +35 -0
  64. data/ext/common/Utils/StringScanning.h +4 -10
  65. data/ext/common/agents/HelperAgent/RequestHandler.h +90 -49
  66. data/ext/nginx/CacheLocationConfig.c +40 -0
  67. data/ext/nginx/ConfigurationCommands.c +20 -0
  68. data/ext/nginx/ConfigurationFields.h +4 -0
  69. data/ext/nginx/ContentHandler.c +1 -1
  70. data/ext/nginx/CreateLocationConfig.c +9 -0
  71. data/ext/nginx/MergeLocationConfig.c +12 -0
  72. data/ext/nginx/config +2 -2
  73. data/ext/nginx/ngx_http_passenger_module.c +4 -4
  74. data/helper-scripts/node-loader.js +40 -27
  75. data/lib/phusion_passenger.rb +1 -1
  76. data/lib/phusion_passenger/apache2/config_options.rb +14 -2
  77. data/lib/phusion_passenger/constants.rb +7 -6
  78. data/lib/phusion_passenger/loader_shared_helpers.rb +11 -1
  79. data/lib/phusion_passenger/nginx/config_options.rb +8 -0
  80. data/lib/phusion_passenger/packaging.rb +8 -3
  81. data/lib/phusion_passenger/platform_info/apache.rb +3 -0
  82. data/lib/phusion_passenger/platform_info/ruby.rb +4 -1
  83. data/lib/phusion_passenger/standalone/command.rb +0 -1
  84. data/lib/phusion_passenger/standalone/package_runtime_command.rb +1 -0
  85. data/lib/phusion_passenger/standalone/start_command.rb +80 -62
  86. data/lib/phusion_passenger/standalone/status_command.rb +1 -0
  87. data/lib/phusion_passenger/standalone/stop_command.rb +1 -0
  88. data/man/passenger-config.1 +1 -1
  89. data/man/passenger-memory-stats.8 +1 -1
  90. data/man/passenger-status.8 +1 -1
  91. data/npm-shrinkwrap.json +229 -0
  92. data/package.json +28 -0
  93. data/resources/templates/standalone/config.erb +2 -0
  94. data/rpm/Vagrantfile +0 -3
  95. data/test/config.json.vagrant +30 -0
  96. data/test/cxx/HttpHeaderBuffererTest.cpp +64 -10
  97. data/test/cxx/RequestHandlerTest.cpp +35 -13
  98. data/test/integration_tests/apache2_tests.rb +1 -0
  99. data/test/stub/node/app.js +26 -18
  100. metadata +28 -13
  101. metadata.gz.asc +7 -7
  102. data/doc/Architectural overview.idmap.txt +0 -36
  103. data/doc/Architectural overview.txt +0 -410
  104. data/doc/images/smart.png +0 -0
  105. data/ext/common/ApplicationPool2/README.md +0 -56
  106. data/man/passenger-stress-test.1 +0 -43
  107. data/node_lib/phusion_passenger/httplib_emulation.js +0 -215
  108. data/node_lib/phusion_passenger/request_handler.js +0 -73
  109. data/node_lib/phusion_passenger/session_protocol_parser.js +0 -113
  110. data/test/node/httplib_emulation_spec.js +0 -623
@@ -32,6 +32,7 @@ class StatusCommand < Command
32
32
 
33
33
  def run
34
34
  parse_options!("status") do |opts|
35
+ opts.separator "Options:"
35
36
  opts.on("-p", "--port NUMBER", Integer,
36
37
  wrap_desc("The port number of a Phusion Passenger Standalone instance (default: #{@options[:port]})")) do |value|
37
38
  @options[:port] = value
@@ -32,6 +32,7 @@ class StopCommand < Command
32
32
 
33
33
  def run
34
34
  parse_options!("stop") do |opts|
35
+ opts.separator "Options:"
35
36
  opts.on("-p", "--port NUMBER", Integer,
36
37
  wrap_desc("The port number of a Phusion Passenger Standalone instance (default: #{@options[:port]})")) do |value|
37
38
  @options[:port] = value
@@ -19,7 +19,7 @@ Shows the current Phusion Passenger version number
19
19
  .LP
20
20
  passenger\-memory\-stats(1), passenger\-stress\-test(1), passenger\-status(8)
21
21
  .LP
22
- User guide at http://www.modrails.com/documentation.html
22
+ User guide at https://www.phusionpassenger.com/documentation_and_support
23
23
  .SH "AUTHOR"
24
24
  .LP
25
25
  Phusion Passenger is written by Phusion (http://www.phusion.nl)
@@ -23,7 +23,7 @@ The full filename to the Apache executable. By default, Passenger will attempt t
23
23
  .LP
24
24
  passenger\-status(8), ps(1), top(1),
25
25
  .LP
26
- User guide at http://www.modrails.com/documentation.html
26
+ User guide at https://www.phusionpassenger.com/documentation_and_support
27
27
  .SH "AUTHOR"
28
28
  .LP
29
29
  Phusion Passenger is written by Phusion (http://www.phusion.nl)
@@ -33,7 +33,7 @@ The process ID of the Phusion Passenger instance you want to look at
33
33
  .LP
34
34
  passenger\-memory\-stats(8), ps(1), top(1)
35
35
  .LP
36
- User guide at http://www.modrails.com/documentation.html
36
+ User guide at https://www.phusionpassenger.com/documentation_and_support
37
37
  .SH "AUTHOR"
38
38
  .LP
39
39
  Phusion Passenger is written by Phusion (http://www.phusion.nl)
@@ -0,0 +1,229 @@
1
+ {
2
+ "name": "passenger",
3
+ "version": "0.0.0",
4
+ "dependencies": {
5
+ "express": {
6
+ "version": "3.4.8",
7
+ "from": "express@",
8
+ "resolved": "https://registry.npmjs.org/express/-/express-3.4.8.tgz",
9
+ "dependencies": {
10
+ "connect": {
11
+ "version": "2.12.0",
12
+ "from": "connect@2.12.0",
13
+ "resolved": "https://registry.npmjs.org/connect/-/connect-2.12.0.tgz",
14
+ "dependencies": {
15
+ "batch": {
16
+ "version": "0.5.0",
17
+ "from": "batch@0.5.0"
18
+ },
19
+ "qs": {
20
+ "version": "0.6.6",
21
+ "from": "qs@0.6.6"
22
+ },
23
+ "bytes": {
24
+ "version": "0.2.1",
25
+ "from": "bytes@0.2.1"
26
+ },
27
+ "pause": {
28
+ "version": "0.0.1",
29
+ "from": "pause@0.0.1"
30
+ },
31
+ "uid2": {
32
+ "version": "0.0.3",
33
+ "from": "uid2@0.0.3"
34
+ },
35
+ "raw-body": {
36
+ "version": "1.1.2",
37
+ "from": "raw-body@1.1.2"
38
+ },
39
+ "negotiator": {
40
+ "version": "0.3.0",
41
+ "from": "negotiator@0.3.0"
42
+ },
43
+ "multiparty": {
44
+ "version": "2.2.0",
45
+ "from": "multiparty@2.2.0",
46
+ "dependencies": {
47
+ "readable-stream": {
48
+ "version": "1.1.10",
49
+ "from": "readable-stream@~1.1.9",
50
+ "dependencies": {
51
+ "core-util-is": {
52
+ "version": "1.0.1",
53
+ "from": "core-util-is@~1.0.0"
54
+ },
55
+ "string_decoder": {
56
+ "version": "0.10.24",
57
+ "from": "string_decoder@~0.10.x"
58
+ },
59
+ "debuglog": {
60
+ "version": "0.0.2",
61
+ "from": "debuglog@0.0.2"
62
+ }
63
+ }
64
+ },
65
+ "stream-counter": {
66
+ "version": "0.2.0",
67
+ "from": "stream-counter@~0.2.0"
68
+ }
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "commander": {
74
+ "version": "1.3.2",
75
+ "from": "commander@1.3.2",
76
+ "resolved": "https://registry.npmjs.org/commander/-/commander-1.3.2.tgz",
77
+ "dependencies": {
78
+ "keypress": {
79
+ "version": "0.1.0",
80
+ "from": "keypress@0.1.x"
81
+ }
82
+ }
83
+ },
84
+ "range-parser": {
85
+ "version": "0.0.4",
86
+ "from": "range-parser@0.0.4"
87
+ },
88
+ "mkdirp": {
89
+ "version": "0.3.5",
90
+ "from": "mkdirp@0.3.5",
91
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz"
92
+ },
93
+ "cookie": {
94
+ "version": "0.1.0",
95
+ "from": "cookie@0.1.0"
96
+ },
97
+ "buffer-crc32": {
98
+ "version": "0.2.1",
99
+ "from": "buffer-crc32@0.2.1"
100
+ },
101
+ "fresh": {
102
+ "version": "0.2.0",
103
+ "from": "fresh@0.2.0"
104
+ },
105
+ "methods": {
106
+ "version": "0.1.0",
107
+ "from": "methods@0.1.0"
108
+ },
109
+ "send": {
110
+ "version": "0.1.4",
111
+ "from": "send@0.1.4",
112
+ "dependencies": {
113
+ "mime": {
114
+ "version": "1.2.11",
115
+ "from": "mime@~1.2.9"
116
+ }
117
+ }
118
+ },
119
+ "cookie-signature": {
120
+ "version": "1.0.1",
121
+ "from": "cookie-signature@1.0.1"
122
+ },
123
+ "merge-descriptors": {
124
+ "version": "0.0.1",
125
+ "from": "merge-descriptors@0.0.1",
126
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-0.0.1.tgz"
127
+ },
128
+ "debug": {
129
+ "version": "0.7.4",
130
+ "from": "debug@>= 0.7.3 < 1"
131
+ }
132
+ }
133
+ },
134
+ "mocha": {
135
+ "version": "1.15.1",
136
+ "from": "mocha@",
137
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-1.15.1.tgz",
138
+ "dependencies": {
139
+ "commander": {
140
+ "version": "2.0.0",
141
+ "from": "commander@2.0.0",
142
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.0.0.tgz"
143
+ },
144
+ "growl": {
145
+ "version": "1.7.0",
146
+ "from": "growl@1.7.x"
147
+ },
148
+ "jade": {
149
+ "version": "0.26.3",
150
+ "from": "jade@0.26.3",
151
+ "resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz",
152
+ "dependencies": {
153
+ "commander": {
154
+ "version": "0.6.1",
155
+ "from": "commander@0.6.1",
156
+ "resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz"
157
+ },
158
+ "mkdirp": {
159
+ "version": "0.3.0",
160
+ "from": "mkdirp@0.3.0",
161
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz"
162
+ }
163
+ }
164
+ },
165
+ "diff": {
166
+ "version": "1.0.7",
167
+ "from": "diff@1.0.7"
168
+ },
169
+ "debug": {
170
+ "version": "0.7.4",
171
+ "from": "debug@*"
172
+ },
173
+ "mkdirp": {
174
+ "version": "0.3.5",
175
+ "from": "mkdirp@0.3.5"
176
+ },
177
+ "glob": {
178
+ "version": "3.2.3",
179
+ "from": "glob@3.2.3",
180
+ "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.3.tgz",
181
+ "dependencies": {
182
+ "minimatch": {
183
+ "version": "0.2.12",
184
+ "from": "minimatch@~0.2.11",
185
+ "dependencies": {
186
+ "lru-cache": {
187
+ "version": "2.5.0",
188
+ "from": "lru-cache@2"
189
+ },
190
+ "sigmund": {
191
+ "version": "1.0.0",
192
+ "from": "sigmund@~1.0.0"
193
+ }
194
+ }
195
+ },
196
+ "graceful-fs": {
197
+ "version": "2.0.1",
198
+ "from": "graceful-fs@~2.0.0"
199
+ },
200
+ "inherits": {
201
+ "version": "2.0.1",
202
+ "from": "inherits@2"
203
+ }
204
+ }
205
+ }
206
+ }
207
+ },
208
+ "should": {
209
+ "version": "2.0.1",
210
+ "from": "should@"
211
+ },
212
+ "sinon": {
213
+ "version": "1.7.3",
214
+ "from": "sinon@",
215
+ "dependencies": {
216
+ "buster-format": {
217
+ "version": "0.5.6",
218
+ "from": "buster-format@~0.5",
219
+ "dependencies": {
220
+ "buster-core": {
221
+ "version": "0.6.4",
222
+ "from": "buster-core@=0.6.4"
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
data/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "__comment__": [
3
+ "This file is only meant for shrinkwrapping the development dependencies."
4
+ ],
5
+ "name": "passenger",
6
+ "version": "0.0.0",
7
+ "description": "A fast and robust web server and application server for Ruby, Python and Node.js",
8
+ "main": "index.js",
9
+ "dependencies": {
10
+ "should": "^2.0.1",
11
+ "sinon": "^1.7.3",
12
+ "express": "^3.4.8",
13
+ "mocha": "^1.15.1"
14
+ },
15
+ "scripts": {
16
+ "test": "rake test:node"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git://github.com/phusion/passenger.git"
21
+ },
22
+ "author": "Phusion <info@phusion.nl>",
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/phusion/passenger/issues"
26
+ },
27
+ "homepage": "https://www.phusionpassenger.com"
28
+ }
@@ -138,6 +138,8 @@ http {
138
138
  <% if app[:thread_count] != DEFAULT_THREAD_COUNT %>passenger_thread_count <%= app[:thread_count] %>;<% end %>
139
139
  <% if app[:min_instances] %>passenger_min_instances <%= app[:min_instances] %>;<% end %>
140
140
  <% if app[:restart_dir] %>passenger_restart_dir '<%= app[:restart_dir] %>';<% end %>
141
+ <% if @options[:sticky_sessions] %>passenger_sticky_sessions on;<% end %>
142
+ <% if @options[:sticky_sessions_cookie_name] %>passenger_sticky_sessions_cookie_name '<%= sticky_sessions_cookie_name %>';<% end %>
141
143
  <% if app[:union_station_key] %>
142
144
  union_station_support on;
143
145
  union_station_key <%= app[:union_station_key] %>;
data/rpm/Vagrantfile CHANGED
@@ -1,6 +1,3 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
1
  # This Vagrantfile sets up a CentOS VM, for the purpose of RPM development.
5
2
 
6
3
  ROOT = File.expand_path(File.dirname(__FILE__) + "/..")
@@ -0,0 +1,30 @@
1
+ {
2
+ //// This file contains system-specific configuration options that the test suite needs.
3
+ //// Please customize it for your system.
4
+
5
+ // These are the usernames and group names of normal, non-administrator
6
+ // users and groups. Preferably, these are user and group accounts that
7
+ // are normally not used.
8
+ //
9
+ // These users and groups MUST be able to access this 'test' directory,
10
+ // otherwise the tests will fail.
11
+
12
+ ///// Good values for Linux and FreeBSD. Same restrictions apply.
13
+ "normal_user_1": "games",
14
+ "normal_user_2": "daemon",
15
+ "default_user": "man",
16
+ "normal_group_1": "daemon",
17
+ "normal_group_2": "man",
18
+ "default_group": "games",
19
+
20
+ // A nonexistant username, group name, user ID and group ID.
21
+ "nonexistant_user": "xxxxxxxxxxxxxxxxxxx",
22
+ "nonexistant_group": "xxxxxxxxxxxxxxxxxxx",
23
+ "nonexistant_uid": 9999,
24
+ "nonexistant_gid": 9999,
25
+
26
+ // If you want to run the Nginx integration tests, then set the following
27
+ // config option to the full path of the Nginx binary. This Nginx binary *must*
28
+ // be compiled with Phusion Passenger support!
29
+ "nginx": "/home/vagrant/nginx/objs/nginx"
30
+ }
@@ -23,13 +23,13 @@ namespace tut {
23
23
  DEFINE_TEST_GROUP(HttpHeaderBuffererTest);
24
24
 
25
25
  TEST_METHOD(1) {
26
- // Test initial state.
26
+ set_test_name("Test initial state");
27
27
  ensure(bufferer.acceptingInput());
28
28
  ensure(!bufferer.hasError());
29
29
  }
30
30
 
31
31
  TEST_METHOD(2) {
32
- // Test feeding a complete stream everything in one go.
32
+ set_test_name("Test feeding a complete stream everything in one go");
33
33
  ensure_equals(bufferer.feed(input.data(), input.size()), input.size());
34
34
  ensure(!bufferer.acceptingInput());
35
35
  ensure(!bufferer.hasError());
@@ -39,7 +39,7 @@ namespace tut {
39
39
  }
40
40
 
41
41
  TEST_METHOD(3) {
42
- // Test feeding a complete stream byte by byte.
42
+ set_test_name("Test feeding a complete stream byte by byte");
43
43
  const char *pos = input.data();
44
44
  const char *end = input.data() + input.size();
45
45
  while (pos < end) {
@@ -57,7 +57,7 @@ namespace tut {
57
57
  }
58
58
 
59
59
  TEST_METHOD(4) {
60
- // Test feeding a complete stream in pieces of 2 bytes.
60
+ set_test_name("Test feeding a complete stream in pieces of 2 bytes");
61
61
  const char *pos = input.data();
62
62
  const char *end = input.data() + input.size();
63
63
  while (pos < end) {
@@ -76,7 +76,7 @@ namespace tut {
76
76
  }
77
77
 
78
78
  TEST_METHOD(5) {
79
- // Test feeding a complete stream in pieces of 3 bytes.
79
+ set_test_name("Test feeding a complete stream in pieces of 3 bytes");
80
80
  const char *pos = input.data();
81
81
  const char *end = input.data() + input.size();
82
82
  while (pos < end) {
@@ -95,7 +95,7 @@ namespace tut {
95
95
  }
96
96
 
97
97
  TEST_METHOD(20) {
98
- // It refuses to accept any more data after the header terminator until reset is called.
98
+ set_test_name("It refuses to accept any more data after the header terminator until reset is called");
99
99
  string input2 = input;
100
100
  input2.append("hello world");
101
101
 
@@ -116,7 +116,7 @@ namespace tut {
116
116
  }
117
117
 
118
118
  TEST_METHOD(21) {
119
- // Same test as above, except we feed byte-by-byte.
119
+ set_test_name("Same test as above, except we feed byte-by-byte");
120
120
  string input2 = input;
121
121
  input2.append("hello world");
122
122
  const char *pos;
@@ -163,7 +163,7 @@ namespace tut {
163
163
  }
164
164
 
165
165
  TEST_METHOD(22) {
166
- // Test inputting data larger than the max size.
166
+ set_test_name("Test inputting data larger than the max size");
167
167
  input.assign(1024, '\0');
168
168
  bufferer.setMax(512);
169
169
 
@@ -173,7 +173,7 @@ namespace tut {
173
173
  }
174
174
 
175
175
  TEST_METHOD(23) {
176
- // Some as above, except we feed byte-by-byte.
176
+ set_test_name("Some as above, except we feed byte-by-byte");
177
177
  unsigned int i;
178
178
  bufferer.setMax(512);
179
179
 
@@ -191,7 +191,7 @@ namespace tut {
191
191
  }
192
192
 
193
193
  TEST_METHOD(24) {
194
- // Test garbage.
194
+ set_test_name("Test garbage");
195
195
  input.clear();
196
196
  for (int i = 0; i < 256; i++) {
197
197
  input.append(1, (char) i);
@@ -200,4 +200,58 @@ namespace tut {
200
200
  ensure(bufferer.acceptingInput());
201
201
  ensure(!bufferer.hasError());
202
202
  }
203
+
204
+ TEST_METHOD(25) {
205
+ set_test_name("It ignores 100-Continue messages that are fed in one go");
206
+ string preamble = "HTTP/1.1 100 Continue\r\n\r\n";
207
+ string input2 = preamble + input;
208
+
209
+ ensure_equals(bufferer.feed(input2.data(), input2.size()), input2.size());
210
+ ensure(!bufferer.acceptingInput());
211
+ ensure(!bufferer.hasError());
212
+ ensure_equals("It ignored the 100-Continue message",
213
+ bufferer.getData(), input);
214
+ ensure_equals("It does not copy any data",
215
+ bufferer.getData().data(),
216
+ input2.data() + preamble.size());
217
+ ensure_equals(bufferer.getData().size(), input.size());
218
+ }
219
+
220
+ TEST_METHOD(26) {
221
+ set_test_name("It ignores 100-Continue messages that are fed byte-by-byte");
222
+ string preamble = "HTTP/1.1 100 Continue\r\n\r\n";
223
+ string input2 = preamble + input;
224
+ const char *pos = input2.data();
225
+ const char *end = input2.data() + input2.size();
226
+ while (pos < end) {
227
+ ensure(bufferer.acceptingInput());
228
+ ensure(!bufferer.hasError());
229
+ ensure_equals(bufferer.feed(pos, 1), 1u);
230
+ pos++;
231
+ }
232
+
233
+ ensure(!bufferer.acceptingInput());
234
+ ensure(!bufferer.hasError());
235
+ ensure("It copies the fed data into an internal buffer",
236
+ bufferer.getData().data() < input2.data()
237
+ || bufferer.getData().data() > input2.data() + input2.size());
238
+ ensure_equals(bufferer.getData(), input);
239
+ }
240
+
241
+ TEST_METHOD(27) {
242
+ set_test_name("It ignores 100-Continue messages, when the non-100 "
243
+ "message is fed separately from the 100 message");
244
+ string preamble = "HTTP/1.1 100 Continue\r\n\r\n";
245
+
246
+ ensure_equals(bufferer.feed(preamble.data(), preamble.size()), preamble.size());
247
+ ensure_equals(bufferer.feed(input.data(), input.size()), input.size());
248
+
249
+ ensure(!bufferer.acceptingInput());
250
+ ensure(!bufferer.hasError());
251
+ ensure_equals("It ignored the 100-Continue message",
252
+ bufferer.getData(), input);
253
+ ensure_equals("It does not copy any data",
254
+ bufferer.getData().data(),
255
+ input.data());
256
+ }
203
257
  }