Nmap Development mailing list archives

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


From: Peter O <perdo.olma () gmail com>
Date: Tue, 19 Jun 2012 15:20:46 +0200

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.


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


Current thread: