Auth plugin improvements #48

Closed
wants to merge 2 commits into
from
View
@@ -8,6 +8,7 @@
"use strict";
var jsDAV_ServerPlugin = require("./../plugin").jsDAV_ServerPlugin;
+var jsDAV_Util_EventEmitter_PRIO_HIGH = require("./../util").EventEmitter.PRIO_HIGH;
/**
* This plugin provides Authentication for a WebDAV server.
@@ -41,7 +42,7 @@ function jsDAV_Auth_Plugin(handler) {
this.realm = null;
this.initialize = function() {
- this.handler.addEventListener("beforeMethod", this.beforeMethod.bind(this));
+ this.handler.addEventListener("beforeMethod", this.beforeMethod.bind(this), jsDAV_Util_EventEmitter_PRIO_HIGH);
};
/**
@@ -43,6 +43,9 @@ function jsDAV_Auth_Backend_File(filename) {
return cbloadfile(err);
data.split("\n").forEach(function(line) {
+ if( '' == line ) /* ignore empty lines (including one at end of file) */
mikedeboer
mikedeboer Jul 23, 2012 Owner

wouldn't if (/^[\s\t\r\n]+$/.test(line)) be more accurate as to catching all types of empty lines?

+ cbloadfile();
+
var parts = line.split(":");
if (line.length !== 3)
cbloadfile(new Exc.jsDAV_Exception("Malformed htdigest file. Every line should contain 2 colons"));