Commit b006dc90 authored by Felix Paul Kühne's avatar Felix Paul Kühne

patches: fix crash in http server

parent d9cb37d5
From 72b746f89eced49a5e17b53a6e792f3a987efabf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Sun, 16 Jun 2013 23:35:17 +0200
Subject: [PATCH 4/4] fix crash when uploading multiple files
---
Core/HTTPConnection.m | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/Core/HTTPConnection.m b/Core/HTTPConnection.m
index 2742415..95e283a 100644
--- a/Core/HTTPConnection.m
+++ b/Core/HTTPConnection.m
@@ -1215,20 +1215,20 @@ static NSMutableArray *recentNonces;
else
{
/* add the proper MIME type */
- NSString *mimeType;
- NSString *pathExtension = [[httpResponse filePath] pathExtension];
- if ([pathExtension isEqualToString:@"html"] || [pathExtension isEqualToString:@"htm"])
- mimeType = @"text/html";
- else if ([pathExtension isEqualToString:@"js"])
- mimeType = @"text/javascript";
- else if ([pathExtension isEqualToString:@"css"])
- mimeType = @"text/css";
- else if ([pathExtension isEqualToString:@"png"])
- mimeType = @"image/png";
- else if ([pathExtension isEqualToString:@"jpg"] || [pathExtension isEqualToString:@"jpeg"])
- mimeType = @"image/jpeg";
- else
- mimeType = @"text/plain";
+ NSString *mimeType = @"text/plain";
+ if ([httpResponse respondsToSelector:@selector(filePath)]) {
+ NSString *pathExtension = [[httpResponse filePath] pathExtension];
+ if ([pathExtension isEqualToString:@"html"] || [pathExtension isEqualToString:@"htm"])
+ mimeType = @"text/html";
+ else if ([pathExtension isEqualToString:@"js"])
+ mimeType = @"text/javascript";
+ else if ([pathExtension isEqualToString:@"css"])
+ mimeType = @"text/css";
+ else if ([pathExtension isEqualToString:@"png"])
+ mimeType = @"image/png";
+ else if ([pathExtension isEqualToString:@"jpg"] || [pathExtension isEqualToString:@"jpeg"])
+ mimeType = @"image/jpeg";
+ }
[response setHeaderField:@"Content-Type" value:mimeType];
// Write the header response
--
1.8.2.1 (Apple Git-45)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment