pixl-server-web 1.3.15 → 1.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/request.js CHANGED
@@ -505,7 +505,7 @@ module.exports = class Request {
505
505
  var headers = arguments[2] || {};
506
506
  var payload = args.query.pretty ? JSON.stringify(json, null, "\t") : JSON.stringify(json);
507
507
 
508
- if (args.query.format && (args.query.format.match(/html/i)) && args.query.callback) {
508
+ if (args.query.format && (args.query.format.match(/html/i)) && args.query.callback && self.config.get('http_legacy_callback_support')) {
509
509
  // old school IFRAME style response
510
510
  headers['Content-Type'] = "text/html";
511
511
  self.sendHTTPResponse( args,
@@ -516,7 +516,7 @@ module.exports = class Request {
516
516
  '</script></head><body>&nbsp;</body></html>' + "\n"
517
517
  );
518
518
  }
519
- else if (args.query.callback) {
519
+ else if (args.query.callback && self.config.get('http_legacy_callback_support')) {
520
520
  // JSON with JS callback wrapper
521
521
  headers['Content-Type'] = "text/javascript";
522
522
  self.sendHTTPResponse( args,
package/lib/response.js CHANGED
@@ -29,12 +29,18 @@ module.exports = class Response {
29
29
  socket_data.url = this.getSelfURL(request, request.url) || request.url;
30
30
  socket_data.ips = args.ips;
31
31
  socket_data.req_id = args.id;
32
+
32
33
  if (this.config.get('http_log_socket_errors')) {
33
34
  this.logError('socket', "Socket closed unexpectedly: " + socket_data.id, socket_data);
34
35
  }
35
36
  else {
36
37
  this.logDebug(9, "Socket closed unexpectedly: " + socket_data.id, socket_data);
37
38
  }
39
+
40
+ args.perf.end();
41
+ var metrics = args.perf.metrics();
42
+ this.emit('metrics', metrics, args);
43
+
38
44
  if (args.callback) {
39
45
  args.callback();
40
46
  delete args.callback;
@@ -44,7 +50,7 @@ module.exports = class Response {
44
50
  if (body && body.pipe && body.destroy) body.destroy();
45
51
 
46
52
  return;
47
- }
53
+ } // destroyed socket
48
54
 
49
55
  // catch double-callback
50
56
  if (args.state == 'writing') {
@@ -136,6 +142,11 @@ module.exports = class Response {
136
142
  url: self.getSelfURL(request, request.url) || request.url
137
143
  });
138
144
  }
145
+
146
+ args.perf.end();
147
+ var metrics = args.perf.metrics();
148
+ self.emit('metrics', metrics, args);
149
+
139
150
  args.callback(); // queue
140
151
  delete args.callback;
141
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-server-web",
3
- "version": "1.3.15",
3
+ "version": "1.3.17",
4
4
  "description": "A web server component for the pixl-server framework.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-server-web",
package/web_server.js CHANGED
@@ -61,12 +61,11 @@ module.exports = Class({
61
61
  "http_log_socket_errors": true,
62
62
  "http_full_uri_match": false,
63
63
  "http_request_timeout": 0,
64
-
65
64
  "http_req_max_dump_enabled": false,
66
65
  "http_req_max_dump_dir": "",
67
66
  "http_req_max_dump_debounce": 10,
68
-
69
- "http_code_response_headers": null
67
+ "http_code_response_headers": null,
68
+ "http_legacy_callback_support": true
70
69
  },
71
70
 
72
71
  conns: null,