rack

deploy a sinatra app with passenger gives only 404, page not founds. Yet a simple rack app works.

I have correctly (or prbably not) installed passenger on apache 2. Rack works, but sinatra keeps giving 404's. Here is what works: config.ru: #app = proc do |env| return [200, { "Content-Type" => "text/html" }, "hello <b>world</b>"] end run app Here is what works too: Running the app.rb (see below) with ruby app.rb and then looki...

Sinatra not passing header with redirect

Hi All I have a simple Sinatra proxy, which when an endpoint is called, will redirect to another endpoint on the same Sinatra proxy. When I make a request with a header, the proxy doesn't seem to pass this header through to the second endpoint when the request redirects in the first. This is my code: get '/first' do # g...

Rack Stream Content

I have a simple rack app that's designed to marshal data from Rackspace CloudFiles, however it doesn't seem to be working. I'm a complete noob when it comes to rack, so I'm hoping someone can show me the follies of my ways. require 'rubygems' require 'cloudfiles' class StreamingFile def initialize(id) user = "<CLOUDFILES USERNAM...

setting cookies

Okay, so I'm trying to set cookies using Ruby. I'm in a Rack environment. response[name]=value will add an HTTP header into the HTTP headers hash rack has. I know that it works. But the following method of setting cookies doesn't work: def set_cookie(opts={}) args = { :name => nil, :value => nil, :expire...

rack variables not showing up

rack.request.form_input isn't in my env variable--what's going on? anyone?? ...

Rack, FastCGI, Lighttpd configuration

Hi! I want to run a simple application using Rack, FastCGI and Lighttpd, but I cannot get it working. I get the following error: /usr/lib/ruby/1.8/rack/handler/fastcgi.rb:23:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE) from /usr/lib/ruby/1.8/rack/handler/fastcgi.rb:23:in `new' from /usr/lib/ruby/1.8/rack/handl...

Can I have Sinatra / Rack not read the entire request body into memory?

Say I have a Sinatra route ala: put '/data' do request.body.read # ... end It appears that the entire request.body is read into memory. Is there a way to consume the body as it comes into the system, rather than having it all buffered in Rack/Sinatra beforehand? I see I can do this to read the body in parts, but the entire body s...

Set Rack session cookie expiration programatically

I'm using Rack to try to implement "Remember Me" functionality in my Sinatra app. I'm able to set the session cookie to expire when the session ends or in X seconds time but I'd like to do both. For example, if a user has clicked "remember me" then I wish for their session to end after X seconds. Eg, my app.rb has a line that looks lik...

Can a Rails app launch a rack app?

If I have a Ruby on Rails application running on my Apache shared server (with Mongrel), can I get it to launch/run another total separate Rack application? Then could I possibly build a Rails app that manages other rails/rack apps? So it could tell what apps are running and start/stop them when I want. Or is each app trapped in it's ow...

Using variables (database requests) in the config.ru

Hi, I'm new to Rack and try to get my head around it running Ruby on Rails 3.0.0.beta4. I'm starting a Rack app in the config.ru file but would like to use a variable there that is stored in my database. Is it even possible to get a database value back before the application is loaded or am I missing the point completely? I'm using th...

Sinatra app as Rails 3 subpath

I'm trying to get a sinatra app as a subpath in my rails 3 app. Specifically, the resque queuing system has a sinatra based web interface that I would like to have accessible through /resque on my usual rails app. You can see the project here: http://github.com/defunkt/resque I found some people talking about adding a rackup file and ...

What does a rack handler do exactly?

What does a rack handler do exactly, i.e. can someone explain in pseudo-code the steps that a rack handler takes to deliver a result for a request? ...

Rack port to Java?

Hi there, Do you know if Rack was ported to Java? To be more specific, I am aware of jruby-rack but I am looking for a native Java (re)implementation of Rack, if any?! Thank you in advance, - florin ...

Rack Request Log

Why Is there a reason Rack's request log by default outputs to stderr? If i'm not mistaken, the request log is Rack::CommonLogger which according to the RDoc: forwards every request to an app given, and logs a line in the Apache common log format to the logger, or rack.errors by default. Doesn't it make more sense to have an acces...

Ruby require 'rack' fails

Hello, I'm trying to install redmine and I have a problem with phusion-passenger. Installer fails on dependencies saying that rack is missing. I've investigated the code to check where it looks for it, but I've found a line: require 'rack' that is enclosed in what seems to be rubys try-catch block. I've already installed rack through ...

Is there anything like request_uri from ActionController::Request in Rails for Rack?

I wrote a rack middleware for my rails that that does something based on the if the REQUEST_URI equals specific string. However what I quickly found out was in my development environment, which is using WEBrick, is the server puts in the full url for the REQUEST_URI. On my production environment, which is on Heroku, it behaves like exp...

How do I set a cookie with a (ruby) rack middleware component?

I'm writing a rack middleware component for a rails app that will need to conditionally set cookies. I am currently trying to figure out to set cookies. From googling around it seems like this should work: class RackApp def initialize(app) @app = app end def call(env) @status, @headers, @response = @app.call(env) @r...

How to set a content-type for a specific file with Rack?

I want to have Rack serve a specific file with a specific content type. It's a .htc file and it needs to be served as text/x-component so that IE will recognize it. In apache I would just do AddType text/x-component .htc How can I achieve this with Rack? Currently the file is served by Rack::Static, but I didn't find an option to set ...

Hook for gems to add middleware on the Rack stack with Rails 3

I am trying to find out how a gem in the Rails 3 gemfile can automatically add middleware to the Rack stack. I am looking for the hook in that gem. For example ... when I add the devise gem to my Rails 3 gemfile, then devise somehow adds warden as middleware on the Rack stack. This seems to work automatically. There is no further configu...

rack 1.1.0 error in parse_multipart

Hi, I got an error while uploading a file. /!\ FAILSAFE /!\ 07/26/2010 02:37 Status: 500 Internal Server Error bad content body /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:467:in `parse_multipart' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/request.rb:268:in `parse_multipart' /usr/lib/ruby/gems/1.8/gem...