ronin-web 0.3.0.pre1 → 0.3.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -4,6 +4,7 @@
4
4
  * Require nokogiri ~> 1.4.
5
5
  * Require mechanize ~> 1.0.
6
6
  * Require spidr ~> 0.2.
7
+ * Require rack ~> 1.3.
7
8
  * Require sinatra ~> 1.2.
8
9
  * Require data_paths ~> 0.3.
9
10
  * Require ronin-support ~> 0.2.
data/README.md CHANGED
@@ -165,7 +165,8 @@ Serve files via a Web Server:
165
165
  * [libxslt1](http://xmlsoft.org/XSLT/)
166
166
  * [mechanize](http://github.com/tenderlove/mechanize) ~> 1.0
167
167
  * [spidr](http://github.com/postmodern/spidr) ~> 0.2
168
- * [sinatra](http://github.com/sinatra/sinatra) ~> 1.1
168
+ * [rack](http://github.com/rack/rack) ~> 1.3
169
+ * [sinatra](http://github.com/sinatra/sinatra) ~> 1.2
169
170
  * [data_paths](http://github.com/postmodern/data_paths) ~> 0.3
170
171
  * [ronin-support](http://github.com/ronin-ruby/ronin-support) ~> 0.2
171
172
  * [ronin](http://github.com/ronin-ruby/ronin) ~> 1.1
data/gemspec.yml CHANGED
@@ -16,14 +16,15 @@ dependencies:
16
16
  nokogiri: ~> 1.4
17
17
  mechanize: ~> 1.0
18
18
  spidr: ~> 0.2
19
+ rack: ~> 1.3
19
20
  sinatra: ~> 1.2
20
21
  # data_paths: ~> 0.3
21
22
  data_paths: ~> 0.3.0.rc1
22
23
  # Ronin dependencies:
23
24
  # ronin-support: ~> 0.2
24
- ronin-support: ~> 0.2.0.rc1
25
+ ronin-support: ~> 0.2.0.rc2
25
26
  # ronin: ~> 1.1
26
- ronin: ~> 1.1.0.rc1
27
+ ronin: ~> 1.1.0.rc3
27
28
 
28
29
  development_dependencies:
29
30
  bundler: ~> 1.0.10
@@ -153,7 +153,9 @@ module Ronin
153
153
 
154
154
  return_file = proc { |local_path|
155
155
  if File.file?(local_path)
156
- print_info "Returning file #{local_path.dump}"
156
+ request = Request.new(env)
157
+
158
+ print_info "Returning file #{local_path.dump} for #{request.address}"
157
159
  return response_for(local_path)
158
160
  end
159
161
  }
@@ -128,7 +128,9 @@ module Ronin
128
128
  end
129
129
 
130
130
  if matched
131
- print_info "Returning file #{local_path.dump}"
131
+ request = Request.new(env)
132
+
133
+ print_info "Returning file #{local_path.dump} for #{request.address}"
132
134
  return response_for(local_path)
133
135
  end
134
136
  end
@@ -197,7 +197,7 @@ module Ronin
197
197
  return super(env)
198
198
  end
199
199
 
200
- print_info "Proxying #{request.url}"
200
+ print_info "Proxying #{request.url} for #{request.address}"
201
201
  request.headers.each do |name,value|
202
202
  print_debug " #{name}: #{value}"
203
203
  end
@@ -206,7 +206,7 @@ module Ronin
206
206
 
207
207
  @every_response_block.call(response) if @every_response_block
208
208
 
209
- print_info "Returning proxied response."
209
+ print_info "Returning proxied response for #{request.address}"
210
210
  response.headers.each do |name,value|
211
211
  print_debug " #{name}: #{value}"
212
212
  end
@@ -29,6 +29,27 @@ module Ronin
29
29
  module Middleware
30
30
  class Request < Rack::Request
31
31
 
32
+ #
33
+ # Returns the remote IP address and port for the request.
34
+ #
35
+ # @param [Hash] env
36
+ # The request env Hash.
37
+ #
38
+ # @return [String]
39
+ # The IP address and port number.
40
+ #
41
+ # @since 0.3.0
42
+ #
43
+ # @api semipublic
44
+ #
45
+ def address
46
+ if env.has_key?('REMOTE_PORT')
47
+ "#{ip}:#{env['REMOTE_PORT']}"
48
+ else
49
+ ip
50
+ end
51
+ end
52
+
32
53
  #
33
54
  # The HTTP Headers for the request.
34
55
  #
@@ -42,7 +63,7 @@ module Ronin
42
63
  def headers
43
64
  headers = {}
44
65
 
45
- self.env.each do |name,value|
66
+ env.each do |name,value|
46
67
  if name =~ /^HTTP_/
47
68
  header_name = Network::HTTP.header_name(name.sub('HTTP_',''))
48
69
  headers[header_name] = value
@@ -153,7 +153,7 @@ module Ronin
153
153
 
154
154
  @routes.each do |rule,app|
155
155
  if rule.match?(request)
156
- print_info "Routing #{request.url}"
156
+ print_info "Routing #{request.url} for #{request.address}"
157
157
  return app.call(env)
158
158
  end
159
159
  end
@@ -23,6 +23,6 @@
23
23
  module Ronin
24
24
  module Web
25
25
  # Ronin Web Version
26
- VERSION = '0.3.0.pre1'
26
+ VERSION = '0.3.0.pre2'
27
27
  end
28
28
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ronin-web
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 0.3.0.pre1
5
+ version: 0.3.0.pre2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-27 00:00:00 Z
13
+ date: 2011-06-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -46,52 +46,63 @@ dependencies:
46
46
  prerelease: false
47
47
  version_requirements: *id003
48
48
  - !ruby/object:Gem::Dependency
49
- name: sinatra
49
+ name: rack
50
50
  requirement: &id004 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: "1.2"
55
+ version: "1.3"
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: *id004
59
59
  - !ruby/object:Gem::Dependency
60
- name: data_paths
60
+ name: sinatra
61
61
  requirement: &id005 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
65
65
  - !ruby/object:Gem::Version
66
- version: 0.3.0.rc1
66
+ version: "1.2"
67
67
  type: :runtime
68
68
  prerelease: false
69
69
  version_requirements: *id005
70
70
  - !ruby/object:Gem::Dependency
71
- name: ronin-support
71
+ name: data_paths
72
72
  requirement: &id006 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 0.2.0.rc1
77
+ version: 0.3.0.rc1
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: *id006
81
81
  - !ruby/object:Gem::Dependency
82
- name: ronin
82
+ name: ronin-support
83
83
  requirement: &id007 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
87
87
  - !ruby/object:Gem::Version
88
- version: 1.1.0.rc1
88
+ version: 0.2.0.rc2
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: *id007
92
92
  - !ruby/object:Gem::Dependency
93
- name: bundler
93
+ name: ronin
94
94
  requirement: &id008 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: 1.1.0.rc3
100
+ type: :runtime
101
+ prerelease: false
102
+ version_requirements: *id008
103
+ - !ruby/object:Gem::Dependency
104
+ name: bundler
105
+ requirement: &id009 !ruby/object:Gem::Requirement
95
106
  none: false
96
107
  requirements:
97
108
  - - ~>
@@ -99,10 +110,10 @@ dependencies:
99
110
  version: 1.0.10
100
111
  type: :development
101
112
  prerelease: false
102
- version_requirements: *id008
113
+ version_requirements: *id009
103
114
  - !ruby/object:Gem::Dependency
104
115
  name: yard
105
- requirement: &id009 !ruby/object:Gem::Requirement
116
+ requirement: &id010 !ruby/object:Gem::Requirement
106
117
  none: false
107
118
  requirements:
108
119
  - - ~>
@@ -110,7 +121,7 @@ dependencies:
110
121
  version: 0.7.0
111
122
  type: :development
112
123
  prerelease: false
113
- version_requirements: *id009
124
+ version_requirements: *id010
114
125
  description: Ronin Web is a Ruby library for Ronin that provides support for web scraping and spidering functionality.
115
126
  email:
116
127
  - postmodern.mod3@gmail.com