Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15482126
D9967.id23915.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9967.id23915.diff
View Options
diff --git a/support/aphlict/server/aphlict_server.js b/support/aphlict/server/aphlict_server.js
--- a/support/aphlict/server/aphlict_server.js
+++ b/support/aphlict/server/aphlict_server.js
@@ -163,29 +163,35 @@
var receive_server = http.createServer(function(request, response) {
// Publishing a notification.
- if (request.method == 'POST') {
- var body = '';
-
- request.on('data', function(data) {
- body += data;
- });
-
- request.on('end', function() {
- try {
- var msg = JSON.parse(body);
-
- debug.log('notification: ' + JSON.stringify(msg));
- ++messages_in;
- transmit(msg);
-
- response.writeHead(200, {'Content-Type': 'text/plain'});
- } catch (err) {
- response.statusCode = 400;
- response.write('400 Bad Request');
- } finally {
- response.end();
- }
- });
+ if (request.url == '/') {
+ if (request.method == 'POST') {
+ var body = '';
+
+ request.on('data', function(data) {
+ body += data;
+ });
+
+ request.on('end', function() {
+ try {
+ var msg = JSON.parse(body);
+
+ debug.log('notification: ' + JSON.stringify(msg));
+ ++messages_in;
+ transmit(msg);
+
+ response.writeHead(200, {'Content-Type': 'text/plain'});
+ } catch (err) {
+ response.statusCode = 400;
+ response.write('400 Bad Request');
+ } finally {
+ response.end();
+ }
+ });
+ } else {
+ response.statusCode = 405;
+ response.write('405 Method Not Allowed');
+ response.end();
+ }
} else if (request.url == '/status/') {
request.on('data', function() {
// We just ignore the request data, but newer versions of Node don't
@@ -208,8 +214,8 @@
response.end();
});
} else {
- response.statusCode = 400;
- response.write('400 Bad Request');
+ response.statusCode = 404;
+ response.write('404 Not Found');
response.end();
}
}).listen(config.admin, config.host);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 10, 3:14 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7738589
Default Alt Text
D9967.id23915.diff (2 KB)
Attached To
Mode
D9967: Make HTTP errors returned from the Aphlict server more specific
Attached
Detach File
Event Timeline
Log In to Comment