chunking-test.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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);