Sha256: f76a5a704615d82198b61607eb4836d469eff988025afe5f24084b20454f197a

Contents?: true

Size: 1.27 KB

Versions: 29

Compression:

Stored size: 1.27 KB

Contents

app = lambda do |env|
    case env['PATH_INFO']
    when '/hello'
        [200, { "Content-Type" => "text/html" }, "hello world"]
    when '/chunked'
        chunks = ["7\r\nchunk1\n\r\n", "7\r\nchunk2\n\r\n", "7\r\nchunk3\n\r\n", "0\r\n\r\n"]
        [200, { "Content-Type" => "text/html", "Transfer-Encoding" => "chunked" }, chunks]
    when '/pid'
        [200, { "Content-Type" => "text/plain" }, [$$]]
    when '/env'
        body = ''
        env.each_pair do |key, value|
            body << "#{key} = #{value}\n"
        end
        [200, { "Content-Type" => "text/plain" }, [body]]
    when '/upload'
        File.open(env['HTTP_X_OUTPUT'], 'w') do |f|
            while line = env['rack.input'].gets
                f.write(line)
                f.flush
            end
        end
        [200, { "Content-Type" => "text/html" }, ["ok"]]
    when '/print_stderr'
        STDERR.puts "hello world!"
        [200, { "Content-Type" => "text/html" }, ["ok"]]
    when '/print_stdout_and_stderr'
        STDOUT.puts "hello stdout!"
        sleep 0.1  # Give HelperAgent the time to process stdout first.
        STDERR.puts "hello stderr!"
        [200, { "Content-Type" => "text/html" }, ["ok"]]
    else
        [200, { "Content-Type" => "text/html" }, ["hello <b>world</b>"]]
    end
end
run app

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
passenger-4.0.30 test/stub/rack/config.ru
passenger-4.0.29 test/stub/rack/config.ru
passenger-4.0.28 test/stub/rack/config.ru
passenger-4.0.27 test/stub/rack/config.ru
passenger-4.0.26 test/stub/rack/config.ru
passenger-4.0.25 test/stub/rack/config.ru
passenger-4.0.24 test/stub/rack/config.ru
passenger-4.0.23 test/stub/rack/config.ru
passenger-4.0.21 test/stub/rack/config.ru
passenger-4.0.20 test/stub/rack/config.ru
passenger-4.0.19 test/stub/rack/config.ru
passenger-4.0.18 test/stub/rack/config.ru
passenger-4.0.17 test/stub/rack/config.ru
passenger-4.0.16 test/stub/rack/config.ru
passenger-4.0.14 test/stub/rack/config.ru
passenger-4.0.13 test/stub/rack/config.ru
passenger-4.0.10 test/stub/rack/config.ru
passenger-4.0.8 test/stub/rack/config.ru
passenger-4.0.7 test/stub/rack/config.ru
passenger-4.0.6 test/stub/rack/config.ru