Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

missing keys in env #8

Open
schmurfy opened this issue Dec 11, 2013 · 2 comments
Open

missing keys in env #8

schmurfy opened this issue Dec 11, 2013 · 2 comments

Comments

@schmurfy
Copy link

It looks like some keys are missing, I found at least these:

SERVER_NAME
SERVER_PORT

I noticed because I use URLMap and it does some checks before routing any request which failed in my case xD
Here is the code:

    def call(env)
      path = env["PATH_INFO"]
      script_name = env['SCRIPT_NAME']
      hHost = env['HTTP_HOST']
      sName = env['SERVER_NAME']
      sPort = env['SERVER_PORT']

      @mapping.each do |host, location, match, app|
        unless hHost == host \
            || sName == host \
            || (!host && (hHost == sName || hHost == sName+':'+sPort))
          next
        end
     # ...

I am not sure what is the level of compatibility your are aiming for with reel-rack though.

For now I am doing my testing with:

class FixReel
  def initialize(next_app)
    @next_app = next_app
  end

  def call(env)
    env['SERVER_NAME'], env['SERVER_PORT'] = env['HTTP_HOST'].split(':')
    @next_app.call(env)
  end
end

use FixReel
# run xxx

that's definitely not production code for now it is enough for my tests.

@tarcieri
Copy link
Member

This should be easy to add

@Nowaker
Copy link

Nowaker commented Aug 8, 2015

Looks done, please close @tarcieri, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants