mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-05-13 00:02:02 +08:00
GCDWebServerGetMimeTypeForExtension() always returns a MIME type
This commit is contained in:
@@ -102,7 +102,7 @@ NSString* GCDWebServerGetMimeTypeForExtension(NSString* extension) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mimeType;
|
return mimeType ? mimeType : kGCDWebServerDefaultMimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* GCDWebServerUnescapeURLString(NSString* string) {
|
NSString* GCDWebServerUnescapeURLString(NSString* string) {
|
||||||
|
|||||||
@@ -306,12 +306,8 @@
|
|||||||
return nil; // TODO: Return 416 status code and "Content-Range: bytes */{file length}" header
|
return nil; // TODO: Return 416 status code and "Content-Range: bytes */{file length}" header
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSString* type = GCDWebServerGetMimeTypeForExtension([path pathExtension]);
|
|
||||||
if (type == nil) {
|
|
||||||
type = kGCDWebServerDefaultMimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((self = [super initWithContentType:type contentLength:(range.location != NSNotFound ? range.length : (NSUInteger)info.st_size)])) {
|
if ((self = [super initWithContentType:GCDWebServerGetMimeTypeForExtension([path pathExtension]) contentLength:(range.location != NSNotFound ? range.length : (NSUInteger)info.st_size)])) {
|
||||||
_path = [path copy];
|
_path = [path copy];
|
||||||
if (range.location != NSNotFound) {
|
if (range.location != NSNotFound) {
|
||||||
_offset = range.location;
|
_offset = range.location;
|
||||||
|
|||||||
Reference in New Issue
Block a user