net-http-server 0.2.0 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 35d57af683a4c0b327c281d5ae71f848e076b6be987e9fa4c1ee77d2aab41d68
4
+ data.tar.gz: 6cd05ef1952687d1ec6b0ac83bfe3ca7ba457fae04891a38fb32b53beee7beb7
5
+ SHA512:
6
+ metadata.gz: 87305fc9592d5cde9ab305b0a98d22f365fc6af32808aca03323f0d0140b89384a95b9e19b5ccc23552ae611b65b600d02ad526b399d4d606793d7d0cfbd308b
7
+ data.tar.gz: ad2a7320a5aeb3b2106cf4b871fb589dd2f0ad0afb86d50ad9a41b75e88f76f7ef0115c2d78b450fc42020f4da4bc58d1605de83e43df464bddf2c49f50b7cb2
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Gemfile.lock
1
2
  doc/
2
3
  pkg/
3
4
  vendor/
data/ChangeLog.md CHANGED
@@ -1,3 +1,28 @@
1
+ ### 0.2.3 / 2022-06-18
2
+
3
+ * Add [gserver] ~> 0.0 as a dependency.
4
+ * Switched to using Ruby 2.x keyword arguments.
5
+ * Fix a bug in {Rack::Handler::HTTP} where the URI `query` string was not being
6
+ properly loaded.
7
+ * Fixed a bug in {Net::HTTP::Server::Parser} where the older `absnt?` method
8
+ was being used instead of the newer `absent?` method.
9
+
10
+ ### 0.2.2 / 2012-09-08
11
+
12
+ * Added an example `rackup` command.
13
+
14
+ #### Parser
15
+
16
+ * Fixed the rule for escaped unicode characters (`%uXXXX`).
17
+ * Added a rule for escaped characters (`%XX`).
18
+
19
+ ### 0.2.1 / 2011-10-14
20
+
21
+ * Adjusted {Net::HTTP::Server::Parser} to include the leading `/` in the
22
+ `:path`.
23
+ * Use `String#replace` to clear the buffer passed to
24
+ {Net::HTTP::Server::ChunkedStream#read}.
25
+
1
26
  ### 0.2.0 / 2011-08-23
2
27
 
3
28
  * Added support for handling Streams and Chunked Transfer-Encoding:
@@ -16,3 +41,5 @@
16
41
  * Added {Net::HTTP::Server::Responses}.
17
42
  * Added {Net::HTTP::Server::Daemon}.
18
43
  * Added {Rack::Handler::HTTP}.
44
+
45
+ [gserver]: https://rubygems.org/gems/gserver
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.1'
8
+
9
+ gem 'rack'
10
+ gem 'rspec', '~> 3.0'
11
+
12
+ gem 'kramdown'
13
+ gem 'redcarpet', platform: :mri
14
+ gem 'yard', '~> 0.9'
15
+ gem 'yard-spellcheck'
16
+ end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Hal Brodigan
1
+ Copyright (c) 2011-2022 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # net-http-server
2
2
 
3
- * [Homepage](http://github.com/postmodern/net-http-server)
4
- * [Issues](http://github.com/postmodern/net-http-server/issues)
5
- * [Documentation](http://rubydoc.info/gems/net-http-server)
6
- * [Email](mailto:postmodern.mod3 at gmail.com)
3
+ * [Homepage](https://github.com/postmodern/net-http-server#readme)
4
+ * [Issues](https://github.com/postmodern/net-http-server/issues)
5
+ * [Documentation](https://rubydoc.info/gems/net-http-server)
7
6
 
8
7
  ## Description
9
8
 
@@ -14,37 +13,50 @@
14
13
  * Pure Ruby.
15
14
  * Supports Streamed Request/Response Bodies.
16
15
  * Supports Chunked Transfer-Encoding.
17
- * Provides a [Rack](http://rack.rubyforge.org/) Handler.
16
+ * Provides a [Rack](https://github.com/rack/rack#readme) Handler.
18
17
 
19
18
  ## Examples
20
19
 
21
20
  Simple HTTP Server:
22
21
 
23
- require 'net/http/server'
24
- require 'pp'
22
+ ```ruby
23
+ require 'net/http/server'
24
+ require 'pp'
25
25
 
26
- Net::HTTP::Server.run(:port => 8080) do |request,stream|
27
- pp request
26
+ Net::HTTP::Server.run(:port => 8080) do |request,stream|
27
+ pp request
28
28
 
29
- [200, {'Content-Type' => 'text/html'}, ['Hello World']]
30
- end
29
+ [200, {'Content-Type' => 'text/html'}, ['Hello World']]
30
+ end
31
+ ```
31
32
 
32
33
  Use it with Rack:
33
34
 
34
- require 'rack/handler/http'
35
-
36
- Rack::Handler::HTTP.run app
35
+ ```ruby
36
+ require 'rack/handler/http'
37
+
38
+ Rack::Handler::HTTP.run app
39
+ ```
40
+
41
+ Using it with `rackup`:
42
+
43
+ ```shell
44
+ $ rackup -s HTTP
45
+ ```
37
46
 
38
47
  ## Requirements
39
48
 
40
- * [parslet](http://rubygems.org/gems/parslet) ~> 1.0
49
+ * [parslet](http://kschiess.github.io/parslet/) ~> 1.0
50
+ * [gserver](https://rubygems.org/gems/gserver) ~> 0.0
41
51
 
42
52
  ## Install
43
53
 
44
- $ gem install net-http-server
54
+ ```shell
55
+ $ gem install net-http-server
56
+ ```
45
57
 
46
58
  ## Copyright
47
59
 
48
- Copyright (c) 2011 Hal Brodigan
60
+ Copyright (c) 2011-2022 Hal Brodigan
49
61
 
50
62
  See {file:LICENSE.txt} for details.
data/Rakefile CHANGED
@@ -1,36 +1,19 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
1
  begin
5
- gem 'ore-tasks', '~> 0.4'
6
- require 'ore/tasks'
7
-
8
- Ore::Tasks.new
2
+ require 'bundler/setup'
9
3
  rescue LoadError => e
10
4
  warn e.message
11
- warn "Run `gem install ore-tasks` to install 'ore/tasks'."
5
+ warn "Run `gem install bundler` to install Bundler"
6
+ exit -1
12
7
  end
13
8
 
14
- begin
15
- gem 'rspec', '~> 2.4'
16
- require 'rspec/core/rake_task'
9
+ require 'rubygems/tasks'
10
+ Gem::Tasks.new
17
11
 
18
- RSpec::Core::RakeTask.new
19
- rescue LoadError => e
20
- task :spec do
21
- abort "Please run `gem install rspec` to install RSpec."
22
- end
23
- end
24
- task :test => :spec
25
- task :default => :spec
12
+ require 'rspec/core/rake_task'
13
+ RSpec::Core::RakeTask.new
26
14
 
27
- begin
28
- gem 'yard', '~> 0.6.0'
29
- require 'yard'
15
+ task :test => :spec
16
+ task :default => :spec
30
17
 
31
- YARD::Rake::YardocTask.new
32
- rescue LoadError => e
33
- task :yard do
34
- abort "Please run `gem install yard` to install YARD."
35
- end
36
- end
18
+ require 'yard'
19
+ YARD::Rake::YardocTask.new
data/gemspec.yml CHANGED
@@ -4,13 +4,19 @@ description: A Rack compatible pure Ruby HTTP Server.
4
4
  license: MIT
5
5
  authors: Postmodern
6
6
  email: postmodern.mod3@gmail.com
7
- homepage: http://github.com/postmodern/net-http-server
7
+ homepage: https://github.com/postmodern/net-http-server#readme
8
8
  has_yard: true
9
9
 
10
+ metadata:
11
+ documentation_uri: https://rubydoc.info/gems/net-http-server
12
+ source_code_uri: https://github.com/postmodern/net-http-server
13
+ bug_tracker_uri: https://github.com/postmodern/net-http-server/issues
14
+ changelog_uri: https://github.com/postmodern/net-http-server/blob/master/ChangeLog.md
15
+ rubygems_mfa_required: 'true'
16
+
10
17
  dependencies:
11
18
  parslet: ~> 1.0
19
+ gserver: ~> 0.0
12
20
 
13
21
  development_dependencies:
14
- ore-tasks: ~> 0.4
15
- rspec: ~> 2.4
16
- yard: ~> 0.6.0
22
+ bundler: ~> 2.0
@@ -14,7 +14,7 @@ module Net
14
14
  class ChunkedStream < Stream
15
15
 
16
16
  #
17
- # Initializes the chuked stream.
17
+ # Initializes the chunked stream.
18
18
  #
19
19
  # @param [#read, #write, #flush] socket
20
20
  # The socket to read from and write to.
@@ -47,9 +47,8 @@ module Net
47
47
  end
48
48
 
49
49
  until @buffer.length >= length
50
- length_line = @socket.readline("\r\n").chomp
51
- chunk_length, chunk_extension = length_line.split(';',2)
52
- chunk_length = chunk_length.to_i(16)
50
+ length_line = @socket.readline("\r\n").chomp
51
+ chunk_length = length_line.split(';',2).first.to_i(16)
53
52
 
54
53
  # read the chunk
55
54
  @buffer << @socket.read(chunk_length)
@@ -62,7 +61,7 @@ module Net
62
61
  end
63
62
 
64
63
  # clear the buffer before appending
65
- buffer.clear
64
+ buffer.replace('')
66
65
 
67
66
  unless @buffer.empty?
68
67
  # empty a slice of the buffer
@@ -26,22 +26,19 @@ module Net
26
26
 
27
27
  # Creates a new HTTP Daemon.
28
28
  #
29
- # @param [Hash] options
30
- # Options for the daemon.
31
- #
32
- # @option options [String] :host (DEFAULT_HOST)
29
+ # @param [String] host
33
30
  # The host to run on.
34
31
  #
35
- # @option options [String] :port (DEFAULT_PORT)
32
+ # @param [String] port
36
33
  # The port to listen on.
37
34
  #
38
- # @option options [Integer] :max_connections (MAX_CONNECTIONS)
35
+ # @param [Integer] max_connections
39
36
  # The maximum number of simultaneous connections.
40
37
  #
41
- # @option options [IO] :log ($stderr)
38
+ # @param [IO] log
42
39
  # The log to write errors to.
43
40
  #
44
- # @option options [#call] :handler
41
+ # @param [#call] handler
45
42
  # The HTTP Request Handler object.
46
43
  #
47
44
  # @yield [request, socket]
@@ -53,15 +50,18 @@ module Net
53
50
  # @yieldparam [TCPSocket] socket
54
51
  # The TCP socket of the client.
55
52
  #
56
- def initialize(options={},&block)
57
- host = options.fetch(:host,DEFAULT_HOST)
58
- port = options.fetch(:port,DEFAULT_PORT).to_i
59
- max_connections = options.fetch(:max_connections,MAX_CONNECTIONS)
60
- log = options.fetch(:log,$stderr)
61
-
62
- super(port,host,max_connections,log,false,true)
53
+ # @raise [ArgumentError]
54
+ # No `handler:` value was given.
55
+ #
56
+ def initialize(host: DEFAULT_HOST,
57
+ port: DEFAULT_PORT,
58
+ max_connections: MAX_CONNECTIONS,
59
+ log: $stderr,
60
+ handler: nil,
61
+ &block)
62
+ super(port.to_i,host,max_connections,log,false,true)
63
63
 
64
- handler(options[:handler],&block)
64
+ handler(handler,&block)
65
65
  end
66
66
 
67
67
  #
@@ -106,7 +106,7 @@ module Net
106
106
 
107
107
  begin
108
108
  request = parser.parse(raw_request)
109
- rescue Parslet::ParseFailed => error
109
+ rescue Parslet::ParseFailed
110
110
  return Responses::BAD_REQUEST
111
111
  end
112
112
 
@@ -9,7 +9,7 @@ module Net
9
9
  #
10
10
  # * [Thin](https://github.com/macournoyer/thin/blob/master/ext/thin_parser/common.rl)
11
11
  # * [Unicorn](https://github.com/defunkt/unicorn/blob/master/ext/unicorn_http/unicorn_http_common.rl)
12
- # * [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616.html)
12
+ # * [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110.html)
13
13
  #
14
14
  class Parser < Parslet::Parser
15
15
 
@@ -30,7 +30,7 @@ module Net
30
30
  rule(:crlf) { str("\r\n") }
31
31
 
32
32
  rule(:ctl) { cntrl | str("\x7f") }
33
- rule(:text) { lws | (ctl.absnt? >> ascii) }
33
+ rule(:text) { lws | (ctl.absent? >> ascii) }
34
34
 
35
35
  rule(:safe) { charset('$', '-', '_', '.') }
36
36
  rule(:extra) { charset('!', '*', "'", '(', ')', ',') }
@@ -39,12 +39,13 @@ module Net
39
39
 
40
40
  rule(:unsafe) { ctl | charset(' ', '#', '%') | sorta_safe }
41
41
  rule(:national) {
42
- (alpha | digit | reserved | extra | safe | unsafe).absnt? >> any
42
+ (alpha | digit | reserved | extra | safe | unsafe).absent? >> any
43
43
  }
44
44
 
45
45
  rule(:unreserved) { alpha | digit | safe | extra | national }
46
- rule(:escape) { str("%u").maybe >> xdigit >> xdigit }
47
- rule(:uchar) { unreserved | escape | sorta_safe }
46
+ rule(:uescape) { str("%u") >> xdigit >> xdigit >> xdigit >> xdigit }
47
+ rule(:escape) { str("%") >> xdigit >> xdigit }
48
+ rule(:uchar) { unreserved | uescape | escape | sorta_safe }
48
49
  rule(:pchar) { uchar | charset(':', '@', '&', '=', '+') }
49
50
  rule(:separators) {
50
51
  lws | charset(
@@ -56,13 +57,13 @@ module Net
56
57
  #
57
58
  # Elements
58
59
  #
59
- rule(:token) { (ctl | separators).absnt? >> ascii }
60
+ rule(:token) { (ctl | separators).absent? >> ascii }
60
61
 
61
- rule(:comment_text) { (str('(') | str(')')).absnt? >> text }
62
+ rule(:comment_text) { (str('(') | str(')')).absent? >> text }
62
63
  rule(:comment) { str('(') >> comment_text.repeat >> str(')') }
63
64
 
64
65
  rule(:quoted_pair) { str("\\") >> ascii }
65
- rule(:quoted_text) { quoted_pair | str('"').absnt? >> text }
66
+ rule(:quoted_text) { quoted_pair | str('"').absent? >> text }
66
67
  rule(:quoted_string) { str('"') >> quoted_text >> str('"') }
67
68
 
68
69
  #
@@ -86,23 +87,22 @@ module Net
86
87
  rule(:params) { param >> (str(';') >> param).repeat }
87
88
  rule(:frag) { (uchar | reserved).repeat }
88
89
 
89
- rule(:relative_path) {
90
- path.maybe.as(:path) >>
90
+ rule(:uri_path) {
91
+ (str('/').maybe >> path.maybe).as(:path) >>
91
92
  (str(';') >> params.as(:params)).maybe >>
92
93
  (str('?') >> query_string.as(:query)).maybe >>
93
94
  (str('#') >> frag.as(:fragment)).maybe
94
95
  }
95
- rule(:absolute_path) { str('/').repeat(1) >> relative_path }
96
96
 
97
- rule(:absolute_uri) {
97
+ rule(:uri) {
98
98
  scheme.as(:scheme) >> str(':') >> str('//').maybe >>
99
99
  (user_info.as(:user_info) >> str('@')).maybe >>
100
100
  host_name.as(:host) >>
101
101
  (str(':') >> digits.as(:port)).maybe >>
102
- absolute_path
102
+ uri_path
103
103
  }
104
104
 
105
- rule(:request_uri) { str('*') | absolute_uri | absolute_path }
105
+ rule(:request_uri) { str('*') | uri | uri_path }
106
106
 
107
107
  #
108
108
  # HTTP Elements
@@ -112,12 +112,12 @@ module Net
112
112
  rule(:version_number) { digits >> str('.') >> digits }
113
113
  rule(:http_version) { str('HTTP/') >> version_number.as(:version) }
114
114
  rule(:request_line) {
115
- request_method.as(:method) >>
116
- str(' ') >> request_uri.as(:uri) >>
117
- str(' ') >> http_version
115
+ request_method.as(:method) >> str(' ') >>
116
+ request_uri.as(:uri) >> str(' ') >>
117
+ http_version
118
118
  }
119
119
 
120
- rule(:header_name) { (str(':').absnt? >> token).repeat(1) }
120
+ rule(:header_name) { (str(':').absent? >> token).repeat(1) }
121
121
  rule(:header_value) {
122
122
  (text | token | separators | quoted_string).repeat(1)
123
123
  }
@@ -7,7 +7,7 @@ module Net
7
7
  # Default ports for common URI schemes
8
8
  DEFAULT_PORTS = {
9
9
  'https' => 443,
10
- 'http' => 80
10
+ 'http' => 80
11
11
  }
12
12
 
13
13
  protected
@@ -65,7 +65,8 @@ module Net
65
65
  def normalize_uri(request)
66
66
  uri = request[:uri]
67
67
 
68
- if uri.kind_of?(Hash)
68
+ case uri
69
+ when Hash
69
70
  if uri[:scheme]
70
71
  uri[:port] = unless uri[:port]
71
72
  DEFAULT_PORTS[uri[:scheme]]
@@ -73,13 +74,7 @@ module Net
73
74
  uri[:port].to_i
74
75
  end
75
76
  end
76
-
77
- unless uri[:path]
78
- uri[:path] = '/'
79
- else
80
- uri[:path].insert(0,'/')
81
- end
82
- elsif uri == '*'
77
+ when '*'
83
78
  request[:uri] = {}
84
79
  end
85
80
  end
@@ -96,7 +91,7 @@ module Net
96
91
 
97
92
  unless headers.empty?
98
93
  headers.each do |header|
99
- name = header[:name].to_s
94
+ name = header[:name].to_s
100
95
  value = header[:value].to_s
101
96
 
102
97
  if normalized_headers.has_key?(name)
@@ -87,7 +87,7 @@ module Net
87
87
  # @param [IO] stream
88
88
  # The stream to write the headers back to.
89
89
  #
90
- # @param [Hash{String => [String, Time, Array<String>}] headers
90
+ # @param [Hash{String => String,Time,Array<String>}] headers
91
91
  # The headers of the HTTP Response.
92
92
  #
93
93
  def write_headers(stream,headers)
@@ -155,7 +155,7 @@ module Net
155
155
  # @param [Integer] status
156
156
  # The status of the HTTP Response.
157
157
  #
158
- # @param [Hash{String => [String, Time, Array<String>}] headers
158
+ # @param [Hash{String => String,Time,Array<String>}] headers
159
159
  # The headers of the HTTP Response.
160
160
  #
161
161
  # @param [#each] body
@@ -8,23 +8,23 @@ module Net
8
8
  #
9
9
  # Starts the HTTP Server.
10
10
  #
11
- # @param [Hash] options
12
- # Options for the server.
11
+ # @param [Boolean] background
12
+ # Specifies whether to run the server in the background or
13
+ # foreground.
13
14
  #
14
- # @option options [String] :host (DEFAULT_HOST)
15
+ # @param [Hash{Symbol => Object}] kwargs
16
+ # Additional keyword arguments for {Daemon#initialize}.
17
+ #
18
+ # @option kwargs [String] :host (DEFAULT_HOST)
15
19
  # The host to run on.
16
20
  #
17
- # @option options [String] :port (DEFAULT_PORT)
21
+ # @option kwargs [String] :port (DEFAULT_PORT)
18
22
  # The port to listen on.
19
23
  #
20
- # @option options [Integer] :max_connections (MAX_CONNECTIONS)
24
+ # @option kwargs [Integer] :max_connections (MAX_CONNECTIONS)
21
25
  # The maximum number of simultaneous connections.
22
26
  #
23
- # @option options [Boolean] :background (false)
24
- # Specifies whether to run the server in the background or
25
- # foreground.
26
- #
27
- # @option options [#call] :handler
27
+ # @option kwargs [#call] :handler
28
28
  # The HTTP Request Handler object.
29
29
  #
30
30
  # @yield [request, socket]
@@ -36,11 +36,14 @@ module Net
36
36
  # @yieldparam [TCPSocket] socket
37
37
  # The TCP socket of the client.
38
38
  #
39
- def Server.run(options={},&block)
40
- daemon = Daemon.new(options,&block)
39
+ # @raise [ArgumentError]
40
+ # No `handler:` value was given.
41
+ #
42
+ def Server.run(background: false, **kwargs,&block)
43
+ daemon = Daemon.new(**kwargs,&block)
41
44
 
42
45
  daemon.start
43
- daemon.join unless options[:background]
46
+ daemon.join unless background
44
47
  return daemon
45
48
  end
46
49
 
@@ -4,7 +4,7 @@ module Net
4
4
  class HTTP < Protocol
5
5
  module Server
6
6
  # net-http-server version.
7
- VERSION = '0.2.0'
7
+ VERSION = '0.2.3'
8
8
  end
9
9
  end
10
10
  end
@@ -37,7 +37,7 @@ module Rack
37
37
  # @param [#call] app
38
38
  # The application the handler will be passing requests to.
39
39
  #
40
- # @param [Hash] options
40
+ # @param [Hash{Symbol => Object}] options
41
41
  # Additional options.
42
42
  #
43
43
  # @option options [String] :Host
@@ -46,11 +46,10 @@ module Rack
46
46
  # @option options [Integer] :Port
47
47
  # The port to listen on.
48
48
  #
49
- def initialize(app,options={})
50
- @app = app
49
+ def initialize(app,**options)
50
+ @app = app
51
51
  @options = options
52
-
53
- @server = nil
52
+ @server = nil
54
53
  end
55
54
 
56
55
  #
@@ -58,8 +57,8 @@ module Rack
58
57
  #
59
58
  # @see #initialize
60
59
  #
61
- def self.run(app,options={})
62
- new(app,options).run
60
+ def self.run(app,**options)
61
+ new(app,**options).run
63
62
  end
64
63
 
65
64
  #
@@ -67,9 +66,9 @@ module Rack
67
66
  #
68
67
  def run
69
68
  @server = Net::HTTP::Server::Daemon.new(
70
- :host => @options[:Host],
71
- :port => @options[:Port],
72
- :handler => self
69
+ host: @options[:Host],
70
+ port: @options[:Port],
71
+ handler: self
73
72
  )
74
73
 
75
74
  @server.start
@@ -89,9 +88,9 @@ module Rack
89
88
  # The response status, headers and body.
90
89
  #
91
90
  def call(request,stream)
92
- request_uri = request[:uri]
91
+ request_uri = request[:uri]
93
92
  remote_address = stream.socket.remote_address
94
- local_address = stream.socket.local_address
93
+ local_address = stream.socket.local_address
95
94
 
96
95
  env = {}
97
96
 
@@ -105,21 +104,21 @@ module Rack
105
104
  env['rack.url_scheme'] = request_uri[:scheme].to_s
106
105
  end
107
106
 
108
- env['SERVER_NAME'] = local_address.getnameinfo[0]
109
- env['SERVER_PORT'] = local_address.ip_port.to_s
107
+ env['SERVER_NAME'] = local_address.getnameinfo[0]
108
+ env['SERVER_PORT'] = local_address.ip_port.to_s
110
109
  env['SERVER_PROTOCOL'] = "HTTP/#{request[:http_version]}"
111
110
 
112
111
  env['REMOTE_ADDR'] = remote_address.ip_address
113
112
  env['REMOTE_PORT'] = remote_address.ip_port.to_s
114
113
 
115
114
  env['REQUEST_METHOD'] = request[:method].to_s
116
- env['PATH_INFO'] = request_uri.fetch(:path,'*').to_s
117
- env['QUERY_STRING'] = request_uri[:query_string].to_s
115
+ env['PATH_INFO'] = request_uri.fetch(:path,'*').to_s
116
+ env['QUERY_STRING'] = request_uri[:query].to_s
118
117
 
119
118
  # add the headers
120
119
  request[:headers].each do |name,value|
121
120
  key = name.dup
122
-
121
+
123
122
  key.upcase!
124
123
  key.tr!('-','_')
125
124