Nmap Development mailing list archives

Re: [NSE] Return values inconsistent with documentation in http.lua


From: David Fifield <david () bamsoftware com>
Date: Tue, 19 Jun 2012 07:22:17 -0700

On Tue, Jun 19, 2012 at 03:20:46PM +0200, Peter O wrote:
Hi all,

there's an issue with return values of: get, head, post, put
(basically every function that uses generic_request) functions from
http.lua library.
Comments above each of those functions suggest that nil is going to be
returned in case of an error, but they can actually return either nil
or error_response =
{status=nil,["status-line"]=nil,header={},body=""}.
Should we change those functions to always return a table? This
approach is suggested by a comment starting in line 1046: "The format
of the return value is a table with the following structure: {status =
200, status-line = "HTTP/1.1 200 OK", header = {}, rawheader = {},
body ="<html>...</html>"} [...] http status code of the request in
case of an error status is nil." and that's also how it was done when
the library came out in r6778.

I think that the returns should always be a table in http.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: