You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.5 KiB

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