HTTPConnection.h.svn-base
上传用户: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. int lastNC;
  18. NSObject<HTTPResponse> *httpResponse;
  19. NSMutableArray *ranges;
  20. NSMutableArray *ranges_headers;
  21. NSString *ranges_boundry;
  22. int rangeIndex;
  23. UInt64 postContentLength;
  24. UInt64 postTotalBytesReceived;
  25. int dataStartIndex;
  26. NSMutableArray* multipartData;
  27. BOOL postHeaderOK;
  28. }
  29. - (id)initWithAsyncSocket:(AsyncSocket *)newSocket forServer:(HTTPServer *)myServer;
  30. - (BOOL)supportsPOST:(NSString *)path withSize:(UInt64)contentLength;
  31. - (BOOL)isSecureServer;
  32. - (NSArray *)sslIdentityAndCertificates;
  33. - (BOOL)isBrowseable:(NSString *)path;
  34. - (NSString *) createBrowseableIndex:(NSString *)path;
  35. - (BOOL)isPasswordProtected:(NSString *)path;
  36. - (BOOL)useDigestAccessAuthentication;
  37. - (NSString *)realm;
  38. - (NSString *)passwordForUser:(NSString *)username;
  39. - (NSString *)filePathForURI:(NSString *)path;
  40. - (NSObject<HTTPResponse> *)httpResponseForURI:(NSString *)path;
  41. - (void)processPostDataChunk:(NSData *)postDataChunk;
  42. - (void)handleVersionNotSupported:(NSString *)version;
  43. - (void)handleAuthenticationFailed;
  44. - (void)handleResourceNotFound;
  45. - (void)handleInvalidRequest:(NSData *)data;
  46. - (void)handleUnknownMethod:(NSString *)method;
  47. - (NSData *)preprocessResponse:(CFHTTPMessageRef)response;
  48. - (NSData *)preprocessErrorResponse:(CFHTTPMessageRef)response;
  49. - (void)die;
  50. @end