HTTPMessage.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * The HTTPMessage class is a simple Objective-C wrapper around Apple's CFHTTPMessage class.
  3. **/
  4. #import <Foundation/Foundation.h>
  5. #if TARGET_OS_IPHONE
  6. // Note: You may need to add the CFNetwork Framework to your project
  7. #import <CFNetwork/CFNetwork.h>
  8. #endif
  9. #define HTTPVersion1_0 ((NSString *)kCFHTTPVersion1_0)
  10. #define HTTPVersion1_1 ((NSString *)kCFHTTPVersion1_1)
  11. @interface HTTPMessage : NSObject
  12. {
  13. CFHTTPMessageRef message;
  14. }
  15. - (id)initEmptyRequest;
  16. - (id)initRequestWithMethod:(NSString *)method URL:(NSURL *)url version:(NSString *)version;
  17. - (id)initResponseWithStatusCode:(NSInteger)code description:(NSString *)description version:(NSString *)version;
  18. - (BOOL)appendData:(NSData *)data;
  19. - (BOOL)isHeaderComplete;
  20. - (NSString *)version;
  21. - (NSString *)method;
  22. - (NSURL *)url;
  23. - (NSInteger)statusCode;
  24. - (NSDictionary *)allHeaderFields;
  25. - (NSString *)headerField:(NSString *)headerField;
  26. - (void)setHeaderField:(NSString *)headerField value:(NSString *)headerFieldValue;
  27. - (NSData *)messageData;
  28. - (NSData *)body;
  29. - (void)setBody:(NSData *)body;
  30. @end