diff --git a/nselib/http.lua b/nselib/http.lua
index 9b1686645..12993027b 100644
--- a/nselib/http.lua
+++ b/nselib/http.lua
@@ -940,12 +940,13 @@ end
-- * cookies: A table of cookies in the form returned by parse_set_cookie.
-- @return A table as described in the module description.
-- @see generic_request
-request = function(host, port, data)
+request = function(host, port, data, options)
local method
- local opts
local header, partial
local response
+ options = options or {}
+
if type(host) == 'table' then
host = host.ip
end
@@ -962,7 +963,7 @@ request = function(host, port, data)
method = string.match(data, "^(%S+)")
- socket, partial = comm.tryssl(host, port, data, opts)
+ socket, partial = comm.tryssl(host, port, data, { timeout = options.timeout })
if not socket then
return error_response