code: function basic_medium(req, res, next) {
  
      var auth = basic_small(req);
      if (auth !== '') {
        if (check(auth, my.hash, my.file) === true) { // check if different
          return setHeader(res, 'WWW-Authenticate', my.realms) === true
            ? end_work(err, next, 401) : null;
        }
  
        if (my.agent === '' || my.agent === req.headers['user-agent']) { // check UA
          return end_work(err, next);
        }
  
        return end_work(err, next, 403);
      }
  
      // first attempt
      res.writeHead(401, my.realm);
      res.end();
    }
docs: protection middleware with basic authentication without res.end
  
  @function basic_medium
  @param {Object} req - client request
  @param {Object} res - response to client
  @param {next} [next] - continue routes