@@ -57,26 +57,26 @@ + (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range {
5757}
5858
5959+ (instancetype )responseWithFile : (NSString *)path byteRange : (NSRange )range isAttachment : (BOOL )attachment {
60- return [[[self class ] alloc ] initWithFile: path byteRange: range isAttachment: attachment];
60+ return [[[self class ] alloc ] initWithFile: path byteRange: range isAttachment: attachment mimeTypeOverrides: nil ];
6161}
6262
6363- (instancetype )initWithFile : (NSString *)path {
64- return [self initWithFile: path byteRange: NSMakeRange (NSUIntegerMax, 0 ) isAttachment: NO ];
64+ return [self initWithFile: path byteRange: NSMakeRange (NSUIntegerMax, 0 ) isAttachment: NO mimeTypeOverrides: nil ];
6565}
6666
6767- (instancetype )initWithFile : (NSString *)path isAttachment : (BOOL )attachment {
68- return [self initWithFile: path byteRange: NSMakeRange (NSUIntegerMax, 0 ) isAttachment: attachment];
68+ return [self initWithFile: path byteRange: NSMakeRange (NSUIntegerMax, 0 ) isAttachment: attachment mimeTypeOverrides: nil ];
6969}
7070
7171- (instancetype )initWithFile : (NSString *)path byteRange : (NSRange )range {
72- return [self initWithFile: path byteRange: range isAttachment: NO ];
72+ return [self initWithFile: path byteRange: range isAttachment: NO mimeTypeOverrides: nil ];
7373}
7474
7575static inline NSDate * _NSDateFromTimeSpec (const struct timespec* t) {
7676 return [NSDate dateWithTimeIntervalSince1970: ((NSTimeInterval )t->tv_sec + (NSTimeInterval )t->tv_nsec / 1000000000.0 )];
7777}
7878
79- - (instancetype )initWithFile : (NSString *)path byteRange : (NSRange )range isAttachment : (BOOL )attachment {
79+ - (instancetype )initWithFile : (NSString *)path byteRange : (NSRange )range isAttachment : (BOOL )attachment mimeTypeOverrides : ( NSDictionary *) overrides {
8080 struct stat info;
8181 if (lstat ([path fileSystemRepresentation ], &info) || !(info.st_mode & S_IFREG)) {
8282 GWS_DNOT_REACHED ();
@@ -129,7 +129,7 @@ - (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachme
129129 }
130130 }
131131
132- self.contentType = GCDWebServerGetMimeTypeForExtension ([_path pathExtension ]);
132+ self.contentType = GCDWebServerGetMimeTypeForExtension ([_path pathExtension ], overrides );
133133 self.contentLength = _size;
134134 self.lastModifiedDate = _NSDateFromTimeSpec (&info.st_mtimespec );
135135 self.eTag = [NSString stringWithFormat: @" %llu /%li /%li " , info.st_ino, info.st_mtimespec.tv_sec, info.st_mtimespec.tv_nsec];
0 commit comments