From 1d2c5cb73542fafceeadc78547ba9ce397b96ca3 Mon Sep 17 00:00:00 2001 From: patrik Date: Thu, 15 Mar 2012 06:30:06 +0000 Subject: [PATCH] Added additional http redirect documentation to the http library --- nselib/http.lua | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/nselib/http.lua b/nselib/http.lua index 7cd5aedff..a9ba690f2 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1354,9 +1354,18 @@ local function get_redirect_ok(host, port, options) end ---Fetches a resource with a GET request and returns the result as a table. This is a simple --- wraper around generic_request, with the added benefit of having local caching. --- This caching can be controlled in the options array, see module documentation --- for more information. +-- wraper around generic_request, with the added benefit of having local caching +-- and support for HTTP redirects. Redirects are followed only if they pass all the +-- validation rules of the redirect_ok function. This function may be overrided by supplying +-- a custom function in the redirect_ok field of the options array. The default +-- function redirects the request if the destination is: +-- * Within the same host or domain +-- * Has the same port number +-- * Stays within the current scheme +-- * Does not exceed MAX_REDIRECT_COUNT count of redirects +-- +-- Caching and redirects can be controlled in the options array, see module +-- documentation for more information. -- -- @param host The host to connect to. -- @param port The port to connect to. @@ -1422,7 +1431,19 @@ function get_url( u, options ) end ---Fetches a resource with a HEAD request. Like get, this is a simple --- wrapper around generic_request with response caching. +-- wrapper around generic_request with response caching. This function +-- also has support for HTTP redirects. Redirects are followed only if they pass +-- all the validation rules of the redirect_ok function. This function may be +-- overrided by supplying a custom function in the redirect_ok field +-- of the options array. The default function redirects the request if the +-- destination is: +-- * Within the same host or domain +-- * Has the same port number +-- * Stays within the current scheme +-- * Does not exceed MAX_REDIRECT_COUNT count of redirects +-- +-- Caching and redirects can be controlled in the options array, +-- see module documentation for more information. -- -- @param host The host to connect to. -- @param port The port to connect to.