From 34db78528aa93e5886b2c8df8abd09971233d634 Mon Sep 17 00:00:00 2001 From: patrik Date: Tue, 6 Dec 2011 22:24:58 +0000 Subject: [PATCH] o [NSE] Added support for detecting whether a http connection was established using SSL or not by the http.lua library [Patrik] --- CHANGELOG | 3 +++ nselib/http.lua | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6be9d1bc0..cf91a837a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o [NSE] Added support for detecting whether a http connection was established + using SSL or not by the http.lua library [Patrik] + o [NSE] Applied patch that replaces a number of GET requests to HEAD in http- fingerprints.lua where no matching was performed on the returned contents. [Hani Benhabiles] diff --git a/nselib/http.lua b/nselib/http.lua index 3b29f0778..7da349cab 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1113,7 +1113,7 @@ local function request(host, port, data, options) return nil end local method - local header, partial + local header local response options = options or {} @@ -1126,11 +1126,10 @@ local function request(host, port, data, options) end local error_response = {status=nil,["status-line"]=nil,header={},body=""} - local socket method = string.match(data, "^(%S+)") - socket, partial = comm.tryssl(host, port, data, { timeout = options.timeout }) + local socket, partial, opts = comm.tryssl(host, port, data, { timeout = options.timeout }) if not socket then return error_response @@ -1148,6 +1147,9 @@ local function request(host, port, data, options) socket:close() + -- if SSL was used to retrieve the URL mark this in the response + response.ssl = ( opts == 'ssl' ) + return response end