HTTPConnection.h
上传用户:kc0325
上传日期:2020-06-20
资源大小:204k
文件大小:2k
源码类别:

iPhone

开发平台:

Objective-C

  1. #import <Foundation/Foundation.h>
  2. #if TARGET_OS_IPHONE
  3. // Note: You may need to add the CFNetwork Framework to your project
  4. #import <CFNetwork/CFNetwork.h>
  5. #endif
  6. @class AsyncSocket;
  7. @class HTTPServer;
  8. @protocol HTTPResponse;
  9. #define HTTPConnectionDidDieNotification  @"HTTPConnectionDidDie"
  10. @interface HTTPConnection : NSObject
  11. {
  12. AsyncSocket *asyncSocket;
  13. HTTPServer *server;
  14. CFHTTPMessageRef request;
  15. int numHeaderLines;
  16. NSString *nonce;
  17. long lastNC;
  18. NSObject<HTTPResponse> *httpResponse;
  19. NSMutableArray *ranges;
  20. NSMutableArray *ranges_headers;
  21. NSString *ranges_boundry;
  22. int rangeIndex;
  23. UInt64 requestContentLength;
  24. UInt64 requestContentLengthReceived;
  25. }
  26. - (id)initWithAsyncSocket:(AsyncSocket *)newSocket forServer:(HTTPServer *)myServer;
  27. - (BOOL)supportsMethod:(NSString *)method atPath:(NSString *)path;
  28. - (BOOL)isSecureServer;
  29. - (NSArray *)sslIdentityAndCertificates;
  30. - (BOOL)isPasswordProtected:(NSString *)path;
  31. - (BOOL)useDigestAccessAuthentication;
  32. - (NSString *)realm;
  33. - (NSString *)passwordForUser:(NSString *)username;
  34. - (NSString *)filePathForURI:(NSString *)path;
  35. - (NSObject<HTTPResponse> *)httpResponseForMethod:(NSString *)method URI:(NSString *)path;
  36. - (void)prepareForBodyWithSize:(UInt64)contentLength;
  37. - (void)processDataChunk:(NSData *)postDataChunk;
  38. - (void)handleVersionNotSupported:(NSString *)version;
  39. - (void)handleAuthenticationFailed;
  40. - (void)handleResourceNotFound;
  41. - (void)handleInvalidRequest:(NSData *)data;
  42. - (void)handleUnknownMethod:(NSString *)method;
  43. - (NSData *)preprocessResponse:(CFHTTPMessageRef)response;
  44. - (NSData *)preprocessErrorResponse:(CFHTTPMessageRef)response;
  45. - (void)die;
  46. @end