Page MenuHomePhabricator

D9967.id23921.diff
No OneTemporary

D9967.id23921.diff

diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
@@ -82,7 +82,8 @@
}
$server_uri = PhabricatorEnv::getEnvConfig('notification.server-uri');
- $server_uri = new PhutilURI($server_uri);
+ $server_uri = id(new PhutilURI($server_uri))
+ ->setPath('/');
$client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri');
$client_uri = new PhutilURI($client_uri);
diff --git a/src/applications/notification/client/PhabricatorNotificationClient.php b/src/applications/notification/client/PhabricatorNotificationClient.php
--- a/src/applications/notification/client/PhabricatorNotificationClient.php
+++ b/src/applications/notification/client/PhabricatorNotificationClient.php
@@ -40,6 +40,8 @@
private static function postMessage(array $data) {
$server_uri = PhabricatorEnv::getEnvConfig('notification.server-uri');
+ $server_uri = id(new PhutilURI($server_uri))
+ ->setPath('/');
id(new HTTPSFuture($server_uri, json_encode($data)))
->setMethod('POST')
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,33 +163,39 @@
var receive_server = http.createServer(function(request, response) {
// Publishing a notification.
- if (request.method == 'POST') {
- var body = '';
+ if (request.url == '/') {
+ if (request.method == 'POST') {
+ var body = '';
- request.on('data', function(data) {
- body += data;
- });
+ request.on('data', function(data) {
+ body += data;
+ });
- request.on('end', function() {
- try {
- var msg = JSON.parse(body);
+ request.on('end', function() {
+ try {
+ var msg = JSON.parse(body);
- debug.log('notification: ' + JSON.stringify(msg));
- ++messages_in;
- transmit(msg);
+ debug.log('notification: ' + JSON.stringify(msg));
+ ++messages_in;
+ transmit(msg);
- response.writeHead(200, {'Content-Type': 'text/plain'});
- } catch (err) {
- debug.log(
- '<%s> Bad Request! %s',
- request.socket.remoteAddress,
- err);
- response.statusCode = 400;
- response.write('400 Bad Request');
- } finally {
- response.end();
- }
- });
+ response.writeHead(200, {'Content-Type': 'text/plain'});
+ } catch (err) {
+ debug.log(
+ '<%s> Bad Request! %s',
+ request.socket.remoteAddress,
+ err);
+ response.statusCode = 400;
+ response.write('400 Bad Request\n');
+ } finally {
+ response.end();
+ }
+ });
+ } else {
+ response.statusCode = 405;
+ response.write('405 Method Not Allowed\n');
+ response.end();
+ }
} else if (request.url == '/status/') {
request.on('data', function() {
// We just ignore the request data, but newer versions of Node don't
@@ -212,8 +218,8 @@
response.end();
});
} else {
- response.statusCode = 400;
- response.write('400 Bad Request');
+ response.statusCode = 404;
+ response.write('404 Not Found\n');
response.end();
}
}).listen(config.admin, config.host);

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 11, 12:43 PM (4 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7739785
Default Alt Text
D9967.id23921.diff (3 KB)

Event Timeline