From 4fb61350d8285931eb55bd4c14ac302d1e460c86 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 7 Feb 2013 23:43:47 +0000 Subject: [PATCH] url.parse should convert all schemes to lower case. RFC 3986 section 3.1: Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. An implementation should accept uppercase letters as equivalent to lowercase in scheme names (e.g., allow "HTTP" as well as "http") for the sake of robustness but should only produce lowercase scheme names for consistency. --- nselib/url.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nselib/url.lua b/nselib/url.lua index a2f2a88f6..4b00cbb6a 100644 --- a/nselib/url.lua +++ b/nselib/url.lua @@ -159,9 +159,9 @@ function parse(url, default) parsed.fragment = f return "" end) - -- get scheme + -- get scheme. Lower-case according to RFC 3986 section 3.1. url = string.gsub(url, "^([%w][%w%+%-%.]*)%:", - function(s) parsed.scheme = s; return "" end) + function(s) parsed.scheme = string.lower(s); return "" end) -- get authority url = string.gsub(url, "^//([^/]*)", function(n) parsed.authority = n