passenger 3.0.7 → 3.0.8
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.
- data/NEWS +27 -0
- data/README +1 -1
- data/bin/passenger-install-nginx-module +3 -1
- data/build/config.rb +2 -1
- data/build/cxx_tests.rb +7 -3
- data/build/documentation.rb +5 -40
- data/build/nginx.rb +0 -1
- data/build/packaging.rb +0 -6
- data/build/rake_extensions.rb +5 -0
- data/doc/Architectural overview.html +344 -77
- data/doc/Security of user switching support.html +338 -71
- data/doc/Users guide Apache with comments.html +4830 -0
- data/doc/Users guide Apache.html +695 -428
- data/doc/Users guide Apache.idmap.txt +80 -0
- data/doc/Users guide Apache.txt +5 -5
- data/doc/Users guide Nginx.html +591 -313
- data/doc/Users guide Nginx.txt +9 -3
- data/doc/Users guide Standalone.html +344 -77
- data/ext/boost/src/pthread/thread.cpp +1 -1
- data/ext/common/AccountsDatabase.h +1 -1
- data/ext/common/Constants.h +2 -2
- data/ext/common/Logging.h +2 -1
- data/ext/common/LoggingAgent/FilterSupport.h +107 -3
- data/ext/common/Session.h +1 -1
- data/ext/common/Utils.cpp +2 -0
- data/ext/common/Utils/Dechunker.h +232 -0
- data/ext/common/Utils/HttpHeaderBufferer.h +165 -0
- data/ext/common/Utils/StrIntUtils.cpp +51 -15
- data/ext/common/Utils/StrIntUtils.h +3 -0
- data/ext/common/Utils/StreamBoyerMooreHorspool.h +506 -0
- data/ext/nginx/Configuration.c +36 -282
- data/ext/nginx/ContentHandler.c +17 -0
- data/ext/nginx/HelperAgent.cpp +397 -39
- data/ext/oxt/tracable_exception.cpp +3 -1
- data/ext/ruby/extconf.rb +1 -0
- data/ext/ruby/passenger_native_support.c +3 -0
- data/helper-scripts/prespawn +113 -31
- data/lib/phusion_passenger.rb +2 -2
- data/lib/phusion_passenger/standalone/runtime_installer.rb +3 -2
- data/lib/phusion_passenger/standalone/start_command.rb +12 -12
- data/test/cxx/DechunkerTest.cpp +216 -0
- data/test/cxx/FilterSupportTest.cpp +31 -4
- data/test/cxx/HttpHeaderBuffererTest.cpp +203 -0
- data/test/cxx/UtilsTest.cpp +46 -3
- data/test/integration_tests/hello_world_rack_spec.rb +7 -0
- data/test/stub/rack/config.ru +6 -1
- data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +1 -1
- data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +1 -1
- data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +1 -1
- data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +1 -1
- data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +1 -1
- data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +1 -1
- data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +1 -1
- data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +1 -1
- data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +1 -1
- metadata +20 -403
- data/doc/Doxyfile +0 -241
- data/doc/cxxapi/AbstractSpawnManager_8h_source.html +0 -141
- data/doc/cxxapi/Account_8h_source.html +0 -206
- data/doc/cxxapi/AccountsDatabase_8h_source.html +0 -161
- data/doc/cxxapi/AgentBase_8h_source.html +0 -70
- data/doc/cxxapi/AgentsStarter_8h_source.html +0 -112
- data/doc/cxxapi/BCrypt_8h_source.html +0 -104
- data/doc/cxxapi/Blowfish_8h_source.html +0 -134
- data/doc/cxxapi/Bucket_8h_source.html +0 -118
- data/doc/cxxapi/Constants_8h_source.html +0 -79
- data/doc/cxxapi/ContentHandler_8h_source.html +0 -95
- data/doc/cxxapi/DirectoryMapper_8h_source.html +0 -311
- data/doc/cxxapi/EventedClient_8h_source.html +0 -733
- data/doc/cxxapi/EventedMessageServer_8h_source.html +0 -358
- data/doc/cxxapi/EventedServer_8h_source.html +0 -326
- data/doc/cxxapi/Exceptions_8h_source.html +0 -393
- data/doc/cxxapi/FileDescriptor_8h_source.html +0 -324
- data/doc/cxxapi/Hooks_8h_source.html +0 -76
- data/doc/cxxapi/HttpStatusExtractor_8h_source.html +0 -382
- data/doc/cxxapi/IniFile_8h_source.html +0 -527
- data/doc/cxxapi/Logging_8h_source.html +0 -796
- data/doc/cxxapi/MessageChannel_8h_source.html +0 -776
- data/doc/cxxapi/MessageClient_8h_source.html +0 -328
- data/doc/cxxapi/MessageReadersWriters_8h_source.html +0 -539
- data/doc/cxxapi/MessageServer_8h_source.html +0 -612
- data/doc/cxxapi/PoolOptions_8h_source.html +0 -549
- data/doc/cxxapi/Process_8h_source.html +0 -286
- data/doc/cxxapi/RandomGenerator_8h_source.html +0 -191
- data/doc/cxxapi/ResourceLocator_8h_source.html +0 -166
- data/doc/cxxapi/SafeLibev_8h_source.html +0 -180
- data/doc/cxxapi/ScgiRequestParser_8h_source.html +0 -406
- data/doc/cxxapi/ServerInstanceDir_8h_source.html +0 -378
- data/doc/cxxapi/Session_8h_source.html +0 -501
- data/doc/cxxapi/SpawnManager_8h_source.html +0 -647
- data/doc/cxxapi/StaticContentHandler_8h_source.html +0 -69
- data/doc/cxxapi/StaticString_8h_source.html +0 -329
- data/doc/cxxapi/StringListCreator_8h_source.html +0 -114
- data/doc/cxxapi/Utils_8h_source.html +0 -469
- data/doc/cxxapi/annotated.html +0 -87
- data/doc/cxxapi/apache2_2Configuration_8h_source.html +0 -82
- data/doc/cxxapi/classAgentWatcher-members.html +0 -54
- data/doc/cxxapi/classAgentWatcher.html +0 -419
- data/doc/cxxapi/classClient-members.html +0 -38
- data/doc/cxxapi/classClient.html +0 -123
- data/doc/cxxapi/classHooks-members.html +0 -40
- data/doc/cxxapi/classHooks.html +0 -153
- data/doc/cxxapi/classPassenger_1_1AbstractSpawnManager-members.html +0 -40
- data/doc/cxxapi/classPassenger_1_1AbstractSpawnManager.html +0 -187
- data/doc/cxxapi/classPassenger_1_1AbstractSpawnManager__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1AbstractSpawnManager__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1AbstractSpawnManager__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1ArgumentException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1ArgumentException.html +0 -56
- data/doc/cxxapi/classPassenger_1_1ArrayMessage-members.html +0 -37
- data/doc/cxxapi/classPassenger_1_1ArrayMessage.html +0 -113
- data/doc/cxxapi/classPassenger_1_1BufferedUpload-members.html +0 -38
- data/doc/cxxapi/classPassenger_1_1BufferedUpload.html +0 -112
- data/doc/cxxapi/classPassenger_1_1BusyException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1BusyException.html +0 -54
- data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +0 -51
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +0 -41
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +0 -223
- data/doc/cxxapi/classPassenger_1_1EOFException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1EOFException.html +0 -61
- data/doc/cxxapi/classPassenger_1_1EOFException__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1EOFException__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1EOFException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1EventFd-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1EventFd.html +0 -52
- data/doc/cxxapi/classPassenger_1_1EventedClient-members.html +0 -59
- data/doc/cxxapi/classPassenger_1_1EventedClient.html +0 -531
- data/doc/cxxapi/classPassenger_1_1EventedMessageServer-members.html +0 -37
- data/doc/cxxapi/classPassenger_1_1EventedMessageServer.html +0 -59
- data/doc/cxxapi/classPassenger_1_1EventedMessageServer__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1EventedMessageServer__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1EventedMessageServer__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1EventedServer-members.html +0 -37
- data/doc/cxxapi/classPassenger_1_1EventedServer.html +0 -93
- data/doc/cxxapi/classPassenger_1_1EventedServer__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1EventedServer__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1EventedServer__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1FileDescriptor-members.html +0 -41
- data/doc/cxxapi/classPassenger_1_1FileDescriptor.html +0 -178
- data/doc/cxxapi/classPassenger_1_1FileDescriptorPair-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1FileDescriptorPair.html +0 -52
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +0 -58
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +0 -41
- data/doc/cxxapi/classPassenger_1_1FileSystemException.html +0 -66
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1HttpStatusExtractor-members.html +0 -39
- data/doc/cxxapi/classPassenger_1_1HttpStatusExtractor.html +0 -128
- data/doc/cxxapi/classPassenger_1_1IOException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1IOException.html +0 -61
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.map +0 -4
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +0 -57
- data/doc/cxxapi/classPassenger_1_1MessageChannel.html +0 -839
- data/doc/cxxapi/classPassenger_1_1MessageServer-members.html +0 -49
- data/doc/cxxapi/classPassenger_1_1MessageServer.html +0 -407
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext.html +0 -58
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1ClientContext__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext-members.html +0 -41
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext.html +0 -165
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1CommonClientContext__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1Handler-members.html +0 -39
- data/doc/cxxapi/classPassenger_1_1MessageServer_1_1Handler.html +0 -173
- data/doc/cxxapi/classPassenger_1_1Process-members.html +0 -44
- data/doc/cxxapi/classPassenger_1_1Process.html +0 -290
- data/doc/cxxapi/classPassenger_1_1RandomGenerator-members.html +0 -37
- data/doc/cxxapi/classPassenger_1_1RandomGenerator.html +0 -79
- data/doc/cxxapi/classPassenger_1_1ResourceLocator-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1ResourceLocator.html +0 -51
- data/doc/cxxapi/classPassenger_1_1RuntimeException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1RuntimeException.html +0 -54
- data/doc/cxxapi/classPassenger_1_1SafeLibev-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1SafeLibev.html +0 -51
- data/doc/cxxapi/classPassenger_1_1ScalarMessage-members.html +0 -37
- data/doc/cxxapi/classPassenger_1_1ScalarMessage.html +0 -76
- data/doc/cxxapi/classPassenger_1_1ScgiRequestParser-members.html +0 -50
- data/doc/cxxapi/classPassenger_1_1ScgiRequestParser.html +0 -285
- data/doc/cxxapi/classPassenger_1_1SecurityException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1SecurityException.html +0 -56
- data/doc/cxxapi/classPassenger_1_1Session-members.html +0 -53
- data/doc/cxxapi/classPassenger_1_1Session.html +0 -556
- data/doc/cxxapi/classPassenger_1_1Session__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1Session__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1Session__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +0 -39
- data/doc/cxxapi/classPassenger_1_1SpawnException.html +0 -101
- data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +0 -42
- data/doc/cxxapi/classPassenger_1_1SpawnManager.html +0 -292
- data/doc/cxxapi/classPassenger_1_1SpawnManager__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1SpawnManager__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1SpawnManager__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1StandardSession-members.html +0 -54
- data/doc/cxxapi/classPassenger_1_1StandardSession.html +0 -394
- data/doc/cxxapi/classPassenger_1_1StandardSession__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1StandardSession__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1StandardSession__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1StaticString-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1StaticString.html +0 -56
- data/doc/cxxapi/classPassenger_1_1SyntaxError-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1SyntaxError.html +0 -54
- data/doc/cxxapi/classPassenger_1_1SystemException-members.html +0 -40
- data/doc/cxxapi/classPassenger_1_1SystemException.html +0 -155
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.map +0 -4
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1TimeRetrievalException-members.html +0 -40
- data/doc/cxxapi/classPassenger_1_1TimeRetrievalException.html +0 -61
- data/doc/cxxapi/classPassenger_1_1TimeRetrievalException__inherit__graph.map +0 -3
- data/doc/cxxapi/classPassenger_1_1TimeRetrievalException__inherit__graph.md5 +0 -1
- data/doc/cxxapi/classPassenger_1_1TimeRetrievalException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1TimeoutException-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1TimeoutException.html +0 -54
- data/doc/cxxapi/classPassenger_1_1Uint16Message-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1Uint16Message.html +0 -51
- data/doc/cxxapi/classPassenger_1_1Uint32Message-members.html +0 -36
- data/doc/cxxapi/classPassenger_1_1Uint32Message.html +0 -51
- data/doc/cxxapi/classServer-members.html +0 -36
- data/doc/cxxapi/classServer.html +0 -49
- data/doc/cxxapi/classServerInstanceDirToucher-members.html +0 -36
- data/doc/cxxapi/classServerInstanceDirToucher.html +0 -47
- data/doc/cxxapi/classes.html +0 -52
- data/doc/cxxapi/definitions_8h_source.html +0 -36
- data/doc/cxxapi/doxygen.css +0 -532
- data/doc/cxxapi/doxygen.png +0 -0
- data/doc/cxxapi/files.html +0 -76
- data/doc/cxxapi/ftv2blank.png +0 -0
- data/doc/cxxapi/ftv2doc.png +0 -0
- data/doc/cxxapi/ftv2folderclosed.png +0 -0
- data/doc/cxxapi/ftv2folderopen.png +0 -0
- data/doc/cxxapi/ftv2lastnode.png +0 -0
- data/doc/cxxapi/ftv2link.png +0 -0
- data/doc/cxxapi/ftv2mlastnode.png +0 -0
- data/doc/cxxapi/ftv2mnode.png +0 -0
- data/doc/cxxapi/ftv2node.png +0 -0
- data/doc/cxxapi/ftv2plastnode.png +0 -0
- data/doc/cxxapi/ftv2pnode.png +0 -0
- data/doc/cxxapi/ftv2vertline.png +0 -0
- data/doc/cxxapi/functions.html +0 -103
- data/doc/cxxapi/functions_0x62.html +0 -82
- data/doc/cxxapi/functions_0x63.html +0 -102
- data/doc/cxxapi/functions_0x64.html +0 -102
- data/doc/cxxapi/functions_0x65.html +0 -88
- data/doc/cxxapi/functions_0x66.html +0 -100
- data/doc/cxxapi/functions_0x67.html +0 -167
- data/doc/cxxapi/functions_0x68.html +0 -88
- data/doc/cxxapi/functions_0x69.html +0 -96
- data/doc/cxxapi/functions_0x6b.html +0 -80
- data/doc/cxxapi/functions_0x6c.html +0 -88
- data/doc/cxxapi/functions_0x6d.html +0 -88
- data/doc/cxxapi/functions_0x6e.html +0 -86
- data/doc/cxxapi/functions_0x6f.html +0 -94
- data/doc/cxxapi/functions_0x70.html +0 -94
- data/doc/cxxapi/functions_0x72.html +0 -110
- data/doc/cxxapi/functions_0x73.html +0 -171
- data/doc/cxxapi/functions_0x74.html +0 -85
- data/doc/cxxapi/functions_0x75.html +0 -85
- data/doc/cxxapi/functions_0x77.html +0 -92
- data/doc/cxxapi/functions_0x7e.html +0 -79
- data/doc/cxxapi/functions_enum.html +0 -49
- data/doc/cxxapi/functions_eval.html +0 -67
- data/doc/cxxapi/functions_func.html +0 -531
- data/doc/cxxapi/functions_vars.html +0 -278
- data/doc/cxxapi/graph_legend.dot +0 -22
- data/doc/cxxapi/graph_legend.html +0 -92
- data/doc/cxxapi/graph_legend.png +0 -0
- data/doc/cxxapi/group__Core.html +0 -46
- data/doc/cxxapi/group__Core.map +0 -3
- data/doc/cxxapi/group__Core.png +0 -0
- data/doc/cxxapi/group__Exceptions.html +0 -53
- data/doc/cxxapi/group__Hooks.html +0 -42
- data/doc/cxxapi/group__Hooks.map +0 -3
- data/doc/cxxapi/group__Hooks.png +0 -0
- data/doc/cxxapi/group__Support.html +0 -538
- data/doc/cxxapi/hierarchy.html +0 -101
- data/doc/cxxapi/index.html +0 -16
- data/doc/cxxapi/inherit__graph__0.map +0 -3
- data/doc/cxxapi/inherit__graph__0.md5 +0 -1
- data/doc/cxxapi/inherit__graph__0.png +0 -0
- data/doc/cxxapi/inherit__graph__1.map +0 -3
- data/doc/cxxapi/inherit__graph__1.md5 +0 -1
- data/doc/cxxapi/inherit__graph__1.png +0 -0
- data/doc/cxxapi/inherit__graph__10.map +0 -3
- data/doc/cxxapi/inherit__graph__10.md5 +0 -1
- data/doc/cxxapi/inherit__graph__10.png +0 -0
- data/doc/cxxapi/inherit__graph__11.map +0 -4
- data/doc/cxxapi/inherit__graph__11.md5 +0 -1
- data/doc/cxxapi/inherit__graph__11.png +0 -0
- data/doc/cxxapi/inherit__graph__12.map +0 -3
- data/doc/cxxapi/inherit__graph__12.md5 +0 -1
- data/doc/cxxapi/inherit__graph__12.png +0 -0
- data/doc/cxxapi/inherit__graph__13.map +0 -3
- data/doc/cxxapi/inherit__graph__13.md5 +0 -1
- data/doc/cxxapi/inherit__graph__13.png +0 -0
- data/doc/cxxapi/inherit__graph__14.map +0 -3
- data/doc/cxxapi/inherit__graph__14.md5 +0 -1
- data/doc/cxxapi/inherit__graph__14.png +0 -0
- data/doc/cxxapi/inherit__graph__15.map +0 -3
- data/doc/cxxapi/inherit__graph__15.md5 +0 -1
- data/doc/cxxapi/inherit__graph__15.png +0 -0
- data/doc/cxxapi/inherit__graph__16.map +0 -5
- data/doc/cxxapi/inherit__graph__16.md5 +0 -1
- data/doc/cxxapi/inherit__graph__16.png +0 -0
- data/doc/cxxapi/inherit__graph__17.map +0 -3
- data/doc/cxxapi/inherit__graph__17.md5 +0 -1
- data/doc/cxxapi/inherit__graph__17.png +0 -0
- data/doc/cxxapi/inherit__graph__18.map +0 -3
- data/doc/cxxapi/inherit__graph__18.md5 +0 -1
- data/doc/cxxapi/inherit__graph__18.png +0 -0
- data/doc/cxxapi/inherit__graph__19.map +0 -4
- data/doc/cxxapi/inherit__graph__19.md5 +0 -1
- data/doc/cxxapi/inherit__graph__19.png +0 -0
- data/doc/cxxapi/inherit__graph__2.map +0 -3
- data/doc/cxxapi/inherit__graph__2.md5 +0 -1
- data/doc/cxxapi/inherit__graph__2.png +0 -0
- data/doc/cxxapi/inherit__graph__20.map +0 -3
- data/doc/cxxapi/inherit__graph__20.md5 +0 -1
- data/doc/cxxapi/inherit__graph__20.png +0 -0
- data/doc/cxxapi/inherit__graph__21.map +0 -3
- data/doc/cxxapi/inherit__graph__21.md5 +0 -1
- data/doc/cxxapi/inherit__graph__21.png +0 -0
- data/doc/cxxapi/inherit__graph__22.map +0 -3
- data/doc/cxxapi/inherit__graph__22.md5 +0 -1
- data/doc/cxxapi/inherit__graph__22.png +0 -0
- data/doc/cxxapi/inherit__graph__23.map +0 -3
- data/doc/cxxapi/inherit__graph__23.md5 +0 -1
- data/doc/cxxapi/inherit__graph__23.png +0 -0
- data/doc/cxxapi/inherit__graph__24.map +0 -3
- data/doc/cxxapi/inherit__graph__24.md5 +0 -1
- data/doc/cxxapi/inherit__graph__24.png +0 -0
- data/doc/cxxapi/inherit__graph__25.map +0 -3
- data/doc/cxxapi/inherit__graph__25.md5 +0 -1
- data/doc/cxxapi/inherit__graph__25.png +0 -0
- data/doc/cxxapi/inherit__graph__26.map +0 -3
- data/doc/cxxapi/inherit__graph__26.md5 +0 -1
- data/doc/cxxapi/inherit__graph__26.png +0 -0
- data/doc/cxxapi/inherit__graph__27.map +0 -3
- data/doc/cxxapi/inherit__graph__27.md5 +0 -1
- data/doc/cxxapi/inherit__graph__27.png +0 -0
- data/doc/cxxapi/inherit__graph__28.map +0 -3
- data/doc/cxxapi/inherit__graph__28.md5 +0 -1
- data/doc/cxxapi/inherit__graph__28.png +0 -0
- data/doc/cxxapi/inherit__graph__29.map +0 -3
- data/doc/cxxapi/inherit__graph__29.md5 +0 -1
- data/doc/cxxapi/inherit__graph__29.png +0 -0
- data/doc/cxxapi/inherit__graph__3.map +0 -4
- data/doc/cxxapi/inherit__graph__3.md5 +0 -1
- data/doc/cxxapi/inherit__graph__3.png +0 -0
- data/doc/cxxapi/inherit__graph__30.map +0 -3
- data/doc/cxxapi/inherit__graph__30.md5 +0 -1
- data/doc/cxxapi/inherit__graph__30.png +0 -0
- data/doc/cxxapi/inherit__graph__31.map +0 -4
- data/doc/cxxapi/inherit__graph__31.md5 +0 -1
- data/doc/cxxapi/inherit__graph__31.png +0 -0
- data/doc/cxxapi/inherit__graph__32.map +0 -3
- data/doc/cxxapi/inherit__graph__32.md5 +0 -1
- data/doc/cxxapi/inherit__graph__32.png +0 -0
- data/doc/cxxapi/inherit__graph__33.map +0 -3
- data/doc/cxxapi/inherit__graph__33.md5 +0 -1
- data/doc/cxxapi/inherit__graph__33.png +0 -0
- data/doc/cxxapi/inherit__graph__34.map +0 -3
- data/doc/cxxapi/inherit__graph__34.md5 +0 -1
- data/doc/cxxapi/inherit__graph__34.png +0 -0
- data/doc/cxxapi/inherit__graph__35.map +0 -3
- data/doc/cxxapi/inherit__graph__35.md5 +0 -1
- data/doc/cxxapi/inherit__graph__35.png +0 -0
- data/doc/cxxapi/inherit__graph__36.map +0 -5
- data/doc/cxxapi/inherit__graph__36.md5 +0 -1
- data/doc/cxxapi/inherit__graph__36.png +0 -0
- data/doc/cxxapi/inherit__graph__37.map +0 -3
- data/doc/cxxapi/inherit__graph__37.md5 +0 -1
- data/doc/cxxapi/inherit__graph__37.png +0 -0
- data/doc/cxxapi/inherit__graph__38.map +0 -3
- data/doc/cxxapi/inherit__graph__38.md5 +0 -1
- data/doc/cxxapi/inherit__graph__38.png +0 -0
- data/doc/cxxapi/inherit__graph__39.map +0 -3
- data/doc/cxxapi/inherit__graph__39.md5 +0 -1
- data/doc/cxxapi/inherit__graph__39.png +0 -0
- data/doc/cxxapi/inherit__graph__4.map +0 -3
- data/doc/cxxapi/inherit__graph__4.md5 +0 -1
- data/doc/cxxapi/inherit__graph__4.png +0 -0
- data/doc/cxxapi/inherit__graph__40.map +0 -3
- data/doc/cxxapi/inherit__graph__40.md5 +0 -1
- data/doc/cxxapi/inherit__graph__40.png +0 -0
- data/doc/cxxapi/inherit__graph__41.map +0 -3
- data/doc/cxxapi/inherit__graph__41.md5 +0 -1
- data/doc/cxxapi/inherit__graph__41.png +0 -0
- data/doc/cxxapi/inherit__graph__5.map +0 -3
- data/doc/cxxapi/inherit__graph__5.md5 +0 -1
- data/doc/cxxapi/inherit__graph__5.png +0 -0
- data/doc/cxxapi/inherit__graph__6.map +0 -3
- data/doc/cxxapi/inherit__graph__6.md5 +0 -1
- data/doc/cxxapi/inherit__graph__6.png +0 -0
- data/doc/cxxapi/inherit__graph__7.map +0 -3
- data/doc/cxxapi/inherit__graph__7.md5 +0 -1
- data/doc/cxxapi/inherit__graph__7.png +0 -0
- data/doc/cxxapi/inherit__graph__8.map +0 -3
- data/doc/cxxapi/inherit__graph__8.md5 +0 -1
- data/doc/cxxapi/inherit__graph__8.png +0 -0
- data/doc/cxxapi/inherit__graph__9.map +0 -3
- data/doc/cxxapi/inherit__graph__9.md5 +0 -1
- data/doc/cxxapi/inherit__graph__9.png +0 -0
- data/doc/cxxapi/inherits.html +0 -165
- data/doc/cxxapi/main.html +0 -28
- data/doc/cxxapi/modules.html +0 -36
- data/doc/cxxapi/namespacePassenger.html +0 -585
- data/doc/cxxapi/namespacemembers.html +0 -190
- data/doc/cxxapi/namespacemembers_enum.html +0 -48
- data/doc/cxxapi/namespacemembers_eval.html +0 -57
- data/doc/cxxapi/namespacemembers_func.html +0 -114
- data/doc/cxxapi/namespacemembers_type.html +0 -54
- data/doc/cxxapi/namespaces.html +0 -37
- data/doc/cxxapi/nginx_2Configuration_8h_source.html +0 -126
- data/doc/cxxapi/ngx__http__passenger__module_8h_source.html +0 -95
- data/doc/cxxapi/structPassenger_1_1MessageServer_1_1DisconnectEventBroadcastGuard-members.html +0 -36
- data/doc/cxxapi/structPassenger_1_1MessageServer_1_1DisconnectEventBroadcastGuard.html +0 -51
- data/doc/cxxapi/structPassenger_1_1PoolOptions-members.html +0 -67
- data/doc/cxxapi/structPassenger_1_1PoolOptions.html +0 -647
- data/doc/cxxapi/structPassenger_1_1StaticString_1_1Hash-members.html +0 -36
- data/doc/cxxapi/structPassenger_1_1StaticString_1_1Hash.html +0 -51
- data/doc/cxxapi/tab_b.gif +0 -0
- data/doc/cxxapi/tab_l.gif +0 -0
- data/doc/cxxapi/tab_r.gif +0 -0
- data/doc/cxxapi/tabs.css +0 -105
- data/doc/cxxapi/tree.html +0 -249
- data/doc/template/horo.rb +0 -613
- data/ext/libev/config.h +0 -122
- data/ext/nginx/HttpStatusExtractor.h +0 -351
data/ext/common/Constants.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - http://www.modrails.com/
|
3
|
-
* Copyright (c) 2010 Phusion
|
3
|
+
* Copyright (c) 2010, 2011 Phusion
|
4
4
|
*
|
5
5
|
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
*
|
@@ -26,7 +26,7 @@
|
|
26
26
|
#define _PASSENGER_CONSTANTS_H_
|
27
27
|
|
28
28
|
/* Don't forget to update lib/phusion_passenger.rb too. */
|
29
|
-
#define PASSENGER_VERSION "3.0.
|
29
|
+
#define PASSENGER_VERSION "3.0.8"
|
30
30
|
|
31
31
|
#define FEEDBACK_FD 3
|
32
32
|
|
data/ext/common/Logging.h
CHANGED
@@ -42,6 +42,7 @@
|
|
42
42
|
#include <sstream>
|
43
43
|
#include <cstdio>
|
44
44
|
#include <ctime>
|
45
|
+
#include <cerrno>
|
45
46
|
|
46
47
|
#include "RandomGenerator.h"
|
47
48
|
#include "FileDescriptor.h"
|
@@ -149,7 +150,7 @@ void setDebugFile(const char *logFile = NULL);
|
|
149
150
|
#endif
|
150
151
|
|
151
152
|
|
152
|
-
/**********
|
153
|
+
/********** Analytics logging facilities *********/
|
153
154
|
|
154
155
|
struct AnalyticsLoggerSharedData {
|
155
156
|
boost::mutex lock;
|
@@ -33,7 +33,9 @@
|
|
33
33
|
|
34
34
|
#include <string>
|
35
35
|
#include <set>
|
36
|
-
#
|
36
|
+
#ifndef _PCREPOSIX_H
|
37
|
+
#include <regex.h>
|
38
|
+
#endif
|
37
39
|
#include <cstdio>
|
38
40
|
#include <cstring>
|
39
41
|
|
@@ -475,7 +477,11 @@ public:
|
|
475
477
|
enum FieldIdentifier {
|
476
478
|
URI,
|
477
479
|
CONTROLLER,
|
478
|
-
RESPONSE_TIME
|
480
|
+
RESPONSE_TIME,
|
481
|
+
RESPONSE_TIME_WITHOUT_GC,
|
482
|
+
STATUS,
|
483
|
+
STATUS_CODE,
|
484
|
+
GC_TIME
|
479
485
|
};
|
480
486
|
|
481
487
|
virtual ~Context() { }
|
@@ -483,8 +489,15 @@ public:
|
|
483
489
|
virtual string getURI() const = 0;
|
484
490
|
virtual string getController() const = 0;
|
485
491
|
virtual int getResponseTime() const = 0;
|
492
|
+
virtual string getStatus() const = 0;
|
493
|
+
virtual int getStatusCode() const = 0;
|
494
|
+
virtual int getGcTime() const = 0;
|
486
495
|
virtual bool hasHint(const string &name) const = 0;
|
487
496
|
|
497
|
+
int getResponseTimeWithoutGc() const {
|
498
|
+
return getResponseTime() - getGcTime();
|
499
|
+
}
|
500
|
+
|
488
501
|
string queryStringField(FieldIdentifier id) const {
|
489
502
|
switch (id) {
|
490
503
|
case URI:
|
@@ -493,6 +506,14 @@ public:
|
|
493
506
|
return getController();
|
494
507
|
case RESPONSE_TIME:
|
495
508
|
return toString(getResponseTime());
|
509
|
+
case RESPONSE_TIME_WITHOUT_GC:
|
510
|
+
return toString(getResponseTimeWithoutGc());
|
511
|
+
case STATUS:
|
512
|
+
return getStatus();
|
513
|
+
case STATUS_CODE:
|
514
|
+
return toString(getStatusCode());
|
515
|
+
case GC_TIME:
|
516
|
+
return toString(getGcTime());
|
496
517
|
default:
|
497
518
|
return "";
|
498
519
|
}
|
@@ -502,6 +523,12 @@ public:
|
|
502
523
|
switch (id) {
|
503
524
|
case RESPONSE_TIME:
|
504
525
|
return getResponseTime();
|
526
|
+
case RESPONSE_TIME_WITHOUT_GC:
|
527
|
+
return getResponseTimeWithoutGc();
|
528
|
+
case STATUS_CODE:
|
529
|
+
return getStatusCode();
|
530
|
+
case GC_TIME:
|
531
|
+
return getGcTime();
|
505
532
|
default:
|
506
533
|
return 0;
|
507
534
|
}
|
@@ -515,6 +542,14 @@ public:
|
|
515
542
|
return !getController().empty();
|
516
543
|
case RESPONSE_TIME:
|
517
544
|
return getResponseTime() > 0;
|
545
|
+
case RESPONSE_TIME_WITHOUT_GC:
|
546
|
+
return getResponseTimeWithoutGc() > 0;
|
547
|
+
case STATUS:
|
548
|
+
return !getStatus().empty();
|
549
|
+
case STATUS_CODE:
|
550
|
+
return getStatusCode() > 0;
|
551
|
+
case GC_TIME:
|
552
|
+
return getGcTime() > 0;
|
518
553
|
default:
|
519
554
|
return false;
|
520
555
|
}
|
@@ -524,8 +559,12 @@ public:
|
|
524
559
|
switch (id) {
|
525
560
|
case URI:
|
526
561
|
case CONTROLLER:
|
562
|
+
case STATUS:
|
527
563
|
return STRING_TYPE;
|
528
564
|
case RESPONSE_TIME:
|
565
|
+
case RESPONSE_TIME_WITHOUT_GC:
|
566
|
+
case STATUS_CODE:
|
567
|
+
case GC_TIME:
|
529
568
|
return INTEGER_TYPE;
|
530
569
|
default:
|
531
570
|
return UNKNOWN_TYPE;
|
@@ -537,11 +576,16 @@ class SimpleContext: public Context {
|
|
537
576
|
public:
|
538
577
|
string uri;
|
539
578
|
string controller;
|
579
|
+
string status;
|
540
580
|
int responseTime;
|
581
|
+
int statusCode;
|
582
|
+
int gcTime;
|
541
583
|
set<string> hints;
|
542
584
|
|
543
585
|
SimpleContext() {
|
544
586
|
responseTime = 0;
|
587
|
+
statusCode = 0;
|
588
|
+
gcTime = 0;
|
545
589
|
}
|
546
590
|
|
547
591
|
virtual string getURI() const {
|
@@ -556,6 +600,18 @@ public:
|
|
556
600
|
return responseTime;
|
557
601
|
}
|
558
602
|
|
603
|
+
virtual string getStatus() const {
|
604
|
+
return status;
|
605
|
+
}
|
606
|
+
|
607
|
+
virtual int getStatusCode() const {
|
608
|
+
return statusCode;
|
609
|
+
}
|
610
|
+
|
611
|
+
virtual int getGcTime() const {
|
612
|
+
return gcTime;
|
613
|
+
}
|
614
|
+
|
559
615
|
virtual bool hasHint(const string &name) const {
|
560
616
|
return hints.find(name) != hints.end();
|
561
617
|
}
|
@@ -569,6 +625,10 @@ private:
|
|
569
625
|
struct ParseState {
|
570
626
|
unsigned long long requestProcessingStart;
|
571
627
|
unsigned long long requestProcessingEnd;
|
628
|
+
unsigned long long smallestTimestamp;
|
629
|
+
unsigned long long largestTimestamp;
|
630
|
+
unsigned long long gcTimeStart;
|
631
|
+
unsigned long long gcTimeEnd;
|
572
632
|
};
|
573
633
|
|
574
634
|
static void parseLine(const StaticString &txnId, unsigned long long timestamp,
|
@@ -587,15 +647,33 @@ private:
|
|
587
647
|
if (pos != string::npos) {
|
588
648
|
ctx.controller = value.substr(0, pos);
|
589
649
|
}
|
650
|
+
} else if (startsWith(data, "Status: ")) {
|
651
|
+
StaticString value = data.substr(data.find(':') + 2);
|
652
|
+
ctx.status = value;
|
653
|
+
ctx.statusCode = stringToInt(value);
|
654
|
+
} else if (startsWith(data, "Initial GC time: ")) {
|
655
|
+
StaticString value = data.substr(data.find(':') + 2);
|
656
|
+
state.gcTimeStart = stringToULL(value);
|
657
|
+
} else if (startsWith(data, "Final GC time: ")) {
|
658
|
+
StaticString value = data.substr(data.find(':') + 2);
|
659
|
+
state.gcTimeEnd = stringToULL(value);
|
660
|
+
}
|
661
|
+
|
662
|
+
if (state.smallestTimestamp == 0 || timestamp < state.smallestTimestamp) {
|
663
|
+
state.smallestTimestamp = timestamp;
|
664
|
+
}
|
665
|
+
if (timestamp > state.largestTimestamp) {
|
666
|
+
state.largestTimestamp = timestamp;
|
590
667
|
}
|
591
668
|
}
|
592
669
|
|
593
670
|
static void reallyParse(const StaticString &data, SimpleContext &ctx) {
|
594
671
|
const char *current = data.data();
|
595
672
|
const char *end = data.data() + data.size();
|
596
|
-
ParseState state;
|
597
673
|
|
674
|
+
ParseState state;
|
598
675
|
memset(&state, 0, sizeof(state));
|
676
|
+
|
599
677
|
while (current < end) {
|
600
678
|
current = skipNewlines(current, end);
|
601
679
|
if (current < end) {
|
@@ -622,6 +700,12 @@ private:
|
|
622
700
|
if (state.requestProcessingEnd != 0) {
|
623
701
|
ctx.responseTime = int(state.requestProcessingEnd -
|
624
702
|
state.requestProcessingStart);
|
703
|
+
} else if (state.smallestTimestamp != 0) {
|
704
|
+
ctx.responseTime = state.largestTimestamp - state.smallestTimestamp;
|
705
|
+
}
|
706
|
+
|
707
|
+
if (state.gcTimeEnd != 0) {
|
708
|
+
ctx.gcTime = state.gcTimeEnd - state.gcTimeStart;
|
625
709
|
}
|
626
710
|
}
|
627
711
|
|
@@ -723,6 +807,18 @@ public:
|
|
723
807
|
return parse()->getResponseTime();
|
724
808
|
}
|
725
809
|
|
810
|
+
virtual string getStatus() const {
|
811
|
+
return parse()->getStatus();
|
812
|
+
}
|
813
|
+
|
814
|
+
virtual int getStatusCode() const {
|
815
|
+
return parse()->getStatusCode();
|
816
|
+
}
|
817
|
+
|
818
|
+
virtual int getGcTime() const {
|
819
|
+
return parse()->getGcTime();
|
820
|
+
}
|
821
|
+
|
726
822
|
virtual bool hasHint(const string &name) const {
|
727
823
|
return parse()->hasHint(name);
|
728
824
|
}
|
@@ -1458,6 +1554,14 @@ private:
|
|
1458
1554
|
return Value(Context::CONTROLLER);
|
1459
1555
|
} else if (token.rawValue == "response_time") {
|
1460
1556
|
return Value(Context::RESPONSE_TIME);
|
1557
|
+
} else if (token.rawValue == "response_time_without_gc") {
|
1558
|
+
return Value(Context::RESPONSE_TIME_WITHOUT_GC);
|
1559
|
+
} else if (token.rawValue == "status") {
|
1560
|
+
return Value(Context::STATUS);
|
1561
|
+
} else if (token.rawValue == "status_code") {
|
1562
|
+
return Value(Context::STATUS_CODE);
|
1563
|
+
} else if (token.rawValue == "gc_time") {
|
1564
|
+
return Value(Context::GC_TIME);
|
1461
1565
|
} else {
|
1462
1566
|
raiseSyntaxError("unknown field '" + token.rawValue + "'", token);
|
1463
1567
|
return Value(); // Shut up compiler warning.
|
data/ext/common/Session.h
CHANGED
data/ext/common/Utils.cpp
CHANGED
@@ -49,6 +49,7 @@
|
|
49
49
|
#include <Utils/Base64.h>
|
50
50
|
#include <Utils/CachedFileStat.hpp>
|
51
51
|
#include <Utils/StrIntUtils.h>
|
52
|
+
#include <Utils/HttpHeaderBufferer.h>
|
52
53
|
|
53
54
|
#ifndef HOST_NAME_MAX
|
54
55
|
#if defined(_POSIX_HOST_NAME_MAX)
|
@@ -68,6 +69,7 @@
|
|
68
69
|
namespace Passenger {
|
69
70
|
|
70
71
|
static string passengerTempDir;
|
72
|
+
HttpHeaderBufferer::StaticData HttpHeaderBufferer::staticData;
|
71
73
|
|
72
74
|
namespace {
|
73
75
|
/**
|
@@ -0,0 +1,232 @@
|
|
1
|
+
#ifndef _PASSENGER_DECHUNKER_H_
|
2
|
+
#define _PASSENGER_DECHUNKER_H_
|
3
|
+
|
4
|
+
#include <algorithm>
|
5
|
+
#include <cstddef>
|
6
|
+
#include <cstdlib>
|
7
|
+
#include <cstring>
|
8
|
+
|
9
|
+
#include <StaticString.h>
|
10
|
+
#include <Utils/StrIntUtils.h>
|
11
|
+
|
12
|
+
namespace Passenger {
|
13
|
+
|
14
|
+
using namespace std;
|
15
|
+
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Parses data in HTTP/1.1 chunked transfer encoding.
|
19
|
+
*
|
20
|
+
* Feed data into this parser by calling feed(). Do this until acceptingInput()
|
21
|
+
* is false. Any data chunks it has parsed will be emitted through the onData
|
22
|
+
* callback. This parser is zero-copy so the callback arguments point to the
|
23
|
+
* fed data.
|
24
|
+
*
|
25
|
+
* Dechunker parses until the terminating chunk or until a parse error occurs.
|
26
|
+
* After that it will refuse to accept new data until reset() is called.
|
27
|
+
*/
|
28
|
+
class Dechunker {
|
29
|
+
public:
|
30
|
+
typedef void (*Callback)(const char *data, size_t size, void *userData);
|
31
|
+
|
32
|
+
private:
|
33
|
+
static const char CR = '\x0D';
|
34
|
+
static const char LF = '\x0A';
|
35
|
+
|
36
|
+
char sizeBuffer[10];
|
37
|
+
unsigned int sizeBufferLen;
|
38
|
+
unsigned int remainingDataSize;
|
39
|
+
const char *errorMessage;
|
40
|
+
|
41
|
+
enum {
|
42
|
+
EXPECTING_SIZE,
|
43
|
+
EXPECTING_CHUNK_EXTENSION,
|
44
|
+
EXPECTING_HEADER_LF,
|
45
|
+
EXPECTING_DATA,
|
46
|
+
EXPECTING_NON_FINAL_CR,
|
47
|
+
EXPECTING_NON_FINAL_LF,
|
48
|
+
EXPECTING_FINAL_CR,
|
49
|
+
EXPECTING_FINAL_LF,
|
50
|
+
DONE,
|
51
|
+
ERROR
|
52
|
+
} state;
|
53
|
+
|
54
|
+
void setError(const char *message) {
|
55
|
+
errorMessage = message;
|
56
|
+
state = ERROR;
|
57
|
+
}
|
58
|
+
|
59
|
+
bool isDigit(char ch) const {
|
60
|
+
return (ch >= '0' && ch <= '9')
|
61
|
+
|| (ch >= 'a' && ch <= 'f')
|
62
|
+
|| (ch >= 'A' && ch <= 'Z');
|
63
|
+
}
|
64
|
+
|
65
|
+
void parseSizeBuffer() {
|
66
|
+
remainingDataSize = hexToUint(StaticString(sizeBuffer, sizeBufferLen));
|
67
|
+
}
|
68
|
+
|
69
|
+
void emitDataEvent(const char *data, size_t size) const {
|
70
|
+
if (onData != NULL) {
|
71
|
+
onData(data, size, userData);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
public:
|
76
|
+
Callback onData;
|
77
|
+
void *userData;
|
78
|
+
|
79
|
+
Dechunker() {
|
80
|
+
onData = NULL;
|
81
|
+
userData = NULL;
|
82
|
+
reset();
|
83
|
+
}
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Resets the internal state so that this Dechunker can be reused
|
87
|
+
* for parsing new data.
|
88
|
+
*
|
89
|
+
* @post acceptingInput()
|
90
|
+
* @post !hasError()
|
91
|
+
*/
|
92
|
+
void reset() {
|
93
|
+
state = EXPECTING_SIZE;
|
94
|
+
sizeBufferLen = 0;
|
95
|
+
remainingDataSize = 0;
|
96
|
+
errorMessage = NULL;
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Feeds data into this parser. Any data chunks it has parsed will be emitted
|
101
|
+
* through the onData callback. Returns the number of bytes that have been
|
102
|
+
* accepted. Any data not recognized as part of the chunked transfer encoding
|
103
|
+
* stream will be rejected.
|
104
|
+
*/
|
105
|
+
size_t feed(const char *data, size_t size) {
|
106
|
+
const char *current = data;
|
107
|
+
const char *end = data + size;
|
108
|
+
const char *needle;
|
109
|
+
size_t dataSize;
|
110
|
+
|
111
|
+
while (current < end && state != DONE && state != ERROR) {
|
112
|
+
switch (state) {
|
113
|
+
case EXPECTING_DATA:
|
114
|
+
dataSize = std::min(size_t(remainingDataSize), size_t(end - current));
|
115
|
+
if (dataSize == 0) {
|
116
|
+
state = EXPECTING_FINAL_CR;
|
117
|
+
} else {
|
118
|
+
emitDataEvent(current, dataSize);
|
119
|
+
current += dataSize;
|
120
|
+
remainingDataSize -= (unsigned int) dataSize;
|
121
|
+
if (remainingDataSize == 0) {
|
122
|
+
state = EXPECTING_NON_FINAL_CR;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
break;
|
126
|
+
|
127
|
+
case EXPECTING_SIZE:
|
128
|
+
while (current < end
|
129
|
+
&& sizeBufferLen < sizeof(sizeBuffer)
|
130
|
+
&& state == EXPECTING_SIZE)
|
131
|
+
{
|
132
|
+
if (*current == CR) {
|
133
|
+
parseSizeBuffer();
|
134
|
+
state = EXPECTING_HEADER_LF;
|
135
|
+
} else if (*current == ';') {
|
136
|
+
parseSizeBuffer();
|
137
|
+
state = EXPECTING_CHUNK_EXTENSION;
|
138
|
+
} else if (isDigit(*current)) {
|
139
|
+
sizeBuffer[sizeBufferLen] = *current;
|
140
|
+
sizeBufferLen++;
|
141
|
+
} else {
|
142
|
+
setError("Parse error: invalid chunk size character.");
|
143
|
+
current--;
|
144
|
+
}
|
145
|
+
current++;
|
146
|
+
}
|
147
|
+
|
148
|
+
if (sizeBufferLen == sizeof(sizeBuffer) && state == EXPECTING_SIZE) {
|
149
|
+
setError("The chunk size header is too large.");
|
150
|
+
}
|
151
|
+
break;
|
152
|
+
|
153
|
+
case EXPECTING_CHUNK_EXTENSION:
|
154
|
+
needle = (const char *) memchr(current, CR, end - current);
|
155
|
+
if (needle == NULL) {
|
156
|
+
current = end;
|
157
|
+
} else {
|
158
|
+
current = needle + 1;
|
159
|
+
state = EXPECTING_HEADER_LF;
|
160
|
+
}
|
161
|
+
break;
|
162
|
+
|
163
|
+
case EXPECTING_HEADER_LF:
|
164
|
+
if (*current == LF) {
|
165
|
+
state = EXPECTING_DATA;
|
166
|
+
current++;
|
167
|
+
} else {
|
168
|
+
setError("Parse error: expected a chunk header LF.");
|
169
|
+
}
|
170
|
+
break;
|
171
|
+
|
172
|
+
case EXPECTING_NON_FINAL_CR:
|
173
|
+
if (*current == CR) {
|
174
|
+
state = EXPECTING_NON_FINAL_LF;
|
175
|
+
current++;
|
176
|
+
} else {
|
177
|
+
setError("Parse error: expected a chunk finalizing CR.");
|
178
|
+
}
|
179
|
+
break;
|
180
|
+
|
181
|
+
case EXPECTING_NON_FINAL_LF:
|
182
|
+
if (*current == LF) {
|
183
|
+
reset();
|
184
|
+
current++;
|
185
|
+
} else {
|
186
|
+
setError("Parse error: expected a chunk finalizing LF.");
|
187
|
+
}
|
188
|
+
break;
|
189
|
+
|
190
|
+
case EXPECTING_FINAL_CR:
|
191
|
+
if (*current == CR) {
|
192
|
+
state = EXPECTING_FINAL_LF;
|
193
|
+
current++;
|
194
|
+
} else {
|
195
|
+
setError("Parse error: expected a final CR.");
|
196
|
+
}
|
197
|
+
break;
|
198
|
+
|
199
|
+
case EXPECTING_FINAL_LF:
|
200
|
+
if (*current == LF) {
|
201
|
+
state = DONE;
|
202
|
+
current++;
|
203
|
+
} else {
|
204
|
+
setError("Parse error: expected a final LF.");
|
205
|
+
}
|
206
|
+
break;
|
207
|
+
|
208
|
+
default:
|
209
|
+
abort();
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
return current - data;
|
214
|
+
}
|
215
|
+
|
216
|
+
bool acceptingInput() const {
|
217
|
+
return state != DONE && state != ERROR;
|
218
|
+
}
|
219
|
+
|
220
|
+
bool hasError() const {
|
221
|
+
return state == ERROR;
|
222
|
+
}
|
223
|
+
|
224
|
+
const char *getErrorMessage() const {
|
225
|
+
return errorMessage;
|
226
|
+
}
|
227
|
+
};
|
228
|
+
|
229
|
+
|
230
|
+
} // namespace Passenger
|
231
|
+
|
232
|
+
#endif _PASSENGER_DECHUNKER_H_
|