Purpose unknown

@param {unknown} req unknown
@param {unknown} _resp unknown
@param {unknown} next unknown
14055
function initializePerformance(req, _resp, next) {
    req.amorphicTracking = {
        startTime: process.hrtime(),
        serverTasks: [],
        browserTasks: [],
        loggingContext: {},
        addServerTask: function addTask(props, hrStartTime) {
            let diff = process.hrtime(hrStartTime);
            let took = (diff[0] * 1e9 + diff[1]) / 1000000;
            props.time = took;
            this.serverTasks.push(props);
        }
    };

    next();
}
474320
function middleware(req, res, next) {
  req.security.csrf.exclude = true;
  next();
}
894502
def process_request(self, req, resp):
        

        key = req.env['REMOTE_PORT'] + req.env['REMOTE_ADDR']
        val = self.cache.get(key, 0)

        if val == self.count:
            abort(exceptions.TooManyRequests(headers=self._error_headers))
        else:
            self.cache[key] = val + 1
265263
@SuppressWarnings({"UnusedDeclaration"})
    public void doIndex(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException {
        req.getView(this, chooseAction()).forward(req, resp);
    }
1124770
function reqres(res, req) {
    if (req && req._headers) {
        throw new Error('Received response object where request object was expected');
    }
    this.res = res;
    this.req = req;
    if (res) {
        if (res.$ && res.$.data) {
            this.data = res.$.data;
        }
        else {
            this.data = { error: null };
            if (!res.$) {
                res.$ = this;
            }
        }
    }
}
763388
function(req, res, next) {
        async.parallel({
            applications: (fn) => {
                const spy = { stash: {} };
                applications.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting applications.'));
                    }

                    return fn(null, spy.stash.body);
                });
            },
            hosts: (fn) => {
                const spy = { stash: {} };
                hosts.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting hosts.'));
                    }

                    return fn(null, spy.stash.body);
                });
            }
        }, (err, results) => {
            if(err) {
                res.stash.code = 500;
                return next();
            }

            res.stash.body = {
                applications: results.applications,
                hosts: results.hosts
            };
            res.stash.code = 200;
            return next();
        });
    }
921290
function show(req, res, next) {
  db.tags.find(req.params.tag, function(err, tag) {
    if(err) { return next(err); }
    res.json(tag);
  });
}
1041759
function requestHandler(req, res, next) {
  const params = req && req.params;
  const start = Date.now();
  let source;
  let opts;

  return Promise.try(() => {
    source = core.getPublicSource(params.src);

    if (!_.contains(source.formats, params.format)) {
      throw new Err('Format %s is not known', params.format).metrics('err.req.format');
    }

    params.z = core.validateZoom(params.z, source);
    params.scale = core.validateScale(params.scale, source);

    params.x = checkType.strToInt(params.x);
    params.y = checkType.strToInt(params.y);
    if (
      !qidx.isValidCoordinate(params.x, params.z) || !qidx.isValidCoordinate(params.y, params.z)
    ) {
      throw new Err('x,y coordinates are not valid, or not allowed for this zoom').metrics('err.req.coords');
    }

    opts = {
      z: params.z,
      x: params.x,
      y: params.y,
    };
    if (params.format !== 'pbf') {
      // Ensure that PNGs are not 32bit
      // TODO: this should be source-configurable
      opts.format = params.format === 'png' ? 'png8:m=h' : params.format;
      if (params.scale) {
        opts.scale = params.scale;
      }
    }
    if (req.query && req.query.lang) {
      if (!langCodeRe.test(req.query.lang)) {
        throw new Err('lang param is not valid').metrics('err.req.lang');
      }
      opts.lang = req.query.lang;
    }

    // fixme: Force all tiles to be treated as vector
    opts.treatAsVector = true;

    return source.getHandler().getAsync(opts);
  }).then((result) => {
    let mx;

    core.setResponseHeaders(res, source, result.headers);

    if (params.format === 'json') {
      // Allow JSON to be shortened to simplify debugging
      res.json(filterJson(req.query, result.data));
    } else {
      res.send(result.data);
    }

    mx = util.format('req.%s.%s.%s', params.src, params.z, params.format);
    if (params.scale) {
      // replace '.' with ',' -- otherwise grafana treats it as a divider
      mx += `.${params.scale.toString().replace('.', ',')}`;
    }
    core.metrics.endTiming(mx, start);
  }).catch(err => core.reportRequestError(err, res)).catch(next);
}
657632
function(req, res, next) {
    Check
    .find({ _id: req.params.id })
    .select({qos: 0})
    .findOne(function(err, check) {
      if (err) return next(err);
      if (!check) return res.json(404, { error: 'failed to load check ' + req.params.id });
      req.check = check;
      next();
    });
  }
1370338
function (req, res, next) {
    if (vulpejs.app.security.ignore) {
      exports.auth.checkAfter(req, res, next);
      return;
    }
    if (!req.cookies.appLanguage || req.cookies.appLanguage === 'undefined') {
      res.cookie('appLanguage', 'pt');
    }
    var skip = false;
    for (var i = 0, len = loginSkip.length; i < len; ++i) {
      var skipUri = vulpejs.app.root.context + loginSkip[i];
      if (skipUri === req.originalUrl || (skipUri !== '/' && req.originalUrl.indexOf(skipUri) === 0)) {
        skip = true;
        break;
      }
    }
    if (!req.isAuthenticated()) {
      if (!skip) {
        req.session['redirect-to'] = req.originalUrl;
        res.redirect(vulpejs.app.root.context + '/login');
        return;
      }
      exports.auth.checkAfter(req, res, next);
    } else {
      var roles = req.session['user-roles'];
      if (skip || !roles || roles.length === 0 || !vulpejs.app.security.routes || vulpejs.app.security.routes.length === 0) {
        exports.auth.checkAfter(req, res, next);
        return;
      }
      var hasRouteRoles = function (route) {
        if (route === '') {
          return false;
        }
        var roleExists = !route.roles || route.roles.length === 0;
        if (!roleExists) {
          for (var i = 0, len = roles.length; i < len; ++i) {
            if (route.roles.indexOf(roles[i]) !== -1) {
              roleExists = true;
              break;
            }
          }
        }
        return roleExists;
      };
      var routeWildcard = '';
      var requestedRoute = '';
      var roleExists = false;
      var routeExists = false;
      var routes = vulpejs.app.security.routes.length;
      var uriCheck = function (value) {
        return (value === '/' && req.originalUrl === value) || (value !== '/' && req.originalUrl.indexOf(value) === 0);
      };
      for (var i = 0; i < routes; ++i) {
        var route = vulpejs.app.security.routes[i];
        if (route.uris && Array.isArray(route.uris)) {
          for (var j = 0; j < route.uris.length; ++j) {
            if (uriCheck(route.uris[j])) {
              requestedRoute = route;
              break;
            }
          }
        } else if (route.uri === '/**') {
          routeWildcard = route;
        } else if (uriCheck(route.uri)) {
          requestedRoute = route;
        }
        if (requestedRoute) {
          break;
        }
      }
      if (((requestedRoute === '' && routeWildcard === '') || hasRouteRoles(requestedRoute)) || (routeWildcard !== '' && hasRouteRoles(routeWildcard))) {
        exports.auth.checkAfter(req, res, next);
      } else {
        res.status(403);
        exports.render(res, 'error', {
          ui: {
            controller: 'Error',
          },
          error: {
            status: 403,
            message: 'Forbidden',
          },
        });
      }
    }
  }
276959
function addUser(req, res, next) {
  res.locals.user = req.user;
  next();
}
745003
function(req, res, next) {
			res.set('XX-Powered-By', 'Restpress');
			req.resource = self;
			req.actionName = actionName;
			req.action = action;
			next();
		}
1002147
function (next) {

            var reqOpts = {
                method: 'GET',
                url: helpers.makeAliasUri(options)
            }

            if(options.auth) {
                reqOpts.auth = {
                    user: options.auth.user,
                    pass: options.auth.password,
                    sendImmediately: false
                };
            }

            helpers.backOffRequest(reqOpts, function (err, res, body) {
                if (err) {
                    return next(err)
                }

                var existingIndices = Object.keys(body)

                // console.log('\nexistingIndices', body)

                var aliasName = helpers.makeIndexName(options)

                // get all aliases pertaining to this collection & are not the index we just created
                // we will remove all of them
                indicesToRemove = existingIndices.filter(function (indexName) {
                    return (indexName.indexOf(aliasName) === 0 && indexName !== versionedIndexName)
                })

                // console.log('\nindicesToRemove', indicesToRemove)

                // generate elasticsearch request body to atomically remove old indices and add the new one
                var requestBody = {
                    actions: [
                        {
                            add: {
                                alias: aliasName,
                                index: versionedIndexName
                            }
                        }
                    ]
                }

                indicesToRemove.forEach(function (indexToRemove) {
                    var removeObj = {
                        remove: {
                            alias: aliasName,
                            index: indexToRemove
                        }
                    }

                    requestBody.actions.unshift(removeObj)
                })

                var reqOpts = {
                    method: 'POST',
                    url: helpers.makeAliasUri(options),
                    body: JSON.stringify(requestBody)
                }

                if(options.auth) {
                    reqOpts.auth = {
                        user: options.auth.user,
                        pass: options.auth.password,
                        sendImmediately: false
                    };
                }

                helpers.backOffRequest(reqOpts, function (err, res, body) {
                    if (err) {
                        return next(err)
                    }

                    if (!helpers.elasticsearchBodyOk(body)) {
                        var error = new Error('Alias deletion error. Elasticsearch reply:'+util.inspect(body, true, 10, true))
                        error.elasticsearchReply = body
                        error.elasticsearchRequestBody = requestBody
                        return next(error)
                    }

                    return next()
                })
            })
        }
92088
function next(err) {
      var fn = fns[++index]
      var params = slice.call(arguments, 0)
      var values = params.slice(1)
      var length = input.length
      var pos = -1

      if (err) {
        done(err)
        return
      }

      /* Copy non-nully input into values. */
      while (++pos < length) {
        if (values[pos] === null || values[pos] === undefined) {
          values[pos] = input[pos]
        }
      }

      input = values

      /* Next or done. */
      if (fn) {
        wrap(fn, next).apply(null, input)
      } else {
        done.apply(null, [null].concat(input))
      }
    }
311084
function(req, res, next) {
      console.log('executing graphql query');
      if (req.url === '/graphql') {
        var schema = getGraphQLSchemaFrom(sails.models);
        require('express-graphql')({
            schema: schema,
            pretty: true
          })(req, res);
      } else {
        return next();
      }
    }
561222
function requestIdMiddleware (req, res, next) {
    // get unique id object
    var uniqueId = randomUniqueId()
    // add data to req
    req.requestId = uniqueId.id
    req.requestCreateTime = uniqueId.timestamp
    // continue
    next()
}
1109043
function putFn (req, res, next) {
    var reqPath = req.params[0];
    var destination = req.body.rename;
    debug('putFn', 'reqPath', reqPath);

    fs.rename(path.join(ramlPath, reqPath), path.join(ramlPath, destination), function (err) {
      if (err) return next(err);
      res.sendStatus(200);
    });
  }