Private
Public Access
1
0

Experimental SSL support

This commit is contained in:
James Magahern
2019-01-22 23:31:36 -08:00
parent 90775ebbba
commit 0cb907e2ad
18 changed files with 370 additions and 47 deletions

View File

@@ -27,20 +27,20 @@
NSString *guid = [self valueForQueryItemWithName:@"guid"];
if (!guid) {
NSLog(@"No query item provided");
MBIMLogInfo(@"No query item provided");
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
break;
}
IMFileTransfer *transfer = [[IMFileTransferCenter sharedInstance] transferForGUID:guid];
if (!transfer) {
NSLog(@"No transfer found for guid: %@", guid);
MBIMLogInfo(@"No transfer found for guid: %@", guid);
response = [[HTTPErrorResponse alloc] initWithErrorCode:404];
break;
}
if (![transfer existsAtLocalPath]) {
NSLog(@"We don't have the file for this yet (still downloading to server?)");
MBIMLogInfo(@"We don't have the file for this yet (still downloading to server?)");
response = [[HTTPErrorResponse alloc] initWithErrorCode:404];
break;
}
@@ -48,7 +48,7 @@
NSString *localPath = [transfer localPath];
NSData *responseData = [NSData dataWithContentsOfFile:localPath];
if (!responseData) {
NSLog(@"Wasn't able to load data from local path: %@", localPath);
MBIMLogInfo(@"Wasn't able to load data from local path: %@", localPath);
response = [[HTTPErrorResponse alloc] initWithErrorCode:404];
break;
}

View File

@@ -25,7 +25,7 @@
NSString *guid = [self valueForQueryItemWithName:@"guid"];
if (!guid) {
NSLog(@"No query item provided");
MBIMLogInfo(@"No query item provided");
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
break;
}
@@ -33,7 +33,7 @@
dispatch_sync([[self class] sharedIMAccessQueue], ^{
IMChat *chat = [sChatRegistry existingChatWithGUID:guid];
if (!chat) {
NSLog(@"Chat with guid: %@ not found", guid);
MBIMLogInfo(@"Chat with guid: %@ not found", guid);
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
} else {
// TODO: be smarter about this and mark individual messages as read? Could lead

View File

@@ -28,7 +28,7 @@
NSString *guid = [self valueForQueryItemWithName:@"guid"];
if (!guid) {
NSLog(@"No query item provided");
MBIMLogInfo(@"No query item provided");
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
break;
}
@@ -37,7 +37,7 @@
dispatch_sync([[self class] sharedIMAccessQueue], ^{
IMChat *chat = [sChatRegistry existingChatWithGUID:guid];
if (!chat) {
NSLog(@"Chat with guid: %@ not found", guid);
MBIMLogInfo(@"Chat with guid: %@ not found", guid);
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
} else {
// Load messages

View File

@@ -44,7 +44,7 @@
}
if (!chat) {
NSLog(@"Chat does not exist: %@", chatGUID);
MBIMLogInfo(@"Chat does not exist: %@", chatGUID);
result = NO;
} else {
[chat sendMessage:reply];

View File

@@ -26,14 +26,14 @@
do {
NSString *filename = [self valueForQueryItemWithName:@"filename"];
if ([filename length] == 0) {
NSLog(@"No filename provided");
MBIMLogInfo(@"No filename provided");
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
break;
}
NSData *attachmentData = self.requestBodyData;
if ([attachmentData length] == 0) {
NSLog(@"No attachment data in request");
MBIMLogInfo(@"No attachment data in request");
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
break;
}
@@ -42,14 +42,14 @@
NSURL *localURL = [NSURL fileURLWithPath:localPath];
BOOL success = [attachmentData writeToURL:localURL atomically:NO];
if (!success) {
NSLog(@"Error writing attachment to temporary directory");
MBIMLogInfo(@"Error writing attachment to temporary directory");
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
break;
}
NSString *guid = [[IMFileTransferCenter sharedInstance] guidForNewOutgoingTransferWithLocalURL:localURL];
if (!guid) {
NSLog(@"There was some problem shuttling the file to IMCore");
MBIMLogInfo(@"There was some problem shuttling the file to IMCore");
response = [[HTTPErrorResponse alloc] initWithErrorCode:500];
break;
}