From 90acf4822d18b1d052224d03185dcbe171759704 Mon Sep 17 00:00:00 2001 From: Andrew Robinson Date: Sun, 11 Mar 2012 21:43:00 -0400 Subject: [PATCH 1/2] Added super basic support for file uploads --- lib/plugins/multipart_parser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/plugins/multipart_parser.js b/lib/plugins/multipart_parser.js index e75d3cd08..42154a5b6 100644 --- a/lib/plugins/multipart_parser.js +++ b/lib/plugins/multipart_parser.js @@ -41,6 +41,7 @@ function multipartBodyParser(options) { return next(new BadRequestError(err.toString())); req.body = fields; + req.files = files; if (options.mapParams !== false) { Object.keys(fields).forEach(function (k) { From 791fbbe7abb6309ae9e7af4dbf2f2848cff256ae Mon Sep 17 00:00:00 2001 From: Andrew Robinson Date: Sun, 11 Mar 2012 22:00:31 -0400 Subject: [PATCH 2/2] Small fix to allow for username-only HTTP basic auth --- lib/plugins/authorization.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plugins/authorization.js b/lib/plugins/authorization.js index 25784de6c..60008a3f5 100644 --- a/lib/plugins/authorization.js +++ b/lib/plugins/authorization.js @@ -39,9 +39,13 @@ function parseBasic(string) { pieces = [decoded.slice(0, index), decoded.slice(index + 1)]; } - if (!pieces || !pieces[0] || !pieces[1]) + if (!pieces || !pieces[0]) throw new InvalidHeaderError('Authorization header invalid'); + // Allows for passwordless authentication + if (!pieces[1]) + pieces[1] = null; + return { username: pieces[0], password: pieces[1]