1

在我的应用程序暂存环境中,当我尝试通过 https 访问页面时出现错误,该网页可以正确使用 http。我得到的错误是:

 undefined method `each' for #<String:0x00000009371f28>

失败的地方在线上的宝石架上:

body.each { |part| parts << part }

def digest_body(body)
    parts = []
    body.each { |part| parts << part }
    string_body = parts.join
    digest = Digest::MD5.hexdigest(string_body) unless string_body.empty?
    [digest, parts]
end

看来,他无法处理通过的身体。我检查了正文,它是一个字符串,其中包含我页面的所有 html 代码。这个参数的数据类型应该是一个数组。

 "<!DOCTYPE html>\n<html class='no-js' lang='fr' xml:lang='fr'>\n<head>\n<meta charset='utf-8'>\n<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>\n<meta content='width=device-width' name='viewport'>\n<title>Bienvenue sur Zurban Culture | Admin Panel | Zurban Culture</title>\n<meta content=\"authenticity_token\" name=\"csrf-param\" />\n<meta content=\"fEVrJPyUwdf4FZ2GSWW/p01SrByXlJpq+xSbAXOkxBg=\" name=\"csrf-token\" />\n<!--[if lt IE 9]>\n<script src='http://html5shim.googlecode.com/svn/trunk/html5.js' type='text/javascript'></script>\n<![endif]-->\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" type=\"text/javascript\"></script>\n<link href=\"/assets/admin/admin-6033541466a41863e188a9fa9e0ea9bd.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<link href=\"/assets/admin/print-088f5bc50dba980c42676157c724ed0a.css\" media=\"print\" rel=\"stylesheet\" type=\"text/css\" />\n\n<script src='https://www.google.com/jsapi' type='text/javascript'></script>\n\n<link href='/favicon.ico' rel='shortcut icon'>\n</head>\n<body data-offset='50' data-spy='scroll' id='admin_show'>\n<h1 class='hidden print'>\nZurban Culture\n</h1>\n<div class='navbar navbar-fixed-top noPrint'>\n<div class='navbar-inner'>\n<div class='container-fluid'>\n<a class='btn btn-navbar' data-target='.nav-collapse' data-toggle='collapse'>\n<span class='icon-bar'></span>\n<span class='icon-bar'></span>\n<span class='icon-bar'></span>\n</a>\n<a class='brand' href='/admin'>Zurban Culture</a>\n<div class='nav-collapse'>\n<ul class='nav' id='tabbedInterface'>\n<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Produits<b class=\"caret\"></b></a><ul class='dropdown-menu'>\n<li><a href=\"https://beta.jeansattitude.fr/admin/products\">Tous produits (4064)</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/products/incomplete\">Brouillons (156)</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/products/deleted\">Effacés (274)</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/purchases\">Bons</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/product_types\">Familles (24)</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/products/maintenance\">Maintenance</a></li>\n</ul>\n</li><li class=\"brands_tab\"><a href=\"https://beta.jeansattitude.fr/admin/brands\">Marques</a></li>\n<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Ventes & Marketing<b class=\"caret\"></b></a><ul class='dropdown-menu'>\n<li><a href=\"https://beta.jeansattitude.fr/admin/sales\">En vente (3905)</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/sales/incomplete\">Brouillons (142)</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/sales/new\">Planning (0)</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/sales/planned\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.menu.sales.planned\">Planned</span></a></li>\n<li><a href=\"/admin/discounts\">Codes promotionnels (27)</a></li>\n<li><a href=\"/admin/sales/dashboard\">Page d&#x27;accueil</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/campaigns\">Collections</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/gift_cards/active_not_used\">Chèques cadeaux</a></li>\n<li><a href=\"https://beta.jeansattitude.fr/admin/cheques\">Chèques</a></li>\n</ul>\n</li><li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Commandes<b class=\"caret\"></b></a><ul class='dropdown-menu'>\n<li><a href=\"/admin/orders/pending\">En attente (0)</a></li>\n<li><a href=\"/admin/orders/fraud_review\">A vérifier (3)</a></li>\n<li><a href=\"/admin/orders/paid\">Payées (7)</a></li>\n<li><a href=\"/admin/orders/processing\">Traitement (0)</a></li>\n<li><a href=\"/admin/orders/shipped\">Envoyées (307)</a></li>\n<li><a href=\"/admin/orders/completed\">Complètée (9205)</a></li>\n<li><a href=\"/admin/orders/unavailable_hold\">Indisponible (1)</a></li>\n<li><a href=\"/admin/orders/cancelled\">Annulées (8736)</a></li>\n<li><a href=\"/admin/orders/fraud\">Fraudes (12)</a></li>\n<li><a href=\"/admin/order_transactions\">Tentatives de paiements</a></li>\n</ul>\n</li><li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Retours<b class=\"caret\"></b></a><ul class='dropdown-menu'>\n<li><a href=\"/admin/returns/pending\">En attente (77)</a></li>\n<li><a href=\"/admin/returns/received\">Réceptionné (23)</a></li>\n<li><a href=\"/admin/returns/completed\">Remboursé (1115)</a></li>\n<li><a href=\"/admin/returns/cancelled\">Procédure annulée (4)</a></li>\n</ul>\n</li><li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Avis <b class=\"caret\"></b></a><ul class='dropdown-menu'>\n<li><a href=\"/admin/reviews/needs_approvement\">À approuver (0)</a></li>\n<li><a href=\"/admin/reviews/approved\">Approuvés (3)</a></li>\n<li><a href=\"/admin/reviews/refused\">Refusés (0)</a></li>\n<li><a href=\"/admin/reviews/deleted\">Effacés (0)</a></li>\n</ul>\n</li><li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Utilisateurs<b class=\"caret\"></b></a><ul class='dropdown-menu'>\n<li><a href=\"/admin/users\">Utilisateurs</a></li>\n<li><a href=\"/admin/users/deleted\">Utilisateurs effacés</a></li>\n<li><a href=\"/admin/invitations\">Invitations</a></li>\n</ul>\n</li><li class=\"help_sections_tab\"><a href=\"https://beta.jeansattitude.fr/admin/help_sections\">Sections d&#x27;aide</a></li>\n<li class=\"dropdown\"><a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\"><img alt=\"Icon_stats\" src=\"/assets/admin/icon_stats-3905dbfb6e4ba900e54d7c49d67f5c49.png\" /><b class=\"caret\"></b></a><ul class='dropdown-menu'>\n<li>\n<a href=\"http://stats.zurbanculture.fr\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.overview\">Overview</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/products\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.products\">Products</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/orders\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.orders\">Orders</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/returns\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.returns\">Returns</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/users\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.users\">Users</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/sales_report\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.sales_report\">Sales Report</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/stock_by_brand\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.stock_report\">Stock Report</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/purchases\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.purchase_report\">Purchase Report</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/statistics/general\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.sales_history\">Sales History</span></a>\n</li>\n<li>\n<a href=\"http://stats.zurbanculture.fr/favorites\"><span class=\"translation_missing\" title=\"translation missing: fr.admin.submenu.favorites\">Favorites</span></a>\n</li>\n</ul>\n</li></ul>\n\n<ul class='nav pull-right'>\n<li class='searchbox'>\n<form accept-charset=\"UTF-8\" action=\"/admin/search\" class=\"navbar-search pull-right\" method=\"get\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /></div>\n<input class=\"search-query span2\" id=\"query\" name=\"query\" size=\"20\" type=\"text\" value=\"Rechercher\" />\n\n</form>\n\n</li>\n<li class='dropdown'>\n<a class='dropdown-toggle' data-toggle='dropdown' href='#'>\n<i class='icon-user icon-white'></i>\n</a>\n<ul class='dropdown-menu'>\n<li>\n<a href=\"/\">Zurban Culture</a>\n</li>\n<li>\n<a href=\"/logout\">Déconnexion</a>\n</li>\n</ul>\n</li>\n</ul>\n\n</div>\n</div>\n</div>\n</div>\n<div class='container-fluid noPrint'>\n<div class='subnav'>\n<ul class='nav nav-pills'>\n<li class=\"active\"><a href=\"/admin\">Statistique rapides</a></li>\n<li><a href=\"/admin/maintenances\">Logs</a></li>\n</ul>\n\n</div>\n<div class='notices_wrapper noPrint'>\n<div class='row-fluid'>\n<div class='span12'>\n\n</div>\n</div>\n</div>\n</div>\n<div class='container-fluid'>\n<div class='row-fluid'>\n<div class='span12'>\n<div class=\"page-header\">\n <h1>Bienvenue sur Zurban Culture</h1> \n</div>\n\n\n <form accept-charset=\"UTF-8\" action=\"https://beta.jeansattitude.fr/admin\" class=\"well\" method=\"get\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /></div>\n <input class=\"datepicker onChangeSubmit\" id=\"start_date\" length=\"8\" name=\"start_date\" placeholder=\"Start Date\" type=\"text\" value=\"2013-04-01\" />\n <input class=\"datepicker onChangeSubmit\" id=\"end_date\" length=\"8\" name=\"end_date\" placeholder=\"End Date\" type=\"text\" value=\"2013-04-23\" />\n <input type=\"submit\" class=\"btn\">\n </form>\n <div class=\"row-fluid\">\n <div class=\"section dashboard span6\" id=\"orders_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Montant des ventes cumulés</h2>\n <div id=\"ordersChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n <div class=\"section dashboard span6\" id=\"revenue_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Montant des ventes</h2>\n <div id=\"revenueChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n </div>\n\n <div class=\"row-fluid\">\n <div class=\"section dashboard span6\" id=\"orders_shipped_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Commandes Expédiées</h2>\n <div id=\"shippedOrdersChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n\n <div class=\"section dashboard span6\" id=\"users_section\">\n <div class=\"well\">\n <h2 class=\"sectionHeader\">Nouveaux utilisateurs confirmés</h2>\n <div id=\"usersChart\" class=\"graph\" style=\"width: 95%; height: 300px; margin: 0; padding: 0\"></div>\n </div>\n </div>\n </div>\n\n\n <div id=\"revenueChart\"></div>\n<script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>\n<script type=\"text/javascript\">\nvar rgviz_revenueChart = null;\nvar rgviz_revenueChart_data = null;\nfunction rgviz_draw_revenueChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/orders/datasource');\n var q = 'select toDate(`paid_at`), `old_members`, `new_members` where ((`state` = \"paid\" or `state` = \"processing\" or `state` = \"shipped\" or `state` = \"completed\") and `paid_at` >= \"2013-04-01\" and `paid_at` <= \"2013-04-24\") group by toDate(`paid_at`) order by toDate(`paid_at`) asc label toDate(`paid_at`) \\'Date\\', `old_members` \\'Ventes Anciens Utilisateurs\\', `new_members` \\'Ventes Nouveaux Utilisateurs\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_revenueChart = new google.visualization.ColumnChart(document.getElementById('revenueChart'));\n rgviz_revenueChart_data = response.getDataTable();\n rgviz_revenueChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":{\"position\":\"bottom\",\"textStyle\":{\"fontSize\":12}},\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"},\"isStacked\":true};\n rgviz_revenueChart.draw(rgviz_revenueChart_data, rgviz_revenueChart_options);\n});\n}\ngoogle.load(\"visualization\", \"1\", {'packages':['corechart']});\ngoogle.setOnLoadCallback(rgviz_draw_revenueChart);\n</script>\n\n\n <div id=\"ordersChart\"></div>\n<script type=\"text/javascript\">\nvar rgviz_ordersChart = null;\nvar rgviz_ordersChart_data = null;\nfunction rgviz_draw_ordersChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/orders/datasource');\n var q = 'select toDate(`paid_at`), sum(`total`) where ((`state` = \"paid\" or `state` = \"processing\" or `state` = \"shipped\" or `state` = \"completed\") and `paid_at` >= \"2013-04-01\" and `paid_at` <= \"2013-04-24\") group by toDate(`paid_at`) order by toDate(`paid_at`) asc label toDate(`paid_at`) \\'Date\\', sum(`total`) \\'Montant Ventes\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_ordersChart = new google.visualization.ColumnChart(document.getElementById('ordersChart'));\n rgviz_ordersChart_data = response.getDataTable();\n rgviz_ordersChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":\"none\",\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"}};\n rgviz_ordersChart.draw(rgviz_ordersChart_data, rgviz_ordersChart_options);\n});\n}\ngoogle.setOnLoadCallback(rgviz_draw_ordersChart);\n</script>\n\n <div id=\"shippedOrdersChart\"></div>\n<script type=\"text/javascript\">\nvar rgviz_shippedOrdersChart = null;\nvar rgviz_shippedOrdersChart_data = null;\nfunction rgviz_draw_shippedOrdersChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/orders/datasource');\n var q = 'select toDate(`shipped_at`), count(`id`) where ((`state` = \"paid\" or `state` = \"processing\" or `state` = \"shipped\" or `state` = \"completed\") and `shipped_at` >= \"2013-04-01\" and `paid_at` <= \"2013-04-24\") group by toDate(`shipped_at`) order by toDate(`shipped_at`) asc label toDate(`shipped_at`) \\'Date\\', count(`id`) \\'Commandes Expédiées\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_shippedOrdersChart = new google.visualization.AreaChart(document.getElementById('shippedOrdersChart'));\n rgviz_shippedOrdersChart_data = response.getDataTable();\n rgviz_shippedOrdersChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":\"none\",\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"}};\n rgviz_shippedOrdersChart.draw(rgviz_shippedOrdersChart_data, rgviz_shippedOrdersChart_options);\n});\n}\ngoogle.setOnLoadCallback(rgviz_draw_shippedOrdersChart);\n</script>\n\n <div id=\"usersChart\"></div>\n<script type=\"text/javascript\">\nvar rgviz_usersChart = null;\nvar rgviz_usersChart_data = null;\nfunction rgviz_draw_usersChart() {\n var query = new google.visualization.Query('http://stats.zurbanculture.fr/users/datasource');\n var q = 'select concat(month(`created_at`), \" \", year(`created_at`)), `seo`, `organique` where (`created_at` >= \"2012-04-23\" and `created_at` <= \"2013-04-24\" and `confirmed` = 1) group by concat(month(`created_at`), \" \", year(`created_at`)) order by `created_at` asc label concat(month(`created_at`), \" \", year(`created_at`)) \\'Month\\', `seo` \\'SEO\\', `organique` \\'Organique\\'';\n query.setQuery(q);\n query.send(function(response) {\n rgviz_usersChart = new google.visualization.LineChart(document.getElementById('usersChart'));\n rgviz_usersChart_data = response.getDataTable();\n rgviz_usersChart_options = {\"is3D\":true,\"width\":\"100%\",\"height\":\"80%\",\"legend\":{\"position\":\"bottom\",\"textStyle\":{\"fontSize\":12}},\"chartArea\":{\"left\":70,\"top\":30,\"width\":\"85%\",\"height\":\"75%\"}};\n rgviz_usersChart.draw(rgviz_usersChart_data, rgviz_usersChart_options);\n});\n}\ngoogle.setOnLoadCallback(rgviz_draw_usersChart);\n</script>\n\n\n</div>\n</div>\n<footer class='footer'>\n<p>Zurban Culture v2.0 - Rails 3.2.13 (staging) / Ruby 1.9.3 patchlevel 327 2012-11-10 - /srv/www/jeansattitude/releases/20130423082652</p>\n</footer>\n</div>\n<script src=\"/assets/admin-ac2e83dde06736c3279cc5c973afd46a.js\" type=\"text/javascript\"></script>\n\n</body>\n</html>\n"

有人知道为什么请求失败并且正文没有像它需要的那样包含和数组?在这里您可以看到我的跟踪路由,我不清楚是什么导致了问题,因为我没有在其中看到我的应用程序的任何痕迹,并且我没有从我的应用程序向该函数传递任何内容。

NoMethodError (undefined method `each' for #<String:0x00000009371f28>):
  rack (1.4.5) lib/rack/etag.rb:59:in `digest_body'
  rack (1.4.5) lib/rack/etag.rb:26:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__965187821369700966__call__4271865895200548975__callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  airbrake (3.1.11) lib/airbrake/rails/middleware.rb:13:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  airbrake (3.1.11) lib/airbrake/user_informer.rb:16:in `_call'
  airbrake (3.1.11) lib/airbrake/user_informer.rb:12:in `call'
  railties (3.2.13) lib/rails/engine.rb:479:in `call'
  railties (3.2.13) lib/rails/application.rb:223:in `call'
  railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
  passenger (3.0.19) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.19) lib/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
  passenger (3.0.19) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
  passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
  passenger (3.0.19) lib/phusion_passenger/utils.rb:470:in `safe_fork'
  passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
  passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:180:in `start'
  passenger (3.0.19) lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
  passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
  passenger (3.0.19) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
  passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
  passenger (3.0.19) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
  <internal:prelude>:10:in `synchronize'
  passenger (3.0.19) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
  passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
  passenger (3.0.19) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.19) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.19) helper-scripts/passenger-spawn-server:99:in `<main>'

另请参阅我在 rack gem 上打开的问题,但这似乎不是他们的问题。https://github.com/rack/rack/issues/548

解决方案:

发生这种情况是因为自定义中间件将主体作为字符串返回,我将这个主体包装在一个数组中,问题就解决了!谢谢您的帮助!

4

1 回答 1

0

你说:

我检查了正文,它是一个字符串,其中包含我页面的所有 html 代码。这个参数的数据类型应该是一个数组。

body参数从哪里来?你期望这个数组的元素是什么?看起来这可能是您想要的:

def digest_body(body)
    parts = body.split("\n")
    string_body = parts.join
    digest = Digest::MD5.hexdigest(string_body) unless string_body.empty?
    [digest, parts]
end
于 2013-04-23T18:27:36.137 回答