Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

The powered by nodejitsu header #69

Merged
merged 1 commit into from

2 participants

@nicoreed

This prevent jitsu from connecting to haibu instances

This should be merged into master once production has been updated.

@indexzero indexzero merged commit 69e0770 into nodejitsu:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 12, 2011
  1. [minor] got support of `x-powered-by: nodejitsu`

    nicoreed authored
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/jitsu/api/client.js
View
10 lib/jitsu/api/client.js
@@ -66,7 +66,14 @@ Client.prototype.request = function (method, uri /* variable arguments */) {
catch (ex) {
// Ignore Errors
}
-
+
+ if (response.headers['x-powered-by'] !== 'Nodejitsu') {
+ error = new Error('Jitsu requires you to connect to Nodejitsu\'s stack (api.nodejitsu.com)');
+ error.statusCode = "403";
+ error.result = "";
+ return callback(error);
+ }
+
if (Object.keys(jitsu.failCodes).indexOf(statusCode) !== -1) {
error = new Error('Nodejitsu Error (' + statusCode + '): ' + jitsu.failCodes[statusCode]);
error.statusCode = statusCode;
@@ -122,7 +129,6 @@ Client.prototype.upload = function (uri, contentType, file, callback, success) {
catch (ex) {
// Ignore Errors
}
-
if (Object.keys(jitsu.failCodes).indexOf(statusCode) !== -1) {
error = new Error('Nodejitsu Error (' + statusCode + '): ' + jitsu.failCodes[statusCode]);
error.result = result;
Something went wrong with that request. Please try again.