source: trip-planner-front/node_modules/sockjs/lib/iframe.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1// Generated by CoffeeScript 1.12.7
2(function() {
3 var iframe_template, utils;
4
5 utils = require('./utils');
6
7 iframe_template = "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <script src=\"{{ sockjs_url }}\"></script>\n <script>\n document.domain = document.domain;\n SockJS.bootstrap_iframe();\n </script>\n</head>\n<body>\n <h2>Don't panic!</h2>\n <p>This is a SockJS hidden iframe. It's used for cross domain magic.</p>\n</body>\n</html>";
8
9 exports.app = {
10 iframe: function(req, res) {
11 var content, context, k, quoted_md5;
12 context = {
13 '{{ sockjs_url }}': this.options.sockjs_url
14 };
15 content = iframe_template;
16 for (k in context) {
17 content = content.replace(k, context[k]);
18 }
19 quoted_md5 = '"' + utils.md5_hex(content) + '"';
20 if ('if-none-match' in req.headers && req.headers['if-none-match'] === quoted_md5) {
21 res.statusCode = 304;
22 return '';
23 }
24 res.setHeader('Content-Type', 'text/html; charset=UTF-8');
25 res.setHeader('ETag', quoted_md5);
26 return content;
27 }
28 };
29
30}).call(this);
Note: See TracBrowser for help on using the repository browser.