experella-proxy 0.0.13 → 0.0.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc1501ac107644b8fd316bf88ffed64f00cd070d
4
- data.tar.gz: be4da95626a59d06fb1dd63e41c3d420f2ca2847
3
+ metadata.gz: 7651f0e09e3c9180b861c3bf9cb35576fa2a3aed
4
+ data.tar.gz: f5f847114f2ac3ad1e78a2d9ffaa130f55fdaf21
5
5
  SHA512:
6
- metadata.gz: 2329cab1c09d03d72ca2b6f47f781c1e326b6839ca1b0f1e88f964048d608dff13e30e52d1a5880619e26866b0ee67dcc9fdf46ee57e10f0ef2fc0b1f6a509ef
7
- data.tar.gz: ef1f2bfcc468f50d4562846987881bfd46cb479e7c01d58001e5bf5c60e8e6f8fa868aa8774a0df5dd2d5e1b386001fd40a238e1be0dcf17adc9fa5058e32fbf
6
+ metadata.gz: 910370bdb8367d1604833ad27c1a810674f730a7177782bae5a698e06487ffbe9e31a539123b95a4d5558f40de1bf618e61a96ab6bd8585b49f75cd1addbceac
7
+ data.tar.gz: e2656fe2f39cbace1928d9767929a8b2c164d9e4d31894bc4fdbedd0308a82debcfe66168444e790704440259c7299ffa4401b6654cca7c1339e77a7f947eaa5
data/README.md CHANGED
@@ -17,6 +17,7 @@ Supports:
17
17
  + Request header manipulation completely configurable for each server
18
18
  + Daemonized control using ruby [Daemons](http://daemons.rubyforge.org/)
19
19
  + TLS support and a default self-signed ssl certification
20
+ + Full request and response logging at practically any point in the proxy
20
21
 
21
22
  Proxy uses [http_parser](https://github.com/tmm1/http_parser.rb) to parse http data and is thereby subject to the parsers restrictions
22
23
 
@@ -25,6 +26,11 @@ as it can severely influence proxy performance overhead.
25
26
 
26
27
  It balances for every single http-request and not per client/connection.
27
28
 
29
+ The proxy is also an excellent man-in-the-middle logger. You can setup log events for http requests and
30
+ responses (partially, e.g. only specific headers or even full message content) at any point of transmission
31
+ and thereby see what the client is sending, what the server is receiving and vice versa.
32
+ Checkout how to setup events for that.
33
+
28
34
  ##Install as Gem
29
35
 
30
36
  To use experella-proxy simply install it as a gem.
@@ -234,6 +240,21 @@ Additionally you can activate simplecov code coverage analysis for specs by sett
234
240
  $> COVERAGE=true rake spec
235
241
  ```
236
242
 
243
+ ## Troubleshooting
244
+
245
+ Reported by [Lucas Mendelowski](https://github.com/lowski):
246
+
247
+ If you get error: `'start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)`
248
+ make sure you aliased 127.0.0.2, 127.0.0.10 and 127.0.0.11 to 127.0.0.1.
249
+
250
+ On OS X you can do it by executing following commands:
251
+
252
+ ```
253
+ sudo ifconfig lo0 alias 127.0.0.2 up
254
+ sudo ifconfig lo0 alias 127.0.0.10 up
255
+ sudo ifconfig lo0 alias 127.0.0.11 up
256
+ ```
257
+
237
258
  ## Additional Information
238
259
 
239
260
  + [em-proxy](https://github.com/igrigorik/em-proxy)
@@ -34,11 +34,13 @@ module ExperellaProxy
34
34
  413 => 'Request Entity Too Large',
35
35
  414 => 'Request-URI Too Large',
36
36
  415 => 'Unsupported Media Type',
37
+ 422 => 'Unprocessable Entity',
37
38
  500 => 'Internal Server Error',
38
39
  501 => 'Not Implemented',
39
40
  502 => 'Bad Gateway',
40
41
  503 => 'Service Unavailable',
41
42
  504 => 'Gateway Time-out',
42
- 505 => 'HTTP Version not supported'
43
+ 505 => 'HTTP Version not supported',
44
+ 522 => 'Uknown Error'
43
45
  }
44
46
  end
@@ -81,7 +81,7 @@ module ExperellaProxy
81
81
  # start line
82
82
  @send_buffer << "HTTP/1.1 "
83
83
  @send_buffer << @status_code.to_s + ' '
84
- @send_buffer << HTTP_STATUS_CODES[@status_code] + "\r\n"
84
+ @send_buffer << HTTP_STATUS_CODES.fetch(@status_code, "Status-Code unknown to experella") + "\r\n"
85
85
  # header fields
86
86
  @header.each do |key, value|
87
87
  key_val = key.to_s + ": "
@@ -1,5 +1,7 @@
1
1
  module ExperellaProxy
2
2
  # ExperellaProxy Gemversion
3
+ # 0.0.14
4
+ # * added error handling for unknown http status codes
3
5
  # 0.0.13
4
6
  # * headers are no longer folded if they came unfolded but headers stay as is
5
7
  # 0.0.12.WIP
@@ -31,5 +33,5 @@ module ExperellaProxy
31
33
  # * added self-signed SSL certificate for TLS/HTTPS
32
34
  # * added config template init functionality
33
35
  #
34
- VERSION = "0.0.13"
36
+ VERSION = "0.0.14"
35
37
  end
@@ -54,6 +54,17 @@ describe ExperellaProxy::Response do
54
54
  data.should include("Via-X: George\r\n")
55
55
  data.end_with?("\r\n\r\n").should be_true
56
56
  end
57
+
58
+ context "when status code does not exist in HTTP_STATUS_CODES" do
59
+ it "returns Uknown Error" do
60
+ response.instance_variable_set(:@status_code, 99)
61
+ response.update_header("Connection" => "keep-alive",
62
+ :"Via-X" => %w(Lukas Amy George))
63
+ response.reconstruct_header
64
+ data = response.flush
65
+ data.start_with?("HTTP/1.1 99 Status-Code unknown to experella\r\n").should be_true
66
+ end
67
+ end
57
68
  end
58
69
 
59
70
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: experella-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis-Florian Herr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-24 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons
@@ -189,38 +189,39 @@ extra_rdoc_files:
189
189
  files:
190
190
  - bin/experella-proxy
191
191
  - dev/experella-proxy
192
- - lib/experella-proxy/server.rb
193
- - lib/experella-proxy/http_status_codes.rb
194
- - lib/experella-proxy/backend_server.rb
192
+ - lib/experella-proxy/configuration.rb
193
+ - lib/experella-proxy/version.rb
195
194
  - lib/experella-proxy/response.rb
196
- - lib/experella-proxy/backend.rb
197
- - lib/experella-proxy/connection_manager.rb
195
+ - lib/experella-proxy/proxy.rb
198
196
  - lib/experella-proxy/connection.rb
199
- - lib/experella-proxy/version.rb
200
- - lib/experella-proxy/request.rb
201
197
  - lib/experella-proxy/globals.rb
202
- - lib/experella-proxy/configuration.rb
203
- - lib/experella-proxy/proxy.rb
198
+ - lib/experella-proxy/backend_server.rb
199
+ - lib/experella-proxy/connection_manager.rb
200
+ - lib/experella-proxy/backend.rb
201
+ - lib/experella-proxy/http_status_codes.rb
202
+ - lib/experella-proxy/server.rb
203
+ - lib/experella-proxy/request.rb
204
204
  - lib/experella-proxy.rb
205
+ - config/default/ssl/certs/experella-proxy.pem
206
+ - config/default/ssl/private/experella-proxy.key
205
207
  - config/default/404.html
206
- - config/default/503.html
207
208
  - config/default/config.rb
208
- - config/default/ssl/private/experella-proxy.key
209
- - config/default/ssl/certs/experella-proxy.pem
209
+ - config/default/503.html
210
+ - spec/fixtures/test_config.rb
210
211
  - spec/fixtures/404.html
212
+ - spec/fixtures/spec.log
211
213
  - spec/fixtures/503.html
212
- - spec/fixtures/test_config.rb
213
- - spec/experella-proxy/configuration_spec.rb
214
- - spec/experella-proxy/response_spec.rb
215
- - spec/experella-proxy/experella-proxy_spec.rb
216
- - spec/experella-proxy/request_spec.rb
214
+ - spec/echo-server/echo_server.rb
217
215
  - spec/experella-proxy/connection_manager_spec.rb
216
+ - spec/experella-proxy/request_spec.rb
218
217
  - spec/experella-proxy/backend_server_spec.rb
219
- - spec/echo-server/echo_server.rb
218
+ - spec/experella-proxy/response_spec.rb
219
+ - spec/experella-proxy/configuration_spec.rb
220
+ - spec/experella-proxy/experella-proxy_spec.rb
220
221
  - spec/spec_helper.rb
221
222
  - test/sinatra/server_one.rb
222
- - test/sinatra/hello_world_server.rb
223
223
  - test/sinatra/server_two.rb
224
+ - test/sinatra/hello_world_server.rb
224
225
  - .gitignore
225
226
  - Gemfile
226
227
  - experella-proxy.gemspec
@@ -252,18 +253,19 @@ signing_key:
252
253
  specification_version: 4
253
254
  summary: experella-proxy gem
254
255
  test_files:
256
+ - spec/fixtures/test_config.rb
255
257
  - spec/fixtures/404.html
258
+ - spec/fixtures/spec.log
256
259
  - spec/fixtures/503.html
257
- - spec/fixtures/test_config.rb
258
- - spec/experella-proxy/configuration_spec.rb
259
- - spec/experella-proxy/response_spec.rb
260
- - spec/experella-proxy/experella-proxy_spec.rb
261
- - spec/experella-proxy/request_spec.rb
260
+ - spec/echo-server/echo_server.rb
262
261
  - spec/experella-proxy/connection_manager_spec.rb
262
+ - spec/experella-proxy/request_spec.rb
263
263
  - spec/experella-proxy/backend_server_spec.rb
264
- - spec/echo-server/echo_server.rb
264
+ - spec/experella-proxy/response_spec.rb
265
+ - spec/experella-proxy/configuration_spec.rb
266
+ - spec/experella-proxy/experella-proxy_spec.rb
265
267
  - spec/spec_helper.rb
266
268
  - test/sinatra/server_one.rb
267
- - test/sinatra/hello_world_server.rb
268
269
  - test/sinatra/server_two.rb
270
+ - test/sinatra/hello_world_server.rb
269
271
  has_rdoc: