<commit_before>url = require('url')
querystring = require('querystring')
fs = require('fs')

utils = require('./utils')


execute_request = (app, funs, req, res, data) ->
    try
        while funs.length > 0
            fun = funs.shift()
            req.last_fun = fun
            data = app[fun](req, res, data, req.next_filter)
    catch x
        if typeof x is 'object' and 'status' of x
            if x.status is 0
                true
            else if 'handle_' + x.status of app
                app['handle_' + x.status](req, res, x)
            else
                app.handle_error(req, res, x)
        else
           app.handle_error(req, res, x)

class WebJS
    constructor: (@app, @dispatcher) ->

    handler: (req, res, head) ->
        that = this
        utils.objectExtend(req, url.parse(req.url, true))

        found = false
        allowed_methods = []
        for row in @dispatcher
            [method, path, funs] = row
            if $.type(path) isnt "array"
                path = [path]
            # path[0] must be a regexp
            m = req.pathname.match(path[0])
            if not m
                continue
            if req.method isnt method
                allowed_methods.push(method)
                continue
            for i in [1...path.length]<commit_msg>Forgot to remove one last jquery reference.<commit_after>url = require('url')
querystring = require('querystring')
fs = require('fs')

utils = require('./utils')


execute_request = (app, funs, req, res, data) ->
    try
        while funs.length > 0
            fun = funs.shift()
            req.last_fun = fun
            data = app[fun](req, res, data, req.next_filter)
    catch x
        if typeof x is 'object' and 'status' of x
            if x.status is 0
                true
            else if 'handle_' + x.status of app
                app['handle_' + x.status](req, res, x)
            else
                app.handle_error(req, res, x)
        else
           app.handle_error(req, res, x)

class WebJS
    constructor: (@app, @dispatcher) ->

    handler: (req, res, head) ->
        that = this
        utils.objectExtend(req, url.parse(req.url, true))

        found = false
        allowed_methods = []
        for row in @dispatcher
            [method, path, funs] = row
            if path.constructor isnt Array
                path = [path]
            # path[0] must be a regexp
            m = req.pathname.match(path[0])
            if not m
                continue
            if req.method isnt method
                allowed_methods.push(method)
                continue
            for i in [1...path.length]
{'fraction_non_alphanumeric': 0.10716981132075472, 'fraction_numerical': 0.0037735849056603774, 'mean_word_length': 1.505671077504726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7173603', 'n_tokens_mistral': 789, 'n_tokens_neox': 758, 'n_words': 231}