Enable support for persistent connections.

(test: works fine with curl -k , but weird behavior with ab -k ...)
This commit is contained in:
2015-04-01 19:31:27 +02:00
parent 89e26519e4
commit 3165c1e5c6
4 changed files with 27 additions and 31 deletions

View File

@@ -174,7 +174,6 @@ feature -- Execution
is_connected: is_connected
local
l_remote_info: detachable like remote_info
l_continue: BOOLEAN
l_socket: like client_socket
l_ready_for_reading: BOOLEAN
do
@@ -192,25 +191,20 @@ feature -- Execution
dbglog (generator + ".execute_request socket=" + l_socket.descriptor.out + " ENTER")
end
l_socket.set_timeout (5) -- 5 seconds!
from until l_continue loop
-- Use timeout from l_socket!
l_ready_for_reading := l_socket.ready_for_reading
if l_ready_for_reading then
l_continue := True
create l_remote_info
if attached l_socket.peer_address as l_addr then
l_remote_info.addr := l_addr.host_address.host_address
l_remote_info.hostname := l_addr.host_address.host_name
l_remote_info.port := l_addr.port
remote_info := l_remote_info
end
analyze_request_message (l_socket)
else
has_error := True
l_continue := True
debug ("dbglog")
dbglog (generator + ".execute_request socket=" + l_socket.descriptor.out + "} WAITING")
end
l_ready_for_reading := l_socket.ready_for_reading
if l_ready_for_reading then
create l_remote_info
if attached l_socket.peer_address as l_addr then
l_remote_info.addr := l_addr.host_address.host_address
l_remote_info.hostname := l_addr.host_address.host_name
l_remote_info.port := l_addr.port
remote_info := l_remote_info
end
analyze_request_message (l_socket)
else
has_error := True
debug ("dbglog")
dbglog (generator + ".execute_request socket=" + l_socket.descriptor.out + "} timeout!")
end
end
@@ -310,11 +304,11 @@ feature -- Parsing
l_connection.is_case_insensitive_equal_general ("keep-alive")
else
-- By default HTTP:1/1 support persistent connection.
if
attached request_header_map.item ("Connection") as l_connection and then
l_connection.is_case_insensitive_equal_general ("close")
then
keep_alive_enabled := False
if attached request_header_map.item ("Connection") as l_connection then
print ("Connection -> " + l_connection + "%N")
if l_connection.is_case_insensitive_equal_general ("close") then
keep_alive_enabled := False
end
else
keep_alive_enabled := True
end

View File

@@ -58,7 +58,7 @@ feature -- Access
factory: separate HTTPD_REQUEST_HANDLER_FACTORY
is_persistent_connection_supported: BOOLEAN = False
is_persistent_connection_supported: BOOLEAN = True
-- Is persistent connection supported?
--| For now, disabled during dev.

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="test_connector_standalone" uuid="BA1C9760-8ECD-4182-8354-5D880F2FC81B" library_target="test_connector_standalone">
<target name="test_standalone_scoop">
<root class="TEST_STANDALONE_CONNECTOR" feature="make"/>
@@ -10,7 +10,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="connector_standalone" location="standalone-safe.ecf" readonly="false"/>
<library name="ewsgi" location="..\..\ewsgi-safe.ecf" readonly="false"/>
<library name="httpd" location="src\httpd\httpd-safe.ecf" readonly="false"/>
<library name="httpd_EDIT" location="src\httpd\httpd-safe.ecf" readonly="false"/>
<library name="net_ssl_EDIT" location="$ISE_LIBRARY\unstable\library\network\socket\netssl\net_ssl-safe.ecf" readonly="false"/>
<library name="wsf" location="..\..\..\wsf\wsf-safe.ecf" readonly="false"/>
<cluster name="tests" location="tests\" recursive="true"/>
</target>

View File

@@ -23,8 +23,9 @@ feature -- Execution
i64: INTEGER_64
do
i64 := {INTEGER_64} 1_000_000_000
s := "Hello Concurrent EWF"
s.append (" (counter=")
s := "Test Concurrent EWF ["
s.append (request.percent_encoded_path_info)
s.append ("] (counter=")
s.append_integer (next_cell_counter_item (counter_cell))
s.append (")%N")