mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-04-24 00:00:04 +08:00
Fixes
This commit is contained in:
@@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
#ifdef __LOGGING_HEADER__
|
#ifdef __LOGGING_HEADER__
|
||||||
|
|
||||||
#import __LOGGING_HEADER__
|
// Define __GCDWEBSERVER_LOGGING_HEADER__ as a preprocessor constant to redirect GCDWebServer logging to your own system
|
||||||
|
#import __GCDWEBSERVER_LOGGING_HEADER__
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|||||||
@@ -72,10 +72,10 @@
|
|||||||
@interface GCDWebServerDataResponse (Extensions)
|
@interface GCDWebServerDataResponse (Extensions)
|
||||||
+ (GCDWebServerDataResponse*) responseWithText:(NSString*)text;
|
+ (GCDWebServerDataResponse*) responseWithText:(NSString*)text;
|
||||||
+ (GCDWebServerDataResponse*) responseWithHTML:(NSString*)html;
|
+ (GCDWebServerDataResponse*) responseWithHTML:(NSString*)html;
|
||||||
+ (GCDWebServerDataResponse*) responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables; // Simple template system that replaces all occurences of "%variable%" with corresponding value (encodes using UTF-8)
|
+ (GCDWebServerDataResponse*) responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables;
|
||||||
- (id) initWithText:(NSString*)text; // Encodes using UTF-8
|
- (id) initWithText:(NSString*)text; // Encodes using UTF-8
|
||||||
- (id) initWithHTML:(NSString*)html; // Encodes using UTF-8
|
- (id) initWithHTML:(NSString*)html; // Encodes using UTF-8
|
||||||
- (id) initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables;
|
- (id) initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables; // Simple template system that replaces all occurences of "%variable%" with corresponding value (encodes using UTF-8)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GCDWebServerFileResponse : GCDWebServerResponse {
|
@interface GCDWebServerFileResponse : GCDWebServerResponse {
|
||||||
|
|||||||
@@ -245,11 +245,12 @@
|
|||||||
|
|
||||||
if ((self = [super initWithContentType:type contentLength:info.st_size])) {
|
if ((self = [super initWithContentType:type contentLength:info.st_size])) {
|
||||||
_path = [path copy];
|
_path = [path copy];
|
||||||
if (attachment) {
|
if (attachment) { // TODO: Use http://tools.ietf.org/html/rfc5987 to encode file names with special characters instead of using lossy conversion to ISO 8859-1
|
||||||
NSData* data = [[path lastPathComponent] dataUsingEncoding:NSISOLatin1StringEncoding allowLossyConversion:YES]; // ISO 8859-1
|
NSData* data = [[path lastPathComponent] dataUsingEncoding:NSISOLatin1StringEncoding allowLossyConversion:YES];
|
||||||
NSString* fileName = data ? [[[NSString alloc] initWithData:data encoding:NSISOLatin1StringEncoding] autorelease] : nil;
|
NSString* fileName = data ? [[NSString alloc] initWithData:data encoding:NSISOLatin1StringEncoding] : nil;
|
||||||
if (fileName) {
|
if (fileName) {
|
||||||
[self setValue:[NSString stringWithFormat:@"attachment; filename=\"%@\"", fileName] forAdditionalHeader:@"Content-Disposition"]; // TODO: Use http://tools.ietf.org/html/rfc5987
|
[self setValue:[NSString stringWithFormat:@"attachment; filename=\"%@\"", fileName] forAdditionalHeader:@"Content-Disposition"];
|
||||||
|
[fileName release];
|
||||||
} else {
|
} else {
|
||||||
DNOT_REACHED();
|
DNOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user