rack_http_script_name 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rack_http_script_name.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ require "rack_http_script_name/version"
2
+
3
+ class RackHttpScriptName
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+ SCRIPT_NAME = 'SCRIPT_NAME'.freeze
8
+ HTTP_SCRIPT_NAME = 'HTTP_SCRIPT_NAME'.freeze
9
+
10
+ def call(env)
11
+ script_name = env['SCRIPT_NAME']
12
+ http_script_name = env['HTTP_SCRIPT_NAME']
13
+ if script_name.empty? && http_script_name && !http_script_name.empty?
14
+ path_info = env['PATH_INFO']
15
+ env["SCRIPT_NAME"] = http_script_name
16
+ env["PATH_INFO"] = env["PATH_INFO"][http_script_name.length..-1]
17
+ end
18
+ @app.call(env)
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ class RackHttpScriptName
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rack_http_script_name/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rack_http_script_name"
7
+ s.version = RackHttpScriptName::VERSION
8
+ s.authors = ["Sokolov Yura 'funny-falcon'"]
9
+ s.email = ["funny.falcon@gmail.com"]
10
+ s.homepage = "https://github.com/funny-falcon/rack_http_script_name"
11
+ s.summary = %q{Rack middleware to automatically strip HTTP_SCRIPT_NAME}
12
+ s.description = %q{In case of nginx proxy, I wish to set SCRIPT_NAME to some value, but it sets HTTP_SCRIPT_NAME. So that, I'd like to adjust SCRIPT_NAME and PATH_INFO accordantly}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_runtime_dependency "rack"
20
+ # specify any dependencies here; for example:
21
+ # s.add_development_dependency "rspec"
22
+ # s.add_runtime_dependency "rest-client"
23
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack_http_script_name
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sokolov Yura 'funny-falcon'
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rack
16
+ requirement: &78174200 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *78174200
25
+ description: In case of nginx proxy, I wish to set SCRIPT_NAME to some value, but
26
+ it sets HTTP_SCRIPT_NAME. So that, I'd like to adjust SCRIPT_NAME and PATH_INFO
27
+ accordantly
28
+ email:
29
+ - funny.falcon@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - Rakefile
37
+ - lib/rack_http_script_name.rb
38
+ - lib/rack_http_script_name/version.rb
39
+ - rack_http_script_name.gemspec
40
+ homepage: https://github.com/funny-falcon/rack_http_script_name
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.17
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Rack middleware to automatically strip HTTP_SCRIPT_NAME
64
+ test_files: []