rflow-components-http 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rflow/components/http/server.rb +6 -8
- data/lib/rflow/components/http/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0183b24ca93c01e10195f3a436fd76b44863dfe5
|
4
|
+
data.tar.gz: 7868db2089a6b7e30b58ddf8d6f39a9eb77ae8b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e97d00002ee102a0ea59e5b1123778ed2a3cdb108dada488902d4ce8bef97fb5284c21d1538849892b17f1e45b6d409bcb79844198647271a6092837e67b73d6
|
7
|
+
data.tar.gz: 80d0783989f62e22ecfa28545edac5b75665b84da65b9b4c75c17d036414ff35f523d8f0ebcb30f131cfb3f21d1f5a2e0a7a364d51d85d996d7f49dfeda103f6
|
@@ -21,6 +21,7 @@ class RFlow
|
|
21
21
|
@server_signature = EM.start_server(@listen, @port, Connection) do |conn|
|
22
22
|
conn.server = self
|
23
23
|
self.connections[conn.signature.to_s] = conn
|
24
|
+
RFlow.logger.debug { "#{name}: Connection from #{conn.client_ip}:#{conn.client_port} to #{conn.server_ip}:#{conn.server_port}" }
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -29,14 +30,12 @@ class RFlow
|
|
29
30
|
# This is done by inspecting the provenance, specifically the
|
30
31
|
# context attribute that we stored originally
|
31
32
|
def process_message(input_port, input_port_key, connection, message)
|
32
|
-
RFlow.logger.debug { "#{self.class.name}: Received a #{message.data_type_name}" }
|
33
33
|
return unless message.data_type_name == 'RFlow::Message::Data::HTTP::Response'
|
34
34
|
my_events = message.provenance.find_all {|processing_event| processing_event.component_instance_uuid == uuid}
|
35
35
|
|
36
36
|
my_events.each do |processing_event|
|
37
37
|
connection_signature_string = processing_event.context.to_s
|
38
38
|
if connections[connection_signature_string]
|
39
|
-
RFlow.logger.debug { "#{self.class.name}: Found connection for #{connection_signature_string}" }
|
40
39
|
connections[connection_signature_string].send_http_response message
|
41
40
|
end
|
42
41
|
end
|
@@ -51,18 +50,17 @@ class RFlow
|
|
51
50
|
def post_init
|
52
51
|
@client_port, @client_ip = Socket.unpack_sockaddr_in(get_peername) rescue ["?", "?.?.?.?"]
|
53
52
|
@server_port, @server_ip = Socket.unpack_sockaddr_in(get_sockname) rescue ["?", "?.?.?.?"]
|
54
|
-
RFlow.logger.debug { "#{self.class.name}: Connection from #{@client_ip}:#{@client_port} to #{@server_ip}:#{@server_port}" }
|
55
53
|
super
|
56
54
|
no_environment_strings
|
57
55
|
end
|
58
56
|
|
59
57
|
def receive_data(data)
|
60
|
-
RFlow.logger.debug { "#{
|
58
|
+
RFlow.logger.debug { "#{server.name}: Received #{data.bytesize} bytes of data from #{client_ip}:#{client_port} to #{@server_ip}:#{@server_port}" }
|
61
59
|
super
|
62
60
|
end
|
63
61
|
|
64
62
|
def process_http_request
|
65
|
-
RFlow.logger.debug { "#{
|
63
|
+
RFlow.logger.debug { "#{server.name}: Received HTTP request from #{client_ip}:#{client_port} to #{@server_ip}:#{@server_port} for #{@http_request_uri}" }
|
66
64
|
|
67
65
|
server.request_port.send_message(RFlow::Message.new('RFlow::Message::Data::HTTP::Request').tap do |m|
|
68
66
|
m.data.client_ip = @client_ip
|
@@ -88,7 +86,7 @@ class RFlow
|
|
88
86
|
end
|
89
87
|
end)
|
90
88
|
rescue Exception => e
|
91
|
-
RFlow.logger.error "Error processing HTTP request from #{client_ip}:#{client_port} to #{@server_ip}:#{@server_port} for #{@http_request_uri}: #{e.class.name}: #{e.message}, because: #{e.backtrace.inspect}"
|
89
|
+
RFlow.logger.error "#{server.name}: Error processing HTTP request from #{client_ip}:#{client_port} to #{@server_ip}:#{@server_port} for #{@http_request_uri}: #{e.class.name}: #{e.message}, because: #{e.backtrace.inspect}"
|
92
90
|
end
|
93
91
|
|
94
92
|
def send_http_response(response_message = nil)
|
@@ -108,7 +106,7 @@ class RFlow
|
|
108
106
|
end
|
109
107
|
end
|
110
108
|
|
111
|
-
RFlow.logger.debug { "#{
|
109
|
+
RFlow.logger.debug { "#{server.name}: Sending an HTTP response #{resp.status} to #{client_ip}:#{client_port}" }
|
112
110
|
|
113
111
|
resp.send_response
|
114
112
|
close_connection_after_writing
|
@@ -117,7 +115,7 @@ class RFlow
|
|
117
115
|
# Called when a connection is torn down for whatever reason.
|
118
116
|
# Remove this connection from the server's list
|
119
117
|
def unbind(reason = nil)
|
120
|
-
RFlow.logger.debug { "#{
|
118
|
+
RFlow.logger.debug { "#{server.name}: Disconnected from HTTP client #{client_ip}:#{client_port}#{reason.nil? ? '' : " due to '#{reason}'"}" }
|
121
119
|
server.connections.delete(self.signature.to_s)
|
122
120
|
super()
|
123
121
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rflow-components-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael L. Artz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rflow
|