From ed3ad962d1d3bd0bbe5e5e9dcac3bf1dff01184a Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 13 Feb 2018 18:46:18 +0100 Subject: [PATCH] Updated a few classes from http_client to use nanoseconds as timeout precision. Fixed typo in comments. --- .../network/http_client/src/http_client_request.e | 4 ++-- .../src/spec/net/net_http_client_request.e | 4 ++-- library/server/httpd/httpd_request_handler_i.e | 14 ++++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/library/network/http_client/src/http_client_request.e b/library/network/http_client/src/http_client_request.e index b645ebba..36911ccf 100644 --- a/library/network/http_client/src/http_client_request.e +++ b/library/network/http_client/src/http_client_request.e @@ -157,7 +157,7 @@ feature -- Settings end connect_timeout: INTEGER - -- HTTP connection timeout in seconds. + -- HTTP connection timeout in milliseconds. --| 0 means it nevers timeout do Result := session.connect_timeout @@ -208,7 +208,7 @@ feature -- Settings end note - copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" + copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/network/http_client/src/spec/net/net_http_client_request.e b/library/network/http_client/src/spec/net/net_http_client_request.e index cbc457c0..63cca7e9 100644 --- a/library/network/http_client/src/spec/net/net_http_client_request.e +++ b/library/network/http_client/src/spec/net/net_http_client_request.e @@ -64,7 +64,7 @@ feature {NONE} -- Internal create Result.make_client_by_port (a_port, a_host) end Result.set_connect_timeout (connect_timeout) - Result.set_timeout (timeout) + Result.set_timeout_ns (Result.seconds_to_nanoseconds (timeout)) Result.connect end end @@ -887,7 +887,7 @@ feature {NONE} -- Helpers invariant note - copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" + copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/httpd/httpd_request_handler_i.e b/library/server/httpd/httpd_request_handler_i.e index 87d1bf43..42022aa2 100644 --- a/library/server/httpd/httpd_request_handler_i.e +++ b/library/server/httpd/httpd_request_handler_i.e @@ -13,6 +13,8 @@ inherit HTTPD_SOCKET_FACTORY + SOCKET_TIMEOUT_UTILITIES + feature {NONE} -- Initialization make (a_request_settings: HTTPD_REQUEST_SETTINGS) @@ -149,16 +151,16 @@ feature -- Settings -- note: it is relevant only if `is_persistent_connection_supported' is True. timeout_ns: NATURAL_64 -- nanoseconds - -- Amount of seconds that the server waits for receipts and transmissions during communications. + -- Amount of nanoseconds that the server waits for receipts and transmissions during communications. socket_recv_timeout_ns: NATURAL_64 -- nanoseconds - -- Amount of seconds that the server waits for receiving data on socket during communications. + -- Amount of nanoseconds that the server waits for receiving data on socket during communications. max_keep_alive_requests: INTEGER -- Maximum number of requests allowed per persistent connection. keep_alive_timeout_ns: NATURAL_64 -- nanoseconds - -- Number of seconds for persistent connection timeout. + -- Number of nanoseconds for persistent connection timeout. feature -- Status report @@ -303,13 +305,13 @@ feature -- Execution end -- Try to get request header. - -- If the request is reusing persistent connection, use `keep_alive_timeout', - -- otherwise `socket_recv_timeout'. + -- If the request is reusing persistent connection, use `keep_alive_timeout_ns', + -- otherwise `socket_recv_timeout_ns'. get_request_header (l_socket, a_is_reusing_connection) if has_error then if a_is_reusing_connection and then request_header.is_empty then - -- Close persistent connection, since no new connection occurred in the delay `keep_alive_timeout'. + -- Close persistent connection, since no new connection occurred in the delay `keep_alive_timeout_ns'. debug ("dbglog") dbglog ("execute_request socket=" + l_socket.descriptor.out + "} close persistent connection.") end