added a close connection method
This commit is contained in:
parent
62cb13fe49
commit
213f9cec0a
1 changed files with 8 additions and 3 deletions
|
@ -20,7 +20,7 @@ class FakeTunnelConnector
|
||||||
response = read_socket(tcp_socket)
|
response = read_socket(tcp_socket)
|
||||||
location = response[:start_line][:location]
|
location = response[:start_line][:location]
|
||||||
write_response(tcp_socket, location)
|
write_response(tcp_socket, location)
|
||||||
tcp_socket.close
|
close_connection(tcp_socket)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ssl_server
|
def ssl_server
|
||||||
|
@ -74,8 +74,13 @@ class FakeTunnelConnector
|
||||||
|
|
||||||
def write_response(tcp_socket, location)
|
def write_response(tcp_socket, location)
|
||||||
routed_response_string = route_request(location)
|
routed_response_string = route_request(location)
|
||||||
|
body = ok(routed_response_string)
|
||||||
tcp_socket.print(ok_headers)
|
tcp_socket.print(ok_headers)
|
||||||
tcp_socket.print(ok(routed_response_string))
|
tcp_socket.print(body)
|
||||||
|
end
|
||||||
|
|
||||||
|
def close_connection(tcp_socket)
|
||||||
|
tcp_socket.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def ok(body = 'Success')
|
def ok(body = 'Success')
|
||||||
|
@ -94,7 +99,7 @@ class FakeTunnelConnector
|
||||||
elsif location == '/session'
|
elsif location == '/session'
|
||||||
login
|
login
|
||||||
else
|
else
|
||||||
ok
|
login
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue