typhoeus 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typhoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix
@@ -58,8 +58,7 @@ files:
58
58
  - spec/typhoeus/filter_spec.rb
59
59
  - spec/typhoeus/remote_method_spec.rb
60
60
  - spec/typhoeus/response_spec.rb
61
- - spec/servers/delay_fixture_server.rb
62
- - spec/servers/method_server.rb
61
+ - spec/servers/app.rb
63
62
  has_rdoc: true
64
63
  homepage: http://github.com/pauldix/typhoeus
65
64
  licenses: []
@@ -1,66 +0,0 @@
1
- # this server simply accepts requests and blocks for a passed in interval before returning a passed in reqeust value to
2
- # the client
3
- require 'rubygems'
4
- require 'eventmachine'
5
- require 'evma_httpserver'
6
-
7
- class DelayFixtureServer < EventMachine::Connection
8
- include EventMachine::HttpServer
9
-
10
- def process_http_request
11
- EventMachine.stop if ENV["PATH_INFO"] == "/die"
12
- puts "got a request #{ENV['PATH_INFO']}"
13
- resp = EventMachine::DelegatedHttpResponse.new( self )
14
-
15
- # Block which fulfills the request
16
- operation = proc do
17
- sleep DelayFixtureServer.response_delay
18
-
19
- resp.status = 200
20
- resp.content = "whatever"
21
- end
22
-
23
- # Callback block to execute once the request is fulfilled
24
- callback = proc do |res|
25
- resp.send_response
26
- end
27
-
28
- # Let the thread pool (20 Ruby threads) handle request
29
- EM.defer(operation, callback)
30
- end
31
-
32
- def self.response_fixture
33
- @response_fixture ||= ""
34
- end
35
-
36
- def self.response_fixture=(val)
37
- @response_fixture = val
38
- end
39
-
40
- def self.response_delay
41
- @response_delay ||= 0
42
- end
43
-
44
- def self.response_delay=(val)
45
- @response_delay = val
46
- end
47
-
48
- def self.reponse_number
49
- @response_number
50
- end
51
-
52
- def self.response_number=(val)
53
- @response_number = val
54
- end
55
- end
56
-
57
- port = (ARGV[0] || 3000).to_i
58
-
59
- DelayFixtureServer.response_delay = 0.5
60
- DelayFixtureServer.response_number = 0
61
- #DelayFixtureServer.response_fixture = File.read(File.dirname(__FILE__) + "/../fixtures/result_set.xml")
62
-
63
- EventMachine::run {
64
- EventMachine.epoll
65
- EventMachine::start_server("0.0.0.0", port, DelayFixtureServer)
66
- }
@@ -1,51 +0,0 @@
1
- # this server simply is for testing out the different http methods. it echoes back the passed in info
2
- require 'rubygems'
3
- require 'eventmachine'
4
- require 'evma_httpserver'
5
-
6
- class MethodServer < EventMachine::Connection
7
- include EventMachine::HttpServer
8
-
9
- def process_http_request
10
- EventMachine.stop if ENV["PATH_INFO"] == "/die"
11
-
12
- resp = EventMachine::DelegatedHttpResponse.new( self )
13
-
14
- # Block which fulfills the request
15
- operation = proc do
16
- sleep MethodServer.sleep_time
17
- resp.status = 200
18
- resp.content = request_params + "\n#{@http_post_content}"
19
- end
20
-
21
- # Callback block to execute once the request is fulfilled
22
- callback = proc do |res|
23
- resp.send_response
24
- end
25
-
26
- # Let the thread pool (20 Ruby threads) handle request
27
- EM.defer(operation, callback)
28
- end
29
-
30
- def request_params
31
- %w( PATH_INFO QUERY_STRING HTTP_COOKIE IF_NONE_MATCH CONTENT_TYPE REQUEST_METHOD REQUEST_URI ).collect do |param|
32
- "#{param}=#{ENV[param]}"
33
- end.join("\n")
34
- end
35
-
36
- def self.sleep_time=(val)
37
- @sleep_time = val
38
- end
39
-
40
- def self.sleep_time
41
- @sleep_time || 0
42
- end
43
- end
44
- #
45
- # port = (ARGV[0] || 3000).to_i
46
- # #Process.fork do
47
- # EventMachine::run {
48
- # EventMachine.epoll
49
- # EventMachine::start_server("0.0.0.0", port, MethodServer)
50
- # }
51
- # #end