Skip to content

Commit

Permalink
Handle unknown request types
Browse files Browse the repository at this point in the history
// FREEBIE
  • Loading branch information
liliakai committed Apr 8, 2017
1 parent 3684001 commit a72c296
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions js/libtextsecure.js
Expand Up @@ -38253,8 +38253,13 @@ MessageReceiver.prototype.extend({
// We do the message decryption here, instead of in the ordered pending queue,
// to avoid exposing the time it took us to process messages through the time-to-ack.

// TODO: handle different types of requests. for now we blindly assume
// PUT /messages <encrypted Envelope>
// TODO: handle different types of requests.
if (request.path !== '/api/v1/message') {
console.log('got request', request.verb, request.path);
request.respond(200, 'OK');
return;
}

textsecure.crypto.decryptWebsocketMessage(request.body, this.signalingKey).then(function(plaintext) {
var envelope = textsecure.protobuf.Envelope.decode(plaintext);
// After this point, decoding errors are not the server's
Expand Down
9 changes: 7 additions & 2 deletions libtextsecure/message_receiver.js
Expand Up @@ -62,8 +62,13 @@ MessageReceiver.prototype.extend({
// We do the message decryption here, instead of in the ordered pending queue,
// to avoid exposing the time it took us to process messages through the time-to-ack.

// TODO: handle different types of requests. for now we blindly assume
// PUT /messages <encrypted Envelope>
// TODO: handle different types of requests.
if (request.path !== '/api/v1/message') {
console.log('got request', request.verb, request.path);
request.respond(200, 'OK');
return;
}

textsecure.crypto.decryptWebsocketMessage(request.body, this.signalingKey).then(function(plaintext) {
var envelope = textsecure.protobuf.Envelope.decode(plaintext);
// After this point, decoding errors are not the server's
Expand Down

0 comments on commit a72c296

Please sign in to comment.