1 |
|
2 | (function() {
|
3 | var utils;
|
4 |
|
5 | utils = require('./utils');
|
6 |
|
7 | exports.app = {
|
8 | chunking_test: function(req, res, _, next_filter) {
|
9 | var write;
|
10 | res.setHeader('Content-Type', 'application/javascript; charset=UTF-8');
|
11 | res.writeHead(200);
|
12 | write = (function(_this) {
|
13 | return function(payload) {
|
14 | var x;
|
15 | try {
|
16 | return res.write(payload + '\n');
|
17 | } catch (error) {
|
18 | x = error;
|
19 | }
|
20 | };
|
21 | })(this);
|
22 | utils.timeout_chain([
|
23 | [
|
24 | 0, (function(_this) {
|
25 | return function() {
|
26 | return write('h');
|
27 | };
|
28 | })(this)
|
29 | ], [
|
30 | 1, (function(_this) {
|
31 | return function() {
|
32 | return write(Array(2049).join(' ') + 'h');
|
33 | };
|
34 | })(this)
|
35 | ], [
|
36 | 5, (function(_this) {
|
37 | return function() {
|
38 | return write('h');
|
39 | };
|
40 | })(this)
|
41 | ], [
|
42 | 25, (function(_this) {
|
43 | return function() {
|
44 | return write('h');
|
45 | };
|
46 | })(this)
|
47 | ], [
|
48 | 125, (function(_this) {
|
49 | return function() {
|
50 | return write('h');
|
51 | };
|
52 | })(this)
|
53 | ], [
|
54 | 625, (function(_this) {
|
55 | return function() {
|
56 | return write('h');
|
57 | };
|
58 | })(this)
|
59 | ], [
|
60 | 3125, (function(_this) {
|
61 | return function() {
|
62 | write('h');
|
63 | return res.end();
|
64 | };
|
65 | })(this)
|
66 | ]
|
67 | ]);
|
68 | return true;
|
69 | },
|
70 | info: function(req, res, _) {
|
71 | var info;
|
72 | info = {
|
73 | websocket: this.options.websocket,
|
74 | origins: !this.options.disable_cors ? ['*:*'] : void 0,
|
75 | cookie_needed: !!this.options.jsessionid,
|
76 | entropy: utils.random32()
|
77 | };
|
78 | if (typeof this.options.base_url === 'function') {
|
79 | info.base_url = this.options.base_url();
|
80 | } else if (this.options.base_url) {
|
81 | info.base_url = this.options.base_url;
|
82 | }
|
83 | res.setHeader('Content-Type', 'application/json; charset=UTF-8');
|
84 | res.writeHead(200);
|
85 | return res.end(JSON.stringify(info));
|
86 | },
|
87 | info_options: function(req, res) {
|
88 | res.statusCode = 204;
|
89 | res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
|
90 | res.setHeader('Access-Control-Max-Age', res.cache_for);
|
91 | return '';
|
92 | }
|
93 | };
|
94 |
|
95 | }).call(this);
|