summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2014-02-04 01:28:53 +0100
committerChristian Franke <nobody@nowhere.ws>2014-02-04 01:28:53 +0100
commitff8bc5575082e08d5b8232bb61740308a36afa6a (patch)
tree9ec2083e5ab2dbe2ce105e688fe4fb3973c41c0a
parent78e9d025cfcb958c484eef2074604f88fc52f983 (diff)
Fixup control request handling for absent cameras
-rw-r--r--server.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/server.js b/server.js
index 02c5734..c9aea0b 100644
--- a/server.js
+++ b/server.js
@@ -32,7 +32,16 @@ function SimpleProxy(url) {
self.url = url;
self.handle_request = function(req, res) {
- request(self.url).pipe(res);
+ request(self.url, function(err, response, body) {
+ if (err) {
+ console.log("Simple proxy " + self.url + " failed.");
+ console.log(err);
+ res.end();
+ return;
+ }
+ res.write(body);
+ res.end();
+ });
};
}