From 854b3460b530fac08886026ecf6713db4dca51fe Mon Sep 17 00:00:00 2001 From: david Date: Tue, 4 Nov 2008 22:39:07 +0000 Subject: [PATCH] Fix an inaccuracy in the documentation for the nmap.receive_lines and nmap.receive_bytes functions. It claimed that if you don't get all the lines/bytes you request before a timeout, then a "TIMEOUT" error happens. In reality you get back data as long as at least one byte was received before the timeout. From nsock_readlines: /* Read up to nlines lines (terminated with \n, which of course inclues \r\n), or until EOF, or until the timeout, whichever comes first. Note that NSE_STATUS_SUCCESS will be returned in the case of EOF or tiemout if at least 1 char has been read. Also note that you may get more than 'nlines' back -- we just stop once "at least" 'nlines' is read */ --- nselib/nmap.luadoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nselib/nmap.luadoc b/nselib/nmap.luadoc index 61d4becae..05bdbac89 100644 --- a/nselib/nmap.luadoc +++ b/nselib/nmap.luadoc @@ -279,12 +279,12 @@ function receive() --- Receives lines from an open connection. -- -- Tries to receive at least n lines from an open connection. A --- line is a string delimited with \n characters. If it was not --- possible to receive at least n lines before the operation times --- out a "TIMEOUT" error occurs. On the other hand, if more than --- n lines were received, all are returned, not just --- n. Use stdnse.make_buffer to guarantee only one --- line is returned per call. +-- line is a string delimited with \n characters. If no data was +-- was received before the operation times out a "TIMEOUT" error +-- occurs. If even one character was received then it is returned with success. +-- On the other hand, if more than n lines were received, all are +-- returned, not just n. Use stdnse.make_buffer to +-- guarantee only one line is returned per call. -- -- On success the function returns true along with the received data. If -- receiving data has failed, the function returns false along with an error @@ -301,8 +301,8 @@ function receive_lines(n) -- Tries to receive at least n bytes from an open connection. Like -- in receive_lines, n is the minimum amount of -- characters we would like to receive. If more arrive, we get all of them. If --- fewer than n characters arrive before the operation times out, --- a "TIMEOUT" error occurs. +-- even one is received then it is returned. If no characters arrive before the +-- operation times out, a "TIMEOUT" error occurs. -- -- On success the function returns true along with the received data. If -- receiving data has failed, the function returns false along with an error