Every repository with this icon (
Every repository with this icon (
| Description: | a modular Ruby webserver interface edit |
-
On request with Content-Type : application/json
in /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:51
here is my fix - but im not shure
def media_type -- content_type && content_type.split(/\s*[;,]\s*/, 2).first.downcase ++ content_type && content_type.to_s.split(/\s*[;,]\s*/, 2).first.downcase endwe get:
Status: 500 Internal Server Error private method `split' called for #<Mime::Type:0xb743a2a8>/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/mime_type.rb:206:in `method_missing' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:51:in `media_type' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:117:in `parseable_data?' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/request.rb:138:in `POST' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/request.rb:428:in `request_parameters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/request.rb:381:in `parameters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/base.rb:1279:in `assign_shortcuts' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/base.rb:518:in `process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/filters.rb:606:in `sass_old_process' /usr/lib/ruby/gems/1.8/gems/haml-2.0.9/lib/sass/plugin/rails.rb:19:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:65:in `call_with_exception' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:91:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:111:in `_call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:82:in `initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:29:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:29:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:9:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:28:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/params_parser.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/rewindable_input.rb:25:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:93:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/reloader.rb:9:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/failsafe.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:106:in `call' /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/static.rb:31:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:46:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `each' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/urlmap.rb:40:in `call' /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/log_tailer.rb:17:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/content_length.rb:13:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/chunked.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:61:in `process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' /usr/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:34:in `run' /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:111 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' script/server:3Comments
-
Current implementation of
Request#referrerreturns"/"instead ofnilwhen noHTTP_REFERERis provided, so it's impossible to make a distinction.Comments
-
response is fully read before sending to client if sessions used
0 comments Created 5 months ago by dimasWhen a request handler returns an object implementing 'each' method it was possible to implement scripts which slowly "stream" some HTML/JS code to the client browser. It worked fine with 0.9.2. However with 1.0.0, the Rack::Session::Abstract::ID implementation does in fact buffering of the whole response before returning it to the client. Because of that it is no longer possible to create a long-running request handler which slowly sends events (by the means of JS code) to the client.
I believe this happens because of redundant use of Rack::Response.new in the commit_session method. to my understanding the only thing why this response needed at all is to call its set_cookie method (because the actual response object is not available there). However, the Rack::Response initialize method executes body.each which blocks output until the each finishes.
To avoid this problem i patched the ID implementation to use temporay Rack::Response only as a container for cookies without letting it to do anything with body.
i guess this fix is probably not perfect - I'm providing it for reference only. Would be happy to accept a better fix if you have any.
Thanks.
(Sorry I do not know how to make the patch look nice - for some reason its text is parsed for some wiki (?) notation and split into chunks. I tries putting the text into PRE tag but it did not help)--- /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/vendor/rack-1.0.0-git/lib/rack/session/abstract/id.rb.orig 2009-06-08 17:58:48.000000000 +0400 +++ /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/vendor/rack-1.0.0-git/lib/rack/session/abstract/id.rb 2009-06-08 17:59:20.000000000 +0400 @@ -115,9 +115,9 @@
cookie = Hash.new cookie[:value] = session_id cookie[:expires] = Time.now + options[:expire_after] unless options[:expire_after].nil?response = Rack::Response.new(body, status, headers)response = Rack::Response.new([], 200, headers) response.set_cookie(@key, cookie.merge(options))response.to_a[status, response.header.to_hash, body] end end
Comments
-
lint.rb line 47 .... @app.call(env) is what I have been dealing with. I think @app is nil when I am using Sinatra and Unicorn.
I pasted two files and an error message @ gist - http://gist.github.com/220270
Let me know
Bryan
Comments











