This commit is contained in:
Pierre-Olivier Latour
2014-04-07 19:29:33 -07:00
parent fb08e77c0c
commit 794ab5f293
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -448,7 +448,7 @@ static inline NSUInteger _ScanHexNumber(const void* bytes, NSUInteger size) {
if ([_response hasBody]) {
[self _writeBodyWithCompletionBlock:^(BOOL successInner) {
[_response performClose];
[_response performClose]; // TODO: There's nothing we can do on failure as headers have already been sent
}];
}
+2 -2
View File
@@ -39,10 +39,10 @@
@property(nonatomic, readonly) NSDictionary* headers;
@property(nonatomic, readonly) NSString* path;
@property(nonatomic, readonly) NSDictionary* query; // May be nil
@property(nonatomic, readonly) NSString* contentType; // Automatically parsed from headers (nil if request has no body)
@property(nonatomic, readonly) NSString* contentType; // Automatically parsed from headers (nil if request has no body or set to "application/octet-stream" if a body is present without a "Content-Type" header)
@property(nonatomic, readonly) NSUInteger contentLength; // Automatically parsed from headers (NSNotFound if request has no "Content-Length" header)
@property(nonatomic, readonly) NSRange byteRange; // Automatically parsed from headers ([NSNotFound, 0] if request has no "Range" header, [offset, length] for byte range from beginning or [NSNotFound, -bytes] from end)
- (id)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query;
- (BOOL)hasBody; // Convenience method
- (BOOL)hasBody; // Convenience method that checks if "contentType" is not nil
- (BOOL)hasByteRange; // Convenience method that checks "byteRange"
@end
+4 -4
View File
@@ -34,15 +34,15 @@
@end
@interface GCDWebServerResponse : NSObject <GCDWebServerBodyReader>
@property(nonatomic, copy) NSString* contentType; // Default is nil i.e. no body
@property(nonatomic) NSUInteger contentLength; // Default is NSNotFound i.e. undefined
@property(nonatomic, copy) NSString* contentType; // Default is nil i.e. no body (must be set if a body is present)
@property(nonatomic) NSUInteger contentLength; // Default is NSNotFound i.e. undefined (if a body is present but length is undefined, chunked transfer encoding will be enabled)
@property(nonatomic) NSInteger statusCode; // Default is 200
@property(nonatomic) NSUInteger cacheControlMaxAge; // Default is 0 seconds i.e. "no-cache"
@property(nonatomic, getter=isGZipContentEncodingEnabled) BOOL gzipContentEncodingEnabled; // Default is disabled
+ (GCDWebServerResponse*) response;
- (id)init;
- (void)setValue:(NSString*)value forAdditionalHeader:(NSString*)header;
- (BOOL)hasBody; // Convenience method
- (void)setValue:(NSString*)value forAdditionalHeader:(NSString*)header; // Pass nil value to remove header
- (BOOL)hasBody; // Convenience method that checks if "contentType" is not nil
@end
@interface GCDWebServerResponse (Extensions)