1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-12 02:39:03 +00:00

Use sock:receive when neither the "lines" nor "bytes" option is given to

comm.exchange. Previously it was acting as if it got bytes=1, which
could return as few as one bytes. sock:receive will read until timeout
or EOF.
This commit is contained in:
david
2010-12-29 22:44:03 +00:00
parent 1046dcab57
commit d9d47eb93d

View File

@@ -52,11 +52,6 @@ local setup_connect = function(host, port, opts)
return status, err return status, err
end end
-- If nothing is given, specify bytes=1 so NSE reads everything
if not opts.lines and not opts.bytes then
opts.bytes = 1
end
return true, sock return true, sock
end end
@@ -68,7 +63,12 @@ local read = function(sock, opts)
return status, response return status, response
end end
status, response = sock:receive_bytes(opts.bytes) if opts.bytes then
status, response = sock:receive_bytes(opts.bytes)
return status, response
end
status, response = sock:receive()
return status, response return status, response
end end